mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
CMake: Use inherited dependencies in database, shared and game
(cherry picked from commit 469f2d3ade)
This commit is contained in:
@@ -8,71 +8,46 @@
|
||||
# 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_Cryptography Cryptography/*.cpp Cryptography/*.h)
|
||||
file(GLOB_RECURSE sources_DataStores DataStores/*.cpp DataStores/*.h)
|
||||
file(GLOB_RECURSE sources_Dynamic Dynamic/*.cpp Dynamic/*.h)
|
||||
file(GLOB_RECURSE sources_Networking Networking/*.cpp Networking/*.h)
|
||||
file(GLOB_RECURSE sources_Packets Packets/*.cpp Packets/*.h)
|
||||
file(GLOB_RECURSE sources_Realm Realm/*.cpp Realm/*.h)
|
||||
|
||||
file(GLOB sources_localdir *.cpp *.h)
|
||||
|
||||
# Manually set sources for Debugging directory as we don't want to include WheatyExceptionReport in shared project
|
||||
# It needs to be included both in bnetserver 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
|
||||
#
|
||||
CollectSourceFiles(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
PRIVATE_SOURCES
|
||||
# Exclude
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
|
||||
|
||||
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)
|
||||
set(PRIVATE_PCH_SOURCE PrecompiledHeaders/sharedPCH.cpp)
|
||||
endif()
|
||||
|
||||
set(shared_STAT_SRCS
|
||||
${shared_STAT_SRCS}
|
||||
${sources_Cryptography}
|
||||
${sources_DataStores}
|
||||
${sources_Dynamic}
|
||||
${sources_Networking}
|
||||
${sources_Packets}
|
||||
${sources_Realm}
|
||||
${sources_Service}
|
||||
${sources_localdir}
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Dynamic
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Networking
|
||||
${CMAKE_SOURCE_DIR}/dep/cppformat
|
||||
${CMAKE_SOURCE_DIR}/src/common/
|
||||
${CMAKE_SOURCE_DIR}/src/common/Debugging
|
||||
${CMAKE_SOURCE_DIR}/src/common/Logging
|
||||
${CMAKE_SOURCE_DIR}/src/common/Threading
|
||||
${CMAKE_SOURCE_DIR}/src/common/Utilities
|
||||
${CMAKE_SOURCE_DIR}/src/server/database
|
||||
${CMAKE_SOURCE_DIR}/src/server/database/Database
|
||||
${MYSQL_INCLUDE_DIR}
|
||||
${OPENSSL_INCLUDE_DIR}
|
||||
${VALGRIND_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
add_library(shared STATIC
|
||||
${shared_STAT_SRCS}
|
||||
${shared_STAT_PCH_SRC}
|
||||
add_library(shared
|
||||
${PRIVATE_SOURCES}
|
||||
${PRIVATE_PCH_SOURCE}
|
||||
)
|
||||
|
||||
add_dependencies(shared revision_data.h)
|
||||
CollectIncludeDirectories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
PUBLIC_INCLUDES
|
||||
# Exclude
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
|
||||
|
||||
target_include_directories(shared
|
||||
PUBLIC
|
||||
${PUBLIC_INCLUDES}
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
target_link_libraries(shared
|
||||
PUBLIC
|
||||
database)
|
||||
|
||||
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} ${PRIVATE_PCH_SOURCE})
|
||||
endif ()
|
||||
|
||||
Reference in New Issue
Block a user