diff --git a/.github/workflows/run-tests.yaml b/.github/workflows/run-tests.yaml index b3123c06..b813133f 100644 --- a/.github/workflows/run-tests.yaml +++ b/.github/workflows/run-tests.yaml @@ -15,13 +15,24 @@ jobs: matrix: config: - { - name: "Ubuntu Latest GCC, coverage enabled", + name: "Ubuntu Latest GCC (debug, coverage enabled)", os: ubuntu-latest, - cov: true + type: coverage } - { - name: "macOS Latest Clang", - os: macos-latest + name: "Ubuntu Latest GCC (all optimizations)", + os: ubuntu-latest, + type: optimized + } + - { + name: "macOS Latest Clang (debug)", + os: macos-latest, + type: debug + } + - { + name: "macOS Latest Clang (all optimizations)", + os: macos-latest, + type: optimized } steps: @@ -30,16 +41,20 @@ jobs: - name: Get latest CMake uses: lukka/get-cmake@latest - - name: Configure the build for Mac - if: ${{ matrix.config.os == 'macos-latest' }} + - name: Configure the build (debug) + if: ${{ matrix.config.type == 'debug' }} run: cmake -S . -B build - - name: Configure the build with coverage - if: ${{ matrix.config.os == 'ubuntu-latest' && matrix.config.cov }} - run: cmake -S . -B build -DCODE_COVERAGE=ON + - name: Configure the build (coverage) + if: ${{ matrix.config.type == 'coverage' }} + run: cmake -S . -B build -DCODE_COVERAGE=ON + + - name: Configure the build (optimized) + if: ${{ matrix.config.type == 'optimized' }} + run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DUSE_MARCH_NATIVE=ON - name: Run the build - run: cmake --build build + run: cmake --build build -j 2 - name: Run the tests run: | diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index ebe11561..992635e3 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -22,6 +22,9 @@ if(CODE_COVERAGE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") set(DO_CODE_COVERAGE ON) endif() +# Test for correct handling of vectorization. +option(USE_MARCH_NATIVE "Build for native architecture." OFF) + macro(decorate_executable target) target_link_libraries( ${target} @@ -38,6 +41,10 @@ macro(decorate_executable target) target_link_options(${target} PRIVATE --coverage) endif() + if(USE_MARCH_NATIVE) + target_compile_options(${target} PRIVATE -march=native) + endif() + gtest_discover_tests(${target}) endmacro()