diff options
23 files changed, 304 insertions, 735 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 4aae339d57f..0b7c14c4a0c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,52 +8,32 @@ # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -##### -##### Base setup for project -##### - -# -# Set projectname (must be done AFTER setting configurationtypes btw...) -# - +# Set projectname (must be done AFTER setting configurationtypes) project(TrinityCore) -# CMake policies +# CMake policies (can not be handled elsewhere) cmake_minimum_required(VERSION 2.6) cmake_policy(SET CMP0005 OLD) -set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") - -# -# Force out-of-source build -# +# Set RPATH-handing (CMake parameters) +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 1) -string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" BUILDING_IN_SOURCE) +# set macro-directory +set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/macros") -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, create a separate build directory - and run 'cmake path_to_project [options]' from there. - ") +# build in Release-mode by default if not explicitly set +if( NOT CMAKE_BUILD_TYPE ) + set(CMAKE_BUILD_TYPE "Release") endif() -# -# Basic packagesearching and setup (further support will be needed, this is a preliminary release!) -# - -include(MacroEnsureVersion) -include(OptimizeForArchitecture) -include(AddCompilerFlag) include(CheckCXXSourceRuns) - include(CheckIncludeFiles) -include(FindPlatform) - -if(WIN32) - set(ACE_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/dep/acelite) -endif() +include(CheckPlatform) +# basic packagesearching and setup (further support will be needed, this is a preliminary release!) find_package(PCHSupport) find_package(ACE REQUIRED) find_package(MySQL REQUIRED) @@ -64,298 +44,30 @@ if( UNIX ) find_package(BZip2) endif() -include(cmake/SSETests.cmake) - -# -# Optimize for architecture -# - -OptimizeForArchitecture() - -# -# Select the Release build configuration by default. -# - -if( NOT CMAKE_BUILD_TYPE ) - set(CMAKE_BUILD_TYPE "Release") -endif() - -##### -##### Options and settings -##### - -# -# Set up default option-parameters for building -# - -option(SERVERS "Build worldserver and authserver" 1) -option(SCRIPTS "Build worldserver with scripts included" 1) -option(TOOLS "Build map/vmap extraction/assembler tools" 0) -option(COREDEBUG "Build worldserver with additional debug-code included" 0) -option(SCRIPTPCH "Use precompiled headers when compiling scripts project" 1) -option(GAMEPCH "Use precompiled headers when compiling game project" 1) -option(SQL "Copy SQL files during installation" 0) -option(WARNINGS "Enable all compile-warnings during compile" 1) -option(USE_SFMT "Use SFMT for random number generation." 0) - -# -# Search for readline on *nixbased systems (CLI-handler) -# - -if( UNIX ) - find_readline() -endif() - -# -# Set up the installation-prefix -# - -if( PREFIX ) - set(CMAKE_INSTALL_PREFIX "${PREFIX}") -endif() - -# -# Example: Check the CMake preload parameters (Commented out by default) -# -# Overload CMAKE_INSTALL_PREFIX if not being set properly -#if( WIN32 ) -# if( NOT CYGWIN ) -# if( NOT CMAKE_INSTALL_PREFIX ) -# set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/bin") -# endif() -# endif() -#endif() - -# -# Handle core debugmode compilation (this will require further work for proper WIN32-setups) -# - -if( COREDEBUG ) - set(CMAKE_BUILD_TYPE Debug) -endif() - -# -# WINDOWS/MSVC: Set up paths for where we want binaries to end up after compilation -# - -if( MSVC ) - # Set up MSVC to dump files in the <builddir>/bin/<buildtype>/ folder for testing builds before install - - # executable binaries (.exe-files, and .dll-files on DLL-capable platforms) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) - - # other parts like static libraries etc - commented out as it's not needed - shown here as an example only - #set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) - #set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) -endif() - -# -# Set default configuration-directory (used on NIX-based platforms only) -# - -if( NOT CONF_DIR ) - set(CONF_DIR ${CMAKE_INSTALL_PREFIX}/etc) -endif() - -set(LIBSDIR ${CMAKE_INSTALL_PREFIX}/lib) - -##### -##### Build-preparation -##### - -# -# Create genrev object and create revision.h -# (Moved to subfolder to avoid cluttering up the base build-dir) -# - -add_subdirectory(src/genrevision) - -# # Find current revision of downloaded sourcetree -# - execute_process( COMMAND hg tip --template {rev} WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" OUTPUT_VARIABLE HG_REVISION ) -if(DEFINED NOPCH) - set(SCRIPTPCH 0) - set(GAMEPCH 0) -endif() - -# -# Output some generic information about the core and buildtype chosen -# - -message("") -message("* TrinityCore revision : ${HG_REVISION}") -if( UNIX ) - message("* Build binaries in : ${CMAKE_BUILD_TYPE} mode") -endif() -message("") - -# -# Output information about installation-directories and locations -# - -message("* Install core to : ${CMAKE_INSTALL_PREFIX}") -if( UNIX ) - message("* Install libraries to : ${LIBSDIR}") - message("* Install configs to : ${CONF_DIR}") -endif() -message("") - -# -# Show infomation about the options selected during configuration -# - -if( SERVERS ) - message("* Build servers : Yes (default)") -else() - message("* Build servers : No") -endif() - -if( GAMEPCH ) - message("* Build game w/PCH : Yes (default)") -else() - message("* Build game w/PCH : No") -endif() - -if( SCRIPTS ) - message("* Build with scripts : Yes (default)") - add_definitions(-DSCRIPTS) -else() - message("* Build with scripts : No") - set(SCRIPTPCH 0) -endif() - -if( SCRIPTPCH ) - message("* Build scripts w/PCH : Yes (default)") -else() - message("* Build scripts w/PCH : No") -endif() - -if( TOOLS ) - message("* Build map/vmap tools : Yes") -else() - message("* Build map/vmap tools : No (default)") -endif() - -if( COREDEBUG ) - message("* Use coreside debug : Yes") - add_definitions(-DTRINITY_DEBUG) - if(CMAKE_COMPILER_IS_GNUCXX) - add_definitions(-g) - endif() -else() - message("* Use coreside debug : No (default)") -endif() - -if( WARNINGS ) - message("* Show all warnings : Yes") - if( UNIX ) - add_definitions(-Wall -Wfatal-errors -Wextra) - endif() -else() - message("* Show compile-warnings : No (default)") - if( UNIX ) - add_definitions(--no-warnings) # makes build look nice, no warnings shown at all, only errors - elseif( WIN32 ) - # Disable warnings in Visual Studio 8 and above - if(MSVC AND NOT CMAKE_GENERATOR MATCHES "Visual Studio 7") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996 /wd4355 /wd4244 /wd4985 /wd4267 /wd4619") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4996 /wd4355 /wd4244 /wd4985 /wd4267 /wd4619") - endif() - add_definitions(-D_CRT_SECURE_NO_WARNINGS) - endif() -endif() - -# -# Inform if we will install SQL-files or not -# - -if( SQL ) - message("* Install SQL-files : Yes") -else() - message("* Install SQL-files : No (default)") +# turn off PCH totally if enabled (hidden setting, mainly for devs) +if( NOPCH ) + set(WITH_COREPCH 0) + set(WITH_SCRIPTPCH 0) endif() -# -# SFMT... -# -if( USE_SFMT ) - add_definitions(-DUSE_SFMT_FOR_RNG) - message("* Use SFMT for RNG : Yes") -else() - message("* Use SFMT for RNG : No (default)") -endif() - -message("") - -##### -##### Tweaks to make things operate well -##### - -# -# Little tweak for OS X -# - -if( CMAKE_SYSTEM_NAME MATCHES "Darwin" ) - set(MACOSX 1) - set(OSX_LIBS /usr/lib/libcrypto.dylib) - add_definitions(-D__ASSERTMACROS__) -endif() - -# -# Some small tweaks for Visual Studio 7 and above. -# - -if( MSVC ) - # Mark 32 bit executables large address aware so they can use > 2GB address space - if(CMAKE_SIZEOF_VOID_P MATCHES 4) - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE") - endif() - # Multithreaded compiling on VS - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") - add_definitions(-D_CRT_SECURE_NO_WARNINGS) -endif() - -# -# Set RPATH-handing (CMake parameters) -# +# set default buildoptions and print them +include(cmake/options.cmake) -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 1) - -##### -##### Start filling in the blanks, and build the project -##### - -# -# Create uninstall-object for UNIX platforms -# - -if( UNIX ) - configure_file( - "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" - IMMEDIATE @ONLY - ) - add_custom_target(uninstall - "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" - ) -endif() - -# -# Enter the different builddirectories and start working -# +# add and generate revision.h +add_subdirectory(src/genrevision) +# add dependencies add_subdirectory(dep) + +# add core sources add_subdirectory(src) -if( SQL ) - add_subdirectory(sql) -endif() + +# add sql-files +add_subdirectory(sql) diff --git a/cmake/AddCompilerFlag.cmake b/cmake/AddCompilerFlag.cmake deleted file mode 100644 index 5310b5982bc..00000000000 --- a/cmake/AddCompilerFlag.cmake +++ /dev/null @@ -1,12 +0,0 @@ -include (CheckCXXCompilerFlag) -macro(AddCompilerFlag _flag) - string(REGEX REPLACE "[/:= ]" "_" _flag_esc "${_flag}") - check_cxx_compiler_flag("${_flag}" check_compiler_flag_${_flag_esc}) - if(check_compiler_flag_${_flag_esc}) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_flag}") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_flag}") - endif(check_compiler_flag_${_flag_esc}) - if(${ARGC} EQUAL 2) - set(${ARGV1} "${check_compiler_flag_${_flag_esc}}") - endif(${ARGC} EQUAL 2) -endmacro(AddCompilerFlag) diff --git a/cmake/FindPlatform.cmake b/cmake/FindPlatform.cmake deleted file mode 100644 index 60ce00149b3..00000000000 --- a/cmake/FindPlatform.cmake +++ /dev/null @@ -1,16 +0,0 @@ -# default to x86 platform. We'll check for X64 in a bit -SET(PLATFORM X86) - -# This definition is necessary to work around a bug with Intellisense described -# here: http://tinyurl.com/2cb428. Syntax highlighting is important for proper -# debugger functionality. - -IF(CMAKE_SIZEOF_VOID_P MATCHES 8) - MESSAGE(STATUS "Detected 64-bit platform.") - if(WIN32) - ADD_DEFINITIONS("-D_WIN64") - ENDIF() - SET (PLATFORM X64) -ELSE() - MESSAGE(STATUS "Detected 32-bit platform.") -ENDIF() diff --git a/cmake/FindSSE.cmake b/cmake/FindSSE.cmake deleted file mode 100644 index 6ece8768968..00000000000 --- a/cmake/FindSSE.cmake +++ /dev/null @@ -1,104 +0,0 @@ -# Check if SSE instructions are available on the machine where -# the project is compiled. - -IF(CMAKE_SYSTEM_NAME MATCHES "Linux") - EXEC_PROGRAM(cat ARGS "/proc/cpuinfo" OUTPUT_VARIABLE CPUINFO) - - STRING(REGEX REPLACE "^.*(sse2).*$" "\\1" SSE_THERE ${CPUINFO}) - STRING(COMPARE EQUAL "sse2" "${SSE_THERE}" SSE2_TRUE) - IF (SSE2_TRUE) - set(SSE2_FOUND true CACHE BOOL "SSE2 available on host") - ELSE (SSE2_TRUE) - set(SSE2_FOUND false CACHE BOOL "SSE2 available on host") - ENDIF (SSE2_TRUE) - - # /proc/cpuinfo apparently omits sse3 :( - STRING(REGEX REPLACE "^.*[^s](sse3).*$" "\\1" SSE_THERE ${CPUINFO}) - STRING(COMPARE EQUAL "sse3" "${SSE_THERE}" SSE3_TRUE) - IF (NOT SSE3_TRUE) - STRING(REGEX REPLACE "^.*(T2300).*$" "\\1" SSE_THERE ${CPUINFO}) - STRING(COMPARE EQUAL "T2300" "${SSE_THERE}" SSE3_TRUE) - ENDIF (NOT SSE3_TRUE) - - STRING(REGEX REPLACE "^.*(ssse3).*$" "\\1" SSE_THERE ${CPUINFO}) - STRING(COMPARE EQUAL "ssse3" "${SSE_THERE}" SSSE3_TRUE) - IF (SSE3_TRUE OR SSSE3_TRUE) - set(SSE3_FOUND true CACHE BOOL "SSE3 available on host") - ELSE (SSE3_TRUE OR SSSE3_TRUE) - set(SSE3_FOUND false CACHE BOOL "SSE3 available on host") - ENDIF (SSE3_TRUE OR SSSE3_TRUE) - IF (SSSE3_TRUE) - set(SSSE3_FOUND true CACHE BOOL "SSSE3 available on host") - ELSE (SSSE3_TRUE) - set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host") - ENDIF (SSSE3_TRUE) - - STRING(REGEX REPLACE "^.*(sse4_1).*$" "\\1" SSE_THERE ${CPUINFO}) - STRING(COMPARE EQUAL "sse4_1" "${SSE_THERE}" SSE41_TRUE) - IF (SSE41_TRUE) - set(SSE4_1_FOUND true CACHE BOOL "SSE4.1 available on host") - ELSE (SSE41_TRUE) - set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host") - ENDIF (SSE41_TRUE) -ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Darwin") - EXEC_PROGRAM("/usr/sbin/sysctl -n machdep.cpu.features" OUTPUT_VARIABLE - CPUINFO) - - STRING(REGEX REPLACE "^.*[^S](SSE2).*$" "\\1" SSE_THERE ${CPUINFO}) - STRING(COMPARE EQUAL "SSE2" "${SSE_THERE}" SSE2_TRUE) - IF (SSE2_TRUE) - set(SSE2_FOUND true CACHE BOOL "SSE2 available on host") - ELSE (SSE2_TRUE) - set(SSE2_FOUND false CACHE BOOL "SSE2 available on host") - ENDIF (SSE2_TRUE) - - STRING(REGEX REPLACE "^.*[^S](SSE3).*$" "\\1" SSE_THERE ${CPUINFO}) - STRING(COMPARE EQUAL "SSE3" "${SSE_THERE}" SSE3_TRUE) - IF (SSE3_TRUE) - set(SSE3_FOUND true CACHE BOOL "SSE3 available on host") - ELSE (SSE3_TRUE) - set(SSE3_FOUND false CACHE BOOL "SSE3 available on host") - ENDIF (SSE3_TRUE) - - STRING(REGEX REPLACE "^.*(SSSE3).*$" "\\1" SSE_THERE ${CPUINFO}) - STRING(COMPARE EQUAL "SSSE3" "${SSE_THERE}" SSSE3_TRUE) - IF (SSSE3_TRUE) - set(SSSE3_FOUND true CACHE BOOL "SSSE3 available on host") - ELSE (SSSE3_TRUE) - set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host") - ENDIF (SSSE3_TRUE) - - STRING(REGEX REPLACE "^.*(SSE4.1).*$" "\\1" SSE_THERE ${CPUINFO}) - STRING(COMPARE EQUAL "SSE4.1" "${SSE_THERE}" SSE41_TRUE) - IF (SSE41_TRUE) - set(SSE4_1_FOUND true CACHE BOOL "SSE4.1 available on host") - ELSE (SSE41_TRUE) - set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host") - ENDIF (SSE41_TRUE) -ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Windows") - # TODO - set(SSE2_FOUND true CACHE BOOL "SSE2 available on host") - set(SSE3_FOUND false CACHE BOOL "SSE3 available on host") - set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host") - set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host") -ELSE(CMAKE_SYSTEM_NAME MATCHES "Linux") - set(SSE2_FOUND true CACHE BOOL "SSE2 available on host") - set(SSE3_FOUND false CACHE BOOL "SSE3 available on host") - set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host") - set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host") -ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux") - -if(NOT SSE2_FOUND) - MESSAGE(STATUS "Could not find hardware support for SSE2 on this machine.") -endif(NOT SSE2_FOUND) -if(NOT SSE3_FOUND) - MESSAGE(STATUS "Could not find hardware support for SSE3 on this machine.") -endif(NOT SSE3_FOUND) -if(NOT SSSE3_FOUND) - MESSAGE(STATUS "Could not find hardware support for SSSE3 on this machine.") -endif(NOT SSSE3_FOUND) -if(NOT SSE4_1_FOUND) - MESSAGE(STATUS "Could not find hardware support for SSE4.1 on this machine.") -endif(NOT SSE4_1_FOUND) - -mark_as_advanced(SSE2_FOUND SSE3_FOUND SSSE3_FOUND SSE4_1_FOUND) diff --git a/cmake/OptimizeForArchitecture.cmake b/cmake/OptimizeForArchitecture.cmake deleted file mode 100644 index 4f10270b97d..00000000000 --- a/cmake/OptimizeForArchitecture.cmake +++ /dev/null @@ -1,224 +0,0 @@ -include (AddCompilerFlag) -include (MacroEnsureVersion) - -macro(_my_find _list _value _ret) - list(FIND ${_list} "${_value}" _found) - if(_found EQUAL -1) - set(${_ret} FALSE) - else(_found EQUAL -1) - set(${_ret} TRUE) - endif(_found EQUAL -1) -endmacro(_my_find) - -macro(OptimizeForArchitecture) - set(TARGET_ARCHITECTURE "auto" CACHE STRING "CPU architecture to optimize for. Using an incorrect setting here can result in crashes of the resulting binary because of invalid instructions used.\nSetting the value to \"auto\" will try to optimize for the architecture where cmake is called.\nOther supported values are: \"core\", \"merom\" (65nm Core2), \"penryn\" (45nm Core2), \"nehalem\", \"westmere\", \"sandy-bridge\", \"atom\", \"k8\", \"k8-sse3\", \"barcelona\", \"istanbul\", \"magny-cours\".") - string(TOLOWER "${TARGET_ARCHITECTURE}" TARGET_ARCHITECTURE) - - set(_march_flag_list) - set(_available_vector_units_list) - - if(TARGET_ARCHITECTURE STREQUAL "auto") - set(TARGET_ARCHITECTURE "generic") - set(_vendor_id) - set(_cpu_family) - set(_cpu_model) - if(CMAKE_SYSTEM_NAME STREQUAL "Linux") - file(READ "/proc/cpuinfo" _cpuinfo) - string(REGEX REPLACE ".*vendor_id[ \t]*:[ \t]+([a-zA-Z0-9_-]+).*" "\\1" _vendor_id "${_cpuinfo}") - string(REGEX REPLACE ".*cpu family[ \t]*:[ \t]+([a-zA-Z0-9_-]+).*" "\\1" _cpu_family "${_cpuinfo}") - string(REGEX REPLACE ".*model[ \t]*:[ \t]+([a-zA-Z0-9_-]+).*" "\\1" _cpu_model "${_cpuinfo}") - elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") - exec_program("/usr/sbin/sysctl -n machdep.cpu.vendor" OUTPUT_VARIABLE _vendor_id) - exec_program("/usr/sbin/sysctl -n machdep.cpu.model" OUTPUT_VARIABLE _cpu_model) - exec_program("/usr/sbin/sysctl -n machdep.cpu.family" OUTPUT_VARIABLE _cpu_family) - elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") - get_filename_component(_vendor_id "[HKEY_LOCAL_MACHINE\\Hardware\\Description\\System\\CentralProcessor\\0;VendorIdentifier]" NAME CACHE) - get_filename_component(_cpu_id "[HKEY_LOCAL_MACHINE\\Hardware\\Description\\System\\CentralProcessor\\0;Identifier]" NAME CACHE) - mark_as_advanced(_vendor_id _cpu_id) - string(REGEX REPLACE ".* Family ([0-9]+) .*" "\\1" _cpu_family "${_cpu_id}") - string(REGEX REPLACE ".* Model ([0-9]+) .*" "\\1" _cpu_model "${_cpu_id}") - endif(CMAKE_SYSTEM_NAME STREQUAL "Linux") - if(_vendor_id STREQUAL "GenuineIntel") - if(_cpu_family EQUAL 6) - # Any recent Intel CPU except NetBurst - if(_cpu_model EQUAL 37) - set(TARGET_ARCHITECTURE "westmere") - elseif(_cpu_model EQUAL 30) - set(TARGET_ARCHITECTURE "allendale") - elseif(_cpu_model EQUAL 29) - set(TARGET_ARCHITECTURE "penryn") - elseif(_cpu_model EQUAL 28) - set(TARGET_ARCHITECTURE "atom") - elseif(_cpu_model EQUAL 26) - set(TARGET_ARCHITECTURE "nehalem") - elseif(_cpu_model EQUAL 23) - set(TARGET_ARCHITECTURE "penryn") - elseif(_cpu_model EQUAL 15) - set(TARGET_ARCHITECTURE "merom") - elseif(_cpu_model EQUAL 14) - set(TARGET_ARCHITECTURE "core") - endif(_cpu_model EQUAL 37) - elseif(_cpu_family EQUAL 7) # Itanium (not supported) - elseif(_cpu_family EQUAL 15) # NetBurst - list(APPEND _available_vector_units_list "sse" "sse2") - if(_cpu_model GREATER 2) # Not sure whether this must be 3 or even 4 instead - list(APPEND _available_vector_units_list "sse" "sse2" "sse3") - endif(_cpu_model GREATER 2) - endif(_cpu_family EQUAL 6) - elseif(_vendor_id STREQUAL "AuthenticAMD") - if(_cpu_family EQUAL 16) - set(TARGET_ARCHITECTURE "barcelona") - elseif(_cpu_family EQUAL 15) - set(TARGET_ARCHITECTURE "k8") - if(_cpu_model GREATER 64) # I don't know the right number to put here. This is just a guess from the hardware I have access to - set(TARGET_ARCHITECTURE "k8-sse3") - endif(_cpu_model GREATER 64) - endif(_cpu_family EQUAL 16) - endif(_vendor_id STREQUAL "GenuineIntel") - endif(TARGET_ARCHITECTURE STREQUAL "auto") - - if(TARGET_ARCHITECTURE STREQUAL "core") - list(APPEND _march_flag_list "core2") - list(APPEND _available_vector_units_list "sse" "sse2" "sse3") - elseif(TARGET_ARCHITECTURE STREQUAL "merom") - list(APPEND _march_flag_list "merom") - list(APPEND _march_flag_list "core2") - list(APPEND _available_vector_units_list "sse" "sse2" "sse3" "ssse3") - elseif(TARGET_ARCHITECTURE STREQUAL "penryn") - list(APPEND _march_flag_list "penryn") - list(APPEND _march_flag_list "core2") - list(APPEND _available_vector_units_list "sse" "sse2" "sse3" "ssse3" "sse4.1") - elseif(TARGET_ARCHITECTURE STREQUAL "nehalem") - list(APPEND _march_flag_list "nehalem") - list(APPEND _march_flag_list "core2") - list(APPEND _available_vector_units_list "sse" "sse2" "sse3" "ssse3" "sse4.1" "sse4.2") - elseif(TARGET_ARCHITECTURE STREQUAL "allendale") - list(APPEND _march_flag_list "allendale") - list(APPEND _march_flag_list "core2") - list(APPEND _available_vector_units_list "sse" "sse2" "sse3" "ssse3" "sse4.1" "sse4.2") - elseif(TARGET_ARCHITECTURE STREQUAL "westmere") - list(APPEND _march_flag_list "westmere") - list(APPEND _march_flag_list "core2") - list(APPEND _available_vector_units_list "sse" "sse2" "sse3" "ssse3" "sse4.1" "sse4.2") - elseif(TARGET_ARCHITECTURE STREQUAL "sandy-bridge") - list(APPEND _march_flag_list "sandybridge") - list(APPEND _march_flag_list "core2") - list(APPEND _available_vector_units_list "sse" "sse2" "sse3" "ssse3" "sse4.1" "sse4.2" "avx") - elseif(TARGET_ARCHITECTURE STREQUAL "atom") - list(APPEND _march_flag_list "atom") - list(APPEND _march_flag_list "core2") - list(APPEND _available_vector_units_list "sse" "sse2" "sse3" "ssse3") - elseif(TARGET_ARCHITECTURE STREQUAL "k8") - list(APPEND _march_flag_list "k8") - list(APPEND _available_vector_units_list "sse" "sse2") - elseif(TARGET_ARCHITECTURE STREQUAL "k8-sse3") - list(APPEND _march_flag_list "k8-sse3") - list(APPEND _march_flag_list "k8") - list(APPEND _available_vector_units_list "sse" "sse2" "sse3") - elseif(TARGET_ARCHITECTURE STREQUAL "barcelona") - list(APPEND _march_flag_list "barcelona") - list(APPEND _march_flag_list "core2") - list(APPEND _available_vector_units_list "sse" "sse2" "sse3" "sse4a") - elseif(TARGET_ARCHITECTURE STREQUAL "istanbul") - list(APPEND _march_flag_list "istanbul") - list(APPEND _march_flag_list "barcelona") - list(APPEND _march_flag_list "core2") - list(APPEND _available_vector_units_list "sse" "sse2" "sse3" "sse4a") - elseif(TARGET_ARCHITECTURE STREQUAL "magny-cours") - list(APPEND _march_flag_list "magnycours") - list(APPEND _march_flag_list "istanbul") - list(APPEND _march_flag_list "barcelona") - list(APPEND _march_flag_list "core2") - list(APPEND _available_vector_units_list "sse" "sse2" "sse3" "sse4a") - elseif(TARGET_ARCHITECTURE STREQUAL "generic") - list(APPEND _march_flag_list "generic") - else(TARGET_ARCHITECTURE STREQUAL "core") - message(FATAL_ERROR "Unknown target architecture: \"${TARGET_ARCHITECTURE}\". Please set TARGET_ARCHITECTURE to a supported value.") - endif(TARGET_ARCHITECTURE STREQUAL "core") - - set(_disable_vector_unit_list) - set(_enable_vector_unit_list) - _my_find(_available_vector_units_list "sse2" SSE2_FOUND) - set(USE_SSE2 ${SSE2_FOUND} CACHE BOOL "Use SSE2. If SSE2 instructions are not enabled the SSE implementation will be disabled.") - if(USE_SSE2) - list(APPEND _enable_vector_unit_list "sse2") - _my_find(_available_vector_units_list "sse3" SSE3_FOUND) - set(USE_SSE3 ${SSE3_FOUND} CACHE BOOL "Use SSE3. If SSE3 instructions are not enabled they will be emulated.") - if(USE_SSE3) - list(APPEND _enable_vector_unit_list "sse3") - _my_find(_available_vector_units_list "ssse3" SSSE3_FOUND) - _my_find(_available_vector_units_list "sse4a" SSE4a_FOUND) - set(USE_SSSE3 ${SSSE3_FOUND} CACHE BOOL "Use SSSE3. If SSSE3 instructions are not enabled they will be emulated.") - set(USE_SSE4a ${SSE4a_FOUND} CACHE BOOL "Use SSE4a. If SSE4a instructions are not enabled they will be emulated.") - if(USE_SSSE3) - list(APPEND _enable_vector_unit_list "ssse3") - _my_find(_available_vector_units_list "sse4.1" SSE4_1_FOUND) - set(USE_SSE4_1 ${SSE4_1_FOUND} CACHE BOOL "Use SSE4.1. If SSE4.1 instructions are not enabled they will be emulated.") - if(USE_SSE4_1) - list(APPEND _enable_vector_unit_list "sse4.1") - _my_find(_available_vector_units_list "sse4.2" SSE4_2_FOUND) - set(USE_SSE4_2 ${SSE4_2_FOUND} CACHE BOOL "Use SSE4.2. If SSE4.2 instructions are not enabled they will be emulated.") - if(USE_SSE4_2) - list(APPEND _enable_vector_unit_list "sse4.2") - else(USE_SSE4_2) - list(APPEND _disable_vector_unit_list "sse4.2") - endif(USE_SSE4_2) - else(USE_SSE4_1) - list(APPEND _disable_vector_unit_list "sse4.1" "sse4.2") - endif(USE_SSE4_1) - else(USE_SSSE3) - list(APPEND _disable_vector_unit_list "ssse3" "sse4.1" "sse4.2") - endif(USE_SSSE3) - if(USE_SSE4a) - list(APPEND _enable_vector_unit_list "sse4a") - else(USE_SSE4a) - list(APPEND _disable_vector_unit_list "sse4a") - endif(USE_SSE4a) - else(USE_SSE3) - list(APPEND _disable_vector_unit_list "sse3" "ssse3" "sse4.1" "sse4.2" "sse4a") - endif(USE_SSE3) - else(USE_SSE2) - list(APPEND _disable_vector_unit_list "sse2" "sse3" "ssse3" "sse4.1" "sse4.2" "sse4a") - endif(USE_SSE2) - if(CMAKE_C_COMPILER MATCHES "cl(.exe)?$") # MSVC - # MSVC on 32 bit can select only /arch:SSE2 - # MSVC on 64 bit cannot select anything - if(NOT CMAKE_CL_64) - _my_find(_enable_vector_unit_list "sse2" SSE2_FOUND) - AddCompilerFlag("/arch:SSE2") - endif(NOT CMAKE_CL_64) - foreach(_flag ${_enable_vector_unit_list}) - string(TOUPPER "${_flag}" _flag) - string(REPLACE "." "_" _flag "__${_flag}__") - add_definitions("-D${_flag}") - endforeach(_flag) - else(CMAKE_C_COMPILER MATCHES "cl(.exe)?$") - foreach(_flag ${_march_flag_list}) - AddCompilerFlag("-march=${_flag}" _good) - if(_good) - break() - endif(_good) - endforeach(_flag) - foreach(_flag ${_enable_vector_unit_list}) - AddCompilerFlag("-m${_flag}") - endforeach(_flag) - foreach(_flag ${_disable_vector_unit_list}) - AddCompilerFlag("-mno-${_flag}") - endforeach(_flag) - # Not really target architecture specific, but GCC 4.5.[01] fail at inlining some functions, - # creating functions with a single instructions, thus a large overhead. This is a good - # (because central) place to fix the problem - if(CMAKE_COMPILER_IS_GNUCXX) - exec_program(${CMAKE_C_COMPILER} ARGS -dumpversion OUTPUT_VARIABLE _gcc_version) - macro_ensure_version("4.5.0" "${_gcc_version}" GCC_4_5_0) - if(GCC_4_5_0) - macro_ensure_version("4.5.2" "${_gcc_version}" GCC_4_5_2) - if(NOT GCC_4_5_2) - AddCompilerFlag("--param early-inlining-insns=12") - endif(NOT GCC_4_5_2) - endif(GCC_4_5_0) - endif(CMAKE_COMPILER_IS_GNUCXX) - endif(CMAKE_C_COMPILER MATCHES "cl(.exe)?$") - - mark_as_advanced(USE_SSE2 USE_SSE3 USE_SSE4a USE_SSSE3) -endmacro(OptimizeForArchitecture) diff --git a/cmake/SSETests.cmake b/cmake/SSETests.cmake deleted file mode 100644 index dddb565d6c0..00000000000 --- a/cmake/SSETests.cmake +++ /dev/null @@ -1,33 +0,0 @@ -if(CMAKE_COMPILER_IS_GNUCXX) - # check the GCC version - exec_program(${CMAKE_C_COMPILER} ARGS -dumpversion OUTPUT_VARIABLE _gcc_version) - macro_ensure_version("4.4.1" "${_gcc_version}" GCC_4_4_1) - if(NOT GCC_4_4_1) - message(STATUS "\n--\n-- WARNING : Your GCC is older than 4.4.1. This is known to cause problems/bugs.\n-- Please update to the latest GCC if you can.\n--\n--") - macro_ensure_version("4.3.0" "${_gcc_version}" GCC_4_3_0) - if(NOT GCC_4_3_0) - message(STATUS "\n--\n-- WARNING : Your GCC is older than 4.3.0. It is unable to handle all SSE2 intrinsics.\n-- All SSE code will be disabled. Please update to the latest GCC if you can.\n--\n--") - set(SSE_INTRINSICS_BROKEN true) - endif(NOT GCC_4_3_0) - endif(NOT GCC_4_4_1) - - if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") - set(ENABLE_STRICT_ALIASING true CACHE BOOL "Enables strict aliasing rules for more aggressive optimizations") - if(NOT ENABLE_STRICT_ALIASING) - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-strict-aliasing ") - set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -fno-strict-aliasing ") - set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fno-strict-aliasing ") - set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -fno-strict-aliasing ") - endif(NOT ENABLE_STRICT_ALIASING) - endif(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") - - # if compiling for 32 bit x86 we need to use the -mfpmath=sse since the x87 is broken by design - CHECK_CXX_SOURCE_RUNS("int main() { return sizeof(void*) != 8; }" VOID_PTR_IS_64BIT) - if(NOT VOID_PTR_IS_64BIT) - exec_program(${CMAKE_C_COMPILER} ARGS -dumpmachine OUTPUT_VARIABLE _gcc_machine) - if(_gcc_machine MATCHES "[x34567]86") - AddCompilerFlag("-mfpmath=sse") - endif(_gcc_machine MATCHES "[x34567]86") - endif(NOT VOID_PTR_IS_64BIT) -endif() - diff --git a/cmake/compiler/gcc/settings.cmake b/cmake/compiler/gcc/settings.cmake new file mode 100644 index 00000000000..1d981509972 --- /dev/null +++ b/cmake/compiler/gcc/settings.cmake @@ -0,0 +1,15 @@ +add_definitions(-fno-delete-null-pointer-checks) + +if( USE_SFMT) + add_definitions(-msse2) +endif() + +if( WITH_WARNINGS ) + add_definitions(-Wall -Wfatal-errors -Wextra) +else() + add_definitions(--no-warnings) +endif() + +if( WITH_COREDEBUG ) + add_definitions(-ggdb3) +endif() diff --git a/cmake/compiler/msvc/settings.cmake b/cmake/compiler/msvc/settings.cmake new file mode 100644 index 00000000000..cea2911084b --- /dev/null +++ b/cmake/compiler/msvc/settings.cmake @@ -0,0 +1,49 @@ +# set up output paths for executable binaries (.exe-files, and .dll-files on DLL-capable platforms) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + +# set up output paths ofr static libraries etc (commented out - shown here as an example only) +#set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +#set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + +# mark 32 bit executables large address aware so they can use > 2GB address space +if(CMAKE_SIZEOF_VOID_P MATCHES 4) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE") + message(STATUS "- MSVC: Enabled large address awareness") +endif() + +# multithreaded compiling on VS +if((NOT USE_COREPCH) AND (NOT USE_SCRIPTPCH)) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") + message(STATUS "- MSVC: PCH not used - enabled multithreaded compiling") +endif() + +# This definition is necessary to work around a bug with Intellisense described +# here: http://tinyurl.com/2cb428. Syntax highlighting is important for proper +# debugger functionality. + +if(${PLATFORM} STREQUAL "X64") + add_definitions("-D_WIN64") + message(STATUS "- MSVC: 64-bit platform, enforced -D_WIN64 parameter") +endif() + +# Defining _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES as 1 eliminates the warning by changing the strcpy call to strcpy_s, which prevents buffer overruns +# DISABLED UNTILL FURTHER, NEEDS TESTING AND VERIFICATION +#add_definitions(-D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES) +#message(STATUS "- MSVC: Overload standard names") + +# disable warnings in Visual Studio 8 and above if not wanted +if(NOT WITH_WARNINGS) + # Ignore warnings about older, less secure functions + add_definitions(-D_CRT_SECURE_NO_WARNINGS) + message(STATUS "- MSVC: Disabled NON-SECURE warnings") + + #Ignore warnings about POSIX deprecation + add_definitions(-D_CRT_NONSTDC_NO_WARNINGS) + message(STATUS "- MSVC: Disabled POSIX warnings") + + if(MSVC AND NOT CMAKE_GENERATOR MATCHES "Visual Studio 7") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996 /wd4355 /wd4244 /wd4985 /wd4267 /wd4619") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4996 /wd4355 /wd4244 /wd4985 /wd4267 /wd4619") + message(STATUS "- MSVC: Disabled generic compiletime warnings") + endif() +endif() diff --git a/cmake/macros/CheckBuildDir.cmake b/cmake/macros/CheckBuildDir.cmake new file mode 100644 index 00000000000..868643285ef --- /dev/null +++ b/cmake/macros/CheckBuildDir.cmake @@ -0,0 +1,23 @@ +# Copyright (C) 2008-2010 Trinity <http://www.trinitycore.org/> +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# +# Force out-of-source build +# + +string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" BUILDING_IN_SOURCE) + +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, create a separate build directory + and run 'cmake path_to_project [options]' from there. + ") +endif() diff --git a/cmake/macros/CheckPlatform.cmake b/cmake/macros/CheckPlatform.cmake new file mode 100644 index 00000000000..a9c80458c02 --- /dev/null +++ b/cmake/macros/CheckPlatform.cmake @@ -0,0 +1,19 @@ +# default to x86 platform. We'll check for X64 in a bit +set(PLATFORM X86) + +if(CMAKE_SIZEOF_VOID_P MATCHES 8) + set(PLATFORM X64) + MESSAGE(STATUS "Detected 64-bit platform") +else() + MESSAGE(STATUS "Detected 32-bit platform") +endif() + +include("${CMAKE_SOURCE_DIR}/cmake/platform/settings.cmake") + +if(WIN32) + include("${CMAKE_SOURCE_DIR}/cmake/platform/settings.win32.cmake") +elseif(APPLE) + include("${CMAKE_SOURCE_DIR}/cmake/platform/settings.osx.cmake") +elseif(UNIX) + include("${CMAKE_SOURCE_DIR}/cmake/platform/settings.unix.cmake") +endif() diff --git a/cmake/MacroEnsureVersion.cmake b/cmake/macros/EnsureVersion.cmake index 6797e5b7dbb..a85e12abb7f 100644 --- a/cmake/MacroEnsureVersion.cmake +++ b/cmake/macros/EnsureVersion.cmake @@ -1,20 +1,20 @@ # This file defines the following macros for developers to use in ensuring # that installed software is of the right version: # -# MACRO_ENSURE_VERSION - test that a version number is greater than +# ENSURE_VERSION - test that a version number is greater than # or equal to some minimum -# MACRO_ENSURE_VERSION_RANGE - test that a version number is greater than +# ENSURE_VERSION_RANGE - test that a version number is greater than # or equal to some minimum and less than some # maximum -# MACRO_ENSURE_VERSION2 - deprecated, do not use in new code +# ENSURE_VERSION2 - deprecated, do not use in new code # -# MACRO_ENSURE_VERSION +# ENSURE_VERSION # This macro compares version numbers of the form "x.y.z" or "x.y" -# MACRO_ENSURE_VERSION( FOO_MIN_VERSION FOO_VERSION_FOUND FOO_VERSION_OK) +# ENSURE_VERSION( FOO_MIN_VERSION FOO_VERSION_FOUND FOO_VERSION_OK) # will set FOO_VERSION_OK to true if FOO_VERSION_FOUND >= FOO_MIN_VERSION # Leading and trailing text is ok, e.g. -# MACRO_ENSURE_VERSION( "2.5.31" "flex 2.5.4a" VERSION_OK) +# ENSURE_VERSION( "2.5.31" "flex 2.5.4a" VERSION_OK) # which means 2.5.31 is required and "flex 2.5.4a" is what was found on the system # Copyright (c) 2006, David Faure, <faure@kde.org> @@ -23,13 +23,13 @@ # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. -# MACRO_ENSURE_VERSION_RANGE +# ENSURE_VERSION_RANGE # This macro ensures that a version number of the form # "x.y.z" or "x.y" falls within a range defined by # min_version <= found_version < max_version. # If this expression holds, FOO_VERSION_OK will be set TRUE # -# Example: MACRO_ENSURE_VERSION_RANGE3( "0.1.0" ${FOOCODE_VERSION} "0.7.0" FOO_VERSION_OK ) +# Example: ENSURE_VERSION_RANGE3( "0.1.0" ${FOOCODE_VERSION} "0.7.0" FOO_VERSION_OK ) # # This macro will break silently if any of x,y,z are greater than 100. # @@ -76,7 +76,7 @@ MACRO(NORMALIZE_VERSION _requested_version _normalized_version) MATH(EXPR ${_normalized_version} "${_major_vers}*10000 + ${_minor_vers}*100 + ${_patch_vers}") ENDMACRO(NORMALIZE_VERSION) -MACRO(MACRO_CHECK_RANGE_INCLUSIVE_LOWER _lower_limit _value _upper_limit _ok) +MACRO(CHECK_RANGE_INCLUSIVE_LOWER _lower_limit _value _upper_limit _ok) if (${_value} LESS ${_lower_limit}) set( ${_ok} FALSE ) elseif (${_value} EQUAL ${_lower_limit}) @@ -88,9 +88,9 @@ MACRO(MACRO_CHECK_RANGE_INCLUSIVE_LOWER _lower_limit _value _upper_limit _ok) else (${_value} LESS ${_lower_limit}) set( ${_ok} TRUE ) endif (${_value} LESS ${_lower_limit}) -ENDMACRO(MACRO_CHECK_RANGE_INCLUSIVE_LOWER) +ENDMACRO(CHECK_RANGE_INCLUSIVE_LOWER) -MACRO(MACRO_ENSURE_VERSION requested_version found_version var_too_old) +MACRO(ENSURE_VERSION requested_version found_version var_too_old) NORMALIZE_VERSION( ${requested_version} req_vers_num ) NORMALIZE_VERSION( ${found_version} found_vers_num ) @@ -100,18 +100,16 @@ MACRO(MACRO_ENSURE_VERSION requested_version found_version var_too_old) set( ${var_too_old} TRUE ) endif (found_vers_num LESS req_vers_num) -ENDMACRO(MACRO_ENSURE_VERSION) +ENDMACRO(ENSURE_VERSION) -MACRO(MACRO_ENSURE_VERSION2 requested_version2 found_version2 var_too_old2) - MACRO_ENSURE_VERSION( ${requested_version2} ${found_version2} ${var_too_old2}) -ENDMACRO(MACRO_ENSURE_VERSION2) +MACRO(ENSURE_VERSION2 requested_version2 found_version2 var_too_old2) + ENSURE_VERSION( ${requested_version2} ${found_version2} ${var_too_old2}) +ENDMACRO(ENSURE_VERSION2) -MACRO(MACRO_ENSURE_VERSION_RANGE min_version found_version max_version var_ok) +MACRO(ENSURE_VERSION_RANGE min_version found_version max_version var_ok) NORMALIZE_VERSION( ${min_version} req_vers_num ) NORMALIZE_VERSION( ${found_version} found_vers_num ) NORMALIZE_VERSION( ${max_version} max_vers_num ) - MACRO_CHECK_RANGE_INCLUSIVE_LOWER( ${req_vers_num} ${found_vers_num} ${max_vers_num} ${var_ok}) -ENDMACRO(MACRO_ENSURE_VERSION_RANGE) - - + CHECK_RANGE_INCLUSIVE_LOWER( ${req_vers_num} ${found_vers_num} ${max_vers_num} ${var_ok}) +ENDMACRO(ENSURE_VERSION_RANGE) diff --git a/cmake/FindACE.cmake b/cmake/macros/FindACE.cmake index 4ade5f64b03..4ade5f64b03 100644 --- a/cmake/FindACE.cmake +++ b/cmake/macros/FindACE.cmake diff --git a/cmake/FindMySQL.cmake b/cmake/macros/FindMySQL.cmake index bc4edaf1c24..bc4edaf1c24 100644 --- a/cmake/FindMySQL.cmake +++ b/cmake/macros/FindMySQL.cmake diff --git a/cmake/FindOpenSSL.cmake b/cmake/macros/FindOpenSSL.cmake index 01f7d20e5d2..01f7d20e5d2 100644 --- a/cmake/FindOpenSSL.cmake +++ b/cmake/macros/FindOpenSSL.cmake diff --git a/cmake/FindPCHSupport.cmake b/cmake/macros/FindPCHSupport.cmake index 39a96b6cadb..39a96b6cadb 100644 --- a/cmake/FindPCHSupport.cmake +++ b/cmake/macros/FindPCHSupport.cmake diff --git a/cmake/FindReadline.cmake b/cmake/macros/FindReadline.cmake index 993ac5126c2..993ac5126c2 100644 --- a/cmake/FindReadline.cmake +++ b/cmake/macros/FindReadline.cmake diff --git a/cmake/options.cmake b/cmake/options.cmake new file mode 100644 index 00000000000..74f25621d44 --- /dev/null +++ b/cmake/options.cmake @@ -0,0 +1,99 @@ +# Copyright (C) 2008-2010 Trinity <http://www.trinitycore.org/> +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +option(SERVERS "Build worldserver and authserver" 1) +option(SCRIPTS "Build core with scripts included" 1) +option(TOOLS "Build map/vmap extraction/assembler tools" 0) +option(USE_SCRIPTPCH "Use precompiled headers when compiling scripts" 1) +option(USE_COREPCH "Use precompiled headers when compiling servers" 1) +option(USE_SFMT "Use SFMT as random numbergenerator" 0) +option(WITH_WARNINGS "Show all warnings during compile" 1) +option(WITH_COREDEBUG "Include additional debug-code in core" 0) +option(WITH_SQL "Copy SQL files during installation" 0) + +# output generic information about the core and buildtype chosen + +message("") +message("* TrinityCore revision : ${HG_REVISION}") +if( UNIX ) + message("* Build binaries in : ${CMAKE_BUILD_TYPE} mode") +endif() +message("") + +# output information about installation-directories and locations + +message("* Install core to : ${CMAKE_INSTALL_PREFIX}") +if( UNIX ) + message("* Install libraries to : ${LIBSDIR}") + message("* Install configs to : ${CONF_DIR}") +endif() +message("") + +# Show infomation about the options selected during configuration + +if( SERVERS ) + message("* Build world/auth : Yes (default)") +else() + message("* Build world/authserver : No") +endif() + +if( SCRIPTS ) + message("* Build with scripts : Yes (default)") + add_definitions(-DSCRIPTS) +else() + message("* Build with scripts : No") + set(SCRIPTPCH 0) +endif() + +if( TOOLS ) + message("* Build map/vmap tools : Yes") +else() + message("* Build map/vmap tools : No (default)") +endif() + +if( WITH_SQL ) + message("* Install SQL-files : Yes") +else() + message("* Install SQL-files : No (default)") +endif() + +if( USE_COREPCH ) + message("* Build core w/PCH : Yes (default)") +else() + message("* Build core w/PCH : No") +endif() + +if( USE_SCRIPTPCH ) + message("* Build scripts w/PCH : Yes (default)") +else() + message("* Build scripts w/PCH : No") +endif() + +if( USE_SFMT ) + message("* Use SFMT for RNG : Yes") + add_definitions(-DUSE_SFMT_FOR_RNG) +else() + message("* Use SFMT for RNG : No (default)") +endif() + +if( WITH_WARNINGS ) + message("* Show all warnings : Yes") +else() + message("* Show compile-warnings : No (default)") +endif() + +if( WITH_COREDEBUG ) + message("* Use coreside debug : Yes") + add_definitions(-DTRINITY_DEBUG) +else() + message("* Use coreside debug : No (default)") +endif() + +message("") diff --git a/cmake/platform/settings.cmake b/cmake/platform/settings.cmake new file mode 100644 index 00000000000..6df5bc2165f --- /dev/null +++ b/cmake/platform/settings.cmake @@ -0,0 +1,5 @@ +# set installation prefix +if( PREFIX ) + set(CMAKE_INSTALL_PREFIX "${PREFIX}") +endif() + diff --git a/cmake/platform/settings.osx.cmake b/cmake/platform/settings.osx.cmake new file mode 100644 index 00000000000..609c6652b3f --- /dev/null +++ b/cmake/platform/settings.osx.cmake @@ -0,0 +1,3 @@ +set(MACOSX 1) +set(OSX_LIBS /usr/lib/libcrypto.dylib) +add_definitions(-D__ASSERTMACROS__) diff --git a/cmake/platform/settings.unix.cmake b/cmake/platform/settings.unix.cmake new file mode 100644 index 00000000000..6751f43b367 --- /dev/null +++ b/cmake/platform/settings.unix.cmake @@ -0,0 +1,24 @@ +# set default configuration directory +if( NOT CONF_DIR ) + set(CONF_DIR ${CMAKE_INSTALL_PREFIX}/etc) +endif() + +# set default library directory +if( NOT LIBSDIR ) + set(LIBSDIR ${CMAKE_INSTALL_PREFIX}/lib) +endif() + +# configure uninstaller +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" + IMMEDIATE @ONLY +) + +# create uninstaller target (allows for using "make uninstall") +add_custom_target(uninstall + "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" +) + +include(${CMAKE_SOURCE_DIR}/cmake/compiler/gcc/settings.cmake) + diff --git a/cmake/platform/settings.win32.cmake b/cmake/platform/settings.win32.cmake new file mode 100644 index 00000000000..f55f5702439 --- /dev/null +++ b/cmake/platform/settings.win32.cmake @@ -0,0 +1,15 @@ +# Package overloads +set(ACE_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/dep/acelite) + +# check the CMake preload parameters (commented out by default) + +# overload CMAKE_INSTALL_PREFIX if not being set properly +#if( WIN32 ) +# if( NOT CYGWIN ) +# if( NOT CMAKE_INSTALL_PREFIX ) +# set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/bin") +# endif() +# endif() +#endif() + +include(${CMAKE_SOURCE_DIR}/cmake/compiler/msvc/settings.cmake) diff --git a/cmake/cmake_uninstall.cmake.in b/cmake_uninstall.cmake.in index 06f9c8263a8..06f9c8263a8 100644 --- a/cmake/cmake_uninstall.cmake.in +++ b/cmake_uninstall.cmake.in diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index a56ba351ded..25537fecf67 100644 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -1,10 +1,6 @@ -add_subdirectory(updates) -add_subdirectory(scripts) -add_subdirectory(base) -add_subdirectory(create) - -########### install files ############### - -FILE(GLOB _SQL *.sql) - -install(FILES ${_SQL} DESTINATION share/trinity/sql) +if( SQL ) + add_subdirectory(updates) + add_subdirectory(scripts) + add_subdirectory(base) + add_subdirectory(create) +endif( SQL ) |