From 6f82606e21ca7691cc82488ce11426c4ee6df4eb Mon Sep 17 00:00:00 2001 From: jadebenn Date: Thu, 21 Nov 2024 02:18:16 -0600 Subject: [PATCH] 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 4ba6a43b..8d3a80b8 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 0d9d394b..377daff6 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 d020ff72..fd3430a6 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 8c5bddae..60359da4 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 acca6246..6e56fd59 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 1816d705..deab81d8 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 1c6688b2..e671f4b9 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 004bdc14..3384ad66 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 35d8cae6..0c884be9 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 c60e135f..545bb149 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 0f28dea4..1d168213 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 b45b27bf..dc461620 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 51f74c37..c8f6a26f 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 3e03ba1d..91681916 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 e2a1c6ef..53e55845 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 ee1e4586..9c7e2bf2 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 15cdda42..602e5700 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 62a3767a..815a2c08 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 ef7c4cba..7af4f347 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 fcd517f1..a1e1fb3e 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 e1c29433..7e7a6dbd 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 79863a53..b370ccff 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 e55b9b54..00000000 --- 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 a9773976..00000000 --- a/thirdparty/tinyxml2 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a9773976845b19e89020c1215781e71116477ef1