Skip to content

Commit 8179133

Browse files
authored
Merge pull request #307 from eseiler/infra/compile_options
[INFRA] Compile options and packages
2 parents 047f812 + d992bc8 commit 8179133

File tree

7 files changed

+35
-40
lines changed

7 files changed

+35
-40
lines changed

.github/workflows/ci_coverage.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ jobs:
4646
- name: Configure tests
4747
run: |
4848
mkdir build && cd build
49-
cmake .. -DCMAKE_BUILD_TYPE=Coverage \
50-
-DCMAKE_CXX_FLAGS="-Werror -Wno-interference-size"
49+
cmake .. -DCMAKE_BUILD_TYPE=Coverage
5150
make gtest_main
5251
5352
- name: Build tests

.github/workflows/ci_header.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ jobs:
3030
fail-fast: false
3131
matrix:
3232
compiler: ["clang-latest", "gcc-latest", "gcc-third-latest", "intel"]
33-
include:
34-
- cxx_flags: "-Wno-interference-size"
35-
- compiler: "clang-latest"
36-
cxx_flags: ""
37-
- compiler: "intel"
38-
cxx_flags: ""
3933
container:
4034
image: ghcr.io/seqan/${{ matrix.compiler }}
4135
volumes:
@@ -51,7 +45,6 @@ jobs:
5145
run: |
5246
mkdir build && cd build
5347
cmake .. -DCMAKE_BUILD_TYPE=Release \
54-
-DCMAKE_CXX_FLAGS="-Werror ${{ matrix.cxx_flags }}" \
5548
-DCHOPPER_HEADER_TEST_ONLY=ON
5649
5750
- name: Build tests

.github/workflows/ci_linux.yml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,6 @@ jobs:
3030
fail-fast: false
3131
matrix:
3232
compiler: ["clang-latest", "clang-second-latest", "clang-third-latest", "gcc-latest", "gcc-second-latest", "gcc-third-latest", "intel"]
33-
include:
34-
- cxx_flags: "-Wno-interference-size"
35-
- compiler: "clang-latest"
36-
cxx_flags: ""
37-
- compiler: "clang-second-latest"
38-
cxx_flags: ""
39-
- compiler: "clang-third-latest"
40-
cxx_flags: ""
41-
- compiler: "intel"
42-
cxx_flags: ""
4333
container:
4434
image: ghcr.io/seqan/${{ matrix.compiler }}
4535
volumes:
@@ -54,8 +44,7 @@ jobs:
5444
- name: Configure tests
5545
run: |
5646
mkdir build && cd build
57-
cmake .. -DCMAKE_BUILD_TYPE=Release \
58-
-DCMAKE_CXX_FLAGS="-Werror ${{ matrix.cxx_flags }}"
47+
cmake .. -DCMAKE_BUILD_TYPE=Release
5948
make gtest_main
6049
6150
- name: Build tests

.github/workflows/ci_macos.yml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,6 @@ jobs:
3030
fail-fast: false
3131
matrix:
3232
compiler: ["clang-latest", "clang-second-latest", "clang-third-latest", "gcc-latest", "gcc-second-latest", "gcc-third-latest"]
33-
include:
34-
- cxx_flags: "-Wno-interference-size"
35-
- compiler: "clang-latest"
36-
cxx_flags: ""
37-
- compiler: "clang-second-latest"
38-
cxx_flags: ""
39-
- compiler: "clang-third-latest"
40-
cxx_flags: ""
4133
steps:
4234
- name: Checkout
4335
uses: actions/checkout@v5
@@ -52,8 +44,7 @@ jobs:
5244
run: |
5345
mkdir build
5446
cd build
55-
cmake .. -DCMAKE_BUILD_TYPE=Release \
56-
-DCMAKE_CXX_FLAGS="-Werror ${{ matrix.cxx_flags }}"
47+
cmake .. -DCMAKE_BUILD_TYPE=Release
5748
make gtest_main
5849
5950
- name: Build tests

.github/workflows/cron_sanitizer.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
include:
3838
- name: "ASan"
3939
os: ubuntu-latest
40-
cxx_flags: "-fno-omit-frame-pointer -fsanitize=address -Wno-maybe-uninitialized -Wno-interference-size"
40+
cxx_flags: "-fno-omit-frame-pointer -fsanitize=address -Wno-maybe-uninitialized"
4141

4242
- name: "ASan"
4343
os: macos-latest
@@ -48,7 +48,7 @@ jobs:
4848

4949
- name: "UBSan"
5050
os: ubuntu-latest
51-
cxx_flags: "-fno-omit-frame-pointer -fsanitize=undefined,float-divide-by-zero -Wno-stringop-overflow -Wno-interference-size"
51+
cxx_flags: "-fno-omit-frame-pointer -fsanitize=undefined,float-divide-by-zero -Wno-stringop-overflow"
5252

5353
- name: "UBSan"
5454
os: macos-latest
@@ -83,7 +83,7 @@ jobs:
8383
run: |
8484
mkdir build && cd build
8585
cmake .. -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
86-
-DCMAKE_CXX_FLAGS="-Werror ${{ matrix.cxx_flags }}"
86+
-DCMAKE_CXX_FLAGS="${{ matrix.cxx_flags }}"
8787
make gtest_main
8888
8989
- name: Build tests

cmake/package-lock.cmake

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
# CPM Package Lock
66
# This file should be committed to version control
77

8+
# cmake-format: off
9+
810
# hibf
9-
set (CHOPPER_HIBF_VERSION 99edc05f9c88892c0019c6ef68affbac623f57d2)
11+
set (CHOPPER_HIBF_VERSION 99edc05f9c88892c0019c6ef68affbac623f57d2 CACHE STRING "")
1012
CPMDeclarePackage (hibf
1113
NAME hibf
1214
GIT_TAG ${CHOPPER_HIBF_VERSION} # main
@@ -16,7 +18,7 @@ CPMDeclarePackage (hibf
1618
OPTIONS "INSTALL_HIBF OFF"
1719
)
1820
# sharg
19-
set (CHOPPER_SHARG_VERSION f9c5c7baf1c60bd556a5726ae4a737ed1536fabf)
21+
set (CHOPPER_SHARG_VERSION f9c5c7baf1c60bd556a5726ae4a737ed1536fabf CACHE STRING "")
2022
CPMDeclarePackage (sharg
2123
NAME sharg
2224
GIT_TAG ${CHOPPER_SHARG_VERSION} # main
@@ -26,17 +28,18 @@ CPMDeclarePackage (sharg
2628
OPTIONS "INSTALL_SHARG OFF" "INSTALL_TDL OFF" "CMAKE_MESSAGE_LOG_LEVEL WARNING" "BUILD_TESTING OFF"
2729
)
2830
# seqan3
29-
set (CHOPPER_SEQAN3_VERSION 8724133817fc7889b280253c209aa47f6395a13c)
31+
set (CHOPPER_SEQAN3_VERSION 3.4.0 CACHE STRING "")
3032
CPMDeclarePackage (seqan3
3133
NAME seqan3
32-
GIT_TAG ${CHOPPER_SEQAN3_VERSION} # main
34+
VERSION ${CHOPPER_SEQAN3_VERSION}
35+
GIT_TAG ${CHOPPER_SEQAN3_VERSION}
3336
GITHUB_REPOSITORY seqan/seqan3
3437
SYSTEM TRUE
3538
EXCLUDE_FROM_ALL TRUE
3639
OPTIONS "INSTALL_SEQAN3 OFF" "CMAKE_MESSAGE_LOG_LEVEL WARNING"
3740
)
3841
# googletest
39-
set (CHOPPER_GOOGLETEST_VERSION 1.17.0)
42+
set (CHOPPER_GOOGLETEST_VERSION 1.17.0 CACHE STRING "")
4043
CPMDeclarePackage (googletest
4144
NAME GTest
4245
VERSION ${CHOPPER_GOOGLETEST_VERSION}
@@ -47,7 +50,7 @@ CPMDeclarePackage (googletest
4750
"CMAKE_CXX_STANDARD 20"
4851
)
4952
# use_ccache
50-
set (USE_CCACHE_VERSION d2a54ef555b6fc2d496a4c9506dbeb7cf899ce37)
53+
set (USE_CCACHE_VERSION d2a54ef555b6fc2d496a4c9506dbeb7cf899ce37 CACHE STRING "")
5154
CPMDeclarePackage (use_ccache
5255
NAME use_ccache
5356
GIT_TAG ${USE_CCACHE_VERSION} # main
@@ -56,3 +59,5 @@ CPMDeclarePackage (use_ccache
5659
SYSTEM TRUE
5760
EXCLUDE_FROM_ALL TRUE
5861
)
62+
63+
# cmake-format: on

src/CMakeLists.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,24 @@ target_include_directories (chopper_interface INTERFACE "${PROJECT_SOURCE_DIR}/i
1717
target_compile_options (chopper_interface INTERFACE "-pedantic" "-Wall" "-Wextra")
1818
add_library (chopper::interface ALIAS chopper_interface)
1919

20+
option (CHOPPER_WITH_WERROR "Report compiler warnings as errors." ON)
21+
if (CHOPPER_WITH_WERROR)
22+
target_compile_options (chopper_interface INTERFACE "-Werror")
23+
message (STATUS "Building tests with -Werror.")
24+
endif ()
25+
26+
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
27+
# Disable warning about std::hardware_destructive_interference_size not being ABI-stable.
28+
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12)
29+
target_compile_options (chopper_interface INTERFACE "-Wno-interference-size")
30+
endif ()
31+
32+
# Warn about failed return value optimization.
33+
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 14)
34+
target_compile_options (chopper_interface INTERFACE "-Wnrvo")
35+
endif ()
36+
endif ()
37+
2038
add_library (chopper_shared STATIC configuration.cpp input_functor.cpp)
2139
target_link_libraries (chopper_shared PUBLIC chopper_interface)
2240
add_library (chopper::shared ALIAS chopper_shared)

0 commit comments

Comments
 (0)