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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-cpplib
Commits
aacdcc54
Verified
Commit
aacdcc54
authored
3 years ago
by
Timm Fitschen
Browse files
Options
Downloads
Patches
Plain Diff
Cherry-pick changes from f-debug-build
parent
111c8ebd
No related branches found
No related tags found
2 merge requests
!33
Release 0.1
,
!32
fix windows build
Pipeline
#15221
failed
3 years ago
Stage: info
Stage: setup
Stage: test
Stage: deploy
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
CMakeLists.txt
+21
-11
21 additions, 11 deletions
CMakeLists.txt
Makefile
+15
-2
15 additions, 2 deletions
Makefile
cmake/CodeCoverage.cmake
+12
-0
12 additions, 0 deletions
cmake/CodeCoverage.cmake
conanfile.py
+5
-1
5 additions, 1 deletion
conanfile.py
doc/README_SETUP.md
+17
-8
17 additions, 8 deletions
doc/README_SETUP.md
with
70 additions
and
22 deletions
CMakeLists.txt
+
21
−
11
View file @
aacdcc54
...
...
@@ -51,7 +51,7 @@ ENDIF()
###########################################
message
(
STATUS
"Build directory
${
CMAKE_BINARY_DIR
}
"
)
include
(
${
CMAKE_BINARY_DIR
}
/conanbuildinfo.cmake
)
conan_basic_setup
()
conan_basic_setup
(
KEEP_RPATHS
)
# fix grpc - remove unsecure (no-op ssl implementations)
string
(
REGEX REPLACE
"grpc
\\
+?
\\
+?_unsecure"
""
CONAN_LIBS_GRPC
...
...
@@ -63,6 +63,8 @@ string(REGEX REPLACE "grpc\\+?\\+?_unsecure" "" CONAN_LIBS
string
(
REGEX REPLACE
"grpc
\\
+?
\\
+?_unsecure"
""
CONAN_PKG_LIBS
"
${
CONAN_PKG_LIBS
}
"
)
message
(
STATUS
"CONAN_LIBS:
${
CONAN_LIBS
}
"
)
###########################################
### GENERAL SETUP of SOURCES
###########################################
...
...
@@ -145,17 +147,20 @@ add_custom_command(
###############################################################################
if
(
"
${
CMAKE_BUILD_TYPE
}
"
MATCHES
"Debug"
)
add_library
(
caosdb_grpc SHARED
${
GRPC_GENERATED
}
)
add_library
(
caosdb SHARED
${
libcaosdb_INCL
}
${
libcaosdb_SRC
}
)
add_library
(
caosdb_grpc SHARED
${
GRPC_GENERATED
}
)
add_library
(
caosdb SHARED
${
libcaosdb_INCL
}
${
libcaosdb_SRC
}
)
target_link_libraries
(
caosdb caosdb_grpc
)
target_link_libraries
(
caosdb_grpc
${
CONAN_LIBS
}
)
set
(
LIBCAOSDB caosdb caosdb_grpc
)
target_include_directories
(
caosdb_grpc SYSTEM PUBLIC
${
CONAN_INCLUDE_DIRS
}
)
target_include_directories
(
caosdb_grpc PUBLIC
$<BUILD_INTERFACE:
${
libcaosdb_SOURCE_DIR
}
/include>
$<BUILD_INTERFACE:
${
libcaosdb_BINARY_DIR
}
/include>
$<INSTALL_INTERFACE:include>
${
CONAN_INCLUDE_DIRS
}
)
else
()
add_library
(
caosdb
...
...
@@ -165,11 +170,13 @@ endif()
target_link_libraries
(
caosdb
${
CONAN_LIBS
}
)
target_include_directories
(
caosdb SYSTEM PUBLIC
${
CONAN_INCLUDE_DIRS
}
)
target_include_directories
(
caosdb PUBLIC
$<BUILD_INTERFACE:
${
libcaosdb_SOURCE_DIR
}
/include>
$<BUILD_INTERFACE:
${
libcaosdb_BINARY_DIR
}
/include>
$<INSTALL_INTERFACE:include>
${
CONAN_INCLUDE_DIRS
}
)
add_library
(
ccaosdb SHARED src/ccaosdb.cpp
)
...
...
@@ -179,11 +186,13 @@ target_link_libraries(ccaosdb
)
add_executable
(
ccaosdbcli EXCLUDE_FROM_ALL src/ccaosdbcli.c
)
target_include_directories
(
ccaosdbcli SYSTEM PUBLIC
${
CONAN_INCLUDE_DIRS
}
)
target_include_directories
(
ccaosdbcli PUBLIC
$<BUILD_INTERFACE:
${
libcaosdb_SOURCE_DIR
}
/include>
$<BUILD_INTERFACE:
${
libcaosdb_BINARY_DIR
}
/include>
$<INSTALL_INTERFACE:include>
${
CONAN_INCLUDE_DIRS
}
)
target_link_libraries
(
ccaosdbcli
ccaosdb
...
...
@@ -191,11 +200,13 @@ target_link_libraries(ccaosdbcli
)
add_executable
(
cxxcaosdbcli EXCLUDE_FROM_ALL src/cxxcaosdbcli.cpp
)
target_include_directories
(
cxxcaosdbcli SYSTEM PUBLIC
${
CONAN_INCLUDE_DIRS
}
)
target_include_directories
(
cxxcaosdbcli PUBLIC
$<BUILD_INTERFACE:
${
libcaosdb_SOURCE_DIR
}
/include>
$<BUILD_INTERFACE:
${
libcaosdb_BINARY_DIR
}
/include>
$<INSTALL_INTERFACE:include>
${
CONAN_INCLUDE_DIRS
}
)
target_link_libraries
(
cxxcaosdbcli
${
LIBCAOSDB
}
...
...
@@ -203,7 +214,6 @@ target_link_libraries(cxxcaosdbcli
)
#######################################################
### LINTING with CLANG-TIDY and INCLUDE-WHAT-YOU-USE
#######################################################
...
...
@@ -242,15 +252,15 @@ endfunction()
option
(
LINTING
"Enable linting with clang-tidy and iwyu when in non-Debug build-type"
OFF
)
if
(
"
${
CMAKE_BUILD_TYPE
}
"
MATCHES
"Debug"
OR LINTING
)
if
(
clang_tidy
AND
(
"
${
CMAKE_BUILD_TYPE
}
"
MATCHES
"Debug"
OR LINTING
)
)
set
(
_LINTING ON
)
endif
()
option
(
SKIP_LINTING
"Skip linting even when in Debug build-type"
OFF
)
if
(
"
${
CMAKE_BUILD_TYPE
}
"
MATCHES
"Debug"
AND SKIP_LINTING
)
if
(
"
${
CMAKE_BUILD_TYPE
}
"
MATCHES
"Debug"
AND SKIP_LINTING
)
message
(
WARNING
"Skipping linting due to SKIP_LINTING option"
)
set
(
_LINTING OFF
)
endif
()
if
(
_LINTING
)
if
(
_LINTING
)
### set paranoid compiler flags
add_compiler_flag
(
"-Wall"
)
...
...
This diff is collapsed.
Click to expand it.
Makefile
+
15
−
2
View file @
aacdcc54
...
...
@@ -37,7 +37,7 @@ else
DETECTED_OS
:=
$(
patsubst MINGW%,MSYS,
$(
DETECTED_OS
))
endif
ifeq
($(DETECTED_OS),Darwin)
# Test if we are on MacOS
CONAN_SETTINGS
:=
"cppstd=1
1
"
CONAN_SETTINGS
:=
"
compiler.
cppstd=1
7
"
endif
...
...
@@ -53,14 +53,27 @@ style:
.PHONY
:
style
conan-install
:
conan
install
.
-s
$(
CONAN_SETTINGS
)
||
\
conan
install
.
-s
$(
CONAN_SETTINGS
)
||
\
(
echo
"'conan install' failed, trying to build from sources..."
;
\
conan
install
.
-s
$(
CONAN_SETTINGS
)
--build
=
missing
)
.PHONY
:
conan-install
conan-install-debug
:
conan
install
.
-s
$(
CONAN_SETTINGS
)
-s
build_type
=
Debug
||
\
(
echo
"'conan install' failed, trying to build from sources..."
;
\
conan
install
.
-s
$(
CONAN_SETTINGS
)
-s
build_type
=
Debug
--build
=
missing
)
.PHONY
:
conan-install-debug
conan-create
:
conan create
.
-s
$(
CONAN_SETTINGS
)
.PHONY
:
conan-create
conan-create-debug
:
conan create
.
-s
$(
CONAN_SETTINGS
)
-s
build_type
=
Debug
.PHONY
:
conan-create-debug
conan
:
conan-install conan-create
.PHONY
:
conan
conan-debug
:
conan-install-debug conan-create-debug
.PHONY
:
conan-debug
This diff is collapsed.
Click to expand it.
cmake/CodeCoverage.cmake
+
12
−
0
View file @
aacdcc54
...
...
@@ -136,6 +136,18 @@
include
(
CMakeParseArguments
)
option
(
CODE_COVERAGE_VERBOSE
"Verbose information"
FALSE
)
option
(
SKIP_CODE_COVERAGE
"Skip code coverage"
OFF
)
if
(
SKIP_CODE_COVERAGE
)
return
()
endif
()
find_library
(
covlib NAMES gcov lcov
)
message
(
STATUS
"covlib: >
${
covlib
}
<"
)
if
(
${
covlib
}
STREQUAL
"covlib-NOTFOUND"
)
message
(
STATUS
"lcov or gcov libraries not found, skipping code coverage."
)
return
()
endif
()
# Check prereqs
find_program
(
GCOV_PATH gcov
)
...
...
This diff is collapsed.
Click to expand it.
conanfile.py
+
5
−
1
View file @
aacdcc54
...
...
@@ -13,7 +13,11 @@ class CaosdbConan(ConanFile):
options
=
{
"
shared
"
:
[
True
,
False
],
"
fPIC
"
:
[
True
,
False
]}
default_options
=
{
"
shared
"
:
False
,
"
fPIC
"
:
True
}
generators
=
"
cmake
"
requires
=
[(
"
boost/1.76.0
"
),
(
"
gtest/1.11.0
"
),
(
"
grpc/1.38.0
"
)]
requires
=
[
(
"
boost/1.77.0
"
),
(
"
gtest/1.11.0
"
),
(
"
grpc/1.39.1
"
),
]
exports
=
"
*.cpp
"
,
"
*.h
"
,
"
*.cmake
"
,
"
*CMakeLists.txt
"
,
"
*.in
"
,
"
*.proto
"
,
"
*.c
"
exports_sources
=
"
src
"
,
"
doc
"
,
"
include
"
,
"
test
"
,
"
cmake
"
,
"
proto
"
...
...
This diff is collapsed.
Click to expand it.
doc/README_SETUP.md
+
17
−
8
View file @
aacdcc54
...
...
@@ -6,7 +6,7 @@
## Build
We use
[
cmake
](
https://cmake.org
)
as build tool.
We use
[
cmake
](
https://cmake.org
)
as build tool
and assume gcc as compiler
.
0.
clone/update the subrepo
`git submodule update --init proto`
1.
`mkdir build && cd build`
...
...
@@ -25,9 +25,9 @@ command (3.).
### How to build on MacOS
Instead of the above conan command (2.) use
If you use apple-clang as the compiler:
Instead of the above conan command (2.) use
2.
`conan install .. -s "cppstd=1
1
"`
2.
`conan install .. -s "
compiler.
cppstd=1
7
"`
and continue as you would when building on a Linux system. You may
have to add
`build/lib/`
(or, alternatively after installation,
...
...
@@ -37,7 +37,8 @@ variable.
#### Problems and solutions ####
-
Make sure that your conan version supports your XCode version. A typical symptom of version
mismatch is for example conan complaining about incompatible
`compiler.version`
settings.
mismatch is for example conan complaining about incompatible
`compiler.version`
settings. You may
need to rerun any conan and cmake commands (and delete cache files first) after compiler updates.
### How to build on Windows
...
...
@@ -73,6 +74,13 @@ dependencies.
Depending on the clang version it might be necessary to use additionally the following flag:
`-DCMAKE_CXX_FLAGS="-Wno-unused-parameter"`
#### conan uses outdated cppstd during install
If you experience compiler errors during a
`conan install`
process due
to, e.g.,
`std::string_view`
being unavailable, try specifying the cpp
standard manually by
`conan install .. [other options] -s
"compiler.cppstd=17"`
.
## Unit Tests
### Build
...
...
@@ -80,12 +88,13 @@ Depending on the clang version it might be necessary to use additionally the fol
For the tests there is a slightly different setup required (with option
`-D CMAKE_BUILD_TYPE=Debug`
)
1.
`mkdir build && cd build/`
2.
`conan install .. -s "compiler.libcxx=libstdc++11"`
2.
`conan install .. `
(with gcc, append
` -s "compiler.libcxx=libstdc++11"`
, with apple-clang,
append
` -s compiler.cppstd=17`
)
3.
`cmake -B . -D CMAKE_BUILD_TYPE=Debug ..`
*
If your clang-format version is too old, formatting, linting etc. can be skipped:
`cmake -B . -D CMAKE_BUILD_TYPE=Debug -D SKIP_LINTING=ON ..`
*
If your clang-format version is too old, formatting, linting etc. can be skipped:
`cmake -B . -D CMAKE_BUILD_TYPE=Debug -D SKIP_LINTING=ON ..`
*
Depending on the clang version it might be necessary to also add
`-DCMAKE_CXX_FLAGS="-Wno-unused-parameter"`
`-DCMAKE_CXX_FLAGS="-Wno-unused-parameter"`
5.
`cmake --build .`
### Run
...
...
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