feat(Cmake): Rewrite build and use inherited dependencies (#1652)

This commit is contained in:
Kargatum
2019-04-02 03:41:08 +07:00
committed by Francesco Borzì
parent 0f174eff01
commit eae9affec9
48 changed files with 6336 additions and 1178 deletions

View File

@@ -1,4 +1,4 @@
# Copyright (C) # Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL3 v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
# #
# This file is free software; as a special exception the author gives # This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without # unlimited permission to copy and/or distribute it, with or without
@@ -28,7 +28,9 @@ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH 1)
set(AC_PATH_ROOT "${CMAKE_SOURCE_DIR}") set(AC_PATH_ROOT "${CMAKE_SOURCE_DIR}")
# set macro-directory # set macro-directory
set(CMAKE_MODULE_PATH "${AC_PATH_ROOT}/src/cmake/macros") list(APPEND CMAKE_MODULE_PATH
"${CMAKE_SOURCE_DIR}/src/cmake/macros"
"${CMAKE_SOURCE_DIR}/deps/cotire/CMake")
include(CheckCXXSourceRuns) include(CheckCXXSourceRuns)
include(CheckIncludeFiles) include(CheckIncludeFiles)
@@ -82,26 +84,17 @@ endif()
include(CheckPlatform) include(CheckPlatform)
include(GroupSources) include(GroupSources)
include(AutoCollect)
# basic packagesearching and setup (further support will be needed, this is a preliminary release!) # basic packagesearching and setup (further support will be needed, this is a preliminary release!)
set(OPENSSL_EXPECTED_VERSION 1.0.0)
set(ACE_EXPECTED_VERSION 6.0.3) set(ACE_EXPECTED_VERSION 6.0.3)
find_package(PCHSupport) find_package(PCHSupport)
find_package(ACE REQUIRED) find_package(ACE REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(Threads REQUIRED)
find_package(MySQL REQUIRED) find_package(MySQL REQUIRED)
if( UNIX ) if(UNIX AND WITH_PERFTOOLS)
find_package(Readline) find_package(Gperftools)
find_package(ZLIB)
find_package(BZip2)
if ( WITH_PERFTOOLS )
find_package(Gperftools)
endif()
endif() endif()
if(NOT WITHOUT_GIT) if(NOT WITHOUT_GIT)
@@ -114,7 +107,6 @@ include(src/cmake/genrev.cmake)
# print out the results before continuing # print out the results before continuing
include(src/cmake/showoptions.cmake) include(src/cmake/showoptions.cmake)
# #
# Loading framework # Loading framework
# #
@@ -129,7 +121,6 @@ if( TOOLS )
add_subdirectory(src/tools) add_subdirectory(src/tools)
endif() endif()
# #
# Loading application sources # Loading application sources
# #

34
deps/CMakeLists.txt vendored
View File

@@ -1,4 +1,4 @@
# Copyright (C) # Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL3 v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
# #
# This file is free software; as a special exception the author gives # This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without # unlimited permission to copy and/or distribute it, with or without
@@ -16,34 +16,32 @@ else()
add_definitions(-w) add_definitions(-w)
endif() endif()
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
if(SERVERS AND NOT NOJEM)
add_subdirectory(jemalloc)
endif()
if(TOOLS)
add_subdirectory(bzip2)
endif()
add_subdirectory(zlib)
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Windows") if(CMAKE_SYSTEM_NAME MATCHES "Windows")
add_subdirectory(acelite)
if(USE_MYSQL_SOURCES) if(USE_MYSQL_SOURCES)
add_subdirectory(mysqllite) add_subdirectory(mysqllite)
endif() endif()
if(TOOLS)
add_subdirectory(bzip2)
endif()
add_subdirectory(zlib)
endif() endif()
add_subdirectory(g3dlite) add_subdirectory(threads)
add_subdirectory(recastnavigation) add_subdirectory(acelite)
if(SERVERS OR TOOLS)
add_subdirectory(zlib)
add_subdirectory(g3dlite)
add_subdirectory(recastnavigation)
add_subdirectory(SFMT)
add_subdirectory(utf8cpp)
add_subdirectory(openssl)
endif()
if(SERVERS) if(SERVERS)
add_subdirectory(mysql)
add_subdirectory(readline)
add_subdirectory(jemalloc)
add_subdirectory(gsoap) add_subdirectory(gsoap)
endif() endif()
if(TOOLS) if(TOOLS)
add_subdirectory(bzip2)
add_subdirectory(libmpq) add_subdirectory(libmpq)
endif() endif()

14
deps/PackageList.txt vendored
View File

@@ -8,6 +8,10 @@ bzip2 (a freely available, patent free, high-quality data compressor)
http://www.bzip.org/ http://www.bzip.org/
Version: 1.0.6 Version: 1.0.6
cotire (CMake module to speed up builds)
https://github.com/sakra/cotire
Version: 1.8.0 391bf6b7609e14f5976bd5247b68d63cbf8d4d12
G3D (a commercial-grade C++ 3D engine available as Open Source (BSD License) G3D (a commercial-grade C++ 3D engine available as Open Source (BSD License)
http://g3d.sourceforge.net/ http://g3d.sourceforge.net/
Version: 8.01-Release Version: 8.01-Release
@@ -15,11 +19,19 @@ G3D (a commercial-grade C++ 3D engine available as Open Source (BSD License)
jemalloc (a general-purpose scalable concurrent malloc-implementation) jemalloc (a general-purpose scalable concurrent malloc-implementation)
http://www.canonware.com/jemalloc/ http://www.canonware.com/jemalloc/
Version: 5.0.1 Version: 5.0.1
libMPQ (a library for reading MPQ files) libMPQ (a library for reading MPQ files)
https://libmpq.org/ https://libmpq.org/
Version: 1.0.4 Version: 1.0.4
libreadline (command line editing library)
https://cnswww.cns.cwru.edu/php/chet/readline/rltop.html
Version: external
OpenSSL (general-purpose cryptography library)
https://www.openssl.org/
Version: external
MySQL (the world's most popular open source database software) MySQL (the world's most popular open source database software)
http://www.mysql.com/ http://www.mysql.com/
Version: 5.5.9 (GA) Version: 5.5.9 (GA)

19
deps/SFMT/CMakeLists.txt vendored Normal file
View File

@@ -0,0 +1,19 @@
# Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
# Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL3 v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
#
# 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.
add_library(sfmt INTERFACE)
# Group sources
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(sfmt
INTERFACE
${CMAKE_CURRENT_SOURCE_DIR})

View File

@@ -1,4 +1,4 @@
# Copyright (C) # Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL3 v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
# #
# This file is free software; as a special exception the author gives # This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without # unlimited permission to copy and/or distribute it, with or without
@@ -8,4 +8,15 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
add_subdirectory(ace) if(CMAKE_SYSTEM_NAME MATCHES "Windows")
add_subdirectory(ace)
else()
add_library(ace SHARED IMPORTED GLOBAL)
set_target_properties(ace
PROPERTIES
IMPORTED_LOCATION
"${ACE_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES
"${ACE_INCLUDE_DIR}")
endif()

View File

@@ -323,33 +323,34 @@ set(ace_STAT_SRCS
) )
if (USE_COREPCH) if (USE_COREPCH)
set(ace_PCH_HDR PrecompiledHeaders/WinAcePCH.h) set(PRIVATE_PCH_HEADER PrecompiledHeaders/WinAcePCH.h)
set(ace_PCH_SRC PrecompiledHeaders/WinAcePCH.cpp)
endif() endif()
include_directories( # Group sources
${CMAKE_SOURCE_DIR}/deps/acelite GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders
${CMAKE_SOURCE_DIR}/deps/zlib add_library(ace SHARED
${ace_STAT_SRCS}
) )
target_include_directories(ace
PUBLIC
${CMAKE_SOURCE_DIR}/deps/acelite
PRIVATE
${CMAKE_SOURCE_DIR}/deps/zlib)
# Needed for PCH support # Needed for PCH support
set_source_files_properties(Atomic_Op_Sparc.c Rtems_init.c PROPERTIES LANGUAGE CXX) set_source_files_properties(Atomic_Op_Sparc.c Rtems_init.c PROPERTIES LANGUAGE CXX)
add_definitions(-DACE_BUILD_DLL) add_definitions(-DACE_BUILD_DLL)
add_library(ace SHARED
${ace_STAT_SRCS}
${ace_PCH_SRC}
)
if (MINGW) # GCC ignores "#prama comment" if (MINGW) # GCC ignores "#prama comment"
target_link_libraries(ace ws2_32 iphlpapi netapi32 mswsock) target_link_libraries(ace ws2_32 iphlpapi netapi32 mswsock)
endif() endif()
# Generate precompiled header # Generate precompiled header
if( USE_COREPCH ) if(USE_COREPCH)
add_cxx_pch(ace ${ace_PCH_HDR} ${ace_PCH_SRC}) add_cxx_pch(ace ${PRIVATE_PCH_HEADER})
endif() endif()
install(TARGETS ace RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}") install(TARGETS ace RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}")

View File

@@ -1,3 +0,0 @@
#include "WinAcePCH.h"

View File

@@ -1,4 +1,4 @@
# Copyright (C) # Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL3 v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
# #
# This file is free software; as a special exception the author gives # This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without # unlimited permission to copy and/or distribute it, with or without
@@ -8,15 +8,33 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
file(GLOB sources *.c) if(UNIX)
# Look for an installed bzip2 on unix
find_package(BZip2 REQUIRED)
set(bzip2_STAT_SRCS add_library(bzip2 SHARED IMPORTED GLOBAL)
${sources}
)
include_directories( set_target_properties(bzip2
${CMAKE_SOURCE_DIR}/deps/zlib PROPERTIES
${CMAKE_CURRENT_SOURCE_DIR} IMPORTED_LOCATION
) "${BZIP2_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES
"${BZIP2_INCLUDE_DIRS}")
else()
# Use the bundled source on windows
file(GLOB sources *.c)
add_library(bzip2 STATIC
${sources})
add_library(bzip2 STATIC ${bzip2_STAT_SRCS}) # Group sources
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(bzip2
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR})
set_target_properties(bzip2
PROPERTIES
FOLDER
"deps")
endif()

4190
deps/cotire/CMake/cotire.cmake vendored Normal file

File diff suppressed because it is too large Load Diff

354
deps/cotire/HISTORY.md vendored Normal file
View File

@@ -0,0 +1,354 @@
## 1.8.0 (2018-03-18)
* support for clang-cl.exe under Windows.
* faster prefix header generation for Clang.
* enable parallel compilation of unity target for MSVC.
* CMake 3.9 and 3.10 compatibility fixes.
* disable inclusion of timestamp in precompiled headers for Clang.
* work around ccache reporting incorrect configuration.
* honor `MANUALLY_ADDED_DEPENDENCIES` property upon generation of unity targets.
* use default setting of 2 for `COTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES`.
* drop broken support for unity building of targets with automatic CMake Qt processing turned on.
* manual updates.
## 1.7.10 (2017-06-16)
* CMake 3.8 compatibility.
* CMake 3.8.0 Qt automoc support (thanks bilke).
* fix Xcode recompiling every time builds happen (thanks gcamp).
* disable PCH messages when `-Wno-pch-messages` flag exists (thanks kbinani).
* work around ccache incompatibility with newer versions of GCC and Clang.
* fix MinGW incompatibility with `BUILD_INTERFACE` generator expression.
* fix handling of `CMAKE_INCLUDE_FLAG_SEP_<LANG>` variables.
## 1.7.9 (2016-12-08)
* CMake 3.6 and 3.7 compatibility.
* fix ccache 3.2 compatibility issues.
* fix bugs with handling language standard related properties (e.g., `CXX_STANDARD`, `CXX_EXTENSIONS`).
* make prefix header generation and precompiled header compilation depend on the compiler executable.
* fix Qt automoc handling for Windows (thanks jcelerier).
* convert Windows paths in include directories to CMake paths (thanks wdx04).
* replace object library with corresponding unity object library when using `COPY_UNITY` linking strategy.
* better error reporting from prefix header generation.
## 1.7.8 (2016-03-27)
* fix `COPY_UNITY` linking strategy for private link dependencies.
* honor `CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE` upon handling of target usage requirements.
* reworked setting up of `LINK_LIBRARIES` and `INTERFACE_LINK_LIBRARIES` properties for unity targets.
## 1.7.7 (2016-03-20)
* CMake 3.5 compatibility.
* fix bugs related to handling of interface libraries.
* output shorter log messages when using Visual Studio IDE.
* don't disable PCH if CMAKE_<LANG>_COMPILER_ID is not set (thanks jcelerier).
* add support for compiler launchers introduced in CMake 3.4 (thanks misery).
## 1.7.6 (2015-12-06)
* fix CMake 3.4 compatibility issues.
* prevent redundant re-generation of prefix header when a target has generated source files.
## 1.7.5 (2015-10-27)
* handle visibility target properties (`CXX_VISIBILITY_PRESET` and `VISIBILITY_INLINES_HIDDEN`).
* better handling of include directories and system include directories.
* parse additional system include directories from target compile flags.
* activate select CMake policies.
## 1.7.4 (2015-10-10)
* set up single unity source file for prefix header generation.
* increase MSVC default PCH memory to 128M.
* remove obsolete code.
## 1.7.3 (2015-07-25)
* handle language standard target properties (e.g., `CXX_STANDARD`).
* apply user provided prefix header to unity build target.
* remove effect of `COTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES` on generated unity target.
* manual updates.
## 1.7.2 (2015-04-22)
* reduce configure time overhead.
* fix bug with dependency checking when using Xcode.
* remove obsolete code required for CMake versions older than 2.8.12.
* streamline debugging output.
## 1.7.1 (2015-04-06)
* fix problem with CMake's automatic Qt processing for generated unity targets.
* added a section on common pitfalls when using cotire to the manual.
* remove obsolete code required for CMake versions older than 2.8.12.
* streamline debugging output.
* activate select CMake policies.
## 1.7.0 (2015-03-29)
* fix CMake 3.2 compatibility issues.
* cotire now requires CMake 2.8.12 or newer.
* copy `IMPORT_PREFIX` and `IMPORT_SUFFIX` target properties for unity targets (thanks peterhuene).
* new property `COTIRE_PREFIX_HEADER_INCLUDE_PRIORITY_PATH` allows for organizing includes
added to the prefix header by priority (thanks ArnaudD-FR).
* for Visual Studio C++, increase static precompiled header memory allocation.
* the default strategy for setting up a unity target's linked libraries is now `COPY_UNITY`.
* for Qt projects, fix problem with handling of `AUTOMOC` in generated unity target.
* fix problem with generating the cotire intermediate directory.
* documentation updates.
## 1.6.9 (2015-01-18)
* fix bug with parsing of localized MSVC `/showIncludes` output.
## 1.6.8 (2014-12-28)
* fix bug with generation of unity source file segments for parallel builds.
## 1.6.7 (2014-12-21)
* fix CMake 3.1 compatibility issues.
* fix ccache 3.2 compatibility issues.
* handle `COTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES` correctly for mixed-language targets.
* correctly compute absolute paths of generated source files added to the unity source file.
* fix bug with checking unity source and prefix header dependencies under Xcode.
* fix bug with handling of unity source file dependencies.
* move code to determine build configurations to function of its own.
* documentation updates.
## 1.6.6 (2014-09-21)
* fix GCC issue with prefix header generation when source files are missing.
* fix bug where some target properties were not properly propagated to the generated unity target.
* use `target_link_libraries` to set up the unity target link libraries.
* add Qt4 and Qt5 examples to the `Patches` directory.
* documentation updates.
## 1.6.5 (2014-08-26)
* correctly handle generator expressions used in compile definitions, compile flags and include
directories (requires CMake 2.8.12 or newer).
* fix `-isystem` includes being incorrectly passed to `execute_process` (thanks nickhutchinson).
* make some error messages more verbose.
## 1.6.4 (2014-07-14)
* fix CMake 3.0 compatibility issues.
* preserve system flag for includes when generating PCH (thanks gjasny).
* fix bug with setting up `EXPORTS` symbol for shared libraries.
## 1.6.3 (2014-06-11)
* correctly handle usage requirements for transitive link targets.
* use indirect inclusion for prefix header when using generator Xcode.
## 1.6.2 (2014-06-09)
* don't use `-w` flag for pre-compiling the prefix header, because it has unwanted side effects.
* correctly handle linked targets' `INTERFACE_COMPILE_OPTIONS`, `INTERFACE_INCLUDE_DIRECTORIES`
and `INTERFACE_COMPILE_DEFINITIONS` properties upon pre-compiling and prefix header generation.
* For Clang and GCC, pre-compile prefix header through indirect inclusion via a prefix source file,
to make both compilers honor the `system_header` pragma in the prefix header correctly.
* fix ccache incompatibility.
## 1.6.1 (2014-04-20)
* fixed bug where precompiled headers did not work with Clang (thanks to nh2 for reporting).
* when using ccache, require that environment variable `CCACHE_SLOPPINESS` is set to `time_macros`.
## 1.6.0 (2014-03-16)
* suppress compiler warnings from precompiled headers.
* fix Clang compatibility issue with prefix header generation.
* use file extension `.pch` for precompiled headers generated with Clang.
* manual updates.
## 1.5.2 (2014-01-17)
* honor framework includes under OS X correctly.
* fix handling of OS X specific variables `CMAKE_OSX_SYSROOT` and `CMAKE_OSX_DEPLOYMENT_TARGET`.
* add new examples to the `Patches` directory.
## 1.5.1 (2013-11-12)
* fixed string quoting bugs.
## 1.5.0 (2013-10-13)
* CMake 2.8.12 compatibility fixes.
* Upon generation of a unity target, cotire can now be configured to automatically copy all the
linked libraries and targets from the original target. See the section on the new target property
`COTIRE_UNITY_LINK_LIBRARIES_INIT` in the cotire manual.
* fixed bug with copying target properties to generated unity target.
* cotire manual updates.
* add new examples to the `Patches` directory.
* fix typos.
## 1.4.3 (2013-09-28)
* fixed bug with generation of unity source file when `COTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES` is
set to 0.
## 1.4.2 (2013-08-24)
* CMake 2.8.11 compatibility fixes.
* always force the inclusion of a user provided prefix header, even if the target
contains too few sources to enable the use of a precompiled header.
## 1.4.1 (2013-06-08)
* fixed bug with determination of compiler version.
* fixed bug with generation of unity source when target source files are used for multiple targets.
* fixed bug with multi-core optimized prefix header generation.
## 1.4.0 (2013-03-11)
* one year anniversary release.
* add support for multi-core optimized unity builds for some CMake generators.
* add support for multi-core optimized prefix header generation.
* add more examples to cotire manual.
## 1.3.6 (2013-03-06)
* fix bug with prefix header initialization for generator Xcode.
* print cotire version upon inclusion.
## 1.3.5 (2013-03-01)
* fix typos in function names and property descriptions.
## 1.3.4 (2013-02-07)
* fixed bug with computing to output directory of the generated unity target (thanks shaunew).
* fixed wrong variable reference in debugging output (thanks shaunew).
## 1.3.3 (2013-02-03)
* fixed bug with handling of policy CMP0018 relating to target property `POSITION_INDEPENDENT_CODE`.
* fixed warnings relating to uninitialized variables.
* Intel XE 2013 Update 2 compatibility fixes.
## 1.3.2 (2013-02-02)
* fixed missing curly brace (thanks shaunew).
## 1.3.1 (2013-01-29)
* fix bug with filtering of compile options.
## 1.3.0 (2013-01-09)
* add support for Intel C and C++ compilers.
* CMake 2.8.10 compatibility fixes.
* properly clean up generated cotire log files upon invoking `clean` target.
* documentation updates.
## 1.2.0 (2012-11-01)
* add support for manually maintained prefix header and unity source files.
* the target property `COTIRE_<LANG>_PREFIX_HEADER_INIT` can be set to a user provided prefix
header file to be used instead of the automatically generated one (e.g., `stdafx.h`).
* the new target property `COTIRE_<LANG>_UNITY_SOURCE_INIT` can be set to a user provided unity
source file to be used instead of the automatically generated one.
* the target property `COTIRE_UNITY_TARGET_NAME` is no longer read-only. It can be set to the
desired name of the unity target that will be added by cotire.
* add parameters `SOURCE_DIR` and `BINARY_DIR` to function `cotire` to allow for explicitly
specifying a target's source and binary directory, if target to be cotired has been added in a
different directory.
## 1.1.8 (2012-10-27)
* when using MSVC, apply option `/bigobj` to compilation of generated unity files.
## 1.1.7 (2012-10-26)
* cope with double slash characters in scanned include paths.
## 1.1.6 (2012-09-22)
* check result code upon scanning includes.
* always add a `clean_cotire` target to easily clean up cotire generated files.
* add section on `extern "C"` linkage issues to manual.
## 1.1.5 (2012-08-17)
* new cache variable `COTIRE_UNITY_SOURCE_EXCLUDE_EXTENSIONS` can be set to globally exclude
sources with the listed file extensions from the generated unity source.
* fix check for multi-architecture builds under OS X.
## 1.1.4 (2012-08-15)
* prevent redundant re-generation of the unity source, prefix header and precompiled header files
(this makes cotire more applicable to C++ projects that use Qt).
## 1.1.3 (2012-08-12)
* fix out of range index operation upon building list of target include directories.
* honor target properties `POSITION_INDEPENDENT_CODE` and `NO_SONAME` introduced with CMake 2.8.9.
* make selection of target source files for requested target language more careful.
* prevent modification of the CMake policy stack upon CMake version check.
## 1.1.2 (2012-05-06)
* make handling of include directories more robust against invalid paths.
## 1.1.1 (2012-04-20)
* fixed bug with generation of unity targets for `WIN32_EXECUTABLE` targets.
* fixed bug with parsing of localized MSVC `/showIncludes` output.
## 1.1.0 (2012-04-19)
* tested with CMake 2.8.8.
* added example to manual that shows how to apply cotire to CMake object library targets.
* fixed multiple bugs with handling of CMake single build type and multiple configuration builds.
* added more robust parsing of localized MSVC `/showIncludes` output.
## 1.0.9 (2012-04-09)
* add support for compiler wrappers like ccache.
* under OS X, apply `CMAKE_OSX_SYSROOT` to prefix header include and ignore paths.
## 1.0.8 (2012-04-05)
* require CMake 2.8.6 since we are using `set_property` option `APPEND_STRING`.
## 1.0.7 (2012-04-02)
* add support for Ninja generator introduced in CMake 2.8.8.
* fix bug with initialization of variable `COTIRE_VERBOSE`.
## 1.0.6 (2012-04-01)
* correctly handle builds where both `CMAKE_BUILD_TYPE` and `CMAKE_CONFIGURATION_TYPES` are set.
## 1.0.5 (2012-03-26)
* fix Visual Studio C++ 2010 compilation of example project.
* enhance heuristic for #include_next directive detection.
* fix llvm-3.0.src.patch for GCC 4.6 compilation.
## 1.0.4 (2012-03-24)
* honor target property INCLUDE_DIRECTORIES introduced in CMake 2.8.8.
## 1.0.3 (2012-03-23)
* handle OBJECT_LIBRARY targets introduced in CMake 2.8.8.
* use predefined compiler version variable, if available.
## 1.0.2 (2012-03-16)
* fix Xcode 4.3 compatibility.
* Cotire manual corrections.
## 1.0.1 (2012-03-15)
* Cotire manual corrections.
* Add prefix header to the generated unity build target.
## 1.0.0 (2012-03-11)
* First release.

791
deps/cotire/MANUAL.md vendored Normal file
View File

@@ -0,0 +1,791 @@
cotire manual
=============
Cotire (compile time reducer) is a CMake module that speeds up the build process of CMake based
build systems by fully automating techniques as [precompiled header][pch] usage and
[single compilation unit][scu] builds for C and C++.
motivation
----------
Cotire was born out of a dissatisfaction with the existing CMake solutions for adding
[precompiled header][1260] support and unity build support to CMake based build systems.
The design of cotire tries to adhere to the following principles:
#### as automatic as possible
[Precompiled header][pch] and [unity builds][scu] are good ideas in principle, but in reality
they do not work if the burden of maintaining the required additional source files (a
[prefix header][pfh] and a unity source file) is put on the developer. A modern build system
like CMake provides enough context information to have the build system generate and update
these files automatically.
#### non-intrusive
The configuration of precompiled headers usage and single computation unit builds belongs to the
build system and not in the source code. Nobody wants to litter one's source files with `hdrstop`
pragmas or be forced to add an include directive to every file. Source code should build properly
when a precompiled header isn't used and should build faster when a precompiled header is used.
#### minimal interface
Maintaining a build system over time is enough work and the CMake language may often get in your
way. Thus the solution should only add few public CMake functions. It should be easy to integrate
it into an existing CMake based build system and it should be just as easy to remove it again.
#### lazy file creation
The additional source files needed for precompiled header support and unity build support should
only be created when they are required for the compilation of a target. Thus the solution should
not create these files upon configuring the project, but should set up custom build commands for
the creation of these files that only kick in when the files are required to exist by the build
process.
#### cross-platform
C/C++ Compilers and IDEs on different platforms vary widely in how the implement precompiled
header support. The solution should hide these implementation details and present a uniform
interface to the developer on all supported platforms.
cotire basic usage
------------------
Cotire consists of a single CMake module file, which can be easily added to an existing CMake
project.
The file `CMake/cotire.cmake` needs to be copied to the module directory of a CMake project. In the
top-level `CMakeList.txt` file, the module directory needs to be added to the CMake module search
path:
set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake")
To use cotire in a CMake project, one adds the following include directive to the beginning of the
top-level `CMakeList.txt`:
include(cotire)
To speed the build process of a CMake library or executable target, the `cotire` function is
applied to a CMake target. From the example project that ships with cotire:
add_executable(example main.cpp example.cpp log.cpp log.h example.h)
...
cotire(example)
Cotire looks at the properties of the target provided by CMake (e.g., target type, source files,
compile flags, preprocessor defines, include directories, ...) and modifies the target's build
process in the following way:
1. cotire adds a custom build rule to produce a unity source file from the target's sources.
2. cotire adds a custom build rule to produce a prefix header file by tracking the header files
included by the target's sources.
3. cotire adds a custom build rule to produce a precompiled header from the prefix header.
4. cotire modifies the target's compile flags to make use of the generated precompiled header.
5. cotire adds a couple of new targets.
For makefile based build systems, running `make help` in the terminal reveals the new targets:
$ make help
...
... all_pch
... all_unity
... clean_cotire
... example
... example_pch
... example_unity
The `example_pch` target triggers the compilation of the precompiled header and as a side effect
the generation of the unity source and the prefix header. The target `clean_cotire` cleans up all
files generated by cotire. The `example_unity` target produces the same output as the original
`example` target, but does so by performing a unity build. The `all_pch` and `all_unity` serve as
pool targets for all cotired project targets.
By default, the `example_unity` target inherits all build settings from the original target
`example` including linked libraries and target dependencies.
cotire generated files
----------------------
For a target that has been cotired, three files will be generated as part of the build process:
### the unity source
The unity source file is generated from the target by querying the target's `SOURCES` property.
It consists of preprocessor include directives for each of the target source files. The files
are included in the same order that is used in the CMake `add_executable` or `add_library` call.
Header files are omitted.
This is a unity source generated for the example project under OS X:
#ifdef __cplusplus
#include "/Users/sakra/Documents/cotire/src/main.cpp"
#include "/Users/sakra/Documents/cotire/src/example.cpp"
#include "/Users/sakra/Documents/cotire/src/log.cpp"
#endif
The unity source file uses absolute paths to include the target's source file. The file is not
intended to be portable across different build folders or machines. It is an intermediate file
tied to the build folder that is automatically recreated by the build system if it is missing.
For multi-core machines cotire can be configured to generate multiple unity file segments that
can be built in parallel by the chosen CMake generator (see below).
### the prefix header
The prefix header is produced from the unity source file by running the unity file through the
preprocessor and keeping track of each header file used (this is done by using option `-H` with
GCC / Clang and `/showIncludes` with Visual Studio C++). The path of each used header file is
compared against an exclude directory list and an include directory list to decide if the header
file should be added to the prefix header.
By default the include directory list is empty and the exclude directory list is initialized to
`"${CMAKE_SOURCE_DIR};${CMAKE_BINARY_DIR}"`. This default setting guarantees that project headers
which are likely to be changed frequently are not added to the prefix header.
Upon generation of the prefix header cotire makes sure that target compile options, include path
settings and preprocessor defines (e.g., `NDEBUG`) that affect the outcome of the preprocessor
are correctly set up.
Generating the prefix header from the unity source is much faster than running each individual
target source file through the preprocessor, because the coalesced unity source will make the
preprocessor process most header files only once.
This is a prefix header produced for the example project with Visual Studio 2013 under Windows 7:
#pragma warning(push, 0)
#ifdef __cplusplus
#include "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\string"
#include "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\algorithm"
#include "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\iostream"
#endif
#pragma warning(pop)
Generating the prefix file under Ubuntu 12.04 with GCC 4.6 yields the following result:
#pragma GCC system_header
#ifdef __cplusplus
#include "/usr/include/c++/4.6/string"
#include "/usr/include/c++/4.6/algorithm"
#include "/usr/include/c++/4.6/iterator"
#include "/usr/include/c++/4.6/iostream"
#endif
Using Xcode 5.1 under OS X 10.9, this is the resulting prefix header:
#pragma clang system_header
#ifdef __cplusplus
#include "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/string"
#include "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/iostream"
#endif
Besides include directives, cotire also adds compiler specific pragmas to the generated prefix
header to suppress compiler warnings upon inclusion.
Cotire attempts to produce a minimal list of header files by omitting header files indirectly
included by a header that is already part of the prefix header. Header files with nonstandard
file extensions like `.inl`, `.inc` of `.ipp` are omitted by default.
The generated prefix file includes the selected header files by their absolute paths. This speeds
up the precompiling of the prefix header because the compiler does not have to search for header
files in include directories again.
The prefix header is tailored to the CMake target that it is generated for. It is tied to the
compiler environment of the local machine and is not portable across different compilers or
machines. It is automatically recreated by the build system if it goes missing.
The generated prefix header can be applied to a different target added in the same source directory
(see below).
Optionally, cotire will also create a prefix source file that consists of a single include directive
for the prefix header. This file is needed for pre-compiling the prefix header with Clang or GCC
to make both compilers handle the `system_header` pragma correctly.
### the precompiled header
The precompiled header is produced from the generated prefix header by using the proprietary
precompiling mechanism depending on the compiler used. For GCC and Clang cotire sets up a custom
build rule and generates the precompiled header as described in the documentation for
[GCC][gcc_pch] and [Clang][clang_pch]. Cotire then modifies the `COMPILE_FLAGS` property of the
target to force the inclusion of the prefix header.
Visual Studio C++ and Intel C++ use a [different approach][msvc_pch] to pre-compiling. Both
compilers require a host source file to generate the precompiled header as a side effect of
producing an object file. Cotire modifies the `COMPILE_FLAGS` of the first target source file to
[generate][msvc_pch_create] the precompiled header and then modifies the `COMPILE_FLAGS` of the
remaining target source files to [include][msvc_pch_use] the generated precompiled header.
For Xcode projects generated with CMake, cotire completely hands off the pre-compilation of
the prefix header and the inclusion of the precompiled header to the IDE. Cotire attaches a
pre-build action to the target which generates the unity source file and the prefix header.
Cotire then modifies Xcode attributes of the generated Xcode project to have Xcode precompile the
the generated prefix header with the Xcode build steps `ProcessPCH` for C sources and
`ProcessPCH++` for C++ sources.
For precompiled headers creation flags must match use flags exactly. Cotire uses the same flags,
include directories and preprocessor defines that are used for the compilation of source files
for the generation of the precompiled header. Thus the resulting precompiled header binary is only
usable for the target and cannot be re-used for a different CMake target.
cotire advanced usage
---------------------
### applying cotire to multiple targets at the same time
The `cotire` function can be applied to multiple targets added in the same source directory in one
call:
add_library(libA STATIC ...)
add_library(libB SHARED ...)
add_executable(example ...)
...
cotire(example libA libB)
### mixed-language targets
Cotire is able to speed up the build process of mixed language targets, consisting of both C and
C++ sources. It generates a separate set of unity source files, prefix headers and precompiled
headers for both languages and modifies the `COMPILE_FLAGS` of each target source file to include
the correct precompiled header depending on the compilation language of the source file.
### obtaining the names of the generated files and targets
For a cotired target the target properties `COTIRE_<LANG>_UNITY_SOURCE`,
`COTIRE_<LANG>_PREFIX_HEADER`, `COTIRE_<LANG>_PRECOMPILED_HEADER` will be set to the paths of the
generated files (`<LANG>` can be set to `CXX` or `C`). The target property
`COTIRE_UNITY_TARGET_NAME` will be set to the name of the generated unity target:
cotire(example)
...
get_target_property(_unitySource example COTIRE_CXX_UNITY_SOURCE)
get_target_property(_prefixHeader example COTIRE_CXX_PREFIX_HEADER)
get_target_property(_precompiledHeader example COTIRE_CXX_PRECOMPILED_HEADER)
get_target_property(_unityTargetName example COTIRE_UNITY_TARGET_NAME)
If a source file's `COMPILE_FLAGS` are modified by cotire, it sets the source file property
`COTIRE_TARGET` to the name of the target, that the source file's build command has been
altered for:
cotire(example)
...
get_source_file_property(_cotireTargetName "example.cpp" COTIRE_TARGET)
if (_cotireTargetName)
message(STATUS "example.cpp has been cotired for target ${_cotireTargetName}")
endif()
### changing the name of the generated unity build target
By default cotire uses the name of the the original target with the suffix `_unity` appended
for the name of the generated unity build target. To create the unity build target under a
different name, set the `COTIRE_UNITY_TARGET_NAME` property:
add_executable(example_template main.cpp example.cpp log.cpp log.h example.h)
set_target_properties(example_template PROPERTIES COTIRE_UNITY_TARGET_NAME "example")
...
cotire(example_template)
Invoking the `example` target will then run the unity build.
### restricting cotire to certain build configurations
To restrict the cotire related modifications to the build process to certain build configurations,
the `CONFIGURATIONS` parameter can be added to the `cotire` call.
cotire(example CONFIGURATIONS Release MinSizeRel)
For single build type builds the selected configuration will be checked at configure time, for
multi-configuration builds the check will be done at build time.
It is recommended to have at least one build configuration that does not make use of cotire to
ensure that the project builds properly without cotire.
### disabling precompiled headers and unity builds
If the target's build process should not be modified to make use of the generated precompiled
header, the target property `COTIRE_ENABLE_PRECOMPILED_HEADER` can be set to `FALSE`:
set_target_properties(example PROPERTIES COTIRE_ENABLE_PRECOMPILED_HEADER FALSE)
cotire(example)
If a unity build target should not be added by cotire, the target property
`COTIRE_ADD_UNITY_BUILD` can be set to `FALSE`:
set_target_properties(example PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
cotire(example)
The property `COTIRE_ADD_UNITY_BUILD` only affects the addition of the unity build target. Custom
build rules for the generation of the unity source file will always be set up, because the
unity source file is needed for the generation of the prefix header.
Both properties default to `TRUE`. If both are set to `FALSE`, cotire will only set up custom build
rules for the generation of the unity source and the prefix header.
The properties `COTIRE_ENABLE_PRECOMPILED_HEADER` and `COTIRE_ADD_UNITY_BUILD` can also be set on
directories. A target inherits the property value from its enclosing directory.
### disabling precompiled headers for small targets
The cache variable `COTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES` can be set to the minimum number of
source files required to enable the use of a precompiled header. It defaults to 2. To override the
default, run `cmake` with the following options:
$ cmake -D COTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES=5 <path-to-source>
### using a manually maintained prefix header instead of the automatically generated one
cotire can be configured to use an existing manually maintained prefix header (e.g., Visual Studio
projects often use a prefix header named `stdafx.h`) instead of the automatically generated one.
Set the target property `COTIRE_CXX_PREFIX_HEADER_INIT` to the path of the existing prefix header
file. The path is interpreted relative to the target source directory:
set_target_properties(example PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT "stdafx.h")
cotire(example)
If the prefix header `stdafx.h` needs an accompanying source file (e.g., `stdafx.cpp`) in order
to be precompiled properly, that source file needs to be the first one on the list of source
files in the target's `add_executable` or `add_library` call.
The property `COTIRE_CXX_PREFIX_HEADER_INIT` can also be set to a list of header files which will
then make up the contents of the generated prefix header.
A manually maintained prefix header will always be applied to the corresponding target,
even if the target contains too few sources to enable the use of a precompiled header.
### using a generated prefix header for multiple targets
A prefix header that is generated for a cotired target can be applied to a different target
added in the same source directory:
cotire(example)
get_target_property(_prefixHeader example COTIRE_CXX_PREFIX_HEADER)
...
set_target_properties(other_target PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT "${_prefixHeader}")
cotire(other_target)
The compilation of either target will trigger the generation of the prefix header.
### configuring the generation of the prefix header
There are multiple target properties which affect the generation of the prefix header:
* `COTIRE_PREFIX_HEADER_IGNORE_PATH` can be set to a semicolon separated list of directories. If a
header file is found in one of these directories or sub-directories, it will be excluded from the
generated prefix header.
* `COTIRE_PREFIX_HEADER_INCLUDE_PATH` can be set to a semicolon separated list of directories. If
a header file is included from one of these directories or sub-directories, it will be included
in the generated prefix header.
If a header file is matched by both `COTIRE_PREFIX_HEADER_IGNORE_PATH` and
`COTIRE_PREFIX_HEADER_INCLUDE_PATH`, the option which yields the closer relative path match wins.
For example, if third-party libraries are part of the source tree in a directory called `Libs`,
the following setting will make cotire select header files from the third-party directory, but
ignore other project related headers in `CMAKE_SOURCE_DIR`:
set_target_properties(example PROPERTIES
COTIRE_PREFIX_HEADER_IGNORE_PATH "${CMAKE_SOURCE_DIR}"
COTIRE_PREFIX_HEADER_INCLUDE_PATH "${CMAKE_SOURCE_DIR}/Libs")
The properties `COTIRE_PREFIX_HEADER_IGNORE_PATH` and `COTIRE_PREFIX_HEADER_INCLUDE_PATH` can
also be set on directories.
The following cache variables also affect the selection of prefix headers:
* Directory paths in `COTIRE_ADDITIONAL_PREFIX_HEADER_IGNORE_PATH` will be added to the list of
ignored directories when the prefix header file is created.
* `COTIRE_ADDITIONAL_PREFIX_HEADER_IGNORE_EXTENSIONS` can be used to ignore header files by file
extension. It defaults to the CMake list `inc;inl;ipp`.
During development, changes to the project source files may affect the list of header files that
should be selected for inclusion in the prefix header (e.g., a standard include may be added or
removed from a target source file). Cotire does not automatically recreate the prefix header,
when a target source file is changed, because this would always trigger a re-compilation of the
precompiled header and would result in a rebuild of the whole target. To make the prefix header
creation dependent on changes to certain target source files, the source file property
`COTIRE_DEPENDENCY` can be set to `TRUE` for those files:
set_property (SOURCE "example.cpp" PROPERTY COTIRE_DEPENDENCY "TRUE")
### fixing linkage issues
When a C++ program uses `extern "C"` on a system header file, cotire will not be able to detect
that the include file needs C linkage and will include the file with C++ linkage in the generated
prefix header instead. For example, the C interface to BLAS `cblas.h` usually has to be included
as `extern "C"` in a C++ program:
extern "C" {
#include <cblas.h>
}
The presence of `extern "C"` includes will prevent cotired targets from being linked successfully
because of unresolved function references using the wrong linkage. To work around the problem,
the property `COTIRE_PREFIX_HEADER_IGNORE_PATH` can also include the full path of header files
besides directories. Here is an example:
set_property(DIRECTORY
PROPERTY COTIRE_PREFIX_HEADER_IGNORE_PATH
"${ATLAS_INCLUDE_DIR}/cblas.h"
"${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}")
That way `cblas.h` will not be included in the generated prefix header and will not cause problems
upon linking.
### using a manually maintained unity source instead of the automatically generated one
Cotire can be configured to use an existing manually maintained unity source file instead of the
automatically generated one. Set the target property `COTIRE_CXX_UNITY_SOURCE_INIT` to the path
of the existing unity source file. Its path is interpreted relative to the target source directory:
set_target_properties(example PROPERTIES COTIRE_CXX_UNITY_SOURCE_INIT "example-all.cpp")
cotire(example)
The property can also be set to a list of source files which will then make up the contents of
the generated unity source file.
### configuring the generation of the unity source
By default cotire adds all target source files to the generated unity source. In most cases a
unity build will not work out of the box, because unity builds [break][EoUB] the use of some C
and C++ language features. Unity build problems can be tackled in the following way:
* Change the order of the source files in the `add_executable` or `add_library` calls.
Problematic source files should be moved towards the end.
* Set the source file property `COTIRE_EXCLUDED` on problematic source files. The source file
will not be included in the unity source file and will be compiled separately when the unity build
is performed.
* `COTIRE_UNITY_SOURCE_EXCLUDE_EXTENSIONS` can be used to exclude source files by file extension
from inclusion in the generated unity source. It defaults to the CMake list `m;mm`.
* If the unity source file is too large and the compilation process runs into a compiler limit,
the target property `COTIRE_UNITY_SOURCE_MAXIMUM_NUMBER_OF_INCLUDES` can be set. If the target
contains more than that number of source files, cotire will create multiple unity source files
for it. Each unity source file is compiled separately when the unity build is performed.
The property is initialized by value of the cache variable
`COTIRE_MAXIMUM_NUMBER_OF_UNITY_INCLUDES`.
* Another way to break up a large unity source file is to set the source file property
`COTIRE_START_NEW_UNITY_SOURCE` to `TRUE` on selected target source files. If cotire encounters
this property, it will complete the current unity file and start a new one. The new unity source
file will include the source file as the first one. This property essentially works as a separator
for unity source files.
### optimizing the build process for multiple processor cores
To make use of all the machine's CPU cores for the unity compilation of a target, the target
property `COTIRE_UNITY_SOURCE_MAXIMUM_NUMBER_OF_INCLUDES` can be set to the string `-j`. Cotire
will then create as many unity file segments as there are CPU cores on the machine. Because
the unity file segments do not depend on each other, a multi-core aware build process can compile
the file segments in parallel.
To explicitly specify the number of cores, append the number after `-j`, e.g. `-j 4` or `-j4`.
For CMake generators that are multi-core aware by default (i.e., Visual Studio, JOM, Ninja), cotire
will automatically initialize the property to `-j`. For makefile based generators, this has to be
done explicitly by setting the cache variable `COTIRE_MAXIMUM_NUMBER_OF_UNITY_INCLUDES`, i.e.:
$ cmake -D COTIRE_MAXIMUM_NUMBER_OF_UNITY_INCLUDES=-j4 <path-to-source>
$ make -j 4
### fixing macro definition clashes
Many unity build problems stem from macro definitions leaking into other target source files,
where they may conflict with other definitions of the same name. Cotire adds the properties
`COTIRE_UNITY_SOURCE_PRE_UNDEFS` and `COTIRE_UNITY_SOURCE_POST_UNDEFS` to fix macro definition
clashes.
As an example, if these properties are set on a source file of the example project:
set_source_files_properties (example.cpp PROPERTIES
COTIRE_UNITY_SOURCE_PRE_UNDEFS "max;min"
COTIRE_UNITY_SOURCE_POST_UNDEFS "DEBUG_TYPE")
This will make cotire add undefs to the generated unity source file.
#ifdef __cplusplus
#include "/Users/sakra/Documents/cotire/src/main.cpp"
#undef min
#undef max
#include "/Users/sakra/Documents/cotire/src/example.cpp"
#undef DEBUG_TYPE
#include "/Users/sakra/Documents/cotire/src/log.cpp"
#endif
The properties `COTIRE_UNITY_SOURCE_PRE_UNDEFS` and `COTIRE_UNITY_SOURCE_POST_UNDEFS` can also be
set on targets. Cotire will add `#undef` directives for each source file in the unity source then.
### enabling verbose builds
The cache variable `COTIRE_VERBOSE` can be set to `TRUE` to see all compile commands used when
generating the cotire related files. Cotire will also print the contents of the generated unity
source and the prefix header for verbose builds. `COTIRE_VERBOSE` defaults to `FALSE`.
When using a Makefile generator `COTIRE_VERBOSE` defaults to the value of the makefile variable
`VERBOSE` (i.e., `make VERBOSE=1`).
### conditionally loading cotire
To make a `CMakeLists.txt` robust against a missing `cotire.cmake` module, the following strategy
can be applied to using cotire:
include(cotire OPTIONAL)
...
add_executable(example main.cpp example.cpp log.cpp log.h example.h)
...
if (COMMAND cotire)
cotire(example)
endif()
The `include(cotire OPTIONAL)` will prevent CMake from raising an error if cotire cannot be
found. The actual calls to cotire need to be guarded by `if (COMMAND cotire)` blocks.
### using cotire with compiler wrappers
Cotire is compatible with CMake compiler wrappers. For example, the use of [ccache][ccch] may be
enabled in the following way upon configuring the project:
$ export CC="/usr/local/bin/ccache /usr/bin/gcc"
$ export CXX="/usr/local/bin/ccache /usr/bin/g++"
$ export CCACHE_SLOPPINESS=pch_defines,time_macros
$ cmake ..
Alternatively, for CMake 3.4 or later compiler wrappers can be enabled by pointing the CMake
variable `CMAKE_CXX_COMPILER_LAUNCHER` to the compiler wrapper executable upon configuring:
$ cmake -D CMAKE_CXX_COMPILER_LAUNCHER=/usr/local/bin/ccache <path-to-source>
Note that with ccache in order for precompiled headers to work properly, it is necessary to set
the environment variable `CCACHE_SLOPPINESS` to `pch_defines,time_macros`. Otherwise the build
process may abort with the following error message:
fatal error: file 'example_CXX_prefix.hxx' has been modified since the precompiled header
'example_CXX_prefix.hxx.gch' was built
Also see the [ccache manual][ccch_pch].
### applying cotire to object library targets
CMake 2.8.8 introduced a new type of library target called [object library][objlib]. An object
library is a convenience target that compiles multiple source files but does not create a linked
target library for them, e.g.:
add_library(myLib OBJECT lib1.cpp lib2.cpp lib3.cpp)
add_executable(exeA $<TARGET_OBJECTS:myLib> mainA.cpp)
add_executable(exeB $<TARGET_OBJECTS:myLib> mainB.cpp)
The `cotire` function can be applied to an object library target in a familiar fashion:
add_library(myLib OBJECT lib1.cpp lib2.cpp lib3.cpp)
cotire(myLib)
# use unity object library for executables
add_executable(exeA $<TARGET_OBJECTS:myLib_unity> mainA.cpp)
add_executable(exeB $<TARGET_OBJECTS:myLib_unity> mainB.cpp)
Because object library targets do not support `PRE_BUILD` actions, precompiled header usage cannot
be enabled for them for Xcode projects generated with CMake. Unity builds work as expected, though.
### automatically setting up linked libraries in the unity target
The setting of the target property `COTIRE_UNITY_LINK_LIBRARIES_INIT` controls the linking
strategy for the generated unit target.
If this property is empty or set to `NONE`, the generated unity target's link libraries have to be
set up manually with subsequent `target_link_libraries` calls:
set_target_properties(example PROPERTIES COTIRE_UNITY_LINK_LIBRARIES_INIT "NONE")
...
cotire(example)
target_link_libraries(MyExecutable_unity ${MyExecutableLibraries})
If this property is set to `COPY`, the unity target's link libraries will be copied from the
original target.
If this property is set to `COPY_UNITY`, the unity target's link libraries will be copied from the
original target but instead of copying a linked target verbatim, the target's corresponding unity
target will be preferred, provided one exists. This also applies to object libraries, which have
been added to the original target with a `TARGET_OBJECTS` generator expression.
As of cotire 1.7.0, the default linking strategy for unit targets is `COPY_UNITY`.
The property `COTIRE_UNITY_LINK_LIBRARIES_INIT` can also be set on directories. A target inherits
the property value from its enclosing directory. To make all targets in the project use the
`COPY` strategy, the directory property can be set in the outermost `CMakeList.txt` file:
include(cotire)
...
set_property(DIRECTORY PROPERTY COTIRE_UNITY_LINK_LIBRARIES_INIT "COPY")
### using cotire with Qt
Cotire is compatible with both Qt projects that use CMake as build system, provided Qt targets
do not use CMake automatic moc, uid or rcc scanning.
### installing files generated by unity targets
Cotire cannot set up a `install_unity` target that mimics the `install` target automatically,
because CMake does not provide the necessary information about the existing install rules
programmatically.
When using a Makefile generator, you can use the following workaround (thanks to peterhuene):
$ make all_unity
$ make install/fast
The `install/fast` does not trigger a build, but will use the binaries built by the `all_unity`
target.
For other generators, set up an `install_unity` target manually. First set up install rules for
all unity targets, that mimic the install rules for the original targets:
install(TARGETS example_unity RUNTIME DESTINATION "bin" OPTIONAL COMPONENT "unity")
This installs the `example` executable built by the unity target to the `bin` folder. The install
rules for unity targets must use a custom install component. Then add a global `install_unity`
target that performs the installation of all unity targets:
add_custom_target(install_unity
COMMAND ${CMAKE_COMMAND} -DCOMPONENT=unity -P cmake_install.cmake
COMMENT "Install the unity-built project..."
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
add_dependencies(unity_install example_unity)
The global `install_unity` target must depend on all unity targets that should be installed.
### customized inclusion of system headers
If a system header ends up in a precompiled header, it is not possible to customize the inclusion
of that header in a source file through preprocessor defines.
For example, under Windows one may want to include `Windows.h` with `NOMINMAX` defined to prevent
the definition of the `min` and `max` macros:
#define NOMINMAX
#include <Windows.h>
The dependency of `Windows.h` on the preprocessor define `NOMINMAX` will not be picked up by cotire
automatically upon adding `Windows.h` to the prefix header. To work around the problem, make the
dependency explicit by using `add_definitions` in the corresponding `CMakeLists.txt`:
if (WIN32)
# prevent definition of min and max macros through inclusion of Windows.h
add_definitions("-DNOMINMAX")
endif()
That way, the preprocessor define `NOMINMAX` will be picked up by cotire and applied to the
pre-compilation of the prefix header.
### organize includes added to the prefix header
Sometimes the order of the includes in the automatically generated prefix header may result in
compilation errors due to subtile header dependencies.
To work around the problem, the target property `COTIRE_PREFIX_HEADER_INCLUDE_PRIORITY_PATH`
can be set to a list of directories. Header files whose path matches one of these directories will
be inserted at the beginning of generated prefix header. Header files are sorted according to
the order of the directories in the property. Headers not matching one of these directories are
left untouched.
The property `COTIRE_PREFIX_HEADER_INCLUDE_PRIORITY_PATH` can also be set on directories. A target
inherits the property value from its enclosing directory.
common pitfalls
---------------
### include the `cotire.cmake` module correctly
If CMake issues the message `Unknown CMake command "cotire"`, double check that the cotire module
has been included correctly in your project. See the manual section "cotire basic usage".
### do not modify a target's build related properties after applying cotire
Cotire only considers build related settings of a target at the time of the `cotire` function call.
If target properties that control the build are changed after the call to the `cotire` function,
the build rules set up by cotire for the precompiled header and unity build may not work correctly.
Don't do this:
add_executable(example main.cpp example.cpp log.cpp log.h example.h)
cotire(example)
...
set_target_properties(example PROPERTIES POSITION_INDEPENDENT_CODE ON) # affects build
### always apply cotire in the same source directory where a target has been added
CMake targets are globally visible. Nevertheless, it is important that the `cotire` function is
called for a target in the exact same directory that creates the target with `add_library` or
`add_executable`.
Don't do this:
add_subdirectory(src)
...
cotire(mytarget) # mytarget added in src directory
Cotire may fail to inspect the target's source files correctly, if the target has been added in a
different directory and you may get odd messages about missing source files.
known issues
------------
### generator expressions
cotire uses the CMake command `file(GENERATE ...` to expand generator expressions used in various
compilation settings. This command does not handle certain CMake generator expressions like
`$<CXX_COMPILER_ID:...>` correctly.
### Ninja compatibility
Under Ninja indirect prefix header dependencies are ignored by the generated build system. Cotire
uses the `IMPLICIT_DEPENDS` option of `add_custom_command` to make the precompiled header depend
on header files indirectly included by the prefix header. The `IMPLICIT_DEPENDS` option is not
supported by CMake's Ninja generator. See [CMake issue][ninja_issue].
### using source files for multiple targets
When the same set of source files is used for different targets (e.g., for producing a static
and a shared library variant from the same sources), using a precompiled header may not work.
Under certain circumstances, cotire cannot enable the precompiled header usage by changing the
`COMPILE_FLAGS` property of the whole target, but must set the `COMPILE_FLAGS` properties of
individual target source files instead. This will break the usage of the source file for multiple
targets.
### multi-architecture builds under Mac OS X
Neither GCC nor Clang support the use of precompiled headers when performing a Mac OS X
multi-architecture build (e.g., using option `-DCMAKE_OSX_ARCHITECTURES=i386;x86_64`).
### Objective-C
CMake targets that contain Objective-C or Objective-C++ source files cannot be cotired. Source
files ending with .m and .mm are excluded by default through the initial default setting of
`COTIRE_UNITY_SOURCE_EXCLUDE_EXTENSIONS`.
### Intel C++
Intel C++ support has only been tested with [Intel C++ Composer XE 2013 for Linux][icc_linux] and
may not work with other platforms or versions.
The Intel compiler may issue incorrect warnings #672 (the command line options do not match those
used when precompiled header was created) or #673 (the initial sequence of preprocessing directives
is not compatible with those of precompiled header file) upon compilation of cotired targets.
### IncrediBuild
Cotire is not compatible with [Xoreax IncrediBuild][XGE].
[1260]:https://cmake.org/Bug/view.php?id=1260
[ccch]:https://ccache.samba.org/
[ccch_pch]:https://ccache.samba.org/manual.html#_precompiled_headers
[clang_pch]:https://clang.llvm.org/docs/UsersManual.html#precompiled-headers
[gcc_pch]:https://gcc.gnu.org/onlinedocs/gcc/Precompiled-Headers.html
[msvc_pch]:https://msdn.microsoft.com/en-us/library/szfdksca(v=vs.90).aspx
[msvc_pch_create]:https://msdn.microsoft.com/en-us/library/7zc28563(v=vs.90).aspx
[msvc_pch_use]:https://msdn.microsoft.com/en-us/library/z0atkd6c(v=vs.90).aspx
[ninja_issue]:https://cmake.org/Bug/view.php?id=13234
[EoUB]:http://altdevblog.com/2011/08/14/the-evils-of-unity-builds/
[pch]:https://en.wikipedia.org/wiki/Precompiled_header
[scu]:https://en.wikipedia.org/wiki/Single_Compilation_Unit
[objlib]:https://cmake.org/cmake/help/latest/command/add_library.html#object-libraries
[pfh]:https://en.wikipedia.org/wiki/Prefix_header
[icc_linux]:https://software.intel.com/en-us/c-compilers/ipsxe-support
[XGE]:https://www.incredibuild.com/

137
deps/cotire/README.md vendored Normal file
View File

@@ -0,0 +1,137 @@
cotire
======
Cotire (compile time reducer) is a CMake module that speeds up the build process of CMake based
build systems by fully automating techniques as [precompiled header][pch] usage and
[single compilation unit][scu] builds for C and C++.
features
--------
* Non-intrusive. Requires no source code modification and only minimal changes to CMake list files.
* Automatically generates a [single compilation unit][scu] (aka unity source file) for a CMake target.
* Automatically generates a [prefix header][pfh] by tracking includes used by a CMake target.
* Automatically precompiles prefix header and applies resulting [precompiled header][pch] to a CMake target.
* Alternatively, allows for using manually maintained unity source and prefix header files.
* Supports C/C++ compilers Clang, GCC, Intel and Visual Studio C++.
* Supports mixed language CMake targets.
* Supports console (Makefile generator) and IDE (Visual Studio and Xcode) based builds.
* Compatible with CMake single build type and CMake multi-configuration builds.
* Compatible with most CMake generators (including [Ninja][ninja]).
* Supports multi-core unity builds for some generators (make -j, [jom][jom], Visual Studio, Ninja).
* Leverages native precompiled header generation features of IDEs (Visual Studio and Xcode).
* Compatible with CMake's [cross-compiling][ccrc] support.
* Compatible with compiler wrappers like [ccache][ccch].
* Tested with Windows, Linux and OS X.
* MIT licensed.
requirements
------------
* [CMake 2.8.12][cmk] or newer. The executable `cmake` should be on the system path.
* [Visual Studio C++][vslstd], [MinGW][mingw] or [Cygwin][cgwn] under Windows.
* [Clang][clang] under Windows, Linux or OS X.
* [GCC][gcc] under Linux or OS X.
* [Intel C++ compiler][intel] under Windows, Linux or OS X.
* [Xcode][xcdt] application or Xcode Command Line Tools under OS X.
installation
------------
Copy the file `CMake/cotire.cmake` to the module directory of your CMake project. In the
top-level `CMakeList.txt` file, add the module directory to the CMake module search path:
set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake")
usage
-----
To use cotire in your CMake project, add the following include directive to the beginning of the
top-level `CMakeList.txt`:
include(cotire)
To speed the build process of a CMake library or executable target, just apply the `cotire`
function to the target:
add_executable(MyExecutable ${MyExecutableSources})
target_link_libraries(MyExecutable ${MyExecutableLibraries})
cotire(MyExecutable)
Cotire looks at the properties of the target provided by CMake (e.g., target type, source files,
compile flags, preprocessor defines, include directories, ...) and sets up custom commands that
will generate a unity source file, a prefix header and a precompiled header at build time
specially tailored to the target.
For the generation of the prefix header, cotire will automatically choose headers used by the
target that are outside of the project directory and thus are likely to change infrequently.
The precompiled prefix header is then applied to the target to speed up the compilation process.
To use an existing manually maintained prefix header instead of the automatically generated one,
set the `COTIRE_CXX_PREFIX_HEADER_INIT` property before invoking cotire:
set_target_properties(MyExecutable PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT "stdafx.h")
cotire(MyExecutable)
As a side effect, cotire generates a new target named `MyExecutable_unity`, which lets you perform
a unity build for the original target. The unity target inherits all build settings from the
original target, including linked library dependencies.
For Makefile based generators you can then invoke a unity build that produces the same output as
the original target, but does so much faster by entering:
$ make MyExecutable_unity
See the advanced usage section of the [cotire manual][manual] for information on how to
configure the cotire process (e.g., how to make the unity build use all available processor
cores).
The directory `Patches` contains patch files to enable cotire for some popular open sources
packages that use CMake as a build system.
speedup
-------
Depending on factors like hardware, compiler, the number of files in the target and the complexity
of the C/C++ code, the build process of targets that use a cotire generated precompiled header
will be sped up from 10 to 40 percent. Using precompiled headers however is not without
[issues][PCHH] and may not work for some programs.
A unity build may be up to 90 percent faster than the one file at a time build of the original
target. Single compilation unit builds however are very unlikely to work without source code
modifications, because they [break][EoUB] the use of some C and C++ language features.
Generally, modern C++ code which makes heavy use of header-only libraries will profit the most from
cotiring.
This [blog post][shrp] discusses speedup results obtained for real-world projects.
known issues
------------
* CMake configure time will increase for cotired targets.
* The size of the CMake build folder will increase, because precompiled headers are large binaries.
* It is not possible to share precompiled headers generated by cotire between CMake targets.
Multiple targets can share a generated prefix header, though (see the [cotire manual][manual]).
* Cotire is not compatible with [Xoreax IncrediBuild][XGE].
[ccch]:https://ccache.samba.org/
[ccrc]:https://cmake.org/Wiki/CMake_Cross_Compiling
[cgwn]:https://www.cygwin.com/
[clang]:https://clang.llvm.org/
[cmk]:https://cmake.org/download/
[gcc]:https://gcc.gnu.org/
[manual]:https://github.com/sakra/cotire/blob/master/MANUAL.md
[mingw]:http://www.mingw.org/
[ninja]:https://ninja-build.org/
[pch]:https://en.wikipedia.org/wiki/Precompiled_header
[pfh]:https://en.wikipedia.org/wiki/Prefix_header
[scu]:https://en.wikipedia.org/wiki/Single_Compilation_Unit
[vslstd]:https://www.visualstudio.com/
[xcdt]:https://developer.apple.com/xcode/
[PCHH]:https://gcc.gnu.org/wiki/PCHHaters
[EoUB]:http://altdevblog.com/2011/08/14/the-evils-of-unity-builds/
[jom]:https://wiki.qt.io/Jom
[intel]:https://software.intel.com/en-us/c-compilers
[XGE]:https://www.incredibuild.com/
[shrp]:https://unriskinsight.blogspot.co.at/2014/09/sharpen-your-tools.html

22
deps/cotire/license vendored Normal file
View File

@@ -0,0 +1,22 @@
Copyright (c) 2012-2018 Sascha Kratky
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -1,4 +1,4 @@
# Copyright (C) # Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL3 v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
# #
# This file is free software; as a special exception the author gives # This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without # unlimited permission to copy and/or distribute it, with or without
@@ -8,7 +8,6 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
set(g3dlib_STAT_SRCS set(g3dlib_STAT_SRCS
source/AABox.cpp source/AABox.cpp
source/Any.cpp source/Any.cpp
@@ -54,19 +53,21 @@ set(g3dlib_STAT_SRCS
source/Vector4.cpp source/Vector4.cpp
) )
if(WIN32)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/deps/zlib
)
else()
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/include
)
endif()
add_library(g3dlib STATIC ${g3dlib_STAT_SRCS}) add_library(g3dlib STATIC ${g3dlib_STAT_SRCS})
# Group sources
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(g3dlib
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include)
target_link_libraries(g3dlib target_link_libraries(g3dlib
${ZLIB_LIBRARIES} PUBLIC
) zlib
threads)
set_target_properties(g3dlib
PROPERTIES
FOLDER
"deps")

View File

@@ -1,4 +1,5 @@
# Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/> # Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
# Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL3 v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
# #
# This file is free software; as a special exception the author gives # This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without # unlimited permission to copy and/or distribute it, with or without
@@ -14,6 +15,9 @@ add_library(gsoap STATIC ${sources})
set_target_properties(gsoap PROPERTIES LINKER_LANGUAGE CXX) set_target_properties(gsoap PROPERTIES LINKER_LANGUAGE CXX)
# Group sources
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(gsoap target_include_directories(gsoap
PUBLIC PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}) ${CMAKE_CURRENT_SOURCE_DIR})
@@ -21,7 +25,7 @@ target_include_directories(gsoap
set_target_properties(gsoap set_target_properties(gsoap
PROPERTIES PROPERTIES
FOLDER FOLDER
"dep") "deps")
if (MSVC) if (MSVC)
# Little fix for MSVC / Windows platforms # Little fix for MSVC / Windows platforms

View File

@@ -1,4 +1,5 @@
# Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/> # Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/>
# Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL3 v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
# #
# This file is free software; as a special exception the author gives # This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without # unlimited permission to copy and/or distribute it, with or without
@@ -8,19 +9,20 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND SERVERS AND NOT NOJEM)
# We need to generate the jemalloc_def.h header based on platform-specific settings # We need to generate the jemalloc_def.h header based on platform-specific settings
CHECK_SYMBOL_EXISTS(MADV_FREE "sys/mman.h" HAVE_MADV_FREE) CHECK_SYMBOL_EXISTS(MADV_FREE "sys/mman.h" HAVE_MADV_FREE)
if (PLATFORM EQUAL 32) if (PLATFORM EQUAL 32)
set(JEM_SIZEDEF 2) set(JEM_SIZEDEF 2)
set(JEM_TLSMODEL) set(JEM_TLSMODEL)
set(JEM_VADDRBITS 32) set(JEM_VADDRBITS 32)
else() else()
set(JEM_SIZEDEF 3) set(JEM_SIZEDEF 3)
set(JEM_TLSMODEL "__attribute__\(\(tls_model\(\"initial-exec\"\)\)\)") set(JEM_TLSMODEL "__attribute__\(\(tls_model\(\"initial-exec\"\)\)\)")
set(JEM_VADDRBITS 48) set(JEM_VADDRBITS 48)
endif() endif()
if (HAVE_MADV_FREE) if (HAVE_MADV_FREE)
set(JEM_MADFREE_DEF "#define") set(JEM_MADFREE_DEF "#define")
else() else()
@@ -67,20 +69,35 @@
${CMAKE_CURRENT_SOURCE_DIR}/src/witness.c ${CMAKE_CURRENT_SOURCE_DIR}/src/witness.c
) )
include_directories( add_library(jemalloc STATIC
${BUILDDIR}/ ${jemalloc_STAT_SRC})
${CMAKE_CURRENT_SOURCE_DIR}/include
)
add_definitions(-D_GNU_SOURCE -D_REENTRANT) target_include_directories(jemalloc
PRIVATE
${BUILDDIR}
${CMAKE_CURRENT_SOURCE_DIR}/include)
add_library(jemalloc STATIC ${jemalloc_STAT_SRC}) target_compile_definitions(jemalloc
target_link_libraries(jemalloc
PUBLIC PUBLIC
${CMAKE_DL_LIBS}) -DNO_BUFFERPOOL
PRIVATE
set_target_properties(jemalloc -D_GNU_SOURCE
-D_REENTRAN)
target_link_libraries(jemalloc
PUBLIC
threads
${CMAKE_DL_LIBS})
set_target_properties(jemalloc
PROPERTIES PROPERTIES
FOLDER FOLDER
"deps") "deps")
else()
# Provide a dummy target for jemalloc which is used when jemalloc
# is disabled or not supported.
add_library(jemalloc INTERFACE)
# target_link_libraries(jemalloc
# INTERFACE
# valgrind)
endif()

View File

@@ -1,4 +1,4 @@
# Copyright (C) # Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL3 v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
# #
# This file is free software; as a special exception the author gives # This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without # unlimited permission to copy and/or distribute it, with or without
@@ -8,27 +8,32 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
file(GLOB sources_mpq libmpq/*.c libmpq/*.h) file(GLOB sources libmpq/*.c libmpq/*.h)
set(mpq_STAT_SRCS add_library(mpq STATIC ${sources})
${sources_mpq}
)
if( UNIX )
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/deps/zlib
${CMAKE_SOURCE_DIR}/deps/bzip2
)
elseif( WIN32 )
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/win
${CMAKE_SOURCE_DIR}/deps/zlib
${CMAKE_SOURCE_DIR}/deps/bzip2
)
endif()
add_library(mpq STATIC ${mpq_STAT_SRCS})
set_target_properties(mpq PROPERTIES LINKER_LANGUAGE CXX) set_target_properties(mpq PROPERTIES LINKER_LANGUAGE CXX)
if(WIN32)
set(WIN_EXTRA_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/win)
endif()
# Group sources
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(mpq
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
${WIN_EXTRA_INCLUDE}
${CMAKE_SOURCE_DIR}/deps/zlib
${CMAKE_SOURCE_DIR}/deps/bzip2)
target_link_libraries(mpq
PUBLIC
zlib
bzip2)
set_target_properties(mpq
PROPERTIES
FOLDER
"deps")

23
deps/mysql/CMakeLists.txt vendored Normal file
View File

@@ -0,0 +1,23 @@
# Copyright (C) 2008-2019 TrinityCore <https://www.trinitycore.org/>
# Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL3 v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
#
# 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.
if (NOT MYSQL_FOUND)
message(FATAL_ERROR "MySQL wasn't found on your system but it's required to build the servers!")
endif()
add_library(mysql STATIC IMPORTED GLOBAL)
set_target_properties(mysql
PROPERTIES
IMPORTED_LOCATION
"${MYSQL_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES
"${MYSQL_INCLUDE_DIR}")

27
deps/openssl/CMakeLists.txt vendored Normal file
View File

@@ -0,0 +1,27 @@
# Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
# Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL3 v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
#
# 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.
# basic packagesearching and setup
# (further support will be needed, this is a preliminary release!)
set(OPENSSL_EXPECTED_VERSION 1.0.0)
find_package(OpenSSL REQUIRED)
add_library(openssl INTERFACE)
target_link_libraries(openssl
INTERFACE
${OPENSSL_LIBRARIES})
target_include_directories(openssl
INTERFACE
${OPENSSL_INCLUDE_DIR})

39
deps/readline/CMakeLists.txt vendored Normal file
View File

@@ -0,0 +1,39 @@
# Copyright (C) 2008-2019 TrinityCore <https://www.trinitycore.org/>
# Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL3 v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
#
# 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.
if( UNIX )
# find Readline (terminal input library) includes and library
#
# READLINE_INCLUDE_DIR - where the directory containing the READLINE headers can be found
# READLINE_LIBRARY - full path to the READLINE library
find_path(READLINE_INCLUDE_DIR readline/readline.h)
find_library(READLINE_LIBRARY NAMES readline)
message(STATUS "Found Readline library: ${READLINE_LIBRARY}")
message(STATUS "Include dir is: ${READLINE_INCLUDE_DIR}")
if (NOT READLINE_INCLUDE_DIR OR NOT READLINE_LIBRARY)
message(FATAL_ERROR "** Readline library not found!\n** Your distro may provide a binary for Readline e.g. for ubuntu try apt-get install libreadline5-dev")
endif ()
add_library(readline SHARED IMPORTED GLOBAL)
set_target_properties(readline
PROPERTIES
IMPORTED_LOCATION
"${READLINE_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES
"${READLINE_INCLUDE_DIR}")
else()
# Provide a dummy target
add_library(readline INTERFACE)
endif()

View File

@@ -1,4 +1,5 @@
# Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/> # Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
# Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL3 v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
# #
# This file is free software; as a special exception the author gives # This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without # unlimited permission to copy and/or distribute it, with or without
@@ -30,6 +31,9 @@ target_include_directories(Detour
PUBLIC PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/Include) ${CMAKE_CURRENT_SOURCE_DIR}/Include)
# Group sources
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(Detour target_link_libraries(Detour
PUBLIC PUBLIC
zlib) zlib)
@@ -37,4 +41,4 @@ target_link_libraries(Detour
set_target_properties(Detour set_target_properties(Detour
PROPERTIES PROPERTIES
FOLDER FOLDER
"dep") "deps")

View File

@@ -1,4 +1,5 @@
# Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/> # Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
# Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL3 v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
# #
# This file is free software; as a special exception the author gives # This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without # unlimited permission to copy and/or distribute it, with or without
@@ -30,6 +31,9 @@ endif()
add_library(Recast STATIC ${Recast_STAT_SRCS}) add_library(Recast STATIC ${Recast_STAT_SRCS})
# Group sources
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(Recast target_include_directories(Recast
PUBLIC PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/Include) ${CMAKE_CURRENT_SOURCE_DIR}/Include)
@@ -41,4 +45,4 @@ target_link_libraries(Recast
set_target_properties(Recast set_target_properties(Recast
PROPERTIES PROPERTIES
FOLDER FOLDER
"dep") "deps")

18
deps/threads/CMakeLists.txt vendored Normal file
View File

@@ -0,0 +1,18 @@
# Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
# Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL3 v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
#
# 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.
find_package(Threads REQUIRED)
add_library(threads INTERFACE)
target_link_libraries(threads
INTERFACE
${CMAKE_THREAD_LIBS_INIT})

16
deps/utf8cpp/CMakeLists.txt vendored Normal file
View File

@@ -0,0 +1,16 @@
# Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
# Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL3 v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
#
# 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.
add_library(utf8cpp INTERFACE)
target_include_directories(utf8cpp
INTERFACE
${CMAKE_CURRENT_SOURCE_DIR})

View File

@@ -1,4 +1,5 @@
# Copyright (C) # Copyright (C) 2008-2019 TrinityCore <https://www.trinitycore.org/>
# Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL3 v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
# #
# This file is free software; as a special exception the author gives # This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without # unlimited permission to copy and/or distribute it, with or without
@@ -8,23 +9,46 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
SET(zlib_STAT_SRCS if(UNIX)
adler32.c # Look for an installed zlib on unix
compress.c find_package(ZLIB REQUIRED)
crc32.c
deflate.c
example.c
infback.c
inffast.c
inflate.c
inftrees.c
trees.c
uncompr.c
zutil.c
)
include_directories( add_library(zlib SHARED IMPORTED GLOBAL)
${CMAKE_CURRENT_SOURCE_DIR}
)
add_library(zlib STATIC ${zlib_STAT_SRCS}) set_target_properties(zlib
PROPERTIES
IMPORTED_LOCATION
"${ZLIB_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES
"${ZLIB_INCLUDE_DIRS}")
else()
# Use the bundled source on windows
SET(zlib_STAT_SRCS
adler32.c
compress.c
crc32.c
deflate.c
infback.c
inffast.c
inflate.c
inftrees.c
trees.c
uncompr.c
zutil.c
)
add_library(zlib STATIC
${zlib_STAT_SRCS})
# Group sources
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(zlib
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR})
set_target_properties(zlib
PROPERTIES
FOLDER
"deps")
endif()

View File

@@ -0,0 +1,72 @@
# Copyright (C) 2008-2019 TrinityCore <https://www.trinitycore.org/>
# Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL3 v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
#
# 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.
# Collects all source files into the given variable,
# which is useful to include all sources in subdirectories.
# Ignores full qualified directories listed in the variadic arguments.
#
# Use it like:
# CollectSourceFiles(
# ${CMAKE_CURRENT_SOURCE_DIR}
# COMMON_PRIVATE_SOURCES
# # Exclude
# ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders
# ${CMAKE_CURRENT_SOURCE_DIR}/Platform)
#
function(CollectSourceFiles current_dir variable)
list(FIND ARGN "${current_dir}" IS_EXCLUDED)
if(IS_EXCLUDED EQUAL -1)
file(GLOB COLLECTED_SOURCES
${current_dir}/*.c
${current_dir}/*.cc
${current_dir}/*.cpp
${current_dir}/*.inl
${current_dir}/*.def
${current_dir}/*.h
${current_dir}/*.hh
${current_dir}/*.hpp)
list(APPEND ${variable} ${COLLECTED_SOURCES})
file(GLOB SUB_DIRECTORIES ${current_dir}/*)
foreach(SUB_DIRECTORY ${SUB_DIRECTORIES})
if (IS_DIRECTORY ${SUB_DIRECTORY})
CollectSourceFiles("${SUB_DIRECTORY}" "${variable}" "${ARGN}")
endif()
endforeach()
set(${variable} ${${variable}} PARENT_SCOPE)
endif()
endfunction()
# Collects all subdirectoroies into the given variable,
# which is useful to include all subdirectories.
# Ignores full qualified directories listed in the variadic arguments.
#
# Use it like:
# CollectIncludeDirectories(
# ${CMAKE_CURRENT_SOURCE_DIR}
# COMMON_PUBLIC_INCLUDES
# # Exclude
# ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders
# ${CMAKE_CURRENT_SOURCE_DIR}/Platform)
#
function(CollectIncludeDirectories current_dir variable)
list(FIND ARGN "${current_dir}" IS_EXCLUDED)
if(IS_EXCLUDED EQUAL -1)
list(APPEND ${variable} ${current_dir})
file(GLOB SUB_DIRECTORIES ${current_dir}/*)
foreach(SUB_DIRECTORY ${SUB_DIRECTORIES})
if (IS_DIRECTORY ${SUB_DIRECTORY})
CollectIncludeDirectories("${SUB_DIRECTORY}" "${variable}" "${ARGN}")
endif()
endforeach()
set(${variable} ${${variable}} PARENT_SCOPE)
endif()
endfunction()

View File

@@ -1,104 +1,27 @@
FUNCTION(GET_COMMON_PCH_PARAMS PCH_HEADER PCH_FE INCLUDE_PREFIX) if (MSVC)
GET_FILENAME_COMPONENT(PCH_HEADER_N ${PCH_HEADER} NAME) # Specify the maximum PreCompiled Header memory allocation limit
GET_DIRECTORY_PROPERTY(TARGET_INCLUDES INCLUDE_DIRECTORIES) # Fixes a compiler-problem when using PCH - the /Ym flag is adjusted by the compiler in MSVC2012,
# hence we need to set an upper limit with /Zm to avoid discrepancies)
# (And yes, this is a verified, unresolved bug with MSVC... *sigh*)
#
# Note: This workaround was verified to be required on MSVC 2017 as well
set(COTIRE_PCH_MEMORY_SCALING_FACTOR 500)
endif()
FOREACH(ITEM ${TARGET_INCLUDES}) include(cotire)
LIST(APPEND INCLUDE_FLAGS_LIST "${INCLUDE_PREFIX}\"${ITEM}\" ")
ENDFOREACH(ITEM)
SET(PCH_HEADER_NAME ${PCH_HEADER_N} PARENT_SCOPE) function(ADD_CXX_PCH TARGET_NAME_LIST PCH_HEADER)
SET(PCH_HEADER_OUT ${CMAKE_CURRENT_BINARY_DIR}/${PCH_HEADER_N}.${PCH_FE} PARENT_SCOPE) # Use the header for every target
SET(INCLUDE_FLAGS ${INCLUDE_FLAGS_LIST} PARENT_SCOPE) foreach(TARGET_NAME ${TARGET_NAME_LIST})
ENDFUNCTION(GET_COMMON_PCH_PARAMS) # Disable unity builds
set_target_properties(${TARGET_NAME} PROPERTIES COTIRE_ADD_UNITY_BUILD OFF)
FUNCTION(GENERATE_CXX_PCH_COMMAND TARGET_NAME INCLUDE_FLAGS IN PCH_SRC OUT) # Set the prefix header
IF (CMAKE_BUILD_TYPE) set_target_properties(${TARGET_NAME} PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT ${PCH_HEADER})
STRING(TOUPPER _${CMAKE_BUILD_TYPE} CURRENT_BUILD_TYPE)
ENDIF ()
SET(COMPILE_FLAGS ${CMAKE_CXX_FLAGS${CURRENT_BUILD_TYPE}}) # Workaround for cotire bug: https://github.com/sakra/cotire/issues/138
LIST(APPEND COMPILE_FLAGS ${CMAKE_CXX_FLAGS}) set_property(TARGET ${TARGET_NAME} PROPERTY CXX_STANDARD 14)
endforeach()
IF ("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin") cotire(${TARGET_NAME_LIST})
IF (NOT "${CMAKE_OSX_ARCHITECTURES}" STREQUAL "") endfunction(ADD_CXX_PCH)
LIST(APPEND COMPILE_FLAGS "-arch ${CMAKE_OSX_ARCHITECTURES}")
ENDIF ()
IF (NOT "${CMAKE_OSX_SYSROOT}" STREQUAL "")
LIST(APPEND COMPILE_FLAGS "-isysroot ${CMAKE_OSX_SYSROOT}")
ENDIF ()
IF (NOT "${CMAKE_OSX_DEPLOYMENT_TARGET}" STREQUAL "")
LIST(APPEND COMPILE_FLAGS "-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
ENDIF ()
ENDIF ()
GET_DIRECTORY_PROPERTY(TARGET_DEFINITIONS COMPILE_DEFINITIONS)
FOREACH(ITEM ${TARGET_DEFINITIONS})
LIST(APPEND DEFINITION_FLAGS "-D${ITEM} ")
ENDFOREACH(ITEM)
SEPARATE_ARGUMENTS(COMPILE_FLAGS)
SEPARATE_ARGUMENTS(INCLUDE_FLAGS)
SEPARATE_ARGUMENTS(DEFINITION_FLAGS)
GET_FILENAME_COMPONENT(PCH_SRC_N ${PCH_SRC} NAME)
ADD_LIBRARY(${PCH_SRC_N}_dephelp MODULE ${PCH_SRC})
ADD_CUSTOM_COMMAND(
OUTPUT ${OUT}
COMMAND ${CMAKE_CXX_COMPILER}
ARGS ${DEFINITION_FLAGS} ${COMPILE_FLAGS} ${INCLUDE_FLAGS} -x c++-header ${IN} -o ${OUT}
DEPENDS ${IN} ${PCH_SRC_N}_dephelp
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
ADD_CUSTOM_TARGET(generate_${PCH_SRC_N}
DEPENDS ${OUT}
)
ADD_DEPENDENCIES(${TARGET_NAME} generate_${PCH_SRC_N})
ENDFUNCTION(GENERATE_CXX_PCH_COMMAND)
FUNCTION(ADD_CXX_PCH_GCC TARGET_NAME PCH_HEADER PCH_SOURCE)
GET_COMMON_PCH_PARAMS(${PCH_HEADER} "gch" "-I")
GENERATE_CXX_PCH_COMMAND(${TARGET_NAME} "${INCLUDE_FLAGS}" ${PCH_HEADER} ${PCH_SOURCE} ${PCH_HEADER_OUT})
SET_TARGET_PROPERTIES(
${TARGET_NAME} PROPERTIES
COMPILE_FLAGS "-include ${CMAKE_CURRENT_BINARY_DIR}/${PCH_HEADER_NAME}"
)
ENDFUNCTION(ADD_CXX_PCH_GCC)
FUNCTION(ADD_CXX_PCH_CLANG TARGET_NAME PCH_HEADER PCH_SOURCE)
GET_COMMON_PCH_PARAMS(${PCH_HEADER} "pch" "-I")
GENERATE_CXX_PCH_COMMAND(${TARGET_NAME} "${INCLUDE_FLAGS}" ${PCH_HEADER} ${PCH_SOURCE} ${PCH_HEADER_OUT})
SET_TARGET_PROPERTIES(
${TARGET_NAME} PROPERTIES
COMPILE_FLAGS "-include-pch ${PCH_HEADER_OUT}"
)
ENDFUNCTION(ADD_CXX_PCH_CLANG)
FUNCTION(ADD_CXX_PCH_MSVC TARGET_NAME PCH_HEADER PCH_SOURCE)
GET_COMMON_PCH_PARAMS(${PCH_HEADER} "pch" "/I")
SET_TARGET_PROPERTIES(
${TARGET_NAME} PROPERTIES
COMPILE_FLAGS "/FI${PCH_HEADER_NAME} /Yu${PCH_HEADER_NAME}"
)
SET_SOURCE_FILES_PROPERTIES(
${PCH_SOURCE} PROPERTIES
COMPILE_FLAGS "/Yc${PCH_HEADER_NAME}"
)
ENDFUNCTION(ADD_CXX_PCH_MSVC)
FUNCTION(ADD_CXX_PCH TARGET_NAME PCH_HEADER PCH_SOURCE)
IF (MSVC)
ADD_CXX_PCH_MSVC(${TARGET_NAME} ${PCH_HEADER} ${PCH_SOURCE})
ELSEIF ("${CMAKE_GENERATOR}" MATCHES "Xcode")
SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES
XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER YES
XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/${PCH_HEADER}"
)
ELSEIF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
ADD_CXX_PCH_CLANG(${TARGET_NAME} ${PCH_HEADER} ${PCH_SOURCE})
ELSEIF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
ADD_CXX_PCH_GCC(${TARGET_NAME} ${PCH_HEADER} ${PCH_SOURCE})
ENDIF ()
ENDFUNCTION(ADD_CXX_PCH)

View File

@@ -1,18 +0,0 @@
# find Readline (terminal input library) includes and library
#
# READLINE_INCLUDE_DIR - where the directory containing the READLINE headers can be found
# READLINE_LIBRARY - full path to the READLINE library
# READLINE_FOUND - TRUE if READLINE was found
FIND_PATH(READLINE_INCLUDE_DIR readline/readline.h)
FIND_LIBRARY(READLINE_LIBRARY NAMES readline)
IF (READLINE_INCLUDE_DIR AND READLINE_LIBRARY)
SET(READLINE_FOUND TRUE)
MESSAGE(STATUS "Found Readline library: ${READLINE_LIBRARY}")
MESSAGE(STATUS "Include dir is: ${READLINE_INCLUDE_DIR}")
INCLUDE_DIRECTORIES(${READLINE_INCLUDE_DIR})
ELSE (READLINE_INCLUDE_DIR AND READLINE_LIBRARY)
SET(READLINE_FOUND FALSE)
MESSAGE(FATAL_ERROR "** Readline library not found!\n** Your distro may provide a binary for Readline e.g. for ubuntu try apt-get install libreadline5-dev")
ENDIF (READLINE_INCLUDE_DIR AND READLINE_LIBRARY)

View File

@@ -4,8 +4,6 @@ option(USE_MYSQL_SOURCES "Use included MySQL-sources to build libraries" 0)
# Package overloads # Package overloads
set(ACE_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/deps/acelite) set(ACE_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/deps/acelite)
set(ACE_LIBRARY "ace") set(ACE_LIBRARY "ace")
set(BZIP2_LIBRARIES "bzip2")
set(ZLIB_LIBRARIES "zlib")
if( USE_MYSQL_SOURCES ) if( USE_MYSQL_SOURCES )
set(MYSQL_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/deps/mysqllite/include) set(MYSQL_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/deps/mysqllite/include)

View File

@@ -8,91 +8,65 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
if( USE_COREPCH ) CollectSourceFiles(
include_directories(${CMAKE_CURRENT_BINARY_DIR}) ${CMAKE_CURRENT_SOURCE_DIR}
endif() PRIVATE_SOURCES
# Exclude
file(GLOB_RECURSE sources_Configuration Configuration/*.cpp Configuration/*.h) ${CMAKE_CURRENT_SOURCE_DIR}/Debugging
file(GLOB_RECURSE sources_Cryptography Cryptography/*.cpp Cryptography/*.h) ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
file(GLOB_RECURSE sources_Database Database/*.cpp Database/*.h)
file(GLOB_RECURSE sources_DataStores DataStores/*.cpp DataStores/*.h)
file(GLOB_RECURSE sources_Dynamic Dynamic/*.cpp Dynamic/*.h)
file(GLOB_RECURSE sources_Logging Logging/*.cpp Logging/*.h)
file(GLOB_RECURSE sources_Packets Packets/*.cpp Packets/*.h)
file(GLOB_RECURSE sources_Threading Threading/*.cpp Threading/*.h)
file(GLOB_RECURSE sources_Utilities Utilities/*.cpp Utilities/*.h)
file(GLOB sources_localdir *.cpp *.h)
# Manually set sources for Debugging directory as we don't want to include WheatyExceptionReport in shared project # Manually set sources for Debugging directory as we don't want to include WheatyExceptionReport in shared project
# It needs to be included both in authserver and worldserver for the static global variable to be properly initialized # It needs to be included both in authserver and worldserver for the static global variable to be properly initialized
# and to handle crash logs on windows # and to handle crash logs on windows
set(sources_Debugging Debugging/Errors.cpp Debugging/Errors.h) list(APPEND PRIVATE_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/Debugging/Errors.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/Debugging/Errors.h)
# Build shared sourcelist
#
if (USE_COREPCH) if (USE_COREPCH)
set(shared_STAT_PCH_HDR PrecompiledHeaders/sharedPCH.h) set(PRIVATE_PCH_HEADER PrecompiledHeaders/sharedPCH.h)
set(shared_STAT_PCH_SRC PrecompiledHeaders/sharedPCH.cpp)
endif() endif()
set(shared_STAT_SRCS
${shared_STAT_SRCS}
${sources_Configuration}
${sources_Cryptography}
${sources_Database}
${sources_DataStores}
${sources_Debugging}
${sources_Dynamic}
${sources_Logging}
${sources_Packets}
${sources_Threading}
${sources_Utilities}
${sources_localdir}
Debugging/Errors.h
)
include_directories(
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/deps/recastnavigation/Detour
${CMAKE_SOURCE_DIR}/deps/SFMT
${CMAKE_SOURCE_DIR}/deps/sockets/include
${CMAKE_SOURCE_DIR}/deps/utf8cpp
${CMAKE_SOURCE_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/Configuration
${CMAKE_CURRENT_SOURCE_DIR}/Cryptography
${CMAKE_CURRENT_SOURCE_DIR}/Database
${CMAKE_CURRENT_SOURCE_DIR}/DataStores
${CMAKE_CURRENT_SOURCE_DIR}/Debugging
${CMAKE_CURRENT_SOURCE_DIR}/Dynamic
${CMAKE_CURRENT_SOURCE_DIR}/Logging
${CMAKE_CURRENT_SOURCE_DIR}/Packets
${CMAKE_CURRENT_SOURCE_DIR}/Threading
${CMAKE_CURRENT_SOURCE_DIR}/Utilities
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Object
${ACE_INCLUDE_DIR}
${MYSQL_INCLUDE_DIR}
${OPENSSL_INCLUDE_DIR}
)
# Group sources # Group sources
GroupSources(${CMAKE_CURRENT_SOURCE_DIR}) GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
add_library(shared STATIC add_library(shared
${shared_STAT_SRCS} ${PRIVATE_SOURCES}
${shared_STAT_PCH_SRC}
) )
CollectIncludeDirectories(
${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC_INCLUDES
# Exclude
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
target_include_directories(shared
PUBLIC
# Provide the binary dir for all child targets
${CMAKE_BINARY_DIR}
${PUBLIC_INCLUDES}
PRIVATE
${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(shared target_link_libraries(shared
${ACE_LIBRARY} PRIVATE
) game-interface
PUBLIC
ace
mysql
g3dlib
Detour
sfmt
utf8cpp
openssl
threads
jemalloc)
set_target_properties(shared
PROPERTIES
FOLDER
"server")
# Generate precompiled header # Generate precompiled header
if (USE_COREPCH) if (USE_COREPCH)
add_cxx_pch(shared ${shared_STAT_PCH_HDR} ${shared_STAT_PCH_SRC}) add_cxx_pch(shared ${PRIVATE_PCH_HEADER})
endif () endif ()
add_subdirectory(Collision)

View File

@@ -1,93 +0,0 @@
# Copyright (C)
#
# 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.
if( USE_COREPCH )
include_directories(${CMAKE_CURRENT_BINARY_DIR})
endif()
file(GLOB_RECURSE sources_Management Management/*.cpp Management/*.h)
file(GLOB_RECURSE sources_Maps Maps/*.cpp Maps/*.h)
file(GLOB_RECURSE sources_Models Models/*.cpp Models/*.h)
file(GLOB sources_localdir *.cpp *.h)
if (USE_COREPCH)
set(collision_STAT_PCH_HDR PrecompiledHeaders/collisionPCH.h)
set(collision_STAT_PCH_SRC PrecompiledHeaders/collisionPCH.cpp)
endif ()
set(collision_STAT_SRCS
${collision_STAT_SRCS}
${sources_Management}
${sources_Maps}
${sources_Models}
${sources_localdir}
)
include_directories(
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/deps/g3dlite/include
${CMAKE_SOURCE_DIR}/deps/recastnavigation/Detour/Include
${CMAKE_SOURCE_DIR}/src/common/
${CMAKE_SOURCE_DIR}/src/common/Configuration
${CMAKE_SOURCE_DIR}/src/common/Debugging
${CMAKE_SOURCE_DIR}/src/common/Database
${CMAKE_SOURCE_DIR}/src/common/Debugging
${CMAKE_SOURCE_DIR}/src/common/Dynamic
${CMAKE_SOURCE_DIR}/src/common/Dynamic/LinkedReference
${CMAKE_SOURCE_DIR}/src/common/Logging
${CMAKE_SOURCE_DIR}/src/common/Threading
${CMAKE_SOURCE_DIR}/src/common/Packets
${CMAKE_SOURCE_DIR}/src/common/Utilities
${CMAKE_SOURCE_DIR}/src/common/DataStores
${CMAKE_SOURCE_DIR}/src/server/game/Addons
${CMAKE_SOURCE_DIR}/src/server/game/Conditions
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Item
${CMAKE_SOURCE_DIR}/src/server/game/Entities/GameObject
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Creature
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Object
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Object/Updates
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Unit
${CMAKE_SOURCE_DIR}/src/server/game/Combat
${CMAKE_SOURCE_DIR}/src/server/game/Loot
${CMAKE_SOURCE_DIR}/src/server/game/Miscellaneous
${CMAKE_SOURCE_DIR}/src/server/game/Grids
${CMAKE_SOURCE_DIR}/src/server/game/Grids/Cells
${CMAKE_SOURCE_DIR}/src/server/game/Grids/Notifiers
${CMAKE_SOURCE_DIR}/src/server/game/Maps
${CMAKE_SOURCE_DIR}/src/server/game/DataStores
${CMAKE_SOURCE_DIR}/src/server/game/Movement/Waypoints
${CMAKE_SOURCE_DIR}/src/server/game/Movement/Spline
${CMAKE_SOURCE_DIR}/src/server/game/Movement
${CMAKE_SOURCE_DIR}/src/server/game/Server
${CMAKE_SOURCE_DIR}/src/server/game/Server/Protocol
${CMAKE_SOURCE_DIR}/src/server/game/World
${CMAKE_SOURCE_DIR}/src/server/game/Spells
${CMAKE_SOURCE_DIR}/src/server/game/Spells/Auras
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/Management
${CMAKE_CURRENT_SOURCE_DIR}/Maps
${CMAKE_CURRENT_SOURCE_DIR}/Models
${ACE_INCLUDE_DIR}
${MYSQL_INCLUDE_DIR}
)
add_library(collision STATIC
${collision_STAT_SRCS}
${collision_STAT_PCH_SRC}
)
target_link_libraries(collision
shared
)
# Generate precompiled header
if (USE_COREPCH)
add_cxx_pch(collision ${collision_STAT_PCH_HDR} ${collision_STAT_PCH_SRC})
endif ()

View File

@@ -1 +0,0 @@
#include "collisionPCH.h"

View File

@@ -1,9 +0,0 @@
#include "Define.h"
#include "VMapDefinitions.h"
#include "MapTree.h"
#include "WorldModel.h"
#include "ModelInstance.h"
#include "BoundingIntervalHierarchy.h"
#include "RegularGrid.h"
#include "BoundingIntervalHierarchyWrapper.h"
#include "GameObjectModel.h"

View File

@@ -1 +0,0 @@
#include "sharedPCH.h"

View File

@@ -13,3 +13,8 @@ add_custom_target(revision.h ALL
COMMAND ${CMAKE_COMMAND} -DBUILDDIR=${CMAKE_BINARY_DIR} -P ${CMAKE_SOURCE_DIR}/src/cmake/genrev.cmake COMMAND ${CMAKE_COMMAND} -DBUILDDIR=${CMAKE_BINARY_DIR} -P ${CMAKE_SOURCE_DIR}/src/cmake/genrev.cmake
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
) )
set_target_properties(revision.h
PROPERTIES
FOLDER
"server")

View File

@@ -1,4 +1,4 @@
# Copyright (C) # Copyright (C)
# #
# This file is free software; as a special exception the author gives # This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without # unlimited permission to copy and/or distribute it, with or without
@@ -10,63 +10,28 @@
########### authserver ############### ########### authserver ###############
file(GLOB_RECURSE sources_authentication Authentication/*.cpp Authentication/*.h) CollectSourceFiles(
file(GLOB_RECURSE sources_realms Realms/*.cpp Realms/*.h) ${CMAKE_CURRENT_SOURCE_DIR}
file(GLOB_RECURSE sources_server Server/*.cpp Server/*.h) PRIVATE_SOURCES
file(GLOB sources_localdir *.cpp *.h) # Exclude
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
if (USE_COREPCH)
set(authserver_PCH_HDR PrecompiledHeaders/authPCH.h)
set(authserver_PCH_SRC PrecompiledHeaders/authPCH.cpp)
endif()
set(authserver_SRCS
${authserver_SRCS}
${sources_authentication}
${sources_realms}
${sources_server}
${sources_localdir}
)
if( WIN32 ) if( WIN32 )
set(authserver_SRCS list(APPEND PRIVATE_SOURCES ${sources_windows})
${authserver_SRCS}
${sources_windows_Debugging}
)
if ( MSVC ) if ( MSVC )
set(authserver_SRCS list(APPEND PRIVATE_SOURCES authserver.rc)
${authserver_SRCS} endif()
authserver.rc
)
endif ()
endif() endif()
include_directories( if (USE_COREPCH)
${CMAKE_BINARY_DIR} set(PRIVATE_PCH_HEADER PrecompiledHeaders/authPCH.h)
${CMAKE_SOURCE_DIR}/src/common endif()
${CMAKE_SOURCE_DIR}/src/common/Database
${CMAKE_SOURCE_DIR}/src/common/Debugging
${CMAKE_SOURCE_DIR}/src/common/Packets
${CMAKE_SOURCE_DIR}/src/common/Cryptography
${CMAKE_SOURCE_DIR}/src/common/Cryptography/Authentication
${CMAKE_SOURCE_DIR}/src/common/Logging
${CMAKE_SOURCE_DIR}/src/common/Threading
${CMAKE_SOURCE_DIR}/src/common/Utilities
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/Authentication
${CMAKE_CURRENT_SOURCE_DIR}/Realms
${CMAKE_CURRENT_SOURCE_DIR}/Server
${ACE_INCLUDE_DIR}
${MYSQL_INCLUDE_DIR}
${OPENSSL_INCLUDE_DIR}
)
# Group sources # Group sources
GroupSources(${CMAKE_CURRENT_SOURCE_DIR}) GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
add_executable(authserver add_executable(authserver
${authserver_SRCS} ${PRIVATE_SOURCES}
${authserver_PCH_SRC}
) )
add_dependencies(authserver revision.h) add_dependencies(authserver revision.h)
@@ -78,13 +43,27 @@ if( NOT WIN32 )
endif() endif()
target_link_libraries(authserver target_link_libraries(authserver
shared PUBLIC
${MYSQL_LIBRARY} shared
${OPENSSL_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${ACE_LIBRARY}
) )
CollectIncludeDirectories(
${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC_INCLUDES
# Exclude
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
target_include_directories(authserver
PUBLIC
${PUBLIC_INCLUDES}
PRIVATE
${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(authserver
PROPERTIES
FOLDER
"server")
if( WIN32 ) if( WIN32 )
if ( MSVC ) if ( MSVC )
add_custom_command(TARGET authserver add_custom_command(TARGET authserver
@@ -109,7 +88,7 @@ install(FILES authserver.conf.dist DESTINATION ${CONF_DIR})
# Generate precompiled header # Generate precompiled header
if (USE_COREPCH) if (USE_COREPCH)
add_cxx_pch(authserver ${authserver_PCH_HDR} ${authserver_PCH_SRC}) add_cxx_pch(authserver ${PRIVATE_PCH_HEADER})
endif() endif()
CU_RUN_HOOK("AFTER_AUTHSERVER_CMAKE") CU_RUN_HOOK("AFTER_AUTHSERVER_CMAKE")

View File

@@ -1 +0,0 @@
#include "authPCH.h"

View File

@@ -10,225 +10,57 @@
CU_RUN_HOOK(BEFORE_GAME_LIBRARY) CU_RUN_HOOK(BEFORE_GAME_LIBRARY)
file(GLOB_RECURSE sources_Accounts Accounts/*.cpp Accounts/*.h) CollectSourceFiles(
file(GLOB_RECURSE sources_Achievements Achievements/*.cpp Achievements/*.h) ${CMAKE_CURRENT_SOURCE_DIR}
file(GLOB_RECURSE sources_Addons Addons/*.cpp Addons/*.h) PRIVATE_SOURCES
file(GLOB_RECURSE sources_AI AI/*.cpp AI/*.h) # Exclude
file(GLOB_RECURSE sources_AuctionHouse AuctionHouse/*.cpp AuctionHouse/*.h) ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
file(GLOB_RECURSE sources_Battlefield Battlefield/*.cpp Battlefield/*.h)
file(GLOB_RECURSE sources_Battlegrounds Battlegrounds/*.cpp Battlegrounds/*.h)
file(GLOB_RECURSE sources_Calendar Calendar/*.cpp Calendar/*.h)
file(GLOB_RECURSE sources_Chat Chat/*.cpp Chat/*.h)
file(GLOB_RECURSE sources_Combat Combat/*.cpp Combat/*.h)
file(GLOB_RECURSE sources_Conditions Conditions/*.cpp Conditions/*.h)
file(GLOB_RECURSE sources_DataStores DataStores/*.cpp DataStores/*.h)
file(GLOB_RECURSE sources_DungeonFinding DungeonFinding/*.cpp DungeonFinding/*.h)
file(GLOB_RECURSE sources_Entities Entities/*.cpp Entities/*.h)
file(GLOB_RECURSE sources_Events Events/*.cpp Events/*.h)
file(GLOB_RECURSE sources_Globals Globals/*.cpp Globals/*.h)
file(GLOB_RECURSE sources_Grids Grids/*.cpp Grids/*.h)
file(GLOB_RECURSE sources_Groups Groups/*.cpp Groups/*.h)
file(GLOB_RECURSE sources_Guilds Guilds/*.cpp Guilds/*.h)
file(GLOB_RECURSE sources_Handlers Handlers/*.cpp Handlers/*.h)
file(GLOB_RECURSE sources_Instances Instances/*.cpp Instances/*.h)
file(GLOB_RECURSE sources_Loot Loot/*.cpp Loot/*.h)
file(GLOB_RECURSE sources_Mails Mails/*.cpp Mails/*.h)
file(GLOB_RECURSE sources_Maps Maps/*.cpp Maps/*.h)
file(GLOB_RECURSE sources_Miscellaneous Miscellaneous/*.cpp Miscellaneous/*.h)
file(GLOB_RECURSE sources_Motd Motd/*.cpp Motd/*.h)
file(GLOB_RECURSE sources_Movement Movement/*.cpp Movement/*.h)
file(GLOB_RECURSE sources_OutdoorPvP OutdoorPvP/*.cpp OutdoorPvP/*.h)
file(GLOB_RECURSE sources_Petitions Petitions/*.cpp Petitions/*.h)
file(GLOB_RECURSE sources_Pools Pools/*.cpp Pools/*.h)
file(GLOB_RECURSE sources_Quests Quests/*.cpp Quests/*.h)
file(GLOB_RECURSE sources_Reputation Reputation/*.cpp Reputation/*.h)
file(GLOB_RECURSE sources_Scripting Scripting/*.cpp Scripting/*.h)
file(GLOB_RECURSE sources_Server Server/*.cpp Server/*.h)
file(GLOB_RECURSE sources_Skills Skills/*.cpp Skills/*.h)
file(GLOB_RECURSE sources_Spells Spells/*.cpp Spells/*.h)
file(GLOB_RECURSE sources_Texts Texts/*.cpp Texts/*.h)
file(GLOB_RECURSE sources_Tools Tools/*.cpp Tools/*.h)
file(GLOB_RECURSE sources_Tickets Tickets/*.cpp Tickets/*.h)
file(GLOB_RECURSE sources_Warden Warden/*.cpp Warden/*.h)
file(GLOB_RECURSE sources_Weather Weather/*.cpp Weather/*.h)
file(GLOB_RECURSE sources_World World/*.cpp World/*.h)
file(GLOB_RECURSE sources_ArenaSpectator ArenaSpectator/*.cpp ArenaSpectator/*.h)
file(GLOB_RECURSE sources_Misc Misc/*.cpp Misc/*.h)
# Create game-libary
if (USE_COREPCH) if (USE_COREPCH)
set(game_STAT_PCH_HDR PrecompiledHeaders/gamePCH.h) set(PRIVATE_PCH_HEADER PrecompiledHeaders/gamePCH.h)
set(game_STAT_PCH_SRC PrecompiledHeaders/gamePCH.cpp)
endif () endif ()
set(game_STAT_SRCS
${game_STAT_SRCS}
${sources_Accounts}
${sources_Achievements}
${sources_Addons}
${sources_AI}
${sources_AuctionHouse}
${sources_Battlefield}
${sources_Battlegrounds}
${sources_Calendar}
${sources_Chat}
${sources_Combat}
${sources_Conditions}
${sources_DataStores}
${sources_DungeonFinding}
${sources_Entities}
${sources_Events}
${sources_Globals}
${sources_Grids}
${sources_Groups}
${sources_Guilds}
${sources_Handlers}
${sources_Instances}
${sources_Loot}
${sources_Mails}
${sources_Maps}
${sources_Miscellaneous}
${sources_Motd}
${sources_Movement}
${sources_OutdoorPvP}
${sources_Petitions}
${sources_Pools}
${sources_Quests}
${sources_Reputation}
${sources_Scripting}
${sources_Server}
${sources_Skills}
${sources_Spells}
${sources_Texts}
${sources_Tools}
${sources_Tickets}
${sources_Warden}
${sources_Weather}
${sources_World}
${sources_ArenaSpectator}
${sources_Misc}
)
include_directories(
${game_INCLUDE_DIRS}
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/deps/recastnavigation/Detour/Include
${CMAKE_SOURCE_DIR}/deps/recastnavigation/Recast/Include
${CMAKE_SOURCE_DIR}/deps/g3dlite/include
${CMAKE_SOURCE_DIR}/deps/SFMT
${CMAKE_SOURCE_DIR}/deps/zlib
${CMAKE_SOURCE_DIR}/src/common/Collision/
${CMAKE_SOURCE_DIR}/src/common/Collision/Management
${CMAKE_SOURCE_DIR}/src/common/Collision/Models
${CMAKE_SOURCE_DIR}/src/common/Collision/Maps
${CMAKE_SOURCE_DIR}/src/common
${CMAKE_SOURCE_DIR}/src/common/Configuration
${CMAKE_SOURCE_DIR}/src/common/Cryptography
${CMAKE_SOURCE_DIR}/src/common/Cryptography/Authentication
${CMAKE_SOURCE_DIR}/src/common/Database
${CMAKE_SOURCE_DIR}/src/common/DataStores
${CMAKE_SOURCE_DIR}/src/common/Debugging
${CMAKE_SOURCE_DIR}/src/common/Dynamic/LinkedReference
${CMAKE_SOURCE_DIR}/src/common/Dynamic
${CMAKE_SOURCE_DIR}/src/common/Logging
${CMAKE_SOURCE_DIR}/src/common/Packets
${CMAKE_SOURCE_DIR}/src/common/Threading
${CMAKE_SOURCE_DIR}/src/common/Utilities
${CMAKE_SOURCE_DIR}/src/server/game/Addons
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/Accounts
${CMAKE_CURRENT_SOURCE_DIR}/Achievements
${CMAKE_CURRENT_SOURCE_DIR}/AI
${CMAKE_CURRENT_SOURCE_DIR}/AI/CoreAI
${CMAKE_CURRENT_SOURCE_DIR}/AI/ScriptedAI
${CMAKE_CURRENT_SOURCE_DIR}/AI/SmartScripts
${CMAKE_CURRENT_SOURCE_DIR}/AuctionHouse
${CMAKE_CURRENT_SOURCE_DIR}/Battlefield
${CMAKE_CURRENT_SOURCE_DIR}/Battlefield/Zones
${CMAKE_CURRENT_SOURCE_DIR}/Battlegrounds
${CMAKE_CURRENT_SOURCE_DIR}/Battlegrounds/Zones
${CMAKE_CURRENT_SOURCE_DIR}/Calendar
${CMAKE_CURRENT_SOURCE_DIR}/Chat
${CMAKE_CURRENT_SOURCE_DIR}/Chat/Channels
${CMAKE_CURRENT_SOURCE_DIR}/Combat
${CMAKE_CURRENT_SOURCE_DIR}/Conditions
${CMAKE_CURRENT_SOURCE_DIR}/DataStores
${CMAKE_CURRENT_SOURCE_DIR}/DungeonFinding
${CMAKE_CURRENT_SOURCE_DIR}/Entities
${CMAKE_CURRENT_SOURCE_DIR}/Entities/Creature
${CMAKE_CURRENT_SOURCE_DIR}/Entities/Corpse
${CMAKE_CURRENT_SOURCE_DIR}/Entities/DynamicObject
${CMAKE_CURRENT_SOURCE_DIR}/Entities/GameObject
${CMAKE_CURRENT_SOURCE_DIR}/Entities/Item
${CMAKE_CURRENT_SOURCE_DIR}/Entities/Item/Container
${CMAKE_CURRENT_SOURCE_DIR}/Entities/Object
${CMAKE_CURRENT_SOURCE_DIR}/Entities/Object/Updates
${CMAKE_CURRENT_SOURCE_DIR}/Entities/Pet
${CMAKE_CURRENT_SOURCE_DIR}/Entities/Player
${CMAKE_CURRENT_SOURCE_DIR}/Entities/Totem
${CMAKE_CURRENT_SOURCE_DIR}/Entities/Unit
${CMAKE_CURRENT_SOURCE_DIR}/Entities/Vehicle
${CMAKE_CURRENT_SOURCE_DIR}/Entities/Transport
${CMAKE_CURRENT_SOURCE_DIR}/Events
${CMAKE_CURRENT_SOURCE_DIR}/Globals
${CMAKE_CURRENT_SOURCE_DIR}/Grids/Cells
${CMAKE_CURRENT_SOURCE_DIR}/Grids/Notifiers
${CMAKE_CURRENT_SOURCE_DIR}/Grids
${CMAKE_CURRENT_SOURCE_DIR}/Groups
${CMAKE_CURRENT_SOURCE_DIR}/Guilds
${CMAKE_CURRENT_SOURCE_DIR}/Handlers
${CMAKE_CURRENT_SOURCE_DIR}/Instances
${CMAKE_CURRENT_SOURCE_DIR}/Loot
${CMAKE_CURRENT_SOURCE_DIR}/Mails
${CMAKE_CURRENT_SOURCE_DIR}/Maps
${CMAKE_CURRENT_SOURCE_DIR}/Miscellaneous
${CMAKE_CURRENT_SOURCE_DIR}/Motd
${CMAKE_CURRENT_SOURCE_DIR}/Movement
${CMAKE_CURRENT_SOURCE_DIR}/Movement/Spline
${CMAKE_CURRENT_SOURCE_DIR}/Movement/MovementGenerators
${CMAKE_CURRENT_SOURCE_DIR}/Movement/Waypoints
${CMAKE_CURRENT_SOURCE_DIR}/OutdoorPvP
${CMAKE_CURRENT_SOURCE_DIR}/Petitions
${CMAKE_CURRENT_SOURCE_DIR}/Pools
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders
${CMAKE_CURRENT_SOURCE_DIR}/Quests
${CMAKE_CURRENT_SOURCE_DIR}/Reputation
${CMAKE_CURRENT_SOURCE_DIR}/Scripting
${CMAKE_CURRENT_SOURCE_DIR}/Server/Protocol
${CMAKE_CURRENT_SOURCE_DIR}/Server
${CMAKE_CURRENT_SOURCE_DIR}/Skills
${CMAKE_CURRENT_SOURCE_DIR}/Spells
${CMAKE_CURRENT_SOURCE_DIR}/Spells/Auras
${CMAKE_CURRENT_SOURCE_DIR}/Texts
${CMAKE_CURRENT_SOURCE_DIR}/Tools
${CMAKE_CURRENT_SOURCE_DIR}/Tickets
${CMAKE_CURRENT_SOURCE_DIR}/Warden
${CMAKE_CURRENT_SOURCE_DIR}/Warden/Modules
${CMAKE_CURRENT_SOURCE_DIR}/Weather
${CMAKE_CURRENT_SOURCE_DIR}/World
${CMAKE_CURRENT_SOURCE_DIR}/ArenaSpectator
${CMAKE_CURRENT_SOURCE_DIR}/Misc
${CMAKE_SOURCE_DIR}/src/server/scripts/
${CMAKE_SOURCE_DIR}/src/server/scripts/PrecompiledHeaders
${ACE_INCLUDE_DIR}
${MYSQL_INCLUDE_DIR}
${OPENSSL_INCLUDE_DIR}
)
# Group sources # Group sources
GroupSources(${CMAKE_CURRENT_SOURCE_DIR}) GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
add_library(game-interface INTERFACE)
CollectIncludeDirectories(
${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC_INCLUDES
# Exclude
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
target_include_directories(game-interface
INTERFACE
${PUBLIC_INCLUDES})
target_link_libraries(game-interface
INTERFACE
shared)
add_library(game STATIC add_library(game STATIC
${game_STAT_SRCS} ${PRIVATE_SOURCES})
${game_STAT_PCH_SRC}
)
add_dependencies(game revision.h) add_dependencies(game revision.h)
target_include_directories(game
PRIVATE
${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(game
PRIVATE
game-interface
scripts-interface)
set_target_properties(game
PROPERTIES
FOLDER
"server")
# Generate precompiled header # Generate precompiled header
if (USE_COREPCH) if (USE_COREPCH)
add_cxx_pch(game ${game_STAT_PCH_HDR} ${game_STAT_PCH_SRC}) add_cxx_pch(game ${PRIVATE_PCH_HEADER})
endif () endif ()
CU_RUN_HOOK(AFTER_GAME_LIBRARY) CU_RUN_HOOK(AFTER_GAME_LIBRARY)

View File

@@ -1 +0,0 @@
#include "gamePCH.h"

View File

@@ -14,14 +14,9 @@ CU_RUN_HOOK(BEFORE_SCRIPTS_LIBRARY)
CU_SET_PATH("AC_SCRIPTS_DIR" "${CMAKE_CURRENT_LIST_DIR}") CU_SET_PATH("AC_SCRIPTS_DIR" "${CMAKE_CURRENT_LIST_DIR}")
if (USE_SCRIPTPCH)
set(scripts_STAT_PCH_HDR PrecompiledHeaders/ScriptPCH.h)
set(scripts_STAT_PCH_SRC PrecompiledHeaders/ScriptPCH.cpp)
endif ()
message(STATUS "SCRIPT PREPARATIONS") message(STATUS "SCRIPT PREPARATIONS")
include(Spells/CMakeLists.txt)
include(Spells/CMakeLists.txt)
include(Commands/CMakeLists.txt) include(Commands/CMakeLists.txt)
set(scripts_STAT_SRCS set(scripts_STAT_SRCS
@@ -75,123 +70,50 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/GenLoader.cpp.cmake ${BUILDDIR}/GenLo
message(STATUS "SCRIPT PREPARATION COMPLETE") message(STATUS "SCRIPT PREPARATION COMPLETE")
message("") message("")
include_directories( if (USE_SCRIPTPCH)
${scripts_INCLUDE_DIRS} set(PRIVATE_PCH_HEADER PrecompiledHeaders/ScriptPCH.h)
${CMAKE_BINARY_DIR} endif ()
${CMAKE_SOURCE_DIR}/deps/recastnavigation/Detour/Include
${CMAKE_SOURCE_DIR}/deps/recastnavigation/Recast/Include
${CMAKE_SOURCE_DIR}/deps/g3dlite/include
${CMAKE_SOURCE_DIR}/deps/SFMT
${CMAKE_SOURCE_DIR}/deps/zlib
${CMAKE_SOURCE_DIR}/src/common
${CMAKE_SOURCE_DIR}/src/common/Configuration
${CMAKE_SOURCE_DIR}/src/common/Cryptography
${CMAKE_SOURCE_DIR}/src/common/Database
${CMAKE_SOURCE_DIR}/src/common/DataStores
${CMAKE_SOURCE_DIR}/src/common/Debugging
${CMAKE_SOURCE_DIR}/src/common/Dynamic/LinkedReference
${CMAKE_SOURCE_DIR}/src/common/Dynamic
${CMAKE_SOURCE_DIR}/src/common/Logging
${CMAKE_SOURCE_DIR}/src/common/Packets
${CMAKE_SOURCE_DIR}/src/common/Threading
${CMAKE_SOURCE_DIR}/src/common/Utilities
${CMAKE_SOURCE_DIR}/src/common/Collision/
${CMAKE_SOURCE_DIR}/src/common/Collision/Management
${CMAKE_SOURCE_DIR}/src/common/Collision/Models
${CMAKE_SOURCE_DIR}/src/common
${CMAKE_SOURCE_DIR}/src/common/Database
${CMAKE_SOURCE_DIR}/src/server/game/Addons
${CMAKE_SOURCE_DIR}/src/server/game/Accounts
${CMAKE_SOURCE_DIR}/src/server/game/Achievements
${CMAKE_SOURCE_DIR}/src/server/game/AI
${CMAKE_SOURCE_DIR}/src/server/game/AI/CoreAI
${CMAKE_SOURCE_DIR}/src/server/game/AI/ScriptedAI
${CMAKE_SOURCE_DIR}/src/server/game/AI/SmartScripts
${CMAKE_SOURCE_DIR}/src/server/game/AuctionHouse
${CMAKE_SOURCE_DIR}/src/server/game/Battlefield
${CMAKE_SOURCE_DIR}/src/server/game/Battlefield/Zones
${CMAKE_SOURCE_DIR}/src/server/game/Battlegrounds
${CMAKE_SOURCE_DIR}/src/server/game/Battlegrounds/Zones
${CMAKE_SOURCE_DIR}/src/server/game/Calendar
${CMAKE_SOURCE_DIR}/src/server/game/Chat
${CMAKE_SOURCE_DIR}/src/server/game/Chat/Channels
${CMAKE_SOURCE_DIR}/src/server/game/Conditions
${CMAKE_SOURCE_DIR}/src/common/Configuration
${CMAKE_SOURCE_DIR}/src/server/game/Combat
${CMAKE_SOURCE_DIR}/src/server/game/DataStores
${CMAKE_SOURCE_DIR}/src/server/game/DungeonFinding
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Corpse
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Creature
${CMAKE_SOURCE_DIR}/src/server/game/Entities/DynamicObject
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Item
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Item/Container
${CMAKE_SOURCE_DIR}/src/server/game/Entities/GameObject
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Object
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Object/Updates
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Pet
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Player
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Totem
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Transport
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Unit
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Vehicle
${CMAKE_SOURCE_DIR}/src/server/game/Events
${CMAKE_SOURCE_DIR}/src/server/game/Globals
${CMAKE_SOURCE_DIR}/src/server/game/Grids
${CMAKE_SOURCE_DIR}/src/server/game/Grids/Cells
${CMAKE_SOURCE_DIR}/src/server/game/Grids/Notifiers
${CMAKE_SOURCE_DIR}/src/server/game/Groups
${CMAKE_SOURCE_DIR}/src/server/game/Guilds
${CMAKE_SOURCE_DIR}/src/server/game/Handlers
${CMAKE_SOURCE_DIR}/src/server/game/Instances
${CMAKE_SOURCE_DIR}/src/server/game/LookingForGroup
${CMAKE_SOURCE_DIR}/src/server/game/Loot
${CMAKE_SOURCE_DIR}/src/server/game/Mails
${CMAKE_SOURCE_DIR}/src/server/game/Miscellaneous
${CMAKE_SOURCE_DIR}/src/server/game/Motd
${CMAKE_SOURCE_DIR}/src/server/game/Maps
${CMAKE_SOURCE_DIR}/src/server/game/Movement
${CMAKE_SOURCE_DIR}/src/server/game/Movement/MovementGenerators
${CMAKE_SOURCE_DIR}/src/server/game/Movement/Spline
${CMAKE_SOURCE_DIR}/src/server/game/Movement/Waypoints
${CMAKE_SOURCE_DIR}/src/server/game/Opcodes
${CMAKE_SOURCE_DIR}/src/server/game/OutdoorPvP
${CMAKE_SOURCE_DIR}/src/server/game/Petitions
${CMAKE_SOURCE_DIR}/src/server/game/Pools
${CMAKE_SOURCE_DIR}/src/server/game/PrecompiledHeaders
${CMAKE_SOURCE_DIR}/src/server/game/Quests
${CMAKE_SOURCE_DIR}/src/server/game/Reputation
${CMAKE_SOURCE_DIR}/src/server/game/Scripting
${CMAKE_SOURCE_DIR}/src/server/game/Server
${CMAKE_SOURCE_DIR}/src/server/game/Server/Protocol
${CMAKE_SOURCE_DIR}/src/server/game/Skills
${CMAKE_SOURCE_DIR}/src/server/game/Spells
${CMAKE_SOURCE_DIR}/src/server/game/Spells/Auras
${CMAKE_SOURCE_DIR}/src/server/game/Texts
${CMAKE_SOURCE_DIR}/src/server/game/Tickets
${CMAKE_SOURCE_DIR}/src/server/game/Tools
${CMAKE_SOURCE_DIR}/src/server/game/Warden
${CMAKE_SOURCE_DIR}/src/server/game/Warden/Modules
${CMAKE_SOURCE_DIR}/src/server/game/Weather
${CMAKE_SOURCE_DIR}/src/server/game/World
${CMAKE_SOURCE_DIR}/src/server/game/ArenaSpectator
${CMAKE_SOURCE_DIR}/src/server/game/Misc
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders
${ACE_INCLUDE_DIR}
${MYSQL_INCLUDE_DIR}
)
# Group sources # Group sources
GroupSources(${CMAKE_CURRENT_SOURCE_DIR}) GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
add_library(scripts-interface INTERFACE)
CollectIncludeDirectories(
${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC_INCLUDES
# Exclude
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
target_include_directories(scripts-interface
INTERFACE
${PUBLIC_INCLUDES})
target_link_libraries(scripts-interface
INTERFACE
shared)
add_library(scripts STATIC add_library(scripts STATIC
${scripts_STAT_SRCS} ${scripts_STAT_SRCS}
${scripts_STAT_PCH_SRC}
) )
target_include_directories(scripts
PRIVATE
${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(scripts
PRIVATE
scripts-interface
game-interface)
set_target_properties(scripts
PROPERTIES
FOLDER
"server")
add_dependencies(scripts revision.h) add_dependencies(scripts revision.h)
# Generate precompiled header # Generate precompiled header
if (USE_SCRIPTPCH) if (USE_SCRIPTPCH)
add_cxx_pch(scripts ${scripts_STAT_PCH_HDR} ${scripts_STAT_PCH_SRC}) add_cxx_pch(scripts ${PRIVATE_PCH_HEADER})
endif() endif()

View File

@@ -1,7 +0,0 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-GPL2
* Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
*/
#include "ScriptPCH.h"

View File

@@ -8,155 +8,114 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
file(GLOB_RECURSE sources_CommandLine CommandLine/*.cpp CommandLine/*.h) CollectSourceFiles(
file(GLOB_RECURSE sources_RemoteAccess RemoteAccess/*.cpp RemoteAccess/*.h) ${CMAKE_CURRENT_SOURCE_DIR}
file(GLOB_RECURSE sources_TCSoap TCSoap/*.cpp TCSoap/*.h) PRIVATE_SOURCES
file(GLOB_RECURSE sources_WorldThread WorldThread/*.cpp WorldThread/*.h) # Exclude
file(GLOB sources_localdir *.cpp *.h) ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
if (USE_COREPCH)
set(worldserver_PCH_HDR PrecompiledHeaders/worldPCH.h)
set(worldserver_PCH_SRC PrecompiledHeaders/worldPCH.cpp)
endif()
set(worldserver_SRCS
${worldserver_SRCS}
${sources_CommandLine}
${sources_RemoteAccess}
${sources_TCSoap}
${sources_WorldThread}
${sources_localdir}
)
if( WIN32 ) if( WIN32 )
set(worldserver_SRCS list(APPEND PRIVATE_SOURCES ${sources_windows})
${worldserver_SRCS}
${sources_windows_Debugging}
)
if ( MSVC ) if ( MSVC )
set(worldserver_SRCS list(APPEND PRIVATE_SOURCES worldserver.rc)
${worldserver_SRCS}
worldserver.rc
)
endif() endif()
endif() endif()
include_directories( if (USE_COREPCH)
${CMAKE_BINARY_DIR} set(PRIVATE_PCH_HEADER PrecompiledHeaders/worldPCH.h)
${CMAKE_SOURCE_DIR}/deps/g3dlite/include endif()
${CMAKE_SOURCE_DIR}/deps/recastnavigation/Detour/Include
${CMAKE_SOURCE_DIR}/deps/gsoap
${CMAKE_SOURCE_DIR}/deps/sockets/include
${CMAKE_SOURCE_DIR}/deps/SFMT
${CMAKE_SOURCE_DIR}/src/common/Collision/
${CMAKE_SOURCE_DIR}/src/common/Collision/Management
${CMAKE_SOURCE_DIR}/src/common/Collision/Models
${CMAKE_SOURCE_DIR}/src/common
${CMAKE_SOURCE_DIR}/src/common/Configuration
${CMAKE_SOURCE_DIR}/src/common/Cryptography
${CMAKE_SOURCE_DIR}/src/common/Cryptography/Authentication
${CMAKE_SOURCE_DIR}/src/common/Database
${CMAKE_SOURCE_DIR}/src/common/DataStores
${CMAKE_SOURCE_DIR}/src/common/Debugging
${CMAKE_SOURCE_DIR}/src/common/Dynamic/LinkedReference
${CMAKE_SOURCE_DIR}/src/common/Dynamic
${CMAKE_SOURCE_DIR}/src/common/Logging
${CMAKE_SOURCE_DIR}/src/common/Packets
${CMAKE_SOURCE_DIR}/src/common/Threading
${CMAKE_SOURCE_DIR}/src/common/Utilities
${CMAKE_SOURCE_DIR}/src/server/game/Addons
${game_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/src/server/game
${CMAKE_SOURCE_DIR}/src/server/game/Accounts
${CMAKE_SOURCE_DIR}/src/server/game/Achievements
${CMAKE_SOURCE_DIR}/src/server/game/AI
${CMAKE_SOURCE_DIR}/src/server/game/AI/CoreAI
${CMAKE_SOURCE_DIR}/src/server/game/AI/ScriptedAI
${CMAKE_SOURCE_DIR}/src/server/game/AI/SmartScripts
${CMAKE_SOURCE_DIR}/src/server/game/AuctionHouse
${CMAKE_SOURCE_DIR}/src/server/game/AuctionHouse/AuctionHouseBot
${CMAKE_SOURCE_DIR}/src/server/game/Battlefield
${CMAKE_SOURCE_DIR}/src/server/game/Battlefield/Zones
${CMAKE_SOURCE_DIR}/src/server/game/Battlegrounds
${CMAKE_SOURCE_DIR}/src/server/game/Battlegrounds/Zones
${CMAKE_SOURCE_DIR}/src/server/game/Calendar
${CMAKE_SOURCE_DIR}/src/server/game/Chat
${CMAKE_SOURCE_DIR}/src/server/game/Chat/Channels
${CMAKE_SOURCE_DIR}/src/server/game/Combat
${CMAKE_SOURCE_DIR}/src/server/game/Conditions
${CMAKE_SOURCE_DIR}/src/server/game/DataStores
${CMAKE_SOURCE_DIR}/src/server/game/DungeonFinding
${CMAKE_SOURCE_DIR}/src/server/game/Entities
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Creature
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Corpse
${CMAKE_SOURCE_DIR}/src/server/game/Entities/DynamicObject
${CMAKE_SOURCE_DIR}/src/server/game/Entities/GameObject
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Item
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Item/Container
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Object
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Object/Updates
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Pet
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Player
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Totem
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Unit
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Vehicle
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Transport
${CMAKE_SOURCE_DIR}/src/server/game/Events
${CMAKE_SOURCE_DIR}/src/server/game/Globals
${CMAKE_SOURCE_DIR}/src/server/game/Grids/Cells
${CMAKE_SOURCE_DIR}/src/server/game/Grids/Notifiers
${CMAKE_SOURCE_DIR}/src/server/game/Grids
${CMAKE_SOURCE_DIR}/src/server/game/Groups
${CMAKE_SOURCE_DIR}/src/server/game/Guilds
${CMAKE_SOURCE_DIR}/src/server/game/Handlers
${CMAKE_SOURCE_DIR}/src/server/game/Instances
${CMAKE_SOURCE_DIR}/src/server/game/Loot
${CMAKE_SOURCE_DIR}/src/server/game/Mails
${CMAKE_SOURCE_DIR}/src/server/game/Maps
${CMAKE_SOURCE_DIR}/src/server/game/Miscellaneous
${CMAKE_SOURCE_DIR}/src/server/game/Motd
${CMAKE_SOURCE_DIR}/src/server/game/Movement
${CMAKE_SOURCE_DIR}/src/server/game/Movement/Spline
${CMAKE_SOURCE_DIR}/src/server/game/Movement/MovementGenerators
${CMAKE_SOURCE_DIR}/src/server/game/Movement/Waypoints
${CMAKE_SOURCE_DIR}/src/server/game/OutdoorPvP
${CMAKE_SOURCE_DIR}/src/server/game/Pools
${CMAKE_SOURCE_DIR}/src/server/game/PrecompiledHeaders
${CMAKE_SOURCE_DIR}/src/server/game/Quests
${CMAKE_SOURCE_DIR}/src/server/game/Reputation
${CMAKE_SOURCE_DIR}/src/server/game/Scripting
${CMAKE_SOURCE_DIR}/src/server/game/Server/Protocol
${CMAKE_SOURCE_DIR}/src/server/game/Server
${CMAKE_SOURCE_DIR}/src/server/game/Skills
${CMAKE_SOURCE_DIR}/src/server/game/Spells
${CMAKE_SOURCE_DIR}/src/server/game/Spells/Auras
${CMAKE_SOURCE_DIR}/src/server/game/Tools
${CMAKE_SOURCE_DIR}/src/server/game/Warden
${CMAKE_SOURCE_DIR}/src/server/game/Warden/Modules
${CMAKE_SOURCE_DIR}/src/server/game/Weather
${CMAKE_SOURCE_DIR}/src/server/game/World
${CMAKE_SOURCE_DIR}/src/server/game/Misc
${CMAKE_SOURCE_DIR}/src/server/scripts/PrecompiledHeaders
${CMAKE_SOURCE_DIR}/src/server/authserver/Server
${CMAKE_SOURCE_DIR}/src/server/authserver/Realms
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/CommandLine
${CMAKE_CURRENT_SOURCE_DIR}/RemoteAccess
${CMAKE_CURRENT_SOURCE_DIR}/TCSoap
${CMAKE_CURRENT_SOURCE_DIR}/WorldThread
${ACE_INCLUDE_DIR}
${MYSQL_INCLUDE_DIR}
${OPENSSL_INCLUDE_DIR}
)
add_executable(worldserver
${worldserver_SRCS}
${worldserver_PCH_SRC}
)
# Group sources # Group sources
GroupSources(${CMAKE_CURRENT_SOURCE_DIR}) GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
add_executable(worldserver
${PRIVATE_SOURCES})
CollectIncludeDirectories(
${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC_INCLUDES
# Exclude
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
target_include_directories(worldserver
PUBLIC
${PUBLIC_INCLUDES}
PRIVATE
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_SOURCE_DIR}/src/server/game
${CMAKE_SOURCE_DIR}/src/server/game/Accounts
${CMAKE_SOURCE_DIR}/src/server/game/Achievements
${CMAKE_SOURCE_DIR}/src/server/game/AI
${CMAKE_SOURCE_DIR}/src/server/game/AI/CoreAI
${CMAKE_SOURCE_DIR}/src/server/game/AI/ScriptedAI
${CMAKE_SOURCE_DIR}/src/server/game/AI/SmartScripts
${CMAKE_SOURCE_DIR}/src/server/game/AuctionHouse
${CMAKE_SOURCE_DIR}/src/server/game/AuctionHouse/AuctionHouseBot
${CMAKE_SOURCE_DIR}/src/server/game/Battlefield
${CMAKE_SOURCE_DIR}/src/server/game/Battlefield/Zones
${CMAKE_SOURCE_DIR}/src/server/game/Battlegrounds
${CMAKE_SOURCE_DIR}/src/server/game/Battlegrounds/Zones
${CMAKE_SOURCE_DIR}/src/server/game/Calendar
${CMAKE_SOURCE_DIR}/src/server/game/Chat
${CMAKE_SOURCE_DIR}/src/server/game/Chat/Channels
${CMAKE_SOURCE_DIR}/src/server/game/Combat
${CMAKE_SOURCE_DIR}/src/server/game/Conditions
${CMAKE_SOURCE_DIR}/src/server/game/DataStores
${CMAKE_SOURCE_DIR}/src/server/game/DungeonFinding
${CMAKE_SOURCE_DIR}/src/server/game/Entities
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Creature
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Corpse
${CMAKE_SOURCE_DIR}/src/server/game/Entities/DynamicObject
${CMAKE_SOURCE_DIR}/src/server/game/Entities/GameObject
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Item
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Item/Container
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Object
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Object/Updates
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Pet
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Player
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Totem
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Unit
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Vehicle
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Transport
${CMAKE_SOURCE_DIR}/src/server/game/Events
${CMAKE_SOURCE_DIR}/src/server/game/Globals
${CMAKE_SOURCE_DIR}/src/server/game/Grids/Cells
${CMAKE_SOURCE_DIR}/src/server/game/Grids/Notifiers
${CMAKE_SOURCE_DIR}/src/server/game/Grids
${CMAKE_SOURCE_DIR}/src/server/game/Groups
${CMAKE_SOURCE_DIR}/src/server/game/Guilds
${CMAKE_SOURCE_DIR}/src/server/game/Handlers
${CMAKE_SOURCE_DIR}/src/server/game/Instances
${CMAKE_SOURCE_DIR}/src/server/game/Loot
${CMAKE_SOURCE_DIR}/src/server/game/Mails
${CMAKE_SOURCE_DIR}/src/server/game/Maps
${CMAKE_SOURCE_DIR}/src/server/game/Miscellaneous
${CMAKE_SOURCE_DIR}/src/server/game/Motd
${CMAKE_SOURCE_DIR}/src/server/game/Movement
${CMAKE_SOURCE_DIR}/src/server/game/Movement/Spline
${CMAKE_SOURCE_DIR}/src/server/game/Movement/MovementGenerators
${CMAKE_SOURCE_DIR}/src/server/game/Movement/Waypoints
${CMAKE_SOURCE_DIR}/src/server/game/OutdoorPvP
${CMAKE_SOURCE_DIR}/src/server/game/Pools
${CMAKE_SOURCE_DIR}/src/server/game/PrecompiledHeaders
${CMAKE_SOURCE_DIR}/src/server/game/Quests
${CMAKE_SOURCE_DIR}/src/server/game/Reputation
${CMAKE_SOURCE_DIR}/src/server/game/Scripting
${CMAKE_SOURCE_DIR}/src/server/game/Server/Protocol
${CMAKE_SOURCE_DIR}/src/server/game/Server
${CMAKE_SOURCE_DIR}/src/server/game/Skills
${CMAKE_SOURCE_DIR}/src/server/game/Spells
${CMAKE_SOURCE_DIR}/src/server/game/Spells/Auras
${CMAKE_SOURCE_DIR}/src/server/game/Tools
${CMAKE_SOURCE_DIR}/src/server/game/Warden
${CMAKE_SOURCE_DIR}/src/server/game/Warden/Modules
${CMAKE_SOURCE_DIR}/src/server/game/Weather
${CMAKE_SOURCE_DIR}/src/server/game/World
${CMAKE_SOURCE_DIR}/src/server/game/Misc
${CMAKE_SOURCE_DIR}/src/server/scripts/PrecompiledHeaders
${CMAKE_SOURCE_DIR}/src/server/authserver/Server
${CMAKE_SOURCE_DIR}/src/server/authserver/Realms)
if( NOT WIN32 ) if( NOT WIN32 )
set_target_properties(worldserver PROPERTIES set_target_properties(worldserver PROPERTIES
COMPILE_DEFINITIONS _TRINITY_CORE_CONFIG="${CONF_DIR}/worldserver.conf" COMPILE_DEFINITIONS _TRINITY_CORE_CONFIG="${CONF_DIR}/worldserver.conf"
@@ -172,23 +131,18 @@ endif()
set_target_properties(worldserver PROPERTIES LINK_FLAGS "${worldserver_LINK_FLAGS}") set_target_properties(worldserver PROPERTIES LINK_FLAGS "${worldserver_LINK_FLAGS}")
target_link_libraries(worldserver target_link_libraries(worldserver
game PUBLIC
shared game
scripts shared
collision scripts
g3dlib gsoap
gsoap readline
Detour ${GPERFTOOLS_LIBRARIES})
${GPERFTOOLS_LIBRARIES}
${JEMALLOC_LIBRARY} set_target_properties(worldserver
${READLINE_LIBRARY} PROPERTIES
${TERMCAP_LIBRARY} FOLDER
${ACE_LIBRARY} "server")
${MYSQL_LIBRARY}
${OPENSSL_LIBRARIES}
${ZLIB_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
)
if( WIN32 ) if( WIN32 )
if ( MSVC ) if ( MSVC )
@@ -214,7 +168,7 @@ install(FILES worldserver.conf.dist DESTINATION ${CONF_DIR})
# Generate precompiled header # Generate precompiled header
if( USE_COREPCH ) if( USE_COREPCH )
add_cxx_pch(worldserver ${worldserver_PCH_HDR} ${worldserver_PCH_SRC}) add_cxx_pch(worldserver ${PRIVATE_PCH_HEADER})
endif() endif()
# handle config file # handle config file

View File

@@ -1 +0,0 @@
#include "worldPCH.h"

View File

@@ -9,35 +9,41 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
file(GLOB_RECURSE sources *.cpp *.h) CollectSourceFiles(
${CMAKE_CURRENT_SOURCE_DIR}
set(include_Dirs PRIVATE_SOURCES)
${CMAKE_SOURCE_DIR}/src/common/Utilities
${CMAKE_SOURCE_DIR}/src/common
${CMAKE_SOURCE_DIR}/deps/libmpq
${CMAKE_SOURCE_DIR}/deps/g3dlite/include
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/loadlib
)
if( WIN32 )
set(include_Dirs
${include_Dirs}
${CMAKE_SOURCE_DIR}/deps/libmpq/win
)
endif()
include_directories(${include_Dirs})
add_executable(mapextractor add_executable(mapextractor
${sources} ${PRIVATE_SOURCES}
) )
target_include_directories(mapextractor
PUBLIC
${CMAKE_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/loadlib)
target_link_libraries(mapextractor target_link_libraries(mapextractor
mpq PUBLIC
${BZIP2_LIBRARIES} shared
${ZLIB_LIBRARIES} mpq)
)
CollectIncludeDirectories(
${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC_INCLUDES)
# Group sources
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(mapextractor
PUBLIC
${PUBLIC_INCLUDES}
PRIVATE
${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(mapextractor
PROPERTIES
FOLDER
"tools")
if( UNIX ) if( UNIX )
install(TARGETS mapextractor DESTINATION bin) install(TARGETS mapextractor DESTINATION bin)

View File

@@ -9,39 +9,35 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
file(GLOB_RECURSE meshExtract_Sources *.cpp *.h) CollectSourceFiles(
set(include_Base
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/src/common
${CMAKE_SOURCE_DIR}/deps/recastnavigation/Recast
${CMAKE_SOURCE_DIR}/deps/recastnavigation/Detour
${CMAKE_SOURCE_DIR}/deps/libmpq
${CMAKE_SOURCE_DIR}/deps/g3dlite/include
${ACE_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
) PRIVATE_SOURCES)
if( WIN32 ) add_executable(MeshExtractor ${PRIVATE_SOURCES})
set(include_Base
${include_Base}
${CMAKE_SOURCE_DIR}/deps/libmpq/win
)
endif()
include_directories(${include_Base})
add_executable(MeshExtractor ${meshExtract_Sources})
target_link_libraries(MeshExtractor target_link_libraries(MeshExtractor
g3dlib PUBLIC
mpq shared
Recast Recast
Detour mpq)
${BZIP2_LIBRARIES}
${ZLIB_LIBRARIES} # Group sources
${ACE_LIBRARY} GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
)
CollectIncludeDirectories(
${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC_INCLUDES)
target_include_directories(MeshExtractor
PUBLIC
${PUBLIC_INCLUDES}
PRIVATE
${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(MeshExtractor
PROPERTIES
FOLDER
"tools")
if( UNIX ) if( UNIX )
install(TARGETS MeshExtractor DESTINATION bin) install(TARGETS MeshExtractor DESTINATION bin)

View File

@@ -8,130 +8,36 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
file(GLOB_RECURSE mmap_gen_sources *.cpp *.h) CollectSourceFiles(
${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE_SOURCES)
set(mmap_gen_Includes add_executable(mmaps_generator ${PRIVATE_SOURCES})
${CMAKE_BINARY_DIR}
${ACE_INCLUDE_DIR}
${MYSQL_INCLUDE_DIR}
${OPENSSL_INCLUDE_DIR}
${CMAKE_SOURCE_DIR}/deps/libmpq
${CMAKE_SOURCE_DIR}/deps/zlib
${CMAKE_SOURCE_DIR}/deps/bzip2
${CMAKE_SOURCE_DIR}/deps/g3dlite/include
${CMAKE_SOURCE_DIR}/deps/recastnavigation/Recast
${CMAKE_SOURCE_DIR}/deps/recastnavigation/Detour
${CMAKE_SOURCE_DIR}/src/common/Collision/
${CMAKE_SOURCE_DIR}/src/common/Collision/Management
${CMAKE_SOURCE_DIR}/src/common/Collision/Maps
${CMAKE_SOURCE_DIR}/src/common/Collision/Models
${CMAKE_SOURCE_DIR}/src/common
${CMAKE_SOURCE_DIR}/src/common/Configuration
${CMAKE_SOURCE_DIR}/src/common/Cryptography
${CMAKE_SOURCE_DIR}/src/common/Cryptography/Authentication
${CMAKE_SOURCE_DIR}/src/common/Database
${CMAKE_SOURCE_DIR}/src/common/DataStores
${CMAKE_SOURCE_DIR}/src/common/Debugging
${CMAKE_SOURCE_DIR}/src/common/Dynamic/LinkedReference
${CMAKE_SOURCE_DIR}/src/common/Dynamic
${CMAKE_SOURCE_DIR}/src/common/Logging
${CMAKE_SOURCE_DIR}/src/common/Packets
${CMAKE_SOURCE_DIR}/src/common/Threading
${CMAKE_SOURCE_DIR}/src/common/Utilities
${CMAKE_SOURCE_DIR}/src/server/game/Addons
${CMAKE_SOURCE_DIR}/src/server/game
${CMAKE_SOURCE_DIR}/src/server/game/Accounts
${CMAKE_SOURCE_DIR}/src/server/game/Achievements
${CMAKE_SOURCE_DIR}/src/server/game/AI
${CMAKE_SOURCE_DIR}/src/server/game/AI/CoreAI
${CMAKE_SOURCE_DIR}/src/server/game/AI/ScriptedAI
${CMAKE_SOURCE_DIR}/src/server/game/AI/SmartScripts
${CMAKE_SOURCE_DIR}/src/server/game/AuctionHouse
${CMAKE_SOURCE_DIR}/src/server/game/AuctionHouse/AuctionHouseBot
${CMAKE_SOURCE_DIR}/src/server/game/Battlefield
${CMAKE_SOURCE_DIR}/src/server/game/Battlefield/Zones
${CMAKE_SOURCE_DIR}/src/server/game/Battlegrounds
${CMAKE_SOURCE_DIR}/src/server/game/Battlegrounds/Zones
${CMAKE_SOURCE_DIR}/src/server/game/Calendar
${CMAKE_SOURCE_DIR}/src/server/game/Chat
${CMAKE_SOURCE_DIR}/src/server/game/Chat/Channels
${CMAKE_SOURCE_DIR}/src/server/game/Combat
${CMAKE_SOURCE_DIR}/src/server/game/Conditions
${CMAKE_SOURCE_DIR}/src/server/game/DataStores
${CMAKE_SOURCE_DIR}/src/server/game/DungeonFinding
${CMAKE_SOURCE_DIR}/src/server/game/Entities
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Creature
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Corpse
${CMAKE_SOURCE_DIR}/src/server/game/Entities/DynamicObject
${CMAKE_SOURCE_DIR}/src/server/game/Entities/GameObject
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Item
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Item/Container
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Object
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Object/Updates
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Pet
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Player
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Totem
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Unit
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Vehicle
${CMAKE_SOURCE_DIR}/src/server/game/Entities/Transport
${CMAKE_SOURCE_DIR}/src/server/game/Events
${CMAKE_SOURCE_DIR}/src/server/game/Globals
${CMAKE_SOURCE_DIR}/src/server/game/Grids/Cells
${CMAKE_SOURCE_DIR}/src/server/game/Grids/Notifiers
${CMAKE_SOURCE_DIR}/src/server/game/Grids
${CMAKE_SOURCE_DIR}/src/server/game/Groups
${CMAKE_SOURCE_DIR}/src/server/game/Guilds
${CMAKE_SOURCE_DIR}/src/server/game/Handlers
${CMAKE_SOURCE_DIR}/src/server/game/Instances
${CMAKE_SOURCE_DIR}/src/server/game/Loot
${CMAKE_SOURCE_DIR}/src/server/game/Mails
${CMAKE_SOURCE_DIR}/src/server/game/Maps
${CMAKE_SOURCE_DIR}/src/server/game/Miscellaneous
${CMAKE_SOURCE_DIR}/src/server/game/Movement
${CMAKE_SOURCE_DIR}/src/server/game/Movement/MovementGenerators
${CMAKE_SOURCE_DIR}/src/server/game/Movement/Waypoints
${CMAKE_SOURCE_DIR}/src/server/game/OutdoorPvP
${CMAKE_SOURCE_DIR}/src/server/game/Pools
${CMAKE_SOURCE_DIR}/src/server/game/PrecompiledHeaders
${CMAKE_SOURCE_DIR}/src/server/game/Quests
${CMAKE_SOURCE_DIR}/src/server/game/Reputation
${CMAKE_SOURCE_DIR}/src/server/game/Scripting
${CMAKE_SOURCE_DIR}/src/server/game/Server/Protocol
${CMAKE_SOURCE_DIR}/src/server/game/Server
${CMAKE_SOURCE_DIR}/src/server/game/Skills
${CMAKE_SOURCE_DIR}/src/server/game/Spells
${CMAKE_SOURCE_DIR}/src/server/game/Spells/Auras
${CMAKE_SOURCE_DIR}/src/server/game/Tools
${CMAKE_SOURCE_DIR}/src/server/game/Warden
${CMAKE_SOURCE_DIR}/src/server/game/Warden/Modules
${CMAKE_SOURCE_DIR}/src/server/game/Weather
${CMAKE_SOURCE_DIR}/src/server/game/World
)
if( WIN32 )
set(mmap_gen_Includes
${mmap_gen_Includes}
${CMAKE_SOURCE_DIR}/deps/libmpq/win
)
endif()
include_directories(${mmap_gen_Includes})
add_executable(mmaps_generator ${mmap_gen_sources})
target_link_libraries(mmaps_generator target_link_libraries(mmaps_generator
shared PUBLIC
collision shared
g3dlib Recast
Recast mpq)
Detour
${ACE_LIBRARY} # Group sources
${MYSQL_LIBRARY} GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
${OPENSSL_LIBRARIES}
${BZIP2_LIBRARIES} CollectIncludeDirectories(
${ZLIB_LIBRARIES} ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_THREAD_LIBS_INIT} PUBLIC_INCLUDES)
)
target_include_directories(mmaps_generator
PUBLIC
${PUBLIC_INCLUDES}
PRIVATE
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_SOURCE_DIR}/src/server/game/Conditions)
set_target_properties(mmaps_generator
PROPERTIES
FOLDER
"tools")
if( UNIX ) if( UNIX )
install(TARGETS mmaps_generator DESTINATION bin) install(TARGETS mmaps_generator DESTINATION bin)

View File

@@ -9,17 +9,6 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
include_directories(
${CMAKE_SOURCE_DIR}/deps/g3dlite/include
${CMAKE_SOURCE_DIR}/src/common
${CMAKE_SOURCE_DIR}/src/common/Debugging
${CMAKE_SOURCE_DIR}/src/common/Collision/
${CMAKE_SOURCE_DIR}/src/common/Collision/Maps
${CMAKE_SOURCE_DIR}/src/common/Collision/Models
${ACE_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR}
)
add_executable(vmap4assembler VMapAssembler.cpp) add_executable(vmap4assembler VMapAssembler.cpp)
if(CMAKE_SYSTEM_NAME MATCHES "Darwin") if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
@@ -27,10 +16,16 @@ if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
endif() endif()
target_link_libraries(vmap4assembler target_link_libraries(vmap4assembler
collision shared
g3dlib zlib)
${ZLIB_LIBRARIES}
) # Group sources
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
set_target_properties(vmap4assembler
PROPERTIES
FOLDER
"tools")
if( UNIX ) if( UNIX )
install(TARGETS vmap4assembler DESTINATION bin) install(TARGETS vmap4assembler DESTINATION bin)

View File

@@ -9,28 +9,33 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
file(GLOB_RECURSE sources *.cpp *.h) CollectSourceFiles(
${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE_SOURCES)
set(include_Dirs add_executable(vmap4extractor ${PRIVATE_SOURCES})
${CMAKE_SOURCE_DIR}/deps/libmpq
)
if( WIN32 )
set(include_Dirs
${include_Dirs}
${CMAKE_SOURCE_DIR}/deps/libmpq/win
)
endif()
include_directories(${include_Dirs})
add_executable(vmap4extractor ${sources})
target_link_libraries(vmap4extractor target_link_libraries(vmap4extractor
mpq PUBLIC
${BZIP2_LIBRARIES} mpq)
${ZLIB_LIBRARIES}
) # Group sources
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
CollectIncludeDirectories(
${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC_INCLUDES)
target_include_directories(vmap4extractor
PUBLIC
${PUBLIC_INCLUDES}
PRIVATE
${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(vmap4extractor
PROPERTIES
FOLDER
"tools")
if( UNIX ) if( UNIX )
install(TARGETS vmap4extractor DESTINATION bin) install(TARGETS vmap4extractor DESTINATION bin)