Skip to content

Commit

Permalink
simplified handling of dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
drexlerd committed Jan 8, 2024
1 parent 9f68446 commit 67b6354
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 41 deletions.
14 changes: 3 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,38 +61,30 @@ configure_ccache()

# Boost
# Find Boost headers only according to https://cmake.org/cmake/help/latest/module/FindBoost.html
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/dependencies/build/boost/boost-prefix/src/boost")
configure_boost()
find_package(Boost ${BOOST_MIN_VERSION} REQUIRED)
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
endif()

#include_directories("${PROJECT_SOURCE_DIR}/external/flatbuffers/include")


##############################################################
# Add library and executable targets
##############################################################

# Add FlatBuffers directly to our build. This defines the `flatbuffers` target.
#set(FLATBUFFERS_MAX_PARSING_DEPTH 16)
#set(FLATBUFFERS_SRC_DIR "${PROJECT_SOURCE_DIR}/external/flatbuffers/")
#add_subdirectory(${FLATBUFFERS_SRC_DIR}
# ${CMAKE_CURRENT_BINARY_DIR}/flatbuffers-build
# EXCLUDE_FROM_ALL)

add_subdirectory(src)

add_subdirectory(exe)

add_subdirectory(examples)

if (ENABLE_TESTING)
add_subdirectory(tests)
add_subdirectory(tests)
endif()

if (ENABLE_BENCHMARKING)
add_subdirectory(benchmarks)
add_subdirectory(benchmarks)
endif()


Expand Down
33 changes: 8 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ Loki depends on a fraction of Boost's (boost.org) header-only libraries.
- Spirit x3
- Container

We provide a cmake project that takes care of downloading, building, and installing all dependencies.
Loki also uses additional dependencies [GoogleBenchmark](https://github.com/google/benchmark), and [GoogleTest](https://github.com/google/googletest) which are used in the continuous integration framework.

We provide a CMake project that takes care of downloading, building, and installing all dependencies.

```console
# Configure dependencies
Expand All @@ -42,15 +44,13 @@ cmake -S dependencies -B dependencies/build
cmake --build dependencies/build -j16
```

We also install the additional dependencies [GoogleBenchmark](https://github.com/google/benchmark), and [GoogleTest](https://github.com/google/googletest) which are used in the continuous integration framework.


## Installation

```console
# Configure with installation prefixes of all dependencies
cmake -S . -B build -DCMAKE_PREFIX_PATH="dependencies/build/boost/boost-prefix/src/boost"
# Build
cmake -S . -B build
# Build
cmake --build build -j16
# Install (optional)
cmake --install build --prefix=<path/to/installation-directory>
Expand All @@ -59,8 +59,8 @@ cmake --install build --prefix=<path/to/installation-directory>
The recommended way to integrate Loki in your CMake projects is by adding the installation directory to `CMAKE_PREFIX_PATH` and a combination of `find_package` and `target_link_libraries`:

```cmake
list(APPEND CMAKE_PREFIX_PATH "<path/to/installation-directory>")
find_package(loki 0.1 COMPONENTS parsers REQUIRED)
target_link_libraries(your_target loki::parsers)
```

Expand Down Expand Up @@ -116,28 +116,11 @@ Parsing a domain and a problem file and printing both.

## Running the Tests

The testing framework depends on [GoogleTest](https://github.com/google/googletest). Use the following altered cmake configure step

```console
cmake -S . -B build \
-DENABLE_TESTING=ON \
-DCMAKE_PREFIX_PATH="dependencies/build/boost/boost-prefix/src/boost;\
dependencies/build/googletest/googletest-prefix/src/googletest"
```

The testing framework depends on [GoogleTest](https://github.com/google/googletest) and requires the additional compile flag `-DENABLE_TESTING=ON` to be set in the cmake configure step.

## Performance Benchmarks

The benchmark framework depends on [GoogleBenchmark](https://github.com/google/benchmark). Use the following altered cmake configure step.

```console
cmake -S . -B build \
-DENABLE_TESTING=ON \
-DCMAKE_PREFIX_PATH="dependencies/build/boost/boost-prefix/src/boost;\
dependencies/build/benchmark/benchmark-prefix/src/benchmark"
```

The results from the GitHub action can be viewed [here](https://drexlerd.github.io/Loki/dev/bench/).
The benchmark framework depends on [GoogleBenchmark](https://github.com/google/benchmark) and requires the additional compile flag `-DENABLE_BENCHMARKING=ON` to be set in the cmake configure step. The results from the GitHub action can be viewed [here](https://drexlerd.github.io/Loki/dev/bench/).


## Acknowledgements
Expand Down
1 change: 1 addition & 0 deletions benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/dependencies/build/benchmark-install")
find_package(benchmark "1.8.3" REQUIRED)

add_executable(construct_atoms "construct_atoms.cpp" "utils.cpp")
Expand Down
2 changes: 1 addition & 1 deletion dependencies/benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.13)
project(InstallBenchmark)

include(ExternalProject)
Expand Down
6 changes: 3 additions & 3 deletions dependencies/boost/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.13)
project(DownloadBoost)

include(ExternalProject)
Expand All @@ -7,8 +7,8 @@ message(STATUS "Preparing external project \"boost\":")

ExternalProject_Add(
boost
URL https://boostorg.jfrog.io/artifactory/main/release/1.84.0/source/boost_1_84_0.tar.gz
# URL_HASH SHA256=a5800f405508f5df8114558ca9855d2640a2de8f0445f051fa1c7c3383045724
# URL https://boostorg.jfrog.io/artifactory/main/release/1.84.0/source/boost_1_84_0.tar.gz ## the official link is broken
URL https://archives.boost.io/release/1.84.0/source/boost_1_84_0.tar.gz
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
Expand Down
2 changes: 1 addition & 1 deletion dependencies/googletest/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.13)
project(InstallGoogletest)

include(ExternalProject)
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@

enable_testing()

list(APPEND CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/dependencies/build/googletest-install")
find_package(GTest "1.11.0" REQUIRED)

file(GLOB SRC_FILES
Expand Down

0 comments on commit 67b6354

Please sign in to comment.