From 81622809f802ccfed0c7bd6e24a650b78252804e Mon Sep 17 00:00:00 2001 From: Enrico Seiler Date: Wed, 23 Oct 2024 18:28:55 +0200 Subject: [PATCH 1/3] [INFRA] Bump to C++23 --- .github/workflows/ci_linux.yml | 2 +- .github/workflows/ci_macos.yml | 2 +- .github/workflows/ci_misc.yml | 14 +++++++------- cmake/configuration.cmake | 35 +++++++++++++++++----------------- include/hibf/platform.hpp | 15 +++++---------- util/CMakeLists.txt | 13 +++++-------- 6 files changed, 36 insertions(+), 45 deletions(-) diff --git a/.github/workflows/ci_linux.yml b/.github/workflows/ci_linux.yml index e955308b..dc754463 100644 --- a/.github/workflows/ci_linux.yml +++ b/.github/workflows/ci_linux.yml @@ -32,7 +32,7 @@ jobs: strategy: fail-fast: false matrix: - compiler: ["clang-18", "clang-17", "gcc-14", "gcc-13", "gcc-12", "gcc-11", "intel"] + compiler: ["clang-18", "clang-17", "gcc-14", "gcc-13", "gcc-12", "intel"] container: image: ghcr.io/seqan/${{ matrix.compiler }} volumes: diff --git a/.github/workflows/ci_macos.yml b/.github/workflows/ci_macos.yml index 51a801ec..ca602588 100644 --- a/.github/workflows/ci_macos.yml +++ b/.github/workflows/ci_macos.yml @@ -32,7 +32,7 @@ jobs: strategy: fail-fast: false matrix: - compiler: ["clang-18", "clang-17", "gcc-14", "gcc-13", "gcc-12", "gcc-11"] + compiler: ["clang-18", "clang-17", "gcc-14", "gcc-13", "gcc-12"] steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/ci_misc.yml b/.github/workflows/ci_misc.yml index e525bda7..c6074977 100644 --- a/.github/workflows/ci_misc.yml +++ b/.github/workflows/ci_misc.yml @@ -40,8 +40,8 @@ jobs: use_include_dependencies: "OFF" cxx_flags: "-stdlib=libc++" - - name: "Snippet gcc11" - compiler: "gcc-11" + - name: "Snippet gcc12" + compiler: "gcc-12" build: snippet build_type: Release use_include_dependencies: "OFF" @@ -53,8 +53,8 @@ jobs: use_include_dependencies: "OFF" cxx_flags: "-stdlib=libc++" - - name: "Performance gcc11" - compiler: "gcc-11" + - name: "Performance gcc12" + compiler: "gcc-12" build: performance build_type: Release use_include_dependencies: "OFF" @@ -72,8 +72,8 @@ jobs: build_type: Release use_include_dependencies: "OFF" - - name: "Header gcc11" - compiler: "gcc-11" + - name: "Header gcc12" + compiler: "gcc-12" build: header build_type: Release use_include_dependencies: "OFF" @@ -85,7 +85,7 @@ jobs: use_include_dependencies: "ON" - name: "Tutorial" - compiler: "gcc-11" + compiler: "gcc-12" build: tutorial build_type: Debug use_include_dependencies: "OFF" diff --git a/cmake/configuration.cmake b/cmake/configuration.cmake index 6346aa48..88e87ffb 100644 --- a/cmake/configuration.cmake +++ b/cmake/configuration.cmake @@ -79,43 +79,42 @@ include ("${HIBF_SOURCE_DIR}/test/cmake/hibf_require_ccache.cmake") hibf_require_ccache () # ---------------------------------------------------------------------------- -# Require C++20 +# Require C++23 # ---------------------------------------------------------------------------- set (CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS}) set (CXXSTD_TEST_SOURCE - "#if !defined (__cplusplus) || (__cplusplus < 202002) - #error NOCXX20 + "#if !defined (__cplusplus) || (__cplusplus < 202100) + #error NOCXX23 #endif int main() {}") -set (HIBF_FEATURE_CPP20_FLAG_BUILTIN "") -set (HIBF_FEATURE_CPP20_FLAG_STD20 "-std=c++20") -set (HIBF_FEATURE_CPP20_FLAG_STD2a "-std=c++2a") +set (HIBF_FEATURE_CPP23_FLAG_BUILTIN "") +set (HIBF_FEATURE_CPP23_FLAG_STD23 "-std=c++23") -set (HIBF_CPP20_FLAG "") +set (HIBF_CPP23_FLAG "") -foreach (_FLAG BUILTIN STD20 STD2a) - set (CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS_SAVE} ${HIBF_FEATURE_CPP20_FLAG_${_FLAG}}") +foreach (_FLAG BUILTIN STD23) + set (CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS_SAVE} ${HIBF_FEATURE_CPP23_FLAG_${_FLAG}}") - check_cxx_source_compiles ("${CXXSTD_TEST_SOURCE}" CPP20_FLAG_${_FLAG}) + check_cxx_source_compiles ("${CXXSTD_TEST_SOURCE}" CPP23_FLAG_${_FLAG}) - if (CPP20_FLAG_${_FLAG}) - set (HIBF_CPP20_FLAG ${_FLAG}) + if (CPP23_FLAG_${_FLAG}) + set (HIBF_CPP23_FLAG ${_FLAG}) break () endif () endforeach () set (CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE}) -if (HIBF_CPP20_FLAG STREQUAL "BUILTIN") - hibf_config_print ("C++ Standard-20 support: builtin") -elseif (HIBF_CPP20_FLAG) - set (HIBF_CXX_FLAGS "${HIBF_CXX_FLAGS} ${HIBF_FEATURE_CPP20_FLAG_${HIBF_CPP20_FLAG}}") - hibf_config_print ("C++ Standard-20 support: via ${HIBF_FEATURE_CPP20_FLAG_${HIBF_CPP20_FLAG}}") +if (HIBF_CPP23_FLAG STREQUAL "BUILTIN") + hibf_config_print ("C++ Standard-23 support: builtin") +elseif (HIBF_CPP23_FLAG) + set (HIBF_CXX_FLAGS "${HIBF_CXX_FLAGS} ${HIBF_FEATURE_CPP23_FLAG_${HIBF_CPP23_FLAG}}") + hibf_config_print ("C++ Standard-23 support: via ${HIBF_FEATURE_CPP23_FLAG_${HIBF_CPP23_FLAG}}") else () - hibf_config_error ("HIBF requires C++20, but your compiler does not support it.") + hibf_config_error ("HIBF requires C++23, but your compiler does not support it.") endif () # ---------------------------------------------------------------------------- diff --git a/include/hibf/platform.hpp b/include/hibf/platform.hpp index 2eb9c25b..ea752bba 100644 --- a/include/hibf/platform.hpp +++ b/include/hibf/platform.hpp @@ -66,13 +66,9 @@ // ============================================================================ #if HIBF_COMPILER_IS_GCC -# if (__GNUC__ < 11) -# error "At least GCC 11 is needed." -# endif // (__GNUC__ < 11) - -# if (__GNUC__ == 11 && __GNUC_MINOR__ <= 3) -# pragma warning "Be aware that GCC < 11.4 might have bugs that cause compile failure." -# endif // (__GNUC__ == 11 && __GNUC_MINOR__ <= 3) +# if (__GNUC__ < 12) +# error "At least GCC 12 is needed." +# endif // (__GNUC__ < 12) # if (__GNUC__ == 12 && __GNUC_MINOR__ <= 2) # pragma warning "Be aware that GCC < 12.3 might have bugs that cause compile failure." @@ -100,10 +96,9 @@ #endif // C++ standard [required] -// Note: gcc10 -std=c++20 still defines __cplusplus=201709 #ifdef __cplusplus -# if (__cplusplus < 201709) -# error "C++20 is required, make sure that you have set -std=c++20." +# if (__cplusplus < 202100) +# error "C++23 is required, make sure that you have set -std=c++23." # endif #else # error "This is not a C++ compiler." diff --git a/util/CMakeLists.txt b/util/CMakeLists.txt index 49a46ad8..af84c2c8 100644 --- a/util/CMakeLists.txt +++ b/util/CMakeLists.txt @@ -16,15 +16,12 @@ add_subdirectory ("${HIBF_ROOT_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/hibf_lib") # Dependency: Sharg include (FetchContent) +option (SHARG_NO_TDL "" ON) FetchContent_Declare ( sharg - URL "https://github.com/seqan/sharg-parser/releases/download/1.1.1/sharg-1.1.1-Source.tar.xz" - URL_HASH SHA256=7330f06501718e7871e55e5fd70d0e41472cc8b34bd0e3519f8c5547510c671c - PATCH_COMMAND curl https://github.com/seqan/sharg-parser/commit/bbbfca65333b00317b3e99a35e64f44a5c3224d6.patch | - patch --strip=1 --force) -FetchContent_Populate (sharg) -list (APPEND CMAKE_PREFIX_PATH "${sharg_SOURCE_DIR}/build_system") -find_package (sharg 1.0 REQUIRED) + GIT_REPOSITORY https://github.com/seqan/sharg-parser + GIT_TAG main) +FetchContent_MakeAvailable (sharg) add_executable (fpr_correction_check fpr_correction_check.cpp) -target_link_libraries (fpr_correction_check seqan::hibf sharg::sharg) +target_link_libraries (fpr_correction_check sharg::sharg seqan::hibf) From 828a1f4754504b53893ece85508f90e0c04a112a Mon Sep 17 00:00:00 2001 From: Enrico Seiler Date: Wed, 23 Oct 2024 19:24:26 +0200 Subject: [PATCH 2/3] [INFRA] Fewer compiler checks --- cmake/configuration.cmake | 4 +-- include/hibf/platform.hpp | 66 ++++++++++----------------------------- 2 files changed, 18 insertions(+), 52 deletions(-) diff --git a/cmake/configuration.cmake b/cmake/configuration.cmake index 88e87ffb..a38afbf0 100644 --- a/cmake/configuration.cmake +++ b/cmake/configuration.cmake @@ -63,8 +63,8 @@ set (CMAKE_REQUIRED_FLAGS ${CMAKE_CXX_FLAGS}) # Check supported compilers # ---------------------------------------------------------------------------- -if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11) - hibf_config_error ("GCC < 11 is not supported. The detected compiler version is ${CMAKE_CXX_COMPILER_VERSION}.") +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12) + hibf_config_error ("GCC < 12 is not supported. The detected compiler version is ${CMAKE_CXX_COMPILER_VERSION}.") endif () if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17) diff --git a/include/hibf/platform.hpp b/include/hibf/platform.hpp index ea752bba..cb0e8eb7 100644 --- a/include/hibf/platform.hpp +++ b/include/hibf/platform.hpp @@ -9,6 +9,8 @@ #pragma once +#include // for __cpp_lib_constexpr_vector + // macro cruft //!\cond #define HIBF_STR_HELPER(x) #x @@ -38,7 +40,7 @@ * * \sa https://sourceforge.net/p/predef/wiki/Compilers */ -#if defined(__GNUC__) && !defined(__llvm__) && !defined(__INTEL_COMPILER) +#if defined(__GNUC__) && !defined(__llvm__) && !defined(__INTEL_COMPILER) && !defined(__INTEL_LLVM_COMPILER) # define HIBF_COMPILER_IS_GCC 1 #else # define HIBF_COMPILER_IS_GCC 0 @@ -68,33 +70,23 @@ #if HIBF_COMPILER_IS_GCC # if (__GNUC__ < 12) # error "At least GCC 12 is needed." -# endif // (__GNUC__ < 12) - -# if (__GNUC__ == 12 && __GNUC_MINOR__ <= 2) -# pragma warning "Be aware that GCC < 12.3 might have bugs that cause compile failure." -# endif // (__GNUC__ == 12 && __GNUC_MINOR__ <= 2) - -# if HIBF_DOXYGEN_ONLY(1) 0 -//!\brief This disables the warning you would get if your compiler is newer than the latest supported version. -# define HIBF_DISABLE_NEWER_COMPILER_DIAGNOSTIC -# endif // HIBF_DOXYGEN_ONLY(1)0 - -# ifndef HIBF_DISABLE_NEWER_COMPILER_DIAGNOSTIC -# if (__GNUC__ > 14) -# pragma message \ - "Your compiler is newer than the latest supported compiler version (gcc-14). It might be that compiling fails. You can disable this warning by setting -DHIBF_DISABLE_NEWER_COMPILER_DIAGNOSTIC." -# endif // (__GNUC__ > 14) -# endif // HIBF_DISABLE_NEWER_COMPILER_DIAGNOSTIC +# endif +#else +# ifdef __INTEL_LLVM_COMPILER +# if __INTEL_LLVM_COMPILER < 20240000 +# error "At least Intel OneAPI 2024 is needed." +# endif +# else +# if (_LIBCPP_VERSION < 170000) +# error "At least Clang 17 is needed." +# endif +# endif #endif // ============================================================================ // C++ standard and features // ============================================================================ -#if __has_include() -# include // for __cpp_lib_constexpr_vector -#endif - // C++ standard [required] #ifdef __cplusplus # if (__cplusplus < 202100) @@ -167,24 +159,6 @@ # endif #endif -/*!\brief This is needed to support CentOS 7 or RHEL 7; Newer CentOS's include a more modern default-gcc version making - * this macro obsolete. - * - * In GCC 5 there was a bigger ABI change and modern systems compile with dual ABI, but some enterprise systems (those - * where gcc 4 is the standard compiler) don't support dual ABI. This has the effect that even community builds of gcc - * are build with --disable-libstdcxx-dual-abi. Only building the compiler yourself would solve this problem. - * - * \see https://github.com/seqan/hibf/issues/2244 - * \see https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html - */ -#ifndef HIBF_WORKAROUND_GCC_NO_CXX11_ABI -# if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0 -# define HIBF_WORKAROUND_GCC_NO_CXX11_ABI 1 -# else -# define HIBF_WORKAROUND_GCC_NO_CXX11_ABI 0 -# endif -#endif - //!\brief Our char literals returning std::vector should be constexpr if constexpr std::vector is supported. #if defined(__cpp_lib_constexpr_vector) && __cpp_lib_constexpr_vector >= 201907L # define HIBF_WORKAROUND_LITERAL constexpr @@ -192,17 +166,9 @@ # define HIBF_WORKAROUND_LITERAL inline #endif -#if HIBF_DOXYGEN_ONLY(1) 0 -//!\brief This disables the warning you would get if -D_GLIBCXX_USE_CXX11_ABI=0 is set. -# define HIBF_DISABLE_LEGACY_STD_DIAGNOSTIC -#endif // HIBF_DOXYGEN_ONLY(1)0 - #if defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI == 0 -# ifndef HIBF_DISABLE_LEGACY_STD_DIAGNOSTIC -# pragma message \ - "We do not actively support compiler that have -D_GLIBCXX_USE_CXX11_ABI=0 set, and it might be that compiling fails. It is known that all compilers of CentOS 7 / RHEL 7 set this flag by default (and that it cannot be overridden!). Note that these versions of the OSes are community-supported. You can disable this warning by setting -DHIBF_DISABLE_LEGACY_STD_DIAGNOSTIC." -# endif // HIBF_DISABLE_LEGACY_STD_DIAGNOSTIC -#endif // _GLIBCXX_USE_CXX11_ABI == 0 +# pragma message "We do not actively support compiler that have -D_GLIBCXX_USE_CXX11_ABI=0 set." +#endif // _GLIBCXX_USE_CXX11_ABI == 0 // ============================================================================ // Backmatter From cf6006f61d5df21d3bcaedddbcb93c2085aa114b Mon Sep 17 00:00:00 2001 From: Enrico Seiler Date: Wed, 23 Oct 2024 19:40:49 +0200 Subject: [PATCH 3/3] [INFRA] Add clang-19 --- .github/workflows/ci_linux.yml | 2 +- .github/workflows/ci_macos.yml | 2 +- .github/workflows/ci_misc.yml | 3 --- .github/workflows/ci_sanitizer.yml | 6 +++--- .github/workflows/ci_util.yml | 2 +- cmake/package-lock.cmake | 8 +++++--- 6 files changed, 11 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci_linux.yml b/.github/workflows/ci_linux.yml index dc754463..ec2ed60f 100644 --- a/.github/workflows/ci_linux.yml +++ b/.github/workflows/ci_linux.yml @@ -32,7 +32,7 @@ jobs: strategy: fail-fast: false matrix: - compiler: ["clang-18", "clang-17", "gcc-14", "gcc-13", "gcc-12", "intel"] + compiler: ["clang-19", "clang-18", "clang-17", "gcc-14", "gcc-13", "gcc-12", "intel"] container: image: ghcr.io/seqan/${{ matrix.compiler }} volumes: diff --git a/.github/workflows/ci_macos.yml b/.github/workflows/ci_macos.yml index ca602588..5458469e 100644 --- a/.github/workflows/ci_macos.yml +++ b/.github/workflows/ci_macos.yml @@ -32,7 +32,7 @@ jobs: strategy: fail-fast: false matrix: - compiler: ["clang-18", "clang-17", "gcc-14", "gcc-13", "gcc-12"] + compiler: ["clang-19", "clang-18", "clang-17", "gcc-14", "gcc-13", "gcc-12"] steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/ci_misc.yml b/.github/workflows/ci_misc.yml index c6074977..2ab12068 100644 --- a/.github/workflows/ci_misc.yml +++ b/.github/workflows/ci_misc.yml @@ -38,7 +38,6 @@ jobs: build: snippet build_type: Release use_include_dependencies: "OFF" - cxx_flags: "-stdlib=libc++" - name: "Snippet gcc12" compiler: "gcc-12" @@ -51,7 +50,6 @@ jobs: build: performance build_type: Release use_include_dependencies: "OFF" - cxx_flags: "-stdlib=libc++" - name: "Performance gcc12" compiler: "gcc-12" @@ -64,7 +62,6 @@ jobs: build: header build_type: Release use_include_dependencies: "OFF" - cxx_flags: "-stdlib=libc++" - name: "Header gcc13" compiler: "gcc-13" diff --git a/.github/workflows/ci_sanitizer.yml b/.github/workflows/ci_sanitizer.yml index fd9092e2..32dce590 100644 --- a/.github/workflows/ci_sanitizer.yml +++ b/.github/workflows/ci_sanitizer.yml @@ -65,7 +65,7 @@ jobs: cxx_flags: "-fno-omit-frame-pointer -fsanitize=undefined,float-divide-by-zero" - os: macos-14 - compiler: clang-18 + compiler: clang-19 - os: ubuntu-latest compiler: gcc-14 @@ -73,8 +73,8 @@ jobs: - name: "TSan" os: ubuntu-latest - compiler: clang-18 - image: ghcr.io/seqan/clang-18 + compiler: clang-19 + image: ghcr.io/seqan/clang-19 container: image: ${{ matrix.image || '' }} volumes: diff --git a/.github/workflows/ci_util.yml b/.github/workflows/ci_util.yml index 8a2f4f5e..2df39cd8 100644 --- a/.github/workflows/ci_util.yml +++ b/.github/workflows/ci_util.yml @@ -32,7 +32,7 @@ jobs: strategy: fail-fast: false matrix: - compiler: ["clang-18", "gcc-14"] + compiler: ["clang-19", "gcc-14"] container: image: ghcr.io/seqan/${{ matrix.compiler }} volumes: diff --git a/cmake/package-lock.cmake b/cmake/package-lock.cmake index f2b86b24..3628c7a3 100644 --- a/cmake/package-lock.cmake +++ b/cmake/package-lock.cmake @@ -12,7 +12,7 @@ CPMDeclarePackage (cereal VERSION ${HIBF_CEREAL_VERSION} GITHUB_REPOSITORY USCiLab/cereal SYSTEM TRUE - OPTIONS "JUST_INSTALL_CEREAL ON") + OPTIONS "JUST_INSTALL_CEREAL ON" "CMAKE_MESSAGE_LOG_LEVEL WARNING") # simde set (HIBF_SIMDE_VERSION 0.8.2) CPMDeclarePackage (simde @@ -27,7 +27,8 @@ CPMDeclarePackage (benchmark VERSION ${HIBF_BENCHMARK_VERSION} GITHUB_REPOSITORY google/benchmark SYSTEM TRUE - OPTIONS "BENCHMARK_ENABLE_TESTING OFF" "BENCHMARK_ENABLE_WERROR OFF") + OPTIONS "BENCHMARK_ENABLE_TESTING OFF" "BENCHMARK_ENABLE_WERROR OFF" + "CMAKE_MESSAGE_LOG_LEVEL WARNING") # googletest set (HIBF_GOOGLETEST_VERSION 1.15.2) CPMDeclarePackage (googletest @@ -35,7 +36,8 @@ CPMDeclarePackage (googletest VERSION ${HIBF_GOOGLETEST_VERSION} GITHUB_REPOSITORY google/googletest SYSTEM TRUE - OPTIONS "BUILD_GMOCK OFF" "INSTALL_GTEST OFF" "CMAKE_CXX_STANDARD 20") + OPTIONS "BUILD_GMOCK OFF" "INSTALL_GTEST OFF" "CMAKE_CXX_STANDARD 23" + "CMAKE_MESSAGE_LOG_LEVEL WARNING") # doxygen-awesome set (HIBF_DOXYGEN_AWESOME_VERSION 2.3.4) CPMDeclarePackage (doxygen_awesome