Skip to content

Commit

Permalink
move from bazel to cmake; fix fd leak in transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
ray6080 committed Nov 25, 2022
1 parent e558c54 commit 8be7757
Show file tree
Hide file tree
Showing 1,254 changed files with 101,929 additions and 4,895 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,33 @@ on:
jobs:
gcc-build-test:
name: gcc build & test
runs-on: self-hosted-testing
runs-on: kuzu-self-hosted-testing
steps:
- uses: actions/checkout@v2
- run: pip install -r tools/python_api/requirements_dev.txt

- name: build
run: CC=gcc bazel build --cxxopt='-std=c++2a' --cxxopt='-O3' //...:all
run: CC=gcc CXX=g++ make release NUM_THREADS=32

- name: test
run: CC=gcc bazel test --test_output=errors --cxxopt='-std=c++2a' --cxxopt='-O3' //...:all
run: CC=gcc CXX=g++ make test

clang-build-test:
name: clang build & test
runs-on: self-hosted-testing
runs-on: kuzu-self-hosted-testing
steps:
- uses: actions/checkout@v2
- run: pip install -r tools/python_api/requirements_dev.txt

- name: build
run: CC=clang-13 bazel build --cxxopt='-std=c++2a' --cxxopt='-O3' //...:all
run: CC=clang-13 CXX=clang++-13 make release NUM_THREADS=32

- name: test
run: CC=clang-13 bazel test --test_output=errors --cxxopt='-std=c++2a' --cxxopt='-O3' //...:all
run: CC=clang-13 CXX=clang++-13 make test

clang-formatting-check:
name: clang-formatting-check
runs-on: self-hosted-testing
runs-on: kuzu-self-hosted-testing
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
Expand All @@ -56,7 +56,7 @@ jobs:
- run: pip3 install -r tools/python_api/requirements_dev.txt

- name: build
run: CC=gcc-9 bazel build --cxxopt='-std=c++2a' --cxxopt='-O3' //...:all
run: CC=gcc-9 make release NUM_THREADS=32

- name: benchmark
run: python3 benchmark/benchmark_runner.py --dataset ldbc-sf100
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ bazel-*
.bazelrc

test_temp/
build/

### Python
# Byte-compiled / optimized / DLL files
Expand Down
Empty file removed BUILD
Empty file.
76 changes: 76 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
cmake_minimum_required(VERSION 3.11)

project(Kuzu VERSION 0.0.1 LANGUAGES CXX)

find_package(Threads REQUIRED)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

find_program(CCACHE_PROGRAM ccache)
if (CCACHE_PROGRAM)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
else ()
find_program(CCACHE_PROGRAM sccache)
if (CCACHE_PROGRAM)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
endif ()
endif ()

set(INSTALL_LIB_DIR
lib
CACHE PATH "Installation directory for libraries")
set(INSTALL_BIN_DIR
bin
CACHE PATH "Installation directory for executables")
set(INSTALL_INCLUDE_DIR
include
CACHE PATH "Installation directory for header files")
set(INSTALL_CMAKE_DIR
${DEF_INSTALL_CMAKE_DIR}
CACHE PATH "Installation directory for CMake files")

option(ENABLE_ADDRESS_SANITIZER "Enable address sanitizer." FALSE)
option(ENABLE_THREAD_SANITIZER "Enable thread sanitizer." FALSE)
option(ENABLE_UBSAN "Enable undefined behavior sanitizer." FALSE)
if(${ENABLE_THREAD_SANITIZER})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread -fno-common -fpermissive")
endif()
if(${ENABLE_ADDRESS_SANITIZER})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer -fno-common -fpermissive")
endif()
if(${ENABLE_UBSAN})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined -fno-common -fpermissive")
endif()

function(link_threads LIBRARY)
if (CMAKE_VERSION VERSION_LESS "3.1")
target_link_libraries(${LIBRARY} pthread)
else ()
target_link_libraries(${LIBRARY} Threads::Threads)
endif ()
endfunction()

function(add_kuzu_test TEST_NAME)
set(SRCS ${ARGN})
add_executable(${TEST_NAME} ${SRCS})
target_link_libraries(${TEST_NAME} PRIVATE test_helper)
target_include_directories(${TEST_NAME} PRIVATE ${PROJECT_SOURCE_DIR}/test/include)
include(GoogleTest)
gtest_discover_tests(${TEST_NAME})
endfunction()

add_definitions(-DKUZU_ROOT_DIRECTORY="${PROJECT_SOURCE_DIR}")

include_directories(src/include)
include_directories(third_party/antlr4_cypher/include)
include_directories(third_party/antlr4_runtime/src)
include_directories(third_party/spdlog)
include_directories(third_party/nlohmann_json)
include_directories(third_party/utf8proc/include)

add_subdirectory(third_party)
add_subdirectory(src)
add_subdirectory(test)
add_subdirectory(tools)
50 changes: 50 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
.PHONY: all release debug test clean

all: release

GENERATOR=
FORCE_COLOR=
NUM_THREADS=
SANITIZER_FLAG=
ROOT_DIR=$(PWD)

ifndef $(NUM_THREADS)
NUM_THREADS=1
endif

ifeq ($(GEN),ninja)
GENERATOR=-G "Ninja"
FORCE_COLOR=-DFORCE_COLORED_OUTPUT=1
endif

ifeq ($(ASAN), 1)
SANITIZER_FLAG=-DENABLE_ADDRESS_SANITIZER=TRUE -DENABLE_THREAD_SANITIZER=FALSE -DENABLE_UBSAN=FALSE
endif
ifeq ($(TSAN), 1)
SANITIZER_FLAG=-DENABLE_ADDRESS_SANITIZER=FALSE -DENABLE_THREAD_SANITIZER=TRUE -DENABLE_UBSAN=FALSE
endif
ifeq ($(UBSAN), 1)
SANITIZER_FLAG=-DENABLE_ADDRESS_SANITIZER=FALSE -DENABLE_THREAD_SANITIZER=TRUE -DENABLE_UBSAN=TRUE
endif

release:
mkdir -p build/release && \
cd build/release && \
cmake $(GENERATOR) $(FORCE_COLOR) $(SANITIZER_FLAG) -DCMAKE_BUILD_TYPE=Release ../.. && \
cmake --build . --config Release -- -j $(NUM_THREADS)

debug:
mkdir -p build/debug && \
cd build/debug && \
cmake $(GENERATOR) $(FORCE_COLOR) $(SANITIZER_FLAG) -DCMAKE_BUILD_TYPE=Debug ../.. && \
cmake --build . --config Debug -- -j $(NUM_THREADS)


test:
cd $(ROOT_DIR)/build/release/test && \
ctest && \
cd $(ROOT_DIR)/tools/python_api/test && \
pytest

clean:
rm -rf build
89 changes: 0 additions & 89 deletions WORKSPACE.bazel

This file was deleted.

23 changes: 0 additions & 23 deletions dataset/BUILD.bazel

This file was deleted.

10 changes: 2 additions & 8 deletions scripts/dockerized-ci-tests-runner/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,10 @@ FROM python:3.9

ENV RUNNER_ALLOW_RUNASROOT=1

# Configure bazel
RUN apt-get install -y apt-transport-https curl gnupg
RUN curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor >bazel-archive-keyring.gpg
RUN mv bazel-archive-keyring.gpg /usr/share/keyrings
RUN echo "deb [arch=amd64 signed-by=/usr/share/keyrings/bazel-archive-keyring.gpg] https://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list

# Install dependencies
RUN apt-get update
RUN apt-get install -y bazel
RUN apt-get install -y openjdk-11-jdk
RUN apt-get install -y apt-transport-https curl gnupg
RUN apt-get install -y cmake
RUN apt-get install -y clang
RUN apt-get install -y clang-format
RUN apt-get install -y clang-13
Expand Down
4 changes: 2 additions & 2 deletions scripts/dockerized-ci-tests-runner/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ REG_TOKEN=$(curl \
-H "Authorization: Bearer ${GITHUB_ACCESS_TOKEN}" \
https://github.com/gitapi/repos/kuzudb/kuzu/actions/runners/registration-token | jq .token --raw-output)

LABELS="self-hosted-testing"
LABELS="kuzu-self-hosted-testing"
if [ -z "${MACHINE_NAME}" ]; then
echo "MACHINE_NAME is not set. The label is ignored."
else
LABELS="self-hosted-testing,$MACHINE_NAME"
LABELS="kuzu-self-hosted-testing,$MACHINE_NAME"
fi

# Register runner
Expand Down
17 changes: 17 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
add_subdirectory(binder)
add_subdirectory(catalog)
add_subdirectory(common)
add_subdirectory(expression_evaluator)
add_subdirectory(function)
add_subdirectory(main)
add_subdirectory(parser)
add_subdirectory(planner)
add_subdirectory(processor)
add_subdirectory(storage)
add_subdirectory(transaction)

add_library(kuzu STATIC ${ALL_OBJECT_FILES})
target_link_libraries(kuzu PUBLIC antlr4_cypher antlr4_runtime utf8proc Threads::Threads)
target_include_directories(
kuzu PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
46 changes: 0 additions & 46 deletions src/antlr4/BUILD.bazel

This file was deleted.

Loading

0 comments on commit 8be7757

Please sign in to comment.