mirror of
				https://github.com/DarkflameUniverse/DarkflameServer.git
				synced 2025-10-31 04:32:06 +00:00 
			
		
		
		
	test using FetchContent for dependencies
This commit is contained in:
		
							
								
								
									
										6
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
								
							| @@ -1,9 +1,6 @@ | |||||||
| [submodule "thirdparty/cpp-httplib"] | [submodule "thirdparty/cpp-httplib"] | ||||||
| 	path = thirdparty/cpp-httplib | 	path = thirdparty/cpp-httplib | ||||||
| 	url = https://github.com/yhirose/cpp-httplib | 	url = https://github.com/yhirose/cpp-httplib | ||||||
| [submodule "thirdparty/tinyxml2"] |  | ||||||
| 	path = thirdparty/tinyxml2 |  | ||||||
| 	url = https://github.com/leethomason/tinyxml2 |  | ||||||
| [submodule "thirdparty/recastnavigation"] | [submodule "thirdparty/recastnavigation"] | ||||||
| 	path = thirdparty/recastnavigation | 	path = thirdparty/recastnavigation | ||||||
| 	url = https://github.com/recastnavigation/recastnavigation | 	url = https://github.com/recastnavigation/recastnavigation | ||||||
| @@ -14,6 +11,3 @@ | |||||||
| 	path = thirdparty/mariadb-connector-cpp | 	path = thirdparty/mariadb-connector-cpp | ||||||
| 	url = https://github.com/mariadb-corporation/mariadb-connector-cpp.git | 	url = https://github.com/mariadb-corporation/mariadb-connector-cpp.git | ||||||
| 	ignore = dirty | 	ignore = dirty | ||||||
| [submodule "thirdparty/magic_enum"] |  | ||||||
| 	path = thirdparty/magic_enum |  | ||||||
| 	url = https://github.com/Neargye/magic_enum.git |  | ||||||
|   | |||||||
| @@ -109,6 +109,31 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) | |||||||
|  |  | ||||||
| find_package(MariaDB) | 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 | # Create a /resServer directory | ||||||
| make_directory(${CMAKE_BINARY_DIR}/resServer) | make_directory(${CMAKE_BINARY_DIR}/resServer) | ||||||
|  |  | ||||||
| @@ -251,9 +276,9 @@ include_directories( | |||||||
| 	"tests/dGameTests/dComponentsTests" | 	"tests/dGameTests/dComponentsTests" | ||||||
|  |  | ||||||
| 	SYSTEM | 	SYSTEM | ||||||
| 	"thirdparty/magic_enum/include/magic_enum" | 	# "thirdparty/magic_enum/include/magic_enum" | ||||||
| 	"thirdparty/raknet/Source" | 	"thirdparty/raknet/Source" | ||||||
| 	"thirdparty/tinyxml2" | 	# "thirdparty/tinyxml2" | ||||||
| 	"thirdparty/recastnavigation" | 	"thirdparty/recastnavigation" | ||||||
| 	"thirdparty/SQLite" | 	"thirdparty/SQLite" | ||||||
| 	"thirdparty/cpplinq" | 	"thirdparty/cpplinq" | ||||||
| @@ -341,7 +366,9 @@ target_precompile_headers( | |||||||
|  |  | ||||||
| target_precompile_headers( | target_precompile_headers( | ||||||
| 	tinyxml2 PRIVATE | 	tinyxml2 PRIVATE | ||||||
| 	"$<$<COMPILE_LANGUAGE:CXX>:${PROJECT_SOURCE_DIR}/thirdparty/tinyxml2/tinyxml2.h>" | 	"$<$<COMPILE_LANGUAGE:CXX>:${tinyxml2_SOURCE_DIR}/tinyxml2.h>" | ||||||
|  | 	#/home/jonah/DarkflameServer/build/gnu-debug/_deps/tinyxml2-src/tinyxml2.h | ||||||
|  | 	#/home/jonah/DarkflameServer/build/gnu-debug/_deps/tinyxml2-src | ||||||
| ) | ) | ||||||
|  |  | ||||||
| if(${ENABLE_TESTING}) | if(${ENABLE_TESTING}) | ||||||
|   | |||||||
| @@ -70,5 +70,6 @@ else () | |||||||
| endif () | endif () | ||||||
|  |  | ||||||
| target_link_libraries(dCommon | target_link_libraries(dCommon | ||||||
|  | 	PUBLIC magic_enum | ||||||
| 	PRIVATE ZLIB::ZLIB bcrypt tinyxml2 | 	PRIVATE ZLIB::ZLIB bcrypt tinyxml2 | ||||||
| 	INTERFACE dDatabase) | 	INTERFACE dDatabase) | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| #pragma once | #pragma once | ||||||
| #include <cstdint> | #include <cstdint> | ||||||
|  |  | ||||||
| #include "magic_enum.hpp" | #include <magic_enum/magic_enum.hpp> | ||||||
|  |  | ||||||
| namespace MessageType { | namespace MessageType { | ||||||
| 	enum class Game : uint16_t { | 	enum class Game : uint16_t { | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| #pragma once | #pragma once | ||||||
| #include <cstdint> | #include <cstdint> | ||||||
|  |  | ||||||
| #include "magic_enum.hpp" | #include <magic_enum/magic_enum.hpp> | ||||||
|  |  | ||||||
| namespace MessageType { | namespace MessageType { | ||||||
| 	enum class World : uint32_t { | 	enum class World : uint32_t { | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ | |||||||
| #define __STRINGIFIEDENUM_H__ | #define __STRINGIFIEDENUM_H__ | ||||||
|  |  | ||||||
| #include <string> | #include <string> | ||||||
| #include "magic_enum.hpp" | #include <magic_enum/magic_enum.hpp> | ||||||
|  |  | ||||||
| namespace StringifiedEnum { | namespace StringifiedEnum { | ||||||
| 	template<typename T> | 	template<typename T> | ||||||
|   | |||||||
| @@ -4,8 +4,7 @@ | |||||||
| #define __EINVENTORYTYPE__H__ | #define __EINVENTORYTYPE__H__ | ||||||
|  |  | ||||||
| #include <cstdint> | #include <cstdint> | ||||||
|  | #include <magic_enum/magic_enum.hpp> | ||||||
| #include "magic_enum.hpp" |  | ||||||
|  |  | ||||||
| static const uint8_t NUMBER_OF_INVENTORIES = 17; | static const uint8_t NUMBER_OF_INVENTORIES = 17; | ||||||
| /** | /** | ||||||
|   | |||||||
| @@ -4,4 +4,4 @@ add_subdirectory(GameDatabase) | |||||||
| add_library(dDatabase STATIC "MigrationRunner.cpp") | add_library(dDatabase STATIC "MigrationRunner.cpp") | ||||||
| target_include_directories(dDatabase PUBLIC ".") | target_include_directories(dDatabase PUBLIC ".") | ||||||
| target_link_libraries(dDatabase | target_link_libraries(dDatabase | ||||||
| 	PUBLIC dDatabaseCDClient dDatabaseGame) | 	PUBLIC magic_enum dDatabaseCDClient dDatabaseGame) | ||||||
|   | |||||||
| @@ -55,7 +55,7 @@ set(DGAME_DBEHAVIORS_SOURCES "AirMovementBehavior.cpp" | |||||||
| 	"VerifyBehavior.cpp") | 	"VerifyBehavior.cpp") | ||||||
|  |  | ||||||
| add_library(dBehaviors OBJECT ${DGAME_DBEHAVIORS_SOURCES}) | 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 "." | target_include_directories(dBehaviors PUBLIC "." | ||||||
| 	"${PROJECT_SOURCE_DIR}/dGame/dGameMessages" # via BehaviorContext.h | 	"${PROJECT_SOURCE_DIR}/dGame/dGameMessages" # via BehaviorContext.h | ||||||
| 	PRIVATE | 	PRIVATE | ||||||
|   | |||||||
| @@ -79,4 +79,4 @@ target_include_directories(dComponents PUBLIC "." | |||||||
| ) | ) | ||||||
| target_precompile_headers(dComponents REUSE_FROM dGameBase) | target_precompile_headers(dComponents REUSE_FROM dGameBase) | ||||||
|  |  | ||||||
| target_link_libraries(dComponents INTERFACE dBehaviors) | target_link_libraries(dComponents PUBLIC magic_enum tinyxml2 INTERFACE dBehaviors) | ||||||
|   | |||||||
| @@ -6,7 +6,7 @@ set(DGAME_DGAMEMESSAGES_SOURCES | |||||||
|  |  | ||||||
| add_library(dGameMessages OBJECT ${DGAME_DGAMEMESSAGES_SOURCES}) | add_library(dGameMessages OBJECT ${DGAME_DGAMEMESSAGES_SOURCES}) | ||||||
| target_link_libraries(dGameMessages | target_link_libraries(dGameMessages | ||||||
| 	PUBLIC dDatabase | 	PUBLIC magic_enum tinyxml2 dDatabase | ||||||
| 	INTERFACE dGameBase # TradingManager | 	INTERFACE dGameBase # TradingManager | ||||||
| ) | ) | ||||||
| target_include_directories(dGameMessages PUBLIC "." | target_include_directories(dGameMessages PUBLIC "." | ||||||
|   | |||||||
| @@ -24,6 +24,7 @@ target_include_directories(dInventory PUBLIC "." | |||||||
| 	"${PROJECT_SOURCE_DIR}/dGame/dMission" # via MissionComponent.h | 	"${PROJECT_SOURCE_DIR}/dGame/dMission" # via MissionComponent.h | ||||||
| 	"${PROJECT_SOURCE_DIR}/dZoneManager" # via Item.cpp | 	"${PROJECT_SOURCE_DIR}/dZoneManager" # via Item.cpp | ||||||
| ) | ) | ||||||
|  | target_link_libraries(dInventory PUBLIC magic_enum tinyxml2) | ||||||
| target_precompile_headers(dInventory REUSE_FROM dGameBase) | 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. | # 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 | # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97185 | ||||||
|   | |||||||
| @@ -4,7 +4,7 @@ set(DGAME_DMISSION_SOURCES | |||||||
| 	"MissionTask.cpp") | 	"MissionTask.cpp") | ||||||
|  |  | ||||||
| add_library(dMission OBJECT ${DGAME_DMISSION_SOURCES}) | 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 "." | target_include_directories(dMission PUBLIC "." | ||||||
| 	PRIVATE | 	PRIVATE | ||||||
| 	"${PROJECT_SOURCE_DIR}/dGame/dComponents" | 	"${PROJECT_SOURCE_DIR}/dGame/dComponents" | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ foreach(file ${DGAME_DPROPERTYBEHAVIORS_CONTROLBEHAVIORMESSAGES}) | |||||||
| endforeach() | endforeach() | ||||||
|  |  | ||||||
| add_library(dPropertyBehaviors OBJECT ${DGAME_DPROPERTYBEHAVIORS_SOURCES}) | 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" | target_include_directories(dPropertyBehaviors PUBLIC "." "ControlBehaviorMessages" | ||||||
| 	PRIVATE | 	PRIVATE | ||||||
| 	"${PROJECT_SOURCE_DIR}/dCommon/dClient" # ControlBehaviors.cpp uses AssetManager | 	"${PROJECT_SOURCE_DIR}/dCommon/dClient" # ControlBehaviors.cpp uses AssetManager | ||||||
|   | |||||||
| @@ -14,4 +14,4 @@ target_include_directories(dNavigation PUBLIC "." | |||||||
| 	"${PROJECT_SOURCE_DIR}/dGame/dEntity" | 	"${PROJECT_SOURCE_DIR}/dGame/dEntity" | ||||||
| 	"${PROJECT_SOURCE_DIR}/dNavigation/dTerrain" # via dNavMesh.cpp | 	"${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) | ||||||
|   | |||||||
| @@ -4,7 +4,7 @@ | |||||||
| #define _VARIADIC_MAX 10 | #define _VARIADIC_MAX 10 | ||||||
| #include "dCommonVars.h" | #include "dCommonVars.h" | ||||||
| #include "dNetCommon.h" | #include "dNetCommon.h" | ||||||
| #include "magic_enum.hpp" | #include <magic_enum/magic_enum.hpp> | ||||||
|  |  | ||||||
| enum class ServerType : uint32_t; | enum class ServerType : uint32_t; | ||||||
| enum class eLoginResponse : uint8_t; | enum class eLoginResponse : uint8_t; | ||||||
|   | |||||||
| @@ -8,7 +8,7 @@ set(DNET_SOURCES "AuthPackets.cpp" | |||||||
| 	"ZoneInstanceManager.cpp") | 	"ZoneInstanceManager.cpp") | ||||||
|  |  | ||||||
| add_library(dNet STATIC ${DNET_SOURCES}) | 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 | target_include_directories(dNet PRIVATE | ||||||
| 	"${PROJECT_SOURCE_DIR}/dCommon" | 	"${PROJECT_SOURCE_DIR}/dCommon" | ||||||
| 	"${PROJECT_SOURCE_DIR}/dCommon/dEnums" | 	"${PROJECT_SOURCE_DIR}/dCommon/dEnums" | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ target_include_directories(WorldServer PRIVATE | |||||||
| 	"${PROJECT_SOURCE_DIR}/dServer" # BinaryPathFinder.h | 	"${PROJECT_SOURCE_DIR}/dServer" # BinaryPathFinder.h | ||||||
| ) | ) | ||||||
|  |  | ||||||
| target_link_libraries(WorldServer ${COMMON_LIBRARIES} | target_link_libraries(WorldServer PUBLIC ${COMMON_LIBRARIES} | ||||||
| 	dScripts | 	dScripts | ||||||
| 	dGameBase | 	dGameBase | ||||||
| 	dComponents | 	dComponents | ||||||
|   | |||||||
| @@ -32,7 +32,7 @@ add_custom_command(TARGET dCommonTests POST_BUILD | |||||||
| endif() | endif() | ||||||
|  |  | ||||||
| # Link needed libraries | # 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 | # Copy test files to testing directory | ||||||
| add_subdirectory(TestBitStreams) | add_subdirectory(TestBitStreams) | ||||||
|   | |||||||
| @@ -8,7 +8,7 @@ | |||||||
| #include "Game.h" | #include "Game.h" | ||||||
| #include "MessageType/Game.h" | #include "MessageType/Game.h" | ||||||
| #include "MessageType/World.h" | #include "MessageType/World.h" | ||||||
| #include "magic_enum.hpp" | #include <magic_enum/magic_enum.hpp> | ||||||
|  |  | ||||||
| #define ENUM_EQ(e, y, z)\ | #define ENUM_EQ(e, y, z)\ | ||||||
| 	LOG("%s %s", StringifiedEnum::ToString(static_cast<e>(y)).data(), #z);\ | 	LOG("%s %s", StringifiedEnum::ToString(static_cast<e>(y)).data(), #z);\ | ||||||
|   | |||||||
| @@ -23,7 +23,7 @@ add_custom_command(TARGET dGameTests POST_BUILD | |||||||
| 	WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) | 	WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) | ||||||
| endif() | 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) | 	dGame dScripts dPhysics Detour Recast tinyxml2 dWorldServer dZoneManager dChatFilter dNavigation) | ||||||
|  |  | ||||||
| # Discover the tests | # Discover the tests | ||||||
|   | |||||||
							
								
								
									
										11
									
								
								thirdparty/CMakeLists.txt
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										11
									
								
								thirdparty/CMakeLists.txt
									
									
									
									
										vendored
									
									
								
							| @@ -3,8 +3,6 @@ add_subdirectory(recastnavigation) | |||||||
|  |  | ||||||
| # Turn off tinyxml2 testing | # Turn off tinyxml2 testing | ||||||
| set(tinyxml2_BUILD_TESTING OFF) | 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. | # Source Code for libbcrypt.  Uses a file glob instead to get around Windows build issues. | ||||||
| file( | file( | ||||||
| @@ -34,21 +32,12 @@ target_include_directories(bcrypt PRIVATE "libbcrypt/src") | |||||||
| # Source code for sqlite | # Source code for sqlite | ||||||
| add_subdirectory(SQLite) | add_subdirectory(SQLite) | ||||||
|  |  | ||||||
| # Source code for magic_enum |  | ||||||
| add_subdirectory(magic_enum) |  | ||||||
|  |  | ||||||
| # Create our third party library objects | # Create our third party library objects | ||||||
| add_subdirectory(raknet) | add_subdirectory(raknet) | ||||||
|  |  | ||||||
| # Download Backtrace if configured | # Download Backtrace if configured | ||||||
| if(UNIX AND NOT APPLE) | if(UNIX AND NOT APPLE) | ||||||
| 	include(FetchContent) |  | ||||||
| 	if (${INCLUDE_BACKTRACE} AND ${COMPILE_BACKTRACE}) | 	if (${INCLUDE_BACKTRACE} AND ${COMPILE_BACKTRACE}) | ||||||
| 		FetchContent_Declare( |  | ||||||
| 			backtrace |  | ||||||
| 			GIT_REPOSITORY https://github.com/ianlancetaylor/libbacktrace.git |  | ||||||
| 		) |  | ||||||
|  |  | ||||||
| 		FetchContent_MakeAvailable(backtrace) | 		FetchContent_MakeAvailable(backtrace) | ||||||
|  |  | ||||||
| 		if (NOT EXISTS ${backtrace_SOURCE_DIR}/.libs) | 		if (NOT EXISTS ${backtrace_SOURCE_DIR}/.libs) | ||||||
|   | |||||||
							
								
								
									
										1
									
								
								thirdparty/magic_enum
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								thirdparty/magic_enum
									
									
									
									
										vendored
									
									
								
							 Submodule thirdparty/magic_enum deleted from e55b9b54d5
									
								
							
							
								
								
									
										1
									
								
								thirdparty/tinyxml2
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								thirdparty/tinyxml2
									
									
									
									
										vendored
									
									
								
							 Submodule thirdparty/tinyxml2 deleted from a977397684
									
								
							
		Reference in New Issue
	
	Block a user
	 jadebenn
					jadebenn