From 46a89b00ad6b0e4e90d8b5a4571ac7fd32eb6845 Mon Sep 17 00:00:00 2001 From: flaviojs Date: Thu, 21 Jul 2011 06:47:12 +0000 Subject: * CMake: Only install template files if they don't already exist. * CMake: Added plugin targets. * CMake: Added options BUILD_* to build the converters and individual plugins. (default=OFF) * CMake: Added option WITH_CPACK for package creation. (default=ON) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14918 54d463be-8e91-2dee-dedb-b68131a5f0ec --- CMakeLists.txt | 66 +++++++++---- Changelog-Trunk.txt | 5 + src/CMakeLists.txt | 2 +- src/char/CMakeLists.txt | 7 +- src/char_sql/CMakeLists.txt | 7 +- src/common/CMakeLists.txt | 4 +- src/login/sql/CMakeLists.txt | 7 +- src/login/txt/CMakeLists.txt | 7 +- src/map/sql/CMakeLists.txt | 7 +- src/map/txt/CMakeLists.txt | 7 +- src/plugins/CMakeLists.txt | 175 +++++++++++++++++++++++++++++++++ src/tool/CMakeLists.txt | 6 +- src/txt-converter/CMakeLists.txt | 3 + src/txt-converter/char/CMakeLists.txt | 13 +-- src/txt-converter/login/CMakeLists.txt | 13 +-- 15 files changed, 256 insertions(+), 73 deletions(-) create mode 100644 src/plugins/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index e2be5c28f..0aee569a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -402,13 +402,16 @@ set( CPACK_PACKAGE_VERSION ${SVNVERSION} ) set( CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE ) #set( CPACK_MONOLITHIC_INSTALL ON ) include( CPACK OPTIONAL RESULT_VARIABLE HAVE_CPACK ) -if( NOT HAVE_CPACK ) +if( HAVE_CPACK ) + option( WITH_CPACK "enable building packages with CPack ('package' target)" ON ) +endif() +if( NOT WITH_CPACK ) # empty replacements macro( cpack_add_component_group ) endmacro() macro( cpack_add_component ) endmacro() - message( STATUS "CPACK not found, package creation disabled" ) + message( STATUS "Disabled package creation" ) endif() set( Runtime "Runtime files" CACHE INTERNAL "" ) @@ -427,8 +430,8 @@ cpack_add_component( Development_base DESCRIPTION ${Development_base} DISPLAY_NA # # install stuff # -option( WITH_COMPONENT_RUNTIME "install/package files needed to run the project" ON ) -option( WITH_COMPONENT_DEVELOPMENT "install/package files needed to build the project" OFF ) +option( INSTALL_COMPONENT_RUNTIME "install/package files needed to run the project" ON ) +option( INSTALL_COMPONENT_DEVELOPMENT "install/package files needed to build the project" OFF ) option( INSTALL_TO_PATH "copy files to INSTALL_PATH" OFF ) option( INSTALL_TO_SOURCE "copy files to source directory, skips what is already there (${CMAKE_CURRENT_SOURCE_DIR})" OFF ) option( INSTALL_TO_SUBDIR "copy files to subdirectory (${CMAKE_CURRENT_BINARY_DIR}/install)" OFF ) @@ -513,7 +516,7 @@ set( RUNTIME_DIRECTORIES ) if( INSTALL_TO_SOURCE )# skip, already in the source dir else() - if( WITH_COMPONENT_RUNTIME ) + if( INSTALL_COMPONENT_RUNTIME ) install( FILES ${RUNTIME_FILES} DESTINATION "." COMPONENT Runtime_base ) @@ -524,8 +527,8 @@ else() PATTERN ${SVN_FOLDER_PATTERN} EXCLUDE PATTERN "conf/import-tmpl" EXCLUDE ) endforeach() - endif() - if( WITH_COMPONENT_DEVELOPMENT ) + endif( INSTALL_COMPONENT_RUNTIME ) + if( INSTALL_COMPONENT_DEVELOPMENT ) install( FILES ${DEVELOPMENT_FILES} DESTINATION "." COMPONENT Development_base ) @@ -535,19 +538,46 @@ else() COMPONENT Development_base PATTERN ${SVN_FOLDER_PATTERN} EXCLUDE ) endforeach() - endif() + endif( INSTALL_COMPONENT_DEVELOPMENT ) endif() -if( WITH_COMPONENT_RUNTIME ) +if( INSTALL_COMPONENT_RUNTIME ) # templates - install( DIRECTORY "save-tmpl/" - DESTINATION "save" - COMPONENT Runtime_templates - PATTERN ${SVN_FOLDER_PATTERN} EXCLUDE ) - install( DIRECTORY "conf/import-tmpl/" - DESTINATION "conf/import" - COMPONENT Runtime_templates - PATTERN ${SVN_FOLDER_PATTERN} EXCLUDE ) -endif() + set( _TEMPLATES + "save-tmpl" "save" + "conf/import-tmpl" "conf/import" + ) + set( INSTALL_TEMPLATES_FILE "${CMAKE_CURRENT_BINARY_DIR}/InstallTemplates.cmake" ) + file( WRITE "${INSTALL_TEMPLATES_FILE}" + "macro( INSTALL_TEMPLATE _SRC _DST )\n" + " set( SRC \"${CMAKE_CURRENT_SOURCE_DIR}/\${_SRC}\" )\n" + " set( DST \"\${CMAKE_INSTALL_PREFIX}/\${_DST}\" )\n" + " if( EXISTS \"\${DST}\" )\n" + " message( \"-- Already exists: \${DST}\" )\n" + " else()\n" + " message( \"-- Installing template: \${DST}\" )\n" + " execute_process( COMMAND \"${CMAKE_COMMAND}\" -E copy \"\${SRC}\" \"\${DST}\" )\n" + " endif()\n" + "endmacro()\n" + ) + while( _TEMPLATES ) + list( GET _TEMPLATES 0 _SRC ) + list( GET _TEMPLATES 1 _DST ) + list( REMOVE_AT _TEMPLATES 0 1 ) + if( IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${_SRC}" ) + file( GLOB _PATHS "${CMAKE_CURRENT_SOURCE_DIR}/${_SRC}/*" ) + foreach( _PATH IN ITEMS ${_PATHS} ) + string( REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/${_SRC}/" "" _PATH "${_PATH}" ) + if( NOT "${_PATH}" MATCHES "${SVN_FOLDER_PATTERN}" ) + list( APPEND _TEMPLATES "${_SRC}/${_PATH}" "${_DST}/${_PATH}" ) + endif() + endforeach() + else() + file( APPEND "${INSTALL_TEMPLATES_FILE}" "INSTALL_TEMPLATE( \"${_SRC}\" \"${_DST}\" )\n" ) + endif() + endwhile() + install( SCRIPT "${INSTALL_TEMPLATES_FILE}" + COMPONENT Runtime_templates ) +endif( INSTALL_COMPONENT_RUNTIME ) # diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 14445a960..c000ed698 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -1,5 +1,10 @@ Date Added +2011/07/21 + * CMake: Only install template files if they don't already exist. [FlavioJS] + * CMake: Added plugin targets. + * CMake: Added options BUILD_* to build the converters and individual plugins. (default=OFF) + * CMake: Added option WITH_CPACK for package creation. (default=ON) 2011/07/20 * Made GCOLLECT use it's debug functions. [FlavioJS] * Turned off garbage collection for GCOLLECT since there's nothing to do with explicit frees. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9415fc82c..4233bcb12 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -6,4 +6,4 @@ add_subdirectory( char_sql ) add_subdirectory( map ) add_subdirectory( tool ) add_subdirectory( txt-converter ) -#add_subdirectory( plugins ) +add_subdirectory( plugins ) diff --git a/src/char/CMakeLists.txt b/src/char/CMakeLists.txt index 29bfeb6fe..92c9f2934 100644 --- a/src/char/CMakeLists.txt +++ b/src/char/CMakeLists.txt @@ -42,17 +42,14 @@ add_executable( char-server ${SOURCE_FILES} ) add_dependencies( char-server ${DEPENDENCIES} ) target_link_libraries( char-server ${LIBRARIES} ${DEPENDENCIES} ) set_target_properties( char-server PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) -if( WITH_COMPONENT_RUNTIME ) +if( INSTALL_COMPONENT_RUNTIME ) cpack_add_component( Runtime_charserver_txt DESCRIPTION "char-server (txt version)" DISPLAY_NAME "char-server" GROUP Runtime ) install( TARGETS char-server DESTINATION "." COMPONENT Runtime_charserver_txt ) -endif() -set( HAVE_char-server ON CACHE BOOL "char-server target is available" ) -mark_as_advanced( HAVE_char-server ) +endif( INSTALL_COMPONENT_RUNTIME ) set( TARGET_LIST ${TARGET_LIST} char-server CACHE INTERNAL "" ) message( STATUS "Creating target char-server - done" ) else() message( STATUS "Skipping target char-server (requires common_base)" ) -unset( HAVE_char-server CACHE ) endif() diff --git a/src/char_sql/CMakeLists.txt b/src/char_sql/CMakeLists.txt index 12c5b078f..cbdee1669 100644 --- a/src/char_sql/CMakeLists.txt +++ b/src/char_sql/CMakeLists.txt @@ -48,17 +48,14 @@ add_executable( char-server_sql ${SOURCE_FILES} ) add_dependencies( char-server_sql ${DEPENDENCIES} ) target_link_libraries( char-server_sql ${LIBRARIES} ${DEPENDENCIES} ) set_target_properties( char-server_sql PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) -if( WITH_COMPONENT_RUNTIME ) +if( INSTALL_COMPONENT_RUNTIME ) cpack_add_component( Runtime_charserver_sql DESCRIPTION "char-server (sql version)" DISPLAY_NAME "char-server_sql" GROUP Runtime ) install( TARGETS char-server_sql DESTINATION "." COMPONENT Runtime_charserver_sql ) -endif() +endif( INSTALL_COMPONENT_RUNTIME ) set( HAVE_char-server_sql ON CACHE BOOL "char-server_sql target is available" ) -mark_as_advanced( HAVE_char-server_sql ) -set( TARGET_LIST ${TARGET_LIST} char-server_sql CACHE INTERNAL "" ) message( STATUS "Creating target char-server_sql - done" ) else() message( STATUS "Skipping target char-server_sql (requires common_sql)" ) -unset( HAVE_char-server_sql CACHE ) endif() diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 3fb95e5e0..6f117c6d5 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -12,11 +12,11 @@ endif() set( GLOBAL_INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "" ) set( SVNVERSION ${SVNVERSION} CACHE STRING "SVN version of the source code" ) -if( WITH_COMPONENT_DEVELOPMENT ) +if( INSTALL_COMPONENT_DEVELOPMENT ) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/svnversion.h DESTINATION "src/common" COMPONENT Development_base ) -endif() +endif( INSTALL_COMPONENT_DEVELOPMENT ) message( STATUS "Creating svnversion.h - done" ) diff --git a/src/login/sql/CMakeLists.txt b/src/login/sql/CMakeLists.txt index 85ad44e94..153d9562f 100644 --- a/src/login/sql/CMakeLists.txt +++ b/src/login/sql/CMakeLists.txt @@ -28,17 +28,14 @@ add_executable( login-server_sql ${SOURCE_FILES} ) add_dependencies( login-server_sql ${DEPENDENCIES} ) target_link_libraries( login-server_sql ${LIBRARIES} ${DEPENDENCIES} ) set_target_properties( login-server_sql PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) -if( WITH_COMPONENT_RUNTIME ) +if( INSTALL_COMPONENT_RUNTIME ) cpack_add_component( Runtime_loginserver_sql DESCRIPTION "login-server (sql version)" DISPLAY_NAME "login-server_sql" GROUP Runtime ) install( TARGETS login-server_sql DESTINATION "." COMPONENT Runtime_loginserver_sql ) -endif() -set( HAVE_login-server_sql ON CACHE BOOL "login-server_sql target is available" ) -mark_as_advanced( HAVE_login-server_sql ) +endif( INSTALL_COMPONENT_RUNTIME ) set( TARGET_LIST ${TARGET_LIST} login-server_sql CACHE INTERNAL "" ) message( STATUS "Creating target login-server_sql - done" ) else() message( STATUS "Skipping target login-server_sql (requires common_sql)" ) -unset( HAVE_login-server_sql CACHE ) endif() diff --git a/src/login/txt/CMakeLists.txt b/src/login/txt/CMakeLists.txt index a8d1246b7..75e055903 100644 --- a/src/login/txt/CMakeLists.txt +++ b/src/login/txt/CMakeLists.txt @@ -28,17 +28,14 @@ add_executable( login-server ${SOURCE_FILES} ) add_dependencies( login-server ${DEPENDENCIES} ) target_link_libraries( login-server ${LIBRARIES} ${DEPENDENCIES} ) set_target_properties( login-server PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) -if( WITH_COMPONENT_RUNTIME ) +if( INSTALL_COMPONENT_RUNTIME ) cpack_add_component( Runtime_loginserver_txt DESCRIPTION "login-server (txt version)" DISPLAY_NAME "login-server" GROUP Runtime ) install( TARGETS login-server DESTINATION "." COMPONENT Runtime_loginserver_txt ) -endif() -set( HAVE_login-server ON CACHE BOOL "login-server target is available" ) -mark_as_advanced( HAVE_login-server ) +endif( INSTALL_COMPONENT_RUNTIME ) set( TARGET_LIST ${TARGET_LIST} login-server CACHE INTERNAL "" ) message( STATUS "Creating target login-server - done" ) else() message( STATUS "Skipping target login-server (requires common_base)" ) -unset( HAVE_login-server CACHE ) endif() diff --git a/src/map/sql/CMakeLists.txt b/src/map/sql/CMakeLists.txt index 591e3e65b..68a8b750a 100644 --- a/src/map/sql/CMakeLists.txt +++ b/src/map/sql/CMakeLists.txt @@ -95,17 +95,14 @@ add_executable( map-server_sql ${SOURCE_FILES} ) add_dependencies( map-server_sql ${DEPENDENCIES} ) target_link_libraries( map-server_sql ${LIBRARIES} ${DEPENDENCIES} ) set_target_properties( map-server_sql PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) -if( WITH_COMPONENT_RUNTIME ) +if( INSTALL_COMPONENT_RUNTIME ) cpack_add_component( Runtime_mapserver_sql DESCRIPTION "map-server (sql version)" DISPLAY_NAME "map-server_sql" GROUP Runtime ) install( TARGETS map-server_sql DESTINATION "." COMPONENT Runtime_mapserver_sql ) -endif() -set( HAVE_map-server_sql ON CACHE BOOL "map-server_sql target is available" ) -mark_as_advanced( HAVE_map-server_sql ) +endif( INSTALL_COMPONENT_RUNTIME ) set( TARGET_LIST ${TARGET_LIST} map-server_sql CACHE INTERNAL "" ) message( STATUS "Creating target map-server_sql - done" ) else() message( STATUS "Skipping target map-server_sql (requires common_sql; optional PCRE)" ) -unset( HAVE_map-server_sql CACHE ) endif() diff --git a/src/map/txt/CMakeLists.txt b/src/map/txt/CMakeLists.txt index 878ab68d2..409013e77 100644 --- a/src/map/txt/CMakeLists.txt +++ b/src/map/txt/CMakeLists.txt @@ -95,17 +95,14 @@ add_executable( map-server ${SOURCE_FILES} ) add_dependencies( map-server ${DEPENDENCIES} ) target_link_libraries( map-server ${LIBRARIES} ${DEPENDENCIES} ) set_target_properties( map-server PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) -if( WITH_COMPONENT_RUNTIME ) +if( INSTALL_COMPONENT_RUNTIME ) cpack_add_component( Runtime_mapserver_txt DESCRIPTION "map-server (txt version)" DISPLAY_NAME "map-server" GROUP Runtime ) install( TARGETS map-server DESTINATION "." COMPONENT Runtime_mapserver_txt ) -endif() -set( HAVE_map-server ON CACHE BOOL "map-server target is available" ) -mark_as_advanced( HAVE_map-server ) +endif( INSTALL_COMPONENT_RUNTIME ) set( TARGET_LIST ${TARGET_LIST} map-server CACHE INTERNAL "" ) message( STATUS "Creating target map-server - done" ) else() message( STATUS "Skipping target map-server (requires common_base; optional PCRE)" ) -unset( HAVE_map-server CACHE ) endif() diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt new file mode 100644 index 000000000..220f70f6b --- /dev/null +++ b/src/plugins/CMakeLists.txt @@ -0,0 +1,175 @@ + +# +# setup +# +get_property( CAN_BUILD_SHARED_LIBS GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS ) +if( NOT CAN_BUILD_SHARED_LIBS ) + return() +endif() + +# +# console +# +option( BUILD_PLUGIN_console "build console plugin" OFF ) +if( BUILD_PLUGIN_console ) +message( STATUS "Creating target console" ) +set( CONSOLE_SOURCES + "${CMAKE_CURRENT_SOURCE_DIR}/console.c" + "${CMAKE_CURRENT_SOURCE_DIR}/console.def" + ) +set( LIBRARIES ${GLOBAL_LIBRARIES} ) +set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ) +set( DEFINITIONS ${GLOBAL_DEFINITIONS} ) +set( SOURCE_FILES ${CONSOLE_SOURCES} ) +source_group( console FILES ${CONSOLE_SOURCES} ) +include_directories( ${INCLUDE_DIRS} ) +add_library( console SHARED ${SOURCE_FILES} ) +target_link_libraries( console ${LIBRARIES} ) +set_target_properties( console PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) +set_target_properties( console PROPERTIES PREFIX "" ) +if( INSTALL_COMPONENT_RUNTIME ) + cpack_add_component( Runtime_console DESCRIPTION "console plugin" DISPLAY_NAME "console" GROUP Runtime ) + install( TARGETS console + DESTINATION "plugins" + COMPONENT Runtime_console ) +endif( INSTALL_COMPONENT_RUNTIME ) +set( TARGET_LIST ${TARGET_LIST} console CACHE INTERNAL "" ) +message( STATUS "Creating target console - done" ) +endif( BUILD_PLUGIN_console ) + + +# +# dbghelpplug +# +if( WIN32 ) + find_path( HAVE_DBGHELP_H dbghelp.h ) + mark_as_advanced( HAVE_DBGHELP_H ) + if( HAVE_DBGHELP_H ) + option( BUILD_PLUGIN_dbghelpplug "build dbghelpplug plugin" OFF ) + endif() +endif() +if( BUILD_PLUGIN_dbghelpplug ) +message( STATUS "Creating target dbghelpplug" ) +set( DBGHELPPLUG_SOURCES + "${CMAKE_CURRENT_SOURCE_DIR}/dbghelpplug.c" + "${CMAKE_CURRENT_SOURCE_DIR}/dbghelpplug.rc" + ) +set( LIBRARIES ${GLOBAL_LIBRARIES} ) +set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ) +set( DEFINITIONS ${GLOBAL_DEFINITIONS} ) +set( SOURCE_FILES ${DBGHELPPLUG_SOURCES} ) +source_group( dbghelpplug FILES ${DBGHELPPLUG_SOURCES} ) +include_directories( ${INCLUDE_DIRS} ) +add_library( dbghelpplug SHARED ${SOURCE_FILES} ) +target_link_libraries( dbghelpplug ${LIBRARIES} ) +set_target_properties( dbghelpplug PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) +set_target_properties( dbghelpplug PROPERTIES PREFIX "" ) +if( INSTALL_COMPONENT_RUNTIME ) + cpack_add_component( Runtime_dbghelpplug DESCRIPTION "dbghelpplug plugin" DISPLAY_NAME "dbghelpplug" GROUP Runtime ) + install( TARGETS dbghelpplug + DESTINATION "plugins" + COMPONENT Runtime_dbghelpplug ) +endif( INSTALL_COMPONENT_RUNTIME ) +set( TARGET_LIST ${TARGET_LIST} dbghelpplug CACHE INTERNAL "" ) +message( STATUS "Creating target dbghelpplug - done" ) +endif( BUILD_PLUGIN_dbghelpplug ) + + +# +# pid +# +if( WIN32 OR HAVE_GETPID ) + option( BUILD_PLUGIN_pid "build pid plugin" OFF ) +endif() +if( BUILD_PLUGIN_pid ) +message( STATUS "Creating target pid" ) +set( PID_SOURCES + "${CMAKE_CURRENT_SOURCE_DIR}/pid.c" + "${CMAKE_CURRENT_SOURCE_DIR}/pid.def" + ) +set( LIBRARIES ${GLOBAL_LIBRARIES} ) +set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ) +set( DEFINITIONS ${GLOBAL_DEFINITIONS} ) +set( SOURCE_FILES ${PID_SOURCES} ) +source_group( pid FILES ${PID_SOURCES} ) +include_directories( ${INCLUDE_DIRS} ) +add_library( pid SHARED ${SOURCE_FILES} ) +target_link_libraries( pid ${LIBRARIES} ) +set_target_properties( pid PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) +set_target_properties( pid PROPERTIES PREFIX "" ) +if( INSTALL_COMPONENT_RUNTIME ) + cpack_add_component( Runtime_pid DESCRIPTION "pid plugin" DISPLAY_NAME "pid" GROUP Runtime ) + install( TARGETS pid + DESTINATION "plugins" + COMPONENT Runtime_pid ) +endif( INSTALL_COMPONENT_RUNTIME ) +set( TARGET_LIST ${TARGET_LIST} pid CACHE INTERNAL "" ) +message( STATUS "Creating target pid - done" ) +endif( BUILD_PLUGIN_pid ) + + +# +# sample +# +option( BUILD_PLUGIN_sample "build sample plugin" OFF ) +if( BUILD_PLUGIN_sample ) +message( STATUS "Creating target sample" ) +set( SAMPLE_SOURCES + "${CMAKE_CURRENT_SOURCE_DIR}/sample.c" + "${CMAKE_CURRENT_SOURCE_DIR}/sample.def" + ) +set( LIBRARIES ${GLOBAL_LIBRARIES} ) +set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ) +set( DEFINITIONS ${GLOBAL_DEFINITIONS} ) +set( SOURCE_FILES ${SAMPLE_SOURCES} ) +source_group( sample FILES ${SAMPLE_SOURCES} ) +include_directories( ${INCLUDE_DIRS} ) +add_library( sample SHARED ${SOURCE_FILES} ) +target_link_libraries( sample ${LIBRARIES} ) +set_target_properties( sample PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) +set_target_properties( sample PROPERTIES PREFIX "" ) +if( INSTALL_COMPONENT_RUNTIME ) + cpack_add_component( Runtime_sample DESCRIPTION "sample plugin" DISPLAY_NAME "sample" GROUP Runtime ) + install( TARGETS sample + DESTINATION "plugins" + COMPONENT Runtime_sample ) +endif( INSTALL_COMPONENT_RUNTIME ) +set( TARGET_LIST ${TARGET_LIST} sample CACHE INTERNAL "" ) +message( STATUS "Creating target sample - done" ) +endif( BUILD_PLUGIN_sample ) + + +# +# sig +# +option( BUILD_PLUGIN_sig "build sig plugin" OFF ) +if( BUILD_PLUGIN_sig ) +message( STATUS "Creating target sig" ) +set( SIG_SOURCES + "${COMMON_SOURCE_DIR}/malloc.c" + "${COMMON_SOURCE_DIR}/malloc.h" + "${COMMON_SOURCE_DIR}/showmsg.c" + "${COMMON_SOURCE_DIR}/showmsg.h" + "${COMMON_SOURCE_DIR}/strlib.c" + "${COMMON_SOURCE_DIR}/strlib.h" + "${CMAKE_CURRENT_SOURCE_DIR}/sig.c" + ) +set( LIBRARIES ${GLOBAL_LIBRARIES} ) +set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ) +set( DEFINITIONS "${GLOBAL_DEFINITIONS} ${COMMON_MINI_DEFINITIONS} -DNO_MEMMGR" ) +set( SOURCE_FILES ${SIG_SOURCES} ) +source_group( sig FILES ${SIG_SOURCES} ) +include_directories( ${INCLUDE_DIRS} ) +add_library( sig SHARED ${SOURCE_FILES} ) +target_link_libraries( sig ${LIBRARIES} ) +set_target_properties( sig PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) +set_target_properties( sig PROPERTIES PREFIX "" ) +if( INSTALL_COMPONENT_RUNTIME ) + cpack_add_component( Runtime_sig DESCRIPTION "sig plugin" DISPLAY_NAME "sig" GROUP Runtime ) + install( TARGETS sig + DESTINATION "plugins" + COMPONENT Runtime_sig ) +endif( INSTALL_COMPONENT_RUNTIME ) +set( TARGET_LIST ${TARGET_LIST} sig CACHE INTERNAL "" ) +message( STATUS "Creating target sig - done" ) +endif( BUILD_PLUGIN_sig ) diff --git a/src/tool/CMakeLists.txt b/src/tool/CMakeLists.txt index 26595b404..4dc500fc7 100644 --- a/src/tool/CMakeLists.txt +++ b/src/tool/CMakeLists.txt @@ -27,14 +27,12 @@ add_executable( mapcache ${SOURCE_FILES} ) include_directories( ${INCLUDE_DIRS} ) target_link_libraries( mapcache ${LIBRARIES} ) set_target_properties( mapcache PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) -if( WITH_COMPONENT_RUNTIME ) +if( INSTALL_COMPONENT_RUNTIME ) cpack_add_component( Runtime_mapcache DESCRIPTION "mapcache generator" DISPLAY_NAME "mapcache" GROUP Runtime ) install( TARGETS mapcache DESTINATION "." COMPONENT Runtime_mapcache ) -endif() -set( HAVE_mapcache ON CACHE BOOL "mapcache target is available" ) -mark_as_advanced( HAVE_mapcache ) +endif( INSTALL_COMPONENT_RUNTIME ) set( TARGET_LIST ${TARGET_LIST} mapcache CACHE INTERNAL "" ) message( STATUS "Creating target mapcache - done" ) else() diff --git a/src/txt-converter/CMakeLists.txt b/src/txt-converter/CMakeLists.txt index bd7d6f1b7..94376c42f 100644 --- a/src/txt-converter/CMakeLists.txt +++ b/src/txt-converter/CMakeLists.txt @@ -3,6 +3,9 @@ # setup # set( CONVERTER_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "" ) +if( WITH_MYSQL ) + option( BUILD_CONVERTERS "build login-converter and char-converter" OFF ) +endif() # diff --git a/src/txt-converter/char/CMakeLists.txt b/src/txt-converter/char/CMakeLists.txt index ecdc28091..ad3970d77 100644 --- a/src/txt-converter/char/CMakeLists.txt +++ b/src/txt-converter/char/CMakeLists.txt @@ -2,7 +2,7 @@ # # char-converter # -if( WITH_MYSQL ) +if( BUILD_CONVERTERS ) message( STATUS "Creating target char-converter" ) set( COMMON_HEADERS ${COMMON_MINI_HEADERS} @@ -65,17 +65,12 @@ include_directories( ${INCLUDE_DIRS} ) add_executable( char-converter ${SOURCE_FILES} ) target_link_libraries( char-converter ${LIBRARIES} ) set_target_properties( char-converter PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) -if( WITH_COMPONENT_RUNTIME ) +if( INSTALL_COMPONENT_RUNTIME ) cpack_add_component( Runtime_charconverter DESCRIPTION "char-converter" DISPLAY_NAME "char-converter" GROUP Runtime ) install( TARGETS char-converter DESTINATION "tools" COMPONENT Runtime_charconverter ) -endif() -set( HAVE_char-converter ON CACHE BOOL "char-converter target is available" ) -mark_as_advanced( HAVE_char-converter ) +endif( INSTALL_COMPONENT_RUNTIME ) set( TARGET_LIST ${TARGET_LIST} char-converter CACHE INTERNAL "" ) message( STATUS "Creating target char-converter - done" ) -else() -message( STATUS "Skipping target char-converter (requires MYSQL)" ) -unset( HAVE_char-converter CACHE ) -endif() +endif( BUILD_CONVERTERS ) diff --git a/src/txt-converter/login/CMakeLists.txt b/src/txt-converter/login/CMakeLists.txt index 8cf333438..605050d60 100644 --- a/src/txt-converter/login/CMakeLists.txt +++ b/src/txt-converter/login/CMakeLists.txt @@ -2,7 +2,7 @@ # # login-converter # -if( WITH_MYSQL ) +if( BUILD_CONVERTERS ) message( STATUS "Creating target login-converter" ) set( COMMON_HEADERS ${COMMON_MINI_HEADERS} @@ -49,17 +49,12 @@ include_directories( ${INCLUDE_DIRS} ) add_executable( login-converter ${SOURCE_FILES} ) target_link_libraries( login-converter ${LIBRARIES} ) set_target_properties( login-converter PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) -if( WITH_COMPONENT_RUNTIME ) +if( INSTALL_COMPONENT_RUNTIME ) cpack_add_component( Runtime_loginconverter DESCRIPTION "login-converter" DISPLAY_NAME "login-converter" GROUP Runtime ) install( TARGETS login-converter DESTINATION "tools" COMPONENT Runtime_loginconverter ) -endif() -set( HAVE_login-converter ON CACHE BOOL "login-converter target is available" ) -mark_as_advanced( HAVE_login-converter ) +endif( INSTALL_COMPONENT_RUNTIME ) set( TARGET_LIST ${TARGET_LIST} login-converter CACHE INTERNAL "" ) message( STATUS "Creating target login-converter - done" ) -else() -message( STATUS "Skipping target login-converter (requires MYSQL)" ) -unset( HAVE_login-converter CACHE ) -endif() +endif( BUILD_CONVERTERS ) -- cgit v1.2.3-60-g2f50