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
Branches
Branches containing commit
Tags
Tags containing commit
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()
...
@@ -51,7 +51,7 @@ ENDIF()
###########################################
###########################################
message
(
STATUS
"Build directory
${
CMAKE_BINARY_DIR
}
"
)
message
(
STATUS
"Build directory
${
CMAKE_BINARY_DIR
}
"
)
include
(
${
CMAKE_BINARY_DIR
}
/conanbuildinfo.cmake
)
include
(
${
CMAKE_BINARY_DIR
}
/conanbuildinfo.cmake
)
conan_basic_setup
()
conan_basic_setup
(
KEEP_RPATHS
)
# fix grpc - remove unsecure (no-op ssl implementations)
# fix grpc - remove unsecure (no-op ssl implementations)
string
(
REGEX REPLACE
"grpc
\\
+?
\\
+?_unsecure"
""
CONAN_LIBS_GRPC
string
(
REGEX REPLACE
"grpc
\\
+?
\\
+?_unsecure"
""
CONAN_LIBS_GRPC
...
@@ -63,6 +63,8 @@ string(REGEX REPLACE "grpc\\+?\\+?_unsecure" "" CONAN_LIBS
...
@@ -63,6 +63,8 @@ string(REGEX REPLACE "grpc\\+?\\+?_unsecure" "" CONAN_LIBS
string
(
REGEX REPLACE
"grpc
\\
+?
\\
+?_unsecure"
""
CONAN_PKG_LIBS
string
(
REGEX REPLACE
"grpc
\\
+?
\\
+?_unsecure"
""
CONAN_PKG_LIBS
"
${
CONAN_PKG_LIBS
}
"
)
"
${
CONAN_PKG_LIBS
}
"
)
message
(
STATUS
"CONAN_LIBS:
${
CONAN_LIBS
}
"
)
###########################################
###########################################
### GENERAL SETUP of SOURCES
### GENERAL SETUP of SOURCES
###########################################
###########################################
...
@@ -145,17 +147,20 @@ add_custom_command(
...
@@ -145,17 +147,20 @@ add_custom_command(
###############################################################################
###############################################################################
if
(
"
${
CMAKE_BUILD_TYPE
}
"
MATCHES
"Debug"
)
if
(
"
${
CMAKE_BUILD_TYPE
}
"
MATCHES
"Debug"
)
add_library
(
caosdb_grpc SHARED
${
GRPC_GENERATED
}
)
add_library
(
caosdb_grpc SHARED
${
GRPC_GENERATED
}
)
add_library
(
caosdb SHARED
${
libcaosdb_INCL
}
${
libcaosdb_SRC
}
)
add_library
(
caosdb SHARED
${
libcaosdb_INCL
}
${
libcaosdb_SRC
}
)
target_link_libraries
(
caosdb caosdb_grpc
)
target_link_libraries
(
caosdb caosdb_grpc
)
target_link_libraries
(
caosdb_grpc
${
CONAN_LIBS
}
)
set
(
LIBCAOSDB caosdb caosdb_grpc
)
set
(
LIBCAOSDB caosdb caosdb_grpc
)
target_include_directories
(
caosdb_grpc SYSTEM PUBLIC
${
CONAN_INCLUDE_DIRS
}
)
target_include_directories
(
caosdb_grpc PUBLIC
target_include_directories
(
caosdb_grpc PUBLIC
$<BUILD_INTERFACE:
${
libcaosdb_SOURCE_DIR
}
/include>
$<BUILD_INTERFACE:
${
libcaosdb_SOURCE_DIR
}
/include>
$<BUILD_INTERFACE:
${
libcaosdb_BINARY_DIR
}
/include>
$<BUILD_INTERFACE:
${
libcaosdb_BINARY_DIR
}
/include>
$<INSTALL_INTERFACE:include>
$<INSTALL_INTERFACE:include>
${
CONAN_INCLUDE_DIRS
}
)
)
else
()
else
()
add_library
(
caosdb
add_library
(
caosdb
...
@@ -165,11 +170,13 @@ endif()
...
@@ -165,11 +170,13 @@ endif()
target_link_libraries
(
caosdb
target_link_libraries
(
caosdb
${
CONAN_LIBS
}
${
CONAN_LIBS
}
)
)
target_include_directories
(
caosdb SYSTEM PUBLIC
${
CONAN_INCLUDE_DIRS
}
)
target_include_directories
(
caosdb PUBLIC
target_include_directories
(
caosdb PUBLIC
$<BUILD_INTERFACE:
${
libcaosdb_SOURCE_DIR
}
/include>
$<BUILD_INTERFACE:
${
libcaosdb_SOURCE_DIR
}
/include>
$<BUILD_INTERFACE:
${
libcaosdb_BINARY_DIR
}
/include>
$<BUILD_INTERFACE:
${
libcaosdb_BINARY_DIR
}
/include>
$<INSTALL_INTERFACE:include>
$<INSTALL_INTERFACE:include>
${
CONAN_INCLUDE_DIRS
}
)
)
add_library
(
ccaosdb SHARED src/ccaosdb.cpp
)
add_library
(
ccaosdb SHARED src/ccaosdb.cpp
)
...
@@ -179,11 +186,13 @@ target_link_libraries(ccaosdb
...
@@ -179,11 +186,13 @@ target_link_libraries(ccaosdb
)
)
add_executable
(
ccaosdbcli EXCLUDE_FROM_ALL src/ccaosdbcli.c
)
add_executable
(
ccaosdbcli EXCLUDE_FROM_ALL src/ccaosdbcli.c
)
target_include_directories
(
ccaosdbcli SYSTEM PUBLIC
${
CONAN_INCLUDE_DIRS
}
)
target_include_directories
(
ccaosdbcli PUBLIC
target_include_directories
(
ccaosdbcli PUBLIC
$<BUILD_INTERFACE:
${
libcaosdb_SOURCE_DIR
}
/include>
$<BUILD_INTERFACE:
${
libcaosdb_SOURCE_DIR
}
/include>
$<BUILD_INTERFACE:
${
libcaosdb_BINARY_DIR
}
/include>
$<BUILD_INTERFACE:
${
libcaosdb_BINARY_DIR
}
/include>
$<INSTALL_INTERFACE:include>
$<INSTALL_INTERFACE:include>
${
CONAN_INCLUDE_DIRS
}
)
)
target_link_libraries
(
ccaosdbcli
target_link_libraries
(
ccaosdbcli
ccaosdb
ccaosdb
...
@@ -191,11 +200,13 @@ target_link_libraries(ccaosdbcli
...
@@ -191,11 +200,13 @@ target_link_libraries(ccaosdbcli
)
)
add_executable
(
cxxcaosdbcli EXCLUDE_FROM_ALL src/cxxcaosdbcli.cpp
)
add_executable
(
cxxcaosdbcli EXCLUDE_FROM_ALL src/cxxcaosdbcli.cpp
)
target_include_directories
(
cxxcaosdbcli SYSTEM PUBLIC
${
CONAN_INCLUDE_DIRS
}
)
target_include_directories
(
cxxcaosdbcli PUBLIC
target_include_directories
(
cxxcaosdbcli PUBLIC
$<BUILD_INTERFACE:
${
libcaosdb_SOURCE_DIR
}
/include>
$<BUILD_INTERFACE:
${
libcaosdb_SOURCE_DIR
}
/include>
$<BUILD_INTERFACE:
${
libcaosdb_BINARY_DIR
}
/include>
$<BUILD_INTERFACE:
${
libcaosdb_BINARY_DIR
}
/include>
$<INSTALL_INTERFACE:include>
$<INSTALL_INTERFACE:include>
${
CONAN_INCLUDE_DIRS
}
)
)
target_link_libraries
(
cxxcaosdbcli
target_link_libraries
(
cxxcaosdbcli
${
LIBCAOSDB
}
${
LIBCAOSDB
}
...
@@ -203,7 +214,6 @@ target_link_libraries(cxxcaosdbcli
...
@@ -203,7 +214,6 @@ target_link_libraries(cxxcaosdbcli
)
)
#######################################################
#######################################################
### LINTING with CLANG-TIDY and INCLUDE-WHAT-YOU-USE
### LINTING with CLANG-TIDY and INCLUDE-WHAT-YOU-USE
#######################################################
#######################################################
...
@@ -242,15 +252,15 @@ endfunction()
...
@@ -242,15 +252,15 @@ endfunction()
option
(
LINTING
"Enable linting with clang-tidy and iwyu when in non-Debug build-type"
OFF
)
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
)
set
(
_LINTING ON
)
endif
()
endif
()
option
(
SKIP_LINTING
"Skip linting even when in Debug build-type"
OFF
)
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"
)
message
(
WARNING
"Skipping linting due to SKIP_LINTING option"
)
set
(
_LINTING OFF
)
set
(
_LINTING OFF
)
endif
()
endif
()
if
(
_LINTING
)
if
(
_LINTING
)
### set paranoid compiler flags
### set paranoid compiler flags
add_compiler_flag
(
"-Wall"
)
add_compiler_flag
(
"-Wall"
)
...
...
This diff is collapsed.
Click to expand it.
Makefile
+
15
−
2
View file @
aacdcc54
...
@@ -37,7 +37,7 @@ else
...
@@ -37,7 +37,7 @@ else
DETECTED_OS
:=
$(
patsubst MINGW%,MSYS,
$(
DETECTED_OS
))
DETECTED_OS
:=
$(
patsubst MINGW%,MSYS,
$(
DETECTED_OS
))
endif
endif
ifeq
($(DETECTED_OS),Darwin)
# Test if we are on MacOS
ifeq
($(DETECTED_OS),Darwin)
# Test if we are on MacOS
CONAN_SETTINGS
:=
"cppstd=1
1
"
CONAN_SETTINGS
:=
"
compiler.
cppstd=1
7
"
endif
endif
...
@@ -53,14 +53,27 @@ style:
...
@@ -53,14 +53,27 @@ style:
.PHONY
:
style
.PHONY
:
style
conan-install
:
conan-install
:
conan
install
.
-s
$(
CONAN_SETTINGS
)
||
\
conan
install
.
-s
$(
CONAN_SETTINGS
)
||
\
(
echo
"'conan install' failed, trying to build from sources..."
;
\
(
echo
"'conan install' failed, trying to build from sources..."
;
\
conan
install
.
-s
$(
CONAN_SETTINGS
)
--build
=
missing
)
conan
install
.
-s
$(
CONAN_SETTINGS
)
--build
=
missing
)
.PHONY
:
conan-install
.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
:
conan create
.
-s
$(
CONAN_SETTINGS
)
conan create
.
-s
$(
CONAN_SETTINGS
)
.PHONY
:
conan-create
.PHONY
:
conan-create
conan-create-debug
:
conan create
.
-s
$(
CONAN_SETTINGS
)
-s
build_type
=
Debug
.PHONY
:
conan-create-debug
conan
:
conan-install conan-create
conan
:
conan-install conan-create
.PHONY
:
conan
.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 @@
...
@@ -136,6 +136,18 @@
include
(
CMakeParseArguments
)
include
(
CMakeParseArguments
)
option
(
CODE_COVERAGE_VERBOSE
"Verbose information"
FALSE
)
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
# Check prereqs
find_program
(
GCOV_PATH gcov
)
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):
...
@@ -13,7 +13,11 @@ class CaosdbConan(ConanFile):
options
=
{
"
shared
"
:
[
True
,
False
],
"
fPIC
"
:
[
True
,
False
]}
options
=
{
"
shared
"
:
[
True
,
False
],
"
fPIC
"
:
[
True
,
False
]}
default_options
=
{
"
shared
"
:
False
,
"
fPIC
"
:
True
}
default_options
=
{
"
shared
"
:
False
,
"
fPIC
"
:
True
}
generators
=
"
cmake
"
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
=
"
*.cpp
"
,
"
*.h
"
,
"
*.cmake
"
,
"
*CMakeLists.txt
"
,
"
*.in
"
,
"
*.proto
"
,
"
*.c
"
exports_sources
=
"
src
"
,
"
doc
"
,
"
include
"
,
"
test
"
,
"
cmake
"
,
"
proto
"
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 @@
...
@@ -6,7 +6,7 @@
## Build
## 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`
0.
clone/update the subrepo
`git submodule update --init proto`
1.
`mkdir build && cd build`
1.
`mkdir build && cd build`
...
@@ -25,9 +25,9 @@ command (3.).
...
@@ -25,9 +25,9 @@ command (3.).
### How to build on MacOS
### 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
and continue as you would when building on a Linux system. You may
have to add
`build/lib/`
(or, alternatively after installation,
have to add
`build/lib/`
(or, alternatively after installation,
...
@@ -37,7 +37,8 @@ variable.
...
@@ -37,7 +37,8 @@ variable.
#### Problems and solutions ####
#### Problems and solutions ####
-
Make sure that your conan version supports your XCode version. A typical symptom of version
-
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
### How to build on Windows
...
@@ -73,6 +74,13 @@ dependencies.
...
@@ -73,6 +74,13 @@ dependencies.
Depending on the clang version it might be necessary to use additionally the following flag:
Depending on the clang version it might be necessary to use additionally the following flag:
`-DCMAKE_CXX_FLAGS="-Wno-unused-parameter"`
`-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
## Unit Tests
### Build
### Build
...
@@ -80,12 +88,13 @@ Depending on the clang version it might be necessary to use additionally the fol
...
@@ -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`
)
For the tests there is a slightly different setup required (with option
`-D CMAKE_BUILD_TYPE=Debug`
)
1.
`mkdir build && cd build/`
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 ..`
3.
`cmake -B . -D CMAKE_BUILD_TYPE=Debug ..`
*
If your clang-format version is too old, formatting, linting etc. can be skipped:
*
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 ..`
`cmake -B . -D CMAKE_BUILD_TYPE=Debug -D SKIP_LINTING=ON ..`
*
Depending on the clang version it might be necessary to also add
*
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 .`
5.
`cmake --build .`
### Run
### 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