diff --git a/.github/workflows/build-and-push-docker.yml b/.github/workflows/build-and-push-docker.yml index e4bffabe5..dafd31941 100644 --- a/.github/workflows/build-and-push-docker.yml +++ b/.github/workflows/build-and-push-docker.yml @@ -1,4 +1,4 @@ -name: CI +name: Build and Update Docker on: push: diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 191efb537..ea9df3254 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -1,4 +1,4 @@ -name: CI +name: Build And Test on: push: @@ -14,6 +14,13 @@ jobs: strategy: matrix: os: [ windows-2022, ubuntu-22.04, macos-13 ] + include: + - os: windows-2022 + configureType: windows-msvc + - os: ubuntu-22.04 + configureType: linux-gnu + - os: macos-13 + configureType: macos steps: - uses: actions/checkout@v4 @@ -33,20 +40,13 @@ jobs: - name: cmake uses: lukka/run-cmake@v10 with: - workflowPreset: "ci-${{matrix.os}}" + configurePreset: "${{matrix.configureType}}" + buildPreset: "ci-${{matrix.os}}" + testPreset: "ci-${{matrix.os}}" + - name: artifacts uses: actions/upload-artifact@v4 with: name: build-${{matrix.os}} path: | - build/*/*Server* - build/*/*.ini - build/*/*.so - build/*/*.dll - build/*/*.dylib - build/*/vanity/ - build/*/navmeshes/ - build/*/migrations/ - build/*/*.dcf - !build/*/*.pdb - !build/*/d*/ + build/* diff --git a/.gitignore b/.gitignore index 3ad1009ea..8ebea943f 100644 --- a/.gitignore +++ b/.gitignore @@ -113,6 +113,8 @@ CMakeFiles/TargetDirectories.txt *.sln *.recipe +CMakeUserPresets.json + # clangd .cache thirdparty/zlib-1.2.11/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ff4e6b3a..354ac3a56 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,14 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # Export the compile commands for debuggi set(CMAKE_POLICY_DEFAULT_CMP0063 NEW) # Set CMAKE visibility policy to NEW on project and subprojects set(CMAKE_VISIBILITY_INLINES_HIDDEN ON) # Set C and C++ symbol visibility to hide inlined functions set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") + +set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build, options are: Debug, Release, RelWithDebInfo, MinSizeRel") + +if (${CMAKE_BUILD_TYPE} MATCHES "") # CI likes to set CMAKE_BUILD_TYPE to an empty string + set(CMAKE_BUILD_TYPE "RelWithDebInfo") +endif() + +set(DLU_CONFIG_DIR ${CMAKE_SOURCE_DIR}/build CACHE PATH "The directory where the server configuration files are stored") # Read variables from file FILE(READ "${CMAKE_SOURCE_DIR}/CMakeVariables.txt" variables) @@ -72,7 +80,7 @@ if(UNIX) # For all except Clang and Apple Clang if(NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options("-static-libgcc" "-lstdc++fs") + add_compile_options("-static-libgcc" "-lstdc++fs" "-Wno-error=implicit-function-declaration" "-Wno-error=int-conversion") endif() if(${DYNAMIC} AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU") @@ -90,10 +98,11 @@ elseif(WIN32) add_compile_definitions(_CRT_SECURE_NO_WARNINGS) endif() -# Our output dir -#set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON) # unfortunately, forces all libraries to be built in series, which will slow down the build process +# Set the output directories +# ./build//// + +set(CMAKE_BINARY_DIR ${CMAKE_BINARY_DIR}/${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}/${CMAKE_CXX_COMPILER_ID}/${CMAKE_BUILD_TYPE}) -# TODO make this not have to override the build type directories set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}) @@ -108,6 +117,15 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) +# Get DLU config directory +if(DEFINED ENV{DLU_CONFIG_DIR}) + set(DLU_CONFIG_DIR $ENV{DLU_CONFIG_DIR}) +else() + set(DLU_CONFIG_DIR ${CMAKE_BINARY_DIR}) +endif() + +message(STATUS "Configuration Directory is ${DLU_CONFIG_DIR}, and the build directory is ${CMAKE_BINARY_DIR}") + find_package(MariaDB) # Create a /resServer directory @@ -116,18 +134,11 @@ make_directory(${CMAKE_BINARY_DIR}/resServer) # Create a /logs directory make_directory(${CMAKE_BINARY_DIR}/logs) -# Get DLU config directory -if(DEFINED ENV{DLU_CONFIG_DIR}) - set(DLU_CONFIG_DIR $ENV{DLU_CONFIG_DIR}) -else() - set(DLU_CONFIG_DIR ${PROJECT_BINARY_DIR}) -endif() -message(STATUS "Variable: DLU_CONFIG_DIR = ${DLU_CONFIG_DIR}") - # Copy resource files on first build set(RESOURCE_FILES "sharedconfig.ini" "authconfig.ini" "chatconfig.ini" "worldconfig.ini" "masterconfig.ini" "blocklist.dcf") message(STATUS "Checking resource file integrity") + include(Utils) UpdateConfigOption(${DLU_CONFIG_DIR}/authconfig.ini "port" "auth_server_port") UpdateConfigOption(${DLU_CONFIG_DIR}/chatconfig.ini "port" "chat_server_port") @@ -196,15 +207,15 @@ endforeach() message(STATUS "Resource file integrity check complete") # if navmeshes directory does not exist, create it -if(NOT EXISTS ${PROJECT_BINARY_DIR}/navmeshes) - file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/navmeshes) +if(NOT EXISTS ${CMAKE_BINARY_DIR}/navmeshes) + file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/navmeshes) endif() # Copy navmesh data on first build and extract it -configure_file(${CMAKE_SOURCE_DIR}/resources/navmeshes.zip ${PROJECT_BINARY_DIR}/navmeshes.zip COPYONLY) +configure_file(${CMAKE_SOURCE_DIR}/resources/navmeshes.zip ${CMAKE_BINARY_DIR}/navmeshes.zip COPYONLY) -file(ARCHIVE_EXTRACT INPUT ${PROJECT_BINARY_DIR}/navmeshes.zip DESTINATION ${PROJECT_BINARY_DIR}/navmeshes) -file(REMOVE ${PROJECT_BINARY_DIR}/navmeshes.zip) +file(ARCHIVE_EXTRACT INPUT ${CMAKE_BINARY_DIR}/navmeshes.zip DESTINATION ${CMAKE_BINARY_DIR}/navmeshes) +file(REMOVE ${CMAKE_BINARY_DIR}/navmeshes.zip) # Copy vanity files on first build set(VANITY_FILES "CREDITS.md" "INFO.md" "TESTAMENT.md" "root.xml" "dev-tribute.xml" "atm.xml" "demo.xml") @@ -214,20 +225,20 @@ foreach(file ${VANITY_FILES}) endforeach() # Move our migrations for MasterServer to run -file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/migrations/dlu/) +file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/migrations/dlu/) file(GLOB SQL_FILES ${CMAKE_SOURCE_DIR}/migrations/dlu/*.sql) foreach(file ${SQL_FILES}) get_filename_component(file ${file} NAME) - configure_file(${CMAKE_SOURCE_DIR}/migrations/dlu/${file} ${PROJECT_BINARY_DIR}/migrations/dlu/${file}) + configure_file(${CMAKE_SOURCE_DIR}/migrations/dlu/${file} ${CMAKE_BINARY_DIR}/migrations/dlu/${file}) endforeach() -file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/migrations/cdserver/) +file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/migrations/cdserver/) file(GLOB SQL_FILES ${CMAKE_SOURCE_DIR}/migrations/cdserver/*.sql) foreach(file ${SQL_FILES}) get_filename_component(file ${file} NAME) - configure_file(${CMAKE_SOURCE_DIR}/migrations/cdserver/${file} ${PROJECT_BINARY_DIR}/migrations/cdserver/${file}) + configure_file(${CMAKE_SOURCE_DIR}/migrations/cdserver/${file} ${CMAKE_BINARY_DIR}/migrations/cdserver/${file}) endforeach() # Add system specfic includes for Apple, Windows and Other Unix OS' (including Linux) diff --git a/CMakePresets.json b/CMakePresets.json index 3ed904e7e..060a00f3a 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -11,72 +11,37 @@ "displayName": "Default configure step", "description": "Use 'build' dir and Unix makefiles", "binaryDir": "${sourceDir}/build", - "generator": "Unix Makefiles" + "generator": "Unix Makefiles", + "hidden": true }, { - "name": "debug-config", - "hidden": true, - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug" - } - }, - { - "name": "relwithdebinfo-config", - "hidden": true, - "cacheVariables": { - "CMAKE_BUILD_TYPE": "RelWithDebInfo" - } - }, - { - "name": "release-config", - "hidden": true, - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Release" - } - }, - { - "name": "clang-config", - "hidden": true, - "toolchainFile": "${sourceDir}/cmake/toolchains/linux-clang.cmake" - }, - { - "name": "gnu-config", - "hidden": true, - "toolchainFile": "${sourceDir}/cmake/toolchains/linux-gnu.cmake" - }, - { - "name": "windows-msvc", + "name": "windows-default", "inherits": "default", - "displayName": "[Multi] Windows (MSVC)", - "description": "Set architecture to 64-bit (b/c RakNet)", + "displayName": "Windows Default Configure Settings", + "description": "Sets build and install directories", "generator": "Visual Studio 17 2022", - "binaryDir": "${sourceDir}/build/msvc", - "architecture": { - "value": "x64" - }, "condition": { "type": "equals", "lhs": "${hostSystemName}", "rhs": "Windows" - } + }, + "hidden": true }, { - "name": "windows-default", - "inherits": "windows-msvc", - "displayName": "Windows only Configure Settings", - "description": "Sets build and install directories", - "generator": "Ninja", - "condition": { - "type": "equals", - "lhs": "${hostSystemName}", - "rhs": "Windows" - }, - "architecture": { - "value": "x64" - } + "name": "windows-msvc", + "inherits": "windows-default", + "displayName": "Windows (MSVC)", + "description": "Create a build using MSVC" + }, + { + "name": "windows-clang", + "inherits": "windows-default", + "displayName": "EXPERIMENTAL - Windows (Clang)", + "description": "Create a build using Clang", + "toolset": "ClangCL" }, { - "name": "linux-config", + "name": "linux-default", "inherits": "default", "hidden": true, "condition": { @@ -86,553 +51,74 @@ } }, { - "name": "linux-clang-debug", - "inherits": [ - "linux-config", - "clang-config", - "debug-config" - ], - "displayName": "EXPERIMENTAL - [Debug] Linux (Clang)", - "description": "Create a debug build using the Clang toolchain for Linux", - "binaryDir": "${sourceDir}/build/clang-debug" + "name": "linux-clang", + "inherits": "linux-default", + "toolchainFile": "${sourceDir}/cmake/toolchains/linux-clang.cmake", + "displayName": "Linux (Clang)", + "description": "Create a build using the Clang toolchain for Linux" }, { - "name": "linux-clang-relwithdebinfo", - "inherits": [ - "linux-config", - "clang-config", - "relwithdebinfo-config" - ], - "displayName": "EXPERIMENTAL - [RelWithDebInfo] Linux (Clang)", - "description": "Create a release build with debug info using the Clang toolchain for Linux", - "binaryDir": "${sourceDir}/build/clang-relwithdebinfo" - }, - { - "name": "linux-clang-release", - "inherits": [ - "linux-config", - "clang-config", - "release-config" - ], - "displayName": "EXPERIMENTAL - [Release] Linux (Clang)", - "description": "Create a release build using the Clang toolchain for Linux", - "binaryDir": "${sourceDir}/build/clang-release" - }, - { - "name": "linux-gnu-debug", - "inherits": [ - "linux-config", - "gnu-config", - "debug-config" - ], - "displayName": "[Debug] Linux (GNU)", - "description": "Create a debug build using the GNU toolchain for Linux", - "binaryDir": "${sourceDir}/build/gnu-debug" - }, - { - "name": "linux-gnu-relwithdebinfo", - "inherits": [ - "linux-config", - "gnu-config", - "relwithdebinfo-config" - ], - "displayName": "[RelWithDebInfo] Linux (GNU)", - "description": "Create a release build with debug info using the GNU toolchain for Linux", - "binaryDir": "${sourceDir}/build/gnu-relwithdebinfo" - }, - { - "name": "linux-gnu-release", - "inherits": [ - "linux-config", - "gnu-config", - "release-config" - ], - "displayName": "[Release] Linux (GNU)", - "description": "Create a release build using the GNU toolchain for Linux", - "binaryDir": "${sourceDir}/build/gnu-release" + "name": "linux-gnu", + "inherits": "linux-default", + "toolchainFile": "${sourceDir}/cmake/toolchains/linux-gnu.cmake", + "displayName": "Linux (GNU)", + "description": "Create a build using the GNU toolchain for Linux" }, { "name": "macos", "inherits": "default", - "displayName": "[Multi] MacOS", + "displayName": "MacOS", "description": "Create a build for MacOS", "condition": { "type": "equals", "lhs": "${hostSystemName}", "rhs": "Darwin" - }, - "binaryDir": "${sourceDir}/build/macos" + } } ], "buildPresets": [ + { "name": "ci-ubuntu-22.04", "configurePreset": "linux-gnu" }, + { "name": "ci-macos-13", "configurePreset": "macos" }, + { "name": "ci-windows-2022", "configurePreset": "windows-msvc" } + ], + "testPresets": [ + { + "name": "default", + "hidden": true, + "execution": { + "jobs": 2 + }, + "output": { + "outputOnFailure": true + } + }, { - "name": "default", - "configurePreset": "default", - "displayName": "Default Build", - "description": "Default Build", - "jobs": 2 - }, - { - "name": "windows-msvc-debug", - "inherits": "default", - "configurePreset": "windows-msvc", - "displayName": "[Debug] Windows (MSVC)", - "description": "This preset is used to build in debug mode using the MSVC toolchain on Windows", - "configuration": "Debug" - }, - { - "name": "windows-msvc-relwithdebinfo", - "inherits": "default", - "configurePreset": "windows-msvc", - "displayName": "[RelWithDebInfo] Windows (MSVC)", - "description": "This preset is used to build in debug mode using the MSVC toolchain on Windows", - "configuration": "RelWithDebInfo" - }, - { - "name": "windows-msvc-release", - "inherits": "default", - "configurePreset": "windows-msvc", - "displayName": "[Release] Windows (MSVC)", - "description": "This preset is used to build in release mode using the MSVC toolchain on Windows", - "configuration": "Release" - }, - { - "name": "linux-clang-debug", - "inherits": "default", - "configurePreset": "linux-clang-debug", - "displayName": "EXPERIMENTAL - [Debug] Linux (Clang)", - "description": "This preset is used to build in debug mode using the Clang toolchain on Linux", - "configuration": "Debug" - }, - { - "name": "linux-clang-relwithdebinfo", - "inherits": "default", - "configurePreset": "linux-clang-relwithdebinfo", - "displayName": "EXPERIMENTAL - [RelWithDebInfo] Linux (Clang)", - "description": "This preset is used to build in release mode with debug info using the Clang toolchain on Linux", - "configuration": "RelWithDebInfo" - }, - { - "name": "linux-clang-release", - "inherits": "default", - "configurePreset": "linux-clang-release", - "displayName": "EXPERIMENTAL - [Release] Linux (Clang)", - "description": "This preset is used to build in release mode using the Clang toolchain on Linux", - "configuration": "Release" - }, - { - "name": "linux-gnu-debug", - "inherits": "default", - "configurePreset": "linux-gnu-debug", - "displayName": "[Debug] Linux (GNU)", - "description": "This preset is used to build in debug mode using the GNU toolchain on Linux", - "configuration": "Debug" - }, - { - "name": "linux-gnu-relwithdebinfo", - "inherits": "default", - "configurePreset": "linux-gnu-relwithdebinfo", - "displayName": "[RelWithDebInfo] Linux (GNU)", - "description": "This preset is used to build in release mode with debug info using the GNU toolchain on Linux", - "configuration": "RelWithDebInfo" - }, - { - "name": "linux-gnu-release", - "inherits": "default", - "configurePreset": "linux-gnu-release", - "displayName": "[Release] Linux (GNU)", - "description": "This preset is used to build in release mode using the GNU toolchain on Linux", - "configuration": "Release" - }, - { - "name": "macos-debug", - "inherits": "default", - "configurePreset": "macos", - "displayName": "[Debug] MacOS", - "description": "This preset is used to build in debug mode on MacOS", - "configuration": "Debug" + "name": "ci-ubuntu-22.04", + "configurePreset": "linux-gnu", + "displayName": "CI Tests on Linux", + "inherits": "default" }, { - "name": "macos-relwithdebinfo", - "inherits": "default", + "name": "ci-macos-13", "configurePreset": "macos", - "displayName": "[RelWithDebInfo] MacOS", - "description": "This preset is used to build in release mode with debug info on MacOS", - "configuration": "RelWithDebInfo" + "displayName": "CI Tests on MacOS", + "inherits": "default" }, { - "name": "macos-release", - "inherits": "default", - "configurePreset": "macos", - "displayName": "[Release] MacOS", - "description": "This preset is used to build in release mode on MacOS", - "configuration": "Release" - } - ], - "testPresets": [ - { - "name": "default", - "configurePreset": "default", - "execution": { - "jobs": 2 - }, - "output": { - "outputOnFailure": true - } - }, - { - "name": "windows-msvc-test", - "inherits": "default", + "name": "ci-windows-2022", "configurePreset": "windows-msvc", - "hidden": true, + "displayName": "CI Tests on windows", + "inherits": "default", + + "configuration": "RelWithDebInfo", "filter": { "exclude": { "name": "((example)|(minigzip))+" } } - }, - { - "name": "windows-msvc-debug", - "inherits": "windows-msvc-test", - "configurePreset": "windows-msvc", - "displayName": "[Debug] Windows (MSVC)", - "description": "Runs all tests on a Windows configuration", - "configuration": "Debug" - }, - { - "name": "windows-msvc-relwithdebinfo", - "inherits": "windows-msvc-test", - "configurePreset": "windows-msvc", - "displayName": "[RelWithDebInfo] Windows (MSVC)", - "description": "Runs all tests on a Windows configuration", - "configuration": "RelWithDebInfo" - }, - { - "name": "windows-msvc-release", - "inherits": "windows-msvc-test", - "configurePreset": "windows-msvc", - "displayName": "[Release] Windows (MSVC)", - "description": "Runs all tests on a Windows configuration", - "configuration": "Release" - }, - { - "name": "linux-clang-debug", - "inherits": "default", - "configurePreset": "linux-clang-debug", - "displayName": "EXPERIMENTAL - [Debug] Linux (Clang)", - "description": "Runs all tests on a Linux Clang configuration", - "configuration": "Release" - }, - { - "name": "linux-clang-relwithdebinfo", - "inherits": "default", - "configurePreset": "linux-clang-relwithdebinfo", - "displayName": "EXPERIMENTAL - [RelWithDebInfo] Linux (Clang)", - "description": "Runs all tests on a Linux Clang configuration", - "configuration": "RelWithDebInfo" - }, - { - "name": "linux-clang-release", - "inherits": "default", - "configurePreset": "linux-clang-release", - "displayName": "EXPERIMENTAL - [Release] Linux (Clang)", - "description": "Runs all tests on a Linux Clang configuration", - "configuration": "Release" - }, - { - "name": "linux-gnu-debug", - "inherits": "default", - "configurePreset": "linux-gnu-debug", - "displayName": "[Debug] Linux (GNU)", - "description": "Runs all tests on a Linux GNU configuration", - "configuration": "Release" - }, - { - "name": "linux-gnu-relwithdebinfo", - "inherits": "default", - "configurePreset": "linux-gnu-relwithdebinfo", - "displayName": "[RelWithDebInfo] Linux (GNU)", - "description": "Runs all tests on a Linux GNU configuration", - "configuration": "RelWithDebInfo" - }, - { - "name": "linux-gnu-release", - "inherits": "default", - "configurePreset": "linux-gnu-release", - "displayName": "[Release] Linux (GNU)", - "description": "Runs all tests on a Linux GNU configuration", - "configuration": "Release" - }, - { - "name": "macos-debug", - "inherits": "default", - "configurePreset": "macos", - "displayName": "[Debug] MacOS", - "description": "Runs all tests on a MacOS configuration", - "configuration": "Debug" - }, - { - "name": "macos-relwithdebinfo", - "inherits": "default", - "configurePreset": "macos", - "displayName": "[RelWithDebInfo] MacOS", - "description": "Runs all tests on a MacOS configuration", - "configuration": "RelWithDebInfo" - }, - { - "name": "macos-release", - "inherits": "default", - "configurePreset": "macos", - "displayName": "[Release] MacOS", - "description": "Runs all tests on a MacOS configuration", - "configuration": "Release" } ], "workflowPresets": [ - { - "name": "default", - "steps": [ - { - "type": "configure", - "name": "default" - }, - { - "type": "build", - "name": "default" - }, - { - "type": "test", - "name": "default" - } - ] - }, - { - "name": "windows-msvc-debug", - "displayName": "[Debug] Windows (MSVC)", - "description": "MSVC debug workflow preset for Windows", - "steps": [ - { - "type": "configure", - "name": "windows-msvc" - }, - { - "type": "build", - "name": "windows-msvc-debug" - }, - { - "type": "test", - "name": "windows-msvc-debug" - } - ] - }, - { - "name": "windows-msvc-relwithdebinfo", - "displayName": "[RelWithDebInfo] Windows (MSVC)", - "description": "MSVC release with debug info workflow preset for Windows", - "steps": [ - { - "type": "configure", - "name": "windows-msvc" - }, - { - "type": "build", - "name": "windows-msvc-relwithdebinfo" - }, - { - "type": "test", - "name": "windows-msvc-relwithdebinfo" - } - ] - }, - { - "name": "ci-windows-2022", - "displayName": "[Release] Windows (MSVC)", - "description": "CI workflow preset for Windows", - "steps": [ - { - "type": "configure", - "name": "windows-msvc" - }, - { - "type": "build", - "name": "windows-msvc-release" - }, - { - "type": "test", - "name": "windows-msvc-release" - } - ] - }, - { - "name": "linux-gnu-debug", - "displayName": "[Debug] Linux (GNU)", - "description": "GNU debug workflow preset for Linux", - "steps": [ - { - "type": "configure", - "name": "linux-gnu-debug" - }, - { - "type": "build", - "name": "linux-gnu-debug" - }, - { - "type": "test", - "name": "linux-gnu-debug" - } - ] - }, - { - "name": "linux-gnu-relwithdebinfo", - "displayName": "[RelWithDebInfo] Linux (GNU)", - "description": "GNU release with debug info workflow preset for Linux", - "steps": [ - { - "type": "configure", - "name": "linux-gnu-relwithdebinfo" - }, - { - "type": "build", - "name": "linux-gnu-relwithdebinfo" - }, - { - "type": "test", - "name": "linux-gnu-relwithdebinfo" - } - ] - }, - { - "name": "ci-ubuntu-22.04", - "displayName": "[Release] Linux (GNU)", - "description": "CI workflow preset for Ubuntu", - "steps": [ - { - "type": "configure", - "name": "linux-gnu-release" - }, - { - "type": "build", - "name": "linux-gnu-release" - }, - { - "type": "test", - "name": "linux-gnu-release" - } - ] - }, - { - "name": "linux-clang-debug", - "displayName": "EXPERIMENTAL - [Debug] Linux (Clang)", - "description": "Clang debug workflow preset for Linux", - "steps": [ - { - "type": "configure", - "name": "linux-clang-debug" - }, - { - "type": "build", - "name": "linux-clang-debug" - }, - { - "type": "test", - "name": "linux-clang-debug" - } - ] - }, - { - "name": "linux-clang-relwithdebinfo", - "displayName": "EXPERIMENTAL - [RelWithDebInfo] Linux (Clang)", - "description": "Clang release with debug info workflow preset for Linux", - "steps": [ - { - "type": "configure", - "name": "linux-clang-relwithdebinfo" - }, - { - "type": "build", - "name": "linux-clang-relwithdebinfo" - }, - { - "type": "test", - "name": "linux-clang-relwithdebinfo" - } - ] - }, - { - "name": "linux-clang-release", - "displayName": "EXPERIMENTAL - [Release] Linux (Clang)", - "description": "Clang release workflow preset for Linux", - "steps": [ - { - "type": "configure", - "name": "linux-clang-release" - }, - { - "type": "build", - "name": "linux-clang-release" - }, - { - "type": "test", - "name": "linux-clang-release" - } - ] - }, - { - "name": "macos-debug", - "displayName": "[Debug] MacOS", - "description": "Release workflow preset for MacOS", - "steps": [ - { - "type": "configure", - "name": "macos" - }, - { - "type": "build", - "name": "macos-debug" - }, - { - "type": "test", - "name": "macos-debug" - } - ] - }, - { - "name": "macos-relwithdebinfo", - "displayName": "[RelWithDebInfo] MacOS", - "description": "Release with debug info workflow preset for MacOS", - "steps": [ - { - "type": "configure", - "name": "macos" - }, - { - "type": "build", - "name": "macos-relwithdebinfo" - }, - { - "type": "test", - "name": "macos-relwithdebinfo" - } - ] - }, - { - "name": "ci-macos-13", - "displayName": "[Release] MacOS", - "description": "CI workflow preset for MacOS", - "steps": [ - { - "type": "configure", - "name": "macos" - }, - { - "type": "build", - "name": "macos-release" - }, - { - "type": "test", - "name": "macos-release" - } - ] - } + ] } diff --git a/Dockerfile b/Dockerfile index 9086cf17d..7de8ce89f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,23 +23,23 @@ RUN --mount=type=cache,id=build-apt-cache,target=/var/cache/apt \ rm -rf /var/lib/apt/lists/* # Grab libraries and load them -COPY --from=build /app/build/mariadbcpp/libmariadbcpp.so /usr/local/lib/ +COPY --from=build /app/build/Linux-x86_64/GNU/Release/mariadbcpp/libmariadbcpp.so /usr/local/lib/ RUN ldconfig # Server bins -COPY --from=build /app/build/*Server /app/ +COPY --from=build /app/build/Linux-x86_64/GNU/Release/*Server /app/ # Necessary suplimentary files -COPY --from=build /app/build/*.ini /app/configs/ -COPY --from=build /app/build/vanity/*.* /app/vanity/ -COPY --from=build /app/build/navmeshes /app/navmeshes -COPY --from=build /app/build/migrations /app/migrations -COPY --from=build /app/build/*.dcf /app/ +COPY --from=build /app/build/Linux-x86_64/GNU/Release/*.ini /app/configs/ +COPY --from=build /app/build/Linux-x86_64/GNU/Release/vanity/*.* /app/vanity/ +COPY --from=build /app/build/Linux-x86_64/GNU/Release/navmeshes /app/navmeshes +COPY --from=build /app/build/Linux-x86_64/GNU/Release/migrations /app/migrations +COPY --from=build /app/build/Linux-x86_64/GNU/Release/*.dcf /app/ # backup of config and vanity files to copy to the host incase # of a mount clobbering the copy from above -COPY --from=build /app/build/*.ini /app/default-configs/ -COPY --from=build /app/build/vanity/*.* /app/default-vanity/ +COPY --from=build /app/build/Linux-x86_64/GNU/Release/*.ini /app/default-configs/ +COPY --from=build /app/build/Linux-x86_64/GNU/Release/vanity/*.* /app/default-vanity/ # needed as the container runs with the root user # and therefore sudo doesn't exist diff --git a/cmake/FindMariaDB.cmake b/cmake/FindMariaDB.cmake index d3f899312..4593b4f79 100644 --- a/cmake/FindMariaDB.cmake +++ b/cmake/FindMariaDB.cmake @@ -2,8 +2,8 @@ # On Windows ClangCL can't compile the connector from source but can link to an msvc compiled one, # so prefer the prebuilt binaries unless MARIADB_BUILD_SOURCE is specified if(WIN32 AND NOT MARIADB_BUILD_SOURCE) - set(MARIADB_MSI_DIR "${PROJECT_BINARY_DIR}/msi") - set(MARIADB_CONNECTOR_DIR "${PROJECT_BINARY_DIR}/mariadbcpp") + set(MARIADB_MSI_DIR "${CMAKE_BINARY_DIR}/msi") + set(MARIADB_CONNECTOR_DIR "${CMAKE_BINARY_DIR}/mariadbcpp") set(MARIADB_C_CONNECTOR_DIR "${MARIADB_CONNECTOR_DIR}/MariaDB/MariaDB Connector C 64-bit") set(MARIADB_CPP_CONNECTOR_DIR "${MARIADB_CONNECTOR_DIR}/MariaDB/MariaDB C++ Connector 64-bit") @@ -59,7 +59,7 @@ if(WIN32 AND NOT MARIADB_BUILD_SOURCE) COMMAND ${CMAKE_COMMAND} -E copy_if_different "${MARIADBCPP_SHARED_LIBRARY_LOCATION}" "${MARIADBC_SHARED_LIBRARY_LOCATION}" - "${PROJECT_BINARY_DIR}") + "${CMAKE_BINARY_DIR}") # MariaDB uses plugins that the database needs to load, the prebuilt binaries by default will try to find the libraries in system directories, # so set this define and the servers will set the MARIADB_PLUGIN_DIR environment variable to the appropriate directory. @@ -86,13 +86,13 @@ else() # Build from source -DCMAKE_CXX_FLAGS=-D_GLIBCXX_USE_CXX11_ABI=0) endif() - set(MARIADBCPP_INSTALL_DIR ${PROJECT_BINARY_DIR}/prefix) - set(MARIADBCPP_LIBRARY_DIR ${PROJECT_BINARY_DIR}/mariadbcpp) + set(MARIADBCPP_INSTALL_DIR ${CMAKE_BINARY_DIR}/prefix) + set(MARIADBCPP_LIBRARY_DIR ${CMAKE_BINARY_DIR}/mariadbcpp) set(MARIADBCPP_PLUGIN_DIR ${MARIADBCPP_LIBRARY_DIR}/plugin) set(MARIADBCPP_SOURCE_DIR ${PROJECT_SOURCE_DIR}/thirdparty/mariadb-connector-cpp) set(MARIADB_INCLUDE_DIR "${MARIADBCPP_SOURCE_DIR}/include") ExternalProject_Add(mariadb_connector_cpp - PREFIX "${PROJECT_BINARY_DIR}/thirdparty/mariadb-connector-cpp" + PREFIX "${CMAKE_BINARY_DIR}/thirdparty/mariadb-connector-cpp" SOURCE_DIR ${MARIADBCPP_SOURCE_DIR} INSTALL_DIR ${MARIADBCPP_INSTALL_DIR} CMAKE_ARGS -Wno-dev @@ -127,20 +127,20 @@ else() # Build from source endif() # Create mariadb connector library object -add_library(MariaDB::ConnCpp SHARED IMPORTED GLOBAL) -add_dependencies(MariaDB::ConnCpp mariadb_connector_cpp) -set_target_properties(MariaDB::ConnCpp PROPERTIES +add_library(mariadb_cpp_connector SHARED IMPORTED GLOBAL) +add_dependencies(mariadb_cpp_connector mariadb_connector_cpp) +set_target_properties(mariadb_cpp_connector PROPERTIES IMPORTED_LOCATION "${MARIADBCPP_SHARED_LIBRARY_LOCATION}") if(WIN32) - set_target_properties(MariaDB::ConnCpp PROPERTIES + set_target_properties(mariadb_cpp_connector PROPERTIES IMPORTED_IMPLIB "${MARIADB_IMPLIB_LOCATION}") elseif(APPLE) - set_target_properties(MariaDB::ConnCpp PROPERTIES + set_target_properties(mariadb_cpp_connector PROPERTIES IMPORTED_SONAME "libmariadbcpp") endif() # Add directories to include lists -target_include_directories(MariaDB::ConnCpp SYSTEM INTERFACE ${MARIADB_INCLUDE_DIR}) +target_include_directories(mariadb_cpp_connector SYSTEM INTERFACE ${MARIADB_INCLUDE_DIR}) -set(MariaDB_FOUND TRUE) +set(mariadb_found TRUE) diff --git a/dCommon/CMakeLists.txt b/dCommon/CMakeLists.txt index d020ff72f..959a71b31 100644 --- a/dCommon/CMakeLists.txt +++ b/dCommon/CMakeLists.txt @@ -45,11 +45,15 @@ if (UNIX) elseif (WIN32) include(FetchContent) + set(WITH_GTEST OFF CACHE BOOL "" FORCE) + set(ZLIB_ENABLE_TESTS OFF CACHE BOOL "" FORCE) + set(ZLIB_COMPAT ON CACHE BOOL "Enable ZLIB compatibility mode" FORCE) + # TODO Keep an eye on the zlib repository for an update to disable testing. Don't forget to update CMakePresets FetchContent_Declare( zlib - URL https://github.com/madler/zlib/archive/refs/tags/v1.2.11.zip - URL_HASH MD5=9d6a627693163bbbf3f26403a3a0b0b1 + URL https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.2.2.zip + URL_HASH MD5=2cf9199fb785ea579a2a9905a75c38b3 ) # Disable warning about no project version. @@ -60,7 +64,6 @@ elseif (WIN32) FetchContent_MakeAvailable(zlib) set(ZLIB_INCLUDE_DIRS ${zlib_SOURCE_DIR} ${zlib_BINARY_DIR}) - set_target_properties(zlib PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${ZLIB_INCLUDE_DIRS}") add_library(ZLIB::ZLIB ALIAS zlib) else () message( diff --git a/dCommon/ZCompression.cpp b/dCommon/ZCompression.cpp index e5b3c8fb4..447f4650f 100644 --- a/dCommon/ZCompression.cpp +++ b/dCommon/ZCompression.cpp @@ -9,6 +9,7 @@ namespace ZCompression { } int32_t Compress(const uint8_t* abSrc, int32_t nLenSrc, uint8_t* abDst, int32_t nLenDst) { + z_stream zInfo = { 0 }; zInfo.total_in = zInfo.avail_in = nLenSrc; zInfo.total_out = zInfo.avail_out = nLenDst; diff --git a/dCommon/dClient/AssetManager.cpp b/dCommon/dClient/AssetManager.cpp index 59427ee52..ba545e7f4 100644 --- a/dCommon/dClient/AssetManager.cpp +++ b/dCommon/dClient/AssetManager.cpp @@ -4,8 +4,6 @@ #include "Game.h" #include "Logger.h" -#include "zlib.h" - AssetManager::AssetManager(const std::filesystem::path& path) { if (!std::filesystem::is_directory(path)) { throw std::runtime_error("Attempted to load asset bundle (" + path.string() + ") however it is not a valid directory."); @@ -82,7 +80,7 @@ bool AssetManager::HasFile(const char* name) { if (fixedName.rfind("client\\res\\", 0) != 0) fixedName = "client\\res\\" + fixedName; uint32_t crc = crc32b(0xFFFFFFFF, reinterpret_cast(const_cast(fixedName.c_str())), fixedName.size()); - crc = crc32b(crc, reinterpret_cast(const_cast("\0\0\0\0")), 4); + crc = crc32b(crc, reinterpret_cast(const_cast("\0\0\0\0")), 4); for (const auto& item : this->m_PackIndex->GetPackFileIndices()) { if (item.m_Crc == crc) { @@ -130,7 +128,7 @@ bool AssetManager::GetFile(const char* name, char** data, uint32_t* len) { } int32_t packIndex = -1; uint32_t crc = crc32b(0xFFFFFFFF, reinterpret_cast(const_cast(fixedName.c_str())), fixedName.size()); - crc = crc32b(crc, reinterpret_cast(const_cast("\0\0\0\0")), 4); + crc = crc32b(crc, reinterpret_cast(const_cast("\0\0\0\0")), 4); for (const auto& item : this->m_PackIndex->GetPackFileIndices()) { if (item.m_Crc == crc) { diff --git a/dCommon/dEnums/dPlatforms.h b/dCommon/dEnums/dPlatforms.h index bca7f9e01..4c2804080 100644 --- a/dCommon/dEnums/dPlatforms.h +++ b/dCommon/dEnums/dPlatforms.h @@ -8,6 +8,8 @@ #define DARKFLAME_PLATFORM_IOS #elif TARGET_OS_MAC #define DARKFLAME_PLATFORM_MACOS +#pragma clang diagnostic push // prevent pragma messages being counted as a warning +#pragma clang diagnostic ignored "-W#pragma-messages" #else #error unknown Apple operating system #endif diff --git a/dDatabase/CMakeLists.txt b/dDatabase/CMakeLists.txt index 42bdb9838..84d827c60 100644 --- a/dDatabase/CMakeLists.txt +++ b/dDatabase/CMakeLists.txt @@ -4,7 +4,7 @@ add_subdirectory(GameDatabase) add_library(dDatabase STATIC "MigrationRunner.cpp") add_custom_target(conncpp_dylib - ${CMAKE_COMMAND} -E copy $ ${PROJECT_BINARY_DIR}) + ${CMAKE_COMMAND} -E copy $ ${CMAKE_BINARY_DIR}) add_dependencies(dDatabase conncpp_dylib) diff --git a/dDatabase/GameDatabase/CMakeLists.txt b/dDatabase/GameDatabase/CMakeLists.txt index 32fe414af..98df08c35 100644 --- a/dDatabase/GameDatabase/CMakeLists.txt +++ b/dDatabase/GameDatabase/CMakeLists.txt @@ -21,7 +21,7 @@ target_include_directories(dDatabaseGame PUBLIC "." "${PROJECT_SOURCE_DIR}/dCommon/dEnums" ) target_link_libraries(dDatabaseGame - PUBLIC MariaDB::ConnCpp + PUBLIC mariadb_cpp_connector INTERFACE dCommon) # Glob together all headers that need to be precompiled diff --git a/dGame/dPropertyBehaviors/ControlBehaviorMessages/MoveToInventoryMessage.h b/dGame/dPropertyBehaviors/ControlBehaviorMessages/MoveToInventoryMessage.h index e1f88713d..6a917b3c3 100644 --- a/dGame/dPropertyBehaviors/ControlBehaviorMessages/MoveToInventoryMessage.h +++ b/dGame/dPropertyBehaviors/ControlBehaviorMessages/MoveToInventoryMessage.h @@ -8,7 +8,8 @@ class AMFArrayValue; /** * @brief Sent when a player moves a Behavior A at position B to their inventory. */ -#pragma warning("This Control Behavior Message does not have a test yet. Non-developers can ignore this warning.") +#pragma message("MoveToInventory.h This Control Behavior Message does not have a test yet. Non-developers can ignore this warning.") + class MoveToInventoryMessage : public BehaviorMessageBase { public: MoveToInventoryMessage(const AMFArrayValue& arguments); diff --git a/dGame/dUtilities/Preconditions.cpp b/dGame/dUtilities/Preconditions.cpp index a0aac27e7..780793da1 100644 --- a/dGame/dUtilities/Preconditions.cpp +++ b/dGame/dUtilities/Preconditions.cpp @@ -137,7 +137,7 @@ bool Precondition::CheckValue(Entity* player, const uint32_t value, bool evaluat return inventoryComponent->GetLotCount(value) >= count; case PreconditionType::DoesNotHaveItem: - return inventoryComponent->IsEquipped(value) < count; + return (inventoryComponent->IsEquipped(value) ? 1 : 0) < count; case PreconditionType::HasAchievement: if (missionComponent == nullptr) return false; return missionComponent->GetMissionState(value) >= eMissionState::COMPLETE; diff --git a/dScripts/02_server/Map/AM/RandomSpawnerFin.cpp b/dScripts/02_server/Map/AM/RandomSpawnerFin.cpp index 577935114..a57358d95 100644 --- a/dScripts/02_server/Map/AM/RandomSpawnerFin.cpp +++ b/dScripts/02_server/Map/AM/RandomSpawnerFin.cpp @@ -65,13 +65,13 @@ void RandomSpawnerFin::OnStartup(Entity* self) { }; sectionMultipliers = { - {"secA", 1}, - {"secB", 1}, + {"secA", 1.0f}, + {"secB", 1.0f}, {"secC", 1.2f}, {"secD", 1.3f}, {"secE", 1.6f}, - {"secF", 1}, - {"secG", 1}, + {"secF", 1.0f}, + {"secG", 1.0f}, {"secH", 1.2f}, }; diff --git a/dScripts/02_server/Map/AM/RandomSpawnerPit.cpp b/dScripts/02_server/Map/AM/RandomSpawnerPit.cpp index ceea9412f..258a8ce25 100644 --- a/dScripts/02_server/Map/AM/RandomSpawnerPit.cpp +++ b/dScripts/02_server/Map/AM/RandomSpawnerPit.cpp @@ -65,7 +65,7 @@ void RandomSpawnerPit::OnStartup(Entity* self) { }; sectionMultipliers = { - {"secA", 1}, + {"secA", 1.0f}, {"secB", 1.2f}, {"secC", 1.2f}, {"secD", 1}, diff --git a/dScripts/02_server/Map/AM/RandomSpawnerStr.cpp b/dScripts/02_server/Map/AM/RandomSpawnerStr.cpp index 0f7f51147..a72211a71 100644 --- a/dScripts/02_server/Map/AM/RandomSpawnerStr.cpp +++ b/dScripts/02_server/Map/AM/RandomSpawnerStr.cpp @@ -65,8 +65,8 @@ void RandomSpawnerStr::OnStartup(Entity* self) { }; sectionMultipliers = { - {"secA", 1}, - {"secB", 1}, + {"secA", 1.0f}, + {"secB", 1.0f}, {"secC", 1.2f}, }; diff --git a/tests/dCommonTests/CMakeLists.txt b/tests/dCommonTests/CMakeLists.txt index 17b31ceda..a94b44063 100644 --- a/tests/dCommonTests/CMakeLists.txt +++ b/tests/dCommonTests/CMakeLists.txt @@ -21,7 +21,7 @@ add_executable(dCommonTests ${DCOMMONTEST_SOURCES}) # Needs to be in binary dir for ctest if(APPLE) add_custom_target(dCommonTestsLink - ${CMAKE_COMMAND} -E copy $ ${CMAKE_CURRENT_BINARY_DIR}) + ${CMAKE_COMMAND} -E copy $ ${CMAKE_CURRENT_BINARY_DIR}) add_dependencies(dCommonTests dCommonTestsLink) endif() diff --git a/tests/dGameTests/CMakeLists.txt b/tests/dGameTests/CMakeLists.txt index f4749ce8c..e466e65d3 100644 --- a/tests/dGameTests/CMakeLists.txt +++ b/tests/dGameTests/CMakeLists.txt @@ -16,7 +16,7 @@ add_executable(dGameTests ${DGAMETEST_SOURCES}) if(APPLE) add_custom_target(dGameTestsLink - ${CMAKE_COMMAND} -E copy $ ${CMAKE_CURRENT_BINARY_DIR}) + ${CMAKE_COMMAND} -E copy $ ${CMAKE_CURRENT_BINARY_DIR}) add_dependencies(dGameTests dGameTestsLink) endif()