diff --git a/.github/workflows/VectorisationTests.yml b/.github/workflows/VectorisationTests.yml index 293481a..a87ac38 100644 --- a/.github/workflows/VectorisationTests.yml +++ b/.github/workflows/VectorisationTests.yml @@ -23,7 +23,7 @@ jobs: run: cmake -B build -DCMAKE_BUILD_TYPE=Release - name: Build - run: cmake --build build --config Release + run: cmake -DENABLE_TESTS=ON --build build --config Release - name: Run Catch2 Tests and Save Output run: | diff --git a/CMakeLists.txt b/CMakeLists.txt index 882dcab..19ab633 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,19 +1,31 @@ cmake_minimum_required (VERSION 3.25) + project (WRAPPER DESCRIPTION "Vectorisation Wrapper with Unit tested" LANGUAGES CXX) +option(ENABLE_TESTS "Build unit tests" OFF) + set (CMAKE_CXX_STANDARD 23) -add_subdirectory (Catch2) if (APPLE) - set (ACCELERATE_SOURCES VectorisationWrappers/Accelerate/AccelerateWrapper.cpp - VectorisationWrappers/Accelerate/Tests/AccelerateArithmeticUnitTests.cpp - VectorisationWrappers/Accelerate/Tests/AccelerateUtilitiesUnitTests.cpp - VectorisationWrappers/Accelerate/Tests/AccelerateRangeUnitTests.cpp - VectorisationWrappers/Accelerate/Tests/AccelerateTrigonometryUnitTests.cpp) + add_library (VECTORISATION_WRAPPER STATIC VectorisationWrappers/Accelerate/AccelerateWrapper.cpp) + target_include_directories (VECTORISATION_WRAPPER PUBLIC ${PROJECT_SOURCE_DIR}/VectorisationWrappers/Accelerate/) + + if (ENABLE_TESTS) + # Todo: fetch catch for tests + + add_subdirectory (Catch2) + set (ACCELERATE_SOURCES + VectorisationWrappers/Accelerate/AccelerateWrapper.cpp + VectorisationWrappers/Accelerate/Tests/AccelerateArithmeticUnitTests.cpp + VectorisationWrappers/Accelerate/Tests/AccelerateUtilitiesUnitTests.cpp + VectorisationWrappers/Accelerate/Tests/AccelerateRangeUnitTests.cpp + VectorisationWrappers/Accelerate/Tests/AccelerateTrigonometryUnitTests.cpp) + + add_executable(accelerate_DSP ${ACCELERATE_SOURCES}) - add_executable(accelerate_DSP ${ACCELERATE_SOURCES}) + target_link_libraries (accelerate_DSP PRIVATE Catch2::Catch2WithMain "$") + endif () - target_link_libraries (accelerate_DSP PRIVATE Catch2::Catch2WithMain "$") elseif (MSVC) message ("No Wrapper") endif() \ No newline at end of file