Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-cpplib
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-cpplib
Commits
ef0b362f
Verified
Commit
ef0b362f
authored
4 years ago
by
Timm Fitschen
Browse files
Options
Downloads
Patches
Plain Diff
WIP: pipeline
parent
4234f650
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#8218
passed with warnings
4 years ago
Stage: setup
Stage: test
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
.docker/Dockerfile
+28
-5
28 additions, 5 deletions
.docker/Dockerfile
.gitlab-ci.yml
+2
-4
2 additions, 4 deletions
.gitlab-ci.yml
CMakeLists.txt
+28
-26
28 additions, 26 deletions
CMakeLists.txt
cmake/FetchGRPC.cmake
+100
-26
100 additions, 26 deletions
cmake/FetchGRPC.cmake
with
158 additions
and
61 deletions
.docker/Dockerfile
+
28
−
5
View file @
ef0b362f
...
...
@@ -2,17 +2,40 @@ FROM debian:latest
RUN
echo
"deb http://deb.debian.org/debian buster-backports main"
>
/etc/apt/sources.list.d/buster-backports.list
RUN
apt-get update
RUN
apt-get
install
-y
cmake
RUN
apt-get
install
-y
cmake
/buster-backports
RUN
apt-get
install
-y
lcov
RUN
apt-get
install
-y
doxygen
RUN
apt-get
install
-y
clang-format-11 clang-tidy-11
RUN
apt-get
install
-y
python3-pip
RUN
apt-get
install
-y
git
COPY
doc/requirements.txt requirements.txt
RUN
pip3
install
-r
requirements.txt
RUN
echo
"deb http://ftp.de.debian.org/debian buster-backports main"
>
/etc/apt/sources.list.d/buster-backports.list
RUN
apt-get update
RUN
apt-get
install
-y
cmake/buster-backports
RUN
apt-get
install
-y
git
RUN
apt-get
install
-y
build-essential autoconf libtool pkg-config
RUN
git clone
--recurse-submodules
-b
v1.38.0 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
# TODO build stuff
This diff is collapsed.
Click to expand it.
.gitlab-ci.yml
+
2
−
4
View file @
ef0b362f
...
...
@@ -60,10 +60,9 @@ test:
tags
:
[
docker
]
stage
:
test
script
:
-
cmake --version
-
mkdir build
-
cd build
-
cmake -DCMAKE_BUILD_TYPE=Debug ..
-
cmake
-DGRPC_FETCHCONTENT=OFF
-DCMAKE_BUILD_TYPE=Debug ..
-
cmake --build .
-
cmake --build . --target unit_test_coverage
...
...
@@ -87,5 +86,4 @@ pages_prepare: &pages_prepare
pages
:
<<
:
*pages_prepare
only
:
refs
:
-
main
-
schedule
This diff is collapsed.
Click to expand it.
CMakeLists.txt
+
28
−
26
View file @
ef0b362f
...
...
@@ -112,33 +112,34 @@ target_include_directories(caosdb PUBLIC
)
## Install libcaosdb in CMAKE_INSTALL_PREFIX (defaults to /usr/local on linux).
## To change the install location, run
## cmake -DCMAKE_INSTALL_PREFIX=<desired-install-path> ..
## install(...) specifies installation rules for the project. It can specify
## location of installed files on the system, user permissions, build
## configurations, etc. Here, we are only copying files.
## install(TARGETS ...) specifies rules for installing targets.
## Here, we are taking a target or list of targets (libcosdb) and telling
## CMake the following:
## - put shared libraries associated with libcaosdb in ${libcaosdb_LIB_DEST}
## - put static libraries associated with libcaosdb in ${libcaosdb_LIB_DEST}
## - put include files associated with libcaosdb in ${libcaosdb_INCLUDE_DEST}
## We also need to specify the export that is associated with libcaosdb; an
## export is just a list of targets to be installed. So we are associating
## libcaosdb with libcaosdbTargets.
#install(
## targets to install
#TARGETS caosdb
## name of the CMake "export group" containing the targets we want to install
set
(
CMAKE_INSTALL_PREFIX
"$ENV{HOME}/libcaosdb/"
)
# Install libcaosdb in CMAKE_INSTALL_PREFIX (defaults to /usr/local on linux).
# To change the install location, run
# cmake -DCMAKE_INSTALL_PREFIX=<desired-install-path> ..
# install(...) specifies installation rules for the project. It can specify
# location of installed files on the system, user permissions, build
# configurations, etc. Here, we are only copying files.
# install(TARGETS ...) specifies rules for installing targets.
# Here, we are taking a target or list of targets (libcosdb) and telling
# CMake the following:
# - put shared libraries associated with libcaosdb in ${libcaosdb_LIB_DEST}
# - put static libraries associated with libcaosdb in ${libcaosdb_LIB_DEST}
# - put include files associated with libcaosdb in ${libcaosdb_INCLUDE_DEST}
# We also need to specify the export that is associated with libcaosdb; an
# export is just a list of targets to be installed. So we are associating
# libcaosdb with libcaosdbTargets.
install
(
# targets to install
TARGETS caosdb
# name of the CMake "export group" containing the targets we want to install
#EXPORT libcaosdbTargets
#
#
Dynamic, static library and include destination locations after running
#
#
"make install"
#
LIBRARY DESTINATION ${libcaosdb_LIB_DEST}
#
ARCHIVE DESTINATION ${libcaosdb_LIB_DEST}
# Dynamic, static library and include destination locations after running
# "make install"
LIBRARY DESTINATION
${
libcaosdb_LIB_DEST
}
ARCHIVE DESTINATION
${
libcaosdb_LIB_DEST
}
#INCLUDES DESTINATION ${libcaosdb_INCLUDE_DEST}
#
)
)
# We now need to install the export libcaosdbTargets that we defined above.
...
...
@@ -166,11 +167,12 @@ target_include_directories(caosdb PUBLIC
## install(FILES ...) simply puts files in a certain place with certain
## properties. We're just copying them to the desired place here.
#
install(FILES ${libcaosdb_INC} DESTINATION ${libcaosdb_INCLUDE_DEST})
install
(
FILES
${
libcaosdb_INC
}
DESTINATION
${
libcaosdb_INCLUDE_DEST
}
)
## CODE GENERATION
option
(
GRPC_FETCHCONTENT
"Fetch and build GRPC from the sources"
ON
)
include
(
FetchGRPC
)
#
...
...
This diff is collapsed.
Click to expand it.
cmake/FetchGRPC.cmake
+
100
−
26
View file @
ef0b362f
...
...
@@ -25,18 +25,6 @@ endif()
find_package
(
Threads REQUIRED
)
# Another way is to use CMake's FetchContent module to clone gRPC at
# configure time. This makes gRPC's source code available to your project,
# similar to a git submodule.
message
(
STATUS
"Using gRPC via add_subdirectory (FetchContent)."
)
include
(
FetchContent
)
FetchContent_Declare
(
grpc
GIT_REPOSITORY https://github.com/grpc/grpc.git
GIT_TAG v1.38.0
GIT_SHALLOW 1
)
# disable a lot of stuff
set
(
gRPC_BUILD_TESTS OFF
)
set
(
gRPC_BUILD_CSHARP_EXT OFF
)
...
...
@@ -47,7 +35,60 @@ set(gRPC_BUILD_GRPC_PHP_PLUGIN OFF)
set
(
gRPC_BUILD_GRPC_OBJECTIVE_C_PLUGIN OFF
)
set
(
gRPC_BUILD_GRPC_NODE_PLUGIN OFF
)
set
(
protobuf_BUILD_TESTS OFF
)
set
(
vGRPC_TAG_VERSION_OF_YOUR_CHOICE
"v1.38.0"
)
if
(
GRPC_AS_SUBMODULE
)
# One way to build a projects that uses gRPC is to just include the
# entire gRPC project tree via "add_subdirectory".
# This approach is very simple to use, but the are some potential
# disadvantages:
# * it includes gRPC's CMakeLists.txt directly into your build script
# without and that can make gRPC's internal setting interfere with your
# own build.
# * depending on what's installed on your system, the contents of submodules
# in gRPC's third_party/* might need to be available (and there might be
# additional prerequisites required to build them). Consider using
# the gRPC_*_PROVIDER options to fine-tune the expected behavior.
#
# A more robust approach to add dependency on gRPC is using
# cmake's ExternalProject_Add (see cmake_externalproject/CMakeLists.txt).
# Include the gRPC's cmake build (normally grpc source code would live
# in a git submodule called "third_party/grpc", but this example lives in
# the same repository as gRPC sources, so we just look a few directories up)
add_subdirectory
(
../../..
${
CMAKE_CURRENT_BINARY_DIR
}
/grpc EXCLUDE_FROM_ALL
)
message
(
STATUS
"Using gRPC via add_subdirectory."
)
# After using add_subdirectory, we can now use the grpc targets directly from
# this build.
set
(
_PROTOBUF_LIBPROTOBUF libprotobuf
)
set
(
_REFLECTION grpc++_reflection
)
if
(
CMAKE_CROSSCOMPILING
)
find_program
(
_PROTOBUF_PROTOC protoc
)
else
()
set
(
_PROTOBUF_PROTOC $<TARGET_FILE:protobuf::protoc>
)
endif
()
set
(
_GRPC_GRPCPP grpc++
)
if
(
CMAKE_CROSSCOMPILING
)
find_program
(
_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin
)
else
()
set
(
_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:grpc_cpp_plugin>
)
endif
()
elseif
(
GRPC_FETCHCONTENT
)
# Another way is to use CMake's FetchContent module to clone gRPC at
# configure time. This makes gRPC's source code available to your project,
# similar to a git submodule.
message
(
STATUS
"Using gRPC via add_subdirectory (FetchContent)."
)
include
(
FetchContent
)
FetchContent_Declare
(
grpc
GIT_REPOSITORY https://github.com/grpc/grpc.git
# when using gRPC, you will actually set this to an existing tag, such as
# v1.25.0, v1.26.0 etc..
# For the purpose of testing, we override the tag used to the commit
# that's currently under test.
GIT_TAG vGRPC_TAG_VERSION_OF_YOUR_CHOICE
GIT_SHALLOW 1
)
FetchContent_MakeAvailable
(
grpc
)
# Since FetchContent uses add_subdirectory under the hood, we can use
...
...
@@ -62,6 +103,7 @@ else()
set
(
_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:grpc_cpp_plugin>
)
endif
()
## disable more unused stuff
set_target_properties
(
zlibstatic
libprotobuf
...
...
@@ -184,4 +226,36 @@ set_target_properties(
PROPERTIES
CXX_CLANG_TIDY
""
CXX_INCLUDE_WHAT_YOU_USE
""
EXCLUDE_FROM_ALL 1
)
EXCLUDE_FROM_ALL 1
)
else
()
# This branch assumes that gRPC and all its dependencies are already installed
# on this system, so they can be located by find_package().
# Find Protobuf installation
# Looks for protobuf-config.cmake file installed by Protobuf's cmake installation.
set
(
protobuf_MODULE_COMPATIBLE TRUE
)
find_package
(
Protobuf CONFIG REQUIRED
)
message
(
STATUS
"Using protobuf
${
Protobuf_VERSION
}
"
)
set
(
_PROTOBUF_LIBPROTOBUF protobuf::libprotobuf
)
set
(
_REFLECTION gRPC::grpc++_reflection
)
if
(
CMAKE_CROSSCOMPILING
)
find_program
(
_PROTOBUF_PROTOC protoc
)
else
()
set
(
_PROTOBUF_PROTOC $<TARGET_FILE:protobuf::protoc>
)
endif
()
# Find gRPC installation
# Looks for gRPCConfig.cmake file installed by gRPC's cmake installation.
find_package
(
gRPC CONFIG REQUIRED
)
message
(
STATUS
"Using gRPC
${
gRPC_VERSION
}
"
)
set
(
_GRPC_GRPCPP gRPC::grpc++
)
if
(
CMAKE_CROSSCOMPILING
)
find_program
(
_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin
)
else
()
set
(
_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:gRPC::grpc_cpp_plugin>
)
endif
()
endif
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment