mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Build: Allow efsw to be built independently of WITH_DYNAMIC_LINKING option (#30019)
(cherry picked from commit 6a5fa255fe)
This commit is contained in:
@@ -37,6 +37,7 @@ option(TOOLS "Build map/vmap/mmap extraction/assembler tools"
|
||||
option(USE_SCRIPTPCH "Use precompiled headers when compiling scripts" 1)
|
||||
option(USE_COREPCH "Use precompiled headers when compiling servers" 1)
|
||||
option(WITH_DYNAMIC_LINKING "Enable dynamic library linking." 0)
|
||||
option(WITH_FILESYSTEM_WATCHER "Include filesystem watcher library" 0)
|
||||
IsDynamicLinkingRequired(WITH_DYNAMIC_LINKING_FORCED)
|
||||
if(WITH_DYNAMIC_LINKING AND WITH_DYNAMIC_LINKING_FORCED)
|
||||
set(WITH_DYNAMIC_LINKING_FORCED OFF)
|
||||
@@ -46,6 +47,9 @@ if(WITH_DYNAMIC_LINKING OR WITH_DYNAMIC_LINKING_FORCED)
|
||||
else()
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
endif()
|
||||
if(WITH_FILESYSTEM_WATCHER OR BUILD_SHARED_LIBS)
|
||||
set(BUILD_EFSW ON)
|
||||
endif()
|
||||
option(WITH_WARNINGS "Show all warnings during compile" 0)
|
||||
option(WITH_WARNINGS_AS_ERRORS "Treat warnings as errors" 0)
|
||||
option(WITH_COREDEBUG "Include additional debug-code in core" 0)
|
||||
@@ -55,8 +59,8 @@ option(COPY_CONF "Copy authserver and worldserver .conf.dist files to the
|
||||
set(WITH_SOURCE_TREE "hierarchical" CACHE STRING "Build the source tree for IDE's.")
|
||||
set_property(CACHE WITH_SOURCE_TREE PROPERTY STRINGS no flat hierarchical hierarchical-folders)
|
||||
option(WITHOUT_GIT "Disable the GIT testing routines" 0)
|
||||
option(BUILD_TESTING "Build test suite" 0)
|
||||
option(BUILD_TESTING "Build test suite" 0)
|
||||
|
||||
if(UNIX)
|
||||
option(USE_LD_GOLD "Use GNU gold linker" 0)
|
||||
option(USE_LD_GOLD "Use GNU gold linker" 0)
|
||||
endif()
|
||||
|
||||
@@ -31,10 +31,13 @@ if(SERVERS)
|
||||
add_subdirectory(readline)
|
||||
add_subdirectory(gsoap)
|
||||
add_subdirectory(rapidjson)
|
||||
add_subdirectory(efsw)
|
||||
add_subdirectory(protobuf)
|
||||
endif()
|
||||
|
||||
if(SERVERS AND BUILD_EFSW)
|
||||
add_subdirectory(efsw)
|
||||
endif()
|
||||
|
||||
if(TOOLS)
|
||||
add_subdirectory(CascLib)
|
||||
endif()
|
||||
|
||||
@@ -1,154 +1,150 @@
|
||||
if (BUILD_SHARED_LIBS)
|
||||
add_library(efsw STATIC)
|
||||
add_library(efsw STATIC)
|
||||
|
||||
if(WIN32)
|
||||
set(efsw_platform_dir "win")
|
||||
else()
|
||||
set(efsw_platform_dir "posix")
|
||||
endif()
|
||||
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)
|
||||
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)
|
||||
|
||||
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/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)
|
||||
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)
|
||||
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")
|
||||
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
|
||||
NO_CACHE
|
||||
)
|
||||
if (EFSW_INOTIFY_H STREQUAL "EFSW_INOTIFY_H-NOTFOUND")
|
||||
list (APPEND EFSW_CPP_SOURCE
|
||||
src/efsw/inotify-nosys.h
|
||||
)
|
||||
target_compile_definitions(efsw
|
||||
PRIVATE
|
||||
EFSW_INOTIFY_NOSYS)
|
||||
endif()
|
||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||
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()
|
||||
|
||||
src/efsw/FileWatcherFSEvents.hpp
|
||||
src/efsw/FileWatcherKqueue.hpp
|
||||
src/efsw/WatcherFSEvents.hpp
|
||||
src/efsw/WatcherKqueue.hpp)
|
||||
target_link_libraries(efsw
|
||||
PRIVATE
|
||||
trinity-dependency-interface
|
||||
PUBLIC
|
||||
threads)
|
||||
$<LINK_LIBRARY:FRAMEWORK,CoreFoundation>
|
||||
$<LINK_LIBRARY:FRAMEWORK,CoreServices>)
|
||||
elseif (WIN32)
|
||||
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")
|
||||
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
|
||||
NO_CACHE
|
||||
)
|
||||
if (EFSW_INOTIFY_H STREQUAL "EFSW_INOTIFY_H-NOTFOUND")
|
||||
list (APPEND EFSW_CPP_SOURCE
|
||||
src/efsw/inotify-nosys.h
|
||||
)
|
||||
target_compile_definitions(efsw
|
||||
PRIVATE
|
||||
EFSW_INOTIFY_NOSYS)
|
||||
endif()
|
||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||
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()
|
||||
|
||||
set_target_properties(efsw
|
||||
PROPERTIES
|
||||
FOLDER
|
||||
"dep")
|
||||
else ()
|
||||
add_library(efsw INTERFACE IMPORTED GLOBAL)
|
||||
endif ()
|
||||
target_link_libraries(efsw
|
||||
PRIVATE
|
||||
trinity-dependency-interface
|
||||
PUBLIC
|
||||
threads)
|
||||
|
||||
set_target_properties(efsw
|
||||
PROPERTIES
|
||||
FOLDER
|
||||
"dep")
|
||||
|
||||
@@ -44,10 +44,15 @@ target_include_directories(game
|
||||
target_link_libraries(game
|
||||
PRIVATE
|
||||
trinity-core-interface
|
||||
efsw
|
||||
PUBLIC
|
||||
game-interface)
|
||||
|
||||
if(TARGET efsw)
|
||||
target_link_libraries(game
|
||||
PRIVATE
|
||||
efsw)
|
||||
endif()
|
||||
|
||||
set_target_properties(game
|
||||
PROPERTIES
|
||||
COMPILE_WARNING_AS_ERROR ${WITH_WARNINGS_AS_ERRORS}
|
||||
|
||||
Reference in New Issue
Block a user