From d78b50874c849e73628c2d1c18d0d9732a993abd Mon Sep 17 00:00:00 2001 From: jadebenn Date: Mon, 29 Jan 2024 21:45:50 -0600 Subject: [PATCH] chore: upgrade MacOS build settings for better C++20 compatibility (#1435) * upgrade MacOS build settings for better C++20 compatibility * add fixes I forgot * 3rd try * Update UserManager.cpp * Update CMakeLists.txt * End with newline * Update CMakeLists.txt * update to reflect feedback * Update CMakeLists.txt to disable deprecation warnings on SHA512 * attempt to disable sqlite warnings * revert last attempt (didn't work) * disable sqlite deprecation warnings on MacOS --- .github/workflows/build-and-test.yml | 10 ++++++---- CMakeLists.txt | 1 + CMakePresets.json | 10 +++++----- dCommon/CMakeLists.txt | 5 +++++ dGame/UserManager.cpp | 2 +- .../ControlBehaviorMessages/AddStripMessage.cpp | 4 ++++ .../ControlBehaviorMessages/AddStripMessage.h | 2 +- thirdparty/SQLite/CMakeLists.txt | 2 +- 8 files changed, 24 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index ed7c0c7b..fc44885d 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -13,7 +13,7 @@ jobs: continue-on-error: true strategy: matrix: - os: [ windows-2022, ubuntu-22.04, macos-11 ] + os: [ windows-2022, ubuntu-22.04, macos-13 ] steps: - uses: actions/checkout@v3 @@ -25,9 +25,11 @@ jobs: with: vs-version: '[17,18)' msbuild-architecture: x64 - - name: Install libssl (Mac Only) - if: ${{ matrix.os == 'macos-11' }} - run: brew install openssl@3 + - name: Install libssl and switch to XCode 15.2 (Mac Only) + if: ${{ matrix.os == 'macos-13' }} + run: | + brew install openssl@3 + sudo xcode-select -s /Applications/Xcode_15.2.app/Contents/Developer - name: cmake uses: lukka/run-cmake@v10 with: diff --git a/CMakeLists.txt b/CMakeLists.txt index 09cbac97..1b6a775e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,7 @@ project(Darkflame) include(CTest) set(CMAKE_CXX_STANDARD 20) +set(CXX_STANDARD_REQUIRED ON) set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") # Read variables from file diff --git a/CMakePresets.json b/CMakePresets.json index 77b8b242..2feabc53 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -20,7 +20,7 @@ "inherits": "default" }, { - "name": "ci-macos-11", + "name": "ci-macos-13", "displayName": "CI configure step for MacOS", "description": "Same as default, Used in GitHub actions workflow", "inherits": "default" @@ -74,8 +74,8 @@ "jobs": 2 }, { - "name": "ci-macos-11", - "configurePreset": "ci-macos-11", + "name": "ci-macos-13", + "configurePreset": "ci-macos-13", "displayName": "MacOS CI Build", "description": "This preset is used by the CI build on MacOS", "jobs": 2 @@ -95,8 +95,8 @@ } }, { - "name": "ci-macos-11", - "configurePreset": "ci-macos-11", + "name": "ci-macos-13", + "configurePreset": "ci-macos-13", "displayName": "CI Tests on MacOS", "description": "Runs all tests on a Mac configuration", "execution": { diff --git a/dCommon/CMakeLists.txt b/dCommon/CMakeLists.txt index fec1a2d7..32f24028 100644 --- a/dCommon/CMakeLists.txt +++ b/dCommon/CMakeLists.txt @@ -68,3 +68,8 @@ else () endif () target_link_libraries(dCommon ZLIB::ZLIB) + +# Disable deprecation warnings on MD5.cpp and SHA512.cpp for Apple Clang +if (APPLE) + set_source_files_properties("MD5.cpp" "SHA512.cpp" PROPERTIES COMPILE_FLAGS "-Wno-deprecated-declarations") +endif() diff --git a/dGame/UserManager.cpp b/dGame/UserManager.cpp index fc582108..b98569eb 100644 --- a/dGame/UserManager.cpp +++ b/dGame/UserManager.cpp @@ -451,7 +451,7 @@ void UserManager::RenameCharacter(const SystemAddress& sysAddr, Packet* packet) "User %i tried to rename a character that it does not own!", u->GetAccountID()); - std::find_if(u->GetCharacters().begin(), u->GetCharacters().end(), [&](Character* c) { + auto unusedItr = std::find_if(u->GetCharacters().begin(), u->GetCharacters().end(), [&](Character* c) { if (c->GetID() == charID) { character = c; return true; diff --git a/dGame/dPropertyBehaviors/ControlBehaviorMessages/AddStripMessage.cpp b/dGame/dPropertyBehaviors/ControlBehaviorMessages/AddStripMessage.cpp index 5e75f6c4..6f0741dd 100644 --- a/dGame/dPropertyBehaviors/ControlBehaviorMessages/AddStripMessage.cpp +++ b/dGame/dPropertyBehaviors/ControlBehaviorMessages/AddStripMessage.cpp @@ -22,3 +22,7 @@ AddStripMessage::AddStripMessage(AMFArrayValue* arguments) : BehaviorMessageBase } LOG_DEBUG("number of actions %i", actionsToAdd.size()); } + +std::vector AddStripMessage::GetActionsToAdd() const { + return actionsToAdd; +} diff --git a/dGame/dPropertyBehaviors/ControlBehaviorMessages/AddStripMessage.h b/dGame/dPropertyBehaviors/ControlBehaviorMessages/AddStripMessage.h index 0b9a09e3..5cceb510 100644 --- a/dGame/dPropertyBehaviors/ControlBehaviorMessages/AddStripMessage.h +++ b/dGame/dPropertyBehaviors/ControlBehaviorMessages/AddStripMessage.h @@ -21,7 +21,7 @@ public: AddStripMessage(AMFArrayValue* arguments); StripUiPosition GetPosition() const { return position; }; ActionContext GetActionContext() const { return actionContext; }; - std::vector GetActionsToAdd() const { return actionsToAdd; }; + std::vector GetActionsToAdd() const; private: StripUiPosition position; ActionContext actionContext; diff --git a/thirdparty/SQLite/CMakeLists.txt b/thirdparty/SQLite/CMakeLists.txt index ba45f015..3aa066a4 100644 --- a/thirdparty/SQLite/CMakeLists.txt +++ b/thirdparty/SQLite/CMakeLists.txt @@ -14,6 +14,6 @@ if(UNIX) if(NOT APPLE) target_compile_options(sqlite3 PRIVATE "-Wno-return-local-addr" "-Wno-maybe-uninitialized") else() - target_compile_options(sqlite3 PRIVATE "-Wno-return-stack-address" "-Wno-uninitialized") + target_compile_options(sqlite3 PRIVATE "-Wno-return-stack-address" "-Wno-uninitialized" "-Wno-deprecated-declarations") endif() endif()