From 5372910c31e92f4adbaf8b82b64ae8100c13514f Mon Sep 17 00:00:00 2001 From: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de> Date: Wed, 27 Oct 2021 15:26:02 +0200 Subject: [PATCH] cta-dcache: minimise integration into other modules --- cta-dcache/gRPC/CMakeLists.txt | 39 ++++++++++++++++++++++++++++++---- eos_cta/CMakeLists.txt | 20 ++--------------- 2 files changed, 37 insertions(+), 22 deletions(-) diff --git a/cta-dcache/gRPC/CMakeLists.txt b/cta-dcache/gRPC/CMakeLists.txt index 8025c8ce42..0a5a1242ed 100644 --- a/cta-dcache/gRPC/CMakeLists.txt +++ b/cta-dcache/gRPC/CMakeLists.txt @@ -16,14 +16,45 @@ cmake_minimum_required (VERSION 2.6) find_package(Protobuf3 REQUIRED) +find_package(GRPC REQUIRED) -include_directories(${CMAKE_BINARY_DIR}/eos_cta +include_directories(${PROTOBUF3_INCLUDE_DIRS}) + +set(PROTOBUF_CTADCACHE_DIR ${PROJECT_SOURCE_DIR}/cta-dcache/grpc-proto/protobuf) +file(GLOB ProtoFilesCtaDcache "${PROTOBUF_CTADCACHE_DIR}/*.proto") + +# depends on CTA_EOS definitions +set(PROTOBUF_EOS_CTA_DIR ${XRD_SSI_PB_DIR}/eos_cta/protobuf) +file(GLOB ProtoFilesEosCta "${PROTOBUF_EOS_CTA_DIR}/*.proto") + +set(PROTOBUF3_INCLUDE_PATH "${PROTOBUF_EOS_CTA_DIR}:${PROTOBUF_CTADCACHE_DIR}:${PROTOBUF3_INCLUDE_DIRS}") +PROTOBUF3_GENERATE_CPP(ProtoSourcesCtaDcache ProtoHeadersCtaDcache ${ProtoFilesCtaDcache}) + +set(GRPC_PROTOBUF_PATH "${CMAKE_BINARY_DIR}/cta-dcache/gRPC") +set(PROTOBUF3_IMPORT_DIRS "${PROTOBUF_EOS_CTA_DIR}:${PROTOBUF3_INCLUDE_DIRS}") +grpc_generate_cpp(ProtoGrpcSourcesCtaDcache ProtoGrpcHeadersCtaDcache ${GRPC_PROTOBUF_PATH} ${ProtoFilesCtaDcache}) + +set_source_files_properties( + ${ProtoSourcesCtaDcache} ${ProtoHeadersCtaDcache} + ${ProtoGrpcSourcesCtaDcache} ${ProtoGrpcHeadersCtaDcache} + PROPERTIES GENERATED TRUE) + +foreach(PROTO_SRC ${ProtoSourcesCtaDcache} ${ProtoGrpcSourcesCtaDcache}) + set_property(SOURCE ${PROTO_SRC} PROPERTY COMPILE_FLAGS " -Wno-missing-field-initializers -fPIC -Wno-narrowing -Wno-implicit-fallthrough") + # Add -Wno-narrowing -Wno-implicit-fallthrough compiler flags if using gcc version 7 or greater + if(CMAKE_COMPILER_IS_GNUCC) + if(GCC_VERSION VERSION_EQUAL 7 OR GCC_VERSION VERSION_GREATER 7) + set_property(SOURCE ${PROTO_SRC} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-narrowing -Wno-implicit-fallthrough") + endif(GCC_VERSION VERSION_EQUAL 7 OR GCC_VERSION VERSION_GREATER 7) + endif(CMAKE_COMPILER_IS_GNUCC) +endforeach(PROTO_SRC) + +include_directories(${CMAKE_BINARY_DIR}/cta-dcache/gRPC ${CMAKE_BINARY_DIR}/eos_cta ${PROTOBUF3_INCLUDE_DIRS}) -add_executable(cta-dcache FrontendGRpcSvc.cpp) +add_executable(cta-dcache FrontendGRpcSvc.cpp ${ProtoSourcesCtaDcache} ${ProtoGrpcSourcesCtaDcache}) -target_link_libraries(cta-dcache CtaGRpc - ${PROTOBUF3_LIBRARIES} ${GRPC_GRPC++_LIBRARY} +target_link_libraries(cta-dcache ${PROTOBUF3_LIBRARIES} ${GRPC_GRPC++_LIBRARY} ctascheduler ctacommon ctaobjectstore ctacatalogue) set_property(TARGET cta-dcache APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH}) diff --git a/eos_cta/CMakeLists.txt b/eos_cta/CMakeLists.txt index 8e59d41eac..b10e0c4468 100644 --- a/eos_cta/CMakeLists.txt +++ b/eos_cta/CMakeLists.txt @@ -24,31 +24,23 @@ set(PROTOBUF_EOS_CTA_DIR ${XRD_SSI_PB_DIR}/eos_cta/protobuf) file(GLOB ProtoFilesEosCta "${PROTOBUF_EOS_CTA_DIR}/*.proto") set(PROTOBUF_MIGRATION_DIR ${PROJECT_SOURCE_DIR}/migration/grpc-proto/protobuf) file(GLOB ProtoFilesMigration "${PROTOBUF_MIGRATION_DIR}/*.proto") -set(PROTOBUF_FRONTEND_DIR ${PROJECT_SOURCE_DIR}/cta-dcache/grpc-proto/protobuf) -file(GLOB ProtoFilesFrontendCta "${PROTOBUF_FRONTEND_DIR}/*.proto") # Compile protobufs -set(PROTOBUF3_INCLUDE_PATH ${PROTOBUF_EOS_CTA_DIR}:${PROTOBUF_MIGRATION_DIR}:${PROTOBUF_FRONTEND_DIR}:${PROTOBUF3_INCLUDE_DIRS}) +set(PROTOBUF3_INCLUDE_PATH ${PROTOBUF_EOS_CTA_DIR}:${PROTOBUF_MIGRATION_DIR}) PROTOBUF3_GENERATE_CPP(ProtoSourcesEosCta ProtoHeadersEosCta ${ProtoFilesEosCta}) PROTOBUF3_GENERATE_CPP(ProtoSourcesMigration ProtoHeadersMigration ${ProtoFilesMigration}) -PROTOBUF3_GENERATE_CPP(ProtoSourcesFrontendCta ProtoHeadersFrontendCta ${ProtoFilesFrontendCta}) # Compile gRPC code set(GRPC_PROTOBUF_PATH "${CMAKE_BINARY_DIR}/eos_cta/") grpc_generate_cpp(ProtoGrpcSourcesMigration ProtoGrpcHeadersMigration ${GRPC_PROTOBUF_PATH} ${ProtoFilesMigration}) -# depends on CTA_EOS definitions -set(PROTOBUF3_IMPORT_DIRS "${PROTOBUF_EOS_CTA_DIR}:${PROTOBUF3_INCLUDE_DIRS}") -grpc_generate_cpp(ProtoGrpcSourcesFrontendCta ProtoGrpcHeadersFrontendCta ${GRPC_PROTOBUF_PATH} ${ProtoFilesFrontendCta}) set_source_files_properties( ${ProtoSourcesEosCta} ${ProtoHeadersEosCta} ${ProtoSourcesMigration} ${ProtoHeadersMigration} ${ProtoGrpcSourcesMigration} ${ProtoGrpcHeadersMigration} - ${ProtoSourcesFrontendCta} ${ProtoHeadersFrontendCta} - ${ProtoGrpcSourcesFrontendCta} ${ProtoGrpcHeadersFrontendCta} PROPERTIES GENERATED TRUE) -foreach(PROTO_SRC ${ProtoSourcesEosCta} ${ProtoSourcesMigration} ${ProtoGrpcSourcesMigration} ${ProtoSourcesFrontendCta} ${ProtoGrpcSourcesFrontendCta}) +foreach(PROTO_SRC ${ProtoSourcesEosCta} ${ProtoSourcesMigration} ${ProtoGrpcSourcesMigration}) set_property(SOURCE ${PROTO_SRC} PROPERTY COMPILE_FLAGS " -Wno-missing-field-initializers -fPIC -Wno-narrowing -Wno-implicit-fallthrough") endforeach(PROTO_SRC) @@ -63,11 +55,3 @@ set_target_properties(EosMigration PROPERTIES LINKER_LANGUAGE CXX POSITION_INDEPENDENT_CODE TRUE) target_link_libraries(EosMigration ${PROTOBUF3_GRPC_LIBRARIES}) - -add_library(CtaGRpc ${ProtoSourcesFrontendCta} ${ProtoGrpcSourcesFrontendCta}) -set_target_properties(CtaGRpc PROPERTIES - LINKER_LANGUAGE CXX - POSITION_INDEPENDENT_CODE TRUE) -target_link_libraries(CtaGRpc ${PROTOBUF3_GRPC_LIBRARIES}) - -add_dependencies(CtaGRpc XrdSsiPbEosCta) -- GitLab