Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate build system to Conan and CMake #136

Closed
wants to merge 51 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
6019083
refactor(cleanup): restructure folders
hrz6976 Dec 20, 2023
16786e3
Stage changes
hrz6976 Dec 20, 2023
608d5a0
stage changes
hrz6976 Dec 23, 2023
599b51f
stage changes
hrz6976 Dec 25, 2023
21f9000
build: migrate toolchain to CMake and Conan
hrz6976 Dec 29, 2023
13b4551
fix: compile issues
hrz6976 Dec 29, 2023
32a8e32
build: add uninstall, add flags
hrz6976 Dec 29, 2023
15a0be6
chore: move artifacts to a standalone folder
hrz6976 Dec 31, 2023
c9a1c3d
chore: restructure and cleanup
hrz6976 Jan 2, 2024
59965d0
chore(cleanup): fix gitignore, remove unused
hrz6976 Jan 2, 2024
cc25826
fix(build): rapidjson can't be found
hrz6976 Jan 2, 2024
625658b
build: dockerfile for cmake
hrz6976 Jan 2, 2024
42cb4d0
fix(docker): init script won't build db
hrz6976 Jan 2, 2024
c02051d
Accelerate TempResult::dofilter by replacing tostring method from str…
fyulingi Dec 1, 2023
3382b4f
update(ghttp&grpc): add param disk to monitor api
Jeevan620 Dec 5, 2023
7f57b0c
Add limit_num (optional parameter) for do_filter.
fyulingi Dec 8, 2023
3b0f5c2
Pass limit num into doFilter in GeneralEvaluation
SoftlySpoken Dec 8, 2023
6888c27
Opt(Query): filter multiple conditions early termination
Dec 11, 2023
ba267b2
Improve bgp plan (from dfs_strategy to bfs_strategy).
fyulingi Dec 11, 2023
5e162d2
Remove one line debug_output in PlanGenerator.cpp.
fyulingi Dec 11, 2023
4733c14
update(ghttp&grpc): update userPrivilegeManage api
Jeevan620 Dec 18, 2023
fce6e74
update(APIUtil): add rwlock for system db
Jeevan620 Dec 18, 2023
4a9098a
Add gzip:add json query default is gzip
Dec 20, 2023
c46ab0f
update(APIUtil): refactor some methods
Jeevan620 Dec 20, 2023
9acb0ef
update(ghttp): refactor build api
Jeevan620 Dec 20, 2023
290cfef
update(grpc): refactor build api
Jeevan620 Dec 20, 2023
f87d4c1
Add remove path:remove file path and dir path
Dec 20, 2023
2b3879c
replace rm(Databasse.cpp):add remove_path as system rm
Dec 20, 2023
7f54d04
replace rm(ghttp.cpp):add remove_path as system rm
Dec 20, 2023
4b07bca
replace system(grpc.cpp):add remove_path replace system rm
Dec 20, 2023
7f1fe92
replace rm(APIUtil.cpp):remove_path replace system rm
Dec 20, 2023
359492e
replace rm(gadd.cpp):remove_path replace system rm
Dec 20, 2023
85212aa
replace rm(gbuild.cpp):remove_path replace system rm
Dec 20, 2023
9e0a999
replace rm(gdrop,gexport,ginit,shutdown):remove_path replace system rm
Dec 20, 2023
128e684
replace rm(grestore,gserver,rollback.cpp):remove_path replace system rm
Dec 20, 2023
83d9a9a
replace rm(Util.cpp):remove_path replace system rm
Dec 21, 2023
a845708
replace rm(gconsole.cpp):remove_path replace system rm
Dec 21, 2023
ff70d79
update parser_test script
Jeevan620 Dec 21, 2023
55930c7
update parser_test script
Jeevan620 Dec 21, 2023
7280953
update basic_test script
Jeevan620 Dec 22, 2023
d2b144c
Create new docker configuration for version 1.2 (#132)
hrz6976 Dec 26, 2023
a1d6d7a
Update compression of http api response data
Jeevan620 Dec 27, 2023
4e3a9eb
Fix a bug in Optimizer.cpp (DFS execution table init).
fyulingi Dec 27, 2023
6cdd77a
Improve queries like "select * where {?s ?p ?o.} limit k".
fyulingi Jan 2, 2024
f9df709
Merge pull request #1 from hrz6976/1.2
hrz6976 Jan 6, 2024
2627edf
fix(chore): unresolved merge conflict
hrz6976 Jan 6, 2024
e1ed2b2
feat: add support for loongarch64
hrz6976 Jan 8, 2024
01ceb35
feat: + backward for stacktraces, cmake cleanup
hrz6976 Jan 8, 2024
fb28992
fix: test cases
hrz6976 Jan 8, 2024
fe69a5e
test: + ctest
hrz6976 Jan 9, 2024
968f3bb
feat: add binary packaging
hrz6976 Jan 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 0 additions & 3 deletions .debug/.gitignore

This file was deleted.

45 changes: 41 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,37 @@
# Artifacts and Cache
build/
include/
lib/
bin/
bin_tests/
dist/
cmake-build-*/
.cmake/
gstore-*.tar.gz
CMakeUserPresets.json

# Runtime directories
.tmp/
.debug/
.obj/
backup/
logs/
upload/
temp/
fun/

# config files
# TODO: add a separate config file folder
/backup.json
/conf.ini
/init.conf
/ipAllow.config
/ipDeny.config
/README.txt
/slog.properties
/slog.stdout.properties
/*.log

# Executables
*.pyc
*.exe
Expand All @@ -7,19 +41,20 @@
*.x86_64
*.hex
bin/g*
scripts/update_test
scripts/dataset_test
tests/update_test
tests/dataset_test
api/cpp/example/example

Parser/Sparql*
src/Parser/Sparql*

#result logs
*.txt
*.log
logs
!CMakeLists.txt

#backup files
backup.json
defaults/backup.json

#download files
*.torrent
Expand Down Expand Up @@ -90,6 +125,7 @@ tags
.vs
*.iml
.idea
.vscode

# latex files
*.aux
Expand All @@ -100,6 +136,7 @@ tags
# queries
*.sql
*.sh
!docker-entrypoint.sh

# modules
node_modules
Expand Down
3 changes: 0 additions & 3 deletions .objs/.gitignore

This file was deleted.

3 changes: 0 additions & 3 deletions .tmp/.gitignore

This file was deleted.

3 changes: 0 additions & 3 deletions .tmp/web/.gitignore

This file was deleted.

16 changes: 0 additions & 16 deletions .vscode/c_cpp_properties.json

This file was deleted.

6 changes: 6 additions & 0 deletions 3rdparty/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*
!.gitignore
!*.tar*
!*.t[bgx]z
!*.zip
!*.sh
19 changes: 19 additions & 0 deletions 3rdparty/antlr4-cpp-runtime-4.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

mkdir -p ../include/
rm -rf antlr4-cpp-runtime-4
tar -xzvf antlr4-cpp-runtime-4.tar.gz;
cd antlr4-cpp-runtime-4 || echo "./antlr4-cpp-runtime-4 not found"
cmake .

# if GSTORE_USE_DYNAMIC_LIB is defined, then we need to copy the dynamic library to the lib directory
# otherwise, we need to copy the static library to the lib directory
if [ -n "$GSTORE_USE_DYNAMIC_LIB" ]; then
make -j2 antlr4_shared
cp dist/libantlr4-runtime.so* ../../lib/libantlr4-runtime.so
cd ../../lib/ || echo "./lib not found"
else
make -j$(nproc) antlr4_static
cp dist/libantlr4-runtime.a ../../lib/
fi
cp -r runtime/src/* ../../include/
File renamed without changes.
20 changes: 20 additions & 0 deletions 3rdparty/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

BLUE='\033[0;34m'
NC='\033[0m'

cd $(dirname "${BASH_SOURCE[0]}")

mkdir -p ../lib ../include

for f in *.sh; do
if [ "$f" != "init.sh" ]; then
echo "${BLUE}Running $f${NC}"
bash "$f"
if [ $? -ne 0 ]; then
echo "${BLUE}Failed to run $f${NC}"
exit 1
fi
fi
done

17 changes: 17 additions & 0 deletions 3rdparty/workflow-0.10.3.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

rm -rf workflow
tar -xzvf workflow-0.10.3.tar.gz
cd ./workflow || echo "./workflow not found"

make -j$(nproc)
# if GSTORE_USE_DYNAMIC_LIB is defined, then we need to copy the dynamic library to the lib directory
# otherwise, we need to copy the static library to the lib directory

if [ -n "$GSTORE_USE_DYNAMIC_LIB" ]; then
cp _lib/libworkflow.so* ../../lib/
cd ../../lib/ || echo "./lib not found"
else
cp _lib/libworkflow.a ../../lib/libworkflow.a
fi
cp _include/workflow ../../include/workflow -r
File renamed without changes.
182 changes: 182 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
# SPDX-License-Identifier: BSD-3-Clause
# @authors: Runzhi He <[email protected]>
# @date: 2023-12-20

cmake_minimum_required(VERSION 3.16)

project(gStore LANGUAGES CXX)

# gStore requires gcc 8 or higher
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_VERSION VERSION_LESS "8")
message(FATAL_ERROR "gStore requires gcc 8 or higher, got ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}")
endif()

### set compiler flags
# use -O2 for Release
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2")
# ignore unused-result, panic on return-type
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-result -Werror=return-type")
# check CMAKE_BUILD_TYPE, if not set, set to Release
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
message(WARNING "Build type not set, default to Release")
endif()
# Check if mold is available and set it as the linker
find_program(MOLD_LINKER mold)
if(MOLD_LINKER)
message(STATUS "mold linker found: ${MOLD_LINKER}, adding -fuse-ld=mold to linker flags")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=mold")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=mold")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fuse-ld=mold")
else()
message(STATUS "mold linker not found, using default linker")
endif()
# coverage settings
if(COVERAGE)
message(STATUS "Enabling coverage reporting")
# halt if the build_type is not Debug
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
message(FATAL_ERROR "Coverage requires Debug build type")
endif()
# set compiler flags
add_link_options(--coverage)
add_compile_options(--coverage)
endif ()

# print build type and flags
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
message(STATUS "CXX Flags: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}}")

# helper for IDEs to find the include path
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# Add include/ and lib/
include_directories(${CMAKE_SOURCE_DIR}/include)
link_directories(${CMAKE_SOURCE_DIR}/lib)
# TODO: The line below is a workaround for millions of relative includes. Remove it when all relative includes are replaced with target_include_directories.
include_directories(${CMAKE_INCLUDE_PATH})

# Set output directories (use -DGSTORE_ROOT_DIR=... to override)
SET(GSTORE_ROOT_DIR ${CMAKE_SOURCE_DIR})
SET(GSTORE_EXE_DIR ${GSTORE_ROOT_DIR}/bin)
SET(GSTORE_LIB_DIR ${GSTORE_ROOT_DIR}/lib)
SET(GSTORE_TEST_DIR ${GSTORE_ROOT_DIR}/bin_tests)

# if option USE_DYNAMIC_LIB is set, set env var GSTORE_USE_DYNAMIC_LIB to 1
SET(USE_DYNAMIC_LIB ON CACHE BOOL "Use dynamic libraries")
if(USE_DYNAMIC_LIB OR ENV{GSTORE_USE_DYNAMIC_LIB})
set(ENV{GSTORE_USE_DYNAMIC_LIB} 1)
# Set rpath so that gStore can find its shared libraries
set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib")
endif()

### Dependencies managed by conan
# boost-system, boost-regex, boost-thread
find_package(Boost REQUIRED CONFIG COMPONENTS system regex thread)
# minizip: minizip::minizip, minizip/zip.h
find_package(minizip REQUIRED CONFIG)
# openssl: OpenSSL::SSL, OpenSSL::Crypto
find_package(OpenSSL REQUIRED CONFIG)
# indicators: indicators::indicators, indicators/progress_bar.hpp
find_package(indicators REQUIRED CONFIG)
## antlr4-runtime: antlr4_shared, antlr4_static
#find_package(antlr4-runtime REQUIRED CONFIG)
# rapidjson: rapidjson, rapidjson/document.h
find_package(RapidJSON REQUIRED CONFIG)
# logcplus: log4cplus::log4cplus, log4cplus/logger.h
find_package(log4cplus REQUIRED CONFIG)
# curl: CURL::libcurl, curl/curl.h
find_package(CURL REQUIRED CONFIG)

### Dependencies managed by system package manager
find_package(Threads REQUIRED)
find_package(PkgConfig REQUIRED)
# readline: have to link for license compatibility with GPL-3
find_library(LIB_READLINE NAMES readline REQUIRED)
# jemalloc
find_library(LIB_JEMALLOC NAMES jemalloc REQUIRED)
# openmp: OpenMP::OpenMP_CXX # the elegance below requires cmake 3.9 or higher
find_package(OpenMP REQUIRED)
# uuid: uuid::uuid (required by antlr4-cppruntime)
find_library(LIB_UUID NAMES uuid REQUIRED)
# Backward: Backward::Backward
find_package(Backward REQUIRED)
# libdwarf: libdwarf::libdwarf
find_package(libdwarf REQUIRED)
# libelf libelf::libelf
find_package(libelf REQUIRED)

### Prepare unmanaged dependencies
add_custom_target(
prepare
COMMAND [ -d ${CMAKE_SOURCE_DIR}/include ] && [ -d ${CMAKE_SOURCE_DIR}/lib ] || bash ${CMAKE_SOURCE_DIR}/3rdparty/init.sh
COMMENT "Prepare unmanaged dependencies"
)

add_custom_target(
clean_prepare
COMMAND rm -rvf ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/lib/*.a
COMMAND find ${CMAKE_SOURCE_DIR}/3rdparty -type d -mindepth 1 -maxdepth 1 -exec rm -rvf {} +
COMMENT "Clean unmanaged dependencies"
)

add_custom_target(
uninstall
# remove all files in bin/, lib/, and scripts/ that are not *.sh or *.py
COMMAND rm -rvf ${GSTORE_EXE_DIR}
COMMAND rm -rvf ${GSTORE_LIB_DIR}/libgcsr.so ${GSTORE_LIB_DIR}/libgpathqueryhandler.so
COMMAND find ${GSTORE_TEST_DIR} -type f -not -name '*.*' -exec rm -v {} +
COMMENT "Clean installed files"
)

add_custom_target(
tarball
COMMAND cd ../ && ${CMAKE_COMMAND} -E tar "cfzv" "gstore-src.tar.gz" --
"src" "api" "defaults" "tests" "3rdparty" "data" "scripts" "conanfile.py" "CMakeLists.txt" "README.md" "LICENSE"
COMMENT "Creating source tarball"
VERBATIM
)

string(TOLOWER "${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}" GSTORE_PLATFORM_NAME)
add_custom_target(
package
COMMAND cd ../ && ${CMAKE_COMMAND} -E tar "cfzv" "gstore-${GSTORE_PLATFORM_NAME}.tar.gz" --
"bin" "lib" "defaults" "data/system" "scripts" "README.md" "LICENSE"
COMMENT "Creating binary tarball"
VERBATIM
)

# Add large file support on 32-bit builds
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
add_definitions(-D_FILE_OFFSET_BITS=64)
add_definitions(-D_LARGEFILE_SOURCE)
add_definitions(-D_LARGEFILE64_SOURCE)
endif()

add_subdirectory(src)
add_subdirectory(tests)

# rules for ctest
include(CTest)
enable_testing()
add_test(NAME BasicTest COMMAND bash ${CMAKE_SOURCE_DIR}/tests/basic_test.sh)
add_test(NAME ParserTest COMMAND bash ${CMAKE_SOURCE_DIR}/tests/parser_test.sh)
add_test(NAME DatasetTest COMMAND dataset_test)
add_test(NAME UpdateTest COMMAND update_test 100)
add_test(NAME TransactionTest COMMAND transaction_test)
add_test(NAME RunTransaction COMMAND run_transaction)
add_test(NAME DebugTest COMMAND debug_test)

set(GSTORE_CI_TESTS
BasicTest
ParserTest
DatasetTest
UpdateTest
TransactionTest
RunTransaction
DebugTest
)

foreach (test ${GSTORE_CI_TESTS})
set_tests_properties(${test} PROPERTIES TIMEOUT 300 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
endforeach ()
Empty file removed COVERAGE/readme
Empty file.
Loading