Skip to content
Snippets Groups Projects
Commit 39a840d7 authored by Joscha Schmiedt's avatar Joscha Schmiedt
Browse files

Merge branch 'dev' into f-34-building-shared-libraries-on-windows-fails

parents 66bca40f 07e88302
No related branches found
No related tags found
2 merge requests!61Release 0.3.0,!48Fix compilation errors on Windows
Pipeline #54307 passed with warnings
Pipeline: caosdb-julialib

#54313

    Pipeline: CaosDB Octave library

    #54312

      Pipeline: caosdb-cppinttest

      #54308

        ...@@ -7,7 +7,8 @@ RUN apt-get install -y doxygen graphviz ...@@ -7,7 +7,8 @@ RUN apt-get install -y doxygen graphviz
        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
        RUN apt-get install -y curl RUN apt-get install -y curl zip unzip tar
        RUN apt-get install -y openjdk-11-jdk-headless RUN apt-get install -y openjdk-11-jdk-headless
        ......
        ...@@ -154,3 +154,6 @@ conanbuildinfo.cmake ...@@ -154,3 +154,6 @@ conanbuildinfo.cmake
        conanbuildinfo.txt conanbuildinfo.txt
        conaninfo.txt conaninfo.txt
        graph_info.json graph_info.json
        # vcpkg
        vcpkg_installed
        \ No newline at end of file
        ...@@ -81,6 +81,17 @@ code_style: ...@@ -81,6 +81,17 @@ code_style:
        - clang-format-11 --dry-run --verbose --Werror $(find test/ src/ include/ -type f -iname "*.cpp" -o -iname "*.h" -o -iname "*.h.in") - clang-format-11 --dry-run --verbose --Werror $(find test/ src/ include/ -type f -iname "*.cpp" -o -iname "*.h" -o -iname "*.h.in")
        allow_failure: true allow_failure: true
        # build with vcpkg
        build_vcpkg:
        tags: [ docker ]
        stage: test
        script:
        - apt update && apt install -y pkg-config
        - cd vcpkg && git fetch origin 5d3798ac7388ca66c169773e46103b14077b76a4 && cd ..
        - make vcpkg-build-release
        allow_failure: true
        # unit tests with gtest # unit tests with gtest
        test: test:
        tags: [ docker ] tags: [ docker ]
        ......
        [submodule "proto"] [submodule "proto"]
        path = proto path = proto
        url = ../caosdb-proto.git url = ../caosdb-proto.git
        [submodule "vcpkg"]
        path = vcpkg
        url = https://github.com/microsoft/vcpkg
        ...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
        # This file is a part of the CaosDB Project. # This file is a part of the CaosDB Project.
        # #
        # Copyright (C) 2021 Timm Fitschen <t.fitschen@indiscale.com> # Copyright (C) 2021 Timm Fitschen <t.fitschen@indiscale.com>
        # Copyright (C) 2021 IndiScale GmbH <info@indiscale.com> # Copyright (C) 2021 Joscha Schmiedt <joscha@schmiedt.dev>
        # Copyright (C) 2021-2024 IndiScale GmbH <info@indiscale.com>
        #
        # #
        # This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
        # it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
        ...@@ -51,24 +53,8 @@ IF (BUILD_ACM) ...@@ -51,24 +53,8 @@ IF (BUILD_ACM)
        add_compile_definitions("BUILD_ACM") add_compile_definitions("BUILD_ACM")
        ENDIF() ENDIF()
        ###########################################
        ### DEPENDENCY MANAGEMENT with CONAN
        ###########################################
        message(STATUS "Build directory ${CMAKE_BINARY_DIR}") message(STATUS "Build directory ${CMAKE_BINARY_DIR}")
        # TODO: Is this still necessary?
        # # fix grpc - remove unsecure (no-op ssl implementations)
        # string(REGEX REPLACE "grpc\\+?\\+?_unsecure" "" CONAN_LIBS_GRPC
        # "${CONAN_LIBS_GRPC}")
        # string(REGEX REPLACE "grpc\\+?\\+?_unsecure" "" CONAN_PKG_LIBS_GRPC
        # "${CONAN_PKG_LIBS_GRPC}")
        # string(REGEX REPLACE "grpc\\+?\\+?_unsecure" "" CONAN_LIBS
        # "${CONAN_LIBS}")
        # string(REGEX REPLACE "grpc\\+?\\+?_unsecure" "" CONAN_PKG_LIBS
        # "${CONAN_PKG_LIBS}")
        # message(STATUS "CONAN_LIBS: ${CONAN_LIBS}")
        ########################################### ###########################################
        ### GENERAL SETUP of SOURCES ### GENERAL SETUP of SOURCES
        ########################################### ###########################################
        ...@@ -81,7 +67,7 @@ add_subdirectory(doc) ...@@ -81,7 +67,7 @@ add_subdirectory(doc)
        ### CODE GENERATION (WITH GRPC) ### CODE GENERATION (WITH GRPC)
        #################################################################### ####################################################################
        # TODO: Replace this with the protobuf_generate_cpp function find_package(protobuf CONFIG REQUIRED)
        # Protobuf/Grpc source files # Protobuf/Grpc source files
        set(PROTO_FILES set(PROTO_FILES
        ...@@ -97,15 +83,12 @@ ENDIF() ...@@ -97,15 +83,12 @@ ENDIF()
        set(PROTO_PATH ${PROJECT_SOURCE_DIR}/proto/proto) set(PROTO_PATH ${PROJECT_SOURCE_DIR}/proto/proto)
        set(_PROTOBUF_PROTOC ${Protobuf_PROTOC_EXECUTABLE})
        # compiler binaries # compiler binaries
        IF (WIN32) IF (WIN32)
        set(_PROTOBUF_PROTOC "${CMAKE_BINARY_DIR}/build_tools/protoc.exe")
        set(_GRPC_CPP_PLUGIN_EXECUTABLE "${CMAKE_BINARY_DIR}/build_tools/grpc_cpp_plugin.exe") set(_GRPC_CPP_PLUGIN_EXECUTABLE "${CMAKE_BINARY_DIR}/build_tools/grpc_cpp_plugin.exe")
        set(STDFSLIB "")
        ELSE() ELSE()
        set(_PROTOBUF_PROTOC "${CMAKE_BINARY_DIR}/build_tools/protoc")
        set(_GRPC_CPP_PLUGIN_EXECUTABLE "${CMAKE_BINARY_DIR}/build_tools/grpc_cpp_plugin") set(_GRPC_CPP_PLUGIN_EXECUTABLE "${CMAKE_BINARY_DIR}/build_tools/grpc_cpp_plugin")
        set(STDFSLIB stdc++fs)
        ENDIF() ENDIF()
        # Generated sources # Generated sources
        ...@@ -164,8 +147,11 @@ message(DEBUG "GRPC_GENERATED: ${GRPC_GENERATED}") ...@@ -164,8 +147,11 @@ message(DEBUG "GRPC_GENERATED: ${GRPC_GENERATED}")
        ############################################################################### ###############################################################################
        find_package(gRPC CONFIG REQUIRED) find_package(gRPC CONFIG REQUIRED)
        find_package(Protobuf CONFIG REQUIRED) find_package(Boost COMPONENTS json REQUIRED)
        find_package(Boost REQUIRED) find_package(Boost COMPONENTS filesystem REQUIRED)
        find_package(Boost COMPONENTS log REQUIRED)
        find_package(Boost COMPONENTS thread REQUIRED)
        find_package(Boost COMPONENTS system REQUIRED)
        find_package(GTest REQUIRED) find_package(GTest REQUIRED)
        # print include directories for debugging # print include directories for debugging
        ...@@ -182,7 +168,7 @@ if("${CMAKE_BUILD_TYPE}" MATCHES "Debug") ...@@ -182,7 +168,7 @@ if("${CMAKE_BUILD_TYPE}" MATCHES "Debug")
        add_library(caosdb_grpc SHARED ${GRPC_GENERATED}) add_library(caosdb_grpc SHARED ${GRPC_GENERATED})
        target_link_libraries(caosdb_grpc target_link_libraries(caosdb_grpc
        grpc::grpc protobuf::protobuf boost::boost gRPC::grpc gRPC::grpc++ protobuf::libprotobuf ${Boost_LIBRARIES}
        ) )
        target_include_directories(caosdb_grpc PUBLIC target_include_directories(caosdb_grpc PUBLIC
        $<BUILD_INTERFACE:${PROJECT_INCLUDE_DIR}> $<BUILD_INTERFACE:${PROJECT_INCLUDE_DIR}>
        ...@@ -193,7 +179,7 @@ if("${CMAKE_BUILD_TYPE}" MATCHES "Debug") ...@@ -193,7 +179,7 @@ if("${CMAKE_BUILD_TYPE}" MATCHES "Debug")
        add_library(caosdb SHARED ${libcaosdb_INCL} ${libcaosdb_SRC}) add_library(caosdb SHARED ${libcaosdb_INCL} ${libcaosdb_SRC})
        target_link_libraries(caosdb target_link_libraries(caosdb
        caosdb_grpc grpc::grpc protobuf::protobuf boost::boost caosdb_grpc gRPC::grpc gRPC::grpc++ protobuf::libprotobuf ${Boost_LIBRARIES}
        ) )
        set(LIBCAOSDB caosdb caosdb_grpc) set(LIBCAOSDB caosdb caosdb_grpc)
        ...@@ -201,7 +187,7 @@ else() ...@@ -201,7 +187,7 @@ else()
        add_library(caosdb add_library(caosdb
        SHARED ${libcaosdb_INCL} ${libcaosdb_SRC} ${GRPC_GENERATED}) SHARED ${libcaosdb_INCL} ${libcaosdb_SRC} ${GRPC_GENERATED})
        target_link_libraries(caosdb target_link_libraries(caosdb
        grpc::grpc protobuf::protobuf boost::boost gRPC::grpc gRPC::grpc++ protobuf::libprotobuf ${Boost_LIBRARIES}
        ) )
        set(LIBCAOSDB caosdb) set(LIBCAOSDB caosdb)
        endif() endif()
        ...@@ -221,8 +207,8 @@ target_include_directories(caosdb PUBLIC ...@@ -221,8 +207,8 @@ target_include_directories(caosdb PUBLIC
        # ---------- # ----------
        add_library(ccaosdb SHARED src/ccaosdb.cpp ${GRPC_GENERATED}) add_library(ccaosdb SHARED src/ccaosdb.cpp ${GRPC_GENERATED})
        target_link_libraries(ccaosdb target_link_libraries(ccaosdb
        grpc::grpc protobuf::protobuf boost::boost gRPC::grpc gRPC::grpc++ protobuf::libprotobuf ${Boost_LIBRARIES}
        ${LIBCAOSDB} ${LIBCAOSDB}
        ) )
        target_include_directories(ccaosdb PUBLIC target_include_directories(ccaosdb PUBLIC
        $<BUILD_INTERFACE:${libcaosdb_SOURCE_DIR}/include> $<BUILD_INTERFACE:${libcaosdb_SOURCE_DIR}/include>
        ...@@ -244,7 +230,7 @@ target_include_directories(ccaosdbcli SYSTEM PUBLIC ...@@ -244,7 +230,7 @@ target_include_directories(ccaosdbcli SYSTEM PUBLIC
        ) )
        target_link_libraries(ccaosdbcli target_link_libraries(ccaosdbcli
        grpc::grpc protobuf::protobuf boost::boost gRPC::grpc protobuf::libprotobuf ${Boost_LIBRARIES}
        ${LIBCAOSDB} ${LIBCAOSDB}
        ccaosdb ccaosdb
        ) )
        ...@@ -262,7 +248,7 @@ target_include_directories(cxxcaosdbcli SYSTEM PUBLIC ...@@ -262,7 +248,7 @@ target_include_directories(cxxcaosdbcli SYSTEM PUBLIC
        ) )
        target_link_libraries(cxxcaosdbcli target_link_libraries(cxxcaosdbcli
        ${LIBCAOSDB} ${LIBCAOSDB}
        grpc::grpc protobuf::protobuf boost::boost gRPC::grpc protobuf::libprotobuf ${Boost_LIBRARIES}
        ) )
        ......
        ...@@ -97,6 +97,17 @@ conan-build-debug: ...@@ -97,6 +97,17 @@ conan-build-debug:
        conan build . -s $(CONAN_SETTINGS) -s build_type=Debug conan build . -s $(CONAN_SETTINGS) -s build_type=Debug
        vcpkg-install:
        ./vcpkg/bootstrap-vcpkg.sh -disableMetrics\
        &&vcpkg/vcpkg install
        vcpkg-build-release: vcpkg-install
        mkdir -p build/build_tools\
        && cp vcpkg_installed/x64-linux/tools/grpc/grpc_cpp_plugin build/build_tools\
        && cd build\
        && cmake -S .. -B . -DCMAKE_TOOLCHAIN_FILE=../vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-linux -DCMAKE_BUILD_TYPE=Release\
        && cmake --build .
        ctest: ctest:
        cd build/Debug && ctest cd build/Debug && ctest
        ......
        ...@@ -10,7 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -10,7 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
        ### Added ### Added
        - Connection::ListUsers method - Connection::ListUsers method
        - Added support for compilation with vcpkg.
        ### Changed ### Changed
        ......
        ...@@ -9,8 +9,8 @@ Dependencies ...@@ -9,8 +9,8 @@ Dependencies
        Build Build
        ----- -----
        Building with ``make`` Building with ``make`` and Conan
        ~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        Make sure that the dependencies (see above) are fulfilled. On systems Make sure that the dependencies (see above) are fulfilled. On systems
        which have ``make`` installed, type this in your command line terminal: which have ``make`` installed, type this in your command line terminal:
        ...@@ -19,8 +19,8 @@ which have ``make`` installed, type this in your command line terminal: ...@@ -19,8 +19,8 @@ which have ``make`` installed, type this in your command line terminal:
        make conan make conan
        Manual build Manual build with Conan
        ~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~
        We use `cmake <https://cmake.org>`__ as build tool, with Conan as We use `cmake <https://cmake.org>`__ as build tool, with Conan as
        package manager. The compiler must support the C++17 standard. package manager. The compiler must support the C++17 standard.
        ...@@ -28,7 +28,7 @@ package manager. The compiler must support the C++17 standard. ...@@ -28,7 +28,7 @@ package manager. The compiler must support the C++17 standard.
        1. clone/update the subrepo ``git submodule update --init proto`` 1. clone/update the subrepo ``git submodule update --init proto``
        2. ``conan install . -s build_type=Release --build=missing`` 2. ``conan install . -s build_type=Release --build=missing``
        3. ``cd build/Release`` 3. ``cd build/Release``
        4. ``cmake .`` 4. ``cmake -S ../.. -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=generators/conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Release``
        5. ``cmake --build .`` 5. ``cmake --build .``
        You may also want to install libcaosdb system-wide to You may also want to install libcaosdb system-wide to
        ...@@ -51,6 +51,43 @@ If you want to build or install libcaosdb without the use of Conan, feel ...@@ -51,6 +51,43 @@ If you want to build or install libcaosdb without the use of Conan, feel
        free to rewrite the CMakeLists.txt as needed. The CaosDB project is open free to rewrite the CMakeLists.txt as needed. The CaosDB project is open
        to merge requests which support multiple ways of installation. to merge requests which support multiple ways of installation.
        Optional: Building with ``vcpkg``
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        Next to Conan, you also have the option to use the vcpkg package manager to install the
        dependencies (`vcpkg.json`). Note, however, *vcpkg is not fully supported and tested*. It's
        included as a submodule in the project. To install the dependencies, run the following
        commands:
        .. code:: console
        ./vcpkg/bootstrap-vcpkg.<sh/bat> -disableMetrics
        vcpkg/vcpkg install
        Copy the ``grpc-cpp-plugin`` to the build directory (TODO: This should ideally be done automatically by CMake):
        .. code:: console
        mkdir -p build/build_tools
        cp vcpkg_installed/<os>/tools/grpc/grpc_cpp_plugin build/build_tools
        Then compile the project with CMake by including the vcpkg toolchain file:
        .. code:: console
        cd build
        cmake -S .. -B . -DCMAKE_TOOLCHAIN_FILE=../vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-linux -DCMAKE_BUILD_TYPE=Release
        cmake --build .
        Alternatively, on Linux, you can use the provided `Makefile` targets
        .. code:: console
        make vcpkg-build-release
        How to build on MacOS How to build on MacOS
        ~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
        ...@@ -74,7 +111,7 @@ as compiler. We use `cmake <https://cmake.org/download/>`__ as build ...@@ -74,7 +111,7 @@ as compiler. We use `cmake <https://cmake.org/download/>`__ as build
        tool. tool.
        1. clone/update the subrepo ``git submodule update --init proto`` 1. clone/update the subrepo ``git submodule update --init proto``
        2. ``conan install .. -g visual_studio -s arch=x86_64 -s build_type=Release -s compiler.toolset=v142 -s compiler.version=16 -s compiler.runtime=MD --build=missing --update`` 2. :code:``conan install .. -g visual_studio -s arch=x86_64 -s build_type=Release -s compiler.toolset=v142 -s compiler.version=16 -s compiler.runtime=MD --build=missing --update``
        3. ``cd build/Release`` 3. ``cd build/Release``
        5. ``cmake -B . ..`` 5. ``cmake -B . ..``
        6. open ``libcaosdb.sln`` with Visual Studio, change the buildtype to 6. open ``libcaosdb.sln`` with Visual Studio, change the buildtype to
        ......
        ...@@ -343,7 +343,7 @@ auto CreateLoggingConfiguration(const object &from) -> LoggingConfiguration { ...@@ -343,7 +343,7 @@ auto CreateLoggingConfiguration(const object &from) -> LoggingConfiguration {
        const auto *elem = sinks.begin(); const auto *elem = sinks.begin();
        while (elem != sinks.end()) { while (elem != sinks.end()) {
        result.AddSink(CreateSinkConfiguration(elem->value().as_object(), elem->key().to_string(), result.AddSink(CreateSinkConfiguration(elem->value().as_object(), std::string(elem->key()),
        default_level)); default_level));
        elem = std::next(elem); elem = std::next(elem);
        } }
        ...@@ -419,7 +419,7 @@ auto ConfigurationManager::mGetDefaultConnectionName() const -> std::string { ...@@ -419,7 +419,7 @@ auto ConfigurationManager::mGetDefaultConnectionName() const -> std::string {
        } }
        if (connections.size() == 1) { if (connections.size() == 1) {
        // return the key of the first and only sub-element of connections. // return the key of the first and only sub-element of connections.
        return connections.begin()->key().to_string(); return std::string(connections.begin()->key());
        } }
        throw ConfigurationError("Could not determine the default connection."); throw ConfigurationError("Could not determine the default connection.");
        } }
        ......
        Subproject commit 333ba63a16024f05f9172fe403f9eced000389e5
        {
        "name": "caosdb",
        "version-string": "0.3.0-dev",
        "port-version": 1,
        "description": "C++ library for the CaosDB project",
        "license": "AGPL-3.0-or-later",
        "dependencies": [
        "boost-beast",
        "boost-filesystem",
        "boost-json",
        "boost-log",
        "boost-smart-ptr",
        "boost-thread",
        "grpc",
        "protobuf",
        "zlib",
        "gtest"
        ],
        "builtin-baseline": "5d3798ac7388ca66c169773e46103b14077b76a4"
        }
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Please register or to comment