Skip to content

Commit

Permalink
[INFRA] Use cpp23
Browse files Browse the repository at this point in the history
  • Loading branch information
eseiler committed Dec 4, 2024
1 parent 8759edd commit 01853bd
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 61 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
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 @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cron_api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cron_avx2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cron_latest_libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 1 addition & 2 deletions cmake/package-lock.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
60 changes: 9 additions & 51 deletions cmake/seqan3-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,15 @@
# 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:
#
# seqan3::seqan3 -- interface target where
# 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
Expand Down Expand Up @@ -203,53 +201,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)
# ----------------------------------------------------------------------------
Expand Down Expand Up @@ -394,10 +353,12 @@ file (WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx" "${CX
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)

if (SEQAN3_PLATFORM_TEST)
Expand Down Expand Up @@ -438,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}")
Expand All @@ -469,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}")
Expand Down
1 change: 1 addition & 0 deletions include/seqan3/argument_parser/validators.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include <algorithm>
#include <concepts>
#include <exception>
#include <filesystem>
#include <fstream>
#include <ranges>
Expand Down
4 changes: 2 additions & 2 deletions include/seqan3/core/platform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,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."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#pragma once

#include <algorithm>
#include <array>
#include <cassert>
#include <iterator>
#include <ranges>
Expand Down
12 changes: 12 additions & 0 deletions test/seqan3-test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@

cmake_minimum_required (VERSION 3.10...3.30)

if (NOT DEFINED CMAKE_CXX_STANDARD)
set (CMAKE_CXX_STANDARD 23)
endif ()

if (NOT DEFINED CMAKE_CXX_STANDARD_REQUIRED)
set (CMAKE_CXX_STANDARD_REQUIRED OFF)
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)

Expand Down

0 comments on commit 01853bd

Please sign in to comment.