From a751e7ba146eee3694169b8087306c93732689e6 Mon Sep 17 00:00:00 2001 From: flaviojs Date: Fri, 22 Jul 2011 14:54:37 +0000 Subject: * CMake: Added options BUILD_TXT_SERVERS, BUILD_SQL_SERVERS, BUILD_MAPCACHE. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14921 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 2 ++ src/CMakeLists.txt | 18 ++++++++++++++++++ src/char/CMakeLists.txt | 6 ++---- src/char_sql/CMakeLists.txt | 6 ++---- src/common/CMakeLists.txt | 6 ++---- src/login/sql/CMakeLists.txt | 6 ++---- src/login/txt/CMakeLists.txt | 6 ++---- src/map/sql/CMakeLists.txt | 10 +++++----- src/map/txt/CMakeLists.txt | 10 +++++----- src/plugins/CMakeLists.txt | 5 +++++ src/tool/CMakeLists.txt | 10 ++++++---- src/txt-converter/CMakeLists.txt | 4 +++- 12 files changed, 54 insertions(+), 35 deletions(-) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index c000ed698..624b54528 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -1,5 +1,7 @@ Date Added +2011/07/22 + * CMake: Added options BUILD_TXT_SERVERS, BUILD_SQL_SERVERS, BUILD_MAPCACHE. [FlavioJS] 2011/07/21 * CMake: Only install template files if they don't already exist. [FlavioJS] * CMake: Added plugin targets. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4233bcb12..7ec05e405 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,5 +1,23 @@ +# +# setup and static libraries +# add_subdirectory( common ) +if( HAVE_common_base ) + option( BUILD_TXT_SERVERS "build txt server executables" ON ) +else() + message( STATUS "Disabled txt server targets (requires common_base)" ) +endif() +if( HAVE_common_sql ) + option( BUILD_SQL_SERVERS "build sql server executables" ON ) +else() + message( STATUS "Disabled sql server targets (requires common_sql)" ) +endif() + + +# +# targets +# add_subdirectory( login ) add_subdirectory( char ) add_subdirectory( char_sql ) diff --git a/src/char/CMakeLists.txt b/src/char/CMakeLists.txt index 92c9f2934..fa1c3f366 100644 --- a/src/char/CMakeLists.txt +++ b/src/char/CMakeLists.txt @@ -8,7 +8,7 @@ set( TXT_CHAR_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "" ) # # char txt # -if( HAVE_common_base ) +if( BUILD_TXT_SERVERS ) message( STATUS "Creating target char-server" ) set( TXT_CHAR_HEADERS "${TXT_CHAR_SOURCE_DIR}/char.h" @@ -50,6 +50,4 @@ if( INSTALL_COMPONENT_RUNTIME ) 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)" ) -endif() +endif( BUILD_TXT_SERVERS ) diff --git a/src/char_sql/CMakeLists.txt b/src/char_sql/CMakeLists.txt index 6da79ac39..823939393 100644 --- a/src/char_sql/CMakeLists.txt +++ b/src/char_sql/CMakeLists.txt @@ -8,7 +8,7 @@ set( SQL_CHAR_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "" ) # # char sql # -if( HAVE_common_sql ) +if( BUILD_SQL_SERVERS ) message( STATUS "Creating target char-server_sql" ) set( SQL_CHAR_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/char.h" @@ -55,6 +55,4 @@ if( INSTALL_COMPONENT_RUNTIME ) COMPONENT Runtime_charserver_sql ) endif( INSTALL_COMPONENT_RUNTIME ) message( STATUS "Creating target char-server_sql - done" ) -else() -message( STATUS "Skipping target char-server_sql (requires common_sql)" ) -endif() +endif( BUILD_SQL_SERVERS ) diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 6f117c6d5..ea8ce6b71 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -103,8 +103,7 @@ add_library( common_base ${SOURCE_FILES} ) target_link_libraries( common_base ${LIBRARIES} ) set_target_properties( common_base PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) include_directories( ${INCLUDE_DIRS} ) -set( HAVE_common_base ON CACHE BOOL "common_base target is available" ) -mark_as_advanced( HAVE_common_base ) +set( HAVE_common_base ON CACHE INTERNAL "" ) set( TARGET_LIST ${TARGET_LIST} common_base CACHE INTERNAL "" ) message( STATUS "Creating target common_base - done" ) else() @@ -136,8 +135,7 @@ add_dependencies( common_sql ${DEPENDENCIES} ) target_link_libraries( common_sql ${LIBRARIES} ${DEPENDENCIES} ) set_target_properties( common_sql PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) include_directories( ${INCLUDE_DIRS} ) -set( HAVE_common_sql ON CACHE BOOL "common_sql target is available" ) -mark_as_advanced( HAVE_common_sql ) +set( HAVE_common_sql ON CACHE INTERNAL "" ) set( TARGET_LIST ${TARGET_LIST} common_sql CACHE INTERNAL "" ) message( STATUS "Creating target common_sql - done" ) else() diff --git a/src/login/sql/CMakeLists.txt b/src/login/sql/CMakeLists.txt index 153d9562f..f452823ec 100644 --- a/src/login/sql/CMakeLists.txt +++ b/src/login/sql/CMakeLists.txt @@ -2,7 +2,7 @@ # # login sql # -if( HAVE_common_sql ) +if( BUILD_SQL_SERVERS ) message( STATUS "Creating target login-server_sql" ) set( SQL_LOGIN_HEADERS "${SQL_LOGIN_SOURCE_DIR}/account.h" @@ -36,6 +36,4 @@ if( INSTALL_COMPONENT_RUNTIME ) 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)" ) -endif() +endif( BUILD_SQL_SERVERS ) diff --git a/src/login/txt/CMakeLists.txt b/src/login/txt/CMakeLists.txt index 75e055903..1df5b32a9 100644 --- a/src/login/txt/CMakeLists.txt +++ b/src/login/txt/CMakeLists.txt @@ -2,7 +2,7 @@ # # login txt # -if( HAVE_common_base ) +if( BUILD_TXT_SERVERS ) message( STATUS "Creating target login-server" ) set( TXT_LOGIN_HEADERS "${TXT_LOGIN_SOURCE_DIR}/account.h" @@ -36,6 +36,4 @@ if( INSTALL_COMPONENT_RUNTIME ) 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)" ) -endif() +endif( BUILD_TXT_SERVERS ) diff --git a/src/map/sql/CMakeLists.txt b/src/map/sql/CMakeLists.txt index 68a8b750a..eadddb2a0 100644 --- a/src/map/sql/CMakeLists.txt +++ b/src/map/sql/CMakeLists.txt @@ -2,7 +2,7 @@ # # map sql # -if( HAVE_common_sql ) +if( BUILD_SQL_SERVERS ) message( STATUS "Creating target map-server_sql" ) set( SQL_MAP_HEADERS "${SQL_MAP_SOURCE_DIR}/atcommand.h" @@ -82,10 +82,12 @@ set( LIBRARIES ${GLOBAL_LIBRARIES} ) set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ) set( DEFINITIONS "${GLOBAL_DEFINITIONS}" ) if( WITH_PCRE ) - message( STATUS "Using PCRE" ) + message( STATUS "Enabled PCRE code" ) set( LIBRARIES ${LIBRARIES} ${PCRE_LIBRARIES} ) set( INCLUDE_DIRS ${INCLUDE_DIRS} ${PCRE_INCLUDE_DIRS} ) set( DEFINITIONS "${DEFINITIONS} -DPCRE_SUPPORT" ) +else() + message( STATUS "Disabled PCRE code" ) endif() set( SOURCE_FILES ${COMMON_BASE_HEADERS} ${COMMON_SQL_HEADERS} ${SQL_MAP_HEADERS} ${SQL_MAP_SOURCES} ) source_group( common FILES ${COMMON_BASE_HEADERS} ${COMMON_SQL_HEADERS} ) @@ -103,6 +105,4 @@ if( INSTALL_COMPONENT_RUNTIME ) 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)" ) -endif() +endif( BUILD_SQL_SERVERS ) diff --git a/src/map/txt/CMakeLists.txt b/src/map/txt/CMakeLists.txt index 409013e77..b2634000a 100644 --- a/src/map/txt/CMakeLists.txt +++ b/src/map/txt/CMakeLists.txt @@ -2,7 +2,7 @@ # # map txt # -if( HAVE_common_base ) +if( BUILD_TXT_SERVERS ) message( STATUS "Creating target map-server" ) set( TXT_MAP_HEADERS "${TXT_MAP_SOURCE_DIR}/atcommand.h" @@ -82,10 +82,12 @@ set( LIBRARIES ${GLOBAL_LIBRARIES} ) set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ) set( DEFINITIONS "${GLOBAL_DEFINITIONS} -DTXT_ONLY" ) if( WITH_PCRE ) - message( STATUS "Using PCRE" ) + message( STATUS "Enabled PCRE code" ) set( LIBRARIES ${LIBRARIES} ${PCRE_LIBRARIES} ) set( INCLUDE_DIRS ${INCLUDE_DIRS} ${PCRE_INCLUDE_DIRS} ) set( DEFINITIONS "${DEFINITIONS} -DPCRE_SUPPORT" ) +else() + message( STATUS "Disabled PCRE code" ) endif() set( SOURCE_FILES ${COMMON_BASE_HEADERS} ${TXT_MAP_HEADERS} ${TXT_MAP_SOURCES} ) source_group( common FILES ${COMMON_BASE_HEADERS} ) @@ -103,6 +105,4 @@ if( INSTALL_COMPONENT_RUNTIME ) 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)" ) -endif() +endif( BUILD_TXT_SERVERS ) diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt index 220f70f6b..903a1ec6e 100644 --- a/src/plugins/CMakeLists.txt +++ b/src/plugins/CMakeLists.txt @@ -48,6 +48,9 @@ if( WIN32 ) option( BUILD_PLUGIN_dbghelpplug "build dbghelpplug plugin" OFF ) endif() endif() +if( NOT DEFINED BUILD_PLUGIN_dbghelpplug ) + message( STATUS "Disabled dbghelpplug plugin target (requires WIN32 and HAVE_DBGHELP_H)" ) +endif() if( BUILD_PLUGIN_dbghelpplug ) message( STATUS "Creating target dbghelpplug" ) set( DBGHELPPLUG_SOURCES @@ -80,6 +83,8 @@ endif( BUILD_PLUGIN_dbghelpplug ) # if( WIN32 OR HAVE_GETPID ) option( BUILD_PLUGIN_pid "build pid plugin" OFF ) +else() + message( STATUS "Disabled pid plugin target (requires WIN32 or HAVE_GETPID)" ) endif() if( BUILD_PLUGIN_pid ) message( STATUS "Creating target pid" ) diff --git a/src/tool/CMakeLists.txt b/src/tool/CMakeLists.txt index 4dc500fc7..55ea2d267 100644 --- a/src/tool/CMakeLists.txt +++ b/src/tool/CMakeLists.txt @@ -3,6 +3,11 @@ # mapcache # if( WITH_ZLIB ) + option( BUILD_MAPCACHE "build mapcache executable" ON ) +else() + message( STATUS "Disabled mapcache target (required ZLIB)" ) +endif() +if( BUILD_MAPCACHE ) message( STATUS "Creating target mapcache" ) set( COMMON_HEADERS ${COMMON_MINI_HEADERS} @@ -35,7 +40,4 @@ if( INSTALL_COMPONENT_RUNTIME ) endif( INSTALL_COMPONENT_RUNTIME ) set( TARGET_LIST ${TARGET_LIST} mapcache CACHE INTERNAL "" ) message( STATUS "Creating target mapcache - done" ) -else() -message( STATUS "Skipping target mapcache (requires ZLIB)" ) -unset( HAVE_mapcache CACHE ) -endif() +endif( BUILD_MAPCACHE ) diff --git a/src/txt-converter/CMakeLists.txt b/src/txt-converter/CMakeLists.txt index 94376c42f..7b1cfb6a8 100644 --- a/src/txt-converter/CMakeLists.txt +++ b/src/txt-converter/CMakeLists.txt @@ -4,7 +4,9 @@ # set( CONVERTER_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "" ) if( WITH_MYSQL ) - option( BUILD_CONVERTERS "build login-converter and char-converter" OFF ) + option( BUILD_CONVERTERS "build converter executables" OFF ) +else() + message( STATUS "Disabled converter targets (requires MYSQL)" ) endif() -- cgit v1.2.3-60-g2f50