diff options
author | bd <bdunahu@operationnull.com> | 2025-02-24 20:48:58 -0500 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-02-24 20:48:58 -0500 |
commit | 428cdf3d8be3d46ca071967596083da98840fbbd (patch) | |
tree | 802210ed60b768892bce8172ac2d5a686149b868 /CMakeLists.txt | |
parent | 9028b78a0d668a8893d4e5ce65fa1d332be35cfa (diff) |
Add catch2 testing framework and integrate with CMake
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 505517f..03f0ca3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,13 +1,36 @@ -cmake_minimum_required(VERSION 3.11) +cmake_minimum_required(VERSION 3.5) project(risc_vector) +# cpp standard set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + set(CMAKE_CXX_COMPILER "g++") -set(SRCDIR src) -set(PYTHON_VERSION 3.10) +# header files +include_directories( + ${PROJECT_SOURCE_DIR}/inc +) + +# gather source files +file(GLOB_RECURSE SRCS "src/*.cc") +list(REMOVE_ITEM SRCS "${CMAKE_CURRENT_SOURCE_DIR}/src/rv.cc") + +# find python3 components find_package(Python3 COMPONENTS Development REQUIRED) -add_executable(${PROJECT_NAME} ${SRCDIR}/rv.cc) +# binary executable +add_executable(${PROJECT_NAME} ${SRCS} src/rv.cc) +target_link_libraries(${PROJECT_NAME} PRIVATE Python3::Python) + +find_package(Catch2 REQUIRED) +set(TESTDIR tests) + +# test executable +add_executable(tests ${SRCS} ${TESTDIR}/tests.cc) +target_link_libraries(tests PRIVATE Catch2::Catch2 PRIVATE Python3::Python) -target_link_libraries(${PROJECT_NAME} Python3::Python) +# test discovery +include(CTest) +include(Catch) +catch_discover_tests(tests) |