Skip to content

Commit

Permalink
feat(cmake): Move to find_package
Browse files Browse the repository at this point in the history
This is preparation to unlock conan package build
for otterbrix
  • Loading branch information
SergeiNA committed Nov 27, 2024
1 parent 305f861 commit efa0ecd
Show file tree
Hide file tree
Showing 73 changed files with 262 additions and 189 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/csharp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
CC: gcc
run: |
cd build
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DDEV_MODE=ON ..
cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" -DCMAKE_BUILD_TYPE=Release -DDEV_MODE=ON ..
cmake --build .
- name: Test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
CC: gcc
run: |
cd build
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DDEV_MODE=ON -DEXAMPLE=ON ..
cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" -DCMAKE_BUILD_TYPE=Release -DDEV_MODE=ON -DEXAMPLE=ON ..
cmake --build .
- name: Test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu-20-04-aarch64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ jobs:
cp ../conanfile.txt .
conan install . --build missing -s build_type=Release
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DDEV_MODE=ON ..
cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" -DCMAKE_BUILD_TYPE=Release -DDEV_MODE=ON ..
cmake --build .
ctest -C -V --output-on-failure
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu-20-04.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
CC: gcc
run: |
cd build
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DDEV_MODE=ON -DEXAMPLE=ON ..
cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" -DCMAKE_BUILD_TYPE=Release -DDEV_MODE=ON -DEXAMPLE=ON ..
cmake --build .
- name: Test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu-22-04.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
CC: gcc
run: |
cd build
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DDEV_MODE=ON -DEXAMPLE=ON ..
cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" -DCMAKE_BUILD_TYPE=Release -DDEV_MODE=ON -DEXAMPLE=ON ..
cmake --build .
- name: Test
Expand Down
25 changes: 16 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ option(CONAN_EXPERIMENTAL_INCLUDE "CONAN EXPERIMENT INCLUDE" ON)
option(APPLICATION_SERVER "application server" OFF)

set(CMAKE_POSITION_INDEPENDENT_CODE ON)
add_definitions(-D_GNU_SOURCE)

if (DEV_MODE)
add_definitions(-DDEV_MODE)
Expand Down Expand Up @@ -82,15 +83,21 @@ find_package(Sanitizers REQUIRED)

#clang tools
#############################################################################################
#conan

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)

#include(${CMAKE_BINARY_DIR}/conan_paths.cmake)
set(CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR} ${CMAKE_MODULE_PATH})
# conan
find_package(Boost 1.86.0 REQUIRED)
find_package(fmt 10.2.1 REQUIRED)
find_package(spdlog 1.12.0 REQUIRED)
find_package(pybind11 2.10.0 REQUIRED)
find_package(msgpack 4.1.1 REQUIRED)
find_package(Catch2 2.13.7 REQUIRED)
find_package(Crc32c 1.1.2 REQUIRED)
find_package(absl 20230802.1 REQUIRED)
find_package(benchmark 1.6.1 REQUIRED)
find_package(ZLIB 1.2.12 REQUIRED)
find_package(BZip2 1.0.8 REQUIRED)
find_package(magic_enum 0.8.1 REQUIRED)
find_package(actor-zeta REQUIRED)

include_directories(SYSTEM ${CONAN_INCLUDE_DIRS})
conan_basic_setup(NO_OUTPUT_DIRS TARGETS KEEP_RPATHS)

# conan
#############################################################################################
Expand Down Expand Up @@ -141,7 +148,7 @@ include_directories(services)
add_subdirectory(services)
add_subdirectory(integration)
if(EXAMPLE)
# add_subdirectory(example)
add_subdirectory(example)
endif()


Expand Down
1 change: 1 addition & 0 deletions components/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ add_subdirectory(physical_plan_generator)
add_subdirectory(planner)
add_subdirectory(ql)
add_subdirectory(session)
add_subdirectory(context)
add_subdirectory(sql)
add_subdirectory(types)

Expand Down
28 changes: 28 additions & 0 deletions components/context/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
project(context)

set( ${PROJECT_NAME}_HEADERS
context.hpp
)

set(${PROJECT_NAME}_SOURCES
context.cpp

)

add_library(otterbrix_${PROJECT_NAME}
${${PROJECT_NAME}_HEADERS}
${${PROJECT_NAME}_SOURCES}
)

add_library(otterbrix::${PROJECT_NAME} ALIAS otterbrix_${PROJECT_NAME})

set_property(TARGET otterbrix_${PROJECT_NAME} PROPERTY EXPORT_NAME ${PROJECT_NAME})

target_link_libraries(
otterbrix_${PROJECT_NAME} PUBLIC
otterbrix::session
otterbrix::ql
actor-zeta::actor-zeta
)

target_include_directories( otterbrix_${PROJECT_NAME} PUBLIC )
File renamed without changes.
File renamed without changes.
5 changes: 3 additions & 2 deletions components/cursor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ set_property(TARGET otterbrix_${PROJECT_NAME} PROPERTY EXPORT_NAME ${PROJECT_NAM

target_link_libraries(
otterbrix_${PROJECT_NAME} PRIVATE
CONAN_PKG::actor-zeta
CONAN_PKG::boost
actor-zeta::actor-zeta
Boost::boost
absl::int128
)

target_include_directories(otterbrix_${PROJECT_NAME}
Expand Down
4 changes: 3 additions & 1 deletion components/cursor/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ target_link_libraries(
otterbrix::document
otterbrix::test_generaty
otterbrix::cursor
CONAN_PKG::boost
Boost::boost
Catch2::Catch2
actor-zeta::actor-zeta
)

include(CTest)
Expand Down
7 changes: 4 additions & 3 deletions components/document/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ target_include_directories(otterbrix_${PROJECT_NAME} PUBLIC "${CMAKE_SOURCE_DIR}
target_link_libraries(
otterbrix_${PROJECT_NAME}
otterbrix::types
CONAN_PKG::boost
CONAN_PKG::abseil
CONAN_PKG::msgpack-cxx
Boost::boost
absl::flat_hash_map
absl::node_hash_map
msgpackc-cxx
)

if (DEV_MODE)
Expand Down
2 changes: 1 addition & 1 deletion components/document/benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ target_link_libraries(
${PROJECT_NAME} PRIVATE
otterbrix::document
otterbrix::test_generaty
CONAN_PKG::benchmark
benchmark::benchmark
)

file(COPY start-perf DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
2 changes: 1 addition & 1 deletion components/document/document_id.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#include <cstdint>

#include <components/oid/oid.hpp>
#include <memory>
#include <oid/oid.hpp>

namespace components::document {

Expand Down
6 changes: 3 additions & 3 deletions components/document/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ target_link_libraries(
${PROJECT_NAME} PRIVATE
otterbrix::document
otterbrix::test_generaty
CONAN_PKG::boost
CONAN_PKG::catch2
CONAN_PKG::msgpack-cxx
Boost::boost
Catch2::Catch2
msgpackc-cxx
${CMAKE_THREAD_LIBS_INIT}
)

Expand Down
4 changes: 3 additions & 1 deletion components/expressions/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ set_property(TARGET otterbrix_${PROJECT_NAME} PROPERTY EXPORT_NAME ${PROJECT_NAM

target_link_libraries(
otterbrix_${PROJECT_NAME} PRIVATE
CONAN_PKG::boost
Boost::boost
magic_enum::magic_enum
msgpackc-cxx
)

target_include_directories(
Expand Down
4 changes: 4 additions & 0 deletions components/expressions/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ add_executable(${PROJECT_NAME} main.cpp ${${PROJECT_NAME}_SOURCES})
target_link_libraries(
${PROJECT_NAME} PRIVATE
otterbrix::expressions
Catch2::Catch2
actor-zeta::actor-zeta
magic_enum::magic_enum
msgpackc-cxx
)

include(CTest)
Expand Down
4 changes: 2 additions & 2 deletions components/index/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ target_link_libraries(
otterbrix::document
otterbrix::cursor
otterbrix::ql
otterbrix::physical_plan_generator
otterbrix::context
dl
CONAN_PKG::boost
Boost::boost
)

target_include_directories(
Expand Down
2 changes: 1 addition & 1 deletion components/index/index_engine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "core/pmr.hpp"
#include "forward.hpp"
#include "index.hpp"
#include <components/physical_plan/context.hpp>
#include <components/context/context.hpp>
#include <core/btree/btree.hpp>

namespace components::index {
Expand Down
3 changes: 2 additions & 1 deletion components/index/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ target_link_libraries(
otterbrix::document
otterbrix::index
otterbrix::test_generaty
CONAN_PKG::boost
Boost::boost
Catch2::Catch2
)

include(CTest)
Expand Down
6 changes: 3 additions & 3 deletions components/log/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ set_property(TARGET otterbrix_${CURRENT_TARGET} PROPERTY EXPORT_NAME ${CURRENT_T

target_link_libraries(
otterbrix_${CURRENT_TARGET} PUBLIC
CONAN_PKG::spdlog
CONAN_PKG::boost
CONAN_PKG::fmt
spdlog::spdlog
Boost::boost
fmt::fmt
)

target_include_directories(
Expand Down
6 changes: 3 additions & 3 deletions components/log/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ add_executable(${CURRENT_TARGET} main.cpp)
target_link_libraries(
${CURRENT_TARGET} PRIVATE
otterbrix::log
CONAN_PKG::spdlog
CONAN_PKG::boost
CONAN_PKG::fmt
spdlog::spdlog
Boost::boost
fmt::fmt
)


Expand Down
2 changes: 1 addition & 1 deletion components/logical_plan/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ target_link_libraries(
otterbrix_${PROJECT_NAME} PRIVATE
otterbrix::ql
otterbrix::types
CONAN_PKG::boost
Boost::boost
)

target_include_directories(
Expand Down
5 changes: 5 additions & 0 deletions components/oid/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ set( ${PROJECT_NAME}_SOURCES

add_executable(${PROJECT_NAME} main.cpp ${${PROJECT_NAME}_SOURCES})

target_link_libraries(
${PROJECT_NAME} PRIVATE
Catch2::Catch2
)

include(CTest)
include(Catch)
catch_discover_tests(${PROJECT_NAME})
9 changes: 4 additions & 5 deletions components/physical_plan/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ set(${PROJECT_NAME}_SOURCES
collection/operators/operator_sort.cpp
collection/operators/operator_join.cpp
collection/operators/aggregation.cpp

context.cpp
)

add_library(otterbrix_${PROJECT_NAME}
Expand All @@ -60,11 +58,12 @@ target_link_libraries(
otterbrix::types
otterbrix::cursor
otterbrix::session
otterbrix::context
otterbrix::index
otterbrix::logical_plan
CONAN_PKG::spdlog
CONAN_PKG::abseil
CONAN_PKG::boost
spdlog::spdlog
abseil::abseil
Boost::boost
)

target_include_directories(otterbrix_${PROJECT_NAME} PUBLIC
Expand Down
3 changes: 2 additions & 1 deletion components/physical_plan/collection/operators/operator.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once

#include <components/context/context.hpp>
#include <components/physical_plan/collection/operators/operator_data.hpp>
#include <components/physical_plan/collection/operators/operator_write_data.hpp>
#include <components/physical_plan/context.hpp>

namespace services::collection {

Expand Down Expand Up @@ -48,6 +48,7 @@ namespace services::collection::operators {
operator_t(context_collection_t* collection, operator_type type);
virtual ~operator_t() = default;

// TODO fwd
void on_execute(components::pipeline::context_t* pipeline_context);
void on_resume(components::pipeline::context_t* pipeline_context);
void async_wait();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <components/expressions/join_expression.hpp>
#include <components/physical_plan/collection/operators/operator.hpp>
#include <components/ql/join/join.hpp>
#include <components/ql/join/join_types.h>
#include <components/ql/join/join_types.hpp>

namespace services::collection::operators {

Expand Down
7 changes: 4 additions & 3 deletions components/physical_plan/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ target_link_libraries(
otterbrix::cursor
otterbrix::session
otterbrix::test_generaty
CONAN_PKG::spdlog
CONAN_PKG::abseil
CONAN_PKG::boost
spdlog::spdlog
absl::int128
Boost::boost
Catch2::Catch2
)

target_include_directories(${PROJECT_NAME} PUBLIC
Expand Down
9 changes: 6 additions & 3 deletions components/physical_plan_generator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@ target_link_libraries(
otterbrix::logical_plan
otterbrix::planner
otterbrix::physical_plan
CONAN_PKG::spdlog
CONAN_PKG::abseil
CONAN_PKG::boost
spdlog::spdlog
absl::int128
absl::flat_hash_map
absl::node_hash_map
Boost::boost
actor-zeta::actor-zeta
)

target_include_directories(otterbrix_${PROJECT_NAME} PUBLIC
Expand Down
9 changes: 6 additions & 3 deletions components/physical_plan_generator/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ target_link_libraries(
otterbrix::cursor
otterbrix::session
otterbrix::test_generaty
CONAN_PKG::spdlog
CONAN_PKG::abseil
CONAN_PKG::boost
spdlog::spdlog
absl::int128
absl::flat_hash_map
absl::node_hash_map
Boost::boost
Catch2::Catch2
)

target_include_directories(${PROJECT_NAME} PUBLIC
Expand Down
Loading

0 comments on commit efa0ecd

Please sign in to comment.