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 de9596c
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 17 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
2 changes: 1 addition & 1 deletion cpp/cmake/libarrow.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function(build_arrow)
)
ExternalProject_Add(
arrow_ep
GIT_REPOSITORY git@github.com:apache/arrow.git
GIT_REPOSITORY https://github.com/apache/arrow.git
GIT_TAG 740889f
CMAKE_ARGS
-DARROW_PARQUET=ON
Expand Down
2 changes: 1 addition & 1 deletion cpp/cmake/libglog.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function(build_glog)
)
ExternalProject_Add(
glog_ep
GIT_REPOSITORY git@github.com:google/glog.git
GIT_REPOSITORY https://github.com/google/glog.git
GIT_TAG v0.6.0
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
Expand Down
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
2 changes: 1 addition & 1 deletion cpp/thirdparty/gtest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include(FetchContent)
message(STATUS "Fetching googletest")
FetchContent_Declare(
googletest
GIT_REPOSITORY git@github.com:google/googletest.git
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG v1.13.0
)

Expand Down
6 changes: 3 additions & 3 deletions cpp/thirdparty/protobuf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ include(FetchContent)

message(STATUS "Fetching protobuf")
FetchContent_Declare(protobuf
GIT_REPOSITORY git@github.com:protocolbuffers/protobuf.git
GIT_REPOSITORY https://github.com/protocolbuffers/protobuf.git
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 de9596c

Please sign in to comment.