Author: piumarta Date: 2009-08-26 12:01:08 -0700 (Wed, 26 Aug 2009) New Revision: 2092 Modified: trunk/platforms/unix/ChangeLog trunk/platforms/unix/cmake/Plugins.cmake trunk/platforms/unix/cmake/Utils.cmake Log: add PLUGIN_FIND and PLUGIN_REQUIRE macros Modified: trunk/platforms/unix/ChangeLog =================================================================== --- trunk/platforms/unix/ChangeLog 2009-08-26 05:24:14 UTC (rev 2091) +++ trunk/platforms/unix/ChangeLog 2009-08-26 19:01:08 UTC (rev 2092) @@ -1,3 +1,8 @@ +2009-08-26 <[hidden email]> + + * cmake/Plugins.cmake: Add PLUGIN_FIND and PLUGIN_REQUIRE macros. + * cmake/Utils.cmake: Add macro LIST_APPEND. + 2009-08-25 <[hidden email]> * plugins/SqueakFFIPrims/config.cmake: Check for libffi via Modified: trunk/platforms/unix/cmake/Plugins.cmake =================================================================== --- trunk/platforms/unix/cmake/Plugins.cmake 2009-08-26 05:24:14 UTC (rev 2091) +++ trunk/platforms/unix/cmake/Plugins.cmake 2009-08-26 19:01:08 UTC (rev 2092) @@ -1,6 +1,6 @@ # Figure out which plugins to build and create a configuration for each. # -# Last edited: 2009-08-25 13:46:02 by piumarta on ubuntu.piumarta.com +# Last edited: 2009-08-26 11:58:56 by piumarta on ubuntu.piumarta.com FILE (STRINGS ${src}/plugins.int plugins_int) STRING (REGEX REPLACE ".*= (.*)" "\\1" plugins_int ${plugins_int}) @@ -67,19 +67,19 @@ ENDMACRO (PLUGIN_SOURCES) MACRO (PLUGIN_DEFINITIONS) - SET (${plugin}_definitions ${${plugin}_definitions} ${ARGV}) + LIST_APPEND (${plugin}_definitions ${ARGV}) ENDMACRO (PLUGIN_DEFINITIONS) MACRO (PLUGIN_INCLUDE_DIRECTORIES) - SET (${plugin}_include_directories ${${plugin}_include_directories} ${ARGV}) + LIST_APPEND (${plugin}_include_directories ${ARGV}) ENDMACRO (PLUGIN_INCLUDE_DIRECTORIES) MACRO (PLUGIN_LINK_DIRECTORIES) - SET (${plugin}_link_directories ${${plugin}_link_directories} ${ARGV}) + LIST_APPEND (${plugin_target}_link_directories ${ARGV}) ENDMACRO (PLUGIN_LINK_DIRECTORIES) MACRO (PLUGIN_LINK_LIBRARIES) - SET (${plugin}_link_libraries ${${plugin}_link_libraries} ${ARGV}) + LIST_APPEND (${plugin_target}_link_libraries ${ARGV}) ENDMACRO (PLUGIN_LINK_LIBRARIES) MACRO (CONFIGURE_PLUGIN_LIST plugins_list) @@ -91,6 +91,11 @@ FILE_APPEND (${bld}/${plugin}/config.cmake ${dir}/${plugin}/config.cmake) ENDFOREACH (dir) #MESSAGE ("-- plugin ${plugin}") + IF (${plugins_list} STREQUAL "plugins_int") + SET (plugin_target "vm") + ELSE () + SET (plugin_target "${plugin}") + ENDIF (${plugins_list} STREQUAL "plugins_int") SET (plugin_disabled) INCLUDE (${bld}/${plugin}/config.cmake) IF (OPT_without-${plugin}) @@ -132,9 +137,65 @@ ENDMACRO (BUILD_PLUGINS) MACRO (PLUGIN_MESSAGE msg) - MESSAGE ("-- ${plugin}: ${msg}") + MESSAGE (STATUS "${plugin}: ${msg}") ENDMACRO (PLUGIN_MESSAGE) +MACRO (PLUGIN_FIND_INCLUDE VAR NAME) + FIND_PATH (${VAR}_H ${NAME} ${${plugin_target}_include_directories} ${ARGN}) + IF (${VAR}_H) + PLUGIN_MESSAGE ("${${VAR}_H}/${NAME}") + SET (HAVE_${VAR}_H 1) + PLUGIN_INCLUDE_DIRECTORIES (${${VAR}_H}) + ELSE () + PLUGIN_MESSAGE ("${NAME} not found") + ENDIF () +ENDMACRO () + +MACRO (PLUGIN_REQUIRE_INCLUDE VAR NAME) + PLUGIN_FIND_INCLUDE(${VAR} ${NAME} ${ARGN}) + IF (NOT ${VAR}_H) + PLUGIN_DISABLE () + ENDIF () +ENDMACRO () + +MACRO (PLUGIN_FIND_LIBRARY VAR NAME) + FIND_LIBRARY (LIB${VAR} ${NAME}) + IF (LIB${VAR}) + PLUGIN_MESSAGE ("${LIB${VAR}}") + SET (HAVE_LIB${VAR} 1) + PLUGIN_LINK_LIBRARIES (${LIB${VAR}}) + ELSE () + PLUGIN_MESSAGE ("lib${NAME} not found") + ENDIF () +ENDMACRO () + +MACRO (PLUGIN_REQUIRE_LIBRARY VAR NAME) + PLUGIN_FIND_LIBRARY(${VAR} ${NAME}) + if (NOT LIB${VAR}) + PLUGIN_DISABLE () + ENDIF () +ENDMACRO () + +MACRO (PLUGIN_FIND_PACKAGE VAR NAME) + IF (PKG_CONFIG_FOUND) + PKG_CHECK_MODULES (${VAR} ${NAME}) + IF (${VAR}_FOUND) + PLUGIN_MESSAGE ("${NAME} found") + SET (HAVE_${VAR} 1) + PLUGIN_INCLUDE_DIRECTORIES (${${VAR}_INCLUDE_DIRS}) + PLUGIN_LINK_DIRECTORIES (${${VAR}_LIBRARY_DIRS}) + PLUGIN_LINK_LIBRARIES (${${VAR}_LIBRARIES}) + ENDIF () + ENDIF () +ENDMACRO () + +MACRO (PLUGIN_REQUIRE_PACKAGE VAR NAME) + PLUGIN_FIND_PACKAGE(${VAR} ${NAME}) + IF (NOT ${VAR}_FOUND) + PLUGIN_DISABLE () + ENDIF () +ENDMACRO () + MACRO (EXPECT_UNDEFINED_SYMBOLS) IF (APPLE) SET (CMAKE_SHARED_MODULE_CREATE_C_FLAGS "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -flat_namespace -undefined suppress") Modified: trunk/platforms/unix/cmake/Utils.cmake =================================================================== --- trunk/platforms/unix/cmake/Utils.cmake 2009-08-26 05:24:14 UTC (rev 2091) +++ trunk/platforms/unix/cmake/Utils.cmake 2009-08-26 19:01:08 UTC (rev 2092) @@ -1,25 +1,30 @@ # Some random useful things to avoid repetition # -# Last edited: 2009-08-13 20:28:39 by piumarta on emilia-2.local +# Last edited: 2009-08-26 10:41:32 by piumarta on ubuntu.piumarta.com MACRO (STRING_APPEND var str) - IF (DEFINED ${var}) - SET (${var} "${${var}} ${str}") - ELSE (DEFINED ${var}) - SET (${var} "${str}") - ENDIF (DEFINED ${var}) + IF (DEFINED ${var}) + SET (${var} "${${var}} ${str}") + ELSE (DEFINED ${var}) + SET (${var} "${str}") + ENDIF (DEFINED ${var}) ENDMACRO (STRING_APPEND) +MACRO (LIST_APPEND list) + LIST (APPEND ${list} "${ARGN}") + LIST (REMOVE_DUPLICATES ${list}) +ENDMACRO (LIST_APPEND) + MACRO (FILE_APPEND to from) - IF (EXISTS ${from}) - FILE (READ ${from} tmp) - FILE (APPEND ${to} "${tmp}") - ENDIF (EXISTS ${from}) + IF (EXISTS ${from}) + FILE (READ ${from} tmp) + FILE (APPEND ${to} "${tmp}") + ENDIF (EXISTS ${from}) ENDMACRO (FILE_APPEND) MACRO (FILE_COPY to from) - IF (EXISTS ${from}) - FILE (READ ${from} tmp) - FILE (WRITE ${to} "${tmp}") - ENDIF (EXISTS ${from}) + IF (EXISTS ${from}) + FILE (READ ${from} tmp) + FILE (WRITE ${to} "${tmp}") + ENDIF (EXISTS ${from}) ENDMACRO (FILE_COPY) |
Free forum by Nabble | Edit this page |