diff options
Diffstat (limited to 'CMakeLists.txt')
| -rw-r--r-- | CMakeLists.txt | 162 |
1 files changed, 79 insertions, 83 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 22339551127..e5c4111c58c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,12 +18,26 @@ if(BUILDING_IN_SOURCE) message(FATAL_ERROR "This project requires an out of source build. Remove the file 'CMakeCache.txt' found in this directory before continuing, and create a separate build directory and run 'cmake path_to_project [options]' from there.") endif(BUILDING_IN_SOURCE) +# +# Basic packagesearching and setup (further support will be needed, this is a preliminary release!) +# + include(CheckIncludeFiles) -include(cmake/FindAce.cmake) -include(cmake/FindMySql.cmake) +include(cmake/FindPCHSupport.cmake) +include(cmake/FindACE.cmake) +include(cmake/FindMySQL.cmake) +include(cmake/FindOpenSSL.cmake) + +# +# *nix-specific packages ( zlib and bzip2 libraries will be built from sourcetree on WIN32-platforms) +# + +if(UNIX) include(cmake/FindReadline.cmake) include(cmake/FindTermcap.cmake) -include(cmake/PCH.cmake) +include(FindZLIB) +include(FindBZip2) +endif(UNIX) # Select the Release build configuration by default. if(NOT CMAKE_BUILD_TYPE) @@ -39,7 +53,6 @@ add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" ) -option(CENTOS "CENTOS" 0) option(DO_AUTHSERVER "Build authserver" 1) option(DO_WORLDSERVER "Build worldserver" 1) option(DO_CLI "With CLI" 1) @@ -49,38 +62,58 @@ option(DO_RA "With RA" 0) option(DO_SCRIPTS "With trinityscripts" 1) option(DO_SQL "Copy SQL files" 0) option(DO_TOOLS "Build tools" 0) +if( UNIX ) +option(CENTOS "CENTOS" 0) option(DO_WARN "Enable all compile warnings" 0) +endif( UNIX ) -if(PREFIX) +if( UNIX ) + if( CENTOS ) + add_definitions(-DCENTOS) + find_termcap() + else( CENTOS ) + find_readline() + endif( CENTOS ) +endif( UNIX ) + +# Set up the installation-prefix + +if( PREFIX ) set(CMAKE_INSTALL_PREFIX ${PREFIX}) -endif(PREFIX) +endif( PREFIX ) set(GENREV_SRC src/genrevision/genrevision.cpp ) -if(DO_DEBUG) +# Handle debugmode compiles (this will require further work for proper WIN32-setups) +if( DO_DEBUG ) set(CMAKE_BUILD_TYPE Debug) + add_executable(genrev ${GENREV_SRC} ) + add_custom_target("revision.h" ALL COMMAND "${CMAKE_BINARY_DIR}/genrev" ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/src/server/shared" DEPENDS genrev ) -else (DO_DEBUG) +else ( DO_DEBUG ) + add_executable(genrev ${GENREV_SRC} ) + add_custom_target("revision.h" ALL COMMAND "${CMAKE_BINARY_DIR}/genrev" ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/src/server/shared" DEPENDS genrev ) -endif(DO_DEBUG) + +endif( DO_DEBUG ) execute_process( COMMAND hg tip --template {rev} @@ -93,10 +126,10 @@ message("* TrinityCore revision : ${HG_REVISION}") message("* Build binaries in : ${CMAKE_BUILD_TYPE} mode") message("") -if(CONF_DIR) -else(CONF_DIR) +if( CONF_DIR ) +else( CONF_DIR ) set(CONF_DIR ${CMAKE_INSTALL_PREFIX}/etc) -endif(CONF_DIR) +endif( CONF_DIR ) set(LIBSDIR ${CMAKE_INSTALL_PREFIX}/lib) @@ -105,30 +138,30 @@ message("* Install libraries to : ${LIBSDIR}") message("* Install configs to : ${CONF_DIR}") message("") -if(DO_AUTHSERVER) +if( DO_AUTHSERVER ) message("* Build authserver : Yes (default)") -else(DO_AUTHSERVER) +else( DO_AUTHSERVER ) message("* Build authserver : No") -endif(DO_AUTHSERVER) +endif( DO_AUTHSERVER ) -if(DO_WORLDSERVER) +if( DO_WORLDSERVER ) message("* Build worldserver : Yes (default)") -else(DO_WORLDSERVER) +else( DO_WORLDSERVER ) message("* Build worldserver : No") -endif(DO_WORLDSERVER) +endif( DO_WORLDSERVER ) -if(DO_SCRIPTS) +if( DO_SCRIPTS ) message("* Build Trinityscripts : Yes (default)") - ADD_DEFINITIONS(-DDO_SCRIPTS) -else (DO_SCRIPTS) + add_definitions(-DDO_SCRIPTS) +else( DO_SCRIPTS ) message("* Build Trinityscripts : No") -endif(DO_SCRIPTS) +endif( DO_SCRIPTS ) -if(DO_TOOLS) +if( DO_TOOLS ) message("* Build map/vmap tools : Yes") -else(DO_TOOLS) +else( DO_TOOLS ) message("* Build map/vmap tools : No (default)") -endif(DO_TOOLS) +endif( DO_TOOLS ) if(DO_CLI) message("* Build with CLI : Yes (default)") @@ -144,27 +177,29 @@ else(DO_RA) message("* Build with RA : No (default)") endif(DO_RA) -if(DO_DEBUG) +if( DO_DEBUG ) message("* Build in debug-mode : Yes") add_definitions(-g -DTRINITY_DEBUG) -else(DO_DEBUG) +else( DO_DEBUG ) message("* Build in debug-mode : No (default)") add_definitions(--no-warnings) # makes build look nice, no warnings shown at all, only errors -endif(DO_DEBUG) +endif( DO_DEBUG ) -if(DO_PCH) +if( DO_PCH ) message("* Use PCH : Yes (default)") -else (DO_PCH) +else( DO_PCH ) message("* Use PCH : No") -endif(DO_PCH) - -if(DO_WARN) - message("* Show all warnings : Yes") - add_definitions(-Wall -Wfatal-errors -Wextra) -else(DO_WARN) - message("* Show compile-warnings : No (default)") - add_definitions(--no-warnings) # makes build look nice, no warnings shown at all, only errors -endif(DO_WARN) +endif( DO_PCH ) + +if( UNIX ) + if( DO_WARN ) + message("* Show all warnings : Yes") + add_definitions(-Wall -Wfatal-errors -Wextra) + else( DO_WARN ) + message("* Show compile-warnings : No (default)") + add_definitions(--no-warnings) # makes build look nice, no warnings shown at all, only errors + endif( DO_WARN ) +endif( UNIX ) if(DO_SQL) message("* Install SQL-files : Yes") @@ -174,61 +209,22 @@ endif(DO_SQL) message("") -find_library(SSLLIB NAMES ssl DOC "SSL library") -find_library(ZLIB z "Zlib library") - -FIND_MYSQL() - -if(UNIX) - if(CENTOS) - add_definitions(-DCENTOS) - FIND_TERMCAP() - else(CENTOS) - FIND_READLINE() - endif(CENTOS) -endif(UNIX) - -FIND_ACE(ACE) -if(ACE_FOUND) - message(STATUS "Found ACE: ${ACE_LIBRARY}") - message(STATUS "Include dir is: ${ACE_INCLUDE_DIR}") -else(ACE_FOUND) - message(SEND_ERROR "** ACE library not found! Trinity Core cannot be compiled!") - message(SEND_ERROR "** Please build ACE from http://www.cs.wustl.edu/~schmidt/ACE.html") - #For now remove msg about install from repo, as ubuntu/debian don't have needed ver in repos. - #message(SEND_ERROR "** your distro may provide a binary for ACE e.g. for ubuntu try apt-get install libace-dev") - return() - #set(BUILD_ACE 1) - #set(ACE_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/dep/ACE_wrappers ${CMAKE_BINARY_DIR}/dep/ACE_wrappers") - #set(ACE_LIBRARY ACE) - #message(STATUS "I will try to build ACE from: ${ACE_INCLUDE_DIR}") - #message(STATUS "And link using: ${ACE_LIBRARY}") -endif(ACE_FOUND) - -#somehow line below don't work. so for now change it to if exist -#check_include_files(${ACE_INCLUDE_DIR}/ace/Stack_Trace.h HAVE_ACE_STACK_TRACE_H) -if(EXISTS ${ACE_INCLUDE_DIR}/ace/Stack_Trace.h) - set(HAVE_ACE_STACK_TRACE_H 1) -else(EXISTS ${ACE_INCLUDE_DIR}/ace/Stack_Trace.h) - message(STATUS "** Your libace is out of date. Please update your libace!") -endif(EXISTS ${ACE_INCLUDE_DIR}/ace/Stack_Trace.h) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) +# Little tweak for OS X if(CMAKE_SYSTEM_NAME MATCHES "Darwin") set(MACOSX 1) set(OSX_LIBS /opt/local/lib/libcrypto.dylib) add_definitions(-D__ASSERTMACROS__) endif(CMAKE_SYSTEM_NAME MATCHES "Darwin") -set(CMAKE_SKIP_BUILD_RPATH FALSE) -set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) +set(CMAKE_SKIP_BUILD_RPATH 0) +set(CMAKE_BUILD_WITH_INSTALL_RPATH 0) set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") -set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) +set(CMAKE_INSTALL_RPATH_USE_LINK_PATH 1) add_subdirectory(externals) add_subdirectory(src) - if(DO_SQL) - add_subdirectory(sql) +add_subdirectory(sql) endif(DO_SQL) |
