Skip to content

Commit

Permalink
Add build dir for cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
markkohdev committed Aug 19, 2024
1 parent 753175f commit 6cc7614
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 12 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*.egg-info/
build/
*/build/*
!build/.gitkeep
dist/
tmp/
__pycache__/
Expand All @@ -26,6 +27,7 @@ CMakeFiles
CMakeScripts
Testing
Makefile
!cpp/Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
Expand Down
5 changes: 1 addition & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
```

Expand Down
3 changes: 2 additions & 1 deletion cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -37,4 +39,3 @@ add_custom_target(format
COMMENT "Running C++ formatter"
)

enable_testing()
15 changes: 15 additions & 0 deletions cpp/Makefile
Original file line number Diff line number Diff line change
@@ -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}/*
Empty file added cpp/build/.gitkeep
Empty file.
4 changes: 4 additions & 0 deletions cpp/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 6cc7614

Please sign in to comment.