Update CMake configuration for easier maintenance (#642)

* Update CMake configuration for easier maintenance

* Incorrect casing fix

* Move package requirement

* Update CTest linking

* Add logs to the CMake

* Add linking for common libraries

Added linking for common libraries in tests subdirectory.

* Move test subdirectory higher up for some reason

* Whitespace a log removal

Missed new line

* Add dCommon to dChatFilter

* Update library output dir

* Correct libBcrypt

* Further refactor CMake behaviour

* Repair bad comments and update library defines

* Revert to old include directory method

* Implement platform defines

* Add missing include

Mac needs a specific include for defining platform.  Does not compile without this.

Co-authored-by: EmosewaMC <39972741+EmosewaMC@users.noreply.github.com>
This commit is contained in:
Jett 2022-07-17 00:24:16 +01:00 committed by GitHub
parent 9c0819de4f
commit df0f11c95b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 839 additions and 429 deletions

View File

@ -36,66 +36,43 @@ foreach(variable ${variables})
endif()
endforeach()
# On windows it's better to build this from source, as there's no way FindZLIB is gonna find it
if(NOT WIN32)
find_package(ZLIB REQUIRED)
endif()
# Fetch External (Non-Submodule) Libraries
if(WIN32)
include(FetchContent)
FetchContent_Declare(
zlib
URL https://github.com/madler/zlib/archive/refs/tags/v1.2.11.zip
URL_HASH MD5=9d6a627693163bbbf3f26403a3a0b0b1
)
FetchContent_MakeAvailable(zlib)
set(ZLIB_INCLUDE_DIRS ${zlib_SOURCE_DIR} ${zlib_BINARY_DIR})
set_target_properties(zlib PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${ZLIB_INCLUDE_DIRS}") # Why?
add_library(ZLIB::ZLIB ALIAS zlib) # You're welcome
endif(WIN32)
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)
set(backtrace_make_cmd "${backtrace_SOURCE_DIR}/configure --prefix=\"/usr\" --enable-shared --with-system-libunwind")
execute_process(
COMMAND bash -c "cd ${backtrace_SOURCE_DIR} && ${backtrace_make_cmd} && make && cd ${CMAKE_SOURCE_DIR}"
)
endif()
link_directories(${backtrace_SOURCE_DIR}/.libs/)
include_directories(${backtrace_SOURCE_DIR})
endif()
endif()
# Set the version
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPROJECT_VERSION=${PROJECT_VERSION}")
# Echo the version
message(STATUS "Version: ${PROJECT_VERSION}")
if(WIN32)
# 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.
# Disabled no-register
# Disabled unknown pragmas because Linux doesn't understand Windows pragmas.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPROJECT_VERSION=${PROJECT_VERSION}")
if(UNIX)
if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++17 -O2 -Wuninitialized -D_GLIBCXX_USE_CXX11_ABI=0 -D_GLIBCXX_USE_CXX17_ABI=0 -fPIC")
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)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -rdynamic")
endif()
if (__ggdb)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -O2 -fPIC")
elseif(MSVC)
# Skip warning for invalid conversion from size_t to uint32_t for all targets below for now
add_compile_options("/wd4267")
elseif(WIN32)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
endif(WIN32)
endif()
# Our output dir
set(CMAKE_BINARY_DIR ${PROJECT_BINARY_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
# Create a /res directory
make_directory(${CMAKE_BINARY_DIR}/res)
@ -107,41 +84,26 @@ make_directory(${CMAKE_BINARY_DIR}/locale)
make_directory(${CMAKE_BINARY_DIR}/logs)
# Copy ini files on first build
if (NOT EXISTS ${PROJECT_BINARY_DIR}/authconfig.ini)
set(INI_FILES "authconfig.ini" "chatconfig.ini" "worldconfig.ini" "masterconfig.ini")
foreach(ini ${INI_FILES})
if (NOT EXISTS ${PROJECT_BINARY_DIR}/${ini})
configure_file(
${CMAKE_SOURCE_DIR}/resources/authconfig.ini ${PROJECT_BINARY_DIR}/authconfig.ini
${CMAKE_SOURCE_DIR}/resources/${ini} ${PROJECT_BINARY_DIR}/${ini}
COPYONLY
)
endif()
if (NOT EXISTS ${PROJECT_BINARY_DIR}/chatconfig.ini)
configure_file(
${CMAKE_SOURCE_DIR}/resources/chatconfig.ini ${PROJECT_BINARY_DIR}/chatconfig.ini
COPYONLY
)
endif()
if (NOT EXISTS ${PROJECT_BINARY_DIR}/worldconfig.ini)
configure_file(
${CMAKE_SOURCE_DIR}/resources/worldconfig.ini ${PROJECT_BINARY_DIR}/worldconfig.ini
COPYONLY
)
endif()
if (NOT EXISTS ${PROJECT_BINARY_DIR}/masterconfig.ini)
configure_file(
${CMAKE_SOURCE_DIR}/resources/masterconfig.ini ${PROJECT_BINARY_DIR}/masterconfig.ini
COPYONLY
)
endif()
endif()
endforeach()
# Copy files to output
configure_file("${CMAKE_SOURCE_DIR}/vanity/CREDITS.md" "${CMAKE_BINARY_DIR}/vanity/CREDITS.md" COPYONLY)
configure_file("${CMAKE_SOURCE_DIR}/vanity/INFO.md" "${CMAKE_BINARY_DIR}/vanity/INFO.md" COPYONLY)
configure_file("${CMAKE_SOURCE_DIR}/vanity/TESTAMENT.md" "${CMAKE_BINARY_DIR}/vanity/TESTAMENT.md" COPYONLY)
configure_file("${CMAKE_SOURCE_DIR}/vanity/NPC.xml" "${CMAKE_BINARY_DIR}/vanity/NPC.xml" COPYONLY)
# Copy vanity files on first build
set(VANITY_FILES "CREDITS.md" "INFO.md" "TESTAMENT.md" "NPC.xml")
foreach(file ${VANITY_FILES})
configure_file("${CMAKE_SOURCE_DIR}/vanity/${file}" "${CMAKE_BINARY_DIR}/vanity/${file}" COPYONLY)
endforeach()
# Move our migrations for MasterServer to run
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/migrations/)
file(GLOB SQL_FILES ${CMAKE_SOURCE_DIR}/migrations/dlu/*.sql)
foreach (file ${SQL_FILES})
foreach(file ${SQL_FILES})
get_filename_component(file ${file} NAME)
if (NOT EXISTS ${PROJECT_BINARY_DIR}/migrations/${file})
configure_file(
@ -151,108 +113,61 @@ foreach (file ${SQL_FILES})
endif()
endforeach()
# 3rdparty includes
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/raknet/Source/)
if(APPLE)
include_directories(/usr/local/include/)
endif(APPLE)
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/tinyxml2/)
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/recastnavigation/Recast/Include)
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/recastnavigation/Detour/Include)
# Create our list of include directories
set(INCLUDED_DIRECTORIES
"dCommon"
"dChatFilter"
"dGame"
"dGame/dBehaviors"
"dGame/dComponents"
"dGame/dGameMessages"
"dGame/dInventory"
"dGame/dMission"
"dGame/dEntity"
"dGame/dUtilities"
"dPhysics"
"dZoneManager"
"dDatabase"
"dDatabase/Tables"
"dNet"
"dScripts"
"thirdparty/raknet/Source"
"thirdparty/tinyxml2"
"thirdparty/recastnavigation/Recast/Include"
"thirdparty/recastnavigation/Detour/Include"
"thirdparty/SQLite"
"thirdparty/cpplinq"
)
# Add system specfic includes for Apple, Windows and Other Unix OS' (including Linux)
if (APPLE)
include_directories("/usr/local/include/")
endif()
if (WIN32)
set(INCLUDED_DIRECTORIES ${INCLUDED_DIRECTORIES} "thirdparty/libbcrypt/include")
elseif (UNIX)
set(INCLUDED_DIRECTORIES ${INCLUDED_DIRECTORIES} "thirdparty/libbcrypt")
set(INCLUDED_DIRECTORIES ${INCLUDED_DIRECTORIES} "thirdparty/libbcrypt/include/bcrypt")
endif()
include_directories(${ZLIB_INCLUDE_DIRS})
# Bcrypt
if (NOT WIN32)
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/libbcrypt)
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/libbcrypt/include/bcrypt)
else ()
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/libbcrypt/include)
endif ()
# Our includes
# Add binary directory as an include directory
include_directories(${PROJECT_BINARY_DIR})
include_directories(${PROJECT_SOURCE_DIR}/dChatFilter/)
include_directories(${PROJECT_SOURCE_DIR}/dCommon/)
include_directories(${PROJECT_SOURCE_DIR}/dGame/)
include_directories(${PROJECT_SOURCE_DIR}/dGame/dBehaviors)
include_directories(${PROJECT_SOURCE_DIR}/dGame/dComponents)
include_directories(${PROJECT_SOURCE_DIR}/dGame/dGameMessages)
include_directories(${PROJECT_SOURCE_DIR}/dGame/dInventory)
include_directories(${PROJECT_SOURCE_DIR}/dGame/dMission)
include_directories(${PROJECT_SOURCE_DIR}/dGame/dEntity)
include_directories(${PROJECT_SOURCE_DIR}/dGame/dUtilities)
include_directories(${PROJECT_SOURCE_DIR}/dPhysics/)
include_directories(${PROJECT_SOURCE_DIR}/dZoneManager/)
include_directories(${PROJECT_SOURCE_DIR}/dDatabase/)
include_directories(${PROJECT_SOURCE_DIR}/dDatabase/Tables/)
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/SQLite/)
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/cpplinq/)
include_directories(${PROJECT_SOURCE_DIR}/dNet/)
include_directories(${PROJECT_SOURCE_DIR}/dScripts/)
# Lib folders:
# Actually include the directories from our list
foreach (dir ${INCLUDED_DIRECTORIES})
include_directories(${PROJECT_SOURCE_DIR}/${dir})
endforeach()
# Add linking directories:
link_directories(${PROJECT_BINARY_DIR})
# Third-Party libraries
# Load all of our third party directories
add_subdirectory(thirdparty)
# Source Code
file(
GLOB SOURCES
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
${PROJECT_SOURCE_DIR}/dWorldServer/*.cpp
)
# Source Code for AuthServer
file(
GLOB SOURCES_AUTH
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
${PROJECT_SOURCE_DIR}/dAuthServer/*.cpp
)
# Source Code for MasterServer
file(
GLOB SOURCES_MASTER
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
${PROJECT_SOURCE_DIR}/dMasterServer/*.cpp
)
# Source Code for ChatServer
file(
GLOB SOURCES_CHAT
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
${PROJECT_SOURCE_DIR}/dChatServer/*.cpp
)
# Source Code for dCommon
file(
GLOB SOURCES_DCOMMON
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
${PROJECT_SOURCE_DIR}/dCommon/*.cpp
)
# Source Code for dChatFilter
file(
GLOB SOURCES_DCHATFILTER
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
${PROJECT_SOURCE_DIR}/dChatFilter/*.cpp
)
# Source Code for dDatabase
file(
GLOB SOURCES_DDATABASE
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
${PROJECT_SOURCE_DIR}/dDatabase/*.cpp
${PROJECT_SOURCE_DIR}/dDatabase/Tables/*.cpp
)
# Glob together all headers that need to be precompiled
file(
GLOB HEADERS_DDATABASE
LIST_DIRECTORIES false
@ -282,79 +197,37 @@ file(
${PROJECT_SOURCE_DIR}/dScripts/CppScripts.h
)
# Source Code for dNet
file(
GLOB SOURCES_DNET
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
${PROJECT_SOURCE_DIR}/dNet/*.cpp
)
# Add our library subdirectories for creation of the library object
add_subdirectory(dCommon)
add_subdirectory(dDatabase)
add_subdirectory(dChatFilter)
add_subdirectory(dNet)
add_subdirectory(dScripts) # Add for dGame to use
add_subdirectory(dGame)
add_subdirectory(dZoneManager)
add_subdirectory(dPhysics)
# Source Code for dGame
file(
GLOB SOURCES_DGAME
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
${PROJECT_SOURCE_DIR}/dGame/*.cpp
${PROJECT_SOURCE_DIR}/dGame/dBehaviors/*.cpp
${PROJECT_SOURCE_DIR}/dGame/dComponents/*.cpp
${PROJECT_SOURCE_DIR}/dGame/dGameMessages/*.cpp
${PROJECT_SOURCE_DIR}/dGame/dInventory/*.cpp
${PROJECT_SOURCE_DIR}/dGame/dMission/*.cpp
${PROJECT_SOURCE_DIR}/dGame/dEntity/*.cpp
${PROJECT_SOURCE_DIR}/dGame/dUtilities/*.cpp
${PROJECT_SOURCE_DIR}/dScripts/*.cpp
)
# Create a list of common libraries shared between all binaries
set(COMMON_LIBRARIES "dCommon" "dDatabase" "dNet" "raknet" "mariadbConnCpp")
# Source Code for dZoneManager
file(
GLOB SOURCES_DZM
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
${PROJECT_SOURCE_DIR}/dZoneManager/*.cpp
)
# Add platform specific common libraries
if (UNIX)
set(COMMON_LIBRARIES ${COMMON_LIBRARIES} "dl" "pthread")
# Source Code for dPhysics
file(
GLOB SOURCES_DPHYSICS
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
${PROJECT_SOURCE_DIR}/dPhysics/*.cpp
)
if (NOT APPLE AND __include_backtrace__)
set(COMMON_LIBRARIES ${COMMON_LIBRARIES} "backtrace")
endif()
endif()
if(MSVC)
# Skip warning for invalid conversion from size_t to uint32_t for all targets below for now
add_compile_options("/wd4267")
endif(MSVC)
add_subdirectory(tests)
# Our static libraries:
add_library(dCommon ${SOURCES_DCOMMON})
add_library(dChatFilter ${SOURCES_DCHATFILTER})
add_library(dDatabase ${SOURCES_DDATABASE})
add_library(dNet ${SOURCES_DNET})
add_library(dGame ${SOURCES_DGAME})
add_library(dZoneManager ${SOURCES_DZM})
add_library(dPhysics ${SOURCES_DPHYSICS})
target_link_libraries(dDatabase sqlite3)
target_link_libraries(dNet dCommon) #Needed because otherwise linker errors occur.
target_link_libraries(dCommon ZLIB::ZLIB)
target_link_libraries(dCommon libbcrypt)
target_link_libraries(dDatabase mariadbConnCpp)
target_link_libraries(dNet dDatabase)
target_link_libraries(dGame dDatabase)
target_link_libraries(dChatFilter dDatabase)
# Include all of our binary directories
add_subdirectory(dWorldServer)
add_subdirectory(dAuthServer)
add_subdirectory(dChatServer)
add_subdirectory(dMasterServer) # Add MasterServer last so it can rely on the other binaries
if(WIN32)
target_link_libraries(raknet ws2_32)
endif(WIN32)
# Our executables:
add_executable(WorldServer ${SOURCES})
add_executable(AuthServer ${SOURCES_AUTH})
add_executable(MasterServer ${SOURCES_MASTER})
add_executable(ChatServer ${SOURCES_CHAT})
# Add out precompiled headers
# Add our precompiled headers
target_precompile_headers(
dGame PRIVATE
${HEADERS_DGAME}
@ -380,90 +253,3 @@ target_precompile_headers(
tinyxml2 PRIVATE
"$<$<COMPILE_LANGUAGE:CXX>:${PROJECT_SOURCE_DIR}/thirdparty/tinyxml2/tinyxml2.h>"
)
# Target libraries to link to:
target_link_libraries(WorldServer dCommon)
target_link_libraries(WorldServer dChatFilter)
target_link_libraries(WorldServer dDatabase)
target_link_libraries(WorldServer dNet)
target_link_libraries(WorldServer dGame)
target_link_libraries(WorldServer dZoneManager)
target_link_libraries(WorldServer dPhysics)
target_link_libraries(WorldServer detour)
target_link_libraries(WorldServer recast)
target_link_libraries(WorldServer raknet)
target_link_libraries(WorldServer mariadbConnCpp)
if(UNIX)
if(NOT APPLE AND __include_backtrace__)
target_link_libraries(WorldServer backtrace)
target_link_libraries(MasterServer backtrace)
target_link_libraries(AuthServer backtrace)
target_link_libraries(ChatServer backtrace)
endif()
endif(UNIX)
target_link_libraries(WorldServer tinyxml2)
# Target libraries for Auth:
target_link_libraries(AuthServer dCommon)
target_link_libraries(AuthServer dDatabase)
target_link_libraries(AuthServer dNet)
target_link_libraries(AuthServer raknet)
target_link_libraries(AuthServer mariadbConnCpp)
if(UNIX)
target_link_libraries(AuthServer pthread)
target_link_libraries(AuthServer dl)
endif(UNIX)
# Target libraries for Master:
target_link_libraries(MasterServer dCommon)
target_link_libraries(MasterServer dDatabase)
target_link_libraries(MasterServer dNet)
target_link_libraries(MasterServer raknet)
target_link_libraries(MasterServer mariadbConnCpp)
if(UNIX)
target_link_libraries(MasterServer pthread)
target_link_libraries(MasterServer dl)
endif(UNIX)
# Target libraries for Chat:
target_link_libraries(ChatServer dCommon)
target_link_libraries(ChatServer dChatFilter)
target_link_libraries(ChatServer dDatabase)
target_link_libraries(ChatServer dNet)
target_link_libraries(ChatServer raknet)
target_link_libraries(ChatServer mariadbConnCpp)
if(UNIX)
target_link_libraries(ChatServer pthread)
target_link_libraries(ChatServer dl)
endif(UNIX)
# 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.
# Disabled no-register
# Disabled unknown pragmas because Linux doesn't understand Windows pragmas.
if(UNIX)
if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++17 -O2 -Wuninitialized -D_GLIBCXX_USE_CXX11_ABI=0 -D_GLIBCXX_USE_CXX17_ABI=0 -fPIC")
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)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -rdynamic")
endif()
if (__ggdb)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -O2 -fPIC")
endif(UNIX)
if(WIN32)
add_dependencies(MasterServer WorldServer)
add_dependencies(MasterServer AuthServer)
add_dependencies(MasterServer ChatServer)
endif()
# Finally, add the tests
add_subdirectory(tests)

View File

@ -0,0 +1,4 @@
set(DAUTHSERVER_SOURCES "AuthServer.cpp")
add_executable(AuthServer ${DAUTHSERVER_SOURCES})
target_link_libraries(AuthServer ${COMMON_LIBRARIES})

View File

@ -0,0 +1,4 @@
set(DCHATFILTER_SOURCES "dChatFilter.cpp")
add_library(dChatFilter STATIC ${DCHATFILTER_SOURCES})
target_link_libraries(dChatFilter dDatabase)

View File

@ -0,0 +1,6 @@
set(DCHATSERVER_SOURCES "ChatPacketHandler.cpp"
"ChatServer.cpp"
"PlayerContainer.cpp")
add_executable(ChatServer ${DCHATSERVER_SOURCES})
target_link_libraries(ChatServer ${COMMON_LIBRARIES} dChatFilter)

26
dCommon/CMakeLists.txt Normal file
View File

@ -0,0 +1,26 @@
set(DCOMMON_SOURCES "AMFFormat.cpp"
"AMFFormat_BitStream.cpp"
"BinaryIO.cpp"
"dConfig.cpp"
"Diagnostics.cpp"
"dLogger.cpp"
"GeneralUtils.cpp"
"LDFFormat.cpp"
"MD5.cpp"
"Metrics.cpp"
"NiPoint3.cpp"
"NiQuaternion.cpp"
"SHA512.cpp"
"Type.cpp"
"ZCompression.cpp")
include_directories(${PROJECT_SOURCE_DIR}/dCommon/)
add_library(dCommon STATIC ${DCOMMON_SOURCES})
target_link_libraries(dCommon libbcrypt)
if (UNIX)
find_package(ZLIB REQUIRED)
target_link_libraries(dCommon ZLIB::ZLIB)
endif()

View File

@ -1,5 +1,7 @@
#include "ZCompression.h"
#ifndef _WIN32
#include <zlib.h>
namespace ZCompression
@ -71,3 +73,5 @@ namespace ZCompression
*/
}
}
#endif

View File

@ -2,6 +2,10 @@
#include <cstdint>
#include "dPlatforms.h"
#ifndef DARKFLAME_PLATFORM_WIN32
namespace ZCompression
{
int32_t GetMaxCompressedLength(int32_t nLenSrc);
@ -10,3 +14,5 @@ namespace ZCompression
int32_t Decompress(const uint8_t* abSrc, int32_t nLenSrc, uint8_t* abDst, int32_t nLenDst, int32_t& nErr);
}
#endif

29
dCommon/dPlatforms.h Normal file
View File

@ -0,0 +1,29 @@
#pragma once
#if defined(_WIN32)
#define DARKFLAME_PLATFORM_WIN32
#elif defined(__APPLE__) && defined(__MACH__)
#include <TargetConditionals.h>
#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
#define DARKFLAME_PLATFORM_IOS
#elif TARGET_OS_MAC
#define DARKFLAME_PLATFORM_MACOS
#else
#error unknown Apple operating system
#endif
#elif defined(__unix__)
#define DARKFLAME_PLATFORM_UNIX
#if defined(__ANDROID__)
#define DARKFLAME_PLATFORM_ANDROID
#elif defined(__linux__)
#define DARKFLAME_PLATFORM_LINUX
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#define DARKFLAME_PLATFORM_FREEBSD
#elif defined(__CYGWIN__)
#define DARKFLAME_PLATFORM_CYGWIN
#else
#error unknown unix operating system
#endif
#else
#error unknown operating system
#endif

13
dDatabase/CMakeLists.txt Normal file
View File

@ -0,0 +1,13 @@
set(DDATABASE_SOURCES "CDClientDatabase.cpp"
"CDClientManager.cpp"
"Database.cpp"
"MigrationRunner.cpp")
add_subdirectory(Tables)
foreach(file ${DDATABASE_TABLES_SOURCES})
set(DDATABASE_SOURCES ${DDATABASE_SOURCES} "Tables/${file}")
endforeach()
add_library(dDatabase STATIC ${DDATABASE_SOURCES})
target_link_libraries(dDatabase sqlite3 mariadbConnCpp)

View File

@ -0,0 +1,38 @@
set(DDATABASE_TABLES_SOURCES "CDActivitiesTable.cpp"
"CDActivityRewardsTable.cpp"
"CDAnimationsTable.cpp"
"CDBehaviorParameterTable.cpp"
"CDBehaviorTemplateTable.cpp"
"CDBrickIDTableTable.cpp"
"CDComponentsRegistryTable.cpp"
"CDCurrencyTableTable.cpp"
"CDDestructibleComponentTable.cpp"
"CDEmoteTable.cpp"
"CDFeatureGatingTable.cpp"
"CDInventoryComponentTable.cpp"
"CDItemComponentTable.cpp"
"CDItemSetSkillsTable.cpp"
"CDItemSetsTable.cpp"
"CDLevelProgressionLookupTable.cpp"
"CDLootMatrixTable.cpp"
"CDLootTableTable.cpp"
"CDMissionEmailTable.cpp"
"CDMissionNPCComponentTable.cpp"
"CDMissionsTable.cpp"
"CDMissionTasksTable.cpp"
"CDMovementAIComponentTable.cpp"
"CDObjectSkillsTable.cpp"
"CDObjectsTable.cpp"
"CDPackageComponentTable.cpp"
"CDPhysicsComponentTable.cpp"
"CDPropertyEntranceComponentTable.cpp"
"CDPropertyTemplateTable.cpp"
"CDProximityMonitorComponentTable.cpp"
"CDRailActivatorComponent.cpp"
"CDRarityTableTable.cpp"
"CDRebuildComponentTable.cpp"
"CDRewardsTable.cpp"
"CDScriptComponentTable.cpp"
"CDSkillBehaviorTable.cpp"
"CDVendorComponentTable.cpp"
"CDZoneTableTable.cpp" PARENT_SCOPE)

59
dGame/CMakeLists.txt Normal file
View File

@ -0,0 +1,59 @@
set(DGAME_SOURCES "Character.cpp"
"Entity.cpp"
"EntityManager.cpp"
"LeaderboardManager.cpp"
"Player.cpp"
"TeamManager.cpp"
"TradingManager.cpp"
"User.cpp"
"UserManager.cpp")
add_subdirectory(dBehaviors)
foreach(file ${DGAME_DBEHAVIORS_SOURCES})
set(DGAME_SOURCES ${DGAME_SOURCES} "dBehaviors/${file}")
endforeach()
add_subdirectory(dComponents)
foreach(file ${DGAME_DCOMPONENTS_SOURCES})
set(DGAME_SOURCES ${DGAME_SOURCES} "dComponents/${file}")
endforeach()
add_subdirectory(dEntity)
foreach(file ${DGAME_DENTITY_SOURCES})
set(DGAME_SOURCES ${DGAME_SOURCES} "dEntity/${file}")
endforeach()
add_subdirectory(dGameMessages)
foreach(file ${DGAME_DGAMEMESSAGES_SOURCES})
set(DGAME_SOURCES ${DGAME_SOURCES} "dGameMessages/${file}")
endforeach()
add_subdirectory(dInventory)
foreach(file ${DGAME_DINVENTORY_SOURCES})
set(DGAME_SOURCES ${DGAME_SOURCES} "dInventory/${file}")
endforeach()
add_subdirectory(dMission)
foreach(file ${DGAME_DMISSION_SOURCES})
set(DGAME_SOURCES ${DGAME_SOURCES} "dMission/${file}")
endforeach()
add_subdirectory(dUtilities)
foreach(file ${DGAME_DUTILITIES_SOURCES})
set(DGAME_SOURCES ${DGAME_SOURCES} "dUtilities/${file}")
endforeach()
foreach(file ${DSCRIPT_SOURCES})
set(DGAME_SOURCES ${DGAME_SOURCES} "${PROJECT_SOURCE_DIR}/dScripts/${file}")
endforeach()
add_library(dGame STATIC ${DGAME_SOURCES})
target_link_libraries(dGame dDatabase)

View File

@ -0,0 +1,51 @@
set(DGAME_DBEHAVIORS_SOURCES "AirMovementBehavior.cpp"
"AndBehavior.cpp"
"ApplyBuffBehavior.cpp"
"AreaOfEffectBehavior.cpp"
"AttackDelayBehavior.cpp"
"BasicAttackBehavior.cpp"
"Behavior.cpp"
"BehaviorBranchContext.cpp"
"BehaviorContext.cpp"
"BehaviorTemplates.cpp"
"BlockBehavior.cpp"
"BuffBehavior.cpp"
"CarBoostBehavior.cpp"
"ChainBehavior.cpp"
"ChangeOrientationBehavior.cpp"
"ChargeUpBehavior.cpp"
"ClearTargetBehavior.cpp"
"DamageAbsorptionBehavior.cpp"
"DamageReductionBehavior.cpp"
"DurationBehavior.cpp"
"EmptyBehavior.cpp"
"EndBehavior.cpp"
"ForceMovementBehavior.cpp"
"HealBehavior.cpp"
"ImaginationBehavior.cpp"
"ImmunityBehavior.cpp"
"InterruptBehavior.cpp"
"JetPackBehavior.cpp"
"KnockbackBehavior.cpp"
"LootBuffBehavior.cpp"
"MovementSwitchBehavior.cpp"
"NpcCombatSkillBehavior.cpp"
"OverTimeBehavior.cpp"
"PlayEffectBehavior.cpp"
"ProjectileAttackBehavior.cpp"
"PullToPointBehavior.cpp"
"RepairBehavior.cpp"
"SkillCastFailedBehavior.cpp"
"SkillEventBehavior.cpp"
"SpawnBehavior.cpp"
"SpawnQuickbuildBehavior.cpp"
"SpeedBehavior.cpp"
"StartBehavior.cpp"
"StunBehavior.cpp"
"SwitchBehavior.cpp"
"SwitchMultipleBehavior.cpp"
"TacArcBehavior.cpp"
"TargetCasterBehavior.cpp"
"TauntBehavior.cpp"
"VentureVisionBehavior.cpp"
"VerifyBehavior.cpp" PARENT_SCOPE)

View File

@ -0,0 +1,40 @@
set(DGAME_DCOMPONENTS_SOURCES "BaseCombatAIComponent.cpp"
"BouncerComponent.cpp"
"BuffComponent.cpp"
"BuildBorderComponent.cpp"
"CharacterComponent.cpp"
"Component.cpp"
"ControllablePhysicsComponent.cpp"
"DestroyableComponent.cpp"
"InventoryComponent.cpp"
"LUPExhibitComponent.cpp"
"MissionComponent.cpp"
"MissionOfferComponent.cpp"
"ModelComponent.cpp"
"ModuleAssemblyComponent.cpp"
"MovementAIComponent.cpp"
"MovingPlatformComponent.cpp"
"PetComponent.cpp"
"PhantomPhysicsComponent.cpp"
"PossessableComponent.cpp"
"PossessorComponent.cpp"
"PropertyComponent.cpp"
"PropertyEntranceComponent.cpp"
"PropertyManagementComponent.cpp"
"PropertyVendorComponent.cpp"
"ProximityMonitorComponent.cpp"
"RacingControlComponent.cpp"
"RailActivatorComponent.cpp"
"RebuildComponent.cpp"
"RenderComponent.cpp"
"RigidbodyPhantomPhysicsComponent.cpp"
"RocketLaunchLupComponent.cpp"
"RocketLaunchpadControlComponent.cpp"
"ScriptedActivityComponent.cpp"
"ShootingGalleryComponent.cpp"
"SimplePhysicsComponent.cpp"
"SkillComponent.cpp"
"SoundTriggerComponent.cpp"
"SwitchComponent.cpp"
"VehiclePhysicsComponent.cpp"
"VendorComponent.cpp" PARENT_SCOPE)

View File

@ -0,0 +1,2 @@
set(DGAME_DENTITY_SOURCES "EntityCallbackTimer.cpp"
"EntityTimer.cpp" PARENT_SCOPE)

View File

@ -0,0 +1,4 @@
set(DGAME_DGAMEMESSAGES_SOURCES "GameMessageHandler.cpp"
"GameMessages.cpp"
"PropertyDataMessage.cpp"
"PropertySelectQueryProperty.cpp" PARENT_SCOPE)

View File

@ -0,0 +1,5 @@
set(DGAME_DINVENTORY_SOURCES "EquippedItem.cpp"
"Inventory.cpp"
"Item.cpp"
"ItemSet.cpp"
"ItemSetPassiveAbility.cpp" PARENT_SCOPE)

View File

@ -0,0 +1,3 @@
set(DGAME_DMISSION_SOURCES "Mission.cpp"
"MissionPrerequisites.cpp"
"MissionTask.cpp" PARENT_SCOPE)

View File

@ -0,0 +1,9 @@
set(DGAME_DUTILITIES_SOURCES "BrickDatabase.cpp"
"dLocale.cpp"
"GameConfig.cpp"
"GUID.cpp"
"Loot.cpp"
"Mail.cpp"
"Preconditions.cpp"
"SlashCommandHandler.cpp"
"VanityUtilities.cpp" PARENT_SCOPE)

View File

@ -0,0 +1,10 @@
set(DMASTERSERVER_SOURCES "InstanceManager.cpp"
"MasterServer.cpp"
"ObjectIDManager.cpp")
add_executable(MasterServer ${DMASTERSERVER_SOURCES})
target_link_libraries(MasterServer ${COMMON_LIBRARIES})
if(WIN32)
add_dependencies(MasterServer WorldServer AuthServer ChatServer)
endif()

11
dNet/CMakeLists.txt Normal file
View File

@ -0,0 +1,11 @@
set(DNET_SOURCES "AuthPackets.cpp"
"ChatPackets.cpp"
"ClientPackets.cpp"
"dServer.cpp"
"MasterPackets.cpp"
"PacketUtils.cpp"
"WorldPackets.cpp"
"ZoneInstanceManager.cpp")
add_library(dNet STATIC ${DNET_SOURCES})
target_link_libraries(dNet dCommon dDatabase)

9
dPhysics/CMakeLists.txt Normal file
View File

@ -0,0 +1,9 @@
set(DPHYSICS_SOURCES "dpCollisionChecks.cpp"
"dpEntity.cpp"
"dpGrid.cpp"
"dpShapeBase.cpp"
"dpShapeBox.cpp"
"dpShapeSphere.cpp"
"dpWorld.cpp")
add_library(dPhysics STATIC ${DPHYSICS_SOURCES})

253
dScripts/CMakeLists.txt Normal file
View File

@ -0,0 +1,253 @@
set(DSCRIPT_SOURCES "ActivityManager.cpp"
"ActMine.cpp"
"ActNinjaTurret.cpp"
"ActParadoxPipeFix.cpp"
"ActPlayerDeathTrigger.cpp"
"ActSharkPlayerDeathTrigger.cpp"
"ActVehicleDeathTrigger.cpp"
"AgBugsprayer.cpp"
"AgBusDoor.cpp"
"AgCagedBricksServer.cpp"
"AgDarkSpiderling.cpp"
"AgFans.cpp"
"AgImagSmashable.cpp"
"AgJetEffectServer.cpp"
"AgLaserSensorServer.cpp"
"AgMonumentBirds.cpp"
"AgMonumentLaserServer.cpp"
"AgMonumentRaceCancel.cpp"
"AgMonumentRaceGoal.cpp"
"AgPicnicBlanket.cpp"
"AgPropGuard.cpp"
"AgPropguards.cpp"
"AgQbElevator.cpp"
"AgSalutingNpcs.cpp"
"AgShipPlayerDeathTrigger.cpp"
"AgShipPlayerShockServer.cpp"
"AgSpaceStuff.cpp"
"AgStagePlatforms.cpp"
"AgStromlingProperty.cpp"
"AgSurvivalBuffStation.cpp"
"AgSurvivalMech.cpp"
"AgSurvivalSpiderling.cpp"
"AgSurvivalStromling.cpp"
"AgTurret.cpp"
"AllCrateChicken.cpp"
"AmBlueX.cpp"
"AmBridge.cpp"
"AmConsoleTeleportServer.cpp"
"AmDarklingDragon.cpp"
"AmDarklingMech.cpp"
"AmDrawBridge.cpp"
"AmDropshipComputer.cpp"
"AmScrollReaderServer.cpp"
"AmShieldGenerator.cpp"
"AmShieldGeneratorQuickbuild.cpp"
"AmSkeletonEngineer.cpp"
"AmSkullkinDrill.cpp"
"AmSkullkinDrillStand.cpp"
"AmSkullkinTower.cpp"
"AmTeapotServer.cpp"
"AmTemplateSkillVolume.cpp"
"AnvilOfArmor.cpp"
"BankInteractServer.cpp"
"BaseConsoleTeleportServer.cpp"
"BaseEnemyApe.cpp"
"BaseEnemyMech.cpp"
"BaseFootRaceManager.cpp"
"BaseInteractDropLootServer.cpp"
"BasePropertyServer.cpp"
"BaseRandomServer.cpp"
"BaseSurvivalServer.cpp"
"BaseWavesGenericEnemy.cpp"
"BaseWavesServer.cpp"
"Binoculars.cpp"
"BootyDigServer.cpp"
"BossSpiderQueenEnemyServer.cpp"
"BuccaneerValiantShip.cpp"
"BurningTile.cpp"
"CatapultBaseServer.cpp"
"CatapultBouncerServer.cpp"
"CauldronOfLife.cpp"
"CavePrisonCage.cpp"
"ChooseYourDestinationNsToNt.cpp"
"ClRing.cpp"
"CppScripts.cpp"
"CrabServer.cpp"
"DamagingPets.cpp"
"Darkitect.cpp"
"DLUVanityNPC.cpp"
"EnemyNjBuff.cpp"
"EnemyRoninSpawner.cpp"
"EnemySkeletonSpawner.cpp"
"EnemySpiderSpawner.cpp"
"ExplodingAsset.cpp"
"FallingTile.cpp"
"FireFirstSkillonStartup.cpp"
"FlameJetServer.cpp"
"ForceVolumeServer.cpp"
"FountainOfImagination.cpp"
"FvBounceOverWall.cpp"
"FvBrickPuzzleServer.cpp"
"FvCandle.cpp"
"FvConsoleLeftQuickbuild.cpp"
"FvConsoleRightQuickbuild.cpp"
"FvDragonSmashingGolemQb.cpp"
"FvFacilityBrick.cpp"
"FvFlyingCreviceDragon.cpp"
"FvFong.cpp"
"FvFreeGfNinjas.cpp"
"FvHorsemenTrigger.cpp"
"FvMaelstromCavalry.cpp"
"FvMaelstromDragon.cpp"
"FvNinjaGuard.cpp"
"FvPandaServer.cpp"
"FvPandaSpawnerServer.cpp"
"FvPassThroughWall.cpp"
"FvRaceSmashEggImagineServer.cpp"
"GfApeSmashingQB.cpp"
"GfBanana.cpp"
"GfBananaCluster.cpp"
"GfCampfire.cpp"
"GfCaptainsCannon.cpp"
"GfJailkeepMission.cpp"
"GfJailWalls.cpp"
"GfOrgan.cpp"
"GfTikiTorch.cpp"
"GrowingFlower.cpp"
"HydrantBroken.cpp"
"HydrantSmashable.cpp"
"ImaginationBackpackHealServer.cpp"
"ImaginationShrineServer.cpp"
"ImgBrickConsoleQB.cpp"
"InstanceExitTransferPlayerToLastNonInstance.cpp"
"InvalidScript.cpp"
"LegoDieRoll.cpp"
"Lieutenant.cpp"
"MaestromExtracticatorServer.cpp"
"MailBoxServer.cpp"
"MastTeleport.cpp"
"MinigameTreasureChestServer.cpp"
"MonCoreNookDoors.cpp"
"MonCoreSmashableDoors.cpp"
"NjColeNPC.cpp"
"NjDragonEmblemChestServer.cpp"
"NjEarthDragonPetServer.cpp"
"NjEarthPetServer.cpp"
"NjGarmadonCelebration.cpp"
"NjhubLavaPlayerDeathTrigger.cpp"
"NjIceRailActivator.cpp"
"NjJayMissionItems.cpp"
"NjMonastryBossInstance.cpp"
"NjNPCMissionSpinjitzuServer.cpp"
"NjNyaMissionitems.cpp"
"NjRailActivatorsServer.cpp"
"NjRailPostServer.cpp"
"NjRailSwitch.cpp"
"NjScrollChestServer.cpp"
"NjWuNPC.cpp"
"NPCAddRemoveItem.cpp"
"NpcAgCourseStarter.cpp"
"NpcCowboyServer.cpp"
"NpcEpsilonServer.cpp"
"NpcNjAssistantServer.cpp"
"NpcNpSpacemanBob.cpp"
"NpcPirateServer.cpp"
"NpcWispServer.cpp"
"NsConcertChoiceBuild.cpp"
"NsConcertChoiceBuildManager.cpp"
"NsConcertInstrument.cpp"
"NsConcertQuickBuild.cpp"
"NsGetFactionMissionServer.cpp"
"NsJohnnyMissionServer.cpp"
"NsLegoClubDoor.cpp"
"NsLupTeleport.cpp"
"NsModularBuild.cpp"
"NsQbImaginationStatue.cpp"
"NsTokenConsoleServer.cpp"
"NtAssemblyTubeServer.cpp"
"NtBeamImaginationCollectors.cpp"
"NtCombatChallengeDummy.cpp"
"NtCombatChallengeExplodingDummy.cpp"
"NtCombatChallengeServer.cpp"
"NtConsoleTeleportServer.cpp"
"NtDarkitectRevealServer.cpp"
"NtDirtCloudServer.cpp"
"NtDukeServer.cpp"
"NtFactionSpyServer.cpp"
"NtHaelServer.cpp"
"NtImagBeamBuffer.cpp"
"NtOverbuildServer.cpp"
"NtParadoxPanelServer.cpp"
"NtParadoxTeleServer.cpp"
"NtSentinelWalkwayServer.cpp"
"NtSleepingGuard.cpp"
"NtVandaServer.cpp"
"NtVentureCannonServer.cpp"
"NtVentureSpeedPadServer.cpp"
"NtXRayServer.cpp"
"PersonalFortress.cpp"
"PetDigBuild.cpp"
"PetDigServer.cpp"
"PetFromDigServer.cpp"
"PetFromObjectServer.cpp"
"PropertyBankInteract.cpp"
"PropertyDeathPlane.cpp"
"PropertyDevice.cpp"
"PropertyFXDamage.cpp"
"PropertyPlatform.cpp"
"PrSeagullFly.cpp"
"PrWhistle.cpp"
"QbEnemyStunner.cpp"
"RaceImagineCrateServer.cpp"
"RaceImaginePowerup.cpp"
"RaceMaelstromGeiser.cpp"
"RaceSmashServer.cpp"
"RainOfArrows.cpp"
"RandomSpawnerFin.cpp"
"RandomSpawnerPit.cpp"
"RandomSpawnerStr.cpp"
"RandomSpawnerZip.cpp"
"RemoveRentalGear.cpp"
"RockHydrantBroken.cpp"
"RockHydrantSmashable.cpp"
"ScriptComponent.cpp"
"ScriptedPowerupSpawner.cpp"
"SGCannon.cpp"
"SpawnGryphonServer.cpp"
"SpawnLionServer.cpp"
"SpawnPetBaseServer.cpp"
"SpawnSaberCatServer.cpp"
"SpawnShrakeServer.cpp"
"SpawnStegoServer.cpp"
"SpecialImaginePowerupSpawner.cpp"
"SpiderBossTreasureChestServer.cpp"
"SsModularBuildServer.cpp"
"StinkyFishTarget.cpp"
"StoryBoxInteractServer.cpp"
"Sunflower.cpp"
"TokenConsoleServer.cpp"
"TouchMissionUpdateServer.cpp"
"TreasureChestDragonServer.cpp"
"TriggerAmbush.cpp"
"VeBricksampleServer.cpp"
"VeEpsilonServer.cpp"
"VeMech.cpp"
"VeMissionConsole.cpp"
"WaveBossApe.cpp"
"WaveBossHammerling.cpp"
"WaveBossHorsemen.cpp"
"WaveBossSpiderling.cpp"
"WhFans.cpp"
"WildAmbients.cpp"
"WishingWellServer.cpp"
"ZoneAgMedProperty.cpp"
"ZoneAgProperty.cpp"
"ZoneAgSpiderQueen.cpp"
"ZoneAgSurvival.cpp"
"ZoneFvProperty.cpp"
"ZoneGfProperty.cpp"
"ZoneNsMedProperty.cpp"
"ZoneNsProperty.cpp"
"ZoneNsWaves.cpp"
"ZoneSGServer.cpp" PARENT_SCOPE)

View File

@ -0,0 +1,6 @@
set(DWORLDSERVER_SOURCES "ObjectIDManager.cpp"
"PerformanceManager.cpp"
"WorldServer.cpp")
add_executable(WorldServer ${DWORLDSERVER_SOURCES})
target_link_libraries(WorldServer ${COMMON_LIBRARIES} dChatFilter dGame dZoneManager dPhysics detour recast tinyxml2)

View File

@ -0,0 +1,6 @@
set(DZONEMANAGER_SOURCES "dZoneManager.cpp"
"Level.cpp"
"Spawner.cpp"
"Zone.cpp")
add_library(dZoneManager STATIC ${DZONEMANAGER_SOURCES})

View File

@ -7,11 +7,7 @@ create_test_sourcelist (Tests
# add the executable
add_executable (CommonCxxTests ${Tests})
target_link_libraries(CommonCxxTests dCommon raknet)
if(WIN32)
target_link_libraries(CommonCxxTests ws2_32)
endif(WIN32)
target_link_libraries(CommonCxxTests ${COMMON_LIBRARIES})
# remove the test driver source file
set (TestsToRun ${Tests})

View File

@ -1,50 +1,50 @@
# Source Code for raknet
file(
GLOB SOURCES_RAKNET
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
${CMAKE_CURRENT_SOURCE_DIR}/raknet/Source/*.cpp
GLOB SOURCES_RAKNET
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
${CMAKE_CURRENT_SOURCE_DIR}/raknet/Source/*.cpp
)
# Source Code for recast
file(
GLOB SOURCES_RECAST
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
${CMAKE_CURRENT_SOURCE_DIR}/recastnavigation/Recast/Source/*.cpp
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
GLOB SOURCES_DETOUR
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
${CMAKE_CURRENT_SOURCE_DIR}/recastnavigation/Detour/Source/*.cpp
)
# Source Code for tinyxml2
file(
GLOB SOURCES_TINYXML2
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
${CMAKE_CURRENT_SOURCE_DIR}/tinyxml2/tinyxml2.cpp
GLOB SOURCES_TINYXML2
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
${CMAKE_CURRENT_SOURCE_DIR}/tinyxml2/tinyxml2.cpp
)
# 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
GLOB SOURCES_LIBBCRYPT
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
${CMAKE_CURRENT_SOURCE_DIR}/libbcrypt/*.c
${CMAKE_CURRENT_SOURCE_DIR}/libbcrypt/src/*.c
)
file(
GLOB SOURCES_SQLITE3
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
${CMAKE_CURRENT_SOURCE_DIR}/SQLite/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/SQLite/*.c
GLOB SOURCES_SQLITE3
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
${CMAKE_CURRENT_SOURCE_DIR}/SQLite/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/SQLite/*.c
)
# mariadb connector cpp
@ -147,7 +147,6 @@ else() # Build from source
set(MARIADB_SHARED_LIBRARY_LOCATION "${BINARY_DIR}/RelWithDebInfo/${MARIADB_SHARED_LIBRARY_NAME}")
set(MARIADB_SHARED_LIBRARY_COPY_LOCATION "${PROJECT_BINARY_DIR}/$<CONFIG>")
set(MARIADB_PLUGINS_LOCATION "${BINARY_DIR}/libmariadb/RelWithDebInfo")
message(STATUS "1 ${CMAKE_SOURCE_DIR}")
else()
set(MARIADB_SHARED_LIBRARY_LOCATION "${BINARY_DIR}/${MARIADB_SHARED_LIBRARY_NAME}")
set(MARIADB_SHARED_LIBRARY_COPY_LOCATION "${PROJECT_BINARY_DIR}")
@ -179,16 +178,19 @@ if(EXISTS "${CMAKE_SOURCE_DIR}/thirdparty/mariadb-connector-cpp/test/CMakeLists.
file(REMOVE "${CMAKE_SOURCE_DIR}/thirdparty/mariadb-connector-cpp/test/CMakeLists.txt")
endif()
# Create mariadb connector library object
add_library(mariadbConnCpp SHARED IMPORTED GLOBAL)
set_property(TARGET mariadbConnCpp PROPERTY IMPORTED_LOCATION ${MARIADB_SHARED_LIBRARY_LOCATION})
if(WIN32)
set_property(TARGET mariadbConnCpp PROPERTY IMPORTED_IMPLIB ${MARIADB_IMPLIB_LOCATION})
endif()
# Add directories to include lists
target_include_directories(mariadbConnCpp INTERFACE ${MARIADB_INCLUDE_DIR})
add_dependencies(mariadbConnCpp mariadb_connector_cpp)
# 3rdparty static libraries:
#add_library(zlib ${SOURCES_ZLIB})
# Create our third party library objects
add_library(raknet ${SOURCES_RAKNET})
add_library(tinyxml2 ${SOURCES_TINYXML2})
add_library(detour ${SOURCES_DETOUR})
@ -196,11 +198,39 @@ add_library(recast ${SOURCES_RECAST})
add_library(libbcrypt ${SOURCES_LIBBCRYPT})
add_library(sqlite3 ${SOURCES_SQLITE3})
if(UNIX)
target_link_libraries(sqlite3 pthread dl m)
if(WIN32)
# Link Win Sockets 2 to RakNet
target_link_libraries(raknet ws2_32)
elseif(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(raknet PRIVATE "-Wno-write-strings" "-Wformat-overflow=0" "-Wformat=0")
target_compile_options(libbcrypt PRIVATE "-Wno-implicit-function-declaration" "-Wno-int-conversion")
endif(UNIX)
# -Wno-unused-result -Wno-unknown-pragmas -fpermissive
target_compile_options(sqlite3 PRIVATE "-Wno-return-local-addr" "-Wno-maybe-uninitialized")
target_compile_options(raknet PRIVATE "-Wno-write-strings" "-Wformat-overflow=0" "-Wformat=0")
target_compile_options(libbcrypt PRIVATE "-Wno-implicit-function-declaration" "-Wno-int-conversion")
endif()
# 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)
set(backtrace_make_cmd "${backtrace_SOURCE_DIR}/configure --prefix=\"/usr\" --enable-shared --with-system-libunwind")
execute_process(
COMMAND bash -c "cd ${backtrace_SOURCE_DIR} && ${backtrace_make_cmd} && make && cd ${CMAKE_SOURCE_DIR}"
)
endif()
link_directories(${backtrace_SOURCE_DIR}/.libs/)
include_directories(${backtrace_SOURCE_DIR})
endif()
endif()