Build: CMake cleanup

* Migrate all add_definitions to target_compile_definitions
* Remove -D from preprocessor definitions added by target_compile_definitions (unneccessary, cmake strips it anyway)
* Fixed NO_BUFFERPOOL not being set on g3d if jemalloc is used
* Moved library/compiler specific compile flag settings spread all over various CMakeLists to their related library/compiler file
* Remove ancient manual link flag settings for worldserver
This commit is contained in:
Shauren
2024-07-15 15:24:35 +02:00
parent d4998bd04a
commit 77fe2745fe
24 changed files with 110 additions and 108 deletions
+1 -1
View File
@@ -35,7 +35,7 @@ if (NOT CLANG_HAVE_PROPER_CHARCONV)
message(STATUS "Clang: Detected from_chars bug for 64-bit integers, workaround enabled") message(STATUS "Clang: Detected from_chars bug for 64-bit integers, workaround enabled")
target_compile_definitions(trinity-compile-option-interface target_compile_definitions(trinity-compile-option-interface
INTERFACE INTERFACE
-DTRINITY_NEED_CHARCONV_WORKAROUND) TRINITY_NEED_CHARCONV_WORKAROUND)
endif() endif()
if(WITH_WARNINGS) if(WITH_WARNINGS)
+6 -2
View File
@@ -6,6 +6,10 @@ else()
message(STATUS "GCC: Minimum version required is ${GCC_EXPECTED_VERSION}, found ${CMAKE_CXX_COMPILER_VERSION} - ok!") message(STATUS "GCC: Minimum version required is ${GCC_EXPECTED_VERSION}, found ${CMAKE_CXX_COMPILER_VERSION} - ok!")
endif() endif()
target_compile_options(trinity-compile-option-interface
INTERFACE
-fno-delete-null-pointer-checks)
if(PLATFORM EQUAL 32) if(PLATFORM EQUAL 32)
# Required on 32-bit systems to enable SSE2 (standard on x64) # Required on 32-bit systems to enable SSE2 (standard on x64)
target_compile_options(trinity-compile-option-interface target_compile_options(trinity-compile-option-interface
@@ -16,8 +20,8 @@ endif()
if(TRINITY_SYSTEM_PROCESSOR MATCHES "x86|amd64") if(TRINITY_SYSTEM_PROCESSOR MATCHES "x86|amd64")
target_compile_definitions(trinity-compile-option-interface target_compile_definitions(trinity-compile-option-interface
INTERFACE INTERFACE
-DHAVE_SSE2 HAVE_SSE2
-D__SSE2__) __SSE2__)
message(STATUS "GCC: SFMT enabled, SSE2 flags forced") message(STATUS "GCC: SFMT enabled, SSE2 flags forced")
endif() endif()
-4
View File
@@ -1,7 +1,3 @@
target_compile_definitions(trinity-compile-option-interface
INTERFACE
-D_BUILD_DIRECTIVE="$<CONFIG>")
if(PLATFORM EQUAL 32) if(PLATFORM EQUAL 32)
target_compile_options(trinity-compile-option-interface target_compile_options(trinity-compile-option-interface
INTERFACE INTERFACE
+7 -7
View File
@@ -34,7 +34,7 @@ if(PLATFORM EQUAL 64)
# debugger functionality. # debugger functionality.
target_compile_definitions(trinity-compile-option-interface target_compile_definitions(trinity-compile-option-interface
INTERFACE INTERFACE
-D_WIN64) _WIN64)
message(STATUS "MSVC: 64-bit platform, enforced -D_WIN64 parameter") message(STATUS "MSVC: 64-bit platform, enforced -D_WIN64 parameter")
@@ -88,24 +88,24 @@ endif()
# Define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES - eliminates the warning by changing the strcpy call to strcpy_s, which prevents buffer overruns # Define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES - eliminates the warning by changing the strcpy call to strcpy_s, which prevents buffer overruns
target_compile_definitions(trinity-compile-option-interface target_compile_definitions(trinity-compile-option-interface
INTERFACE INTERFACE
-D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES) _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES)
message(STATUS "MSVC: Overloaded standard names") message(STATUS "MSVC: Overloaded standard names")
# Ignore warnings about older, less secure functions # Ignore warnings about older, less secure functions
target_compile_definitions(trinity-compile-option-interface target_compile_definitions(trinity-compile-option-interface
INTERFACE INTERFACE
-D_CRT_SECURE_NO_WARNINGS) _CRT_SECURE_NO_WARNINGS)
message(STATUS "MSVC: Disabled NON-SECURE warnings") message(STATUS "MSVC: Disabled NON-SECURE warnings")
# Ignore warnings about POSIX deprecation # Ignore warnings about POSIX deprecation
target_compile_definitions(trinity-compile-option-interface target_compile_definitions(trinity-compile-option-interface
INTERFACE INTERFACE
-D_CRT_NONSTDC_NO_WARNINGS) _CRT_NONSTDC_NO_WARNINGS)
# Force math constants like M_PI to be available # Force math constants like M_PI to be available
target_compile_definitions(trinity-compile-option-interface target_compile_definitions(trinity-compile-option-interface
INTERFACE INTERFACE
-D_USE_MATH_DEFINES) _USE_MATH_DEFINES)
message(STATUS "MSVC: Disabled POSIX warnings") message(STATUS "MSVC: Disabled POSIX warnings")
@@ -157,8 +157,8 @@ target_compile_options(trinity-compile-option-interface
if(ASAN) if(ASAN)
target_compile_definitions(trinity-compile-option-interface target_compile_definitions(trinity-compile-option-interface
INTERFACE INTERFACE
-D_DISABLE_STRING_ANNOTATION _DISABLE_STRING_ANNOTATION
-D_DISABLE_VECTOR_ANNOTATION) _DISABLE_VECTOR_ANNOTATION)
target_compile_options(trinity-compile-option-interface target_compile_options(trinity-compile-option-interface
INTERFACE INTERFACE
+1 -1
View File
@@ -18,7 +18,7 @@ set(CMAKE_CXX_STANDARD 20)
# Set build-directive (used in core to tell which buildtype we used) # Set build-directive (used in core to tell which buildtype we used)
target_compile_definitions(trinity-compile-option-interface target_compile_definitions(trinity-compile-option-interface
INTERFACE INTERFACE
-D_BUILD_DIRECTIVE="$<CONFIG>") _BUILD_DIRECTIVE="$<CONFIG>")
# An interface library to make the target features available to other targets # An interface library to make the target features available to other targets
add_library(trinity-feature-interface INTERFACE) add_library(trinity-feature-interface INTERFACE)
+7 -5
View File
@@ -1,8 +1,10 @@
add_definitions(-D_WIN32_WINNT=0x0A00) # Windows 10 target_compile_definitions(trinity-compile-option-interface
add_definitions(-DNTDDI_VERSION=0x0A000007) # 19H1 (1903) INTERFACE
add_definitions(-DWIN32_LEAN_AND_MEAN) _WIN32_WINNT=0x0A00 # Windows 10
add_definitions(-DNOMINMAX) NTDDI_VERSION=0x0A000007 # 19H1 (1903)
add_definitions(-DTRINITY_REQUIRED_WINDOWS_BUILD=18362) WIN32_LEAN_AND_MEAN
NOMINMAX
TRINITY_REQUIRED_WINDOWS_BUILD=18362)
# set up output paths for executable binaries (.exe-files, and .dll-files on DLL-capable platforms) # set up output paths for executable binaries (.exe-files, and .dll-files on DLL-capable platforms)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/$<CONFIG>") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/$<CONFIG>")
+32 -17
View File
@@ -1,7 +1,8 @@
# output generic information about the core and buildtype chosen # output generic information about the core and buildtype chosen
message("") message("")
message("* TrinityCore revision : ${rev_hash} ${rev_date} (${rev_branch} branch)") message("* TrinityCore revision : ${rev_hash} ${rev_date} (${rev_branch} branch)")
if(NOT ("${CMAKE_GENERATOR}" MATCHES "Visual Studio" OR "${CMAKE_GENERATOR}" STREQUAL "Ninja Multi-Config")) get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(NOT IS_MULTI_CONFIG)
message("* TrinityCore buildtype : ${CMAKE_BUILD_TYPE}") message("* TrinityCore buildtype : ${CMAKE_BUILD_TYPE}")
endif() endif()
message("") message("")
@@ -72,7 +73,9 @@ if(WITH_COREDEBUG)
message(" *** -DCMAKE_BUILD_TYPE=RelWithDebInfo") message(" *** -DCMAKE_BUILD_TYPE=RelWithDebInfo")
message(" *** DO NOT ENABLE IT UNLESS YOU KNOW WHAT YOU'RE DOING!") message(" *** DO NOT ENABLE IT UNLESS YOU KNOW WHAT YOU'RE DOING!")
message("* Use coreside debug : Yes") message("* Use coreside debug : Yes")
add_definitions(-DTRINITY_DEBUG) target_compile_definitions(trinity-compile-option-interface
INTERFACE
TRINITY_DEBUG)
else() else()
message("* Use coreside debug : No (default)") message("* Use coreside debug : No (default)")
endif() endif()
@@ -111,60 +114,70 @@ if(HELGRIND)
message(" *** HELGRIND - WARNING!") message(" *** HELGRIND - WARNING!")
message(" *** Please specify the valgrind include directory in VALGRIND_INCLUDE_DIR option if you get build errors") message(" *** Please specify the valgrind include directory in VALGRIND_INCLUDE_DIR option if you get build errors")
message(" *** Please note that this is for DEBUGGING WITH HELGRIND only!") message(" *** Please note that this is for DEBUGGING WITH HELGRIND only!")
add_definitions(-DHELGRIND) target_compile_definitions(trinity-compile-option-interface
INTERFACE
HELGRIND)
endif() endif()
if(ASAN) if(ASAN)
message("") message("")
message(" *** ASAN - WARNING!") message(" *** ASAN - WARNING!")
message(" *** Please note that this is for DEBUGGING WITH ADDRESS SANITIZER only!") message(" *** Please note that this is for DEBUGGING WITH ADDRESS SANITIZER only!")
add_definitions(-DASAN) target_compile_definitions(trinity-compile-option-interface
INTERFACE
ASAN)
endif() endif()
if(MSAN) if(MSAN)
message("") message("")
message(" *** MSAN - WARNING!") message(" *** MSAN - WARNING!")
message(" *** Please note that this is for DEBUGGING WITH MEMORY SANITIZER only!") message(" *** Please note that this is for DEBUGGING WITH MEMORY SANITIZER only!")
add_definitions(-DMSAN) target_compile_definitions(trinity-compile-option-interface
INTERFACE
MSAN)
endif() endif()
if(UBSAN) if(UBSAN)
message("") message("")
message(" *** UBSAN - WARNING!") message(" *** UBSAN - WARNING!")
message(" *** Please note that this is for DEBUGGING WITH UNDEFINED BEHAVIOR SANITIZER only!") message(" *** Please note that this is for DEBUGGING WITH UNDEFINED BEHAVIOR SANITIZER only!")
add_definitions(-DUBSAN) target_compile_definitions(trinity-compile-option-interface
INTERFACE
UBSAN)
endif() endif()
if(TSAN) if(TSAN)
message("") message("")
message(" *** TSAN - WARNING!") message(" *** TSAN - WARNING!")
message(" *** Please note that this is for DEBUGGING WITH THREAD SANITIZER only!") message(" *** Please note that this is for DEBUGGING WITH THREAD SANITIZER only!")
add_definitions(-DTSAN -DNO_BUFFERPOOL) target_compile_definitions(trinity-compile-option-interface
INTERFACE
TSAN)
endif() endif()
if(PERFORMANCE_PROFILING) if(PERFORMANCE_PROFILING)
message("") message("")
message(" *** PERFORMANCE_PROFILING - WARNING!") message(" *** PERFORMANCE_PROFILING - WARNING!")
message(" *** Please note that this is for PERFORMANCE PROFILING only! Do NOT report any issue when enabling this configuration!") message(" *** Please note that this is for PERFORMANCE PROFILING only! Do NOT report any issue when enabling this configuration!")
add_definitions(-DPERFORMANCE_PROFILING) target_compile_definitions(trinity-compile-option-interface
INTERFACE
PERFORMANCE_PROFILING)
endif() endif()
if(WITHOUT_METRICS) if(WITHOUT_METRICS)
message("") message("")
message(" *** WITHOUT_METRICS - WARNING!") message(" *** WITHOUT_METRICS - WARNING!")
message(" *** Please note that this will disable all metrics output (i.e. InfluxDB and Grafana)") message(" *** Please note that this will disable all metrics output (i.e. InfluxDB and Grafana)")
add_definitions(-DWITHOUT_METRICS) target_compile_definitions(trinity-compile-option-interface
INTERFACE
WITHOUT_METRICS)
elseif (WITH_DETAILED_METRICS) elseif (WITH_DETAILED_METRICS)
message("") message("")
message(" *** WITH_DETAILED_METRICS - WARNING!") message(" *** WITH_DETAILED_METRICS - WARNING!")
message(" *** Please note that this will enable detailed metrics output (i.e. time each session takes to update)") message(" *** Please note that this will enable detailed metrics output (i.e. time each session takes to update)")
add_definitions(-DWITH_DETAILED_METRICS) target_compile_definitions(trinity-compile-option-interface
endif() INTERFACE
WITH_DETAILED_METRICS)
if(WITH_BOOST_STACKTRACE)
if (BOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE)
add_definitions(-DBOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE="${BOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE}")
endif()
endif() endif()
if(BUILD_SHARED_LIBS) if(BUILD_SHARED_LIBS)
@@ -176,7 +189,9 @@ if(BUILD_SHARED_LIBS)
message("") message("")
message(" *** Dynamic linking was enforced through a dynamic script module!") message(" *** Dynamic linking was enforced through a dynamic script module!")
endif() endif()
add_definitions(-DTRINITY_API_USE_DYNAMIC_LINKING) target_compile_definitions(trinity-compile-option-interface
INTERFACE
TRINITY_API_USE_DYNAMIC_LINKING)
WarnAboutSpacesInBuildPath() WarnAboutSpacesInBuildPath()
endif() endif()
+1 -1
View File
@@ -59,7 +59,7 @@ target_include_directories(casc
PRIVATE PRIVATE
${CMAKE_SOURCE_DIR}/dep) ${CMAKE_SOURCE_DIR}/dep)
target_compile_definitions(casc PUBLIC -D__SYS_ZLIB -DCASCLIB_NO_AUTO_LINK_LIBRARY -DCASCLIB_NODEBUG) target_compile_definitions(casc PUBLIC __SYS_ZLIB CASCLIB_NO_AUTO_LINK_LIBRARY CASCLIB_NODEBUG)
target_link_libraries(casc target_link_libraries(casc
PRIVATE PRIVATE
+3 -3
View File
@@ -36,7 +36,7 @@ target_include_directories(sfmt
${CMAKE_CURRENT_SOURCE_DIR}) ${CMAKE_CURRENT_SOURCE_DIR})
# using the standard Mersenne exponent 19937 # using the standard Mersenne exponent 19937
target_compile_definitions(sfmt PUBLIC -DSFMT_MEXP=19937) target_compile_definitions(sfmt PUBLIC SFMT_MEXP=19937)
# enable SIMD instructions if available # enable SIMD instructions if available
include(CheckCXXCompilerFlag) include(CheckCXXCompilerFlag)
@@ -67,11 +67,11 @@ else ()
endif () endif ()
if (HAVE_NEON) if (HAVE_NEON)
target_compile_definitions(sfmt PUBLIC -DHAVE_NEON) target_compile_definitions(sfmt PUBLIC HAVE_NEON)
endif () endif ()
if (HAVE_SSE2) if (HAVE_SSE2)
target_compile_definitions(sfmt PUBLIC -DHAVE_SSE2) target_compile_definitions(sfmt PUBLIC HAVE_SSE2)
endif () endif ()
set_target_properties(sfmt PROPERTIES LINKER_LANGUAGE CXX) set_target_properties(sfmt PROPERTIES LINKER_LANGUAGE CXX)
+1 -1
View File
@@ -23,7 +23,7 @@ add_library(argon2 STATIC
target_compile_definitions(argon2 target_compile_definitions(argon2
PRIVATE PRIVATE
-DARGON2_NO_THREADS) ARGON2_NO_THREADS)
set_target_properties(argon2 PROPERTIES LINKER_LANGUAGE CXX) set_target_properties(argon2 PROPERTIES LINKER_LANGUAGE CXX)
+14 -11
View File
@@ -20,8 +20,6 @@ endif()
set(Boost_NO_WARN_NEW_VERSIONS ON) set(Boost_NO_WARN_NEW_VERSIONS ON)
include (CheckCXXSourceCompiles)
if (WIN32) if (WIN32)
# On windows the requirements are higher according to the wiki. # On windows the requirements are higher according to the wiki.
set(BOOST_REQUIRED_VERSION 1.78) set(BOOST_REQUIRED_VERSION 1.78)
@@ -49,19 +47,24 @@ target_include_directories(boost
target_compile_definitions(boost target_compile_definitions(boost
INTERFACE INTERFACE
-DBOOST_ALL_NO_LIB BOOST_ALL_NO_LIB
-DBOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE
-DBOOST_ASIO_NO_DEPRECATED BOOST_ASIO_NO_DEPRECATED
-DBOOST_BIND_NO_PLACEHOLDERS BOOST_BIND_NO_PLACEHOLDERS
-DBOOST_SYSTEM_USE_UTF8) BOOST_SYSTEM_USE_UTF8)
if (WITH_BOOST_STACKTRACE AND NOT WIN32) if (WITH_BOOST_STACKTRACE AND NOT WIN32)
message("*** libbacktrace will be linked") message(STATUS "libbacktrace will be linked")
include(CheckIncludeFile)
if (BOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE) if (BOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE)
CHECK_INCLUDE_FILE(${BOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE} HAS_BACKTRACE) check_include_file("${BOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE}" HAS_BACKTRACE)
target_compile_definitions(boost
INTERFACE
BOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE=${BOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE})
else() else()
CHECK_INCLUDE_FILE("backtrace.h" HAS_BACKTRACE) check_include_file("backtrace.h" HAS_BACKTRACE)
endif() endif()
if (NOT HAS_BACKTRACE) if (NOT HAS_BACKTRACE)
@@ -70,7 +73,7 @@ if (WITH_BOOST_STACKTRACE AND NOT WIN32)
target_compile_definitions(boost target_compile_definitions(boost
INTERFACE INTERFACE
-DBOOST_STACKTRACE_USE_BACKTRACE) BOOST_STACKTRACE_USE_BACKTRACE)
target_link_libraries(boost target_link_libraries(boost
INTERFACE INTERFACE
+6
View File
@@ -60,6 +60,12 @@ target_include_directories(g3dlib
PUBLIC PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include) ${CMAKE_CURRENT_SOURCE_DIR}/include)
if((CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT NOJEM) OR TSAN)
target_compile_definitions(g3dlib
PRIVATE
NO_BUFFERPOOL)
endif()
target_link_libraries(g3dlib target_link_libraries(g3dlib
PRIVATE PRIVATE
trinity-dependency-interface trinity-dependency-interface
+2 -2
View File
@@ -20,7 +20,7 @@ target_include_directories(gsoap
target_compile_definitions(gsoap target_compile_definitions(gsoap
PUBLIC PUBLIC
-DWITH_OPENSSL) WITH_OPENSSL)
target_link_libraries(gsoap target_link_libraries(gsoap
PRIVATE PRIVATE
@@ -37,5 +37,5 @@ if (MSVC)
# Little fix for MSVC / Windows platforms # Little fix for MSVC / Windows platforms
target_compile_definitions(gsoap target_compile_definitions(gsoap
PRIVATE PRIVATE
-D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=0) _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=0)
endif() endif()
+2 -4
View File
@@ -91,11 +91,9 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT NOJEM)
${CMAKE_CURRENT_SOURCE_DIR}/include) ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_compile_definitions(jemalloc target_compile_definitions(jemalloc
PUBLIC
-DNO_BUFFERPOOL
PRIVATE PRIVATE
-D_GNU_SOURCE _GNU_SOURCE
-D_REENTRAN) _REENTRAN)
target_link_libraries(jemalloc target_link_libraries(jemalloc
PRIVATE PRIVATE
+1 -1
View File
@@ -25,7 +25,7 @@ target_include_directories(openssl_ed25519
target_compile_definitions(openssl_ed25519 target_compile_definitions(openssl_ed25519
PRIVATE PRIVATE
-DOPENSSL_ED25519_EXPORT OPENSSL_ED25519_EXPORT
) )
target_link_libraries(openssl_ed25519 target_link_libraries(openssl_ed25519
+4 -4
View File
@@ -74,10 +74,10 @@ target_link_libraries(protobuf
if (BUILD_SHARED_LIBS) if (BUILD_SHARED_LIBS)
target_compile_definitions(protobuf target_compile_definitions(protobuf
PRIVATE PRIVATE
-DLIBPROTOBUF_EXPORTS LIBPROTOBUF_EXPORTS
-DLIBPROTOC_EXPORTS LIBPROTOC_EXPORTS
PUBLIC PUBLIC
-DPROTOBUF_USE_DLLS) PROTOBUF_USE_DLLS)
endif() endif()
if (MSVC) if (MSVC)
@@ -87,7 +87,7 @@ if (MSVC)
target_compile_definitions(protobuf target_compile_definitions(protobuf
PRIVATE PRIVATE
-D_SCL_SECURE_NO_WARNINGS) _SCL_SECURE_NO_WARNINGS)
endif() endif()
set_target_properties(protobuf set_target_properties(protobuf
+3 -3
View File
@@ -16,9 +16,9 @@ target_include_directories(rapidjson
target_compile_definitions(rapidjson target_compile_definitions(rapidjson
INTERFACE INTERFACE
-DRAPIDJSON_HAS_STDSTRING RAPIDJSON_HAS_STDSTRING
-DRAPIDJSON_48BITPOINTER_OPTIMIZATION=0 RAPIDJSON_48BITPOINTER_OPTIMIZATION=0
-DRAPIDJSON_ASSERT=WPAssert) RAPIDJSON_ASSERT=WPAssert)
if(TRINITY_SYSTEM_PROCESSOR MATCHES "x86|amd64") if(TRINITY_SYSTEM_PROCESSOR MATCHES "x86|amd64")
target_compile_definitions(rapidjson INTERFACE -DRAPIDJSON_SSE2) target_compile_definitions(rapidjson INTERFACE -DRAPIDJSON_SSE2)
+4 -11
View File
@@ -29,21 +29,10 @@ endif(USE_COREPCH)
GroupSources(${CMAKE_CURRENT_SOURCE_DIR}) GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
add_definitions(-DTRINITY_API_EXPORT_COMMON)
add_library(common add_library(common
${PRIVATE_SOURCES} ${PRIVATE_SOURCES}
) )
# Do NOT add any extra include directory here, as we don't want the common
# library to depend on anything else than TC deps, and itself.
# This way we ensure that if either a PR does that without modifying this file,
# a compile error will be generated, either this file will be modified so it
# is detected more easily.
# While it is OK to include files from other libs as long as they don't require
# linkage (enums, defines...) it is discouraged to do so unless necessary, as it will pullute
# include_directories leading to further unnoticed dependency aditions
# Linker Depencency requirements: none
CollectIncludeDirectories( CollectIncludeDirectories(
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC_INCLUDES PUBLIC_INCLUDES
@@ -58,6 +47,10 @@ target_include_directories(common
PRIVATE PRIVATE
${CMAKE_CURRENT_BINARY_DIR}) ${CMAKE_CURRENT_BINARY_DIR})
target_compile_definitions(common
PRIVATE
TRINITY_API_EXPORT_COMMON)
target_link_libraries(common target_link_libraries(common
PRIVATE PRIVATE
trinity-core-interface trinity-core-interface
-8
View File
@@ -8,14 +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.
# Enforce compileparameters for corebuilds under GCC
# This to stop a few silly crashes that could have been avoided IF people
# weren't doing some -O3 psychooptimizations etc.
if(CMAKE_COMPILER_IS_GNUCXX AND NOT MINGW)
add_definitions(-fno-delete-null-pointer-checks)
endif()
if(WIN32) if(WIN32)
list(APPEND sources_windows list(APPEND sources_windows
${CMAKE_SOURCE_DIR}/src/common/Platform/ServiceWin32.cpp ${CMAKE_SOURCE_DIR}/src/common/Platform/ServiceWin32.cpp
+3 -10
View File
@@ -24,15 +24,6 @@ add_library(database
${PRIVATE_SOURCES} ${PRIVATE_SOURCES}
) )
# Do NOT add any extra include directory unless it does not create unneeded extra dependencies,
# and specially, not add any dependency to neither of these: shared, game, scripts
# This way we ensure that if either a PR does that without modifying this file,
# a compile error will be generated, either this file will be modified so it
# is detected more easily.
# While it is OK to include files from other libs as long as they don't require
# linkage (enums, defines...) it is discouraged to do so unless necessary, as it will pullute
# include_directories leading to further unnoticed dependency aditions
# Linker Depencency requirements: common
CollectIncludeDirectories( CollectIncludeDirectories(
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC_INCLUDES PUBLIC_INCLUDES
@@ -45,7 +36,9 @@ target_include_directories(database
PRIVATE PRIVATE
${CMAKE_CURRENT_BINARY_DIR}) ${CMAKE_CURRENT_BINARY_DIR})
add_definitions(-DTRINITY_API_EXPORT_DATABASE) target_compile_definitions(database
PRIVATE
TRINITY_API_EXPORT_DATABASE)
target_link_libraries(database target_link_libraries(database
PRIVATE PRIVATE
+4 -2
View File
@@ -20,8 +20,6 @@ endif()
GroupSources(${CMAKE_CURRENT_SOURCE_DIR}) GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
add_definitions(-DTRINITY_API_EXPORT_GAME)
CollectIncludeDirectories( CollectIncludeDirectories(
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC_INCLUDES PUBLIC_INCLUDES
@@ -48,6 +46,10 @@ target_include_directories(game
PRIVATE PRIVATE
${CMAKE_CURRENT_BINARY_DIR}) ${CMAKE_CURRENT_BINARY_DIR})
target_compile_definitions(game
PRIVATE
TRINITY_API_EXPORT_GAME)
target_link_libraries(game target_link_libraries(game
PRIVATE PRIVATE
trinity-core-interface trinity-core-interface
+4 -2
View File
@@ -20,8 +20,6 @@ endif()
GroupSources(${CMAKE_CURRENT_SOURCE_DIR}) GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
add_definitions(-DTRINITY_API_EXPORT_PROTO)
add_library(proto add_library(proto
${PRIVATE_SOURCES} ${PRIVATE_SOURCES}
) )
@@ -40,6 +38,10 @@ target_include_directories(proto
PRIVATE PRIVATE
${CMAKE_CURRENT_BINARY_DIR}) ${CMAKE_CURRENT_BINARY_DIR})
target_compile_definitions(proto
PRIVATE
TRINITY_API_EXPORT_PROTO)
target_link_libraries(proto target_link_libraries(proto
PRIVATE PRIVATE
trinity-default-interface trinity-default-interface
+4 -2
View File
@@ -20,8 +20,6 @@ endif()
GroupSources(${CMAKE_CURRENT_SOURCE_DIR}) GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
add_definitions(-DTRINITY_API_EXPORT_SHARED)
add_library(shared add_library(shared
${PRIVATE_SOURCES} ${PRIVATE_SOURCES}
) )
@@ -38,6 +36,10 @@ target_include_directories(shared
PRIVATE PRIVATE
${CMAKE_CURRENT_BINARY_DIR}) ${CMAKE_CURRENT_BINARY_DIR})
target_compile_definitions(shared
PRIVATE
TRINITY_API_EXPORT_SHARED)
target_link_libraries(shared target_link_libraries(shared
PRIVATE PRIVATE
trinity-core-interface trinity-core-interface
-6
View File
@@ -39,12 +39,6 @@ if(NOT WIN32)
) )
endif() endif()
if(UNIX AND NOT NOJEM AND NOT APPLE)
set(worldserver_LINK_FLAGS "-pthread -lncurses ${worldserver_LINK_FLAGS}")
endif()
set_target_properties(worldserver PROPERTIES LINK_FLAGS "${worldserver_LINK_FLAGS}")
target_link_libraries(worldserver target_link_libraries(worldserver
PRIVATE PRIVATE
trinity-core-interface trinity-core-interface