mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-12-22 13:33:35 +00:00
Modularize CMakeLists for submodules (#736)
* Use RecastNavigation CMakeLists * Use tinyxml2 CMakeLists * Use bcrypt CMakeLists * Move variable init to CMakeLists This has to be done here to prevent missing dependency errors. * General improvements Only link dynamic if on gnu use more thirdparty cmakes * Disable tinyxml2 testing
This commit is contained in:
parent
f8c1e2fb52
commit
c05562a227
@ -42,6 +42,12 @@ set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT
|
||||
# Echo the version
|
||||
message(STATUS "Version: ${PROJECT_VERSION}")
|
||||
|
||||
# Disable demo, tests and examples for recastNavigation. Turn these to ON if you want to use them
|
||||
# This has to be done here to prevent a rare build error due to missing dependencies on the initial generations.
|
||||
set(RECASTNAVIGATION_DEMO OFF CACHE BOOL "" FORCE)
|
||||
set(RECASTNAVIGATION_TESTS OFF CACHE BOOL "" FORCE)
|
||||
set(RECASTNAVIGATION_EXAMPLES OFF CACHE BOOL "" FORCE)
|
||||
|
||||
# Compiler flags:
|
||||
# Disabled deprecated warnings as the MySQL includes have deprecated code in them.
|
||||
# Disabled misleading indentation as DL_LinkedList from RakNet has a weird indent.
|
||||
@ -54,7 +60,7 @@ if(UNIX)
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++17 -O2 -Wuninitialized -D_GLIBCXX_USE_CXX11_ABI=0 -D_GLIBCXX_USE_CXX17_ABI=0 -static-libgcc -fPIC")
|
||||
endif()
|
||||
if (__dynamic)
|
||||
if (__dynamic AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -rdynamic")
|
||||
endif()
|
||||
if (__ggdb)
|
||||
@ -137,8 +143,7 @@ set(INCLUDED_DIRECTORIES
|
||||
|
||||
"thirdparty/raknet/Source"
|
||||
"thirdparty/tinyxml2"
|
||||
"thirdparty/recastnavigation/Recast/Include"
|
||||
"thirdparty/recastnavigation/Detour/Include"
|
||||
"thirdparty/recastnavigation"
|
||||
"thirdparty/SQLite"
|
||||
"thirdparty/cpplinq"
|
||||
)
|
||||
|
@ -19,7 +19,7 @@ include_directories(${PROJECT_SOURCE_DIR}/dCommon/)
|
||||
|
||||
add_library(dCommon STATIC ${DCOMMON_SOURCES})
|
||||
|
||||
target_link_libraries(dCommon libbcrypt)
|
||||
target_link_libraries(dCommon bcrypt)
|
||||
|
||||
if (UNIX)
|
||||
find_package(ZLIB REQUIRED)
|
||||
|
@ -56,4 +56,4 @@ endforeach()
|
||||
|
||||
add_library(dGame STATIC ${DGAME_SOURCES})
|
||||
|
||||
target_link_libraries(dGame dDatabase)
|
||||
target_link_libraries(dGame dDatabase Recast Detour)
|
||||
|
@ -7,4 +7,4 @@ foreach(file ${DNAVIGATIONS_DTERRAIN_SOURCES})
|
||||
endforeach()
|
||||
|
||||
add_library(dNavigation STATIC ${DNAVIGATION_SOURCES})
|
||||
target_link_libraries(dNavigation detour recast)
|
||||
target_link_libraries(dNavigation Detour Recast)
|
||||
|
@ -7,3 +7,4 @@ set(DPHYSICS_SOURCES "dpCollisionChecks.cpp"
|
||||
"dpWorld.cpp")
|
||||
|
||||
add_library(dPhysics STATIC ${DPHYSICS_SOURCES})
|
||||
target_link_libraries(dPhysics Recast Detour)
|
||||
|
@ -3,4 +3,4 @@ set(DWORLDSERVER_SOURCES "ObjectIDManager.cpp"
|
||||
"WorldServer.cpp")
|
||||
|
||||
add_executable(WorldServer ${DWORLDSERVER_SOURCES})
|
||||
target_link_libraries(WorldServer ${COMMON_LIBRARIES} dChatFilter dGame dZoneManager dPhysics detour recast tinyxml2 dNavigation)
|
||||
target_link_libraries(WorldServer ${COMMON_LIBRARIES} dChatFilter dGame dZoneManager Detour Recast dPhysics tinyxml2 dNavigation)
|
||||
|
62
thirdparty/CMakeLists.txt
vendored
62
thirdparty/CMakeLists.txt
vendored
@ -1,63 +1,27 @@
|
||||
# Source Code for recast
|
||||
file(
|
||||
GLOB SOURCES_RECAST
|
||||
LIST_DIRECTORIES false
|
||||
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/recastnavigation/Recast/Source/*.cpp
|
||||
)
|
||||
|
||||
# Source Code for detour
|
||||
file(
|
||||
GLOB SOURCES_DETOUR
|
||||
LIST_DIRECTORIES false
|
||||
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/recastnavigation/Detour/Source/*.cpp
|
||||
)
|
||||
add_subdirectory(recastnavigation)
|
||||
|
||||
# Turn off tinyxml2 testing
|
||||
set(tinyxml2_BUILD_TESTING OFF)
|
||||
# Source Code for tinyxml2
|
||||
file(
|
||||
GLOB SOURCES_TINYXML2
|
||||
LIST_DIRECTORIES false
|
||||
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tinyxml2/tinyxml2.cpp
|
||||
)
|
||||
add_subdirectory(tinyxml2)
|
||||
|
||||
# Source Code for libbcrypt
|
||||
file(
|
||||
GLOB SOURCES_LIBBCRYPT
|
||||
LIST_DIRECTORIES false
|
||||
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/libbcrypt/*.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/libbcrypt/src/*.c
|
||||
)
|
||||
# Disable warning about no project version.
|
||||
set(CMAKE_POLICY_DEFAULT_CMP0048 NEW)
|
||||
# Disable warning about the minimum version of cmake used for bcrypt being deprecated in the future
|
||||
set(CMAKE_WARN_DEPRECATED OFF CACHE BOOL "" FORCE)
|
||||
|
||||
file(
|
||||
GLOB SOURCES_SQLITE3
|
||||
LIST_DIRECTORIES false
|
||||
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/SQLite/*.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/SQLite/*.c
|
||||
)
|
||||
add_subdirectory(libbcrypt)
|
||||
|
||||
# Source code for sqlite
|
||||
add_subdirectory(SQLite)
|
||||
|
||||
# MariaDB C++ Connector
|
||||
include(CMakeMariaDBLists.txt)
|
||||
|
||||
# Create our third party library objects
|
||||
add_subdirectory(raknet)
|
||||
add_library(tinyxml2 ${SOURCES_TINYXML2})
|
||||
add_library(detour ${SOURCES_DETOUR})
|
||||
add_library(recast ${SOURCES_RECAST})
|
||||
add_library(libbcrypt ${SOURCES_LIBBCRYPT})
|
||||
add_library(sqlite3 ${SOURCES_SQLITE3})
|
||||
|
||||
if(UNIX)
|
||||
# Add warning disable flags and link Unix libraries to sqlite3
|
||||
target_link_libraries(sqlite3 pthread dl m)
|
||||
|
||||
# -Wno-unused-result -Wno-unknown-pragmas -fpermissive
|
||||
target_compile_options(sqlite3 PRIVATE "-Wno-return-local-addr" "-Wno-maybe-uninitialized")
|
||||
target_compile_options(libbcrypt PRIVATE "-Wno-implicit-function-declaration" "-Wno-int-conversion")
|
||||
endif()
|
||||
|
||||
# Download Backtrace if configured
|
||||
if(UNIX AND NOT APPLE)
|
||||
@ -81,4 +45,4 @@ if(UNIX AND NOT APPLE)
|
||||
link_directories(${backtrace_SOURCE_DIR}/.libs/)
|
||||
include_directories(${backtrace_SOURCE_DIR})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
14
thirdparty/SQLite/CMakeLists.txt
vendored
Normal file
14
thirdparty/SQLite/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
set (SQLITE3_SOURCES
|
||||
"CppSQLite3.cpp"
|
||||
"sqlite3.c"
|
||||
)
|
||||
|
||||
add_library (sqlite3 ${SQLITE3_SOURCES})
|
||||
|
||||
if(UNIX)
|
||||
# Add warning disable flags and link Unix libraries to sqlite3
|
||||
target_link_libraries(sqlite3 pthread dl m)
|
||||
|
||||
# -Wno-unused-result -Wno-unknown-pragmas -fpermissive
|
||||
target_compile_options(sqlite3 PRIVATE "-Wno-return-local-addr" "-Wno-maybe-uninitialized")
|
||||
endif()
|
Loading…
Reference in New Issue
Block a user