Skip to content
Snippets Groups Projects
Verified Commit e2665622 authored by Timm Fitschen's avatar Timm Fitschen
Browse files

WIP: conan

parent cdaa27ce
No related branches found
No related tags found
No related merge requests found
Pipeline #9481 failed
...@@ -8,38 +8,13 @@ RUN apt-get install -y doxygen ...@@ -8,38 +8,13 @@ RUN apt-get install -y doxygen
RUN apt-get install -y clang-format-11 clang-tidy-11 RUN apt-get install -y clang-format-11 clang-tidy-11
RUN apt-get install -y python3-pip RUN apt-get install -y python3-pip
RUN apt-get install -y git RUN apt-get install -y git
COPY doc/requirements.txt requirements.txt
RUN pip3 install -r requirements.txt
RUN apt-get install -y build-essential autoconf libtool pkg-config
RUN git clone --recurse-submodules -b v1.38.1 https://github.com/grpc/grpc
WORKDIR /grpc
RUN mkdir -p cmake/build
WORKDIR cmake/build
RUN cmake -DgRPC_INSTALL=ON \
-DgRPC_BUILD_CSHARP_EXT=OFF \
-DgRPC_BUILD_GRPC_CSHARP_PLUGIN=OFF \
-DgRPC_BUILD_GRPC_PYTHON_PLUGIN=OFF \
-DgRPC_BUILD_GRPC_RUBY_PLUGIN=OFF \
-DgRPC_BUILD_GRPC_PHP_PLUGIN=OFF \
-DgRPC_BUILD_GRPC_OBJECTIVE_C_PLUGIN=OFF \
-DgRPC_BUILD_GRPC_NODE_PLUGIN=OFF \
-DgRPC_BUILD_TESTS=OFF \
../..
RUN make -j
RUN make install
WORKDIR /grpc
RUN mkdir -p third_party/abseil-cpp/cmake/build
WORKDIR third_party/abseil-cpp/cmake/build
RUN cmake -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE \
../..
RUN make -j
RUN make install
RUN apt-get install -y curl RUN apt-get install -y curl
COPY doc/requirements.txt doc-requirements.txt
RUN pip3 install -r doc-requirements.txt
COPY requirements.txt build-requirements.txt
RUN pip3 install -r build-requirements.txt
COPY . /libcaosdb/ COPY . /libcaosdb/
WORKDIR /libcaosdb WORKDIR /libcaosdb
RUN rm -rf .git RUN rm -rf .git
...@@ -62,7 +62,7 @@ build-testenv: ...@@ -62,7 +62,7 @@ build-testenv:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
# use here general latest or specific branch latest... # use here general latest or specific branch latest...
- docker pull $CPPLIB_REGISTRY_IMAGE|| true - docker pull $CPPLIB_REGISTRY_IMAGE|| true
- docker build - docker build
--file .docker/Dockerfile --file .docker/Dockerfile
--pull --pull
--cache-from $CPPLIB_REGISTRY_IMAGE --cache-from $CPPLIB_REGISTRY_IMAGE
...@@ -84,7 +84,8 @@ test: ...@@ -84,7 +84,8 @@ test:
script: script:
- mkdir build - mkdir build
- cd build - cd build
- cmake -DGRPC_FETCHCONTENT=OFF -DCMAKE_BUILD_TYPE=Debug .. - conan install ..
- cmake -DCMAKE_BUILD_TYPE=Debug ..
- cmake --build . - cmake --build .
- cmake --build . --target unit_test_coverage - cmake --build . --target unit_test_coverage
......
...@@ -34,6 +34,11 @@ set(CMAKE_CXX_STANDARD 17) ...@@ -34,6 +34,11 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
# dependency management with conan
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
set(PROJECT_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/include") set(PROJECT_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/include")
find_program(iwyu NAMES include-what-you-use iwyu PATHS ${CMAKE_SOURCE_DIR}/tools/include-what-you-use/${iwyu_os}/bin) find_program(iwyu NAMES include-what-you-use iwyu PATHS ${CMAKE_SOURCE_DIR}/tools/include-what-you-use/${iwyu_os}/bin)
...@@ -68,7 +73,7 @@ set_target_properties(caosdbcli PROPERTIES ...@@ -68,7 +73,7 @@ set_target_properties(caosdbcli PROPERTIES
CXX_CLANG_TIDY "${_CMAKE_CXX_CLANG_TIDY}" CXX_CLANG_TIDY "${_CMAKE_CXX_CLANG_TIDY}"
CXX_INCLUDE_WHAT_YOU_USE "${_CMAKE_CXX_INCLUDE_WHAT_YOU_USE}" CXX_INCLUDE_WHAT_YOU_USE "${_CMAKE_CXX_INCLUDE_WHAT_YOU_USE}"
) )
target_link_libraries(caosdbcli caosdb) target_link_libraries(caosdbcli caosdb ${CONAN_LIBS})
if("${CMAKE_BUILD_TYPE}" MATCHES "Debug") if("${CMAKE_BUILD_TYPE}" MATCHES "Debug")
# supress warnings during build of gtest # supress warnings during build of gtest
...@@ -83,8 +88,8 @@ endif() ...@@ -83,8 +88,8 @@ endif()
## CODE GENERATION ## CODE GENERATION
option(GRPC_FETCHCONTENT "Fetch and build GRPC from the sources" OFF) #option(GRPC_FETCHCONTENT "Fetch and build GRPC from the sources" OFF)
include(FetchGRPC) #include(FetchGRPC)
# #
# Protobuf/Grpc source files # Protobuf/Grpc source files
...@@ -103,11 +108,11 @@ set(hw_grpc_srcs "${CMAKE_CURRENT_BINARY_DIR}/include/caosdb/info/v1alpha1/main. ...@@ -103,11 +108,11 @@ set(hw_grpc_srcs "${CMAKE_CURRENT_BINARY_DIR}/include/caosdb/info/v1alpha1/main.
set(hw_grpc_hdrs "${CMAKE_CURRENT_BINARY_DIR}/include/${hw_hdrs_path}/main.grpc.pb.h") set(hw_grpc_hdrs "${CMAKE_CURRENT_BINARY_DIR}/include/${hw_hdrs_path}/main.grpc.pb.h")
add_custom_command( add_custom_command(
OUTPUT "${hw_proto_srcs}" "${hw_proto_hdrs}" "${hw_grpc_srcs}" "${hw_grpc_hdrs}" OUTPUT "${hw_proto_srcs}" "${hw_proto_hdrs}" "${hw_grpc_srcs}" "${hw_grpc_hdrs}"
COMMAND ${_PROTOBUF_PROTOC} COMMAND ${CMAKE_BINARY_DIR}/build_tools/protoc
ARGS --grpc_out "${CMAKE_CURRENT_BINARY_DIR}/include" ARGS --grpc_out "${CMAKE_CURRENT_BINARY_DIR}/include"
--cpp_out "${CMAKE_CURRENT_BINARY_DIR}/include" --cpp_out "${CMAKE_CURRENT_BINARY_DIR}/include"
-I "${PROTO_PATH}" -I "${PROTO_PATH}"
--plugin=protoc-gen-grpc="${_GRPC_CPP_PLUGIN_EXECUTABLE}" --plugin=protoc-gen-grpc="${CMAKE_BINARY_DIR}/build_tools/grpc_cpp_plugin"
"${PROTO_FILES}" "${PROTO_FILES}"
DEPENDS "${PROTO_FILES}") DEPENDS "${PROTO_FILES}")
...@@ -120,9 +125,7 @@ add_library(caosdb_info_v1alpha1 ...@@ -120,9 +125,7 @@ add_library(caosdb_info_v1alpha1
${hw_proto_srcs} ${hw_proto_srcs}
${hw_proto_hdrs}) ${hw_proto_hdrs})
target_link_libraries(caosdb_info_v1alpha1 target_link_libraries(caosdb_info_v1alpha1
${_REFLECTION} ${CONAN_LIBS})
${_GRPC_GRPCPP}
${_PROTOBUF_LIBPROTOBUF})
target_include_directories(caosdb_info_v1alpha1 PUBLIC target_include_directories(caosdb_info_v1alpha1 PUBLIC
# headers to include when building from source # headers to include when building from source
$<BUILD_INTERFACE:${libcaosdb_SOURCE_DIR}/include> $<BUILD_INTERFACE:${libcaosdb_SOURCE_DIR}/include>
...@@ -131,10 +134,8 @@ target_include_directories(caosdb_info_v1alpha1 PUBLIC ...@@ -131,10 +134,8 @@ target_include_directories(caosdb_info_v1alpha1 PUBLIC
) )
target_link_libraries(caosdb target_link_libraries(caosdb
caosdb_info_v1alpha1 caosdb_info_v1alpha1
${_REFLECTION} ${CONAN_LIBS})
${_GRPC_GRPCPP}
${_PROTOBUF_LIBPROTOBUF})
############################################### ###############################################
...@@ -196,7 +197,7 @@ install( ...@@ -196,7 +197,7 @@ install(
TARGETS TARGETS
caosdb caosdb
caosdb_info_v1alpha1 caosdb_info_v1alpha1
${_GRPC_DEPS} #${CONAN_LIBS_GRPC}
# name of the CMake "export group" containing the targets we want to install # name of the CMake "export group" containing the targets we want to install
EXPORT caosdbTargets EXPORT caosdbTargets
# Dynamic, static library and include destination locations after running # Dynamic, static library and include destination locations after running
......
[requires]
boost/1.76.0
grpc/1.38.0
[generators]
cmake
[imports]
bin, protoc* -> ./build_tools
bin, grpc_cpp_plugin* -> ./build_tools
...@@ -20,9 +20,6 @@ ...@@ -20,9 +20,6 @@
* *
*/ */
#include "caosdb/connection.h"
#include "caosdb/utils.h"
#include "caosdb/authentication.h"
#include <grpcpp/create_channel.h> #include <grpcpp/create_channel.h>
#include <grpcpp/impl/codegen/client_context.h> #include <grpcpp/impl/codegen/client_context.h>
#include <grpcpp/impl/codegen/status.h> #include <grpcpp/impl/codegen/status.h>
...@@ -33,6 +30,9 @@ ...@@ -33,6 +30,9 @@
#include "caosdb/info/v1alpha1/main.grpc.pb.h" #include "caosdb/info/v1alpha1/main.grpc.pb.h"
#include "caosdb/info/v1alpha1/main.pb.h" #include "caosdb/info/v1alpha1/main.pb.h"
#include "caosdb/exceptions.h" #include "caosdb/exceptions.h"
#include "caosdb/connection.h"
#include "caosdb/utils.h"
#include "caosdb/authentication.h"
namespace caosdb::connection { namespace caosdb::connection {
using caosdb::authentication::Authenticator; using caosdb::authentication::Authenticator;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment