Skip to content

Commit

Permalink
compile using cmake
Browse files Browse the repository at this point in the history
Signed-off-by: sunby <[email protected]>
  • Loading branch information
sunby committed Apr 25, 2024
1 parent ae0e08c commit d4edb57
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cpp-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
make check-tidy

- name : Test
working-directory: ./cpp/build/Release
working-directory: ./cpp/build/test
run:
ctest .

Expand Down
1 change: 1 addition & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ option(WITH_ASAN "Build with address sanitizer." OFF)
option(WITH_OPENDAL "Build with opendal." OFF)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
Expand Down
16 changes: 8 additions & 8 deletions cpp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ ifneq ($(TIDY_THREADS),)
endif

build:
mkdir -p build && cd build && \
conan install .. --build=missing && \
conan build ..
mkdir -p build/release && cd build/release && \
cmake ../.. && \
make -j 8

debug:
mkdir -p build && cd build && \
conan install .. --build=missing -s build_type=Debug && \
conan build ..
cmake -DCMAKE_BUILD_TYPE=Debug .. && \
make -j 8

clean:
rm -rf build

test: build
cd build/Release && ctest . -j ${TEST_THREADS} --output-on-failure
cd build/test && ctest . -j ${TEST_THREADS} --output-on-failure

fix-format:
find ./src -type f ! -name "*.pb.h" -iname *.h -o -iname *.cpp | xargs clang-format -i
Expand All @@ -32,10 +32,10 @@ check-format:
find ./test -type f ! -name "*.pb.h" -iname *.h -o -iname *.cpp | xargs clang-format --dry-run --Werror

check-tidy:
python3 ./scripts/run-clang-tidy.py -p build/Release
python3 ./scripts/run-clang-tidy.py -p build

fix-tidy:
python3 ./scripts/run-clang-tidy.py -fix -p build/Release
python3 ./scripts/run-clang-tidy.py -fix -p build

proto:
protoc -I="src/proto" --cpp_out="src/proto" src/proto/*.proto
4 changes: 2 additions & 2 deletions cpp/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
enable_testing()

file(GLOB_RECURSE BUSTUB_TEST_SOURCES "${PROJECT_SOURCE_DIR}/test/*.cpp")
file(GLOB_RECURSE MILVUS_TEST_SOURCES "${PROJECT_SOURCE_DIR}/test/*.cpp")

add_executable(
milvus_test
${BUSTUB_TEST_SOURCES}
${MILVUS_TEST_SOURCES}
)

target_link_libraries(
Expand Down
4 changes: 2 additions & 2 deletions cpp/thirdparty/protobuf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ FetchContent_Declare(protobuf
GIT_TAG v3.21.4
)

set(protobuf_BUILD_TESTS OFF)
set(protobuf_BUILD_PROTOC_BINARIES OFF)
set(protobuf_BUILD_TESTS OFF CACHE INTERNAL "")
set(protobuf_BUILD_PROTOC_BINARIES OFF CACHE INTERNAL "")
FetchContent_MakeAvailable(protobuf)

0 comments on commit d4edb57

Please sign in to comment.