Skip to content

Commit

Permalink
Merge pull request #169 from eseiler/infra/clang
Browse files Browse the repository at this point in the history
[INFRA] Update clang CI
  • Loading branch information
eseiler authored Nov 16, 2023
2 parents f1b03ab + ef1c684 commit af4cbf5
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 11 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/ci_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
compiler: "clang-17"
build: unit
build_type: Release
cxx_flags: "-stdlib=libc++"

- name: "gcc13"
compiler: "gcc-13"
Expand Down Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/ci_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/ci_misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }}"
Expand Down
17 changes: 11 additions & 6 deletions cmake/configuration.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
Expand Down
5 changes: 4 additions & 1 deletion test/header/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<TARGET_OBJECTS:${header_target}>)
endforeach ()
endforeach ()
Expand Down
1 change: 1 addition & 0 deletions test/hibf-test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions test/unit/hibf/sketch/toolbox_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 8 additions & 0 deletions test/unit/test/expect_same_type_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int, float, double, unsigned int>\"\n"
" std::tuple<int, float, unsigned, double>\n"
" Which is: \"std::__1::tuple<int, float, unsigned int, double>\"";
#else
char const * error_message = "Expected equality of these values:\n"
" decltype(std::tuple{0, .0f, .0, 0u})\n"
" Which is: \"std::tuple<int, float, double, unsigned int>\"\n"
" std::tuple<int, float, unsigned, double>\n"
" Which is: \"std::tuple<int, float, unsigned int, double>\"";
#endif

auto && expect_result =
seqan::hibf::test::expect_same_type{}("std::type_identity< decltype(std::tuple{0, .0f, .0, 0u})>{}",
Expand Down

1 comment on commit af4cbf5

@vercel
Copy link

@vercel vercel bot commented on af4cbf5 Nov 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

hibf – ./

hibf-git-main-seqan.vercel.app
hibf.vercel.app
hibf-seqan.vercel.app

Please sign in to comment.