From 6f82606e21ca7691cc82488ce11426c4ee6df4eb Mon Sep 17 00:00:00 2001 From: jadebenn Date: Thu, 21 Nov 2024 02:18:16 -0600 Subject: [PATCH 1/7] testing --- .gitmodules | 6 ---- CMakeLists.txt | 31 +++++++++++++++++-- dCommon/CMakeLists.txt | 1 + dCommon/dEnums/MessageType/Game.h | 2 +- dCommon/dEnums/MessageType/World.h | 2 +- dCommon/dEnums/StringifiedEnum.h | 2 +- dCommon/dEnums/eInventoryType.h | 3 +- dDatabase/CMakeLists.txt | 2 +- dGame/dBehaviors/CMakeLists.txt | 2 +- dGame/dComponents/CMakeLists.txt | 2 +- dGame/dGameMessages/CMakeLists.txt | 2 +- dGame/dInventory/CMakeLists.txt | 1 + dGame/dMission/CMakeLists.txt | 2 +- dGame/dPropertyBehaviors/CMakeLists.txt | 2 +- dNavigation/CMakeLists.txt | 2 +- dNet/AuthPackets.h | 2 +- dNet/CMakeLists.txt | 2 +- dWorldServer/CMakeLists.txt | 2 +- tests/dCommonTests/CMakeLists.txt | 2 +- .../dEnumsTests/MagicEnumTests.cpp | 2 +- tests/dGameTests/CMakeLists.txt | 2 +- thirdparty/CMakeLists.txt | 11 ------- thirdparty/magic_enum | 1 - thirdparty/tinyxml2 | 1 - 24 files changed, 47 insertions(+), 40 deletions(-) delete mode 160000 thirdparty/magic_enum delete mode 160000 thirdparty/tinyxml2 diff --git a/.gitmodules b/.gitmodules index 4ba6a43b5..8d3a80b83 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,6 @@ [submodule "thirdparty/cpp-httplib"] path = thirdparty/cpp-httplib url = https://github.com/yhirose/cpp-httplib -[submodule "thirdparty/tinyxml2"] - path = thirdparty/tinyxml2 - url = https://github.com/leethomason/tinyxml2 [submodule "thirdparty/recastnavigation"] path = thirdparty/recastnavigation url = https://github.com/recastnavigation/recastnavigation @@ -14,6 +11,3 @@ path = thirdparty/mariadb-connector-cpp url = https://github.com/mariadb-corporation/mariadb-connector-cpp.git ignore = dirty -[submodule "thirdparty/magic_enum"] - path = thirdparty/magic_enum - url = https://github.com/Neargye/magic_enum.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 0d9d394b2..377daff6f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -109,6 +109,31 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) find_package(MariaDB) +# Fetch third party dependencies +include(FetchContent) +FetchContent_Declare( + backtrace + SYSTEM + GIT_REPOSITORY https://github.com/ianlancetaylor/libbacktrace.git +) +FetchContent_Declare( + magic_enum + SYSTEM + GIT_REPOSITORY https://github.com/Neargye/magic_enum.git + GIT_TAG v0.9.7 +) +FetchContent_Declare( + tinyxml2 + SYSTEM + GIT_REPOSITORY https://github.com/leethomason/tinyxml2.git + GIT_TAG 9.0.0 +) +FetchContent_MakeAvailable(magic_enum tinyxml2) + +include(CMakePrintHelpers) +cmake_print_properties(TARGETS magic_enum tinyxml2 PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES) + # Create a /resServer directory make_directory(${CMAKE_BINARY_DIR}/resServer) @@ -251,9 +276,9 @@ include_directories( "tests/dGameTests/dComponentsTests" SYSTEM - "thirdparty/magic_enum/include/magic_enum" + # "thirdparty/magic_enum/include/magic_enum" "thirdparty/raknet/Source" - "thirdparty/tinyxml2" + # "thirdparty/tinyxml2" "thirdparty/recastnavigation" "thirdparty/SQLite" "thirdparty/cpplinq" @@ -341,7 +366,7 @@ target_precompile_headers( target_precompile_headers( tinyxml2 PRIVATE - "$<$:${PROJECT_SOURCE_DIR}/thirdparty/tinyxml2/tinyxml2.h>" + "$<$:${tinyxml2_SOURCE_DIR}/tinyxml2.h>" ) if(${ENABLE_TESTING}) diff --git a/dCommon/CMakeLists.txt b/dCommon/CMakeLists.txt index d020ff72f..fd3430a6e 100644 --- a/dCommon/CMakeLists.txt +++ b/dCommon/CMakeLists.txt @@ -70,5 +70,6 @@ else () endif () target_link_libraries(dCommon + PUBLIC magic_enum PRIVATE ZLIB::ZLIB bcrypt tinyxml2 INTERFACE dDatabase) diff --git a/dCommon/dEnums/MessageType/Game.h b/dCommon/dEnums/MessageType/Game.h index 8c5bddae7..60359da4c 100644 --- a/dCommon/dEnums/MessageType/Game.h +++ b/dCommon/dEnums/MessageType/Game.h @@ -1,7 +1,7 @@ #pragma once #include -#include "magic_enum.hpp" +#include namespace MessageType { enum class Game : uint16_t { diff --git a/dCommon/dEnums/MessageType/World.h b/dCommon/dEnums/MessageType/World.h index acca62466..6e56fd590 100644 --- a/dCommon/dEnums/MessageType/World.h +++ b/dCommon/dEnums/MessageType/World.h @@ -1,7 +1,7 @@ #pragma once #include -#include "magic_enum.hpp" +#include namespace MessageType { enum class World : uint32_t { diff --git a/dCommon/dEnums/StringifiedEnum.h b/dCommon/dEnums/StringifiedEnum.h index 1816d705c..deab81d8d 100644 --- a/dCommon/dEnums/StringifiedEnum.h +++ b/dCommon/dEnums/StringifiedEnum.h @@ -2,7 +2,7 @@ #define __STRINGIFIEDENUM_H__ #include -#include "magic_enum.hpp" +#include namespace StringifiedEnum { template diff --git a/dCommon/dEnums/eInventoryType.h b/dCommon/dEnums/eInventoryType.h index 1c6688b22..e671f4b94 100644 --- a/dCommon/dEnums/eInventoryType.h +++ b/dCommon/dEnums/eInventoryType.h @@ -4,8 +4,7 @@ #define __EINVENTORYTYPE__H__ #include - -#include "magic_enum.hpp" +#include static const uint8_t NUMBER_OF_INVENTORIES = 17; /** diff --git a/dDatabase/CMakeLists.txt b/dDatabase/CMakeLists.txt index 004bdc147..3384ad66b 100644 --- a/dDatabase/CMakeLists.txt +++ b/dDatabase/CMakeLists.txt @@ -4,4 +4,4 @@ add_subdirectory(GameDatabase) add_library(dDatabase STATIC "MigrationRunner.cpp") target_include_directories(dDatabase PUBLIC ".") target_link_libraries(dDatabase - PUBLIC dDatabaseCDClient dDatabaseGame) + PUBLIC magic_enum dDatabaseCDClient dDatabaseGame) diff --git a/dGame/dBehaviors/CMakeLists.txt b/dGame/dBehaviors/CMakeLists.txt index 35d8cae66..0c884be95 100644 --- a/dGame/dBehaviors/CMakeLists.txt +++ b/dGame/dBehaviors/CMakeLists.txt @@ -55,7 +55,7 @@ set(DGAME_DBEHAVIORS_SOURCES "AirMovementBehavior.cpp" "VerifyBehavior.cpp") add_library(dBehaviors OBJECT ${DGAME_DBEHAVIORS_SOURCES}) -target_link_libraries(dBehaviors PUBLIC dDatabaseCDClient dPhysics) +target_link_libraries(dBehaviors PUBLIC dDatabaseCDClient dPhysics magic_enum tinyxml2) target_include_directories(dBehaviors PUBLIC "." "${PROJECT_SOURCE_DIR}/dGame/dGameMessages" # via BehaviorContext.h PRIVATE diff --git a/dGame/dComponents/CMakeLists.txt b/dGame/dComponents/CMakeLists.txt index c60e135fe..545bb1497 100644 --- a/dGame/dComponents/CMakeLists.txt +++ b/dGame/dComponents/CMakeLists.txt @@ -79,4 +79,4 @@ target_include_directories(dComponents PUBLIC "." ) target_precompile_headers(dComponents REUSE_FROM dGameBase) -target_link_libraries(dComponents INTERFACE dBehaviors) +target_link_libraries(dComponents PUBLIC magic_enum tinyxml2 INTERFACE dBehaviors) diff --git a/dGame/dGameMessages/CMakeLists.txt b/dGame/dGameMessages/CMakeLists.txt index 0f28dea4f..1d168213b 100644 --- a/dGame/dGameMessages/CMakeLists.txt +++ b/dGame/dGameMessages/CMakeLists.txt @@ -6,7 +6,7 @@ set(DGAME_DGAMEMESSAGES_SOURCES add_library(dGameMessages OBJECT ${DGAME_DGAMEMESSAGES_SOURCES}) target_link_libraries(dGameMessages - PUBLIC dDatabase + PUBLIC magic_enum tinyxml2 dDatabase INTERFACE dGameBase # TradingManager ) target_include_directories(dGameMessages PUBLIC "." diff --git a/dGame/dInventory/CMakeLists.txt b/dGame/dInventory/CMakeLists.txt index b45b27bf1..dc461620b 100644 --- a/dGame/dInventory/CMakeLists.txt +++ b/dGame/dInventory/CMakeLists.txt @@ -24,6 +24,7 @@ target_include_directories(dInventory PUBLIC "." "${PROJECT_SOURCE_DIR}/dGame/dMission" # via MissionComponent.h "${PROJECT_SOURCE_DIR}/dZoneManager" # via Item.cpp ) +target_link_libraries(dInventory PUBLIC magic_enum tinyxml2) target_precompile_headers(dInventory REUSE_FROM dGameBase) # Workaround for compiler bug where the optimized code could result in a memcpy of 0 bytes, even though that isnt possible. # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97185 diff --git a/dGame/dMission/CMakeLists.txt b/dGame/dMission/CMakeLists.txt index 51f74c37d..c8f6a26fa 100644 --- a/dGame/dMission/CMakeLists.txt +++ b/dGame/dMission/CMakeLists.txt @@ -4,7 +4,7 @@ set(DGAME_DMISSION_SOURCES "MissionTask.cpp") add_library(dMission OBJECT ${DGAME_DMISSION_SOURCES}) -target_link_libraries(dMission PUBLIC dDatabase) +target_link_libraries(dMission PUBLIC tinyxml2 dDatabase) target_include_directories(dMission PUBLIC "." PRIVATE "${PROJECT_SOURCE_DIR}/dGame/dComponents" diff --git a/dGame/dPropertyBehaviors/CMakeLists.txt b/dGame/dPropertyBehaviors/CMakeLists.txt index 3e03ba1d1..91681916c 100644 --- a/dGame/dPropertyBehaviors/CMakeLists.txt +++ b/dGame/dPropertyBehaviors/CMakeLists.txt @@ -13,7 +13,7 @@ foreach(file ${DGAME_DPROPERTYBEHAVIORS_CONTROLBEHAVIORMESSAGES}) endforeach() add_library(dPropertyBehaviors OBJECT ${DGAME_DPROPERTYBEHAVIORS_SOURCES}) -target_link_libraries(dPropertyBehaviors PRIVATE dDatabaseCDClient) +target_link_libraries(dPropertyBehaviors PUBLIC tinyxml2 PRIVATE dDatabaseCDClient) target_include_directories(dPropertyBehaviors PUBLIC "." "ControlBehaviorMessages" PRIVATE "${PROJECT_SOURCE_DIR}/dCommon/dClient" # ControlBehaviors.cpp uses AssetManager diff --git a/dNavigation/CMakeLists.txt b/dNavigation/CMakeLists.txt index e2a1c6ef3..53e558457 100644 --- a/dNavigation/CMakeLists.txt +++ b/dNavigation/CMakeLists.txt @@ -14,4 +14,4 @@ target_include_directories(dNavigation PUBLIC "." "${PROJECT_SOURCE_DIR}/dGame/dEntity" "${PROJECT_SOURCE_DIR}/dNavigation/dTerrain" # via dNavMesh.cpp ) -target_link_libraries(dNavigation PRIVATE Detour Recast dCommon) +target_link_libraries(dNavigation PUBLIC tinyxml2 PRIVATE Detour Recast dCommon) diff --git a/dNet/AuthPackets.h b/dNet/AuthPackets.h index ee1e4586e..9c7e2bf27 100644 --- a/dNet/AuthPackets.h +++ b/dNet/AuthPackets.h @@ -4,7 +4,7 @@ #define _VARIADIC_MAX 10 #include "dCommonVars.h" #include "dNetCommon.h" -#include "magic_enum.hpp" +#include enum class ServerType : uint32_t; enum class eLoginResponse : uint8_t; diff --git a/dNet/CMakeLists.txt b/dNet/CMakeLists.txt index 15cdda42b..602e57006 100644 --- a/dNet/CMakeLists.txt +++ b/dNet/CMakeLists.txt @@ -8,7 +8,7 @@ set(DNET_SOURCES "AuthPackets.cpp" "ZoneInstanceManager.cpp") add_library(dNet STATIC ${DNET_SOURCES}) -target_link_libraries(dNet PRIVATE bcrypt MD5) +target_link_libraries(dNet PUBLIC magic_enum PRIVATE bcrypt MD5) target_include_directories(dNet PRIVATE "${PROJECT_SOURCE_DIR}/dCommon" "${PROJECT_SOURCE_DIR}/dCommon/dEnums" diff --git a/dWorldServer/CMakeLists.txt b/dWorldServer/CMakeLists.txt index 62a3767aa..815a2c08b 100644 --- a/dWorldServer/CMakeLists.txt +++ b/dWorldServer/CMakeLists.txt @@ -13,7 +13,7 @@ target_include_directories(WorldServer PRIVATE "${PROJECT_SOURCE_DIR}/dServer" # BinaryPathFinder.h ) -target_link_libraries(WorldServer ${COMMON_LIBRARIES} +target_link_libraries(WorldServer PUBLIC ${COMMON_LIBRARIES} dScripts dGameBase dComponents diff --git a/tests/dCommonTests/CMakeLists.txt b/tests/dCommonTests/CMakeLists.txt index ef7c4cba9..7af4f3477 100644 --- a/tests/dCommonTests/CMakeLists.txt +++ b/tests/dCommonTests/CMakeLists.txt @@ -32,7 +32,7 @@ add_custom_command(TARGET dCommonTests POST_BUILD endif() # Link needed libraries -target_link_libraries(dCommonTests ${COMMON_LIBRARIES} GTest::gtest_main) +target_link_libraries(dCommonTests ${COMMON_LIBRARIES} GTest::gtest_main magic_enum) # Copy test files to testing directory add_subdirectory(TestBitStreams) diff --git a/tests/dCommonTests/dEnumsTests/MagicEnumTests.cpp b/tests/dCommonTests/dEnumsTests/MagicEnumTests.cpp index fcd517f1f..a1e1fb3e1 100644 --- a/tests/dCommonTests/dEnumsTests/MagicEnumTests.cpp +++ b/tests/dCommonTests/dEnumsTests/MagicEnumTests.cpp @@ -8,7 +8,7 @@ #include "Game.h" #include "MessageType/Game.h" #include "MessageType/World.h" -#include "magic_enum.hpp" +#include #define ENUM_EQ(e, y, z)\ LOG("%s %s", StringifiedEnum::ToString(static_cast(y)).data(), #z);\ diff --git a/tests/dGameTests/CMakeLists.txt b/tests/dGameTests/CMakeLists.txt index e1c294331..7e7a6dbd7 100644 --- a/tests/dGameTests/CMakeLists.txt +++ b/tests/dGameTests/CMakeLists.txt @@ -23,7 +23,7 @@ add_custom_command(TARGET dGameTests POST_BUILD WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) endif() -target_link_libraries(dGameTests ${COMMON_LIBRARIES} GTest::gtest_main +target_link_libraries(dGameTests ${COMMON_LIBRARIES} magic_enum GTest::gtest_main dGame dScripts dPhysics Detour Recast tinyxml2 dWorldServer dZoneManager dChatFilter dNavigation) # Discover the tests diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt index 79863a53b..b370ccff5 100644 --- a/thirdparty/CMakeLists.txt +++ b/thirdparty/CMakeLists.txt @@ -3,8 +3,6 @@ add_subdirectory(recastnavigation) # Turn off tinyxml2 testing set(tinyxml2_BUILD_TESTING OFF) -# Source Code for tinyxml2 -add_subdirectory(tinyxml2) # Source Code for libbcrypt. Uses a file glob instead to get around Windows build issues. file( @@ -34,21 +32,12 @@ target_include_directories(bcrypt PRIVATE "libbcrypt/src") # Source code for sqlite add_subdirectory(SQLite) -# Source code for magic_enum -add_subdirectory(magic_enum) - # Create our third party library objects add_subdirectory(raknet) # Download Backtrace if configured if(UNIX AND NOT APPLE) - include(FetchContent) if (${INCLUDE_BACKTRACE} AND ${COMPILE_BACKTRACE}) - FetchContent_Declare( - backtrace - GIT_REPOSITORY https://github.com/ianlancetaylor/libbacktrace.git - ) - FetchContent_MakeAvailable(backtrace) if (NOT EXISTS ${backtrace_SOURCE_DIR}/.libs) diff --git a/thirdparty/magic_enum b/thirdparty/magic_enum deleted file mode 160000 index e55b9b54d..000000000 --- a/thirdparty/magic_enum +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e55b9b54d5cf61f8e117cafb17846d7d742dd3b4 diff --git a/thirdparty/tinyxml2 b/thirdparty/tinyxml2 deleted file mode 160000 index a97739768..000000000 --- a/thirdparty/tinyxml2 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a9773976845b19e89020c1215781e71116477ef1 From b16785441e663efbf9800066d0cca2d857318ec3 Mon Sep 17 00:00:00 2001 From: jadebenn Date: Sat, 23 Nov 2024 14:54:43 -0800 Subject: [PATCH 2/7] download to common source directory --- .gitignore | 3 +++ CMakeLists.txt | 12 +++++++++--- thirdparty/CMakeLists.txt | 3 --- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 0b0d2ecf7..f5d132375 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,9 @@ docker/configs # Third party libraries thirdparty/mysql/ thirdparty/mysql_linux/ +thirdparty/backtrace/ +thirdparty/magic_enum/ +thirdparty/tinyxml2/ CMakeVariables.txt # Build folders diff --git a/CMakeLists.txt b/CMakeLists.txt index 377daff6f..4e9f4d2f8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -110,26 +110,34 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) find_package(MariaDB) # Fetch third party dependencies +set(DLU_THIRDPARTY_SOURCE_DIR ${CMAKE_SOURCE_DIR}/thirdparty) + include(FetchContent) FetchContent_Declare( backtrace SYSTEM + SOURCE_DIR ${DLU_THIRDPARTY_SOURCE_DIR}/backtrace GIT_REPOSITORY https://github.com/ianlancetaylor/libbacktrace.git ) FetchContent_Declare( magic_enum SYSTEM + SOURCE_DIR ${DLU_THIRDPARTY_SOURCE_DIR}/magic_enum GIT_REPOSITORY https://github.com/Neargye/magic_enum.git GIT_TAG v0.9.7 ) FetchContent_Declare( tinyxml2 SYSTEM + SOURCE_DIR ${DLU_THIRDPARTY_SOURCE_DIR}/tinyxml2 GIT_REPOSITORY https://github.com/leethomason/tinyxml2.git GIT_TAG 9.0.0 ) FetchContent_MakeAvailable(magic_enum tinyxml2) +# Turn off tinyxml2 testing +set(tinyxml2_BUILD_TESTING OFF) + include(CMakePrintHelpers) cmake_print_properties(TARGETS magic_enum tinyxml2 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES) @@ -276,9 +284,7 @@ include_directories( "tests/dGameTests/dComponentsTests" SYSTEM - # "thirdparty/magic_enum/include/magic_enum" "thirdparty/raknet/Source" - # "thirdparty/tinyxml2" "thirdparty/recastnavigation" "thirdparty/SQLite" "thirdparty/cpplinq" @@ -297,7 +303,7 @@ if(MSVC) # add_compile_options("/W4") # Want to enable warnings eventually, but WAY too much noise right now elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU") - add_compile_options("-Wuninitialized" "-Wold-style-cast") + add_compile_options("-Wuninitialized" "-Wold-style-cast" "-Wstrict-aliasing") else() message(WARNING "Unknown compiler: '${CMAKE_CXX_COMPILER_ID}' - No warning flags enabled.") endif() diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt index b370ccff5..26c6ec9e4 100644 --- a/thirdparty/CMakeLists.txt +++ b/thirdparty/CMakeLists.txt @@ -1,9 +1,6 @@ # Source Code for recast add_subdirectory(recastnavigation) -# Turn off tinyxml2 testing -set(tinyxml2_BUILD_TESTING OFF) - # Source Code for libbcrypt. Uses a file glob instead to get around Windows build issues. file( GLOB SOURCES_LIBBCRYPT From fd300027a8b1bc832f688190d69a0fc1dde87afd Mon Sep 17 00:00:00 2001 From: jadebenn Date: Sun, 24 Nov 2024 14:07:39 -0800 Subject: [PATCH 3/7] try building bcrypt from its own CMake --- CMakeLists.txt | 7 +++++++ thirdparty/CMakeLists.txt | 41 +++++++++++++++++++++++++-------------- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e9f4d2f8..94c2af681 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -119,6 +119,13 @@ FetchContent_Declare( SOURCE_DIR ${DLU_THIRDPARTY_SOURCE_DIR}/backtrace GIT_REPOSITORY https://github.com/ianlancetaylor/libbacktrace.git ) +FetchContent_Declare( + bcrypt + SYSTEM + SOURCE_DIR ${DLU_THIRDPARTY_SOURCE_DIR}/libbcrypt + GIT_REPOSITORY https://github.com/trusch/libbcrypt.git + GIT_TAG d6523c370de6e724ce4ec703e2449b5b028ea3b1 +) FetchContent_Declare( magic_enum SYSTEM diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt index 26c6ec9e4..98fdc3450 100644 --- a/thirdparty/CMakeLists.txt +++ b/thirdparty/CMakeLists.txt @@ -2,29 +2,40 @@ add_subdirectory(recastnavigation) # Source Code for libbcrypt. Uses a file glob instead to get around Windows build issues. -file( - GLOB SOURCES_LIBBCRYPT - LIST_DIRECTORIES false - RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" - ${CMAKE_CURRENT_SOURCE_DIR}/libbcrypt/src/*.c -) +# file( +# GLOB SOURCES_LIBBCRYPT +# LIST_DIRECTORIES false +# RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" +# ${CMAKE_CURRENT_SOURCE_DIR}/libbcrypt/src/*.c +# ) -add_library(bcrypt ${SOURCES_LIBBCRYPT}) +# add_library(bcrypt ${SOURCES_LIBBCRYPT}) +FetchContent_MakeAvailable(bcrypt) + +# Fix BCrypt header includes +get_target_property(BCRYPT_INCLUDES bcrypt INCLUDE_DIRECTORIES) +message(STATUS "BYCRPT_INCLUDES = ${BCRYPT_INCLUDES}") +target_include_directories(bcrypt INTERFACE ${BCRYPT_INCLUDES}) + +cmake_print_properties(TARGETS bcrypt PROPERTIES + PUBLIC_HEADER + INCLUDE_DIRECTORIES + INTERFACE_INCLUDE_DIRECTORIES) # Because we are not using the libbcrypt CMakeLists.txt, we need to include these headers for the library to use. # fortunately they are only needed for building the libbcrypt directory and nothing else, so these are marked private. -if(NOT WIN32) - target_include_directories(bcrypt PRIVATE "libbcrypt/include/bcrypt") -endif() +# if(NOT WIN32) +# target_include_directories(bcrypt PRIVATE "libbcrypt/include/bcrypt") +# endif() # Need to define this on Clang and GNU for 'strdup' support -if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU") - target_compile_definitions(bcrypt PRIVATE "_POSIX_C_SOURCE=200809L") -endif() +# if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU") +# target_compile_definitions(bcrypt PRIVATE "_POSIX_C_SOURCE=200809L") +# endif() -target_include_directories(bcrypt INTERFACE "libbcrypt/include") -target_include_directories(bcrypt PRIVATE "libbcrypt/src") +# target_include_directories(bcrypt INTERFACE "libbcrypt/include") +# target_include_directories(bcrypt PRIVATE "libbcrypt/src") # Source code for sqlite add_subdirectory(SQLite) From 764bf43778cb0ca40311f61bd4922c974561a9eb Mon Sep 17 00:00:00 2001 From: jadebenn Date: Tue, 26 Nov 2024 22:37:40 -0600 Subject: [PATCH 4/7] switch recast to using fetchcontent --- .gitignore | 1 + .gitmodules | 3 --- CMakeLists.txt | 12 +++++++++--- thirdparty/CMakeLists.txt | 2 +- thirdparty/recastnavigation | 2 +- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index f5d132375..f87f7c19d 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ thirdparty/mysql/ thirdparty/mysql_linux/ thirdparty/backtrace/ thirdparty/magic_enum/ +thirdparty/recastnavigation/ thirdparty/tinyxml2/ CMakeVariables.txt diff --git a/.gitmodules b/.gitmodules index 8d3a80b83..c2cfe7400 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,6 @@ [submodule "thirdparty/cpp-httplib"] path = thirdparty/cpp-httplib url = https://github.com/yhirose/cpp-httplib -[submodule "thirdparty/recastnavigation"] - path = thirdparty/recastnavigation - url = https://github.com/recastnavigation/recastnavigation [submodule "thirdparty/libbcrypt"] path = thirdparty/libbcrypt url = https://github.com/trusch/libbcrypt.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 94c2af681..6a3669d6a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -133,6 +133,13 @@ FetchContent_Declare( GIT_REPOSITORY https://github.com/Neargye/magic_enum.git GIT_TAG v0.9.7 ) +FetchContent_Declare( + Recast + SYSTEM + SOURCE_DIR ${DLU_THIRDPARTY_SOURCE_DIR}/recastnavigation + GIT_REPOSITORY https://github.com/recastnavigation/recastnavigation + GIT_TAG v1.6.0 +) FetchContent_Declare( tinyxml2 SYSTEM @@ -140,13 +147,13 @@ FetchContent_Declare( GIT_REPOSITORY https://github.com/leethomason/tinyxml2.git GIT_TAG 9.0.0 ) -FetchContent_MakeAvailable(magic_enum tinyxml2) +FetchContent_MakeAvailable(magic_enum Recast tinyxml2) # Turn off tinyxml2 testing set(tinyxml2_BUILD_TESTING OFF) include(CMakePrintHelpers) -cmake_print_properties(TARGETS magic_enum tinyxml2 PROPERTIES +cmake_print_properties(TARGETS magic_enum Recast tinyxml2 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES) # Create a /resServer directory @@ -292,7 +299,6 @@ include_directories( SYSTEM "thirdparty/raknet/Source" - "thirdparty/recastnavigation" "thirdparty/SQLite" "thirdparty/cpplinq" "thirdparty/cpp-httplib" diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt index 98fdc3450..24c8f4441 100644 --- a/thirdparty/CMakeLists.txt +++ b/thirdparty/CMakeLists.txt @@ -1,5 +1,5 @@ # Source Code for recast -add_subdirectory(recastnavigation) +# add_subdirectory(recastnavigation) # Source Code for libbcrypt. Uses a file glob instead to get around Windows build issues. # file( diff --git a/thirdparty/recastnavigation b/thirdparty/recastnavigation index c5cbd5302..6dc1667f5 160000 --- a/thirdparty/recastnavigation +++ b/thirdparty/recastnavigation @@ -1 +1 @@ -Subproject commit c5cbd53024c8a9d8d097a4371215e3342d2fdc87 +Subproject commit 6dc1667f580357e8a2154c28b7867bea7e8ad3a7 From ee40d98fb1ec7bae84f47f4b50f4656842aaed8b Mon Sep 17 00:00:00 2001 From: jadebenn Date: Tue, 26 Nov 2024 23:26:16 -0600 Subject: [PATCH 5/7] revert bcrypt compilation changes --- thirdparty/CMakeLists.txt | 41 ++++++++++++++------------------------- 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt index 24c8f4441..f94c99bac 100644 --- a/thirdparty/CMakeLists.txt +++ b/thirdparty/CMakeLists.txt @@ -2,40 +2,29 @@ # add_subdirectory(recastnavigation) # Source Code for libbcrypt. Uses a file glob instead to get around Windows build issues. -# file( -# GLOB SOURCES_LIBBCRYPT -# LIST_DIRECTORIES false -# RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" -# ${CMAKE_CURRENT_SOURCE_DIR}/libbcrypt/src/*.c -# ) + file( + GLOB SOURCES_LIBBCRYPT + LIST_DIRECTORIES false + RELATIVE "${DLU_THIRDPARTY_SOURCE_DIR}" + ${DLU_THIRDPARTY_SOURCE_DIR}/libbcrypt/src/*.c +) -# add_library(bcrypt ${SOURCES_LIBBCRYPT}) -FetchContent_MakeAvailable(bcrypt) - -# Fix BCrypt header includes -get_target_property(BCRYPT_INCLUDES bcrypt INCLUDE_DIRECTORIES) -message(STATUS "BYCRPT_INCLUDES = ${BCRYPT_INCLUDES}") -target_include_directories(bcrypt INTERFACE ${BCRYPT_INCLUDES}) - -cmake_print_properties(TARGETS bcrypt PROPERTIES - PUBLIC_HEADER - INCLUDE_DIRECTORIES - INTERFACE_INCLUDE_DIRECTORIES) +add_library(bcrypt ${SOURCES_LIBBCRYPT}) # Because we are not using the libbcrypt CMakeLists.txt, we need to include these headers for the library to use. # fortunately they are only needed for building the libbcrypt directory and nothing else, so these are marked private. -# if(NOT WIN32) -# target_include_directories(bcrypt PRIVATE "libbcrypt/include/bcrypt") -# endif() +if(NOT WIN32) + target_include_directories(bcrypt PRIVATE "libbcrypt/include/bcrypt") +endif() # Need to define this on Clang and GNU for 'strdup' support -# if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU") -# target_compile_definitions(bcrypt PRIVATE "_POSIX_C_SOURCE=200809L") -# endif() +if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU") + target_compile_definitions(bcrypt PRIVATE "_POSIX_C_SOURCE=200809L") +endif() -# target_include_directories(bcrypt INTERFACE "libbcrypt/include") -# target_include_directories(bcrypt PRIVATE "libbcrypt/src") +target_include_directories(bcrypt INTERFACE "libbcrypt/include") +target_include_directories(bcrypt PRIVATE "libbcrypt/src") # Source code for sqlite add_subdirectory(SQLite) From a355fbf00346d1ad08c9cf7bdaae83432aa2b773 Mon Sep 17 00:00:00 2001 From: jadebenn Date: Tue, 26 Nov 2024 23:31:04 -0600 Subject: [PATCH 6/7] fix recast git url --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7fc7271e1..91cd757a2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -137,7 +137,7 @@ FetchContent_Declare( Recast SYSTEM SOURCE_DIR ${DLU_THIRDPARTY_SOURCE_DIR}/recastnavigation - GIT_REPOSITORY https://github.com/recastnavigation/recastnavigation + GIT_REPOSITORY https://github.com/recastnavigation/recastnavigation.git GIT_TAG v1.6.0 ) FetchContent_Declare( From 32e6709f61f51358e7f95745a4f3a4641e66f5bf Mon Sep 17 00:00:00 2001 From: jadebenn Date: Tue, 26 Nov 2024 23:41:43 -0600 Subject: [PATCH 7/7] fix submodules --- .gitmodules | 3 --- thirdparty/libbcrypt | 1 - thirdparty/recastnavigation | 1 - 3 files changed, 5 deletions(-) delete mode 160000 thirdparty/libbcrypt delete mode 160000 thirdparty/recastnavigation diff --git a/.gitmodules b/.gitmodules index c2cfe7400..4c50f8b3c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,6 @@ [submodule "thirdparty/cpp-httplib"] path = thirdparty/cpp-httplib url = https://github.com/yhirose/cpp-httplib -[submodule "thirdparty/libbcrypt"] - path = thirdparty/libbcrypt - url = https://github.com/trusch/libbcrypt.git [submodule "thirdparty/mariadb-connector-cpp"] path = thirdparty/mariadb-connector-cpp url = https://github.com/mariadb-corporation/mariadb-connector-cpp.git diff --git a/thirdparty/libbcrypt b/thirdparty/libbcrypt deleted file mode 160000 index d6523c370..000000000 --- a/thirdparty/libbcrypt +++ /dev/null @@ -1 +0,0 @@ -Subproject commit d6523c370de6e724ce4ec703e2449b5b028ea3b1 diff --git a/thirdparty/recastnavigation b/thirdparty/recastnavigation deleted file mode 160000 index 6dc1667f5..000000000 --- a/thirdparty/recastnavigation +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6dc1667f580357e8a2154c28b7867bea7e8ad3a7