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)
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_COREDEBUG "Include additional debug-code in core" 0)
|
||||
option(WITHOUT_METRICS "Disable metrics reporting (i.e. InfluxDB and Grafana)" 0)
|
||||
@@ -54,8 +58,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()
|
||||
|
||||
@@ -29,6 +29,9 @@ if(SERVERS)
|
||||
add_subdirectory(mysql)
|
||||
add_subdirectory(readline)
|
||||
add_subdirectory(gsoap)
|
||||
endif()
|
||||
|
||||
if(SERVERS AND BUILD_EFSW)
|
||||
add_subdirectory(efsw)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -1,90 +1,86 @@
|
||||
if (BUILD_SHARED_LIBS)
|
||||
set(SRCS
|
||||
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/Mutex.cpp
|
||||
src/efsw/String.cpp
|
||||
src/efsw/System.cpp
|
||||
src/efsw/Thread.cpp
|
||||
src/efsw/Watcher.cpp
|
||||
src/efsw/WatcherGeneric.cpp)
|
||||
set(SRCS
|
||||
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/Mutex.cpp
|
||||
src/efsw/String.cpp
|
||||
src/efsw/System.cpp
|
||||
src/efsw/Thread.cpp
|
||||
src/efsw/Watcher.cpp
|
||||
src/efsw/WatcherGeneric.cpp)
|
||||
|
||||
if (WIN32)
|
||||
list (APPEND SRCS
|
||||
src/efsw/platform/win/FileSystemImpl.cpp
|
||||
src/efsw/platform/win/MutexImpl.cpp
|
||||
src/efsw/platform/win/SystemImpl.cpp
|
||||
src/efsw/platform/win/ThreadImpl.cpp)
|
||||
else ()
|
||||
list (APPEND SRCS
|
||||
src/efsw/platform/posix/FileSystemImpl.cpp
|
||||
src/efsw/platform/posix/MutexImpl.cpp
|
||||
src/efsw/platform/posix/SystemImpl.cpp
|
||||
src/efsw/platform/posix/ThreadImpl.cpp)
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
list (APPEND SRCS
|
||||
src/efsw/FileWatcherFSEvents.cpp
|
||||
src/efsw/FileWatcherKqueue.cpp
|
||||
src/efsw/WatcherFSEvents.cpp
|
||||
src/efsw/WatcherKqueue.cpp)
|
||||
|
||||
exec_program(uname ARGS -v OUTPUT_VARIABLE OSX_VERSION)
|
||||
string(REGEX MATCH "[0-9]+" OSX_VERSION ${OSX_VERSION})
|
||||
if (NOT OSX_VERSION GREATER 9)
|
||||
set(OPTIONAL_COMPILE_DEFINITIONS "-DEFSW_FSEVENTS_NOT_SUPPORTED")
|
||||
endif()
|
||||
set(OPTIONAL_LINK_LIBRARIES "-framework CoreFoundation" "-framework CoreServices")
|
||||
elseif (WIN32)
|
||||
list (APPEND SRCS
|
||||
src/efsw/FileWatcherWin32.cpp
|
||||
src/efsw/WatcherWin32.cpp)
|
||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
list (APPEND SRCS
|
||||
src/efsw/FileWatcherInotify.cpp
|
||||
src/efsw/WatcherInotify.cpp)
|
||||
if (NOT EXISTS "/usr/include/sys/inotify.h" AND NOT EXISTS "/usr/local/include/sys/inotify.h")
|
||||
set(OPTIONAL_COMPILE_DEFINITIONS "-DEFSW_INOTIFY_NOSYS")
|
||||
endif()
|
||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||
list (APPEND SRCS
|
||||
src/efsw/FileWatcherKqueue.cpp
|
||||
src/efsw/WatcherKqueue.cpp)
|
||||
endif()
|
||||
|
||||
add_library(efsw STATIC ${SRCS})
|
||||
|
||||
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})
|
||||
|
||||
set_target_properties(efsw
|
||||
PROPERTIES
|
||||
FOLDER
|
||||
"dep")
|
||||
if (WIN32)
|
||||
list (APPEND SRCS
|
||||
src/efsw/platform/win/FileSystemImpl.cpp
|
||||
src/efsw/platform/win/MutexImpl.cpp
|
||||
src/efsw/platform/win/SystemImpl.cpp
|
||||
src/efsw/platform/win/ThreadImpl.cpp)
|
||||
else ()
|
||||
add_library(efsw INTERFACE IMPORTED GLOBAL)
|
||||
endif ()
|
||||
list (APPEND SRCS
|
||||
src/efsw/platform/posix/FileSystemImpl.cpp
|
||||
src/efsw/platform/posix/MutexImpl.cpp
|
||||
src/efsw/platform/posix/SystemImpl.cpp
|
||||
src/efsw/platform/posix/ThreadImpl.cpp)
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
list (APPEND SRCS
|
||||
src/efsw/FileWatcherFSEvents.cpp
|
||||
src/efsw/FileWatcherKqueue.cpp
|
||||
src/efsw/WatcherFSEvents.cpp
|
||||
src/efsw/WatcherKqueue.cpp)
|
||||
|
||||
exec_program(uname ARGS -v OUTPUT_VARIABLE OSX_VERSION)
|
||||
string(REGEX MATCH "[0-9]+" OSX_VERSION ${OSX_VERSION})
|
||||
if (NOT OSX_VERSION GREATER 9)
|
||||
set(OPTIONAL_COMPILE_DEFINITIONS "-DEFSW_FSEVENTS_NOT_SUPPORTED")
|
||||
endif()
|
||||
set(OPTIONAL_LINK_LIBRARIES "-framework CoreFoundation" "-framework CoreServices")
|
||||
elseif (WIN32)
|
||||
list (APPEND SRCS
|
||||
src/efsw/FileWatcherWin32.cpp
|
||||
src/efsw/WatcherWin32.cpp)
|
||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
list (APPEND SRCS
|
||||
src/efsw/FileWatcherInotify.cpp
|
||||
src/efsw/WatcherInotify.cpp)
|
||||
if (NOT EXISTS "/usr/include/sys/inotify.h" AND NOT EXISTS "/usr/local/include/sys/inotify.h")
|
||||
set(OPTIONAL_COMPILE_DEFINITIONS "-DEFSW_INOTIFY_NOSYS")
|
||||
endif()
|
||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||
list (APPEND SRCS
|
||||
src/efsw/FileWatcherKqueue.cpp
|
||||
src/efsw/WatcherKqueue.cpp)
|
||||
endif()
|
||||
|
||||
add_library(efsw STATIC ${SRCS})
|
||||
|
||||
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})
|
||||
|
||||
set_target_properties(efsw
|
||||
PROPERTIES
|
||||
FOLDER
|
||||
"dep")
|
||||
|
||||
@@ -51,10 +51,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
|
||||
FOLDER
|
||||
|
||||
Reference in New Issue
Block a user