diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index 0d941b7a..28dc7285 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -249,12 +249,8 @@ jobs: - name: Install CMake (Ubuntu) if: matrix.os == 'ubuntu-latest' run: sudo apt-get install -y cmake - - name: Configure CMake - run: cmake . - - name: Build with CMake - run: make - - name: Run Tests (if any) - run: cat Makefile + - name: Run tests + run: make test build-python-wheels: needs: [run-python-tests, run-python-tests-with-address-sanitizer] diff --git a/.gitignore b/.gitignore index 329081d5..f5287bce 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ *.egg-info/ -build/ +*/build/* +!build/.gitkeep dist/ tmp/ __pycache__/ @@ -26,6 +27,7 @@ CMakeFiles CMakeScripts Testing Makefile +!cpp/Makefile cmake_install.cmake install_manifest.txt compile_commands.json diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c06e7e97..2ef187e9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -67,8 +67,7 @@ To build the C++ library with `cmake`, use the following commands: ```shell cd cpp git submodule update --init --recursive -cmake . -make +make build ``` ## Testing @@ -114,8 +113,6 @@ To run the C++ tests, use the following commands: ```shell cd cpp git submodule update --init --recursive -cmake . -make make test ``` diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 7a4607bf..4208d3eb 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -16,6 +16,8 @@ if (MSVC) string(REGEX REPLACE "/RTC1" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") endif() +enable_testing() + add_subdirectory(include) add_subdirectory(src) add_subdirectory(test) @@ -37,4 +39,3 @@ add_custom_target(format COMMENT "Running C++ formatter" ) -enable_testing() diff --git a/cpp/Makefile b/cpp/Makefile new file mode 100644 index 00000000..02c3ab16 --- /dev/null +++ b/cpp/Makefile @@ -0,0 +1,15 @@ +default_target: build + +BUILD_DIR := build + +cmake: + cmake -S . -B $(BUILD_DIR) + +build: cmake + cmake --build ${BUILD_DIR} + +test: build + cmake --build ${BUILD_DIR} --target test + +clean: + rm -rf ${BUILD_DIR}/* \ No newline at end of file diff --git a/cpp/build/.gitkeep b/cpp/build/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/cpp/test/CMakeLists.txt b/cpp/test/CMakeLists.txt index c5598640..adde8751 100644 --- a/cpp/test/CMakeLists.txt +++ b/cpp/test/CMakeLists.txt @@ -15,3 +15,7 @@ target_link_libraries(VoyagerTests # Add the tests add_test(NAME VoyagerTests COMMAND VoyagerTests) + +# Discover tests using Doctest +include(${CMAKE_SOURCE_DIR}/include/doctest/scripts/cmake/doctest.cmake) +doctest_discover_tests(VoyagerTests)