From dd73c6ea546a8828653cdce38a52f575cbdd3b96 Mon Sep 17 00:00:00 2001 From: flaviojs Date: Wed, 29 Jun 2011 12:26:51 +0000 Subject: * Added experimental support for CMake. (for now: basic build, no extras, only tested with VS10 and cygwin) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14872 54d463be-8e91-2dee-dedb-b68131a5f0ec --- 3rdparty/pcre/CMakeLists.txt | 92 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 3rdparty/pcre/CMakeLists.txt (limited to '3rdparty/pcre/CMakeLists.txt') diff --git a/3rdparty/pcre/CMakeLists.txt b/3rdparty/pcre/CMakeLists.txt new file mode 100644 index 000000000..0625999b1 --- /dev/null +++ b/3rdparty/pcre/CMakeLists.txt @@ -0,0 +1,92 @@ + +# +# local copy +# +if( WIN32 ) +message( STATUS "Detecting local PCRE" ) +find_path( LOCAL_PCRE_INCLUDE_DIRS "pcre.h" + PATHS "${CMAKE_CURRENT_SOURCE_DIR}/include" + NO_DEFAULT_PATH ) +find_library( LOCAL_PCRE_LIBRARIES + NAMES pcre + PATHS "${CMAKE_CURRENT_SOURCE_DIR}/lib" + NO_DEFAULT_PATH ) +mark_as_advanced( LOCAL_PCRE_LIBRARIES ) +mark_as_advanced( LOCAL_PCRE_INCLUDE_DIRS ) + +if( LOCAL_PCRE_LIBRARIES AND LOCAL_PCRE_INCLUDE_DIRS ) + file( STRINGS "${LOCAL_PCRE_INCLUDE_DIRS}/pcre.h" PCRE_H REGEX "^#define[ \t]+PCRE_M[A-Z]+[ \t]+[0-9]+.*$" ) + string( REGEX REPLACE "^.*PCRE_MAJOR[ \t]+([0-9]+).*$" "\\1" PCRE_MAJOR "${PCRE_H}" ) + string( REGEX REPLACE "^.*PCRE_MINOR[ \t]+([0-9]+).*$" "\\1" PCRE_MINOR "${PCRE_H}" ) + message( STATUS "Found PCRE: ${LOCAL_PCRE_LIBRARIES} (found version ${PCRE_MAJOR}.${PCRE_MINOR})" ) + set( HAVE_LOCAL_PCRE ON + CACHE BOOL "pcre is available as a local copy" ) +else() + foreach( _VAR LOCAL_PCRE_LIBRARIES LOCAL_PCRE_INCLUDE_DIRS ) + if( NOT "${_VAR}" ) + set( MISSING_VARS ${MISSING_VARS} ${_VAR} ) + endif() + endforeach() + message( STATUS "Could NOT find PCRE (missing: ${MISSING_VARS})" ) + unset( HAVE_LOCAL_PCRE CACHE ) +endif() +message( STATUS "Detecting local PCRE - done" ) +endif( WIN32 ) + + +# +# system +# +message( STATUS "Detecting system PCRE" ) +set( CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_MODULE_PATH} ) +find_package( PCRE ) +set( SYSTEM_PCRE_LIBRARIES ${PCRE_LIBRARIES} + CACHE PATH "system pcre libraries" ) +set( SYSTEM_PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIRS} + CACHE PATH "system pcre include directories" ) +mark_as_advanced( SYSTEM_PCRE_LIBRARIES ) +mark_as_advanced( SYSTEM_PCRE_INCLUDE_DIRS ) + +if( SYSTEM_PCRE_LIBRARIES AND SYSTEM_PCRE_INCLUDE_DIRS ) + set( HAVE_SYSTEM_PCRE ON + CACHE BOOL "pcre is available on the system" ) +else() + unset( HAVE_SYSTEM_PCRE CACHE ) +endif() +message( STATUS "Detecting system PCRE - done" ) + + +# +# configure +# +unset( PCRE_LIBRARIES CACHE ) +unset( PCRE_INCLUDE_DIRS CACHE ) +if( HAVE_LOCAL_PCRE ) + set( USE_LOCAL_PCRE ON + CACHE BOOL "use local copy of pcre" ) +else() + unset( USE_LOCAL_PCRE CACHE ) +endif() +if( USE_LOCAL_PCRE ) + message( STATUS "Configuring for local PCRE" ) + set( PCRE_LIBRARIES ${LOCAL_PCRE_LIBRARIES} ) + set( PCRE_INCLUDE_DIRS ${LOCAL_PCRE_INCLUDE_DIRS} ) + message( STATUS "Configuring for local PCRE - done" ) +elseif( HAVE_SYSTEM_PCRE ) + message( STATUS "Configuring for system PCRE" ) + set( PCRE_LIBRARIES ${SYSTEM_PCRE_LIBRARIES} ) + set( PCRE_INCLUDE_DIRS ${SYSTEM_PCRE_INCLUDE_DIRS} ) + message( STATUS "Configuring for system PCRE - done" ) +endif() +if( USE_LOCAL_PCRE OR HAVE_SYSTEM_PCRE ) + set( USE_PCRE ON + CACHE BOOL "use pcre" ) +else() + unset( USE_PCRE CACHE ) +endif() +set( PCRE_LIBRARIES ${PCRE_LIBRARIES} + CACHE PATH "pcre libraries" ) +set( PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIRS} + CACHE PATH "pcre include directories" ) +mark_as_advanced( PCRE_LIBRARIES ) +mark_as_advanced( PCRE_INCLUDE_DIRS ) -- cgit v1.2.3-70-g09d2 From 0361920446e9311979b5187abf123ba8e055d944 Mon Sep 17 00:00:00 2001 From: flaviojs Date: Fri, 1 Jul 2011 15:43:58 +0000 Subject: * CMake: marked executables as different components and other miscellaneous changes. [FlavioJS] git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14877 54d463be-8e91-2dee-dedb-b68131a5f0ec --- 3rdparty/CMakeLists.txt | 48 +++++++++++++++++++++++++++++ 3rdparty/mysql/CMakeLists.txt | 66 +++++++++++----------------------------- 3rdparty/pcre/CMakeLists.txt | 60 ++++++++++-------------------------- 3rdparty/zlib/CMakeLists.txt | 60 ++++++++++-------------------------- CMakeLists.txt | 71 ++++++++++++++++++++++++++++++++++++++----- Changelog-Trunk.txt | 2 ++ src/char/CMakeLists.txt | 8 ++++- src/char_sql/CMakeLists.txt | 8 ++++- src/login/CMakeLists.txt | 12 ++++++-- src/map/CMakeLists.txt | 14 +++++++-- src/tool/CMakeLists.txt | 4 ++- 11 files changed, 202 insertions(+), 151 deletions(-) (limited to '3rdparty/pcre/CMakeLists.txt') diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index 6e5c759cc..0ea359186 100644 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -1,4 +1,52 @@ +# macro to configure the use of local or system version of a package +# Uses: +# HAVE_LOCAL_${name} - is local version available? +# ${name}_LOCAL_LIBRARIES - libraries of the local version +# ${name}_LOCAL_INCLUDE_DIRS - include directories of the local version +# HAVE_SYSTEM_${name} - is system version available? +# ${name}_SYSTEM_LIBRARIES - libraries of the system version +# ${name}_SYSTEM_INCLUDE_DIRS - include directories of the system version +# Generates: +# USE_LOCAL_${name} - use the local version of the package (only when local is available) +# USE_${name} - use this package +# ${name}_LIBRARIES - libraries +# ${name}_INCLUDE_DIRS - include directories +macro( CONFIGURE_USE_LOCAL_OR_SYSTEM name ) + unset( ${name}_LIBRARIES CACHE ) + unset( ${name}_INCLUDE_DIRS CACHE ) + if( HAVE_LOCAL_${name} ) + set( USE_LOCAL_${name} ON + CACHE BOOL "use local version of ${name}" ) + else() + unset( USE_LOCAL_${name} CACHE ) + endif() + if( USE_LOCAL_${name} ) + message( STATUS "Configuring for local ${name}" ) + set( ${name}_LIBRARIES ${${name}_LOCAL_LIBRARIES} ) + set( ${name}_INCLUDE_DIRS ${${name}_LOCAL_INCLUDE_DIRS} ) + message( STATUS "Configuring for local ${name} - done" ) + elseif( HAVE_SYSTEM_${name} ) + message( STATUS "Configuring for system ${name}" ) + set( ${name}_LIBRARIES ${${name}_SYSTEM_LIBRARIES} ) + set( ${name}_INCLUDE_DIRS ${${name}_SYSTEM_INCLUDE_DIRS} ) + message( STATUS "Configuring for system ${name} - done" ) + endif() + if( USE_LOCAL_${name} OR HAVE_SYSTEM_${name} ) + set( USE_${name} ON + CACHE BOOL "use ${name}" ) + else() + unset( USE_${name} CACHE ) + endif() + set( ${name}_LIBRARIES ${${name}_LIBRARIES} + CACHE PATH "${name} libraries" ) + set( ${name}_INCLUDE_DIRS ${${name}_INCLUDE_DIRS} + CACHE PATH "${name} include directories" ) + mark_as_advanced( ${name}_LIBRARIES ) + mark_as_advanced( ${name}_INCLUDE_DIRS ) +endmacro( CONFIGURE_USE_LOCAL_OR_SYSTEM ) + + add_subdirectory( msinttypes ) add_subdirectory( mt19937ar ) add_subdirectory( mysql ) diff --git a/3rdparty/mysql/CMakeLists.txt b/3rdparty/mysql/CMakeLists.txt index 1c14d7395..902037f07 100644 --- a/3rdparty/mysql/CMakeLists.txt +++ b/3rdparty/mysql/CMakeLists.txt @@ -4,28 +4,28 @@ # if( WIN32 ) message( STATUS "Detecting local MYSQL" ) -find_path( LOCAL_MYSQL_INCLUDE_DIRS "mysql.h" +find_path( MYSQL_LOCAL_INCLUDE_DIRS "mysql.h" PATHS "${CMAKE_CURRENT_SOURCE_DIR}/include" NO_DEFAULT_PATH ) -find_library( LOCAL_MYSQL_LIBRARIES +find_library( MYSQL_LOCAL_LIBRARIES NAMES libmysql PATHS "${CMAKE_CURRENT_SOURCE_DIR}/lib" NO_DEFAULT_PATH ) -mark_as_advanced( LOCAL_MYSQL_LIBRARIES ) -mark_as_advanced( LOCAL_MYSQL_INCLUDE_DIRS ) +mark_as_advanced( MYSQL_LOCAL_LIBRARIES ) +mark_as_advanced( MYSQL_LOCAL_INCLUDE_DIRS ) -if( LOCAL_MYSQL_LIBRARIES AND LOCAL_MYSQL_INCLUDE_DIRS ) - if( EXISTS "${LOCAL_MYSQL_INCLUDE_DIRS}/mysql_version.h" ) - file( STRINGS "${LOCAL_MYSQL_INCLUDE_DIRS}/mysql_version.h" MYSQL_VERSION_H REGEX "^#define MYSQL_SERVER_VERSION[ \t]+\"[^\"]+\".*$" ) +if( MYSQL_LOCAL_LIBRARIES AND MYSQL_LOCAL_INCLUDE_DIRS ) + if( EXISTS "${MYSQL_LOCAL_INCLUDE_DIRS}/mysql_version.h" ) + file( STRINGS "${MYSQL_LOCAL_INCLUDE_DIRS}/mysql_version.h" MYSQL_VERSION_H REGEX "^#define MYSQL_SERVER_VERSION[ \t]+\"[^\"]+\".*$" ) string( REGEX REPLACE "^.*MYSQL_SERVER_VERSION[ \t]+\"([^\"]+)\".*$" "\\1" MYSQL_SERVER_VERSION "${MYSQL_VERSION_H}" ) - message( STATUS "Found MYSQL: ${LOCAL_MYSQL_LIBRARIES} (found version ${MYSQL_SERVER_VERSION})" ) + message( STATUS "Found MYSQL: ${MYSQL_LOCAL_LIBRARIES} (found version ${MYSQL_SERVER_VERSION})" ) else() - message( STATUS "Found MYSQL: ${LOCAL_MYSQL_LIBRARIES}" ) + message( STATUS "Found MYSQL: ${MYSQL_LOCAL_LIBRARIES}" ) endif() set( HAVE_LOCAL_MYSQL ON CACHE BOOL "mysql client is available as a local copy") else() - foreach( _VAR LOCAL_MYSQL_LIBRARIES LOCAL_MYSQL_INCLUDE_DIRS ) + foreach( _VAR MYSQL_LOCAL_LIBRARIES MYSQL_LOCAL_INCLUDE_DIRS ) if( NOT "${_VAR}" ) set( MISSING_VARS ${MISSING_VARS} ${_VAR} ) endif() @@ -55,56 +55,26 @@ if( MYSQL_CONFIG_EXECUTABLE ) message( STATUS "Found MYSQL: ${MYSQL_LIBRARIES} (found version ${MYSQL_VERSION})" ) else() # find mysql package + unset( MYSQL_LIBRARIES CACHE ) + unset( MYSQL_INCLUDE_DIRS CACHE ) set( CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_MODULE_PATH} ) find_package( MYSQL ) endif() -set( SYSTEM_MYSQL_LIBRARIES "${MYSQL_LIBRARIES}" +set( MYSQL_SYSTEM_LIBRARIES "${MYSQL_LIBRARIES}" CACHE PATH "system mysql libraries" ) -set( SYSTEM_MYSQL_INCLUDE_DIRS "${MYSQL_INCLUDE_DIRS}" +set( MYSQL_SYSTEM_INCLUDE_DIRS "${MYSQL_INCLUDE_DIRS}" CACHE PATH "system mysql include directories" ) -mark_as_advanced( SYSTEM_MYSQL_LIBRARIES ) -mark_as_advanced( SYSTEM_MYSQL_INCLUDE_DIRS ) +mark_as_advanced( MYSQL_SYSTEM_LIBRARIES ) +mark_as_advanced( MYSQL_SYSTEM_INCLUDE_DIRS ) -if( SYSTEM_MYSQL_LIBRARIES AND SYSTEM_MYSQL_INCLUDE_DIRS ) +if( MYSQL_SYSTEM_LIBRARIES AND MYSQL_SYSTEM_INCLUDE_DIRS ) set( HAVE_SYSTEM_MYSQL ON CACHE BOOL "mysql client is available on the system" ) endif() message( STATUS "Detecting system MYSQL - done" ) -# options - # # configure # -unset( MYSQL_LIBRARIES CACHE ) -unset( MYSQL_INCLUDE_DIRS CACHE ) -if( HAVE_LOCAL_MYSQL ) - set( USE_LOCAL_MYSQL ON - CACHE BOOL "use local copy of mysql" ) -else() - unset( USE_LOCAL_MYSQL CACHE ) -endif() -if( USE_LOCAL_MYSQL ) - message( STATUS "Configuring for local MYSQL" ) - set( MYSQL_LIBRARIES ${LOCAL_MYSQL_LIBRARIES} ) - set( MYSQL_INCLUDE_DIRS ${LOCAL_MYSQL_INCLUDE_DIRS} ) - message( STATUS "Configuring for local MYSQL - done" ) -elseif( HAVE_SYSTEM_MYSQL ) - message( STATUS "Configuring for system MYSQL" ) - set( MYSQL_LIBRARIES ${SYSTEM_MYSQL_LIBRARIES} ) - set( MYSQL_INCLUDE_DIRS ${SYSTEM_MYSQL_INCLUDE_DIRS} ) - message( STATUS "Configuring for system MYSQL - done" ) -endif() -if( USE_LOCAL_MYSQL OR HAVE_SYSTEM_MYSQL ) - set( USE_MYSQL ON - CACHE BOOL "use mysql" ) -else() - unset( USE_MYSQL CACHE ) -endif() -set( MYSQL_LIBRARIES ${MYSQL_LIBRARIES} - CACHE PATH "mysql libraries" ) -set( MYSQL_INCLUDE_DIRS ${MYSQL_INCLUDE_DIRS} - CACHE PATH "mysql include directories" ) -mark_as_advanced( MYSQL_LIBRARIES ) -mark_as_advanced( MYSQL_INCLUDE_DIRS ) +CONFIGURE_USE_LOCAL_OR_SYSTEM( MYSQL ) diff --git a/3rdparty/pcre/CMakeLists.txt b/3rdparty/pcre/CMakeLists.txt index 0625999b1..ab1c83b6d 100644 --- a/3rdparty/pcre/CMakeLists.txt +++ b/3rdparty/pcre/CMakeLists.txt @@ -4,25 +4,25 @@ # if( WIN32 ) message( STATUS "Detecting local PCRE" ) -find_path( LOCAL_PCRE_INCLUDE_DIRS "pcre.h" +find_path( PCRE_LOCAL_INCLUDE_DIRS "pcre.h" PATHS "${CMAKE_CURRENT_SOURCE_DIR}/include" NO_DEFAULT_PATH ) -find_library( LOCAL_PCRE_LIBRARIES +find_library( PCRE_LOCAL_LIBRARIES NAMES pcre PATHS "${CMAKE_CURRENT_SOURCE_DIR}/lib" NO_DEFAULT_PATH ) -mark_as_advanced( LOCAL_PCRE_LIBRARIES ) -mark_as_advanced( LOCAL_PCRE_INCLUDE_DIRS ) +mark_as_advanced( PCRE_LOCAL_LIBRARIES ) +mark_as_advanced( PCRE_LOCAL_INCLUDE_DIRS ) -if( LOCAL_PCRE_LIBRARIES AND LOCAL_PCRE_INCLUDE_DIRS ) - file( STRINGS "${LOCAL_PCRE_INCLUDE_DIRS}/pcre.h" PCRE_H REGEX "^#define[ \t]+PCRE_M[A-Z]+[ \t]+[0-9]+.*$" ) +if( PCRE_LOCAL_LIBRARIES AND PCRE_LOCAL_INCLUDE_DIRS ) + file( STRINGS "${PCRE_LOCAL_INCLUDE_DIRS}/pcre.h" PCRE_H REGEX "^#define[ \t]+PCRE_M[A-Z]+[ \t]+[0-9]+.*$" ) string( REGEX REPLACE "^.*PCRE_MAJOR[ \t]+([0-9]+).*$" "\\1" PCRE_MAJOR "${PCRE_H}" ) string( REGEX REPLACE "^.*PCRE_MINOR[ \t]+([0-9]+).*$" "\\1" PCRE_MINOR "${PCRE_H}" ) - message( STATUS "Found PCRE: ${LOCAL_PCRE_LIBRARIES} (found version ${PCRE_MAJOR}.${PCRE_MINOR})" ) + message( STATUS "Found PCRE: ${PCRE_LOCAL_LIBRARIES} (found version ${PCRE_MAJOR}.${PCRE_MINOR})" ) set( HAVE_LOCAL_PCRE ON CACHE BOOL "pcre is available as a local copy" ) else() - foreach( _VAR LOCAL_PCRE_LIBRARIES LOCAL_PCRE_INCLUDE_DIRS ) + foreach( _VAR PCRE_LOCAL_LIBRARIES PCRE_LOCAL_INCLUDE_DIRS ) if( NOT "${_VAR}" ) set( MISSING_VARS ${MISSING_VARS} ${_VAR} ) endif() @@ -39,15 +39,17 @@ endif( WIN32 ) # message( STATUS "Detecting system PCRE" ) set( CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_MODULE_PATH} ) +unset( PCRE_LIBRARIES CACHE ) +unset( PCRE_INCLUDE_DIRS CACHE ) find_package( PCRE ) -set( SYSTEM_PCRE_LIBRARIES ${PCRE_LIBRARIES} +set( PCRE_SYSTEM_LIBRARIES ${PCRE_LIBRARIES} CACHE PATH "system pcre libraries" ) -set( SYSTEM_PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIRS} +set( PCRE_SYSTEM_INCLUDE_DIRS ${PCRE_INCLUDE_DIRS} CACHE PATH "system pcre include directories" ) -mark_as_advanced( SYSTEM_PCRE_LIBRARIES ) -mark_as_advanced( SYSTEM_PCRE_INCLUDE_DIRS ) +mark_as_advanced( PCRE_SYSTEM_LIBRARIES ) +mark_as_advanced( PCRE_SYSTEM_INCLUDE_DIRS ) -if( SYSTEM_PCRE_LIBRARIES AND SYSTEM_PCRE_INCLUDE_DIRS ) +if( PCRE_SYSTEM_LIBRARIES AND PCRE_SYSTEM_INCLUDE_DIRS ) set( HAVE_SYSTEM_PCRE ON CACHE BOOL "pcre is available on the system" ) else() @@ -59,34 +61,4 @@ message( STATUS "Detecting system PCRE - done" ) # # configure # -unset( PCRE_LIBRARIES CACHE ) -unset( PCRE_INCLUDE_DIRS CACHE ) -if( HAVE_LOCAL_PCRE ) - set( USE_LOCAL_PCRE ON - CACHE BOOL "use local copy of pcre" ) -else() - unset( USE_LOCAL_PCRE CACHE ) -endif() -if( USE_LOCAL_PCRE ) - message( STATUS "Configuring for local PCRE" ) - set( PCRE_LIBRARIES ${LOCAL_PCRE_LIBRARIES} ) - set( PCRE_INCLUDE_DIRS ${LOCAL_PCRE_INCLUDE_DIRS} ) - message( STATUS "Configuring for local PCRE - done" ) -elseif( HAVE_SYSTEM_PCRE ) - message( STATUS "Configuring for system PCRE" ) - set( PCRE_LIBRARIES ${SYSTEM_PCRE_LIBRARIES} ) - set( PCRE_INCLUDE_DIRS ${SYSTEM_PCRE_INCLUDE_DIRS} ) - message( STATUS "Configuring for system PCRE - done" ) -endif() -if( USE_LOCAL_PCRE OR HAVE_SYSTEM_PCRE ) - set( USE_PCRE ON - CACHE BOOL "use pcre" ) -else() - unset( USE_PCRE CACHE ) -endif() -set( PCRE_LIBRARIES ${PCRE_LIBRARIES} - CACHE PATH "pcre libraries" ) -set( PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIRS} - CACHE PATH "pcre include directories" ) -mark_as_advanced( PCRE_LIBRARIES ) -mark_as_advanced( PCRE_INCLUDE_DIRS ) +CONFIGURE_USE_LOCAL_OR_SYSTEM( PCRE ) diff --git a/3rdparty/zlib/CMakeLists.txt b/3rdparty/zlib/CMakeLists.txt index 849813be0..3bb4304e7 100644 --- a/3rdparty/zlib/CMakeLists.txt +++ b/3rdparty/zlib/CMakeLists.txt @@ -4,24 +4,24 @@ # if( WIN32 ) message( STATUS "Detecting local ZLIB" ) -find_path( LOCAL_ZLIB_INCLUDE_DIRS "zlib.h" +find_path( ZLIB_LOCAL_INCLUDE_DIRS "zlib.h" PATHS "${CMAKE_CURRENT_SOURCE_DIR}/include" NO_DEFAULT_PATH ) -find_library( LOCAL_ZLIB_LIBRARIES +find_library( ZLIB_LOCAL_LIBRARIES NAMES zdll PATHS "${CMAKE_CURRENT_SOURCE_DIR}/lib" NO_DEFAULT_PATH ) -mark_as_advanced( LOCAL_ZLIB_LIBRARIES ) -mark_as_advanced( LOCAL_ZLIB_INCLUDE_DIRS ) +mark_as_advanced( ZLIB_LOCAL_LIBRARIES ) +mark_as_advanced( ZLIB_LOCAL_INCLUDE_DIRS ) -if( LOCAL_ZLIB_LIBRARIES AND LOCAL_ZLIB_INCLUDE_DIRS ) - file( STRINGS "${LOCAL_ZLIB_INCLUDE_DIRS}/zlib.h" ZLIB_H REGEX "^#define[ \t]+ZLIB_VERSION[ \t]+\"[^\"]+\".*$" ) +if( ZLIB_LOCAL_LIBRARIES AND ZLIB_LOCAL_INCLUDE_DIRS ) + file( STRINGS "${ZLIB_LOCAL_INCLUDE_DIRS}/zlib.h" ZLIB_H REGEX "^#define[ \t]+ZLIB_VERSION[ \t]+\"[^\"]+\".*$" ) string( REGEX REPLACE "^.*ZLIB_VERSION[ \t]+\"([^\"]+)\".*$" "\\1" ZLIB_VERSION "${ZLIB_H}" ) - message( STATUS "Found local ZLIB: ${LOCAL_ZLIB_LIBRARIES} (found version ${ZLIB_VERSION})" ) + message( STATUS "Found local ZLIB: ${ZLIB_LOCAL_LIBRARIES} (found version ${ZLIB_VERSION})" ) set( HAVE_LOCAL_ZLIB ON CACHE BOOL "zlib is available as a local copy" ) else() - foreach( _VAR LOCAL_ZLIB_LIBRARIES LOCAL_ZLIB_INCLUDE_DIRS ) + foreach( _VAR ZLIB_LOCAL_LIBRARIES ZLIB_LOCAL_INCLUDE_DIRS ) if( NOT "${_VAR}" ) set( MISSING_VARS ${MISSING_VARS} ${_VAR} ) endif() @@ -37,15 +37,17 @@ endif( WIN32 ) # system # message( STATUS "Detecting system ZLIB" ) +unset( ZLIB_LIBRARIES CACHE ) +unset( ZLIB_INCLUDE_DIRS CACHE ) find_package( ZLIB ) -set( SYSTEM_ZLIB_LIBRARIES ${ZLIB_LIBRARIES} +set( ZLIB_SYSTEM_LIBRARIES ${ZLIB_LIBRARIES} CACHE PATH "system zlib libraries" ) -set( SYSTEM_ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS} +set( ZLIB_SYSTEM_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS} CACHE PATH "system zlib include directories" ) -mark_as_advanced( SYSTEM_ZLIB_LIBRARIES ) -mark_as_advanced( SYSTEM_ZLIB_INCLUDE_DIRS ) +mark_as_advanced( ZLIB_SYSTEM_LIBRARIES ) +mark_as_advanced( ZLIB_SYSTEM_INCLUDE_DIRS ) -if( SYSTEM_ZLIB_LIBRARIES AND SYSTEM_ZLIB_INCLUDE_DIRS ) +if( ZLIB_SYSTEM_LIBRARIES AND ZLIB_SYSTEM_INCLUDE_DIRS ) set( HAVE_SYSTEM_ZLIB ON CACHE BOOL "zlib is available on the system" ) else() @@ -57,34 +59,4 @@ message( STATUS "Detecting system ZLIB - done" ) # # configure # -unset( ZLIB_LIBRARIES CACHE ) -unset( ZLIB_INCLUDE_DIRS CACHE ) -if( HAVE_LOCAL_ZLIB ) - set( USE_LOCAL_ZLIB ON - CACHE BOOL "use local copy of zlib" ) -else() - unset( USE_LOCAL_ZLIB CACHE ) -endif() -if( USE_LOCAL_ZLIB ) - message( STATUS "Configuring for local ZLIB" ) - set( ZLIB_LIBRARIES ${LOCAL_ZLIB_LIBRARIES} ) - set( ZLIB_INCLUDE_DIRS ${LOCAL_ZLIB_INCLUDE_DIRS} ) - message( STATUS "Configuring for local ZLIB - done" ) -elseif( HAVE_SYSTEM_ZLIB ) - message( STATUS "Configuring for system ZLIB" ) - set( ZLIB_LIBRARIES ${SYSTEM_ZLIB_LIBRARIES} ) - set( ZLIB_INCLUDE_DIRS ${SYSTEM_ZLIB_INCLUDE_DIRS} ) - message( STATUS "Configuring for system ZLIB - done" ) -endif() -if( USE_LOCAL_ZLIB OR HAVE_SYSTEM_ZLIB ) - set( USE_ZLIB ON - CACHE BOOL "use zlib" ) -else() - unset( USE_ZLIB CACHE ) -endif() -set( ZLIB_LIBRARIES ${ZLIB_LIBRARIES} - CACHE PATH "zlib libraries" ) -set( ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS} - CACHE PATH "zlib include directories" ) -mark_as_advanced( ZLIB_LIBRARIES ) -mark_as_advanced( ZLIB_INCLUDE_DIRS ) +CONFIGURE_USE_LOCAL_OR_SYSTEM( ZLIB ) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f7c46987..a56059956 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,10 @@ - +# "Getting Started with CMake", a tutorial video by Eric Wing. +# Part 1 of 6: http://www.youtube.com/watch?v=CLvZTyji_Uw +# Part 2 of 6: http://www.youtube.com/watch?v=gUW-RrRQjEg +# Part 3 of 6: http://www.youtube.com/watch?v=sz6cPhbuTk4 +# Part 4 of 6: http://www.youtube.com/watch?v=JICZOkyNXbg +# Part 5 of 6: http://www.youtube.com/watch?v=lAiuLHy4dCk +# Part 6 of 6: http://www.youtube.com/watch?v=fAtJNzDZdH8 cmake_minimum_required( VERSION 2.8.4 ) project( eAthena ) @@ -165,13 +171,43 @@ endif() set( PACKETVER "" CACHE STRING "Sets the PACKETVER define of the servers. (see src/common/mmo.h)" ) + +##################################################################### +# package stuff +# +if( OFF ) +set( CPACK_PACKAGE_NAME "eAthena" ) +set( CPACK_PACKAGE_DESCRIPTION_SUMMARY "MMORPG server package" ) +set( CPACK_PACKAGE_FILE_NAME ) +set( CPACK_PACKAGE_INSTALL_DIRECTORY ) +set( CPACK_PROJECT_CONFIG_FILE ) +set( CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE ) +set( CPACK_RESOURCE_FILE_README ) +set( CPACK_RESOURCE_FILE_WELCOME ) +set( CPACK_MONOLITHIC_INSTALL ON ) +set( CPACK_GENERATOR "ZIP" ) +set( CPACK_OUTPUT_CONFIG_FILE ) +set( CPACK_PACKAGE_EXECUTABLES ) +set( CPACK_STRIP_FILES ) +#source +set( CPACK_SOURCE_PACKAGE_FILE_NAME ) +set( CPACK_SOURCE_STRIP_FILES ) +set( CPACK_SOURCE_GENERATOR "ZIP" ) +set( CPACK_SOURCE_OUTPUT_CONFIG_FILE ) +set( CPACK_SOURCE_IGNORE_FILES ) +include(CPACK) +endif() + + # # install stuff # +set( COMPONENT_SOURCE "Source code, librarires and project files" CACHE INTERNAL "" ) +set( COMPONENT_BASE "Base files" CACHE INTERNAL "" ) option( INSTALL_RUN_DATA "install files needed to run the project" ON ) option( INSTALL_BUILD_DATA "install files needed to build the project" OFF ) set( SVN_FOLDER_PATTERN "[\\.]svn" - CACHE PATH "pattern of svn folder that we exclude from instalations" ) + CACHE STRING "pattern of svn folder that we exclude from instalations" ) mark_as_advanced( SVN_FOLDER_PATTERN ) if( "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_INSTALL_PREFIX}" ) set( INSTALLING_TO_SOURCE ON @@ -252,18 +288,37 @@ function( INSTALL_DIRECTORIES DIRS EXCLUDE_PATTERN ) endforeach() endfunction() if( NOT INSTALLING_TO_SOURCE ) + # skipped if in-source if( INSTALL_RUN_DATA ) - install( FILES ${LOCAL_RUN_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX} ) - INSTALL_DIRECTORIES( "${LOCAL_RUN_DIRECTORIES}" "conf/import-tmpl" ) + # base + install( FILES ${LOCAL_RUN_FILES} + DESTINATION ${CMAKE_INSTALL_PREFIX} ) + foreach( DIR IN ITEMS ${LOCAL_RUN_DIRECTORIES} ) + install( DIRECTORY "${DIR}/" + DESTINATION "${DIR}" + PATTERN ${SVN_FOLDER_PATTERN} EXCLUDE + PATTERN "conf/import-tmpl" EXCLUDE ) + endforeach() endif() if( INSTALL_BUILD_DATA ) - install( FILES ${LOCAL_BUILD_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX} ) - INSTALL_DIRECTORIES( "${LOCAL_BUILD_DIRECTORIES}" "" ) + # source + install( FILES ${LOCAL_BUILD_FILES} + DESTINATION ${CMAKE_INSTALL_PREFIX} ) + foreach( DIR IN ITEMS ${LOCAL_BUILD_DIRECTORIES} ) + install( DIRECTORY "${DIR}/" + DESTINATION "${DIR}" + PATTERN ${SVN_FOLDER_PATTERN} EXCLUDE ) + endforeach() endif() endif() if( INSTALL_RUN_DATA ) - INSTALL_DIRECTORY( "save-tmpl" "save" "" ) - INSTALL_DIRECTORY( "conf/import-tmpl" "conf/import" "" ) + # base templates + install( DIRECTORY "save-tmpl/" + DESTINATION "save" + PATTERN ${SVN_FOLDER_PATTERN} EXCLUDE ) + install( DIRECTORY "conf/import-tmpl/" + DESTINATION "conf/import" + PATTERN ${SVN_FOLDER_PATTERN} EXCLUDE ) endif() diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index cc0b1d7ef..f8b235416 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -1,5 +1,7 @@ Date Added +2011/07/01 + * CMake: marked executables as different components and other miscellaneous changes. [FlavioJS] 2011/06/29 * Added experimental support for CMake. (for now: basic build, no extras, only tested with VS10 and cygwin) [FlavioJS] 2011/06/27 diff --git a/src/char/CMakeLists.txt b/src/char/CMakeLists.txt index 666070532..5c2d66c3c 100644 --- a/src/char/CMakeLists.txt +++ b/src/char/CMakeLists.txt @@ -1,5 +1,7 @@ +# # setup +# set( MT19937AR_SOURCES # "${MT19937AR_SOURCE_DIR}/mt19937ar.c" ) @@ -33,7 +35,9 @@ set( CHAR_SOURCES ) +# # char txt +# if( USE_ZLIB ) message ( STATUS "Creating target char-server" ) set( LIBRARIES ${GLOBAL_LIBRARIES} ${ZLIB_LIBRARIES} ) @@ -56,7 +60,9 @@ add_executable( char-server ${SOURCE_FILES} ) target_link_libraries( char-server ${LIBRARIES} ) set_target_properties( char-server PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}" ) if( INSTALL_RUN_DATA ) - install( TARGETS char-server DESTINATION ${CMAKE_INSTALL_PREFIX} ) + install( TARGETS char-server + DESTINATION ${CMAKE_INSTALL_PREFIX} + COMPONENT "char-server" ) endif() message ( STATUS "Creating target char-server - done" ) else() diff --git a/src/char_sql/CMakeLists.txt b/src/char_sql/CMakeLists.txt index d534ce89c..412393b21 100644 --- a/src/char_sql/CMakeLists.txt +++ b/src/char_sql/CMakeLists.txt @@ -1,5 +1,7 @@ +# # setup +# set( MT19937AR_SOURCES # "${MT19937AR_SOURCE_DIR}/mt19937ar.c" ) @@ -37,7 +39,9 @@ set( CHAR_SOURCES ) +# # char sql +# if( USE_ZLIB AND USE_MYSQL ) message ( STATUS "Creating target char-server_sql" ) set( LIBRARIES ${GLOBAL_LIBRARIES} ${ZLIB_LIBRARIES} ${MYSQL_LIBRARIES} ) @@ -60,7 +64,9 @@ add_executable( char-server_sql ${SOURCE_FILES} ) target_link_libraries( char-server_sql ${LIBRARIES} ) set_target_properties( char-server_sql PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}" ) if( INSTALL_RUN_DATA ) - install( TARGETS char-server_sql DESTINATION ${CMAKE_INSTALL_PREFIX} ) + install( TARGETS char-server_sql + DESTINATION ${CMAKE_INSTALL_PREFIX} + COMPONENT "char-server_sql" ) endif() message ( STATUS "Creating target char-server_sql - done" ) else() diff --git a/src/login/CMakeLists.txt b/src/login/CMakeLists.txt index 88d137507..b75878eed 100644 --- a/src/login/CMakeLists.txt +++ b/src/login/CMakeLists.txt @@ -1,5 +1,7 @@ +# # setup +# set( MT19937AR_SOURCES "${MT19937AR_SOURCE_DIR}/mt19937ar.c" ) @@ -64,7 +66,9 @@ add_executable( login-server ${SOURCE_FILES} ) target_link_libraries( login-server ${LIBRARIES} ) set_target_properties( login-server PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}" ) if( INSTALL_RUN_DATA ) - install( TARGETS login-server DESTINATION ${CMAKE_INSTALL_PREFIX} ) + install( TARGETS login-server + DESTINATION ${CMAKE_INSTALL_PREFIX} + COMPONENT "login-server" ) endif() message ( STATUS "Creating target login-server - done" ) else() @@ -72,7 +76,9 @@ message ( STATUS "Skipping target login-server (requires ZLIB)" ) endif() +# # login sql +# if( USE_ZLIB AND USE_MYSQL ) message ( STATUS "Creating target login-server_sql" ) set( LIBRARIES ${GLOBAL_LIBRARIES} ${ZLIB_LIBRARIES} ${MYSQL_LIBRARIES} ) @@ -95,7 +101,9 @@ add_executable( login-server_sql ${SOURCE_FILES} ) target_link_libraries( login-server_sql ${LIBRARIES} ) set_target_properties( login-server_sql PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}" ) if( INSTALL_RUN_DATA ) - install( TARGETS login-server_sql DESTINATION ${CMAKE_INSTALL_PREFIX} ) + install( TARGETS login-server_sql + DESTINATION ${CMAKE_INSTALL_PREFIX} + COMPONENT "login-server_sql" ) endif() message ( STATUS "Creating target login-server_sql - done" ) else() diff --git a/src/map/CMakeLists.txt b/src/map/CMakeLists.txt index e5589a30e..7189bbdd7 100644 --- a/src/map/CMakeLists.txt +++ b/src/map/CMakeLists.txt @@ -1,5 +1,7 @@ +# # setup +# set( MT19937AR_SOURCES "${MT19937AR_SOURCE_DIR}/mt19937ar.c" ) @@ -68,7 +70,9 @@ set( MAP_SQL_SOURCES ) +# # map txt +# if( USE_ZLIB ) message ( STATUS "Creating target map-server" ) set( LIBRARIES ${GLOBAL_LIBRARIES} ${ZLIB_LIBRARIES} ) @@ -96,7 +100,9 @@ add_executable( map-server ${SOURCE_FILES} ) target_link_libraries( map-server ${LIBRARIES} ) set_target_properties( map-server PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}" ) if( INSTALL_RUN_DATA ) - install( TARGETS map-server DESTINATION ${CMAKE_INSTALL_PREFIX} ) + install( TARGETS map-server + DESTINATION ${CMAKE_INSTALL_PREFIX} + COMPONENT "map-server" ) endif() message ( STATUS "Creating target map-server - done" ) else() @@ -104,7 +110,9 @@ message ( STATUS "Skipping target map-server (requires ZLIB; optional PCRE)" ) endif() +# # map sql +# if( USE_ZLIB AND USE_MYSQL ) message ( STATUS "Creating target map-server_sql" ) set( LIBRARIES ${GLOBAL_LIBRARIES} ${ZLIB_LIBRARIES} ${MYSQL_LIBRARIES} ) @@ -132,7 +140,9 @@ add_executable( map-server_sql ${SOURCE_FILES} ) target_link_libraries( map-server_sql ${LIBRARIES} ) set_target_properties( map-server_sql PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}" ) if( INSTALL_RUN_DATA ) - install( TARGETS map-server_sql DESTINATION ${CMAKE_INSTALL_PREFIX} ) + install( TARGETS map-server_sql + DESTINATION ${CMAKE_INSTALL_PREFIX} + COMPONENT "map-server_sql" ) endif() message ( STATUS "Creating target map-server_sql - done" ) else() diff --git a/src/tool/CMakeLists.txt b/src/tool/CMakeLists.txt index 5b4880893..4f69174b9 100644 --- a/src/tool/CMakeLists.txt +++ b/src/tool/CMakeLists.txt @@ -41,7 +41,9 @@ include_directories( ${INCLUDE_DIRS} ) target_link_libraries( mapcache ${ZLIB_LIBRARIES} ) set_target_properties( mapcache PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}" ) if( INSTALL_RUN_DATA ) - install( TARGETS mapcache DESTINATION ${CMAKE_INSTALL_PREFIX} ) + install( TARGETS mapcache + DESTINATION ${CMAKE_INSTALL_PREFIX} + COMPONENT "mapcache" ) endif() message ( STATUS "Creating target mapcache - done" ) else() -- cgit v1.2.3-70-g09d2 From 76d7c8ad887ac7b9dfdb495fe26ef8d4d8dfe370 Mon Sep 17 00:00:00 2001 From: flaviojs Date: Thu, 7 Jul 2011 03:21:42 +0000 Subject: * CMake: normalized variable names, added ability to create a package/installer. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14890 54d463be-8e91-2dee-dedb-b68131a5f0ec --- 3rdparty/CMakeLists.txt | 20 +-- 3rdparty/mysql/CMakeLists.txt | 6 +- 3rdparty/pcre/CMakeLists.txt | 4 +- 3rdparty/zlib/CMakeLists.txt | 4 +- CMakeLists.txt | 380 ++++++++++++++++-------------------------- Changelog-Trunk.txt | 1 + src/char/CMakeLists.txt | 7 +- src/char_sql/CMakeLists.txt | 7 +- src/common/CMakeLists.txt | 25 +-- src/login/sql/CMakeLists.txt | 7 +- src/login/txt/CMakeLists.txt | 7 +- src/map/sql/CMakeLists.txt | 9 +- src/map/txt/CMakeLists.txt | 9 +- src/tool/CMakeLists.txt | 35 +--- 14 files changed, 206 insertions(+), 315 deletions(-) (limited to '3rdparty/pcre/CMakeLists.txt') diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index 0ea359186..3e7cb4cc4 100644 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -8,20 +8,20 @@ # ${name}_SYSTEM_LIBRARIES - libraries of the system version # ${name}_SYSTEM_INCLUDE_DIRS - include directories of the system version # Generates: -# USE_LOCAL_${name} - use the local version of the package (only when local is available) -# USE_${name} - use this package +# WITH_LOCAL_${name} - use the local version of the package (only when local is available) +# WITH_${name} - use this package # ${name}_LIBRARIES - libraries # ${name}_INCLUDE_DIRS - include directories -macro( CONFIGURE_USE_LOCAL_OR_SYSTEM name ) +macro( CONFIGURE_WITH_LOCAL_OR_SYSTEM name ) unset( ${name}_LIBRARIES CACHE ) unset( ${name}_INCLUDE_DIRS CACHE ) if( HAVE_LOCAL_${name} ) - set( USE_LOCAL_${name} ON + set( WITH_LOCAL_${name} ON CACHE BOOL "use local version of ${name}" ) else() - unset( USE_LOCAL_${name} CACHE ) + unset( WITH_LOCAL_${name} CACHE ) endif() - if( USE_LOCAL_${name} ) + if( WITH_LOCAL_${name} ) message( STATUS "Configuring for local ${name}" ) set( ${name}_LIBRARIES ${${name}_LOCAL_LIBRARIES} ) set( ${name}_INCLUDE_DIRS ${${name}_LOCAL_INCLUDE_DIRS} ) @@ -32,11 +32,11 @@ macro( CONFIGURE_USE_LOCAL_OR_SYSTEM name ) set( ${name}_INCLUDE_DIRS ${${name}_SYSTEM_INCLUDE_DIRS} ) message( STATUS "Configuring for system ${name} - done" ) endif() - if( USE_LOCAL_${name} OR HAVE_SYSTEM_${name} ) - set( USE_${name} ON + if( WITH_LOCAL_${name} OR HAVE_SYSTEM_${name} ) + set( WITH_${name} ON CACHE BOOL "use ${name}" ) else() - unset( USE_${name} CACHE ) + unset( WITH_${name} CACHE ) endif() set( ${name}_LIBRARIES ${${name}_LIBRARIES} CACHE PATH "${name} libraries" ) @@ -44,7 +44,7 @@ macro( CONFIGURE_USE_LOCAL_OR_SYSTEM name ) CACHE PATH "${name} include directories" ) mark_as_advanced( ${name}_LIBRARIES ) mark_as_advanced( ${name}_INCLUDE_DIRS ) -endmacro( CONFIGURE_USE_LOCAL_OR_SYSTEM ) +endmacro( CONFIGURE_WITH_LOCAL_OR_SYSTEM ) add_subdirectory( msinttypes ) diff --git a/3rdparty/mysql/CMakeLists.txt b/3rdparty/mysql/CMakeLists.txt index 902037f07..3f792281c 100644 --- a/3rdparty/mysql/CMakeLists.txt +++ b/3rdparty/mysql/CMakeLists.txt @@ -24,6 +24,7 @@ if( MYSQL_LOCAL_LIBRARIES AND MYSQL_LOCAL_INCLUDE_DIRS ) endif() set( HAVE_LOCAL_MYSQL ON CACHE BOOL "mysql client is available as a local copy") + mark_as_advanced( HAVE_LOCAL_MYSQL ) else() foreach( _VAR MYSQL_LOCAL_LIBRARIES MYSQL_LOCAL_INCLUDE_DIRS ) if( NOT "${_VAR}" ) @@ -70,6 +71,9 @@ mark_as_advanced( MYSQL_SYSTEM_INCLUDE_DIRS ) if( MYSQL_SYSTEM_LIBRARIES AND MYSQL_SYSTEM_INCLUDE_DIRS ) set( HAVE_SYSTEM_MYSQL ON CACHE BOOL "mysql client is available on the system" ) + mark_as_advanced( HAVE_SYSTEM_MYSQL ) +else() + unset( HAVE_SYSTEM_MYSQL CACHE ) endif() message( STATUS "Detecting system MYSQL - done" ) @@ -77,4 +81,4 @@ message( STATUS "Detecting system MYSQL - done" ) # # configure # -CONFIGURE_USE_LOCAL_OR_SYSTEM( MYSQL ) +CONFIGURE_WITH_LOCAL_OR_SYSTEM( MYSQL ) diff --git a/3rdparty/pcre/CMakeLists.txt b/3rdparty/pcre/CMakeLists.txt index ab1c83b6d..70448d40e 100644 --- a/3rdparty/pcre/CMakeLists.txt +++ b/3rdparty/pcre/CMakeLists.txt @@ -21,6 +21,7 @@ if( PCRE_LOCAL_LIBRARIES AND PCRE_LOCAL_INCLUDE_DIRS ) message( STATUS "Found PCRE: ${PCRE_LOCAL_LIBRARIES} (found version ${PCRE_MAJOR}.${PCRE_MINOR})" ) set( HAVE_LOCAL_PCRE ON CACHE BOOL "pcre is available as a local copy" ) + mark_as_advanced( HAVE_LOCAL_PCRE ) else() foreach( _VAR PCRE_LOCAL_LIBRARIES PCRE_LOCAL_INCLUDE_DIRS ) if( NOT "${_VAR}" ) @@ -52,6 +53,7 @@ mark_as_advanced( PCRE_SYSTEM_INCLUDE_DIRS ) if( PCRE_SYSTEM_LIBRARIES AND PCRE_SYSTEM_INCLUDE_DIRS ) set( HAVE_SYSTEM_PCRE ON CACHE BOOL "pcre is available on the system" ) + mark_as_advanced( HAVE_SYSTEM_PCRE ) else() unset( HAVE_SYSTEM_PCRE CACHE ) endif() @@ -61,4 +63,4 @@ message( STATUS "Detecting system PCRE - done" ) # # configure # -CONFIGURE_USE_LOCAL_OR_SYSTEM( PCRE ) +CONFIGURE_WITH_LOCAL_OR_SYSTEM( PCRE ) diff --git a/3rdparty/zlib/CMakeLists.txt b/3rdparty/zlib/CMakeLists.txt index 3bb4304e7..4002908f5 100644 --- a/3rdparty/zlib/CMakeLists.txt +++ b/3rdparty/zlib/CMakeLists.txt @@ -20,6 +20,7 @@ if( ZLIB_LOCAL_LIBRARIES AND ZLIB_LOCAL_INCLUDE_DIRS ) message( STATUS "Found local ZLIB: ${ZLIB_LOCAL_LIBRARIES} (found version ${ZLIB_VERSION})" ) set( HAVE_LOCAL_ZLIB ON CACHE BOOL "zlib is available as a local copy" ) + mark_as_advanced( HAVE_LOCAL_ZLIB ) else() foreach( _VAR ZLIB_LOCAL_LIBRARIES ZLIB_LOCAL_INCLUDE_DIRS ) if( NOT "${_VAR}" ) @@ -50,6 +51,7 @@ mark_as_advanced( ZLIB_SYSTEM_INCLUDE_DIRS ) if( ZLIB_SYSTEM_LIBRARIES AND ZLIB_SYSTEM_INCLUDE_DIRS ) set( HAVE_SYSTEM_ZLIB ON CACHE BOOL "zlib is available on the system" ) + mark_as_advanced( HAVE_SYSTEM_ZLIB ) else() unset( HAVE_SYSTEM_ZLIB CACHE ) endif() @@ -59,4 +61,4 @@ message( STATUS "Detecting system ZLIB - done" ) # # configure # -CONFIGURE_USE_LOCAL_OR_SYSTEM( ZLIB ) +CONFIGURE_WITH_LOCAL_OR_SYSTEM( ZLIB ) diff --git a/CMakeLists.txt b/CMakeLists.txt index 59529c442..953c804ff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,12 @@ # Part 4 of 6: http://www.youtube.com/watch?v=JICZOkyNXbg # Part 5 of 6: http://www.youtube.com/watch?v=lAiuLHy4dCk # Part 6 of 6: http://www.youtube.com/watch?v=fAtJNzDZdH8 +# +# You can use notepad++ for syntax highlighting. +# Naming conventions: +# WITH_* : option to use an external package or not +# ENABLE_* : option to use an internal feature/code or not +# HAVE_* : internal variable indicating if we have and are using something cmake_minimum_required( VERSION 2.8.4 ) project( eAthena ) @@ -19,218 +25,134 @@ elseif( "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}" ) endif() -# -# Debug stuff -# -if( NOT SKIP_DEBUG ) -message( "DEBUG: # Variables That Change Behavior" ) -message( "DEBUG: BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}" ) -message( "DEBUG: CMAKE_BACKWARDS_COMPATIBILITY=${CMAKE_BACKWARDS_COMPATIBILITY}" ) -message( "DEBUG: CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" ) -message( "DEBUG: CMAKE_COLOR_MAKEFILE=${CMAKE_COLOR_MAKEFILE}" ) -message( "DEBUG: CMAKE_CONFIGURATION_TYPES=${CMAKE_CONFIGURATION_TYPES}" ) -message( "DEBUG: CMAKE_FIND_LIBRARY_PREFIXES=${CMAKE_FIND_LIBRARY_PREFIXES}" ) -message( "DEBUG: CMAKE_FIND_LIBRARY_SUFFIXES=${CMAKE_FIND_LIBRARY_SUFFIXES}" ) -message( "DEBUG: CMAKE_IGNORE_PATH=${CMAKE_IGNORE_PATH}" ) -message( "DEBUG: CMAKE_INCLUDE_PATH=${CMAKE_INCLUDE_PATH}" ) -message( "DEBUG: CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}" ) -message( "DEBUG: CMAKE_LIBRARY_PATH=${CMAKE_LIBRARY_PATH}" ) -message( "DEBUG: CMAKE_MFC_FLAG=${CMAKE_MFC_FLAG}" ) -message( "DEBUG: CMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}" ) -message( "DEBUG: CMAKE_NOT_USING_CONFIG_FLAGS=${CMAKE_NOT_USING_CONFIG_FLAGS}" ) -message( "DEBUG: CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}" ) -message( "DEBUG: CMAKE_PROGRAM_PATH=${CMAKE_PROGRAM_PATH}" ) -message( "DEBUG: CMAKE_SKIP_INSTALL_ALL_DEPENDENCY=${CMAKE_SKIP_INSTALL_ALL_DEPENDENCY}" ) -message( "DEBUG: CMAKE_SYSTEM_IGNORE_PATH=${CMAKE_SYSTEM_IGNORE_PATH}" ) -message( "DEBUG: CMAKE_SYSTEM_INCLUDE_PATH=${CMAKE_SYSTEM_INCLUDE_PATH}" ) -message( "DEBUG: CMAKE_SYSTEM_LIBRARY_PATH=${CMAKE_SYSTEM_LIBRARY_PATH}" ) -message( "DEBUG: CMAKE_SYSTEM_PREFIX_PATH=${CMAKE_SYSTEM_PREFIX_PATH}" ) -message( "DEBUG: CMAKE_SYSTEM_PROGRAM_PATH=${CMAKE_SYSTEM_PROGRAM_PATH}" ) -message( "DEBUG: CMAKE_USER_MAKE_RULES_OVERRIDE=${CMAKE_USER_MAKE_RULES_OVERRIDE}" ) -message( "DEBUG: # Variables That Describe the System" ) -message( "DEBUG: APPLE=${APPLE}" ) -message( "DEBUG: BORLAND=${BORLAND}" ) -message( "DEBUG: CMAKE_CL_64=${CMAKE_CL_64}" ) -message( "DEBUG: CMAKE_COMPILER_2005=${CMAKE_COMPILER_2005}" ) -message( "DEBUG: CMAKE_HOST_APPLE=${CMAKE_HOST_APPLE}" ) -message( "DEBUG: CMAKE_HOST_SYSTEM=${CMAKE_HOST_SYSTEM}" ) -message( "DEBUG: CMAKE_HOST_SYSTEM_NAME=${CMAKE_HOST_SYSTEM_NAME}" ) -message( "DEBUG: CMAKE_HOST_SYSTEM_PROCESSOR=${CMAKE_HOST_SYSTEM_PROCESSOR}" ) -message( "DEBUG: CMAKE_HOST_SYSTEM_VERSION=${CMAKE_HOST_SYSTEM_VERSION}" ) -message( "DEBUG: CMAKE_HOST_UNIX=${CMAKE_HOST_UNIX}" ) -message( "DEBUG: CMAKE_HOST_WIN32=${CMAKE_HOST_WIN32}" ) -message( "DEBUG: CMAKE_OBJECT_PATH_MAX=${CMAKE_OBJECT_PATH_MAX}" ) -message( "DEBUG: CMAKE_SYSTEM=${CMAKE_SYSTEM}" ) -message( "DEBUG: CMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}" ) -message( "DEBUG: CMAKE_SYSTEM_PROCESSOR=${CMAKE_SYSTEM_PROCESSOR}" ) -message( "DEBUG: CMAKE_SYSTEM_VERSION=${CMAKE_SYSTEM_VERSION}" ) -message( "DEBUG: CYGWIN=${CYGWIN}" ) -message( "DEBUG: MSVC=${MSVC}" ) -message( "DEBUG: MSVC80=${MSVC80}" ) -message( "DEBUG: MSVC_IDE=${MSVC_IDE}" ) -message( "DEBUG: MSVC_VERSION=${MSVC_VERSION}" ) -message( "DEBUG: UNIX=${UNIX}" ) -message( "DEBUG: WIN32=${WIN32}" ) -message( "DEBUG: XCODE_VERSION=${XCODE_VERSION}" ) -message( "DEBUG: # Variables that Control the Build" ) -message( "DEBUG: CMAKE_ARCHIVE_OUTPUT_DIRECTORY=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}" ) -message( "DEBUG: CMAKE_BUILD_WITH_INSTALL_RPATH=${CMAKE_BUILD_WITH_INSTALL_RPATH}" ) -message( "DEBUG: CMAKE_DEBUG_POSTFIX=${CMAKE_DEBUG_POSTFIX}" ) -message( "DEBUG: CMAKE_EXE_LINKER_FLAGS=${CMAKE_EXE_LINKER_FLAGS}" ) -message( "DEBUG: CMAKE_INCLUDE_CURRENT_DIR=${CMAKE_INCLUDE_CURRENT_DIR}" ) -message( "DEBUG: CMAKE_INSTALL_NAME_DIR=${CMAKE_INSTALL_NAME_DIR}" ) -message( "DEBUG: CMAKE_INSTALL_RPATH=${CMAKE_INSTALL_RPATH}" ) -message( "DEBUG: CMAKE_INSTALL_RPATH_USE_LINK_PATH=${CMAKE_INSTALL_RPATH_USE_LINK_PATH}" ) -message( "DEBUG: CMAKE_LIBRARY_OUTPUT_DIRECTORY=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}" ) -message( "DEBUG: CMAKE_LIBRARY_PATH_FLAG=${CMAKE_LIBRARY_PATH_FLAG}" ) -message( "DEBUG: CMAKE_LINK_DEF_FILE_FLAG=${CMAKE_LINK_DEF_FILE_FLAG}" ) -message( "DEBUG: CMAKE_LINK_LIBRARY_FILE_FLAG=${CMAKE_LINK_LIBRARY_FILE_FLAG}" ) -message( "DEBUG: CMAKE_LINK_LIBRARY_FLAG=${CMAKE_LINK_LIBRARY_FLAG}" ) -message( "DEBUG: CMAKE_NO_BUILTIN_CHRPATH=${CMAKE_NO_BUILTIN_CHRPATH}" ) -message( "DEBUG: CMAKE_RUNTIME_OUTPUT_DIRECTORY=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" ) -message( "DEBUG: CMAKE_SKIP_BUILD_RPATH=${CMAKE_SKIP_BUILD_RPATH}" ) -message( "DEBUG: CMAKE_TRY_COMPILE_CONFIGURATION=${CMAKE_TRY_COMPILE_CONFIGURATION}" ) -message( "DEBUG: CMAKE_USE_RELATIVE_PATHS=${CMAKE_USE_RELATIVE_PATHS}" ) -message( "DEBUG: EXECUTABLE_OUTPUT_PATH=${EXECUTABLE_OUTPUT_PATH}" ) -message( "DEBUG: LIBRARY_OUTPUT_PATH=${LIBRARY_OUTPUT_PATH}" ) -message( "DEBUG: # Variables that Provide Information" ) -message( "DEBUG: CMAKE_AR=${CMAKE_AR}" ) -message( "DEBUG: CMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}" ) -message( "DEBUG: CMAKE_BUILD_TOOL=${CMAKE_BUILD_TOOL}" ) -message( "DEBUG: CMAKE_CACHEFILE_DIR=${CMAKE_CACHEFILE_DIR}" ) -message( "DEBUG: CMAKE_CACHE_MAJOR_VERSION=${CMAKE_CACHE_MAJOR_VERSION}" ) -message( "DEBUG: CMAKE_CACHE_MINOR_VERSION=${CMAKE_CACHE_MINOR_VERSION}" ) -message( "DEBUG: CMAKE_CACHE_PATCH_VERSION=${CMAKE_CACHE_PATCH_VERSION}" ) -message( "DEBUG: CMAKE_CFG_INTDIR=${CMAKE_CFG_INTDIR}" ) -message( "DEBUG: CMAKE_COMMAND=${CMAKE_COMMAND}" ) -message( "DEBUG: CMAKE_CROSSCOMPILING=${CMAKE_CROSSCOMPILING}" ) -message( "DEBUG: CMAKE_CTEST_COMMAND=${CMAKE_CTEST_COMMAND}" ) -message( "DEBUG: CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}" ) -message( "DEBUG: CMAKE_CURRENT_LIST_DIR=${CMAKE_CURRENT_LIST_DIR}" ) -message( "DEBUG: CMAKE_CURRENT_LIST_FILE=${CMAKE_CURRENT_LIST_FILE}" ) -message( "DEBUG: CMAKE_CURRENT_LIST_LINE=${CMAKE_CURRENT_LIST_LINE}" ) -message( "DEBUG: CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}" ) -message( "DEBUG: CMAKE_DL_LIBS=${CMAKE_DL_LIBS}" ) -message( "DEBUG: CMAKE_EDIT_COMMAND=${CMAKE_EDIT_COMMAND}" ) -message( "DEBUG: CMAKE_EXECUTABLE_SUFFIX=${CMAKE_EXECUTABLE_SUFFIX}" ) -message( "DEBUG: CMAKE_EXTRA_GENERATOR=${CMAKE_EXTRA_GENERATOR}" ) -message( "DEBUG: CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES=${CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES}" ) -message( "DEBUG: CMAKE_GENERATOR=${CMAKE_GENERATOR}" ) -message( "DEBUG: CMAKE_HOME_DIRECTORY=${CMAKE_HOME_DIRECTORY}" ) -message( "DEBUG: CMAKE_IMPORT_LIBRARY_PREFIX=${CMAKE_IMPORT_LIBRARY_PREFIX}" ) -message( "DEBUG: CMAKE_IMPORT_LIBRARY_SUFFIX=${CMAKE_IMPORT_LIBRARY_SUFFIX}" ) -message( "DEBUG: CMAKE_LINK_LIBRARY_SUFFIX=${CMAKE_LINK_LIBRARY_SUFFIX}" ) -message( "DEBUG: CMAKE_MAJOR_VERSION=${CMAKE_MAJOR_VERSION}" ) -message( "DEBUG: CMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}" ) -message( "DEBUG: CMAKE_MINOR_VERSION=${CMAKE_MINOR_VERSION}" ) -message( "DEBUG: CMAKE_PARENT_LIST_FILE=${CMAKE_PARENT_LIST_FILE}" ) -message( "DEBUG: CMAKE_PATCH_VERSION=${CMAKE_PATCH_VERSION}" ) -message( "DEBUG: CMAKE_PROJECT_NAME=${CMAKE_PROJECT_NAME}" ) -message( "DEBUG: CMAKE_RANLIB=${CMAKE_RANLIB}" ) -message( "DEBUG: CMAKE_ROOT=${CMAKE_ROOT}" ) -message( "DEBUG: CMAKE_SHARED_LIBRARY_PREFIX=${CMAKE_SHARED_LIBRARY_PREFIX}" ) -message( "DEBUG: CMAKE_SHARED_LIBRARY_SUFFIX=${CMAKE_SHARED_LIBRARY_SUFFIX}" ) -message( "DEBUG: CMAKE_SHARED_MODULE_PREFIX=${CMAKE_SHARED_MODULE_PREFIX}" ) -message( "DEBUG: CMAKE_SHARED_MODULE_SUFFIX=${CMAKE_SHARED_MODULE_SUFFIX}" ) -message( "DEBUG: CMAKE_SIZEOF_VOID_P=${CMAKE_SIZEOF_VOID_P}" ) -message( "DEBUG: CMAKE_SKIP_RPATH=${CMAKE_SKIP_RPATH}" ) -message( "DEBUG: CMAKE_SOURCE_DIR=${CMAKE_SOURCE_DIR}" ) -message( "DEBUG: CMAKE_STANDARD_LIBRARIES=${CMAKE_STANDARD_LIBRARIES}" ) -message( "DEBUG: CMAKE_STATIC_LIBRARY_PREFIX=${CMAKE_STATIC_LIBRARY_PREFIX}" ) -message( "DEBUG: CMAKE_STATIC_LIBRARY_SUFFIX=${CMAKE_STATIC_LIBRARY_SUFFIX}" ) -message( "DEBUG: CMAKE_TWEAK_VERSION=${CMAKE_TWEAK_VERSION}" ) -message( "DEBUG: CMAKE_USING_VC_FREE_TOOLS=${CMAKE_USING_VC_FREE_TOOLS}" ) -message( "DEBUG: CMAKE_VERBOSE_MAKEFILE=${CMAKE_VERBOSE_MAKEFILE}" ) -message( "DEBUG: CMAKE_VERSION=${CMAKE_VERSION}" ) -message( "DEBUG: PROJECT_BINARY_DIR=${PROJECT_BINARY_DIR}" ) -message( "DEBUG: PROJECT_NAME=${PROJECT_NAME}" ) -message( "DEBUG: PROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR}" ) -set( CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/install CACHE PATH "test install to dir" FORCE ) -#set( CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH "test install to source dir" FORCE ) -endif( NOT SKIP_DEBUG ) - - # # Global stuff # set( GLOBAL_LIBRARIES CACHE INTERNAL "" ) set( GLOBAL_INCLUDE_DIRS CACHE INTERNAL "" ) set( GLOBAL_DEFINITIONS CACHE INTERNAL "" ) -mark_as_advanced( GLOBAL_LIBRARIES GLOBAL_INCLUDE_DIRS GLOBAL_DEFINITIONS ) +mark_as_advanced( GLOBAL_LIBRARIES GLOBAL_INCLUDE_DIRS GLOBAL_DEFINITIONS ) if( WIN32 ) - list( APPEND GLOBAL_DEFINITIONS FD_SETSIZE=4096 ) - list( APPEND GLOBAL_LIBRARIES "oldnames.lib" "ws2_32.lib" ) + list( APPEND GLOBAL_DEFINITIONS FD_SETSIZE=4096 ) + list( APPEND GLOBAL_LIBRARIES "oldnames.lib" "ws2_32.lib" ) endif() if( MSVC ) - list( APPEND GLOBAL_DEFINITIONS _CRT_SECURE_NO_DEPRECATE _CRT_NONSTDC_NO_DEPRECATE DB_MANUAL_CAST_TO_UNION ) + list( APPEND GLOBAL_DEFINITIONS _CRT_SECURE_NO_DEPRECATE _CRT_NONSTDC_NO_DEPRECATE DB_MANUAL_CAST_TO_UNION ) endif() # -# packetver +# Find svnversion +# +message( STATUS "Detecting svnversion" ) +find_program( SVNVERSION_EXECUTABLE svnversion ) +mark_as_advanced( SVNVERSION_EXECUTABLE ) +message( STATUS "Detecting svnversion - done" ) + + +# +# Find Subversion +# +message( STATUS "Detecting Subversion" ) +find_package( Subversion ) +message( STATUS "Detecting Subversion - done" ) + + +# +# PACKETVER # -set( PACKETVER "" - CACHE STRING "Sets the PACKETVER define of the servers. (see src/common/mmo.h)" ) +set( PACKETVER CACHE STRING "Sets the PACKETVER define of the servers. (see src/common/mmo.h)" ) if( PACKETVER ) - list( APPEND GLOBAL_DEFINITIONS PACKETVER=${PACKETVER} ) + list( APPEND GLOBAL_DEFINITIONS PACKETVER=${PACKETVER} ) +endif() + + +# +# SVNVERSION +# +if( SVNVERSION_EXECUTABLE ) + execute_process( COMMAND ${SVNVERSION_EXECUTABLE} ${PROJECT_SOURCE_DIR} + OUTPUT_VARIABLE SVNVERSION + OUTPUT_STRIP_TRAILING_WHITESPACE ) + string( REGEX REPLACE "[^1234567890MSexported]" "_" SVNVERSION ${SVNVERSION} ) +endif() +if( Subversion_FOUND AND SVNVERSION ) + Subversion_WC_INFO( ${PROJECT_SOURCE_DIR} eAthena ) + if( eAthena_WC_URL ) + string( REGEX MATCH "[^/]+$" BRANCH ${eAthena_WC_URL} ) + set( SVNVERSION "${BRANCH}-${SVNVERSION}" ) + endif() endif() ##################################################################### # package stuff # -if( OFF ) set( CPACK_PACKAGE_NAME "eAthena" ) set( CPACK_PACKAGE_DESCRIPTION_SUMMARY "MMORPG server package" ) -set( CPACK_PACKAGE_FILE_NAME ) -set( CPACK_PACKAGE_INSTALL_DIRECTORY ) -set( CPACK_PROJECT_CONFIG_FILE ) +set( CPACK_PACKAGE_VERSION ${SVNVERSION} ) set( CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE ) -set( CPACK_RESOURCE_FILE_README ) -set( CPACK_RESOURCE_FILE_WELCOME ) -set( CPACK_MONOLITHIC_INSTALL ON ) -set( CPACK_GENERATOR "ZIP" ) -set( CPACK_OUTPUT_CONFIG_FILE ) -set( CPACK_PACKAGE_EXECUTABLES ) -set( CPACK_STRIP_FILES ) -#source -set( CPACK_SOURCE_PACKAGE_FILE_NAME ) -set( CPACK_SOURCE_STRIP_FILES ) -set( CPACK_SOURCE_GENERATOR "ZIP" ) -set( CPACK_SOURCE_OUTPUT_CONFIG_FILE ) -set( CPACK_SOURCE_IGNORE_FILES ) -include(CPACK) -endif() +#set( CPACK_MONOLITHIC_INSTALL ON ) +include( CPACK ) + +set( Runtime "Runtime files" CACHE INTERNAL "" ) +set( Runtime_base "configurations, dbs, npcs, docs, ..." CACHE INTERNAL "" ) +set( Runtime_templates "conf/import and save (generated from conf/import-tmpl and save-tmpl)" CACHE INTERNAL "" ) +cpack_add_component_group( Runtime DESCRIPTION ${Runtime} DISPLAY_NAME "Runtime" ) +cpack_add_component( Runtime_base DESCRIPTION ${Runtime_base} DISPLAY_NAME "Base files" GROUP Runtime ) +cpack_add_component( Runtime_templates DESCRIPTION ${Runtime_templates} DISPLAY_NAME "Base templates" GROUP Runtime ) + +set( Development "Development files" CACHE INTERNAL "" ) +set( Development_base "projects, 3rdparty, sources, templates" CACHE INTERNAL "" ) +cpack_add_component_group( Development DESCRIPTION ${Development} DISPLAY_NAME "Development" ) +cpack_add_component( Development_base DESCRIPTION ${Development_base} DISPLAY_NAME "Base files" GROUP Development ) # # install stuff # -set( COMPONENT_SOURCE "Source code, librarires and project files" CACHE INTERNAL "" ) -set( COMPONENT_BASE "Base files" CACHE INTERNAL "" ) -option( INSTALL_RUN_DATA "install files needed to run the project" ON ) -option( INSTALL_BUILD_DATA "install files needed to build the project" OFF ) -set( SVN_FOLDER_PATTERN "[\\.]svn" - CACHE STRING "pattern of svn folder that we exclude from instalations" ) -mark_as_advanced( SVN_FOLDER_PATTERN ) -if( "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_INSTALL_PREFIX}" ) - set( INSTALLING_TO_SOURCE ON - CACHE INTERNAL "we are installing to the source folder, skip uneeded stuff" ) -else() - unset( INSTALLING_TO_SOURCE CACHE ) +option( WITH_COMPONENT_RUNTIME "install files needed to run the project" ON ) +option( WITH_COMPONENT_DEVELOPMENT "install 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 (${CMAKE_CURRENT_SOURCE_DIR})" OFF ) +option( INSTALL_TO_SUBDIR "copy files to subdirectory (${CMAKE_CURRENT_BINARY_DIR}/install)" OFF ) +set( INSTALL_PATH "${CMAKE_INSTALL_PREFIX}" CACHE STRING "install path (only used when INSTALL_TO_PATH is set)" ) +mark_as_advanced( CMAKE_INSTALL_PREFIX ) +if( INSTALL_TO_PATH AND NOT ("${INSTALL_TO}" STREQUAL "path") )# changed to path + set_property( CACHE INSTALL_TO_SOURCE INSTALL_TO_SUBDIR PROPERTY VALUE OFF ) +elseif( INSTALL_TO_SOURCE AND NOT ("${INSTALL_TO}" STREQUAL "source") )# changed to source + set_property( CACHE INSTALL_TO_PATH INSTALL_TO_SUBDIR PROPERTY VALUE OFF ) +elseif( INSTALL_TO_SUBDIR AND NOT ("${INSTALL_TO}" STREQUAL "subdir") )# changed to subdir + set_property( CACHE INSTALL_TO_PATH INSTALL_TO_SOURCE PROPERTY VALUE OFF ) +elseif( NOT INSTALL_TO_PATH AND NOT INSTALL_TO_SOURCE AND NOT INSTALL_TO_SUBDIR )# default + set_property( CACHE INSTALL_TO_SUBDIR PROPERTY VALUE ON ) +endif() +if( INSTALL_TO_PATH ) + set( INSTALL_TO "path" CACHE INTERNAL "" ) + set_property( CACHE CMAKE_INSTALL_PREFIX PROPERTY VALUE "${INSTALL_PATH}" ) +elseif( INSTALL_TO_SOURCE ) + set( INSTALL_TO "source" CACHE INTERNAL "" ) + set_property( CACHE CMAKE_INSTALL_PREFIX PROPERTY VALUE "${CMAKE_CURRENT_SOURCE_DIR}" ) +elseif( INSTALL_TO_SUBDIR ) + set( INSTALL_TO "subdir" CACHE INTERNAL "" ) + set_property( CACHE CMAKE_INSTALL_PREFIX PROPERTY VALUE "${CMAKE_CURRENT_BINARY_DIR}/install" ) endif() -set( LOCAL_BUILD_FILES - "CMakeLists.txt" - "configure" - "configure.in" - "eAthena-6.dsw" - "eAthena-7.1.sln" - "eAthena-8.sln" - "eAthena-9.sln" - "eAthena-10.sln" +set( SVN_FOLDER_PATTERN "[\\.]svn" CACHE STRING "pattern of svn folder that we exclude from instalations" ) +mark_as_advanced( SVN_FOLDER_PATTERN ) +set( DEVELOPMENT_FILES + "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt" + "${CMAKE_CURRENT_SOURCE_DIR}/configure" + "${CMAKE_CURRENT_SOURCE_DIR}/configure.in" + "${CMAKE_CURRENT_SOURCE_DIR}/eAthena-6.dsw" + "${CMAKE_CURRENT_SOURCE_DIR}/eAthena-7.1.sln" + "${CMAKE_CURRENT_SOURCE_DIR}/eAthena-8.sln" + "${CMAKE_CURRENT_SOURCE_DIR}/eAthena-9.sln" + "${CMAKE_CURRENT_SOURCE_DIR}/eAthena-10.sln" ) -set( LOCAL_BUILD_DIRECTORIES +set( DEVELOPMENT_DIRECTORIES "3rdparty" + "conf/import-tmpl" + "save-tmpl" "src" "vcproj-6" "vcproj-7.1" @@ -238,28 +160,31 @@ set( LOCAL_BUILD_DIRECTORIES "vcproj-9" "vcproj-10" ) -set( LOCAL_RUN_FILES - "athena-start" - "Changelog-Trunk.txt" - "char-server.sh" - "charserv-sql.bat" - "charserv.bat" - "dbghelp.dll" - "LICENSE" - "login-server.sh" - "logserv-sql.bat" - "logserv.bat" - "map-server.sh" - "mapserv-sql.bat" - "mapserv.bat" - "notice.txt" - "readme.html" - "runserver-sql.bat" - "runserver.bat" - "serv.bat" - "start" +set( RUNTIME_FILES + "${CMAKE_CURRENT_SOURCE_DIR}/athena-start" + "${CMAKE_CURRENT_SOURCE_DIR}/Changelog-Trunk.txt" + "${CMAKE_CURRENT_SOURCE_DIR}/char-server.sh" + "${CMAKE_CURRENT_SOURCE_DIR}/charserv-sql.bat" + "${CMAKE_CURRENT_SOURCE_DIR}/charserv.bat" + "${CMAKE_CURRENT_SOURCE_DIR}/dbghelp.dll" + "${CMAKE_CURRENT_SOURCE_DIR}/libmysql.dll" + "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE" + "${CMAKE_CURRENT_SOURCE_DIR}/login-server.sh" + "${CMAKE_CURRENT_SOURCE_DIR}/logserv-sql.bat" + "${CMAKE_CURRENT_SOURCE_DIR}/logserv.bat" + "${CMAKE_CURRENT_SOURCE_DIR}/map-server.sh" + "${CMAKE_CURRENT_SOURCE_DIR}/mapserv-sql.bat" + "${CMAKE_CURRENT_SOURCE_DIR}/mapserv.bat" + "${CMAKE_CURRENT_SOURCE_DIR}/notice.txt" + "${CMAKE_CURRENT_SOURCE_DIR}/pcre3.dll" + "${CMAKE_CURRENT_SOURCE_DIR}/readme.html" + "${CMAKE_CURRENT_SOURCE_DIR}/runserver-sql.bat" + "${CMAKE_CURRENT_SOURCE_DIR}/runserver.bat" + "${CMAKE_CURRENT_SOURCE_DIR}/serv.bat" + "${CMAKE_CURRENT_SOURCE_DIR}/start" + "${CMAKE_CURRENT_SOURCE_DIR}/zlib1.dll" ) -set( LOCAL_RUN_DIRECTORIES +set( RUNTIME_DIRECTORIES "conf" "db" "doc" @@ -270,58 +195,41 @@ set( LOCAL_RUN_DIRECTORIES "sql-files" "tools" ) -if( USE_LOCAL_MYSQL ) - list( APPEND LOCAL_RUN_FILES "libmysql.dll" ) -endif() -if( USE_LOCAL_PCRE ) - list( APPEND LOCAL_RUN_FILES "pcre3.dll" ) -endif() -if( USE_LOCAL_ZLIB ) - list( APPEND LOCAL_RUN_FILES "zlib1.dll" ) -endif() -function( INSTALL_DIRECTORY DIR DEST EXCLUDE_PATTERN ) - # warning: that slash(/) is important here, otherwise the whole directory (not its content) will be copied! - install( DIRECTORY ${DIR}/ - DESTINATION ${DEST} - PATTERN ${SVN_FOLDER_PATTERN} EXCLUDE - PATTERN "${EXCLUDE_PATTERN}" EXCLUDE ) -endfunction() -function( INSTALL_DIRECTORIES DIRS EXCLUDE_PATTERN ) - foreach( DIR IN ITEMS ${DIRS} ) - INSTALL_DIRECTORY( ${DIR} ${DIR} "${EXCLUDE_PATTERN}" ) - endforeach() -endfunction() -if( NOT INSTALLING_TO_SOURCE ) - # skipped if in-source - if( INSTALL_RUN_DATA ) - # base - install( FILES ${LOCAL_RUN_FILES} - DESTINATION ${CMAKE_INSTALL_PREFIX} ) - foreach( DIR IN ITEMS ${LOCAL_RUN_DIRECTORIES} ) +if( INSTALL_TO_SOURCE )# skip, already in the source dir +else() + if( WITH_COMPONENT_RUNTIME ) + install( FILES ${RUNTIME_FILES} + DESTINATION "." + COMPONENT Runtime_base ) + foreach( DIR IN ITEMS ${RUNTIME_DIRECTORIES} ) install( DIRECTORY "${DIR}/" DESTINATION "${DIR}" + COMPONENT Runtime_base PATTERN ${SVN_FOLDER_PATTERN} EXCLUDE PATTERN "conf/import-tmpl" EXCLUDE ) endforeach() endif() - if( INSTALL_BUILD_DATA ) - # source - install( FILES ${LOCAL_BUILD_FILES} - DESTINATION ${CMAKE_INSTALL_PREFIX} ) - foreach( DIR IN ITEMS ${LOCAL_BUILD_DIRECTORIES} ) + if( WITH_COMPONENT_DEVELOPMENT ) + install( FILES ${DEVELOPMENT_FILES} + DESTINATION "." + COMPONENT Development_base ) + foreach( DIR IN ITEMS ${DEVELOPMENT_DIRECTORIES} ) install( DIRECTORY "${DIR}/" DESTINATION "${DIR}" + COMPONENT Development_base PATTERN ${SVN_FOLDER_PATTERN} EXCLUDE ) endforeach() endif() endif() -if( INSTALL_RUN_DATA ) - # base templates +if( WITH_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() diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index b2747c3c7..37acba5cf 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -5,6 +5,7 @@ Date Added * Merged decode_zip/encode_zip from eapp's grfio to replace our direct use of zlib's uncompress/compress. * Fixed strict-aliasing warning in mapcache's GetFloat. * CMake: src/common builds static libraries common_base/common_sql, that are used as dependencies by the other targets. + * CMake: normalized variable names, added ability to create a package/installer. 2011/07/05 * CMake: split txt and sql variants of login-server and map-server. [FlavioJS] 2011/07/04 diff --git a/src/char/CMakeLists.txt b/src/char/CMakeLists.txt index 1f6f1ea11..9e0cbd9f4 100644 --- a/src/char/CMakeLists.txt +++ b/src/char/CMakeLists.txt @@ -36,10 +36,11 @@ 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_DEFINITIONS "${DEFINITIONS}" ) -if( INSTALL_RUN_DATA ) +if( WITH_COMPONENT_RUNTIME ) + cpack_add_component( Runtime_charserver_txt DESCRIPTION "char-server (txt version)" DISPLAY_NAME "char-server" GROUP Runtime ) install( TARGETS char-server - DESTINATION ${CMAKE_INSTALL_PREFIX} - COMPONENT "char-server" ) + DESTINATION "." + COMPONENT Runtime_charserver_txt ) endif() message( STATUS "Creating target char-server - done" ) set( HAVE_char-server ON CACHE BOOL "char-server target is available" ) diff --git a/src/char_sql/CMakeLists.txt b/src/char_sql/CMakeLists.txt index 7d3b7ad7e..f2d1cd0f0 100644 --- a/src/char_sql/CMakeLists.txt +++ b/src/char_sql/CMakeLists.txt @@ -42,10 +42,11 @@ 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_DEFINITIONS "${DEFINITIONS}" ) -if( INSTALL_RUN_DATA ) +if( WITH_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 ${CMAKE_INSTALL_PREFIX} - COMPONENT "char-server_sql" ) + DESTINATION "." + COMPONENT Runtime_charserver_sql ) endif() message( STATUS "Creating target char-server_sql - done" ) set( HAVE_char-server_sql ON CACHE BOOL "char-server_sql target is available" ) diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 0241dfbca..21feb53f9 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -1,22 +1,8 @@ -##################################################################### -# Find svnversion -# -message( STATUS "Detecting svnversion" ) -find_program( SVNVERSION_EXECUTABLE svnversion ) -mark_as_advanced( SVNVERSION_EXECUTABLE ) -message( STATUS "Detecting svnversion - done" ) - - # # Create svnversion.h # message( STATUS "Creating svnversion.h" ) -if( SVNVERSION_EXECUTABLE ) - execute_process( COMMAND ${SVNVERSION_EXECUTABLE} ${PROJECT_SOURCE_DIR} - OUTPUT_VARIABLE SVNVERSION - OUTPUT_STRIP_TRAILING_WHITESPACE ) -endif() if( SVNVERSION ) file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/svnversion.h "#ifndef SVNVERSION\n#define SVNVERSION ${SVNVERSION}\n#endif\n" ) @@ -26,11 +12,14 @@ 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( INSTALL_BUILD_DATA ) - install( FILES ${CMAKE_CURRENT_BINARY_DIR}/svnversion.h DESTINATION ${CMAKE_INSTALL_PREFIX}/src/common ) +if( WITH_COMPONENT_DEVELOPMENT ) + install( FILES ${CMAKE_CURRENT_BINARY_DIR}/svnversion.h + DESTINATION "src/common" + COMPONENT Development_base ) endif() message( STATUS "Creating svnversion.h - done" ) + ##################################################################### # setup # @@ -65,7 +54,7 @@ set( COMMON_MINI_DEFINITIONS MINICORE CACHE INTERNAL "" ) # # common_base # -if( USE_ZLIB ) +if( WITH_ZLIB ) message( STATUS "Creating target common_base" ) set( COMMON_BASE_HEADERS ${COMMON_ALL_HEADERS} @@ -126,7 +115,7 @@ endif() # # common_sql # -if( HAVE_common_base AND USE_MYSQL ) +if( HAVE_common_base AND WITH_MYSQL ) message( STATUS "Creating target common_sql" ) set( COMMON_SQL_HEADERS ${COMMON_ALL_HEADERS} diff --git a/src/login/sql/CMakeLists.txt b/src/login/sql/CMakeLists.txt index 50bf256e2..ac7d464c9 100644 --- a/src/login/sql/CMakeLists.txt +++ b/src/login/sql/CMakeLists.txt @@ -28,10 +28,11 @@ 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_DEFINITIONS "${DEFINITIONS}" ) -if( INSTALL_RUN_DATA ) +if( WITH_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 ${CMAKE_INSTALL_PREFIX} - COMPONENT "login-server_sql" ) + DESTINATION "." + COMPONENT Runtime_loginserver_sql ) endif() message( STATUS "Creating target login-server_sql - done" ) set( HAVE_login-server_sql ON CACHE BOOL "login-server_sql target is available" ) diff --git a/src/login/txt/CMakeLists.txt b/src/login/txt/CMakeLists.txt index dff7d322c..9d57103e9 100644 --- a/src/login/txt/CMakeLists.txt +++ b/src/login/txt/CMakeLists.txt @@ -28,10 +28,11 @@ 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_DEFINITIONS "${DEFINITIONS}" ) -if( INSTALL_RUN_DATA ) +if( WITH_COMPONENT_RUNTIME ) + cpack_add_component( Runtime_loginserver_txt DESCRIPTION "login-server (txt version)" DISPLAY_NAME "login-server" GROUP Runtime ) install( TARGETS login-server - DESTINATION ${CMAKE_INSTALL_PREFIX} - COMPONENT "login-server" ) + DESTINATION "." + COMPONENT Runtime_loginserver_txt ) endif() message( STATUS "Creating target login-server - done" ) set( HAVE_login-server ON CACHE BOOL "login-server target is available" ) diff --git a/src/map/sql/CMakeLists.txt b/src/map/sql/CMakeLists.txt index c7922f276..74598423a 100644 --- a/src/map/sql/CMakeLists.txt +++ b/src/map/sql/CMakeLists.txt @@ -81,7 +81,7 @@ set( DEPENDENCIES common_sql ) set( LIBRARIES ${GLOBAL_LIBRARIES} ) set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ) set( DEFINITIONS ${GLOBAL_DEFINITIONS} ) -if( USE_PCRE ) +if( WITH_PCRE ) message( STATUS "Using PCRE" ) list( APPEND LIBRARIES ${PCRE_LIBRARIES} ) list( APPEND INCLUDE_DIRS ${PCRE_INCLUDE_DIRS} ) @@ -95,10 +95,11 @@ 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_DEFINITIONS "${DEFINITIONS}" ) -if( INSTALL_RUN_DATA ) +if( WITH_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 ${CMAKE_INSTALL_PREFIX} - COMPONENT "map-server_sql" ) + DESTINATION "." + COMPONENT Runtime_mapserver_sql ) endif() message( STATUS "Creating target map-server_sql - done" ) set( HAVE_map-server_sql ON CACHE BOOL "map-server_sql target is available" ) diff --git a/src/map/txt/CMakeLists.txt b/src/map/txt/CMakeLists.txt index 544e00c87..d58866f96 100644 --- a/src/map/txt/CMakeLists.txt +++ b/src/map/txt/CMakeLists.txt @@ -81,7 +81,7 @@ set( DEPENDENCIES common_base ) set( LIBRARIES ${GLOBAL_LIBRARIES} ) set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ) set( DEFINITIONS ${GLOBAL_DEFINITIONS} TXT_ONLY ) -if( USE_PCRE ) +if( WITH_PCRE ) message( STATUS "Using PCRE" ) list( APPEND LIBRARIES ${PCRE_LIBRARIES} ) list( APPEND INCLUDE_DIRS ${PCRE_INCLUDE_DIRS} ) @@ -95,10 +95,11 @@ 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_DEFINITIONS "${DEFINITIONS}" ) -if( INSTALL_RUN_DATA ) +if( WITH_COMPONENT_RUNTIME ) + cpack_add_component( Runtime_mapserver_txt DESCRIPTION "map-server (txt version)" DISPLAY_NAME "map-server" GROUP Runtime ) install( TARGETS map-server - DESTINATION ${CMAKE_INSTALL_PREFIX} - COMPONENT "map-server" ) + DESTINATION "." + COMPONENT Runtime_mapserver_txt ) endif() message( STATUS "Creating target map-server - done" ) set( HAVE_map-server ON CACHE BOOL "map-server target is available" ) diff --git a/src/tool/CMakeLists.txt b/src/tool/CMakeLists.txt index e39b174dd..a23637e3d 100644 --- a/src/tool/CMakeLists.txt +++ b/src/tool/CMakeLists.txt @@ -1,30 +1,8 @@ -# setup -set( COMMON_SOURCES - "${COMMON_SOURCE_DIR}/core.c" -# "${COMMON_SOURCE_DIR}/db.c" -# "${COMMON_SOURCE_DIR}/ers.c" - "${COMMON_SOURCE_DIR}/grfio.c" -# "${COMMON_SOURCE_DIR}/lock.c" - "${COMMON_SOURCE_DIR}/malloc.c" -# "${COMMON_SOURCE_DIR}/mapindex.c" -# "${COMMON_SOURCE_DIR}/md5calc.c" -# "${COMMON_SOURCE_DIR}/nullpo.c" -# "${COMMON_SOURCE_DIR}/plugins.c" -# "${COMMON_SOURCE_DIR}/random.c" - "${COMMON_SOURCE_DIR}/showmsg.c" -# "${COMMON_SOURCE_DIR}/socket.c" - "${COMMON_SOURCE_DIR}/strlib.c" -# "${COMMON_SOURCE_DIR}/timer.c" - "${COMMON_SOURCE_DIR}/utils.c" - ) -set( MAPCACHE_SOURCES - mapcache.c - ) - - +# # mapcache -if( USE_ZLIB ) +# +if( WITH_ZLIB ) message( STATUS "Creating target mapcache" ) set( COMMON_HEADERS ${COMMON_MINI_HEADERS} @@ -49,10 +27,11 @@ add_executable( mapcache ${SOURCE_FILES} ) include_directories( ${INCLUDE_DIRS} ) target_link_libraries( mapcache ${ZLIB_LIBRARIES} ) set_target_properties( mapcache PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}" ) -if( INSTALL_RUN_DATA ) +if( WITH_COMPONENT_RUNTIME ) + cpack_add_component( Runtime_mapcache DESCRIPTION "mapcache generator" DISPLAY_NAME "mapcache" GROUP Runtime ) install( TARGETS mapcache - DESTINATION ${CMAKE_INSTALL_PREFIX} - COMPONENT "mapcache" ) + DESTINATION "." + COMPONENT Runtime_mapcache ) endif() message( STATUS "Creating target mapcache - done" ) set( HAVE_mapcache ON CACHE BOOL "mapcache target is available" ) -- cgit v1.2.3-70-g09d2 From f817e3714747b39a364e99c536e0b802b24fd2c3 Mon Sep 17 00:00:00 2001 From: flaviojs Date: Sun, 10 Jul 2011 15:29:57 +0000 Subject: * CMake: lowered required version to 2.8.3 and moved custom cmake modules to 3rdparty/cmake. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14897 54d463be-8e91-2dee-dedb-b68131a5f0ec --- 3rdparty/CMakeLists.txt | 1 + 3rdparty/cmake/FindMYSQL.cmake | 35 +++++++++++++++++++++++++++++++++++ 3rdparty/cmake/FindPCRE.cmake | 35 +++++++++++++++++++++++++++++++++++ 3rdparty/mysql/CMakeLists.txt | 1 - 3rdparty/mysql/FindMYSQL.cmake | 35 ----------------------------------- 3rdparty/pcre/CMakeLists.txt | 1 - 3rdparty/pcre/FindPCRE.cmake | 35 ----------------------------------- CMakeLists.txt | 27 +++++++++++++++++++++++++-- Changelog-Trunk.txt | 1 + 9 files changed, 97 insertions(+), 74 deletions(-) create mode 100644 3rdparty/cmake/FindMYSQL.cmake create mode 100644 3rdparty/cmake/FindPCRE.cmake delete mode 100644 3rdparty/mysql/FindMYSQL.cmake delete mode 100644 3rdparty/pcre/FindPCRE.cmake (limited to '3rdparty/pcre/CMakeLists.txt') diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index 3e7cb4cc4..a63321033 100644 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -47,6 +47,7 @@ macro( CONFIGURE_WITH_LOCAL_OR_SYSTEM name ) endmacro( CONFIGURE_WITH_LOCAL_OR_SYSTEM ) +set( CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH} ) add_subdirectory( msinttypes ) add_subdirectory( mt19937ar ) add_subdirectory( mysql ) diff --git a/3rdparty/cmake/FindMYSQL.cmake b/3rdparty/cmake/FindMYSQL.cmake new file mode 100644 index 000000000..0a07f3612 --- /dev/null +++ b/3rdparty/cmake/FindMYSQL.cmake @@ -0,0 +1,35 @@ +# - Find mysqlclient +# Find the native MySQL includes and library +# +# MYSQL_INCLUDE_DIRS - where to find mysql.h, etc. +# MYSQL_LIBRARIES - mysqlclient library. +# MYSQL_FOUND - True if mysqlclient is found. +# + +find_path( MYSQL_INCLUDE_DIRS "mysql.h" + PATHS + "/usr/include/mysql" + "/usr/local/include/mysql" + "$ENV{PROGRAMFILES}/MySQL/*/include" + "$ENV{SYSTEMDRIVE}/MySQL/*/include" ) + +find_library( MYSQL_LIBRARIES + NAMES "mysqlclient" "mysqlclient_r" + PATHS + "/usr/lib/mysql" + "/usr/local/lib/mysql" + "$ENV{PROGRAMFILES}/MySQL/*/lib" + "$ENV{SYSTEMDRIVE}/MySQL/*/lib" ) +mark_as_advanced( MYSQL_LIBRARIES MYSQL_INCLUDE_DIRS ) + +if( MYSQL_INCLUDE_DIRS AND EXISTS "${MYSQL_INCLUDE_DIRS}/mysql_version.h" ) + file( STRINGS "${MYSQL_INCLUDE_DIRS}/mysql_version.h" MYSQL_VERSION_H REGEX "^#define[ \t]+MYSQL_SERVER_VERSION[ \t]+\"[^\"]+\".*$" ) + string( REGEX REPLACE "^.*MYSQL_SERVER_VERSION[ \t]+\"([^\"]+)\".*$" "\\1" MYSQL_VERSION_STRING "${MYSQL_VERSION_H}" ) +endif() + +# handle the QUIETLY and REQUIRED arguments and set MYSQL_FOUND to TRUE if +# all listed variables are TRUE +include( FindPackageHandleStandardArgs ) +FIND_PACKAGE_HANDLE_STANDARD_ARGS( MYSQL + REQUIRED_VARS MYSQL_LIBRARIES MYSQL_INCLUDE_DIRS + VERSION_VAR MYSQL_VERSION_STRING ) diff --git a/3rdparty/cmake/FindPCRE.cmake b/3rdparty/cmake/FindPCRE.cmake new file mode 100644 index 000000000..cb4d9177b --- /dev/null +++ b/3rdparty/cmake/FindPCRE.cmake @@ -0,0 +1,35 @@ +# - Find pcre +# Find the native PCRE includes and library +# +# PCRE_INCLUDE_DIRS - where to find pcre.h +# PCRE_LIBRARIES - List of libraries when using pcre. +# PCRE_FOUND - True if pcre found. + + +find_path( PCRE_INCLUDE_DIR pcre.h ) + +set( PCRE_NAMES pcre ) +find_library( PCRE_LIBRARY NAMES ${PCRE_NAMES} ) +mark_as_advanced( PCRE_LIBRARY PCRE_INCLUDE_DIR ) + +if( PCRE_INCLUDE_DIR AND EXISTS "${PCRE_INCLUDE_DIR}/pcre.h" ) + file( STRINGS "${PCRE_INCLUDE_DIR}/pcre.h" PCRE_H REGEX "^#define[ \t]+PCRE_M[A-Z]+[ \t]+[0-9]+.*$" ) + string( REGEX REPLACE "^.*PCRE_MAJOR[ \t]+([0-9]+).*$" "\\1" PCRE_MAJOR "${PCRE_H}" ) + string( REGEX REPLACE "^.*PCRE_MINOR[ \t]+([0-9]+).*$" "\\1" PCRE_MINOR "${PCRE_H}" ) + + set( PCRE_VERSION_STRING "${PCRE_MAJOR}.${PCRE_MINOR}" ) + set( PCRE_VERSION_MAJOR "${PCRE_MAJOR}" ) + set( PCRE_VERSION_MINOR "${PCRE_MINOR}" ) +endif() + +# handle the QUIETLY and REQUIRED arguments and set PCRE_FOUND to TRUE if +# all listed variables are TRUE +include( FindPackageHandleStandardArgs ) +FIND_PACKAGE_HANDLE_STANDARD_ARGS( PCRE + REQUIRED_VARS PCRE_LIBRARY PCRE_INCLUDE_DIR + VERSION_VAR PCRE_VERSION_STRING ) + +if( PCRE_FOUND ) + set( PCRE_LIBRARIES ${PCRE_LIBRARY} ) + set( PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIR} ) +endif() diff --git a/3rdparty/mysql/CMakeLists.txt b/3rdparty/mysql/CMakeLists.txt index f4996907f..e85fd626d 100644 --- a/3rdparty/mysql/CMakeLists.txt +++ b/3rdparty/mysql/CMakeLists.txt @@ -44,7 +44,6 @@ endif( WIN32 ) message( STATUS "Detecting system MYSQL" ) unset( MYSQL_LIBRARIES CACHE ) unset( MYSQL_INCLUDE_DIRS CACHE ) -set( CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_MODULE_PATH} ) find_package( MYSQL ) set( MYSQL_SYSTEM_LIBRARIES "${MYSQL_LIBRARIES}" CACHE PATH "system mysql libraries" ) diff --git a/3rdparty/mysql/FindMYSQL.cmake b/3rdparty/mysql/FindMYSQL.cmake deleted file mode 100644 index 0a07f3612..000000000 --- a/3rdparty/mysql/FindMYSQL.cmake +++ /dev/null @@ -1,35 +0,0 @@ -# - Find mysqlclient -# Find the native MySQL includes and library -# -# MYSQL_INCLUDE_DIRS - where to find mysql.h, etc. -# MYSQL_LIBRARIES - mysqlclient library. -# MYSQL_FOUND - True if mysqlclient is found. -# - -find_path( MYSQL_INCLUDE_DIRS "mysql.h" - PATHS - "/usr/include/mysql" - "/usr/local/include/mysql" - "$ENV{PROGRAMFILES}/MySQL/*/include" - "$ENV{SYSTEMDRIVE}/MySQL/*/include" ) - -find_library( MYSQL_LIBRARIES - NAMES "mysqlclient" "mysqlclient_r" - PATHS - "/usr/lib/mysql" - "/usr/local/lib/mysql" - "$ENV{PROGRAMFILES}/MySQL/*/lib" - "$ENV{SYSTEMDRIVE}/MySQL/*/lib" ) -mark_as_advanced( MYSQL_LIBRARIES MYSQL_INCLUDE_DIRS ) - -if( MYSQL_INCLUDE_DIRS AND EXISTS "${MYSQL_INCLUDE_DIRS}/mysql_version.h" ) - file( STRINGS "${MYSQL_INCLUDE_DIRS}/mysql_version.h" MYSQL_VERSION_H REGEX "^#define[ \t]+MYSQL_SERVER_VERSION[ \t]+\"[^\"]+\".*$" ) - string( REGEX REPLACE "^.*MYSQL_SERVER_VERSION[ \t]+\"([^\"]+)\".*$" "\\1" MYSQL_VERSION_STRING "${MYSQL_VERSION_H}" ) -endif() - -# handle the QUIETLY and REQUIRED arguments and set MYSQL_FOUND to TRUE if -# all listed variables are TRUE -include( FindPackageHandleStandardArgs ) -FIND_PACKAGE_HANDLE_STANDARD_ARGS( MYSQL - REQUIRED_VARS MYSQL_LIBRARIES MYSQL_INCLUDE_DIRS - VERSION_VAR MYSQL_VERSION_STRING ) diff --git a/3rdparty/pcre/CMakeLists.txt b/3rdparty/pcre/CMakeLists.txt index 70448d40e..57465a46c 100644 --- a/3rdparty/pcre/CMakeLists.txt +++ b/3rdparty/pcre/CMakeLists.txt @@ -39,7 +39,6 @@ endif( WIN32 ) # system # message( STATUS "Detecting system PCRE" ) -set( CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_MODULE_PATH} ) unset( PCRE_LIBRARIES CACHE ) unset( PCRE_INCLUDE_DIRS CACHE ) find_package( PCRE ) diff --git a/3rdparty/pcre/FindPCRE.cmake b/3rdparty/pcre/FindPCRE.cmake deleted file mode 100644 index cb4d9177b..000000000 --- a/3rdparty/pcre/FindPCRE.cmake +++ /dev/null @@ -1,35 +0,0 @@ -# - Find pcre -# Find the native PCRE includes and library -# -# PCRE_INCLUDE_DIRS - where to find pcre.h -# PCRE_LIBRARIES - List of libraries when using pcre. -# PCRE_FOUND - True if pcre found. - - -find_path( PCRE_INCLUDE_DIR pcre.h ) - -set( PCRE_NAMES pcre ) -find_library( PCRE_LIBRARY NAMES ${PCRE_NAMES} ) -mark_as_advanced( PCRE_LIBRARY PCRE_INCLUDE_DIR ) - -if( PCRE_INCLUDE_DIR AND EXISTS "${PCRE_INCLUDE_DIR}/pcre.h" ) - file( STRINGS "${PCRE_INCLUDE_DIR}/pcre.h" PCRE_H REGEX "^#define[ \t]+PCRE_M[A-Z]+[ \t]+[0-9]+.*$" ) - string( REGEX REPLACE "^.*PCRE_MAJOR[ \t]+([0-9]+).*$" "\\1" PCRE_MAJOR "${PCRE_H}" ) - string( REGEX REPLACE "^.*PCRE_MINOR[ \t]+([0-9]+).*$" "\\1" PCRE_MINOR "${PCRE_H}" ) - - set( PCRE_VERSION_STRING "${PCRE_MAJOR}.${PCRE_MINOR}" ) - set( PCRE_VERSION_MAJOR "${PCRE_MAJOR}" ) - set( PCRE_VERSION_MINOR "${PCRE_MINOR}" ) -endif() - -# handle the QUIETLY and REQUIRED arguments and set PCRE_FOUND to TRUE if -# all listed variables are TRUE -include( FindPackageHandleStandardArgs ) -FIND_PACKAGE_HANDLE_STANDARD_ARGS( PCRE - REQUIRED_VARS PCRE_LIBRARY PCRE_INCLUDE_DIR - VERSION_VAR PCRE_VERSION_STRING ) - -if( PCRE_FOUND ) - set( PCRE_LIBRARIES ${PCRE_LIBRARY} ) - set( PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIR} ) -endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index 523d445ef..1163ccddb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,5 @@ +##################################################################### +# # "Getting Started with CMake", a tutorial video by Eric Wing. # Part 1 of 6: http://www.youtube.com/watch?v=CLvZTyji_Uw # Part 2 of 6: http://www.youtube.com/watch?v=gUW-RrRQjEg @@ -11,8 +13,30 @@ # WITH_* : option to use an external package or not # ENABLE_* : option to use an internal feature/code or not # HAVE_* : internal variable indicating if we have and are using something -cmake_minimum_required( VERSION 2.8.4 ) +# +# Example (build in subdir 'build' and install to source dir): +# mkdir build +# cd build +# cmake -G"Unix Makefiles" -DINSTALL_TO_SOURCE:bool=ON .. +# make install +# cd .. +# rm -rf build +# +##################################################################### + + +#cmake_minimum_required( VERSION 2.8.4 ) +# Functional changes from 2.8.3 to 2.8.4: +# string(SUBSTRING) works with length -1 as "rest of string" +# changes to some CPack generators +# CYGWIN no longer defines WIN32 +# CMP0017: Prefer files from the CMake module directory when including from there. +set( CMAKE_LEGACY_CYGWIN_WIN32 0 ) +cmake_minimum_required( VERSION 2.8.3 ) project( eAthena ) +if( CYGWIN ) + unset( WIN32 ) +endif() # @@ -261,5 +285,4 @@ endif() # # subdirectories # -add_subdirectory( 3rdparty ) add_subdirectory( src ) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 4d512c8da..2840900ee 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -2,6 +2,7 @@ Date Added 2011/07/10 * Temporary fix for bugreport:4961 (unintended conversion from signed to unsigned). [FlavioJS] + * CMake: lowered required version to 2.8.3 and moved custom cmake modules to 3rdparty/cmake. 2011/07/09 * Added script command 'getmercinfo' for retrieving information about a mercenary of an online character. [Ai4rei] * CMake: added search for math library, made CPack existence optional, updated the search for mysqlclient and corrected misspelled variables (tested with FreeBSD-8.2-i386) [FlavioJS] -- cgit v1.2.3-70-g09d2