From 7019c171b154d4f341f837b62a35b7b772decdf9 Mon Sep 17 00:00:00 2001 From: beats-dh Date: Tue, 27 Aug 2024 20:54:48 -0300 Subject: [PATCH] add ubuntu 24 and gcc14/g++14 fix build fix warnig build add ubuntu 24 and gcc14/g++14 --- .github/workflows/build-ubuntu.yml | 23 +++++++++++++----- cmake/modules/CanaryLib.cmake | 38 ++++++++++++++++++------------ src/pch.hpp | 7 +++--- vcpkg.json | 2 +- 4 files changed, 45 insertions(+), 25 deletions(-) diff --git a/.github/workflows/build-ubuntu.yml b/.github/workflows/build-ubuntu.yml index 2b369e34875..291db8d4999 100644 --- a/.github/workflows/build-ubuntu.yml +++ b/.github/workflows/build-ubuntu.yml @@ -36,11 +36,13 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-22.04] + os: [ubuntu-22.04, ubuntu-24.04] buildtype: [linux-release, linux-debug] include: - os: ubuntu-22.04 triplet: x64-linux + - os: ubuntu-24.04 + triplet: x64-linux steps: - name: Checkout repository @@ -50,12 +52,21 @@ jobs: run: > sudo apt-get update && sudo apt-get install ccache linux-headers-$(uname -r) - - name: Switch to gcc-11 - if: matrix.os == 'ubuntu-20.04' + - name: Switch to gcc-12 on Ubuntu 22.04 + if: matrix.os == 'ubuntu-22.04' + run: | + sudo apt install gcc-12 g++-12 + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100 --slave /usr/bin/g++ g++ /usr/bin/g++-12 --slave /usr/bin/gcov gcov /usr/bin/gcov-12 + sudo update-alternatives --set gcc /usr/bin/gcc-12 + + - name: Switch to gcc-14 on Ubuntu 24.04 + if: matrix.os == 'ubuntu-24.04' run: | - sudo apt install gcc-11 g++-11 - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11 - sudo update-alternatives --set gcc /usr/bin/gcc-11 + sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y + sudo apt-get update + sudo apt-get install gcc-14 g++-14 -y + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100 --slave /usr/bin/g++ g++ /usr/bin/g++-14 --slave /usr/bin/gcov gcov /usr/bin/gcov-14 + sudo update-alternatives --set gcc /usr/bin/gcc-14 - name: CCache uses: hendrikmuhs/ccache-action@main diff --git a/cmake/modules/CanaryLib.cmake b/cmake/modules/CanaryLib.cmake index a3f5410b9d8..ff57f370e64 100644 --- a/cmake/modules/CanaryLib.cmake +++ b/cmake/modules/CanaryLib.cmake @@ -47,23 +47,31 @@ target_compile_definitions(${PROJECT_NAME}_lib PUBLIC ) # === IPO === -if(MSVC) - target_compile_options(${PROJECT_NAME}_lib PRIVATE "/GL") - set_target_properties(${PROJECT_NAME}_lib PROPERTIES - STATIC_LINKER_FLAGS "/LTCG" - SHARED_LINKER_FLAGS "/LTCG" - MODULE_LINKER_FLAGS "/LTCG" - EXE_LINKER_FLAGS "/LTCG") -else() - include(CheckIPOSupported) - check_ipo_supported(RESULT result) - if(result) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto=auto") - message(STATUS "IPO/LTO enabled with -flto=auto for non-MSVC compiler.") - set_property(TARGET ${PROJECT_NAME}_lib PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) +if(OPTIONS_ENABLE_IPO) + if(MSVC) + target_compile_options(${PROJECT_NAME}_lib PRIVATE "/GL") + set_target_properties(${PROJECT_NAME}_lib PROPERTIES + STATIC_LINKER_FLAGS "/LTCG" + SHARED_LINKER_FLAGS "/LTCG" + MODULE_LINKER_FLAGS "/LTCG" + EXE_LINKER_FLAGS "/LTCG") else() - message(WARNING "IPO/LTO is not supported: ${output}") + if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "14.0" AND CMAKE_BUILD_TYPE STREQUAL "Debug") + message(STATUS "GCC 14 detected and Debug build. Disabling IPO/LTO.") + else() + include(CheckIPOSupported) + check_ipo_supported(RESULT result) + if(result) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto=auto") + message(STATUS "IPO/LTO enabled with -flto=auto for non-MSVC compiler.") + set_property(TARGET ${PROJECT_NAME}_lib PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) + else() + message(WARNING "IPO/LTO is not supported: ${output}") + endif() + endif() endif() +else() + log_option_disabled("IPO/LTO") endif() # === UNITY BUILD (compile time reducer) === diff --git a/src/pch.hpp b/src/pch.hpp index e69c27016a4..248d142bd86 100644 --- a/src/pch.hpp +++ b/src/pch.hpp @@ -81,13 +81,14 @@ #include #include #include +#include // FMT Custom Formatter for Enums template -struct fmt::formatter, char>> : formatter> { +struct fmt::formatter, char>> : fmt::formatter> { template - auto format(E e, FormatContext &ctx) { - return formatter>::format( + auto format(E e, FormatContext &ctx) const { // Adicione 'const' aqui + return fmt::formatter>::format( static_cast>(e), ctx ); } diff --git a/vcpkg.json b/vcpkg.json index eed7e776ee0..31c25bfe496 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -38,5 +38,5 @@ "platform": "windows" } ], - "builtin-baseline": "095ee06e7f60dceef7d713e3f8b1c2eb10d650d7" + "builtin-baseline": "509f71e53f45e46c13fa7935d2f6a45803580c07" }