diff --git a/.github/workflows/ci_linux.yml b/.github/workflows/ci_linux.yml index f9ccad6de6..7e11044b84 100644 --- a/.github/workflows/ci_linux.yml +++ b/.github/workflows/ci_linux.yml @@ -33,7 +33,7 @@ jobs: strategy: fail-fast: false matrix: - compiler: ["clang-19", "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"] include: - compiler: "intel" cxx_flags: "-fp-model=strict -Wno-overriding-option" diff --git a/.github/workflows/ci_macos.yml b/.github/workflows/ci_macos.yml index 6b5850a164..9d11def826 100644 --- a/.github/workflows/ci_macos.yml +++ b/.github/workflows/ci_macos.yml @@ -33,7 +33,7 @@ jobs: strategy: fail-fast: false matrix: - compiler: ["clang-19", "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 diff --git a/.github/workflows/ci_misc.yml b/.github/workflows/ci_misc.yml index 27b1787626..5388fbc8f2 100644 --- a/.github/workflows/ci_misc.yml +++ b/.github/workflows/ci_misc.yml @@ -33,7 +33,7 @@ jobs: strategy: fail-fast: false matrix: - compiler: ["clang-19", "gcc-14", "gcc-11", "intel"] + compiler: ["clang-19", "gcc-14", "gcc-12", "intel"] build: ["snippet", "performance", "header"] include: - compiler: "intel" diff --git a/.github/workflows/cron_api.yml b/.github/workflows/cron_api.yml index 94f6b2eeed..83996c59bc 100644 --- a/.github/workflows/cron_api.yml +++ b/.github/workflows/cron_api.yml @@ -32,7 +32,7 @@ jobs: strategy: fail-fast: false matrix: - compiler: ["gcc-14", "gcc-13", "gcc-12", "gcc-11"] + compiler: ["gcc-14", "gcc-13", "gcc-12"] container: image: ghcr.io/seqan/${{ matrix.compiler }} volumes: diff --git a/.github/workflows/cron_avx2.yml b/.github/workflows/cron_avx2.yml index c3c3c39b2e..62bb0343e9 100644 --- a/.github/workflows/cron_avx2.yml +++ b/.github/workflows/cron_avx2.yml @@ -33,7 +33,7 @@ jobs: strategy: fail-fast: false matrix: - compiler: ["clang-19", "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"] build: [unit, snippet, performance, header] include: - compiler: "intel" diff --git a/.github/workflows/cron_latest_libraries.yml b/.github/workflows/cron_latest_libraries.yml index 129820b6a9..570027fc3a 100644 --- a/.github/workflows/cron_latest_libraries.yml +++ b/.github/workflows/cron_latest_libraries.yml @@ -33,7 +33,7 @@ jobs: strategy: fail-fast: false matrix: - compiler: ["clang-19", "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"] build: [unit, snippet, performance, header] include: - compiler: "intel" diff --git a/cmake/package-lock.cmake b/cmake/package-lock.cmake index 0da13662f5..6c93578470 100644 --- a/cmake/package-lock.cmake +++ b/cmake/package-lock.cmake @@ -47,8 +47,7 @@ CPMDeclarePackage (googletest VERSION ${SEQAN3_GOOGLETEST_VERSION} GITHUB_REPOSITORY google/googletest SYSTEM TRUE - OPTIONS "BUILD_GMOCK OFF" "INSTALL_GTEST OFF" "CMAKE_CXX_STANDARD 20" - "CMAKE_MESSAGE_LOG_LEVEL WARNING") + OPTIONS "BUILD_GMOCK OFF" "INSTALL_GTEST OFF" "CMAKE_MESSAGE_LOG_LEVEL WARNING") # doxygen-awesome set (SEQAN3_DOXYGEN_AWESOME_VERSION 2.3.4) CPMDeclarePackage (doxygen_awesome diff --git a/cmake/seqan3-config.cmake b/cmake/seqan3-config.cmake index 74c5987305..1e716c81d8 100644 --- a/cmake/seqan3-config.cmake +++ b/cmake/seqan3-config.cmake @@ -44,7 +44,6 @@ # SEQAN3_INCLUDE_DIRS -- to be passed to include_directories () # SEQAN3_LIBRARIES -- to be passed to target_link_libraries () # SEQAN3_DEFINITIONS -- to be passed to add_definitions () -# SEQAN3_CXX_FLAGS -- to be added to CMAKE_CXX_FLAGS # # Additionally, the following [IMPORTED][IMPORTED] targets are defined: # @@ -52,9 +51,8 @@ # target_link_libraries(target seqan3::seqan3) # automatically sets # target_include_directories(target $SEQAN3_INCLUDE_DIRS), -# target_link_libraries(target $SEQAN3_LIBRARIES), -# target_compile_definitions(target $SEQAN3_DEFINITIONS) and -# target_compile_options(target $SEQAN3_CXX_FLAGS) +# target_link_libraries(target $SEQAN3_LIBRARIES) and +# target_compile_definitions(target $SEQAN3_DEFINITIONS) # for a target. # # [IMPORTED]: https://cmake.org/cmake/help/v3.10/prop_tgt/IMPORTED.html#prop_tgt:IMPORTED @@ -201,53 +199,14 @@ option (SEQAN3_NO_BZIP2 "Don't use BZip2, even if present." OFF) # Check supported compilers # ---------------------------------------------------------------------------- -if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10) - message (FATAL_ERROR "GCC < 10 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) + message (FATAL_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) message (FATAL_ERROR "Clang < 17 is not supported. The detected compiler version is ${CMAKE_CXX_COMPILER_VERSION}.") endif () -# ---------------------------------------------------------------------------- -# Require C++20 -# ---------------------------------------------------------------------------- - -set (CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS}) - -set (CXXSTD_TEST_SOURCE - "#if !defined (__cplusplus) || (__cplusplus < 202002L) - #error NOCXX20 - #endif - int main() {}") - -set (SEQAN3_FEATURE_CPP20_FLAG_BUILTIN "") -set (SEQAN3_FEATURE_CPP20_FLAG_STD20 "-std=c++20") - -set (SEQAN3_CPP20_FLAG "") - -foreach (_FLAG BUILTIN STD20) - set (CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS_SAVE} ${SEQAN3_FEATURE_CPP20_FLAG_${_FLAG}}") - - check_cxx_source_compiles ("${CXXSTD_TEST_SOURCE}" CPP20_FLAG_${_FLAG}) - - if (CPP20_FLAG_${_FLAG}) - set (SEQAN3_CPP20_FLAG ${_FLAG}) - break () - endif () -endforeach () - -set (CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE}) - -if (SEQAN3_CPP20_FLAG STREQUAL "BUILTIN") - seqan3_config_print ("C++ Standard-20 support: builtin") -elseif (SEQAN3_CPP20_FLAG) - set (SEQAN3_CXX_FLAGS "${SEQAN3_CXX_FLAGS} ${SEQAN3_FEATURE_CPP20_FLAG_${SEQAN3_CPP20_FLAG}}") - seqan3_config_print ("C++ Standard-20 support: via ${SEQAN3_FEATURE_CPP20_FLAG_${SEQAN3_CPP20_FLAG}}") -else () - seqan3_config_error ("SeqAn3 requires C++20, but your compiler does not support it.") -endif () - # ---------------------------------------------------------------------------- # thread support (pthread, windows threads) # ---------------------------------------------------------------------------- @@ -389,14 +348,18 @@ set (CXXSTD_TEST_SOURCE "#include # using try_compile instead of check_cxx_source_compiles to capture output in case of failure file (WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx" "${CXXSTD_TEST_SOURCE}\n") -try_compile (SEQAN3_PLATFORM_TEST # +# cmake-format: off +try_compile (SEQAN3_PLATFORM_TEST ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx - CMAKE_FLAGS "-DCOMPILE_DEFINITIONS:STRING=${CMAKE_CXX_FLAGS} ${SEQAN3_CXX_FLAGS}" - "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_INCLUDE_PATH};${SEQAN3_INCLUDE_DIR};${SEQAN3_DEPENDENCY_INCLUDE_DIRS}" + CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_INCLUDE_PATH};${SEQAN3_INCLUDE_DIR};${SEQAN3_DEPENDENCY_INCLUDE_DIRS}" COMPILE_DEFINITIONS ${SEQAN3_DEFINITIONS} LINK_LIBRARIES ${SEQAN3_LIBRARIES} + CXX_STANDARD 23 + CXX_STANDARD_REQUIRED ON + CXX_EXTENSIONS OFF OUTPUT_VARIABLE SEQAN3_PLATFORM_TEST_OUTPUT) +# cmake-format: on if (SEQAN3_PLATFORM_TEST) seqan3_config_print ("SeqAn3 platform.hpp build: passed.") @@ -436,11 +399,9 @@ set (SEQAN3_INCLUDE_DIRS ${SEQAN3_INCLUDE_DIR} ${SEQAN3_DEPENDENCY_INCLUDE_DIRS} # ---------------------------------------------------------------------------- if (SEQAN3_FOUND AND NOT TARGET seqan3::seqan3) - separate_arguments (SEQAN3_CXX_FLAGS_LIST UNIX_COMMAND "${SEQAN3_CXX_FLAGS}") - add_library (seqan3_seqan3 INTERFACE) target_compile_definitions (seqan3_seqan3 INTERFACE ${SEQAN3_DEFINITIONS}) - target_compile_options (seqan3_seqan3 INTERFACE ${SEQAN3_CXX_FLAGS_LIST}) + target_compile_features (seqan3_seqan3 INTERFACE cxx_std_23) target_link_libraries (seqan3_seqan3 INTERFACE "${SEQAN3_LIBRARIES}") # include seqan3/include/ as -I, because seqan3 should never produce warnings. target_include_directories (seqan3_seqan3 INTERFACE "${SEQAN3_INCLUDE_DIR}") @@ -467,7 +428,6 @@ if (SEQAN3_FIND_DEBUG) message (" SEQAN3_INCLUDE_DIRS ${SEQAN3_INCLUDE_DIRS}") message (" SEQAN3_LIBRARIES ${SEQAN3_LIBRARIES}") message (" SEQAN3_DEFINITIONS ${SEQAN3_DEFINITIONS}") - message (" SEQAN3_CXX_FLAGS ${SEQAN3_CXX_FLAGS}") message ("") message (" SEQAN3_VERSION ${SEQAN3_VERSION}") message (" SEQAN3_VERSION_MAJOR ${SEQAN3_VERSION_MAJOR}") diff --git a/include/seqan3/argument_parser/validators.hpp b/include/seqan3/argument_parser/validators.hpp index 0194936771..9c953bcd10 100644 --- a/include/seqan3/argument_parser/validators.hpp +++ b/include/seqan3/argument_parser/validators.hpp @@ -11,6 +11,7 @@ #include #include +#include #include #include #include diff --git a/include/seqan3/core/platform.hpp b/include/seqan3/core/platform.hpp index ee1de243e0..9970bebc61 100644 --- a/include/seqan3/core/platform.hpp +++ b/include/seqan3/core/platform.hpp @@ -40,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 SEQAN3_COMPILER_IS_GCC 1 #else # define SEQAN3_COMPILER_IS_GCC 0 @@ -52,51 +52,34 @@ #endif // SEQAN3_DOXYGEN_ONLY(1)0 // ============================================================================ -// Compiler support GCC +// Compiler support // ============================================================================ -#if SEQAN3_COMPILER_IS_GCC -# if (__GNUC__ < 11) -# error \ - "SeqAn 3.1.x is the last version that supports GCC 7, 8, and 9. SeqAn 3.2.x is the latest version that support GCC 10. Please upgrade your compiler or use 3.1.x./3.2.x." -# endif // (__GNUC__ < 11) - -# if (__GNUC__ == 11 && __GNUC_MINOR__ <= 3) -# pragma GCC warning "Be aware that GCC < 11.4 might have bugs that cause SeqAn3 fail to compile." -# endif // (__GNUC__ == 11 && __GNUC_MINOR__ <= 2) - -# if (__GNUC__ == 12 && __GNUC_MINOR__ <= 2) -# pragma GCC warning "Be aware that GCC < 12.3 might have bugs that cause SeqAn3 fail to compile." -# endif // (__GNUC__ == 12 && __GNUC_MINOR__ <= 1) +#if SEQAN3_COMPILER_IS_GCC && (__GNUC__ < 12) +# error "At least GCC 12 is needed." +#endif -# if SEQAN3_DOXYGEN_ONLY(1) 0 -//!\brief This disables the warning you would get if your compiler is newer than the latest supported version. -# define SEQAN3_DISABLE_NEWER_COMPILER_DIAGNOSTIC -# endif // SEQAN3_DOXYGEN_ONLY(1)0 +// clang-format off +#if defined(__INTEL_LLVM_COMPILER) && (__INTEL_LLVM_COMPILER < 20240000) +# error "At least Intel OneAPI 2024 is needed." +#endif +// clang-format on -# ifndef SEQAN3_DISABLE_NEWER_COMPILER_DIAGNOSTIC -# if (__GNUC__ > 14) -# pragma message \ - "Your compiler is newer than the latest supported compiler of this SeqAn version (gcc-13). It might be that SeqAn does not compile due to this. You can disable this warning by setting -DSEQAN3_DISABLE_NEWER_COMPILER_DIAGNOSTIC." -# endif // (__GNUC__ > 13) -# endif // SEQAN3_DISABLE_NEWER_COMPILER_DIAGNOSTIC +#if defined(__clang__) && defined(__clang_major__) && (__clang_major__ < 17) +# error "At least Clang 17 is needed." +#endif // ============================================================================ -// Compiler support Clang +// Standard library support // ============================================================================ -#elif defined(__clang__) -# if __clang_major__ < 17 -# error "Only Clang >= 17 is supported." -# endif - -// ============================================================================ -// Compiler support other -// ============================================================================ +#if defined(_LIBCPP_VERSION) && (_LIBCPP_VERSION < 170000) +# error "At least libc++ 17 is required." +#endif -#elif !defined(SEQAN3_DISABLE_COMPILER_CHECK) -# error "Your compiler is not supported. You can disable this error by setting -DSEQAN3_DISABLE_COMPILER_CHECK." -#endif // SEQAN3_COMPILER_IS_GCC +#if defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 12) +# error "At least libstdc++ 12 is needed." +#endif // ============================================================================ // C++ standard and features @@ -104,8 +87,8 @@ // C++ standard [required] #ifdef __cplusplus -# if (__cplusplus < 202002L) -# error "SeqAn3 requires C++20, make sure that you have set -std=c++20." +# if (__cplusplus < 202100) +# error "SeqAn3 requires C++23, make sure that you have set -std=c++23." # endif #else # error "This is not a C++ compiler." diff --git a/include/seqan3/io/stream/detail/fast_ostreambuf_iterator.hpp b/include/seqan3/io/stream/detail/fast_ostreambuf_iterator.hpp index 344a4bdc41..484fb1be92 100644 --- a/include/seqan3/io/stream/detail/fast_ostreambuf_iterator.hpp +++ b/include/seqan3/io/stream/detail/fast_ostreambuf_iterator.hpp @@ -11,6 +11,7 @@ #pragma once #include +#include #include #include #include diff --git a/test/external_project/seqan3_setup_tutorial_with_sharg/CMakeLists.txt b/test/external_project/seqan3_setup_tutorial_with_sharg/CMakeLists.txt index 1742748dfb..3cc6372a34 100644 --- a/test/external_project/seqan3_setup_tutorial_with_sharg/CMakeLists.txt +++ b/test/external_project/seqan3_setup_tutorial_with_sharg/CMakeLists.txt @@ -19,6 +19,8 @@ list (APPEND CMAKE_PREFIX_PATH "${SHARG_ROOT}/build_system") cmake_minimum_required (VERSION 3.20...3.31) project (seqan3_tutorial CXX) +set (CMAKE_CXX_STANDARD 23) + # add seqan3 to search path list (APPEND CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../seqan3/cmake") # add the Sharg Parser to search path diff --git a/test/external_project/seqan3_setup_tutorial_with_sharg_installed/CMakeLists.txt b/test/external_project/seqan3_setup_tutorial_with_sharg_installed/CMakeLists.txt index 53d03e905d..08ebe56feb 100644 --- a/test/external_project/seqan3_setup_tutorial_with_sharg_installed/CMakeLists.txt +++ b/test/external_project/seqan3_setup_tutorial_with_sharg_installed/CMakeLists.txt @@ -9,6 +9,8 @@ project (seqan3_app CXX) include (../find-package-diagnostics.cmake) # --- +set (CMAKE_CXX_STANDARD 23) + # require seqan3 with a version between >=3.0.0 and <4.0.0 find_package (seqan3 3.0 REQUIRED) find_package (sharg 1.0 REQUIRED) diff --git a/test/seqan3-test.cmake b/test/seqan3-test.cmake index 02b28cbcbe..28a7c80c85 100644 --- a/test/seqan3-test.cmake +++ b/test/seqan3-test.cmake @@ -6,6 +6,18 @@ # SeqAn3. To build tests, run cmake on one of the sub-folders in this directory # which contain a CMakeLists.txt. +if (NOT DEFINED CMAKE_CXX_STANDARD) + set (CMAKE_CXX_STANDARD 23) +endif () + +if (NOT DEFINED CMAKE_CXX_STANDARD_REQUIRED) + set (CMAKE_CXX_STANDARD_REQUIRED ON) +endif () + +if (NOT DEFINED CMAKE_CXX_EXTENSIONS) + set (CMAKE_CXX_EXTENSIONS OFF) +endif () + # require SeqAn3 package find_package (SeqAn3 REQUIRED HINTS ${CMAKE_CURRENT_LIST_DIR}/../cmake)