diff --git a/CMakeLists.txt b/CMakeLists.txt index 6acca4d8..1a977a64 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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" ) diff --git a/dCommon/CMakeLists.txt b/dCommon/CMakeLists.txt index 7262bfef..028eb29f 100644 --- a/dCommon/CMakeLists.txt +++ b/dCommon/CMakeLists.txt @@ -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) diff --git a/dGame/CMakeLists.txt b/dGame/CMakeLists.txt index 5acdba31..6b31802e 100644 --- a/dGame/CMakeLists.txt +++ b/dGame/CMakeLists.txt @@ -56,4 +56,4 @@ endforeach() add_library(dGame STATIC ${DGAME_SOURCES}) -target_link_libraries(dGame dDatabase) +target_link_libraries(dGame dDatabase Recast Detour) diff --git a/dNavigation/CMakeLists.txt b/dNavigation/CMakeLists.txt index 5891c77d..4c03d24b 100644 --- a/dNavigation/CMakeLists.txt +++ b/dNavigation/CMakeLists.txt @@ -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) diff --git a/dPhysics/CMakeLists.txt b/dPhysics/CMakeLists.txt index 383393cc..5fe6adaa 100644 --- a/dPhysics/CMakeLists.txt +++ b/dPhysics/CMakeLists.txt @@ -7,3 +7,4 @@ set(DPHYSICS_SOURCES "dpCollisionChecks.cpp" "dpWorld.cpp") add_library(dPhysics STATIC ${DPHYSICS_SOURCES}) +target_link_libraries(dPhysics Recast Detour) diff --git a/dWorldServer/CMakeLists.txt b/dWorldServer/CMakeLists.txt index 05338960..fcf29838 100644 --- a/dWorldServer/CMakeLists.txt +++ b/dWorldServer/CMakeLists.txt @@ -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) diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt index c04e418e..c7a27510 100644 --- a/thirdparty/CMakeLists.txt +++ b/thirdparty/CMakeLists.txt @@ -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() \ No newline at end of file +endif() diff --git a/thirdparty/SQLite/CMakeLists.txt b/thirdparty/SQLite/CMakeLists.txt new file mode 100644 index 00000000..aa7a6423 --- /dev/null +++ b/thirdparty/SQLite/CMakeLists.txt @@ -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()