aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2024-07-15 15:24:35 +0200
committerShauren <shauren.trinity@gmail.com>2025-04-13 19:05:21 +0200
commit8cbb263c14443e5b264679abe824f8b835043bb7 (patch)
tree166ac590a44079692297d7ada8364c5084f49708 /src
parent5269de59191f1adde28aaefbac2c8a81cdf27991 (diff)
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 (cherry picked from commit 77fe2745febab9e4362b09750093d831325e6091)
Diffstat (limited to 'src')
-rw-r--r--src/common/CMakeLists.txt15
-rw-r--r--src/server/CMakeLists.txt8
-rw-r--r--src/server/database/CMakeLists.txt13
-rw-r--r--src/server/game/CMakeLists.txt6
-rw-r--r--src/server/shared/CMakeLists.txt6
-rw-r--r--src/server/worldserver/CMakeLists.txt6
6 files changed, 15 insertions, 39 deletions
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
index 67d0d663c73..413d0d6378a 100644
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -29,21 +29,10 @@ endif(USE_COREPCH)
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
-add_definitions(-DTRINITY_API_EXPORT_COMMON)
-
add_library(common
${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(
${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC_INCLUDES
@@ -58,6 +47,10 @@ target_include_directories(common
PRIVATE
${CMAKE_CURRENT_BINARY_DIR})
+target_compile_definitions(common
+ PRIVATE
+ TRINITY_API_EXPORT_COMMON)
+
target_link_libraries(common
PRIVATE
trinity-core-interface
diff --git a/src/server/CMakeLists.txt b/src/server/CMakeLists.txt
index 78852a64b4e..e4e795ba8a1 100644
--- a/src/server/CMakeLists.txt
+++ b/src/server/CMakeLists.txt
@@ -8,14 +8,6 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# 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)
list(APPEND sources_windows
${CMAKE_SOURCE_DIR}/src/common/Platform/ServiceWin32.cpp
diff --git a/src/server/database/CMakeLists.txt b/src/server/database/CMakeLists.txt
index b652e7f3ffc..8c9788c34cd 100644
--- a/src/server/database/CMakeLists.txt
+++ b/src/server/database/CMakeLists.txt
@@ -24,15 +24,6 @@ add_library(database
${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(
${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC_INCLUDES
@@ -45,7 +36,9 @@ target_include_directories(database
PRIVATE
${CMAKE_CURRENT_BINARY_DIR})
-add_definitions(-DTRINITY_API_EXPORT_DATABASE)
+target_compile_definitions(database
+ PRIVATE
+ TRINITY_API_EXPORT_DATABASE)
target_link_libraries(database
PRIVATE
diff --git a/src/server/game/CMakeLists.txt b/src/server/game/CMakeLists.txt
index 1beffa37c3c..f2e3152f9d2 100644
--- a/src/server/game/CMakeLists.txt
+++ b/src/server/game/CMakeLists.txt
@@ -20,8 +20,6 @@ endif()
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
-add_definitions(-DTRINITY_API_EXPORT_GAME)
-
CollectIncludeDirectories(
${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC_INCLUDES
@@ -48,6 +46,10 @@ target_include_directories(game
PRIVATE
${CMAKE_CURRENT_BINARY_DIR})
+target_compile_definitions(game
+ PRIVATE
+ TRINITY_API_EXPORT_GAME)
+
target_link_libraries(game
PRIVATE
trinity-core-interface
diff --git a/src/server/shared/CMakeLists.txt b/src/server/shared/CMakeLists.txt
index 5fd13cee9d4..751e3fce751 100644
--- a/src/server/shared/CMakeLists.txt
+++ b/src/server/shared/CMakeLists.txt
@@ -20,8 +20,6 @@ endif()
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
-add_definitions(-DTRINITY_API_EXPORT_SHARED)
-
add_library(shared
${PRIVATE_PCH_SOURCE}
${PRIVATE_SOURCES}
@@ -39,6 +37,10 @@ target_include_directories(shared
PRIVATE
${CMAKE_CURRENT_BINARY_DIR})
+target_compile_definitions(shared
+ PRIVATE
+ TRINITY_API_EXPORT_SHARED)
+
target_link_libraries(shared
PRIVATE
trinity-core-interface
diff --git a/src/server/worldserver/CMakeLists.txt b/src/server/worldserver/CMakeLists.txt
index fec9e60fcea..69534d8c69d 100644
--- a/src/server/worldserver/CMakeLists.txt
+++ b/src/server/worldserver/CMakeLists.txt
@@ -39,12 +39,6 @@ if(NOT WIN32)
)
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
PRIVATE
trinity-core-interface