Skip to content

Commit

Permalink
Build arrow in the cmake configure stage
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminwinger committed Jul 4, 2023
1 parent 05195ed commit b725472
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 37 deletions.
16 changes: 15 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,21 @@ if (${USE_SYSTEM_ARROW})
else()
if (NOT DEFINED ARROW_INSTALL)
message(STATUS "Configuring arrow for bundled install")
set(ARROW_INSTALL ${CMAKE_CURRENT_SOURCE_DIR}/external/build/arrow/install)
set(ARROW_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/arrow-build/arrow/install)
set(ARROW_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/arrow-build)
file(MAKE_DIRECTORY ${ARROW_BUILD_DIR})
execute_process(COMMAND ${CMAKE_COMMAND}
${CMAKE_CURRENT_SOURCE_DIR}/external
-G ${CMAKE_GENERATOR}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DENABLE_ADDRESS_SANITIZER=${ENABLE_ADDRESS_SANITIZER}
-DENABLE_THREAD_SANITIZER=${ENABLE_THREAD_SANITIZER}
-DENABLE_UBSAN=${ENABLE_UBSAN}
-DFORCE_COLORED_OUTPUT=${FORCE_COLORED_OUTPUT}
WORKING_DIRECTORY ${ARROW_BUILD_DIR}
COMMAND_ERROR_IS_FATAL ANY)
execute_process(COMMAND ${CMAKE_COMMAND} --build ${ARROW_BUILD_DIR} --config ${CMAKE_BUILD_TYPE}
COMMAND_ERROR_IS_FATAL ANY)
else()
message(STATUS "Using arrow at path ${ARROW_INSTALL}")
endif()
Expand Down
45 changes: 10 additions & 35 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,72 +48,56 @@ define mkdirp
endef
endif

arrow:
$(call mkdirp,external/build) && cd external/build && \
cmake $(FORCE_COLOR) $(SANITIZER_FLAG) $(GENERATOR) -DCMAKE_BUILD_TYPE=Release .. && \
cmake --build . --config Release -- -j $(NUM_THREADS)

arrow-debug:
ifeq ($(OS),Windows_NT)
$(call mkdirp,external/build) && cd external/build && \
cmake $(FORCE_COLOR) $(SANITIZER_FLAG) $(GENERATOR) -DCMAKE_BUILD_TYPE=Debug .. && \
cmake --build . --config Debug -- -j $(NUM_THREADS)
else
$(call mkdirp,external/build) && cd external/build && \
cmake $(FORCE_COLOR) $(SANITIZER_FLAG) $(GENERATOR) -DCMAKE_BUILD_TYPE=Release .. && \
cmake --build . --config Release -- -j $(NUM_THREADS)
endif

release: arrow
release:
$(call mkdirp,build/release) && cd build/release && \
cmake $(GENERATOR) $(FORCE_COLOR) $(SANITIZER_FLAG) -DCMAKE_BUILD_TYPE=Release ../.. && \
cmake --build . --config Release -- -j $(NUM_THREADS)

debug: arrow-debug
debug:
$(call mkdirp,build/debug) && cd build/debug && \
cmake $(GENERATOR) $(FORCE_COLOR) $(SANITIZER_FLAG) -DCMAKE_BUILD_TYPE=Debug ../.. && \
cmake --build . --config Debug -- -j $(NUM_THREADS)

all: arrow
all:
$(call mkdirp,build/release) && cd build/release && \
cmake $(GENERATOR) $(FORCE_COLOR) $(SANITIZER_FLAG) -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=TRUE -DBUILD_BENCHMARK=TRUE -DBUILD_NODEJS=TRUE ../.. && \
cmake --build . --config Release -- -j $(NUM_THREADS)

alldebug: arrow
alldebug:
$(call mkdirp,build/debug) && cd build/debug && \
cmake $(GENERATOR) $(FORCE_COLOR) $(SANITIZER_FLAG) -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=TRUE -DBUILD_BENCHMARK=TRUE -DBUILD_NODEJS=TRUE ../.. && \
cmake --build . --config Debug -- -j $(NUM_THREADS)

benchmark: arrow
benchmark:
$(call mkdirp,build/release) && cd build/release && \
cmake $(GENERATOR) $(FORCE_COLOR) $(SANITIZER_FLAG) -DCMAKE_BUILD_TYPE=Release -DBUILD_BENCHMARK=TRUE ../.. && \
cmake --build . --config Release -- -j $(NUM_THREADS)

nodejs: arrow
nodejs:
$(call mkdirp,build/release) && cd build/release && \
cmake $(GENERATOR) $(FORCE_COLOR) $(SANITIZER_FLAG) -DCMAKE_BUILD_TYPE=Release -DBUILD_NODEJS=TRUE ../.. && \
cmake --build . --config Release -- -j $(NUM_THREADS)

test: arrow
test:
$(call mkdirp,build/release) && cd build/release && \
cmake $(GENERATOR) $(FORCE_COLOR) $(SANITIZER_FLAG) -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=TRUE ../.. && \
cmake --build . --config Release -- -j $(NUM_THREADS)
cd $(ROOT_DIR)/build/release/test && \
ctest --output-on-failure -j ${TEST_JOBS}

lcov: arrow
lcov:
$(call mkdirp,build/release) && cd build/release && \
cmake $(GENERATOR) $(FORCE_COLOR) $(SANITIZER_FLAG) -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=TRUE -DBUILD_NODEJS=TRUE -DBUILD_LCOV=TRUE ../.. && \
cmake --build . --config Release -- -j $(NUM_THREADS)
cd $(ROOT_DIR)/build/release/test && \
ctest --output-on-failure -j ${TEST_JOBS}

pytest: arrow
pytest:
$(MAKE) release
cd $(ROOT_DIR)/tools/python_api/test && \
python3 -m pytest -v test_main.py

nodejstest: arrow
nodejstest:
$(MAKE) nodejs
cd $(ROOT_DIR)/tools/nodejs_api/ && \
npm test
Expand All @@ -137,18 +121,9 @@ else
rm -rf tools/python_api/build
endif

clean-external:
ifeq ($(OS),Windows_NT)
if exist external\build rmdir /s /q external\build
else
rm -rf external/build
endif

clean: clean-python-api
ifeq ($(OS),Windows_NT)
if exist build rmdir /s /q build
else
rm -rf build
endif

clean-all: clean-external clean
2 changes: 1 addition & 1 deletion tools/rust_api/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ fn main() {
println!("cargo:rustc-link-search=native={}", lib_path.display());
}

let arrow_install = kuzu_root.join("external/build/arrow/install");
let arrow_install = kuzu_root.join("build/arrow-build/arrow/install");
println!(
"cargo:rustc-link-search=native={}",
arrow_install.join("lib").display()
Expand Down

0 comments on commit b725472

Please sign in to comment.