Skip to content

Commit

Permalink
add ubuntu 24 and gcc14/g++14
Browse files Browse the repository at this point in the history
fix build

fix warnig build

add ubuntu 24 and gcc14/g++14
  • Loading branch information
beats-dh committed Aug 27, 2024
1 parent 06c6a67 commit 7019c17
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 25 deletions.
23 changes: 17 additions & 6 deletions .github/workflows/build-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -50,12 +52,21 @@ jobs:
run: >

Check failure on line 52 in .github/workflows/build-ubuntu.yml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] reported by reviewdog 🐶 shellcheck reported issue in this script: SC2046:warning:1:66: Quote this to prevent word splitting [shellcheck] Raw Output: .github/workflows/build-ubuntu.yml:52:9: shellcheck reported issue in this script: SC2046:warning:1:66: Quote this to prevent word splitting [shellcheck]
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
Expand Down
38 changes: 23 additions & 15 deletions cmake/modules/CanaryLib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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) ===
Expand Down
7 changes: 4 additions & 3 deletions src/pch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,14 @@
#include <fmt/core.h>
#include <fmt/format.h>
#include <fmt/args.h>
#include <fmt/ranges.h>

// FMT Custom Formatter for Enums
template <typename E>
struct fmt::formatter<E, std::enable_if_t<std::is_enum_v<E>, char>> : formatter<std::underlying_type_t<E>> {
struct fmt::formatter<E, std::enable_if_t<std::is_enum_v<E>, char>> : fmt::formatter<std::underlying_type_t<E>> {
template <typename FormatContext>
auto format(E e, FormatContext &ctx) {
return formatter<std::underlying_type_t<E>>::format(
auto format(E e, FormatContext &ctx) const { // Adicione 'const' aqui
return fmt::formatter<std::underlying_type_t<E>>::format(
static_cast<std::underlying_type_t<E>>(e), ctx
);
}
Expand Down
2 changes: 1 addition & 1 deletion vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@
"platform": "windows"
}
],
"builtin-baseline": "095ee06e7f60dceef7d713e3f8b1c2eb10d650d7"
"builtin-baseline": "509f71e53f45e46c13fa7935d2f6a45803580c07"
}

0 comments on commit 7019c17

Please sign in to comment.