Skip to content

Commit

Permalink
Merge pull request #241 from eseiler/infra/llvm19
Browse files Browse the repository at this point in the history
[INFRA] CPP23 and Clang-19
  • Loading branch information
eseiler authored Oct 23, 2024
2 parents 25539c9 + cf6006f commit 6e1fd5a
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 106 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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-19", "clang-18", "clang-17", "gcc-14", "gcc-13", "gcc-12", "intel"]
container:
image: ghcr.io/seqan/${{ matrix.compiler }}
volumes:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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-19", "clang-18", "clang-17", "gcc-14", "gcc-13", "gcc-12"]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
17 changes: 7 additions & 10 deletions .github/workflows/ci_misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@ jobs:
build: snippet
build_type: Release
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"
Expand All @@ -51,10 +50,9 @@ jobs:
build: performance
build_type: Release
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"
Expand All @@ -64,16 +62,15 @@ jobs:
build: header
build_type: Release
use_include_dependencies: "OFF"
cxx_flags: "-stdlib=libc++"

- name: "Header gcc13"
compiler: "gcc-13"
build: header
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"
Expand All @@ -85,7 +82,7 @@ jobs:
use_include_dependencies: "ON"

- name: "Tutorial"
compiler: "gcc-11"
compiler: "gcc-12"
build: tutorial
build_type: Debug
use_include_dependencies: "OFF"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci_sanitizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,16 @@ 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
image: ghcr.io/seqan/gcc-14

- 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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_util.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
39 changes: 19 additions & 20 deletions cmake/configuration.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 ()

# ----------------------------------------------------------------------------
Expand Down
8 changes: 5 additions & 3 deletions cmake/package-lock.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -27,15 +27,17 @@ 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
NAME 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
Expand Down
79 changes: 20 additions & 59 deletions include/hibf/platform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

#pragma once

#include <version> // for __cpp_lib_constexpr_vector

// macro cruft
//!\cond
#define HIBF_STR_HELPER(x) #x
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -66,44 +68,29 @@
// ============================================================================

#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 && __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
# if (__GNUC__ < 12)
# error "At least GCC 12 is needed."
# 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(<version>)
# include <version> // for __cpp_lib_constexpr_vector
#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."
Expand Down Expand Up @@ -172,42 +159,16 @@
# 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
#else
# 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
Expand Down
13 changes: 5 additions & 8 deletions util/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 6e1fd5a

Please sign in to comment.