Skip to content
Snippets Groups Projects
Verified Commit 16056d4d authored by Timm Fitschen's avatar Timm Fitschen
Browse files

WIP: pipeline

parent 027c5c58
No related branches found
No related tags found
No related merge requests found
Pipeline #8238 passed
Pipeline: caosdb-cppinttest

#8239

    ......@@ -39,3 +39,7 @@ RUN make -j
    RUN make install
    RUN apt-get install -y curl
    COPY . /libcaosdb/
    WORKDIR /libcaosdb
    RUN rm -rf .git
    ......@@ -82,6 +82,65 @@ if("${CMAKE_BUILD_TYPE}" MATCHES "Debug")
    endif()
    ## CODE GENERATION
    option(GRPC_FETCHCONTENT "Fetch and build GRPC from the sources" OFF)
    include(FetchGRPC)
    #
    # Protobuf/Grpc source files
    #
    set(PROTO_FILES
    ${PROJECT_SOURCE_DIR}/proto/proto/caosdb/info/v1alpha1/main.proto
    )
    set(PROTO_PATH ${PROJECT_SOURCE_DIR}/proto/proto)
    # Generated sources
    set(hw_hdrs_path "caosdb/info/v1alpha1")
    set(hw_proto_srcs "${CMAKE_CURRENT_BINARY_DIR}/include/caosdb/info/v1alpha1/main.pb.cc")
    set(hw_proto_hdrs "${CMAKE_CURRENT_BINARY_DIR}/include/${hw_hdrs_path}/main.pb.h")
    set(hw_grpc_srcs "${CMAKE_CURRENT_BINARY_DIR}/include/caosdb/info/v1alpha1/main.grpc.pb.cc")
    set(hw_grpc_hdrs "${CMAKE_CURRENT_BINARY_DIR}/include/${hw_hdrs_path}/main.grpc.pb.h")
    add_custom_command(
    OUTPUT "${hw_proto_srcs}" "${hw_proto_hdrs}" "${hw_grpc_srcs}" "${hw_grpc_hdrs}"
    COMMAND ${_PROTOBUF_PROTOC}
    ARGS --grpc_out "${CMAKE_CURRENT_BINARY_DIR}/include"
    --cpp_out "${CMAKE_CURRENT_BINARY_DIR}/include"
    -I "${PROTO_PATH}"
    --plugin=protoc-gen-grpc="${_GRPC_CPP_PLUGIN_EXECUTABLE}"
    "${PROTO_FILES}"
    DEPENDS "${PROTO_FILES}")
    # hw_grpc_proto
    add_library(caosdb_info_v1alpha1
    ${hw_grpc_srcs}
    ${hw_grpc_hdrs}
    ${hw_proto_srcs}
    ${hw_proto_hdrs})
    target_link_libraries(caosdb_info_v1alpha1
    ${_REFLECTION}
    ${_GRPC_GRPCPP}
    ${_PROTOBUF_LIBPROTOBUF})
    target_include_directories(caosdb_info_v1alpha1 PUBLIC
    # headers to include when building from source
    $<BUILD_INTERFACE:${libcaosdb_SOURCE_DIR}/include>
    $<BUILD_INTERFACE:${libcaosdb_BINARY_DIR}/include>
    $<INSTALL_INTERFACE:include>
    )
    target_link_libraries(caosdb
    caosdb_info_v1alpha1
    ${_REFLECTION}
    ${_GRPC_GRPCPP}
    ${_PROTOBUF_LIBPROTOBUF})
    ###############################################
    ############ INSTALLATION #####################
    ###############################################
    # These variables slightly modify the install location to allow for version
    # specific installations.
    set(libcaosdb_INCLUDE_DEST "include/libcaosdb-${libcaosdb_VERSION}")
    ......@@ -108,7 +167,7 @@ target_include_directories(caosdb PUBLIC
    $<BUILD_INTERFACE:${libcaosdb_BINARY_DIR}/include>
    # headers to include when installing (implicitly prefixes with ${CMAKE_INSTALL_PREFIX}).
    $<INSTALL_INTERFACE:include>
    $<INSTALL_INTERFACE:include>
    )
    ......@@ -131,14 +190,19 @@ set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/libcaosdb/")
    # libcaosdb with libcaosdbTargets.
    install(
    # targets to install
    TARGETS caosdb
    TARGETS
    caosdb
    caosdb_info_v1alpha1
    #${_REFLECTION}
    #${_GRPC_GRPCPP}
    #${_PROTOBUF_LIBPROTOBUF}
    # name of the CMake "export group" containing the targets we want to install
    #EXPORT libcaosdbTargets
    EXPORT caosdbTargets
    # 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}
    INCLUDES DESTINATION ${libcaosdb_INCLUDE_DEST}
    )
    ......@@ -152,72 +216,26 @@ install(
    # install(EXPORT ...) will install the information about an export. Here, we
    # save it to a file {$libcaosdb_LIB_DEST}/libcaosdbTargets.cmake and prepend
    # everything inside libcaosdbTargets with the namespace libcaosdb::.
    #install(
    ## The export we want to save (matches name defined above containing the
    ## install targets)
    #EXPORT libcaosdbTargets
    ## CMake file in which to store the export's information
    #FILE libcaosdbTargets.cmake
    ## Namespace prepends all targets in the export (when we import later, we
    ## will use caosdb::caosdb)
    #NAMESPACE caosdb::
    ## where to place the resulting file (here, we're putting it with the library)
    #DESTINATION ${libcaosdb_LIB_DEST}
    #)
    install(
    # The export we want to save (matches name defined above containing the
    # install targets)
    EXPORT caosdbTargets
    # CMake file in which to store the export's information
    FILE caosdbTargets.cmake
    # Namespace prepends all targets in the export (when we import later, we
    # will use caosdb::caosdb)
    NAMESPACE caosdb::
    # where to place the resulting file (here, we're putting it with the library)
    DESTINATION ${libcaosdb_LIB_DEST}
    )
    ## 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})
    ## CODE GENERATION
    option(GRPC_FETCHCONTENT "Fetch and build GRPC from the sources" ON)
    include(FetchGRPC)
    #
    # Protobuf/Grpc source files
    #
    set(PROTO_FILES
    ${PROJECT_SOURCE_DIR}/proto/proto/caosdb/info/v1alpha1/main.proto
    )
    set(PROTO_PATH ${PROJECT_SOURCE_DIR}/proto/proto)
    # Generated sources
    set(hw_proto_srcs "${CMAKE_CURRENT_BINARY_DIR}/include/caosdb/info/v1alpha1/main.pb.cc")
    set(hw_proto_hdrs "${CMAKE_CURRENT_BINARY_DIR}/include/caosdb/info/v1alpha1/main.pb.h")
    set(hw_grpc_srcs "${CMAKE_CURRENT_BINARY_DIR}/include/caosdb/info/v1alpha1/main.grpc.pb.cc")
    set(hw_grpc_hdrs "${CMAKE_CURRENT_BINARY_DIR}/include/caosdb/info/v1alpha1/main.grpc.pb.h")
    add_custom_command(
    OUTPUT "${hw_proto_srcs}" "${hw_proto_hdrs}" "${hw_grpc_srcs}" "${hw_grpc_hdrs}"
    COMMAND ${_PROTOBUF_PROTOC}
    ARGS --grpc_out "${CMAKE_CURRENT_BINARY_DIR}/include"
    --cpp_out "${CMAKE_CURRENT_BINARY_DIR}/include"
    -I "${PROTO_PATH}"
    --plugin=protoc-gen-grpc="${_GRPC_CPP_PLUGIN_EXECUTABLE}"
    "${PROTO_FILES}"
    DEPENDS "${PROTO_FILES}")
    install(FILES ${libcaosdb_INCL} DESTINATION ${libcaosdb_INCLUDE_DEST})
    install(FILES ${hw_grpc_hdrs} ${hw_proto_hdrs}
    DESTINATION ${libcaosdb_INCLUDE_DEST}/${hw_hdrs_path})
    install(FILES ${PROJECT_SOURCE_DIR}/caosdbConfig.cmake
    DESTINATION ${libcaosdb_LIB_DEST})
    # Include generated *.pb.h files
    target_include_directories(caosdb PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/include")
    # hw_grpc_proto
    add_library(caosdb_info_v1alpha1
    ${hw_grpc_srcs}
    ${hw_grpc_hdrs}
    ${hw_proto_srcs}
    ${hw_proto_hdrs})
    target_link_libraries(caosdb_info_v1alpha1
    ${_REFLECTION}
    ${_GRPC_GRPCPP}
    ${_PROTOBUF_LIBPROTOBUF})
    target_include_directories(caosdb_info_v1alpha1 PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/include")
    target_link_libraries(caosdb
    caosdb_info_v1alpha1
    ${_REFLECTION}
    ${_GRPC_GRPCPP}
    ${_PROTOBUF_LIBPROTOBUF})
    get_filename_component(CAOSDB_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
    include(CMakeFindDependencyMacro)
    find_dependency(Protobuf CONFIG REQUIRED)
    find_dependency(gRPC CONFIG REQUIRED)
    if(NOT TARGET caosdb::caosdb)
    include("${CAOSDB_CMAKE_DIR}/caosdbTargets.cmake")
    endif()
    ......@@ -20,8 +20,8 @@
    # add all header files to this list
    set(libcaosdb_INCL
    include/caosdb_config.h
    include/connection.h
    ${CMAKE_CURRENT_BINARY_DIR}/caosdb_config.h
    ${CMAKE_CURRENT_SOURCE_DIR}/connection.h
    )
    # pass variable to parent scope
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment