Skip to content

Commit

Permalink
Put back c++ std setting for tests into cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
z4kn4fein committed Dec 13, 2023
1 parent b1020c4 commit c7374c4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
15 changes: 6 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@ jobs:
os: [ macos-latest ]
build: [ Debug, Release ]
compiler: [ clang++ ]
std_version: [ 17, 20 ]
name: ${{matrix.os}} ${{matrix.compiler}} ${{matrix.build}} std:${{matrix.std_version}}
name: ${{matrix.os}} ${{matrix.compiler}} ${{matrix.build}}
env:
CXX: ${{matrix.compiler}}
CTEST_OUTPUT_ON_FAILURE: 1
steps:
- uses: actions/checkout@v3
- name: cmake
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=${{matrix.build}} -DCMAKE_CXX_STANDARD=${{matrix.std_version}}
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=${{matrix.build}}
- name: build
run: cmake --build build --config ${{matrix.build}} --parallel 4
- name: test
Expand All @@ -31,15 +30,14 @@ jobs:
os: [ ubuntu-latest ]
build: [ Debug, Release ]
compiler: [ g++-11, g++-12, g++-13, clang++-15 ]
std_version: [ 17, 20 ]
name: ${{matrix.os}} ${{matrix.compiler}} ${{matrix.build}} std:${{matrix.std_version}}
name: ${{matrix.os}} ${{matrix.compiler}} ${{matrix.build}}
env:
CXX: ${{matrix.compiler}}
CTEST_OUTPUT_ON_FAILURE: 1
steps:
- uses: actions/checkout@v3
- name: cmake
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=${{matrix.build}} -DCMAKE_CXX_STANDARD=${{matrix.std_version}}
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=${{matrix.build}}
- name: build
run: cmake --build build --config ${{matrix.build}} --parallel 4
- name: test
Expand All @@ -53,14 +51,13 @@ jobs:
build: [ Debug, Release ]
os: [ windows-2019, windows-latest ]
arch: [ Win32, x64 ]
std_version: [ 17, 20 ]
name: ${{matrix.os}} ${{matrix.arch}} ${{matrix.build}} std:${{matrix.std_version}}
name: ${{matrix.os}} ${{matrix.arch}} ${{matrix.build}}
env:
CTEST_OUTPUT_ON_FAILURE: 1
steps:
- uses: actions/checkout@v3
- name: cmake
run: cmake -S . -B build -A ${{matrix.arch}} -DCMAKE_BUILD_TYPE=${{matrix.build}} -DCMAKE_CXX_STANDARD=${{matrix.std_version}}
run: cmake -S . -B build -A ${{matrix.arch}} -DCMAKE_BUILD_TYPE=${{matrix.build}}
- name: build
run: cmake --build build --config ${{matrix.build}} --parallel 4
- name: test
Expand Down
14 changes: 11 additions & 3 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ file(GLOB test-sources CONFIGURE_DEPENDS *.cpp)

include(Catch)

add_executable(${PROJECT_NAME}-tests "${test-sources}")
target_link_libraries(${PROJECT_NAME}-tests PRIVATE Catch2::Catch2WithMain ${PROJECT_NAME})
catch_discover_tests(${PROJECT_NAME}-tests)
# add c++17 tests
add_executable(${PROJECT_NAME}-tests-17 "${test-sources}")
set_target_properties(${PROJECT_NAME}-tests-17 PROPERTIES CXX_STANDARD 17)
target_link_libraries(${PROJECT_NAME}-tests-17 PRIVATE Catch2::Catch2WithMain ${PROJECT_NAME})
catch_discover_tests(${PROJECT_NAME}-tests-17)

# add c++20 tests
add_executable(${PROJECT_NAME}-tests-20 "${test-sources}")
set_target_properties(${PROJECT_NAME}-tests-20 PROPERTIES CXX_STANDARD 20)
target_link_libraries(${PROJECT_NAME}-tests-20 PRIVATE Catch2::Catch2WithMain ${PROJECT_NAME})
catch_discover_tests(${PROJECT_NAME}-tests-20)

0 comments on commit c7374c4

Please sign in to comment.