mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-18 03:15:41 +00:00
feat(Cmake): Rewrite build and use inherited dependencies (#1652)
This commit is contained in:
committed by
Francesco Borzì
parent
0f174eff01
commit
eae9affec9
@@ -8,91 +8,65 @@
|
||||
# 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_Configuration Configuration/*.cpp Configuration/*.h)
|
||||
file(GLOB_RECURSE sources_Cryptography Cryptography/*.cpp Cryptography/*.h)
|
||||
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)
|
||||
CollectSourceFiles(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
PRIVATE_SOURCES
|
||||
# Exclude
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Debugging
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
|
||||
|
||||
# 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
|
||||
# and to handle crash logs on windows
|
||||
set(sources_Debugging Debugging/Errors.cpp Debugging/Errors.h)
|
||||
|
||||
#
|
||||
# Build shared sourcelist
|
||||
#
|
||||
list(APPEND PRIVATE_SOURCES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Debugging/Errors.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Debugging/Errors.h)
|
||||
|
||||
if (USE_COREPCH)
|
||||
set(shared_STAT_PCH_HDR PrecompiledHeaders/sharedPCH.h)
|
||||
set(shared_STAT_PCH_SRC PrecompiledHeaders/sharedPCH.cpp)
|
||||
set(PRIVATE_PCH_HEADER PrecompiledHeaders/sharedPCH.h)
|
||||
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
|
||||
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
add_library(shared STATIC
|
||||
${shared_STAT_SRCS}
|
||||
${shared_STAT_PCH_SRC}
|
||||
add_library(shared
|
||||
${PRIVATE_SOURCES}
|
||||
)
|
||||
|
||||
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
|
||||
${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
|
||||
if (USE_COREPCH)
|
||||
add_cxx_pch(shared ${shared_STAT_PCH_HDR} ${shared_STAT_PCH_SRC})
|
||||
add_cxx_pch(shared ${PRIVATE_PCH_HEADER})
|
||||
endif ()
|
||||
|
||||
add_subdirectory(Collision)
|
||||
@@ -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 ()
|
||||
@@ -1 +0,0 @@
|
||||
#include "collisionPCH.h"
|
||||
@@ -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"
|
||||
@@ -1 +0,0 @@
|
||||
#include "sharedPCH.h"
|
||||
Reference in New Issue
Block a user