Skip to content
Snippets Groups Projects
Commit 2fdfea98 authored by Florian Spreckelsen's avatar Florian Spreckelsen
Browse files

Merge branch 'f-73-extern-adapt-to-conan-2-0' into 'dev'

Adapt for Conan 2

See merge request !35
parents 577dc4c9 ca7b280f
No related branches found
No related tags found
2 merge requests!41Release 0.3.0,!35Adapt for Conan 2
Pipeline #54976 passed
...@@ -5,9 +5,8 @@ COPY .docker/wait-for-it.sh /wait-for-it.sh ...@@ -5,9 +5,8 @@ COPY .docker/wait-for-it.sh /wait-for-it.sh
# build and install caosdb-cpplib # build and install caosdb-cpplib
WORKDIR /libcaosdb/ WORKDIR /libcaosdb/
RUN mkdir build RUN conan profile detect -f
WORKDIR /libcaosdb/build RUN make conan
RUN conan create -s "compiler.libcxx=libstdc++11" -o caosdb:build_acm=True .. "caosdb/$(conan inspect --raw version ..)@_/_"
COPY . /caosdb-cppinttest COPY . /caosdb-cppinttest
WORKDIR /caosdb-cppinttest WORKDIR /caosdb-cppinttest
...@@ -17,10 +16,7 @@ COPY .docker/caosdb-client.json /caosdb-client.json ...@@ -17,10 +16,7 @@ COPY .docker/caosdb-client.json /caosdb-client.json
# Build and run tests. # Build and run tests.
# If no other command is given to the Docker image # If no other command is given to the Docker image
CMD mkdir build && \ CMD make build-release &&\
cd build && \ cd build/Release &&\
conan install .. -s "compiler.libcxx=libstdc++11" && \
cmake .. && \
cmake --build . && \
/wait-for-it.sh caosdb-server:10443 -t 500 -- \ /wait-for-it.sh caosdb-server:10443 -t 500 -- \
ctest -V ctest -V
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
build/ build/
include/libcaosdbConfig.h include/libcaosdbConfig.h
cert/ cert/
.*
# CMake # CMake
CMakeLists.txt.user CMakeLists.txt.user
......
...@@ -101,11 +101,7 @@ build-test: ...@@ -101,11 +101,7 @@ build-test:
stage: build stage: build
script: script:
- echo $PWD - echo $PWD
- mkdir build - make build-release
- cd build
- conan install .. -s "compiler.libcxx=libstdc++11"
- cmake ..
- cmake --build .
test: test:
......
...@@ -28,20 +28,16 @@ set(CMAKE_CXX_STANDARD 17) ...@@ -28,20 +28,16 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# # fix grpc - remove unsecure (no-op ssl implementations)
# dependency management with conan # TODO: Find out if this is still necessary
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) # string(REGEX REPLACE "grpc\\+?\\+?_unsecure" "" CONAN_LIBS_GRPC
conan_basic_setup() # "${CONAN_LIBS_GRPC}")
# string(REGEX REPLACE "grpc\\+?\\+?_unsecure" "" CONAN_PKG_LIBS_GRPC
# fix grpc - remove unsecure (no-op ssl implementations) # "${CONAN_PKG_LIBS_GRPC}")
string(REGEX REPLACE "grpc\\+?\\+?_unsecure" "" CONAN_LIBS_GRPC # string(REGEX REPLACE "grpc\\+?\\+?_unsecure" "" CONAN_LIBS
"${CONAN_LIBS_GRPC}") # "${CONAN_LIBS}")
string(REGEX REPLACE "grpc\\+?\\+?_unsecure" "" CONAN_PKG_LIBS_GRPC # string(REGEX REPLACE "grpc\\+?\\+?_unsecure" "" CONAN_PKG_LIBS
"${CONAN_PKG_LIBS_GRPC}") # "${CONAN_PKG_LIBS}")
string(REGEX REPLACE "grpc\\+?\\+?_unsecure" "" CONAN_LIBS
"${CONAN_LIBS}")
string(REGEX REPLACE "grpc\\+?\\+?_unsecure" "" CONAN_PKG_LIBS
"${CONAN_PKG_LIBS}")
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
......
...@@ -35,14 +35,46 @@ CLANG_TIDY_CMD = $(CLANG_TIDY) \ ...@@ -35,14 +35,46 @@ CLANG_TIDY_CMD = $(CLANG_TIDY) \
.PHONY: help .PHONY: help
help: help:
@echo "Targets:" @echo "Targets:"
@echo " conan-install - Install locally with Conan." @echo " conan-install-debug - Install locally with Conan."
@echo " conan-install-release - Install locally with Conan."
@echo " format - auto-format the source files." @echo " format - auto-format the source files."
@echo " build-debug - Build the project in Debug mode."
@echo " build-release - Build the project in Release mode."
@echo " test-debug - Run the tests in Debug mode."
@echo " test-release - Run the tests in Release mode."
@echo " clean - Remove build directories."
conan-install: conan-install-debug:
conan install . -s "compiler.libcxx=libstdc++11" conan install . -s "compiler.libcxx=libstdc++11" -s build_type=Debug --build=missing
.PHONY: conan-install
conan-install-release:
conan install . -s "compiler.libcxx=libstdc++11" -s build_type=Release --build=missing
format: format:
$(CLANG_FORMAT) -i --verbose \ $(CLANG_FORMAT) -i --verbose \
$$(find test/ -type f -iname "*.cpp" -o -iname "*.h" -o -iname "*.h.in") $$(find test/ -type f -iname "*.cpp" -o -iname "*.h" -o -iname "*.h.in")
.PHONY: format .PHONY: format
build-debug: conan-install-debug
# cmake --preset conan-debug && cmake --build build/Debug # for CMake >= 3.23
cd build/Debug &&\
cmake -S ../.. -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=generators/conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Debug &&\
cmake --build .
build-release: conan-install-release
# cmake --preset conan-release # for CMake >= 3.23
cd build/Release &&\
cmake -S ../.. -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=generators/conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Release &&\
cmake --build .
test-debug: build-debug
cd build/Debug && ctest
test-release: build-release
cd build/Release && ctest
clean:
rm -rf build
.PHONY: conan-install-debug conan-install-release build-debug build-release test-debug test-release
\ No newline at end of file
...@@ -12,13 +12,21 @@ Integration tests for caosdb-cpplib and the caosdb-server ...@@ -12,13 +12,21 @@ Integration tests for caosdb-cpplib and the caosdb-server
# Run tests # Run tests
## Prerequisite ## Prerequisites
Create a local conan package from the caosdb-cpplib repository Create a local conan package from the caosdb-cpplib repository
## Build & Execution ## Build & Execution
1. `mkdir build && cd build/`
2. `conan install .. -s "compiler.libcxx=libstdc++11"` ```
3. `cmake -B . ..` make test-release
```
or manually via
1. `conan install . -s build_type=<Debug/Release> --build=missing`
2. `cmake --preset conan-<debug/release>`
3. `cd build <Debug/Release>`
4. `cmake --build .` 4. `cmake --build .`
5. Provide client configuration at `~/.caosdb-client.json` or via any other method described in the docs. 5. Provide client configuration at `~/.caosdb-client.json` or via any other method described in the docs.
6. There are tests which need access to the server's certificate file. Define 6. There are tests which need access to the server's certificate file. Define
......
[requires] [requires]
caosdb/[>=0.3.0-dev, include_prerelease=True] caosdb/[>=0.3.0-dev, include_prerelease=True]
protobuf/3.21.12
grpc/1.48.4
[build_requires] [test_requires]
gtest/1.11.0 gtest/1.11.0
[generators] [generators]
cmake CMakeDeps
CMakeToolchain
[options] [options]
caosdb:build_acm=True caosdb*:build_acm=True
[layout]
cmake_layout
\ No newline at end of file
...@@ -86,10 +86,9 @@ if(LINTING) ...@@ -86,10 +86,9 @@ if(LINTING)
else() else()
message(STATUS "clang-tidy: ${clang_tidy}") message(STATUS "clang-tidy: ${clang_tidy}")
set(_CMAKE_CXX_CLANG_TIDY "${clang_tidy}" set(_CMAKE_CXX_CLANG_TIDY "${clang_tidy}"
"--header-filter=caosdb/.*[^\(\.pb\.h\)]$" "--header-filter=caosdb/.*[^\(\.pb\.h\)]$")
"--fix")
set(_CMAKE_CXX_CLANG_TIDY_CHECKS set(_CMAKE_CXX_CLANG_TIDY_CHECKS
"--checks=*,-fuchsia-*,-llvmlibc-*,-cert-err58-cpp,-cppcoreguidelines-avoid-non-const-global-variables,-cppcoreguidelines-owning-memory,-modernize-use-trailing-return-type,-google-readability-avoid-underscore-in-googletest-name,-cppcoreguidelines-avoid-magic-numbers,-readability-magic-numbers,-cppcoreguidelines-avoid-goto,-hicpp-avoid-goto,-readability-function-cognitive-complexity,-cppcoreguidelines-pro-type-vararg,-cppcoreguidelines-non-private-member-variables-in-classes,-misc-non-private-member-variables-in-classes,-cppcoreguidelines-pro-type-vararg,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-hicpp-no-array-decay,-altera-*") "--checks=*,-fuchsia-*,-llvmlibc-*,-cert-err58-cpp,-cppcoreguidelines-avoid-non-const-global-variables,-cppcoreguidelines-owning-memory,-modernize-use-trailing-return-type,-google-readability-avoid-underscore-in-googletest-name,-cppcoreguidelines-avoid-magic-numbers,-readability-magic-numbers,-cppcoreguidelines-avoid-goto,-hicpp-avoid-goto,-readability-function-cognitive-complexity,-cppcoreguidelines-pro-type-vararg,-cppcoreguidelines-non-private-member-variables-in-classes,-misc-non-private-member-variables-in-classes,-cppcoreguidelines-pro-type-vararg,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-hicpp-no-array-decay,-altera-*,-misc-include-cleaner,-readability-identifier-length")
endif() endif()
else() else()
message(STATUS "LINTING is OFF") message(STATUS "LINTING is OFF")
...@@ -103,22 +102,25 @@ endif() ...@@ -103,22 +102,25 @@ endif()
# add special cmake functions for gtest # add special cmake functions for gtest
include(GoogleTest REQUIRED) include(GoogleTest REQUIRED)
find_package(caosdb)
find_package(GTest)
find_package(gRPC)
find_package(protobuf)
# loop over all test cases and add them to the test runner # loop over all test cases and add them to the test runner
list(LENGTH test_cases len_test_cases) list(LENGTH test_cases len_test_cases)
math(EXPR len_test_cases "${len_test_cases} - 1") math(EXPR len_test_cases "${len_test_cases} - 1")
foreach (i RANGE "${len_test_cases}") foreach (i RANGE "${len_test_cases}")
list(GET test_cases ${i} test_case_name) list(GET test_cases ${i} test_case_name)
add_executable(${test_case_name} ${test_case_name}.cpp) add_executable(${test_case_name} ${test_case_name}.cpp)
target_link_libraries(${test_case_name} PRIVATE ${CONAN_LIBS_CAOSDB} target_link_libraries(${test_case_name} PRIVATE
${CONAN_LIBS_GTEST} ${CONAN_LIBS_GRPC} ${CONAN_LIBS_ABSEIL} caosdb::caosdb gtest::gtest grpc::grpc protobuf::protobuf
${CONAN_LIBS_OPENSSL} ${CONAN_LIBS_C-ARES} ${CONAN_LIBS_BZIP2} )
${CONAN_LIBS_PROTOBUF} ${CONAN_LIBS_ZLIB} ${CONAN_LIBS_RE2}
${CONAN_LIBS_BOOST})
if("${CMAKE_BUILD_TYPE}" MATCHES "Debug") if("${CMAKE_BUILD_TYPE}" MATCHES "Debug")
target_link_libraries(${test_case_name} PRIVATE caosdb_grpc) target_link_libraries(${test_case_name} PRIVATE caosdb_grpc)
endif() endif()
target_include_directories(${test_case_name} target_include_directories(${test_case_name}
PUBLIC ${CONAN_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}) PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
if(LINTING) if(LINTING)
set_target_properties(${test_case_name} set_target_properties(${test_case_name}
PROPERTIES PROPERTIES
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment