From ef1c684bafcd13fe9859df8fe6e844676703079f Mon Sep 17 00:00:00 2001 From: Enrico Seiler Date: Thu, 16 Nov 2023 14:36:15 +0100 Subject: [PATCH] [INFRA] Update clang CI --- .github/workflows/ci_linux.yml | 6 ++---- .github/workflows/ci_macos.yml | 5 +++++ .github/workflows/ci_misc.yml | 22 ++++++++++++++++++++++ cmake/configuration.cmake | 17 +++++++++++------ test/header/CMakeLists.txt | 5 ++++- test/hibf-test.cmake | 1 + test/unit/hibf/sketch/toolbox_test.cpp | 4 ++++ test/unit/test/expect_same_type_test.cpp | 8 ++++++++ 8 files changed, 57 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci_linux.yml b/.github/workflows/ci_linux.yml index a9a8d40c..ded56f15 100644 --- a/.github/workflows/ci_linux.yml +++ b/.github/workflows/ci_linux.yml @@ -38,6 +38,7 @@ jobs: compiler: "clang-17" build: unit build_type: Release + cxx_flags: "-stdlib=libc++" - name: "gcc13" compiler: "gcc-13" @@ -73,11 +74,8 @@ jobs: compiler: ${{ matrix.compiler }} ccache_size: 75M - - name: Install OpenMP - if: contains(matrix.name, 'clang') - run: install libomp-17-dev - - name: Install CMake + if: contains(matrix.compiler, 'intel') == false uses: seqan/actions/setup-cmake@main with: cmake: 3.18.6 diff --git a/.github/workflows/ci_macos.yml b/.github/workflows/ci_macos.yml index 8b7850a2..99322ce9 100644 --- a/.github/workflows/ci_macos.yml +++ b/.github/workflows/ci_macos.yml @@ -34,6 +34,11 @@ jobs: fail-fast: true matrix: include: + - name: "clang17" + compiler: "clang-17" + build: unit + build_type: Release + - name: "gcc13" compiler: "gcc-13" build: unit diff --git a/.github/workflows/ci_misc.yml b/.github/workflows/ci_misc.yml index d4c7a522..534eb36d 100644 --- a/.github/workflows/ci_misc.yml +++ b/.github/workflows/ci_misc.yml @@ -34,18 +34,39 @@ jobs: fail-fast: false matrix: include: + - name: "Snippet clang17" + compiler: "clang-17" + build: snippet + build_type: Release + use_include_dependencies: "OFF" + cxx_flags: "-stdlib=libc++" + - name: "Snippet gcc11" compiler: "gcc-11" build: snippet build_type: Release use_include_dependencies: "OFF" + - name: "Performance clang17" + compiler: "clang-17" + build: performance + build_type: Release + use_include_dependencies: "OFF" + cxx_flags: "-stdlib=libc++" + - name: "Performance gcc11" compiler: "gcc-11" build: performance build_type: Release use_include_dependencies: "OFF" + - name: "Header clang17" + compiler: "clang-17" + build: header + build_type: Release + use_include_dependencies: "OFF" + cxx_flags: "-stdlib=libc++" + - name: "Header gcc13" compiler: "gcc-13" build: header @@ -87,6 +108,7 @@ jobs: mkdir build cd build cmake ../test/${{ matrix.build }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ + -DCMAKE_CXX_FLAGS="${{ matrix.cxx_flags }}" \ -DHIBF_NATIVE_BUILD=OFF \ -DHIBF_VERBOSE_TESTS=OFF \ -DHIBF_USE_INCLUDE_DEPENDENCIES="${{ matrix.use_include_dependencies }}" diff --git a/cmake/configuration.cmake b/cmake/configuration.cmake index 8da9a5b2..44c051e0 100644 --- a/cmake/configuration.cmake +++ b/cmake/configuration.cmake @@ -140,19 +140,24 @@ endif () # Required: OpenMP # ---------------------------------------------------------------------------- -check_cxx_compiler_flag ("-fopenmp" HIBF_HAS_OPENMP) +set (HIBF_OPENMP_FLAG_PREFIX "-fopenmp") +if (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM") + set (HIBF_OPENMP_FLAG_PREFIX "-qopenmp") +endif () + +check_cxx_compiler_flag ("${HIBF_OPENMP_FLAG_PREFIX}" HIBF_HAS_OPENMP) if (HIBF_HAS_OPENMP) - set (HIBF_CXX_FLAGS "${HIBF_CXX_FLAGS} -fopenmp") - hibf_config_print ("OpenMP support: via -fopenmp") + set (HIBF_CXX_FLAGS "${HIBF_CXX_FLAGS} ${HIBF_OPENMP_FLAG_PREFIX}") + hibf_config_print ("OpenMP support: via ${HIBF_OPENMP_FLAG_PREFIX}") else () hibf_config_error ("HIBF requires OpenMP, but your compiler does not support it.") endif () -check_cxx_compiler_flag ("-fopenmp-simd" HIBF_HAS_OPENMP_SIMD) +check_cxx_compiler_flag ("${HIBF_OPENMP_FLAG_PREFIX}-simd" HIBF_HAS_OPENMP_SIMD) if (HIBF_HAS_OPENMP_SIMD) - set (HIBF_CXX_FLAGS "${HIBF_CXX_FLAGS} -fopenmp-simd") + set (HIBF_CXX_FLAGS "${HIBF_CXX_FLAGS} ${HIBF_OPENMP_FLAG_PREFIX}-simd") set (HIBF_DEFINITIONS ${HIBF_DEFINITIONS} "-DSIMDE_ENABLE_OPENMP") - hibf_config_print ("SIMD-OpenMP support: via -fopenmp-simd") + hibf_config_print ("SIMD-OpenMP support: via ${HIBF_OPENMP_FLAG_PREFIX}-simd") else () hibf_config_print ("SIMD-OpenMP support: not found") endif () diff --git a/test/header/CMakeLists.txt b/test/header/CMakeLists.txt index 8275cc26..55ea21cb 100644 --- a/test/header/CMakeLists.txt +++ b/test/header/CMakeLists.txt @@ -107,7 +107,10 @@ macro (hibf_header_test component header_base_path exclude_regex) "${CMAKE_CURRENT_SOURCE_DIR}/generate_header_source.cmake") add_library (${header_target} OBJECT "${header_target_source}") - target_link_libraries (${header_target} hibf::test::header) + # Link hibf::test first, even though it is also linked by hibf::test:header. + # Without this, the compile options of hibf::test are appended, e.g., + # `-Wno-error=... -Werror -Wall`, instead of `-Werror -Wall -Wno-error=...` + target_link_libraries (${header_target} hibf::test hibf::test::header) target_sources (${target} PRIVATE $) endforeach () endforeach () diff --git a/test/hibf-test.cmake b/test/hibf-test.cmake index 537fa351..58447136 100644 --- a/test/hibf-test.cmake +++ b/test/hibf-test.cmake @@ -91,6 +91,7 @@ if (NOT TARGET hibf::test::header) add_library (hibf_test_header INTERFACE) target_link_libraries (hibf_test_header INTERFACE "hibf::test::unit") target_link_libraries (hibf_test_header INTERFACE "hibf::test::performance") + target_compile_options (hibf_test_header INTERFACE "-Wno-unused-function") target_compile_definitions (hibf_test_header INTERFACE -DHIBF_DISABLE_DEPRECATED_WARNINGS) target_compile_definitions (hibf_test_header INTERFACE -DHIBF_HEADER_TEST) add_library (hibf::test::header ALIAS hibf_test_header) diff --git a/test/unit/hibf/sketch/toolbox_test.cpp b/test/unit/hibf/sketch/toolbox_test.cpp index c0bdf4ca..5505f6e8 100644 --- a/test/unit/hibf/sketch/toolbox_test.cpp +++ b/test/unit/hibf/sketch/toolbox_test.cpp @@ -95,7 +95,11 @@ TEST_F(toolbox_test, random_shuffle) seqan::hibf::sketch::toolbox::random_shuffle(dist, ids); // since randomness is seeded, the output is deterministic +#ifdef _LIBCPP_VERSION + auto [new_pos_0, new_pos_1, new_pos_2, new_pos_3, new_pos_4] = std::make_tuple(0u, 4u, 2u, 1u, 3u); +#else auto [new_pos_0, new_pos_1, new_pos_2, new_pos_3, new_pos_4] = std::make_tuple(3u, 2u, 1u, 0u, 4u); +#endif EXPECT_EQ(ids[0], new_pos_0); EXPECT_EQ(ids[1], new_pos_1); diff --git a/test/unit/test/expect_same_type_test.cpp b/test/unit/test/expect_same_type_test.cpp index 8021d743..8497d276 100644 --- a/test/unit/test/expect_same_type_test.cpp +++ b/test/unit/test/expect_same_type_test.cpp @@ -162,11 +162,19 @@ TEST(tuple, same_type_pass) TEST(tuple, same_type_fail) { +#ifdef _LIBCPP_VERSION + char const * error_message = "Expected equality of these values:\n" + " decltype(std::tuple{0, .0f, .0, 0u})\n" + " Which is: \"std::__1::tuple\"\n" + " std::tuple\n" + " Which is: \"std::__1::tuple\""; +#else char const * error_message = "Expected equality of these values:\n" " decltype(std::tuple{0, .0f, .0, 0u})\n" " Which is: \"std::tuple\"\n" " std::tuple\n" " Which is: \"std::tuple\""; +#endif auto && expect_result = seqan::hibf::test::expect_same_type{}("std::type_identity< decltype(std::tuple{0, .0f, .0, 0u})>{}",