Build: Modernize include directory management using target_sources(FILE_SET)

This commit is contained in:
Shauren
2025-11-12 22:53:54 +01:00
parent 7ccc2d4f6b
commit 3331699906
29 changed files with 624 additions and 639 deletions

View File

@@ -8,39 +8,47 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# Collects all source files into the given variable,
# which is useful to include all sources in subdirectories.
# Ignores full qualified directories listed in the variadic arguments.
# Adds all found source files to a given target
#
# Use it like:
# CollectSourceFiles(
# CollectAndAddSourceFiles(
# common
# ${CMAKE_CURRENT_SOURCE_DIR}
# COMMON_PRIVATE_SOURCES
# # Exclude
# EXCLUDE
# ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders
# ${CMAKE_CURRENT_SOURCE_DIR}/Platform)
#
function(CollectSourceFiles current_dir variable)
list(FIND ARGN "${current_dir}" IS_EXCLUDED)
function(CollectAndAddSourceFiles target_name current_dir)
cmake_parse_arguments(PARSE_ARGV 2 arg "" "BASE_DIR" "EXCLUDE")
if(NOT arg_BASE_DIR)
set(arg_BASE_DIR "${current_dir}")
endif()
list(FIND arg_EXCLUDE "${current_dir}" IS_EXCLUDED)
if(IS_EXCLUDED EQUAL -1)
file(GLOB COLLECTED_SOURCES
cmake_path(RELATIVE_PATH current_dir BASE_DIRECTORY "${arg_BASE_DIR}" OUTPUT_VARIABLE fileset_name)
# normalize file set name
string(REGEX REPLACE "[./\\]" "_" fileset_name "${fileset_name}")
file(GLOB private_source_files
${current_dir}/*.c
${current_dir}/*.cc
${current_dir}/*.cpp
${current_dir}/*.cpp)
file(GLOB public_header_files
${current_dir}/*.inl
${current_dir}/*.def
${current_dir}/*.h
${current_dir}/*.hh
${current_dir}/*.hpp)
list(APPEND ${variable} ${COLLECTED_SOURCES})
target_sources(${target_name} PRIVATE ${private_source_files})
target_sources(${target_name} PUBLIC FILE_SET "headers_${fileset_name}" TYPE HEADERS BASE_DIRS ${current_dir} FILES ${public_header_files})
file(GLOB SUB_DIRECTORIES ${current_dir}/*)
foreach(SUB_DIRECTORY ${SUB_DIRECTORIES})
if(IS_DIRECTORY ${SUB_DIRECTORY})
CollectSourceFiles("${SUB_DIRECTORY}" "${variable}" "${ARGN}")
CollectAndAddSourceFiles("${target_name}" "${SUB_DIRECTORY}" BASE_DIR ${arg_BASE_DIR} EXCLUDE ${arg_EXCLUDE})
endif()
endforeach()
set(${variable} ${${variable}} PARENT_SCOPE)
endif()
endfunction()
@@ -52,20 +60,21 @@ endfunction()
# CollectIncludeDirectories(
# ${CMAKE_CURRENT_SOURCE_DIR}
# COMMON_PUBLIC_INCLUDES
# # Exclude
# EXCLUDE
# ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders
# ${CMAKE_CURRENT_SOURCE_DIR}/Platform)
#
function(CollectIncludeDirectories current_dir variable)
list(FIND ARGN "${current_dir}" IS_EXCLUDED)
function(CollectIncludeDirectories current_dir sources_variable)
cmake_parse_arguments(PARSE_ARGV 2 arg "" "" "EXCLUDE")
list(FIND arg_EXCLUDE "${current_dir}" IS_EXCLUDED)
if(IS_EXCLUDED EQUAL -1)
list(APPEND ${variable} ${current_dir})
list(APPEND ${sources_variable} ${current_dir})
file(GLOB SUB_DIRECTORIES ${current_dir}/*)
foreach(SUB_DIRECTORY ${SUB_DIRECTORIES})
if(IS_DIRECTORY ${SUB_DIRECTORY})
CollectIncludeDirectories("${SUB_DIRECTORY}" "${variable}" "${ARGN}")
CollectIncludeDirectories("${SUB_DIRECTORY}" "${sources_variable}" EXCLUDE ${arg_EXCLUDE})
endif()
endforeach()
set(${variable} ${${variable}} PARENT_SCOPE)
set(${sources_variable} ${${sources_variable}} PARENT_SCOPE)
endif()
endfunction()

View File

@@ -1,23 +1,7 @@
set(HEADER_FILES
src/CascCommon.h
src/CascLib.h
src/CascPort.h
src/common/Array.h
src/common/Common.h
src/common/Csv.h
src/common/Directory.h
src/common/FileStream.h
src/common/FileTree.h
src/common/ListFile.h
src/common/Map.h
src/common/Mime.h
src/common/Path.h
src/common/RootHandler.h
src/common/Sockets.h
src/jenkins/lookup.h
)
add_library(casc STATIC)
set(SRC_FILES
target_sources(casc
PRIVATE
src/common/Common.cpp
src/common/Directory.cpp
src/common/Csv.cpp
@@ -48,18 +32,36 @@ set(SRC_FILES
src/CascRootFile_Text.cpp
src/CascRootFile_TVFS.cpp
src/CascRootFile_OW.cpp
src/CascRootFile_WoW.cpp
)
src/CascRootFile_WoW.cpp)
add_library(casc STATIC ${SRC_FILES} ${HEADER_FILES})
target_sources(casc
PUBLIC
FILE_SET HEADERS
BASE_DIRS src
FILES
src/CascLib.h
PRIVATE
FILE_SET casc_private_headers
TYPE HEADERS
BASE_DIRS src
FILES
src/CascCommon.h
src/CascPort.h
src/common/Array.h
src/common/Common.h
src/common/Csv.h
src/common/Directory.h
src/common/FileStream.h
src/common/FileTree.h
src/common/ListFile.h
src/common/Map.h
src/common/Mime.h
src/common/Path.h
src/common/RootHandler.h
src/common/Sockets.h
src/jenkins/lookup.h)
target_include_directories(casc
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/src
PRIVATE
${CMAKE_SOURCE_DIR}/dep)
target_compile_definitions(casc PUBLIC __SYS_ZLIB CASCLIB_NO_AUTO_LINK_LIBRARY CASCLIB_NODEBUG)
target_compile_definitions(casc PUBLIC CASC_USE_SYSTEM_ZLIB CASCLIB_NO_AUTO_LINK_LIBRARY CASCLIB_NODEBUG)
target_link_libraries(casc
PRIVATE

View File

@@ -9,31 +9,37 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
set(SFMT_SOURCES
SFMT.c
SFMT.h
SFMT-alti.h
SFMT-common.h
SFMT-neon.h
SFMT-params.h
SFMT-params607.h
SFMT-params1279.h
SFMT-params2281.h
SFMT-params4253.h
SFMT-params11213.h
SFMT-params19937.h
SFMT-params44497.h
SFMT-params86243.h
SFMT-params132049.h
SFMT-params216091.h
SFMT-sse2.h
SFMT-sse2-msc.h)
add_library(sfmt STATIC)
add_library(sfmt STATIC ${SFMT_SOURCES})
target_sources(sfmt
PRIVATE
SFMT.c)
target_include_directories(sfmt
INTERFACE
${CMAKE_CURRENT_SOURCE_DIR})
target_sources(sfmt
PUBLIC
FILE_SET HEADERS
FILES
SFMT.h
SFMT-params.h
SFMT-params607.h
SFMT-params1279.h
SFMT-params2281.h
SFMT-params4253.h
SFMT-params11213.h
SFMT-params19937.h
SFMT-params44497.h
SFMT-params86243.h
SFMT-params132049.h
SFMT-params216091.h
PRIVATE
FILE_SET sfmt_private_headers
TYPE HEADERS
FILES
SFMT-alti.h
SFMT-common.h
SFMT-neon.h
SFMT-sse2.h
SFMT-sse2-msc.h)
# using the standard Mersenne exponent 19937
target_compile_definitions(sfmt PUBLIC SFMT_MEXP=19937)

View File

@@ -8,18 +8,36 @@
# 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 *.c)
add_library(argon2 STATIC)
target_sources(argon2
PRIVATE
argon2/argon2.c
argon2/core.c
argon2/encoding.c
argon2/thread.c
argon2/blake2/blake2b.c)
if(TRINITY_SYSTEM_PROCESSOR MATCHES "x86|amd64")
list(REMOVE_ITEM sources
${CMAKE_CURRENT_SOURCE_DIR}/argon2/ref.c)
target_sources(argon2 PRIVATE argon2/opt.c)
else()
list(REMOVE_ITEM sources
${CMAKE_CURRENT_SOURCE_DIR}/argon2/opt.c)
target_sources(argon2 PRIVATE argon2/ref.c)
endif()
add_library(argon2 STATIC
${sources})
target_sources(argon2
PUBLIC
FILE_SET HEADERS
FILES
argon2/argon2.h
PRIVATE
FILE_SET argon2_private_headers
TYPE HEADERS
FILES
argon2/core.h
argon2/encoding.h
argon2/thread.h
argon2/blake2/blake2.h
argon2/blake2/blake2-impl.h)
target_compile_definitions(argon2
PRIVATE
@@ -27,10 +45,6 @@ target_compile_definitions(argon2
set_target_properties(argon2 PROPERTIES LINKER_LANGUAGE CXX)
target_include_directories(argon2
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(argon2
PRIVATE
trinity-dependency-interface)

View File

@@ -1,79 +1,116 @@
if (BUILD_SHARED_LIBS)
set(EFSW_CPP_SOURCE
src/efsw/Atomic.hpp
src/efsw/base.hpp
src/efsw/Debug.cpp
src/efsw/Debug.hpp
src/efsw/DirectorySnapshot.cpp
src/efsw/DirectorySnapshot.hpp
src/efsw/DirectorySnapshotDiff.cpp
src/efsw/DirectorySnapshotDiff.hpp
src/efsw/DirWatcherGeneric.cpp
src/efsw/DirWatcherGeneric.hpp
src/efsw/FileInfo.cpp
src/efsw/FileInfo.hpp
src/efsw/FileSystem.cpp
src/efsw/FileSystem.hpp
src/efsw/FileWatcher.cpp
src/efsw/FileWatcherCWrapper.cpp
src/efsw/FileWatcherGeneric.cpp
src/efsw/FileWatcherGeneric.hpp
src/efsw/FileWatcherImpl.cpp
src/efsw/FileWatcherImpl.hpp
src/efsw/Lock.hpp
src/efsw/Log.cpp
src/efsw/Mutex.hpp
src/efsw/sophist.h
src/efsw/String.cpp
src/efsw/String.hpp
src/efsw/System.cpp
src/efsw/System.hpp
src/efsw/Thread.hpp
src/efsw/Utf.hpp
src/efsw/Watcher.cpp
src/efsw/Watcher.hpp
src/efsw/WatcherGeneric.cpp
src/efsw/WatcherGeneric.hpp
src/efsw/platform/platformimpl.hpp
)
add_library(efsw STATIC)
if (WIN32)
list (APPEND EFSW_CPP_SOURCE
src/efsw/platform/win/FileSystemImpl.cpp
src/efsw/platform/win/FileSystemImpl.hpp
src/efsw/platform/win/SystemImpl.cpp
src/efsw/platform/win/SystemImpl.hpp)
else ()
list (APPEND EFSW_CPP_SOURCE
src/efsw/platform/posix/FileSystemImpl.cpp
src/efsw/platform/posix/FileSystemImpl.hpp
src/efsw/platform/posix/SystemImpl.cpp
src/efsw/platform/posix/SystemImpl.hpp)
if(WIN32)
set(efsw_platform_dir "win")
else()
set(efsw_platform_dir "posix")
endif()
target_sources(efsw
PRIVATE
src/efsw/Debug.cpp
src/efsw/DirectorySnapshot.cpp
src/efsw/DirectorySnapshotDiff.cpp
src/efsw/DirWatcherGeneric.cpp
src/efsw/FileInfo.cpp
src/efsw/FileSystem.cpp
src/efsw/FileWatcher.cpp
src/efsw/FileWatcherCWrapper.cpp
src/efsw/FileWatcherGeneric.cpp
src/efsw/FileWatcherImpl.cpp
src/efsw/Log.cpp
src/efsw/String.cpp
src/efsw/System.cpp
src/efsw/Watcher.cpp
src/efsw/WatcherGeneric.cpp
src/efsw/platform/${efsw_platform_dir}/FileSystemImpl.cpp
src/efsw/platform/${efsw_platform_dir}/SystemImpl.cpp)
target_sources(efsw
PUBLIC
FILE_SET HEADERS
BASE_DIRS include
FILES
include/efsw/efsw.h
include/efsw/efsw.hpp)
target_sources(efsw
PRIVATE
FILE_SET efsw_private_headers
TYPE HEADERS
BASE_DIRS src
FILES
src/efsw/Atomic.hpp
src/efsw/base.hpp
src/efsw/Debug.hpp
src/efsw/DirectorySnapshot.hpp
src/efsw/DirectorySnapshotDiff.hpp
src/efsw/DirWatcherGeneric.hpp
src/efsw/FileInfo.hpp
src/efsw/FileSystem.hpp
src/efsw/FileWatcherGeneric.hpp
src/efsw/FileWatcherImpl.hpp
src/efsw/Lock.hpp
src/efsw/Mutex.hpp
src/efsw/sophist.h
src/efsw/String.hpp
src/efsw/System.hpp
src/efsw/Thread.hpp
src/efsw/Utf.hpp
src/efsw/Watcher.hpp
src/efsw/WatcherGeneric.hpp
src/efsw/platform/platformimpl.hpp
src/efsw/platform/${efsw_platform_dir}/FileSystemImpl.hpp
src/efsw/platform/${efsw_platform_dir}/SystemImpl.hpp)
if (APPLE)
list (APPEND EFSW_CPP_SOURCE
src/efsw/FileWatcherFSEvents.cpp
src/efsw/FileWatcherFSEvents.hpp
src/efsw/FileWatcherKqueue.cpp
src/efsw/FileWatcherKqueue.hpp
src/efsw/WatcherFSEvents.cpp
src/efsw/WatcherFSEvents.hpp
src/efsw/WatcherKqueue.cpp
src/efsw/WatcherKqueue.hpp)
set(OPTIONAL_LINK_LIBRARIES "-framework CoreFoundation" "-framework CoreServices")
target_sources(efsw
PRIVATE
src/efsw/FileWatcherFSEvents.cpp
src/efsw/FileWatcherKqueue.cpp
src/efsw/WatcherFSEvents.cpp
src/efsw/WatcherKqueue.cpp)
target_sources(efsw
PRIVATE
FILE_SET efsw_private_headers
TYPE HEADERS
BASE_DIRS src
FILES
src/efsw/FileWatcherFSEvents.hpp
src/efsw/FileWatcherKqueue.hpp
src/efsw/WatcherFSEvents.hpp
src/efsw/WatcherKqueue.hpp)
target_link_libraries(efsw
PRIVATE
$<LINK_LIBRARY:FRAMEWORK,CoreFoundation>
$<LINK_LIBRARY:FRAMEWORK,CoreServices>)
elseif (WIN32)
list (APPEND EFSW_CPP_SOURCE
src/efsw/FileWatcherWin32.cpp
src/efsw/FileWatcherWin32.hpp
src/efsw/WatcherWin32.cpp
src/efsw/WatcherWin32.hpp)
target_sources(efsw
PRIVATE
src/efsw/FileWatcherWin32.cpp
src/efsw/WatcherWin32.cpp)
target_sources(efsw
PRIVATE
FILE_SET efsw_private_headers
TYPE HEADERS
BASE_DIRS src
FILES
src/efsw/FileWatcherWin32.hpp
src/efsw/WatcherWin32.hpp)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
list (APPEND EFSW_CPP_SOURCE
src/efsw/FileWatcherInotify.cpp
src/efsw/FileWatcherInotify.hpp
src/efsw/WatcherInotify.cpp
src/efsw/WatcherInotify.hpp)
target_sources(efsw
PRIVATE
src/efsw/FileWatcherInotify.cpp
src/efsw/WatcherInotify.cpp)
target_sources(efsw
PRIVATE
FILE_SET efsw_private_headers
TYPE HEADERS
BASE_DIRS src
FILES
src/efsw/FileWatcherInotify.hpp
src/efsw/WatcherInotify.hpp)
find_path(EFSW_INOTIFY_H
NAMES
sys/inotify.h
@@ -83,34 +120,30 @@ if (BUILD_SHARED_LIBS)
list (APPEND EFSW_CPP_SOURCE
src/efsw/inotify-nosys.h
)
set(OPTIONAL_COMPILE_DEFINITIONS "-DEFSW_INOTIFY_NOSYS")
target_compile_definitions(efsw
PRIVATE
EFSW_INOTIFY_NOSYS)
endif()
elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
list (APPEND EFSW_CPP_SOURCE
src/efsw/FileWatcherKqueue.cpp
src/efsw/FileWatcherKqueue.hpp
src/efsw/WatcherKqueue.cpp
src/efsw/WatcherKqueue.hpp)
target_sources(efsw
PRIVATE
src/efsw/FileWatcherKqueue.cpp
src/efsw/WatcherKqueue.cpp)
target_sources(efsw
PRIVATE
FILE_SET efsw_private_headers
TYPE HEADERS
BASE_DIRS src
FILES
src/efsw/FileWatcherKqueue.hpp
src/efsw/WatcherKqueue.hpp)
endif()
add_library(efsw STATIC ${EFSW_CPP_SOURCE})
target_include_directories(efsw
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src)
target_compile_definitions(efsw
PRIVATE
${OPTIONAL_COMPILE_DEFINITIONS})
target_link_libraries(efsw
PRIVATE
trinity-dependency-interface
PUBLIC
threads
${OPTIONAL_LINK_LIBRARIES})
threads)
set_target_properties(efsw
PROPERTIES

View File

@@ -8,31 +8,32 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
set(FMT_HEADERS
include/fmt/args.h
include/fmt/base.h
include/fmt/chrono.h
include/fmt/color.h
include/fmt/compile.h
include/fmt/core.h
include/fmt/format.h
include/fmt/format-inl.h
include/fmt/os.h
include/fmt/ostream.h
include/fmt/printf.h
include/fmt/ranges.h
include/fmt/std.h
include/fmt/xchar.h)
add_library(fmt STATIC)
set(FMT_SOURCES
src/format.cc
src/os.cc)
add_library(fmt STATIC ${FMT_SOURCES} ${FMT_HEADERS})
target_include_directories(fmt
target_sources(fmt
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include)
FILE_SET HEADERS
BASE_DIRS include
FILES
include/fmt/args.h
include/fmt/base.h
include/fmt/chrono.h
include/fmt/color.h
include/fmt/compile.h
include/fmt/core.h
include/fmt/format.h
include/fmt/format-inl.h
include/fmt/os.h
include/fmt/ostream.h
include/fmt/printf.h
include/fmt/ranges.h
include/fmt/std.h
include/fmt/xchar.h)
target_sources(fmt
PRIVATE
src/format.cc
src/os.cc)
target_link_libraries(fmt
PRIVATE

View File

@@ -8,57 +8,71 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
set(g3dlib_STAT_SRCS
source/AABox.cpp
source/Any.cpp
source/AnyTableReader.cpp
source/BinaryFormat.cpp
source/BinaryInput.cpp
source/BinaryOutput.cpp
source/Box.cpp
source/Capsule.cpp
source/CollisionDetection.cpp
source/CoordinateFrame.cpp
source/Crypto.cpp
source/Cylinder.cpp
source/debugAssert.cpp
source/FileSystem.cpp
source/fileutils.cpp
source/format.cpp
source/g3dfnmatch.cpp
source/g3dmath.cpp
source/GThread.cpp
source/Line.cpp
source/LineSegment.cpp
source/Log.cpp
source/Matrix3.cpp
source/Matrix4.cpp
source/MemoryManager.cpp
source/PhysicsFrame.cpp
source/Plane.cpp
source/prompt.cpp
source/Quat.cpp
source/Random.cpp
source/Ray.cpp
source/RegistryUtil.cpp
source/Sphere.cpp
source/stringutils.cpp
source/System.cpp
source/TextInput.cpp
source/TextOutput.cpp
source/Triangle.cpp
source/uint128.cpp
source/UprightFrame.cpp
source/Vector2.cpp
source/Vector3.cpp
source/Vector4.cpp
)
add_library(g3dlib STATIC)
add_library(g3dlib STATIC ${g3dlib_STAT_SRCS})
target_sources(g3dlib
PRIVATE
source/AABox.cpp
source/Any.cpp
source/AnyTableReader.cpp
source/BinaryFormat.cpp
source/BinaryInput.cpp
source/BinaryOutput.cpp
source/Box.cpp
source/Capsule.cpp
source/CollisionDetection.cpp
source/CoordinateFrame.cpp
source/Crypto.cpp
source/Cylinder.cpp
source/debugAssert.cpp
source/FileSystem.cpp
source/fileutils.cpp
source/format.cpp
source/g3dfnmatch.cpp
source/g3dmath.cpp
source/GThread.cpp
source/Line.cpp
source/LineSegment.cpp
source/Log.cpp
source/Matrix3.cpp
source/Matrix4.cpp
source/MemoryManager.cpp
source/PhysicsFrame.cpp
source/Plane.cpp
source/prompt.cpp
source/Quat.cpp
source/Random.cpp
source/Ray.cpp
source/RegistryUtil.cpp
source/Sphere.cpp
source/stringutils.cpp
source/System.cpp
source/TextInput.cpp
source/TextOutput.cpp
source/Triangle.cpp
source/uint128.cpp
source/UprightFrame.cpp
source/Vector2.cpp
source/Vector3.cpp
source/Vector4.cpp)
target_include_directories(g3dlib
target_sources(g3dlib
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include)
FILE_SET HEADERS
BASE_DIRS include
FILES
include/G3D/AABox.h
include/G3D/BoundsTrait.h
include/G3D/Box.h
include/G3D/CoordinateFrame.h
include/G3D/g3dmath.h
include/G3D/Matrix3.h
include/G3D/Matrix4.h
include/G3D/Plane.h
include/G3D/Quat.h
include/G3D/Ray.h
include/G3D/Vector3.h
include/G3D/Vector4.h)
if((CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT NOJEM) OR TSAN)
target_compile_definitions(g3dlib

View File

@@ -8,16 +8,24 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
file(GLOB sources *.cpp *.c *.h)
add_library(gsoap STATIC)
add_library(gsoap STATIC ${sources})
target_sources(gsoap
PRIVATE
soapC.cpp
soapServer.cpp
stdsoap2.cpp)
target_sources(gsoap
PUBLIC
FILE_SET HEADERS
FILES
soapH.h
soapStub.h
stdsoap2.h)
set_target_properties(gsoap PROPERTIES LINKER_LANGUAGE CXX)
target_include_directories(gsoap
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR})
target_compile_definitions(gsoap
PUBLIC
WITH_OPENSSL)

View File

@@ -8,25 +8,29 @@
# 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 *.c *.h)
add_library(openssl_ed25519 SHARED)
add_library(openssl_ed25519
SHARED
curve25519.c
ed25519/ed25519.h
ec_lcl.h
internal/refcount.h)
target_sources(openssl_ed25519
PRIVATE
curve25519.c)
target_sources(openssl_ed25519
PUBLIC
FILE_SET HEADERS
FILES
ed25519/ed25519.h
PRIVATE
FILE_SET openssl_ed25519_private_headers
TYPE HEADERS
FILES
ec_lcl.h
internal/refcount.h)
set_target_properties(openssl_ed25519 PROPERTIES LINKER_LANGUAGE CXX)
target_include_directories(openssl_ed25519
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR})
target_compile_definitions(openssl_ed25519
PRIVATE
OPENSSL_ED25519_EXPORT
)
OPENSSL_ED25519_EXPORT)
target_link_libraries(openssl_ed25519
PRIVATE

View File

@@ -8,61 +8,98 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
set(protobuf_STAT_SRCS
src/google/protobuf/compiler/importer.cc
src/google/protobuf/compiler/parser.cc
src/google/protobuf/descriptor.cc
src/google/protobuf/descriptor.pb.cc
src/google/protobuf/descriptor_database.cc
src/google/protobuf/dynamic_message.cc
src/google/protobuf/extension_set.cc
src/google/protobuf/extension_set_heavy.cc
src/google/protobuf/generated_message_reflection.cc
src/google/protobuf/generated_message_util.cc
src/google/protobuf/io/coded_stream.cc
src/google/protobuf/io/gzip_stream.cc
src/google/protobuf/io/printer.cc
src/google/protobuf/io/strtod.cc
src/google/protobuf/io/tokenizer.cc
src/google/protobuf/io/zero_copy_stream.cc
src/google/protobuf/io/zero_copy_stream_impl.cc
src/google/protobuf/io/zero_copy_stream_impl_lite.cc
src/google/protobuf/message.cc
src/google/protobuf/message_lite.cc
src/google/protobuf/reflection_ops.cc
src/google/protobuf/repeated_field.cc
src/google/protobuf/service.cc
src/google/protobuf/stubs/common.cc
src/google/protobuf/stubs/once.cc
src/google/protobuf/stubs/stringprintf.cc
src/google/protobuf/stubs/structurally_valid.cc
src/google/protobuf/stubs/strutil.cc
src/google/protobuf/stubs/substitute.cc
src/google/protobuf/text_format.cc
src/google/protobuf/unknown_field_set.cc
src/google/protobuf/wire_format.cc
src/google/protobuf/wire_format_lite.cc
)
add_library(protobuf)
if (MSVC)
set(protobuf_STAT_SRCS
${protobuf_STAT_SRCS}
src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc
)
else()
set(protobuf_STAT_SRCS
${protobuf_STAT_SRCS}
src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc
)
endif()
add_library(protobuf ${protobuf_STAT_SRCS})
target_include_directories(protobuf
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/src
target_sources(protobuf
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/tc_custom)
src/google/protobuf/compiler/importer.cc
src/google/protobuf/compiler/parser.cc
src/google/protobuf/descriptor.cc
src/google/protobuf/descriptor.pb.cc
src/google/protobuf/descriptor_database.cc
src/google/protobuf/dynamic_message.cc
src/google/protobuf/extension_set.cc
src/google/protobuf/extension_set_heavy.cc
src/google/protobuf/generated_message_reflection.cc
src/google/protobuf/generated_message_util.cc
src/google/protobuf/io/coded_stream.cc
src/google/protobuf/io/gzip_stream.cc
src/google/protobuf/io/printer.cc
src/google/protobuf/io/strtod.cc
src/google/protobuf/io/tokenizer.cc
src/google/protobuf/io/zero_copy_stream.cc
src/google/protobuf/io/zero_copy_stream_impl.cc
src/google/protobuf/io/zero_copy_stream_impl_lite.cc
src/google/protobuf/message.cc
src/google/protobuf/message_lite.cc
src/google/protobuf/reflection_ops.cc
src/google/protobuf/repeated_field.cc
src/google/protobuf/service.cc
src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc
src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc
src/google/protobuf/stubs/common.cc
src/google/protobuf/stubs/once.cc
src/google/protobuf/stubs/stringprintf.cc
src/google/protobuf/stubs/structurally_valid.cc
src/google/protobuf/stubs/strutil.cc
src/google/protobuf/stubs/substitute.cc
src/google/protobuf/text_format.cc
src/google/protobuf/unknown_field_set.cc
src/google/protobuf/wire_format.cc
src/google/protobuf/wire_format_lite.cc)
target_sources(protobuf
PUBLIC
FILE_SET HEADERS
BASE_DIRS src
FILES
src/google/protobuf/compiler/importer.h
src/google/protobuf/compiler/parser.h
src/google/protobuf/descriptor_database.h
src/google/protobuf/descriptor.h
src/google/protobuf/descriptor.pb.h
src/google/protobuf/dynamic_message.h
src/google/protobuf/extension_set.h
src/google/protobuf/generated_enum_reflection.h
src/google/protobuf/generated_message_reflection.h
src/google/protobuf/generated_message_util.h
src/google/protobuf/io/coded_stream.h
src/google/protobuf/io/coded_stream_inl.h
src/google/protobuf/io/gzip_stream.h
src/google/protobuf/io/printer.h
src/google/protobuf/io/strtod.h
src/google/protobuf/io/tokenizer.h
src/google/protobuf/io/zero_copy_stream.h
src/google/protobuf/io/zero_copy_stream_impl.h
src/google/protobuf/io/zero_copy_stream_impl_lite.h
src/google/protobuf/message.h
src/google/protobuf/message_lite.h
src/google/protobuf/reflection_ops.h
src/google/protobuf/repeated_field.h
src/google/protobuf/service.h
src/google/protobuf/stubs/atomicops.h
src/google/protobuf/stubs/common.h
src/google/protobuf/stubs/hash.h
src/google/protobuf/stubs/map_util.h
src/google/protobuf/stubs/once.h
src/google/protobuf/stubs/platform_macros.h
src/google/protobuf/stubs/stl_util.h
src/google/protobuf/stubs/stringprintf.h
src/google/protobuf/stubs/strutil.h
src/google/protobuf/stubs/substitute.h
src/google/protobuf/stubs/template_util.h
src/google/protobuf/stubs/type_traits.h
src/google/protobuf/text_format.h
src/google/protobuf/unknown_field_set.h
src/google/protobuf/wire_format.h
src/google/protobuf/wire_format_lite.h
src/google/protobuf/wire_format_lite_inl.h
PRIVATE
FILE_SET protobuf_private_headers
TYPE HEADERS
BASE_DIRS tc_custom
FILES
tc_custom/config.h)
target_link_libraries(protobuf
PRIVATE

View File

@@ -8,27 +8,36 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
set(Detour_STAT_SRCS
add_library(Detour STATIC)
target_sources(Detour
PRIVATE
Source/DetourAlloc.cpp
Source/DetourAssert.cpp
Source/DetourCommon.cpp
Source/DetourNavMesh.cpp
Source/DetourNavMeshBuilder.cpp
Source/DetourNavMeshQuery.cpp
Source/DetourNode.cpp
)
Source/DetourNode.cpp)
add_library(Detour STATIC ${Detour_STAT_SRCS})
target_include_directories(Detour
target_sources(Detour
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/Include)
FILE_SET HEADERS
BASE_DIRS Include
FILES
Include/DetourAlloc.h
Include/DetourAssert.h
Include/DetourCommon.h
Include/DetourMath.h
Include/DetourNavMeshBuilder.h
Include/DetourNavMesh.h
Include/DetourNavMeshQuery.h
Include/DetourNode.h
Include/DetourStatus.h)
target_link_libraries(Detour
PRIVATE
trinity-dependency-interface
PUBLIC
zlib)
trinity-dependency-interface)
set_target_properties(Detour
PROPERTIES

View File

@@ -8,10 +8,13 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
set(Recast_STAT_SRCS
add_library(Recast STATIC)
target_sources(Recast
PRIVATE
Source/Recast.cpp
Source/RecastAlloc.cpp
Source/RecastAssert.cpp
Source/RecastAssert.cpp
Source/RecastArea.cpp
Source/RecastContour.cpp
Source/RecastFilter.cpp
@@ -19,20 +22,20 @@ set(Recast_STAT_SRCS
Source/RecastMesh.cpp
Source/RecastMeshDetail.cpp
Source/RecastRasterization.cpp
Source/RecastRegion.cpp
)
Source/RecastRegion.cpp)
add_library(Recast STATIC ${Recast_STAT_SRCS})
target_include_directories(Recast
target_sources(Recast
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/Include)
FILE_SET HEADERS
BASE_DIRS Include
FILES
Include/RecastAlloc.h
Include/RecastAssert.h
Include/Recast.h)
target_link_libraries(Recast
PRIVATE
trinity-dependency-interface
PUBLIC
zlib)
trinity-dependency-interface)
set_target_properties(Recast
PROPERTIES

View File

@@ -22,40 +22,44 @@ if(UNIX)
"${ZLIB_INCLUDE_DIRS}")
else()
# Use the bundled source on windows
SET(zlib_STAT_SRCS
adler32.c
compress.c
crc32.c
crc32.h
deflate.c
deflate.h
gzguts.h
infback.c
inffast.c
inffast.h
inffixed.h
inflate.c
inflate.h
inftrees.c
inftrees.h
trees.c
trees.h
uncompr.c
zconf.h
zlib.h
zutil.c
zutil.h
)
add_library(zlib STATIC)
add_library(zlib STATIC
${zlib_STAT_SRCS})
target_sources(zlib
PRIVATE
adler32.c
compress.c
crc32.c
deflate.c
infback.c
inffast.c
inflate.c
inftrees.c
trees.c
uncompr.c
zutil.c)
target_sources(zlib
PUBLIC
FILE_SET HEADERS
FILES
zlib.h
PRIVATE
FILE_SET zlib_private_headers
TYPE HEADERS
FILES
crc32.h
deflate.h
gzguts.h
inffast.h
inffixed.h
inflate.h
inftrees.h
trees.h
zconf.h
zutil.h)
set_target_properties(zlib PROPERTIES LINKER_LANGUAGE CXX)
target_include_directories(zlib
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(zlib
PRIVATE
trinity-dependency-interface)

View File

@@ -8,10 +8,14 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
CollectSourceFiles(
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
add_library(common)
CollectAndAddSourceFiles(
common
${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE_SOURCES
# Exclude
EXCLUDE
${CMAKE_CURRENT_SOURCE_DIR}/Debugging/Windows
${CMAKE_CURRENT_SOURCE_DIR}/Platform
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders
@@ -19,43 +23,20 @@ CollectSourceFiles(
${CMAKE_CURRENT_SOURCE_DIR}/network)
if(WIN32)
CollectSourceFiles(
CollectAndAddSourceFiles(
common
${CMAKE_CURRENT_SOURCE_DIR}/Debugging/Windows
WINDOWS_DEBUGGING_SOURCES)
list(APPEND PRIVATE_SOURCES
${WINDOWS_DEBUGGING_SOURCES})
CollectSourceFiles(
BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
CollectAndAddSourceFiles(
common
${CMAKE_CURRENT_SOURCE_DIR}/Platform/Windows
WINDOWS_PLATFORM_SOURCES)
list(APPEND PRIVATE_SOURCES
${WINDOWS_PLATFORM_SOURCES})
unset(WINDOWS_DEBUGGING_SOURCES)
unset(WINDOWS_PLATFORM_SOURCES)
BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
endif()
if(USE_COREPCH)
set(PRIVATE_PCH_HEADER PrecompiledHeaders/commonPCH.h)
endif(USE_COREPCH)
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
add_library(common
${PRIVATE_SOURCES}
)
CollectIncludeDirectories(
${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC_INCLUDES
# Exclude
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders
${CMAKE_CURRENT_SOURCE_DIR}/mmaps_common
${CMAKE_CURRENT_SOURCE_DIR}/network)
target_include_directories(common
PUBLIC
# Provide the binary dir for all child targets
${CMAKE_BINARY_DIR}
${PUBLIC_INCLUDES}
PRIVATE
${CMAKE_CURRENT_BINARY_DIR})
@@ -98,12 +79,8 @@ endif()
# Generate precompiled header
if(USE_COREPCH)
add_cxx_pch(common ${PRIVATE_PCH_HEADER})
add_cxx_pch(common PrecompiledHeaders/commonPCH.h)
endif()
unset(PRIVATE_SOURCES)
unset(PRIVATE_PCH_HEADER)
unset(PUBLIC_INCLUDES)
add_subdirectory(mmaps_common)
add_subdirectory(network)

View File

@@ -8,18 +8,13 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
CollectSourceFiles(
${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE_SOURCES)
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
CollectIncludeDirectories(
${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC_INCLUDES
)
add_library(mmaps_common)
add_library(mmaps_common ${PRIVATE_SOURCES})
CollectAndAddSourceFiles(
mmaps_common
${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(mmaps_common
PRIVATE
@@ -29,10 +24,6 @@ target_link_libraries(mmaps_common
Recast
Detour)
target_include_directories(mmaps_common
PUBLIC
${PUBLIC_INCLUDES})
set_target_properties(mmaps_common
PROPERTIES
COMPILE_WARNING_AS_ERROR ${WITH_WARNINGS_AS_ERRORS}

View File

@@ -8,22 +8,17 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
CollectSourceFiles(
${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE_SOURCES)
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
add_library(network
${PRIVATE_SOURCES})
add_library(network)
CollectIncludeDirectories(
CollectAndAddSourceFiles(
network
${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC_INCLUDES)
EXCLUDE
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
target_include_directories(network
PUBLIC
${PUBLIC_INCLUDES}
PRIVATE
${CMAKE_CURRENT_BINARY_DIR})

View File

@@ -10,29 +10,21 @@
########### bnetserver ###############
CollectSourceFiles(
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
add_executable(bnetserver)
CollectAndAddSourceFiles(
bnetserver
${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE_SOURCES
# Exclude
EXCLUDE
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
if (WIN32)
if (MSVC)
list(APPEND PRIVATE_SOURCES bnetserver.rc)
target_sources(bnetserver PRIVATE bnetserver.rc)
endif()
endif()
if (USE_COREPCH)
set(PRIVATE_PCH_HEADER PrecompiledHeaders/bnetPCH.h)
endif()
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
add_executable(bnetserver
${PRIVATE_SOURCES}
)
if (NOT WIN32)
else()
target_compile_definitions(bnetserver PRIVATE
_TRINITY_BNET_CONFIG="${CONF_DIR}/bnetserver.conf"
_TRINITY_BNET_CONFIG_DIR="${CONF_DIR}/bnetserver.conf.d"
@@ -45,15 +37,7 @@ target_link_libraries(bnetserver
PUBLIC
shared)
CollectIncludeDirectories(
${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC_INCLUDES
# Exclude
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
target_include_directories(bnetserver
PUBLIC
${PUBLIC_INCLUDES}
PRIVATE
${CMAKE_CURRENT_BINARY_DIR})
@@ -92,5 +76,5 @@ endif()
# Generate precompiled header
if (USE_COREPCH)
add_cxx_pch(bnetserver ${PRIVATE_PCH_HEADER})
add_cxx_pch(bnetserver PrecompiledHeaders/bnetPCH.h)
endif()

View File

@@ -8,31 +8,17 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
CollectSourceFiles(
${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE_SOURCES
# Exclude
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
if(USE_COREPCH)
set(PRIVATE_PCH_HEADER PrecompiledHeaders/databasePCH.h)
endif()
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
add_library(database
${PRIVATE_SOURCES}
)
add_library(database)
CollectIncludeDirectories(
CollectAndAddSourceFiles(
database
${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC_INCLUDES
# Exclude
EXCLUDE
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
target_include_directories(database
PUBLIC
${PUBLIC_INCLUDES}
PRIVATE
${CMAKE_CURRENT_BINARY_DIR})
@@ -63,5 +49,5 @@ endif()
# Generate precompiled header
if(USE_COREPCH)
add_cxx_pch(database ${PRIVATE_PCH_HEADER})
add_cxx_pch(database PrecompiledHeaders/databasePCH.h)
endif()

View File

@@ -8,22 +8,12 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
CollectSourceFiles(
${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE_SOURCES
# Exclude
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
if(USE_COREPCH)
set(PRIVATE_PCH_HEADER PrecompiledHeaders/gamePCH.h)
endif()
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
CollectIncludeDirectories(
${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC_INCLUDES
# Exclude
EXCLUDE
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
# Provide an interface target for the game project to allow
@@ -39,8 +29,13 @@ target_link_libraries(game-interface
shared
mmaps_common)
add_library(game
${PRIVATE_SOURCES})
add_library(game)
CollectAndAddSourceFiles(
game
${CMAKE_CURRENT_SOURCE_DIR}
EXCLUDE
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
target_include_directories(game
PRIVATE
@@ -73,5 +68,5 @@ endif()
# Generate precompiled header
if(USE_COREPCH)
add_cxx_pch(game ${PRIVATE_PCH_HEADER})
add_cxx_pch(game PrecompiledHeaders/gamePCH.h)
endif()

View File

@@ -8,33 +8,17 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
CollectSourceFiles(
${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE_SOURCES
# Exclude
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
if (USE_COREPCH)
set(PRIVATE_PCH_HEADER PrecompiledHeaders/protoPCH.h)
endif()
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
add_library(proto
${PRIVATE_SOURCES}
)
add_library(proto)
CollectIncludeDirectories(
CollectAndAddSourceFiles(
proto
${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC_INCLUDES
# Exclude
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders
${CMAKE_CURRENT_SOURCE_DIR}/Client/api
${CMAKE_CURRENT_SOURCE_DIR}/Client/global_extensions)
EXCLUDE
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
target_include_directories(proto
PUBLIC
${PUBLIC_INCLUDES}
PRIVATE
${CMAKE_CURRENT_BINARY_DIR})
@@ -66,5 +50,5 @@ endif()
# Generate precompiled header
if (USE_COREPCH)
add_cxx_pch(proto ${PRIVATE_PCH_HEADER})
add_cxx_pch(proto PrecompiledHeaders/protoPCH.h)
endif()

View File

@@ -88,13 +88,10 @@ foreach(GRAPH_KEY ${GRAPH_KEYS})
message(" |")
endforeach()
# Base sources which are used by every script project
if(USE_SCRIPTPCH)
set(PRIVATE_PCH_HEADER ScriptPCH.h)
endif()
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
add_library(scripts STATIC)
# Configures the scriptloader with the given name and stores the output in the LOADER_OUT variable.
# It is possible to expose multiple subdirectories from the same scriptloader through passing
# it to the variable arguments
@@ -145,32 +142,28 @@ foreach(SCRIPT_MODULE ${SCRIPT_MODULE_LIST})
# Add the module name to STATIC_SCRIPT_MODULES
list(APPEND STATIC_SCRIPT_MODULES ${SCRIPT_MODULE})
# Add the module content to the whole static module
CollectSourceFiles(${SCRIPT_MODULE_PATH} PRIVATE_SOURCES)
CollectAndAddSourceFiles(scripts ${SCRIPT_MODULE_PATH})
endif()
elseif(${SCRIPT_MODULE_VARIABLE} STREQUAL "dynamic")
# Generate an own dynamic module which is loadable on runtime
# Add the module content to the whole static module
unset(SCRIPT_MODULE_PRIVATE_SOURCES)
CollectSourceFiles(${SCRIPT_MODULE_PATH} SCRIPT_MODULE_PRIVATE_SOURCES)
# Configure the scriptloader
ConfigureScriptLoader(${SCRIPT_MODULE} SCRIPT_MODULE_PRIVATE_SCRIPTLOADER ON ${SCRIPT_MODULE})
GetProjectNameOfScriptModule(${SCRIPT_MODULE} SCRIPT_MODULE_PROJECT_NAME)
# Add the module name to DYNAMIC_SCRIPT_MODULES
list(APPEND DYNAMIC_SCRIPT_MODULE_PROJECTS ${SCRIPT_MODULE_PROJECT_NAME})
# Create the script module project
add_library(${SCRIPT_MODULE_PROJECT_NAME} SHARED
${SCRIPT_MODULE_PRIVATE_SOURCES}
${SCRIPT_MODULE_PRIVATE_SCRIPTLOADER})
add_library(${SCRIPT_MODULE_PROJECT_NAME} SHARED)
CollectAndAddSourceFiles(${SCRIPT_MODULE_PROJECT_NAME} ${SCRIPT_MODULE_PATH})
target_sources(${SCRIPT_MODULE_PROJECT_NAME}
PUBLIC
FILE_SET HEADERS FILES ScriptLoader.h)
target_link_libraries(${SCRIPT_MODULE_PROJECT_NAME}
PRIVATE
trinity-core-interface
PUBLIC
game)
target_include_directories(${SCRIPT_MODULE_PROJECT_NAME}
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR})
set_target_properties(${SCRIPT_MODULE_PROJECT_NAME}
PROPERTIES
COMPILE_WARNING_AS_ERROR ${WITH_WARNINGS_AS_ERRORS}
@@ -203,10 +196,13 @@ set(WORLDSERVER_DYNAMIC_SCRIPT_MODULES_DEPENDENCIES ${DYNAMIC_SCRIPT_MODULE_PROJ
ConfigureScriptLoader("static" SCRIPT_MODULE_PRIVATE_SCRIPTLOADER OFF ${STATIC_SCRIPT_MODULES})
add_library(scripts STATIC
ScriptLoader.h
${SCRIPT_MODULE_PRIVATE_SCRIPTLOADER}
${PRIVATE_SOURCES})
target_sources(scripts
PRIVATE
${SCRIPT_MODULE_PRIVATE_SCRIPTLOADER})
target_sources(scripts
PUBLIC
FILE_SET HEADERS FILES ScriptLoader.h)
target_link_libraries(scripts
PRIVATE
@@ -214,10 +210,6 @@ target_link_libraries(scripts
PUBLIC
game-interface)
target_include_directories(scripts
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR})
set_target_properties(scripts
PROPERTIES
COMPILE_WARNING_AS_ERROR ${WITH_WARNINGS_AS_ERRORS}
@@ -225,7 +217,7 @@ set_target_properties(scripts
# Generate precompiled header
if(USE_SCRIPTPCH)
add_cxx_pch("scripts" ${PRIVATE_PCH_HEADER} ${DYNAMIC_SCRIPT_MODULE_PROJECTS})
add_cxx_pch("scripts" ScriptPCH.h ${DYNAMIC_SCRIPT_MODULE_PROJECTS})
reuse_cxx_pch("${DYNAMIC_SCRIPT_MODULE_PROJECTS}" scripts)
endif()

View File

@@ -8,31 +8,17 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
CollectSourceFiles(
${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE_SOURCES
# Exclude
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
if(USE_COREPCH)
set(PRIVATE_PCH_HEADER PrecompiledHeaders/sharedPCH.h)
endif()
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
add_library(shared
${PRIVATE_SOURCES}
)
add_library(shared)
CollectIncludeDirectories(
CollectAndAddSourceFiles(
shared
${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC_INCLUDES
# Exclude
EXCLUDE
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
target_include_directories(shared
PUBLIC
${PUBLIC_INCLUDES}
PRIVATE
${CMAKE_CURRENT_BINARY_DIR})
@@ -66,5 +52,5 @@ endif()
# Generate precompiled header
if(USE_COREPCH)
add_cxx_pch(shared ${PRIVATE_PCH_HEADER})
add_cxx_pch(shared PrecompiledHeaders/sharedPCH.h)
endif()

View File

@@ -8,29 +8,23 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
CollectSourceFiles(
${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE_SOURCES
# Exclude
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
if(WIN32)
if(MSVC)
list(APPEND PRIVATE_SOURCES worldserver.rc)
endif()
endif()
if(USE_COREPCH)
set(PRIVATE_PCH_HEADER PrecompiledHeaders/worldPCH.h)
endif()
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
add_executable(worldserver
${PRIVATE_SOURCES}
)
if(NOT WIN32)
CollectAndAddSourceFiles(
worldserver
${CMAKE_CURRENT_SOURCE_DIR}
EXCLUDE
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
if(WIN32)
if(MSVC)
target_sources(worldserver PRIVATE worldserver.rc)
endif()
else()
target_compile_definitions(worldserver PRIVATE
_TRINITY_CORE_CONFIG="${CONF_DIR}/worldserver.conf"
_TRINITY_CORE_CONFIG_DIR="${CONF_DIR}/worldserver.conf.d"
@@ -46,15 +40,7 @@ target_link_libraries(worldserver
readline
gsoap)
CollectIncludeDirectories(
${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC_INCLUDES
# Exclude
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
target_include_directories(worldserver
PUBLIC
${PUBLIC_INCLUDES}
PRIVATE
${CMAKE_CURRENT_BINARY_DIR})
@@ -90,5 +76,5 @@ endif()
# Generate precompiled header
if(USE_COREPCH)
add_cxx_pch(worldserver ${PRIVATE_PCH_HEADER})
add_cxx_pch(worldserver PrecompiledHeaders/worldPCH.h)
endif()

View File

@@ -8,11 +8,11 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
CollectSourceFiles(
${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE_SOURCES)
add_library(extractor_common STATIC)
add_library(extractor_common STATIC ${PRIVATE_SOURCES})
CollectAndAddSourceFiles(
extractor_common
${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(extractor_common
PRIVATE
@@ -22,10 +22,6 @@ target_link_libraries(extractor_common
common
network)
target_include_directories(extractor_common
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR})
set_target_properties(extractor_common
PROPERTIES
COMPILE_WARNING_AS_ERROR ${WITH_WARNINGS_AS_ERRORS}

View File

@@ -8,18 +8,11 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
CollectSourceFiles(
${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE_SOURCES)
add_executable(mapextractor)
add_executable(mapextractor
${PRIVATE_SOURCES}
)
target_include_directories(mapextractor
PUBLIC
${CMAKE_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/loadlib)
CollectAndAddSourceFiles(
mapextractor
${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(mapextractor
PRIVATE
@@ -27,13 +20,7 @@ target_link_libraries(mapextractor
PUBLIC
extractor_common)
CollectIncludeDirectories(
${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC_INCLUDES)
target_include_directories(mapextractor
PUBLIC
${PUBLIC_INCLUDES}
PRIVATE
${CMAKE_CURRENT_BINARY_DIR})

View File

@@ -8,11 +8,11 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
CollectSourceFiles(
${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE_SOURCES)
add_executable(mmaps_generator)
add_executable(mmaps_generator ${PRIVATE_SOURCES})
CollectAndAddSourceFiles(
mmaps_generator
${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(mmaps_generator
PRIVATE
@@ -20,13 +20,7 @@ target_link_libraries(mmaps_generator
extractor_common
mmaps_common)
CollectIncludeDirectories(
${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC_INCLUDES)
target_include_directories(mmaps_generator
PUBLIC
${PUBLIC_INCLUDES}
PRIVATE
${CMAKE_CURRENT_BINARY_DIR})

View File

@@ -8,12 +8,11 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
set(PRIVATE_SOURCES
TileAssembler.cpp
TileAssembler.h
VMapAssembler.cpp)
add_executable(vmap4assembler)
add_executable(vmap4assembler ${PRIVATE_SOURCES})
CollectAndAddSourceFiles(
vmap4assembler
${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(vmap4assembler
PRIVATE

View File

@@ -8,11 +8,13 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
CollectSourceFiles(
${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE_SOURCES)
add_executable(vmap4extractor)
add_executable(vmap4extractor ${PRIVATE_SOURCES})
CollectAndAddSourceFiles(
vmap4extractor
${CMAKE_CURRENT_SOURCE_DIR}
EXCLUDE
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
target_link_libraries(vmap4extractor
PRIVATE
@@ -20,13 +22,7 @@ target_link_libraries(vmap4extractor
PUBLIC
extractor_common)
CollectIncludeDirectories(
${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC_INCLUDES)
target_include_directories(vmap4extractor
PUBLIC
${PUBLIC_INCLUDES}
PRIVATE
${CMAKE_CURRENT_BINARY_DIR})

View File

@@ -8,14 +8,13 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
CollectSourceFiles(
${CMAKE_CURRENT_SOURCE_DIR}
TEST_SOURCES
)
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
add_executable(tests ${TEST_SOURCES})
add_executable(tests)
CollectAndAddSourceFiles(
tests
${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(tests
PRIVATE
@@ -23,13 +22,7 @@ target_link_libraries(tests
game
Catch2::Catch2)
CollectIncludeDirectories(
${CMAKE_CURRENT_SOURCE_DIR}
TEST_INCLUDES)
target_include_directories(tests
PUBLIC
${TEST_INCLUDES}
PRIVATE
${CMAKE_CURRENT_BINARY_DIR})