[c12576] CMake: cleanup & strip trailing newline from

This commit is contained in:
DasBlub 2013-05-31 10:09:05 +01:00 committed by Antz
parent 4fa06e1c91
commit 1634ad38dc
2 changed files with 72 additions and 74 deletions

View file

@ -27,6 +27,39 @@ set(CMAKE_MODULE_PATH
${CMAKE_SOURCE_DIR}/cmake ${CMAKE_SOURCE_DIR}/cmake
) )
# define all options here
option(DEBUG "Debug mode" OFF)
option(TBB_USE_EXTERNAL "Use external TBB" OFF)
option(USE_STD_MALLOC "Use standard malloc instead of TBB" OFF)
option(ACE_USE_EXTERNAL "Use external ACE" OFF)
if(PCHSupport_FOUND AND WIN32) # TODO: why only enable it on windows by default?
option(PCH "Use precompiled headers" ON)
else()
option(PCH "Use precompiled headers" OFF)
endif()
# TODO: options that should be checked/created:
#option(CLI "With CLI" ON)
#option(RA "With Remote Access" OFF)
#option(SQL "Copy SQL files" OFF)
#option(TOOLS "Build tools" OFF)
# Output description of this script
message("")
message(
"This script builds the MaNGOS server.
Options that can be used in order to configure the process:
CMAKE_INSTALL_PREFIX Path where the server should be installed to
PCH Use precompiled headers
DEBUG Debug mode
TBB_USE_EXTERNAL Use external TBB
USE_STD_MALLOC Use standard malloc instead of TBB
ACE_USE_EXTERNAL Use external ACE
To set an option simply type -D<OPTION>=<VALUE> after 'cmake <srcs>'.
Also, you can specify the generator with -G. see 'cmake --help' for more details
For example: cmake .. -DDEBUG=1 -DCMAKE_INSTALL_PREFIX=/opt/mangos"
)
message("")
# Force out-of-source build # Force out-of-source build
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR message(FATAL_ERROR
@ -34,45 +67,21 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
) )
endif() endif()
# TODO: allow other compilers under windows in the future
if(WIN32 AND NOT MSVC) if(WIN32 AND NOT MSVC)
message(FATAL_ERROR message(FATAL_ERROR
"Under Windows other compiler than Microsoft Visual Studio are not supported." "Under Windows other compiler than Microsoft Visual Studio are not supported."
) )
endif() endif()
# TODO: remove this in the future! it has only been added to make the switch easier for end users
if(PREFIX)
message(FATAL_ERROR "The parameter PREFIX has been removed. Please re-run CMake and use CMAKE_INSTALL_PREFIX instead to define your installation location!")
endif()
# TODO: use MSVC_CXX_ARCHITECTURE_ID instead to identify platform on windows (not required on other systems)
# find platform: required to build 3rd party libraries w/o CMake files
find_package(Platform REQUIRED) find_package(Platform REQUIRED)
find_package(Git)
# VS100 uses MSBuild.exe instead of devenv.com, so force it to use devenv.com
if(WIN32 AND MSVC_VERSION MATCHES 1600)
find_package(VisualStudio2010)
endif()
# if(NOT PLATFORM MATCHES X86 AND NOT PLATFORM MATCHES X64)
# message(FATAL_ERROR
# "An unknown Architecture was selected. Only the values X86 and X64 for PLATFORM are supported."
# )
# endif()
# Output description of this script
message(
"\nThis script builds the MaNGOS server.
Options that can be used in order to configure the process:
CMAKE_INSTALL_PREFIX: Path where the server should be installed to
PCH: Use precompiled headers
DEBUG: Debug mode
To set an option simply type -D<OPTION>=<VALUE> after 'cmake <srcs>'.
For example: cmake .. -DDEBUG=1 -DCMAKE_INSTALL_PREFIX=/opt/mangos\n"
) # TODO: PLATFORM: Sets the architecture for compile (X86,X64)
# Override configuration-types - we don't use anything else than debug and release
if(CMAKE_CONFIGURATION_TYPES)
set(CMAKE_CONFIGURATION_TYPES Release Debug)
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING
"Reset the configurations to what we need"
FORCE)
endif()
# Find out what system we use to include the needed libs # Find out what system we use to include the needed libs
if(WIN32) if(WIN32)
if(PLATFORM MATCHES X86) # 32-bit if(PLATFORM MATCHES X86) # 32-bit
@ -82,31 +91,24 @@ if(WIN32)
endif() endif()
endif() endif()
option(DEBUG "Debug mode" 0) # find Git: used to get the revision number
# option(CLI "With CLI" 1) # Not used by MaNGOS so far find_package(Git)
# option(RA "With Remote Access" 0) # TODO: support remote access
option(TBB_USE_EXTERNAL "Use external TBB" 0)
option(USE_STD_MALLOC "Use standard malloc instead of TBB" 0)
option(ACE_USE_EXTERNAL "Use external ACE" 0)
# check if the platform supports precomiled headers
find_package(PCHSupport) find_package(PCHSupport)
# Add options for compile of mangos # TODO: remove this (refactor ACE & TBB CMake code)
if(PCHSupport_FOUND) # VS100 uses MSBuild.exe instead of devenv.com, so force it to use devenv.com
if(WIN32) if(WIN32 AND MSVC_VERSION MATCHES 1600)
option(PCH "Use precompiled headers" 1) find_package(VisualStudio2010)
else()
option(PCH "Use precompiled headers" 0)
endif()
endif() endif()
# FIXME: options that should be checked # Override configuration-types - we don't use anything else than debug and release
# option(SQL "Copy SQL files" 0) if(CMAKE_CONFIGURATION_TYPES)
# option(TOOLS "Build tools" 0) set(CMAKE_CONFIGURATION_TYPES Release Debug)
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING
# TODO: remove this in the future! it has only been added to make the switch easier for end users "Reset the configurations to what we need"
if(PREFIX) FORCE)
message(FATAL_ERROR "The parameter PREFIX has been removed. Please re-run CMake and use CMAKE_INSTALL_PREFIX instead to define your installation location!")
endif() endif()
set(BIN_DIR ${CMAKE_INSTALL_PREFIX}/bin) set(BIN_DIR ${CMAKE_INSTALL_PREFIX}/bin)
@ -164,7 +166,7 @@ if(NOT USE_STD_MALLOC)
endif() endif()
endif() endif()
# Win32 delifered packages # Win32 delivered packages
if(WIN32) if(WIN32)
set(MYSQL_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/dep/include/mysql) set(MYSQL_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/dep/include/mysql)
set(MYSQL_LIBRARY ${CMAKE_SOURCE_DIR}/dep/lib/${DEP_ARCH}_release/libmySQL.lib) set(MYSQL_LIBRARY ${CMAKE_SOURCE_DIR}/dep/lib/${DEP_ARCH}_release/libmySQL.lib)
@ -201,6 +203,7 @@ if(GIT_EXECUTABLE)
OUTPUT_VARIABLE GIT_REVISION OUTPUT_VARIABLE GIT_REVISION
RESULT_VARIABLE GIT_RESULT RESULT_VARIABLE GIT_RESULT
ERROR_QUIET ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
) )
if(GIT_RESULT) if(GIT_RESULT)
set(GIT_REVISION "Git repository not found") set(GIT_REVISION "Git repository not found")
@ -209,45 +212,42 @@ else()
set(GIT_REVISION "Git not found") set(GIT_REVISION "Git not found")
endif() endif()
message("") message(STATUS "MaNGOS-Core revision : ${GIT_REVISION}")
message("MaNGOS-Core revision : ${GIT_REVISION}") message(STATUS "Install server to : ${CMAKE_INSTALL_PREFIX}")
message("Install server to : ${CMAKE_INSTALL_PREFIX}")
message("")
# if(CLI) # if(CLI)
# message("Build with CLI : Yes (default)") # message(STATUS "Build with CLI : Yes (default)")
# add_definitions(-DENABLE_CLI) # add_definitions(-DENABLE_CLI)
# else() # else()
# message("Build with CLI : No") # message(STATUS "Build with CLI : No")
# endif() # endif()
# if(RA) # if(RA)
# message("* Build with RA : Yes") # message(STATUS "* Build with RA : Yes")
# add_definitions(-DENABLE_RA) # add_definitions(-DENABLE_RA)
# else(RA) # else(RA)
# message("* Build with RA : No (default)") # message(STATUS "* Build with RA : No (default)")
# endif(RA) # endif(RA)
if(PCH AND NOT PCHSupport_FOUND) if(PCH AND NOT PCHSupport_FOUND)
set(PCH 0 CACHE BOOL set(PCH 0 CACHE BOOL
"Use precompiled headers" "Use precompiled headers"
FORCE) FORCE)
message( message(WARNING "No PCH for your system possible but PCH was set to 1. Resetting it."
"No PCH for your system possible but PCH was set to 1. Resetting it."
) )
endif() endif()
if(PCH) if(PCH)
message("Use PCH : Yes") message(STATUS "Use PCH : Yes")
else() else()
message("Use PCH : No") message(STATUS "Use PCH : No")
endif() endif()
if(DEBUG) if(DEBUG)
message("Build in debug-mode : Yes") message(STATUS "Build in debug-mode : Yes")
set(CMAKE_BUILD_TYPE Debug) set(CMAKE_BUILD_TYPE Debug)
else() else()
set(CMAKE_BUILD_TYPE Release) set(CMAKE_BUILD_TYPE Release)
message("Build in debug-mode : No (default)") message(STATUS "Build in debug-mode : No (default)")
endif() endif()
# Handle debugmode compiles (this will require further work for proper WIN32-setups) # Handle debugmode compiles (this will require further work for proper WIN32-setups)
if(UNIX) if(UNIX)
@ -272,19 +272,17 @@ elseif(WIN32)
endif() endif()
# if(SQL) # if(SQL)
# message("Install SQL-files : Yes") # message(STATUS "Install SQL-files : Yes")
# else() # else()
# message("Install SQL-files : No (default)") # message(STATUS "Install SQL-files : No (default)")
# endif() # endif()
# if(TOOLS) # if(TOOLS)
# message("Build map/vmap tools : Yes") # message(STATUS "Build map/vmap tools : Yes")
# else() # else()
# message("Build map/vmap tools : No (default)") # message(STATUS "Build map/vmap tools : No (default)")
# endif() # endif()
message("")
# Some small tweaks for Visual Studio 7 and above. # Some small tweaks for Visual Studio 7 and above.
if(MSVC) if(MSVC)
# Mark 32 bit executables large address aware so they can use > 2GB address space # Mark 32 bit executables large address aware so they can use > 2GB address space

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "12575" #define REVISION_NR "12576"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__