aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/CMakeLists.txt97
-rw-r--r--src/genrev/CMakeLists.txt5
-rw-r--r--src/server/database/CMakeLists.txt4
-rw-r--r--src/tools/connection_patcher/CMakeLists.txt15
-rw-r--r--src/tools/map_extractor/CMakeLists.txt46
-rw-r--r--src/tools/mmaps_generator/CMakeLists.txt57
-rw-r--r--src/tools/vmap4_assembler/CMakeLists.txt21
-rw-r--r--src/tools/vmap4_extractor/CMakeLists.txt37
8 files changed, 131 insertions, 151 deletions
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
index 8bf86b57139..6f13dc821a9 100644
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -8,40 +8,31 @@
# 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_Common Common.cpp Common.h)
-file(GLOB_RECURSE sources_Collision Collision/*.cpp Collision/*.h)
-file(GLOB_RECURSE sources_Threading Threading/*.cpp Threading/*.h)
-file(GLOB_RECURSE sources_Utilities Utilities/*.cpp Utilities/*.h)
-file(GLOB_RECURSE sources_Configuration Configuration/*.cpp Configuration/*.h)
-file(GLOB_RECURSE sources_Logging Logging/*.cpp Logging/*.h)
-file(GLOB_RECURSE sources_Cryptography Cryptography/*.cpp Cryptography/*.h)
+CollectSourceFiles(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ PRIVATE_SOURCES
+ # Exclude
+ ${CMAKE_CURRENT_SOURCE_DIR}/Debugging
+ ${CMAKE_CURRENT_SOURCE_DIR}/Platform
+ ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
# Manually set sources for Debugging directory as we don't want to include WheatyExceptionReport in common 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)
-file(GLOB sources_localdir *.cpp *.h)
+list(APPEND PRIVATE_SOURCES
+ ${CMAKE_CURRENT_SOURCE_DIR}/Debugging/Errors.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/Debugging/Errors.h)
if (USE_COREPCH)
- set(common_STAT_PCH_HDR PrecompiledHeaders/commonPCH.h)
- set(common_STAT_PCH_SRC PrecompiledHeaders/commonPCH.cpp)
+ set(PRIVATE_PCH_HEADER PrecompiledHeaders/commonPCH.h)
+ set(PRIVATE_PCH_SOURCE PrecompiledHeaders/commonPCH.cpp)
endif (USE_COREPCH)
-set(common_STAT_SRCS
- ${common_STAT_SRCS}
- ${sources_Common}
- ${sources_Collision}
- ${sources_Threading}
- ${sources_Utilities}
- ${sources_Debugging}
- ${sources_Configuration}
- ${sources_Logging}
- ${sources_Cryptography}
- ${sources_localdir}
+GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
+
+add_library(common
+ ${PRIVATE_SOURCES}
+ ${PRIVATE_PCH_SOURCE}
)
# Do NOT add any extra include directory here, as we don't want the common
@@ -53,37 +44,41 @@ set(common_STAT_SRCS
# 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
-include_directories(
- ${CMAKE_BINARY_DIR}
+CollectIncludeDirectories(
${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_CURRENT_SOURCE_DIR}/Collision
- ${CMAKE_CURRENT_SOURCE_DIR}/Collision/Management
- ${CMAKE_CURRENT_SOURCE_DIR}/Collision/Maps
- ${CMAKE_CURRENT_SOURCE_DIR}/Collision/Models
- ${CMAKE_CURRENT_SOURCE_DIR}/Configuration
- ${CMAKE_CURRENT_SOURCE_DIR}/Cryptography
- ${CMAKE_CURRENT_SOURCE_DIR}/Debugging
- ${CMAKE_CURRENT_SOURCE_DIR}/Logging
- ${CMAKE_CURRENT_SOURCE_DIR}/Utilities
- ${CMAKE_SOURCE_DIR}/dep/cppformat
- ${CMAKE_SOURCE_DIR}/dep/g3dlite/include
- ${CMAKE_SOURCE_DIR}/dep/recastnavigation/Detour/Include
- ${CMAKE_SOURCE_DIR}/dep/SFMT
- ${CMAKE_SOURCE_DIR}/dep/utf8cpp
- ${OPENSSL_INCLUDE_DIR}
- ${VALGRIND_INCLUDE_DIR}
-)
+ PUBLIC_INCLUDES
+ # Exclude
+ ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
-GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
+target_include_directories(common
+ PUBLIC
+ # Provide the binary dir for all child targets
+ ${CMAKE_BINARY_DIR}
+ ${PUBLIC_INCLUDES}
+ PRIVATE
+ ${CMAKE_CURRENT_BINARY_DIR})
-add_library(common STATIC
- ${common_STAT_SRCS}
- ${common_STAT_PCH_SRC}
-)
+target_link_libraries(common
+ PUBLIC
+ boost
+ cppformat
+ g3dlib
+ Detour
+ sfmt
+ utf8cpp
+ openssl
+ valgrind
+ threads
+ jemalloc)
add_dependencies(common revision_data.h)
+set_target_properties(common
+ PROPERTIES
+ FOLDER
+ "server")
+
# Generate precompiled header
if (USE_COREPCH)
- add_cxx_pch(common ${common_STAT_PCH_HDR} ${common_STAT_PCH_SRC})
+ add_cxx_pch(common ${PRIVATE_PCH_HEADER} ${PRIVATE_PCH_SOURCE})
endif ()
diff --git a/src/genrev/CMakeLists.txt b/src/genrev/CMakeLists.txt
index 91a13609037..355e2043b51 100644
--- a/src/genrev/CMakeLists.txt
+++ b/src/genrev/CMakeLists.txt
@@ -13,3 +13,8 @@ add_custom_target(revision_data.h ALL
COMMAND "${CMAKE_COMMAND}" -DBUILDDIR="${CMAKE_BINARY_DIR}" -P "${CMAKE_SOURCE_DIR}/cmake/genrev.cmake" "${CMAKE_BINARY_DIR}"
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
)
+
+set_target_properties(revision_data.h
+ PROPERTIES
+ FOLDER
+ "server")
diff --git a/src/server/database/CMakeLists.txt b/src/server/database/CMakeLists.txt
index 5a53899f4cb..f4f160fe1ca 100644
--- a/src/server/database/CMakeLists.txt
+++ b/src/server/database/CMakeLists.txt
@@ -8,10 +8,6 @@
# 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(SEND_ERROR "MySQL wasn't found on your system but it's required to build the servers!")
-endif()
-
if( USE_COREPCH )
include_directories(${CMAKE_CURRENT_BINARY_DIR})
endif()
diff --git a/src/tools/connection_patcher/CMakeLists.txt b/src/tools/connection_patcher/CMakeLists.txt
index 781547f628b..3fad34fabb1 100644
--- a/src/tools/connection_patcher/CMakeLists.txt
+++ b/src/tools/connection_patcher/CMakeLists.txt
@@ -8,15 +8,6 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-include_directories(
- ${CMAKE_SOURCE_DIR}
- ${CMAKE_SOURCE_DIR}/src/common
- ${CMAKE_SOURCE_DIR}/src/common/Cryptography
- ${CMAKE_SOURCE_DIR}/src/common/Debugging
- ${CMAKE_SOURCE_DIR}/src/common/Utilities
- ${OPENSSL_INCLUDE_DIR}
-)
-
set(HEADER_FILES
Helper.hpp
Patcher.hpp
@@ -42,10 +33,8 @@ if (MSVC)
endif ()
target_link_libraries(connection_patcher
- common
- ${OPENSSL_LIBRARIES}
- ${CMAKE_THREAD_LIBS_INIT}
- ${Boost_LIBRARIES}
+ PUBLIC
+ common
)
if (UNIX)
diff --git a/src/tools/map_extractor/CMakeLists.txt b/src/tools/map_extractor/CMakeLists.txt
index 25ad7c771e8..656bee3d5a0 100644
--- a/src/tools/map_extractor/CMakeLists.txt
+++ b/src/tools/map_extractor/CMakeLists.txt
@@ -9,34 +9,38 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-file(GLOB_RECURSE sources *.cpp *.h)
-
-include_directories (
- ${CMAKE_SOURCE_DIR}/dep/CascLib/src
- ${CMAKE_SOURCE_DIR}/dep/cppformat
- ${CMAKE_SOURCE_DIR}/src/common
- ${CMAKE_SOURCE_DIR}/src/common/Utilities
- ${CMAKE_SOURCE_DIR}/src/server/shared
+CollectSourceFiles(
${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_CURRENT_SOURCE_DIR}/loadlib
-)
-
-include_directories(${include_Dirs})
+ PRIVATE_SOURCES)
add_executable(mapextractor
- ${sources}
+ ${PRIVATE_SOURCES}
)
+target_include_directories(mapextractor
+ PUBLIC
+ ${CMAKE_SOURCE_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}/loadlib)
+
target_link_libraries(mapextractor
- casc
- common
- cppformat
- ${BZIP2_LIBRARIES}
- ${ZLIB_LIBRARIES}
- ${Boost_LIBRARIES}
-)
+ PUBLIC
+ common
+ casc)
+
+CollectIncludeDirectories(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ PUBLIC_INCLUDES)
+
+target_include_directories(mapextractor
+ PUBLIC
+ ${PUBLIC_INCLUDES}
+ PRIVATE
+ ${CMAKE_CURRENT_BINARY_DIR})
-add_dependencies(mapextractor casc)
+set_target_properties(mapextractor
+ PROPERTIES
+ FOLDER
+ "tools")
if( UNIX )
install(TARGETS mapextractor DESTINATION bin)
diff --git a/src/tools/mmaps_generator/CMakeLists.txt b/src/tools/mmaps_generator/CMakeLists.txt
index 5640ea8be5d..7e34fea6acc 100644
--- a/src/tools/mmaps_generator/CMakeLists.txt
+++ b/src/tools/mmaps_generator/CMakeLists.txt
@@ -8,43 +8,34 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# 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
- ${CMAKE_BINARY_DIR}
- ${CMAKE_SOURCE_DIR}/dep/cppformat
- ${CMAKE_SOURCE_DIR}/dep/zlib
- ${CMAKE_SOURCE_DIR}/dep/bzip2
- ${CMAKE_SOURCE_DIR}/dep/g3dlite/include
- ${CMAKE_SOURCE_DIR}/dep/recastnavigation/Recast
- ${CMAKE_SOURCE_DIR}/dep/recastnavigation/Recast/Include
- ${CMAKE_SOURCE_DIR}/dep/recastnavigation/Detour
- ${CMAKE_SOURCE_DIR}/dep/recastnavigation/Detour/Include
- ${CMAKE_SOURCE_DIR}/src/common
- ${CMAKE_SOURCE_DIR}/src/common/Utilities
- ${CMAKE_SOURCE_DIR}/src/common/Threading
- ${CMAKE_SOURCE_DIR}/src/server/game/Conditions
- ${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
-)
+add_executable(mmaps_generator ${PRIVATE_SOURCES})
-include_directories(${mmap_gen_Includes})
+target_link_libraries(mmaps_generator
+ PUBLIC
+ common
+ Recast
+ Detour
+ zlib
+ bzip2)
-add_executable(mmaps_generator ${mmap_gen_sources})
+CollectIncludeDirectories(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ PUBLIC_INCLUDES)
-target_link_libraries(mmaps_generator
- common
- g3dlib
- Recast
- Detour
- cppformat
- ${BZIP2_LIBRARIES}
- ${ZLIB_LIBRARIES}
- ${CMAKE_THREAD_LIBS_INIT}
- ${Boost_LIBRARIES}
-)
+target_include_directories(mmaps_generator
+ PUBLIC
+ ${PUBLIC_INCLUDES}
+ PRIVATE
+ ${CMAKE_CURRENT_BINARY_DIR})
+
+set_target_properties(mmaps_generator
+ PROPERTIES
+ FOLDER
+ "tools")
if( UNIX )
install(TARGETS mmaps_generator DESTINATION bin)
diff --git a/src/tools/vmap4_assembler/CMakeLists.txt b/src/tools/vmap4_assembler/CMakeLists.txt
index b2b17f49289..28e8b374143 100644
--- a/src/tools/vmap4_assembler/CMakeLists.txt
+++ b/src/tools/vmap4_assembler/CMakeLists.txt
@@ -9,24 +9,17 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-include_directories(
- ${CMAKE_SOURCE_DIR}/dep/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
- ${ZLIB_INCLUDE_DIR}
-)
-
add_executable(vmap4assembler VMapAssembler.cpp)
-add_dependencies(vmap4assembler casc)
target_link_libraries(vmap4assembler
common
- g3dlib
- ${ZLIB_LIBRARIES}
-)
+ casc
+ zlib)
+
+set_target_properties(vmap4assembler
+ PROPERTIES
+ FOLDER
+ "tools")
if( UNIX )
install(TARGETS vmap4assembler DESTINATION bin)
diff --git a/src/tools/vmap4_extractor/CMakeLists.txt b/src/tools/vmap4_extractor/CMakeLists.txt
index 18d770af707..feaf7ddb215 100644
--- a/src/tools/vmap4_extractor/CMakeLists.txt
+++ b/src/tools/vmap4_extractor/CMakeLists.txt
@@ -9,25 +9,32 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-file(GLOB_RECURSE sources *.cpp *.h)
+CollectSourceFiles(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ PRIVATE_SOURCES)
-include_directories(
- ${CMAKE_SOURCE_DIR}/src/common
- ${CMAKE_SOURCE_DIR}/src/server/shared
- ${CMAKE_SOURCE_DIR}/dep/CascLib/src
-)
-
-add_executable(vmap4extractor ${sources})
+add_executable(vmap4extractor ${PRIVATE_SOURCES})
target_link_libraries(vmap4extractor
- casc
- common
- ${BZIP2_LIBRARIES}
- ${ZLIB_LIBRARIES}
- ${Boost_LIBRARIES}
-)
+ PUBLIC
+ common
+ casc
+ bzip2)
+
+CollectIncludeDirectories(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ PUBLIC_INCLUDES)
+
+target_include_directories(vmap4extractor
+ PUBLIC
+ ${PUBLIC_INCLUDES}
+ PRIVATE
+ ${CMAKE_CURRENT_BINARY_DIR})
-add_dependencies(vmap4extractor casc)
+set_target_properties(vmap4extractor
+ PROPERTIES
+ FOLDER
+ "tools")
if( UNIX )
install(TARGETS vmap4extractor DESTINATION bin)