Skip to content

Commit

Permalink
v1.3.0 (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
liss-h authored Apr 10, 2024
1 parent 9be81cf commit 3733291
Show file tree
Hide file tree
Showing 159 changed files with 4,370 additions and 30,334 deletions.
8 changes: 6 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@

## project specific
/src/lib/tentris/tentris_version.hpp
**/tentris_version.hpp
**/build*/**
**/cmake-*/**
tests
# log files
tentris_*
tentris.log

# Created by https://www.toptal.com/developers/gitignore/api/c++,conan,jetbrains+all,cmake
# Edit at https://www.toptal.com/developers/gitignore?templates=c++,conan,jetbrains+all,cmake
Expand Down
29 changes: 0 additions & 29 deletions .github/workflows/push.yaml

This file was deleted.

85 changes: 0 additions & 85 deletions .github/workflows/release.yaml

This file was deleted.

5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
## project specific
/src/lib/tentris/tentris_version.hpp
**/tentris_version.hpp

# log files
tentris_*
tentris.log

# Created by https://www.toptal.com/developers/gitignore/api/c++,conan,jetbrains+all,cmake
# Edit at https://www.toptal.com/developers/gitignore?templates=c++,conan,jetbrains+all,cmake
Expand Down
195 changes: 12 additions & 183 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,194 +1,23 @@
cmake_minimum_required(VERSION 3.13)
cmake_minimum_required(VERSION 3.18)
project(tentris
LANGUAGES CXX
VERSION 1.1.3)
set(CMAKE_CXX_STANDARD 20)

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/version.hpp.in ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/tentris/tentris_version.hpp)
VERSION 1.3.0
DESCRIPTION "tensor-based triplestore")

include(cmake/boilerplate_init.cmake)
boilerplate_init()
include(cmake/conan_cmake.cmake)
install_packages_via_conan("${CMAKE_SOURCE_DIR}/conanfile.txt" "${CONAN_OPTIONS}")

if(DEFINED ${TENTRIS_MARCH})
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -march=${TENTRIS_MARCH}")
endif()

if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -fomit-frame-pointer -momit-leaf-frame-pointer")
else ()
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -fomit-frame-pointer")
option(CONAN_CMAKE "If this should use conan cmake to fetch dependencies" On)
if (IS_TOP_LEVEL AND CONAN_CMAKE)
include(cmake/conan_cmake.cmake)
install_packages_via_conan("${CMAKE_CURRENT_SOURCE_DIR}/conanfile.py" "")
endif ()

if (TENTRIS_STATIC)
SET(CMAKE_FIND_LIBRARY_SUFFIXES .a)
endif ()

if (TENTRIS_BUILD_WITH_TCMALLOC)
find_library(TCMALLOCMINIMAL tcmalloc_minimal)
if (NOT TCMALLOCMINIMAL)
find_library(TCMALLOCMINIMAL tcmalloc-minimal)
endif()
if (NOT TCMALLOCMINIMAL)
message(FATAL_ERROR "Neither tcmalloc-minimal nor tcmalloc_minimal was found")
endif()
message("tcmalloc minimal ${TCMALLOCMINIMAL}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${TCMALLOCMINIMAL}")
if(TENTRIS_STATIC)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--eh-frame-hdr")
endif()
endif()
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wextra -g -O0")

# Lightweight C++ command line option parser https://github.com/jarro2783/cxxopts
include(FetchContent)
FetchContent_Declare(
cxxopts
GIT_REPOSITORY https://github.com/jarro2783/cxxopts.git
GIT_TAG v2.2.1
GIT_SHALLOW TRUE
)
set(CXXOPTS_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(CXXOPTS_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(CXXOPTS_ENABLE_INSTALL OFF CACHE BOOL "" FORCE)
set(CXXOPTS_ENABLE_WARNINGS OFF CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(cxxopts)

add_library(csv-parser INTERFACE)
target_include_directories(csv-parser INTERFACE
thirdparty/csv-parser
)


add_library(rapidjson INTERFACE)
target_include_directories(rapidjson INTERFACE
thirdparty/RapidJSON/include
)

find_package(tsl-hopscotch-map REQUIRED)
find_package(fmt REQUIRED)
find_package(hypertrie REQUIRED)
find_package(sparql-parser-base REQUIRED)
find_package(rdf-parser REQUIRED)
if (TENTRIS_STATIC)
SET(Boost_USE_STATIC_LIBS ON)
endif ()

find_package(Boost REQUIRED COMPONENTS system log_setup log thread)
if (TENTRIS_STATIC)
SET(RESTINIO_USE_BOOST_ASIO=static)
endif ()
find_package(restinio REQUIRED)
find_package(string-view-lite REQUIRED)
find_package(optional-lite REQUIRED)
find_package(serd REQUIRED)

# make a library of the code
add_library(tentris INTERFACE)

include(FetchContent)
FetchContent_Declare(
cppitertools
GIT_REPOSITORY https://github.com/ryanhaining/cppitertools.git
GIT_TAG v2.1
GIT_SHALLOW TRUE)

FetchContent_MakeAvailable(cppitertools)

target_link_libraries(tentris
INTERFACE
stdc++fs # for #include <filesystem>
cxxopts
rapidjson
sparql-parser-base::sparql-parser-base
tsl::hopscotch_map
fmt::fmt
hypertrie::hypertrie
rdf-parser::rdf-parser
Boost::Boost
serd::serd
cppitertools::cppitertools
)

target_include_directories(tentris INTERFACE
# todo: move code to include/Dice/tentris
src/lib/
${Boost_INCLUDE_DIRS}
)

# for rt and pthread linkage see:
# * https://stackoverflow.com/questions/58848694/gcc-whole-archive-recipe-for-static-linking-to-pthread-stopped-working-in-rec
# * https://stackoverflow.com/questions/35116327/when-g-static-link-pthread-cause-segmentation-fault-why
if (TENTRIS_STATIC)
set(TENTRIS_STATIC_DEF -static)
set(TENTRIS_PTHREAD_DEF -Wl,--whole-archive -lrt -lpthread -Wl,--no-whole-archive)
else()
set(TENTRIS_PTHREAD_DEF -lpthread)
if (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/CMakeCache.txt)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
endif ()
endif ()


# main executable targets
add_executable(tentris_server src/exec/TentrisServer.cpp src/exec/config/ServerConfig.hpp src/exec/config/TerminalConfig.hpp)

target_link_libraries(tentris_server
PRIVATE
${TENTRIS_STATIC_DEF}
${TENTRIS_PTHREAD_DEF}
tentris
restinio::restinio
nonstd::string-view-lite
nonstd::optional-lite
nonstd::variant-lite
)

set_target_properties(tentris_server PROPERTIES LINK_FLAGS_RELEASE -s)

add_dependencies(tentris_server tentris)

add_executable(tentris_terminal src/exec/TentrisTerminal.cpp src/exec/config/ServerConfig.hpp src/exec/config/TerminalConfig.hpp)
target_link_libraries(tentris_terminal
${TENTRIS_STATIC_DEF}
${TENTRIS_PTHREAD_DEF}
tentris
)

set_target_properties(tentris_terminal PROPERTIES LINK_FLAGS_RELEASE -s)

add_dependencies(tentris_terminal tentris)

add_executable(rdf2ids src/exec/tools/RDF2IDs.cpp)
target_link_libraries(rdf2ids
${TENTRIS_STATIC_DEF}
${TENTRIS_PTHREAD_DEF}
tentris
)

set_target_properties(rdf2ids PROPERTIES LINK_FLAGS_RELEASE -s)

add_dependencies(rdf2ids tentris)


add_executable(ids2hypertrie src/exec/tools/IDs2Hypertrie.cpp)
target_link_libraries(ids2hypertrie
${TENTRIS_STATIC_DEF}
${TENTRIS_PTHREAD_DEF}
tentris
csv-parser
)

add_dependencies(ids2hypertrie tentris)

if (CMAKE_BUILD_TYPE MATCHES "Release")
set_property(TARGET tentris_server PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
set_property(TARGET tentris_terminal PROPERTY INTERPROCEDURAL_OPTIMIZATION True)

set_property(TARGET ids2hypertrie PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
set_property(TARGET rdf2ids PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
endif ()

option(TENTRIS_BUILD_TESTS "build tests alongside the project" OFF)
if (TENTRIS_BUILD_TESTS)
enable_testing() # enable this to enable testing
add_subdirectory(tests)
endif ()
add_subdirectory(libs)
Loading

0 comments on commit 3733291

Please sign in to comment.