diff --git a/cmake/FindProtobuf.cmake b/cmake/FindProtobuf3.cmake similarity index 67% rename from cmake/FindProtobuf.cmake rename to cmake/FindProtobuf3.cmake index ecc6ff39a514b764b35d658e677cd606751b354b..2c0e00b315930ea77ce989ed15bac009543a9f71 100644 --- a/cmake/FindProtobuf.cmake +++ b/cmake/FindProtobuf3.cmake @@ -15,15 +15,27 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -find_program(PROTOBUF_PROTOC_EXECUTABLE - NAMES protoc - DOC "The Google Protocol Buffers Compiler" +find_program(PROTOBUF3_PROTOC3_EXECUTABLE + NAMES protoc3 + DOC "Version 3 of The Google Protocol Buffers Compiler" ) +message(STATUS "protoc3 is at ${PROTOBUF3_PROTOC3_EXECUTABLE} ") -message(STATUS "protoc is at ${PROTOBUF_PROTOC_EXECUTABLE} ") -function(PROTOBUF_GENERATE_CPP SRCS HDRS) +find_path(PROTOBUF3_INCLUDE_DIRS + google/protobuf/message.h + PATHS /usr/include/protobuf3 + NO_DEFAULT_PATH) +message(STATUS "PROTOBUF3_INCLUDE_DIRS=${PROTOBUF3_INCLUDE_DIRS}") + +find_library(PROTOBUF3_LIBRARIES + NAME protobuf + PATHS /usr/lib64/protobuf3 + NO_DEFAULT_PATH) +message(STATUS "PROTOBUF3_LIBRARIES=${PROTOBUF3_LIBRARIES}") + +function(PROTOBUF3_GENERATE_CPP SRCS HDRS) if(NOT ARGN) - message(SEND_ERROR "Error: PROTOBUF_GENERATE_CPP() called without any proto files") + message(SEND_ERROR "Error: PROTOBUF3_GENERATE_CPP() called without any proto files") return() endif() @@ -41,7 +53,7 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS) add_custom_command( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.cc" "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h" - COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} + COMMAND ${PROTOBUF3_PROTOC3_EXECUTABLE} ARGS --cpp_out ${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${ABS_FIL} DEPENDS ${ABS_FIL} COMMENT "Running C++ protocol buffer compiler on ${FIL}" @@ -51,4 +63,8 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS) set_source_files_properties(${${SRCS}} ${${HDRS}} PROPERTIES GENERATED TRUE) set(${SRCS} ${${SRCS}} PARENT_SCOPE) set(${HDRS} ${${HDRS}} PARENT_SCOPE) -endfunction() \ No newline at end of file +endfunction() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Protobuf3 DEFAULT_MSG + PROTOBUF3_INCLUDE_DIRS PROTOBUF3_LIBRARIES) diff --git a/cta.spec.in b/cta.spec.in index b4fbf7b5a08786a2eac6ca518f54680eb6558663..04e7c8588a5f61740b0eaf5c13d6f0114336e647 100644 --- a/cta.spec.in +++ b/cta.spec.in @@ -42,7 +42,7 @@ BuildRequires: xrootd-devel = 1:4.4.1 BuildRequires: xrootd-server-devel = 1:4.4.1 BuildRequires: xrootd-private-devel = 1:4.4.1 BuildRequires: librados-devel >= 11.0, libradosstriper-devel >= 11.0, -BuildRequires: protobuf3-compiler = 3.2.0 protobuf3-devel = 3.2.0 +BuildRequires: protobuf3-compiler >= 3.3.1 protobuf3-devel >= 3.3.1 BuildRequires: gmock-devel >= 1.5.0 gtest-devel >= 1.5.0 BuildRequires: sqlite-devel >= 3.6 BuildRequires: libcap-devel >= 2.16 diff --git a/eos/messages/CMakeLists.txt b/eos/messages/CMakeLists.txt index dbf65671bf70c5d53a32ffa1b69d5e02e9544112..866bd4376d9b13b19f4e0c706e04b1691cbd3549 100644 --- a/eos/messages/CMakeLists.txt +++ b/eos/messages/CMakeLists.txt @@ -15,14 +15,17 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. cmake_minimum_required (VERSION 2.6) -find_package(Protobuf REQUIRED) +find_package(Protobuf3 REQUIRED) file(GLOB ProtoFiles "${CMAKE_CURRENT_SOURCE_DIR}/*.proto") -PROTOBUF_GENERATE_CPP(ProtoSources ProtoHeaders ${ProtoFiles}) - +PROTOBUF3_GENERATE_CPP(ProtoSources ProtoHeaders ${ProtoFiles}) +foreach(PROTO_SRC ${ProtoSources}) + set_property(SOURCE ${PROTO_SRC} PROPERTY COMPILE_FLAGS " -Wno-missing-field-initializers") +endforeach(PROTO_SRC) set (CTA_FRONT_END_MESSAGES_SRC_FILES ${ProtoSources}) +include_directories(${PROTOBUF3_INCLUDE_DIRS}) add_library (ctaeosmessages ${CTA_FRONT_END_MESSAGES_SRC_FILES}) target_link_libraries (ctaeosmessages - protobuf) + ${PROTOBUF3_LIBRARIES}) diff --git a/mediachanger/CMakeLists.txt b/mediachanger/CMakeLists.txt index 91a78ca728f15933cd40d57748a23f27c03224ca..f108728bc638f8af81c6a516efbcd75017a9d0fe 100644 --- a/mediachanger/CMakeLists.txt +++ b/mediachanger/CMakeLists.txt @@ -16,11 +16,11 @@ cmake_minimum_required (VERSION 2.6) find_package(openssl REQUIRED) -find_package(Protobuf REQUIRED) +find_package(Protobuf3 REQUIRED) find_package(zeromq REQUIRED) file(GLOB ProtoFiles "${CMAKE_CURRENT_SOURCE_DIR}/*.proto") -PROTOBUF_GENERATE_CPP(ProtoSources ProtoHeaders ${ProtoFiles}) +PROTOBUF3_GENERATE_CPP(ProtoSources ProtoHeaders ${ProtoFiles}) set (MEDIACHANGER_LIB_SRC_FILES AcsLibrarySlot.cpp @@ -52,12 +52,13 @@ set (MEDIACHANGER_LIB_SRC_FILES ZmqMsg.cpp ZmqSocket.cpp) +include_directories (${PROTOBUF3_INCLUDE_DIRS}) add_library (ctamediachanger SHARED ${MEDIACHANGER_LIB_SRC_FILES}) target_link_libraries (ctamediachanger ctacommon - protobuf + ${PROTOBUF3_LIBRARIES} ssl zmq) diff --git a/objectstore/CMakeLists.txt b/objectstore/CMakeLists.txt index 59b55d8be72d542b95ddec8333b39f62b2646e85..c6e2b65c831cc6a2b23087693ac7cc7e4f11205f 100644 --- a/objectstore/CMakeLists.txt +++ b/objectstore/CMakeLists.txt @@ -22,12 +22,12 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../middletier) find_package(json-c REQUIRED) find_package(librados2 REQUIRED) -find_package(Protobuf REQUIRED) +find_package(Protobuf3 REQUIRED) set (CTAProtoFiles cta.proto) -PROTOBUF_GENERATE_CPP(CTAProtoSources CTAProtoHeaders ${CTAProtoFiles}) +PROTOBUF3_GENERATE_CPP(CTAProtoSources CTAProtoHeaders ${CTAProtoFiles}) set (CTAProtoDependants objectstore/Agent.hpp objectstore/ArchiveRequest.hpp @@ -46,7 +46,7 @@ SET_SOURCE_FILES_PROPERTIES(${CTAProtoHeaders} PROPERTIES HEADER_FILE_ONLY TRUE) SET_SOURCE_FILES_PROPERTIES(${CTAProtoDependants} PROPERTIES OBJECT_DEPENDS ${CTAProtoHeaders}) - +include_directories (${PROTOBUF3_INCLUDE_DIRS}) add_library (ctaobjectstore SHARED ${CTAProtoSources} RootEntry.cpp @@ -83,24 +83,24 @@ set(ObjectStoreUnitTests add_library(ctaobjectstoreunittests SHARED ${ObjectStoreUnitTests}) target_link_libraries(ctaobjectstoreunittests - protobuf rados ctacommon gtest ctaobjectstore) + ${PROTOBUF3_LIBRARIES} rados ctacommon gtest ctaobjectstore) install(TARGETS ctaobjectstoreunittests DESTINATION usr/${CMAKE_INSTALL_LIBDIR}) add_executable(cta-objectstore-initialize cta-objectstore-initialize.cpp) target_link_libraries(cta-objectstore-initialize - protobuf ctaobjectstore ctacommon ctautils) + ${PROTOBUF3_LIBRARIES} ctaobjectstore ctacommon ctautils) add_executable(cta-objectstore-list cta-objectstore-list.cpp) target_link_libraries(cta-objectstore-list - protobuf ctaobjectstore ctacommon) + ${PROTOBUF3_LIBRARIES} ctaobjectstore ctacommon) add_executable(cta-objectstore-dump-object cta-objectstore-dump-object.cpp) target_link_libraries(cta-objectstore-dump-object - protobuf ctaobjectstore ctacommon) + ${PROTOBUF3_LIBRARIES} ctaobjectstore ctacommon) add_executable(cta-objectstore-unfollow-agent cta-objectstore-unfollow-agent.cpp) target_link_libraries(cta-objectstore-unfollow-agent - protobuf ctaobjectstore ctacommon) + ${PROTOBUF3_LIBRARIES} ctaobjectstore ctacommon) install(TARGETS cta-objectstore-initialize cta-objectstore-list cta-objectstore-dump-object DESTINATION usr/bin) diff --git a/scheduler/CMakeLists.txt b/scheduler/CMakeLists.txt index 6a3a46896634fe3bcd90af3db49b12c034ff09ca..f85148c63bfa1a29d512d7dd8e15f74ef1a730c5 100644 --- a/scheduler/CMakeLists.txt +++ b/scheduler/CMakeLists.txt @@ -21,11 +21,13 @@ set (CTA_SCHEDULER_SRC_FILES OStoreDB/OStoreDBWithAgent.cpp LabelMount.cpp) +find_package(Protobuf3 REQUIRED) +include_directories (${PROTOBUF3_INCLUDE_DIRS}) add_library (ctascheduler SHARED ${CTA_SCHEDULER_SRC_FILES}) install (TARGETS ctascheduler DESTINATION usr/${CMAKE_INSTALL_LIBDIR}) -target_link_libraries (ctascheduler ctacommon ctaobjectstore protobuf ctautils ctaeos) +target_link_libraries (ctascheduler ctacommon ctaobjectstore ${PROTOBUF3_LIBRARIES} ctautils ctaeos) #add_library (ctaschedulerutils SHARED # _old_prototype_DummyScheduler.cpp) diff --git a/tapeserver/CMakeLists.txt b/tapeserver/CMakeLists.txt index ef4a7c477eb9af7a0f0e0ab0a1980ec9b59a12c0..31881c29f08fcc046fe49ea6f5a10685c508dd2e 100644 --- a/tapeserver/CMakeLists.txt +++ b/tapeserver/CMakeLists.txt @@ -10,8 +10,9 @@ add_subdirectory (session) # from the previous one to create a single library). add_executable (cta-taped cta-taped.cpp) +find_package(Protobuf3 REQUIRED) target_link_libraries(cta-taped - ctatapedaemon ctacommon protobuf) + ctatapedaemon ctacommon ${PROTOBUF3_LIBRARIES}) install (TARGETS cta-taped DESTINATION usr/bin) install (FILES TPCONFIG.example DESTINATION /etc/cta) install (FILES cta-taped.1cta DESTINATION /usr/share/man/man1) diff --git a/tapeserver/castor/messages/CMakeLists.txt b/tapeserver/castor/messages/CMakeLists.txt index 3cd7032bbd795ed7126cc86521226ef431bb0b9d..bcc9f6a09abce948943d072fa1a0e4c315e8f939 100644 --- a/tapeserver/castor/messages/CMakeLists.txt +++ b/tapeserver/castor/messages/CMakeLists.txt @@ -21,12 +21,13 @@ include_directories(${PROJECT_SOURCE_DIR}/tapeserver) include_directories(${PROJECT_BINARY_DIR}/tapeserver) find_package(openssl REQUIRED) -find_package(Protobuf REQUIRED) +find_package(Protobuf3 REQUIRED) find_package(zeromq REQUIRED) file(GLOB ProtoFiles "${CMAKE_CURRENT_SOURCE_DIR}/*.proto") -PROTOBUF_GENERATE_CPP(ProtoSources ProtoHeaders ${ProtoFiles}) +PROTOBUF3_GENERATE_CPP(ProtoSources ProtoHeaders ${ProtoFiles}) +include_directories (${PROTOBUF3_INCLUDE_DIRS}) add_library(ctamessagesprotobuf ${ProtoSources}) @@ -52,5 +53,5 @@ target_link_libraries(ctamessages ctamediachanger ctautils ctatapesession - protobuf + ${PROTOBUF3_LIBRARIES} ssl) diff --git a/tapeserver/castor/tape/tapeserver/daemon/CMakeLists.txt b/tapeserver/castor/tape/tapeserver/daemon/CMakeLists.txt index a34cc31f4c31ae2d9dba097931d6fbe9c7df3b35..00ee282ccaafac012a0636df5dc532f44f1ef242 100644 --- a/tapeserver/castor/tape/tapeserver/daemon/CMakeLists.txt +++ b/tapeserver/castor/tape/tapeserver/daemon/CMakeLists.txt @@ -26,7 +26,7 @@ include_directories(${PROJECT_BINARY_DIR}/tapeserver) include_directories(${CMAKE_SOURCE_DIR}) include_directories(${PROJECT_BINARY_DIR}) -find_package(Protobuf REQUIRED) +find_package(Protobuf3 REQUIRED) find_package( ZLIB REQUIRED ) set(CTATAPESERVERDAEMON_LIBRARY_SRCS @@ -76,9 +76,10 @@ endif(CMAKE_COMPILER_IS_GNUCC) add_library(ctaTapeServerDaemon ${CTATAPESERVERDAEMON_LIBRARY_SRCS}) -target_link_libraries(ctaTapeServerDaemon ctamessages ctacommon protobuf ctascheduler ctalegacymsg ctacatalogue TapeDrive) +target_link_libraries(ctaTapeServerDaemon ctamessages ctacommon ${PROTOBUF3_LIBRARIES} ctascheduler ctalegacymsg ctacatalogue TapeDrive) add_dependencies(ctaTapeServerDaemon ctamessagesprotobuf) +include_directories(${PROTOBUF3_INCLUDE_DIRS}) add_library(ctatapeserverdaemonunittests SHARED DataTransferSessionTest.cpp DiskReadTaskTest.cpp diff --git a/tapeserver/daemon/CMakeLists.txt b/tapeserver/daemon/CMakeLists.txt index 0398d28f9f980ce7c270ea9946962a25cbbce3b5..e8de0817e07d5ad5609de35287961cea3786f983 100644 --- a/tapeserver/daemon/CMakeLists.txt +++ b/tapeserver/daemon/CMakeLists.txt @@ -1,14 +1,15 @@ cmake_minimum_required (VERSION 2.6) -find_package(Protobuf REQUIRED) +find_package(Protobuf3 REQUIRED) include_directories(${PROJECT_BINARY_DIR}/tapeserver) -PROTOBUF_GENERATE_CPP(WDMsgSources WDMsgHeaders WatchdogMessage.proto) +PROTOBUF3_GENERATE_CPP(WDMsgSources WDMsgHeaders WatchdogMessage.proto) SET_SOURCE_FILES_PROPERTIES(${WDMsgHeaders} PROPERTIES HEADER_FILE_ONLY TRUE) SET_SOURCE_FILES_PROPERTIES(DriveHandler.cpp PROPERTIES OBJECT_DEPENDS ${WDMsgHeaders}) +include_directories(${PROTOBUF3_INCLUDE_DIRS}) add_library(ctatapedaemon ${WDMsgSources} CommandLineParams.cpp diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f818d1958ba9464606efc0f1178f5b586e7618be..9f459e3a2d4600b1d3cfad948ffad64f9ed5393b 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -56,13 +56,15 @@ add_executable(cta-unitTests-multiProcess unit_tests.cpp ${GMOCK_SRC}) +find_package(Protobuf3 REQUIRED) + target_link_libraries(cta-unitTests-multiProcess ctadaemonunittests-multiprocess ctacommon ${GMOCK_LIB} gtest pthread - protobuf + ${PROTOBUF3_LIBRAIRES} sqlite3) add_library(unitTestHelper diff --git a/xroot_plugins/CMakeLists.txt b/xroot_plugins/CMakeLists.txt index 386b5a3d35c79b07dbe77a53e1c1d8d03ce3bd4c..6b7b6f898e259d7d8e718bc478c9148fc5415fce 100644 --- a/xroot_plugins/CMakeLists.txt +++ b/xroot_plugins/CMakeLists.txt @@ -22,8 +22,10 @@ include_directories(${XROOTD_INCLUDE_DIR} ${XROOTD_PRIVATE_INCLUDE_DIR}) include_directories(${CMAKE_BINARY_DIR}) include_directories(${CMAKE_SOURCE_DIR}/tapeserver) +find_package(Protobuf3 REQUIRED) +include_directories(${PROTOBUF3_INCLUDE_DIRS}) add_library (XrdCtaOfs MODULE XrdCtaFilesystem.cpp XrdCtaFile.cpp XrdCtaDir.cpp) -target_link_libraries (XrdCtaOfs ctacatalogue ctaeosmessages ctascheduler ctacommon protobuf ctaobjectstore cryptopp) +target_link_libraries (XrdCtaOfs ctacatalogue ctaeosmessages ctascheduler ctacommon ${PROTOBUF3_LIBRARIES} ctaobjectstore cryptopp) INSTALL (TARGETS XrdCtaOfs DESTINATION usr/${CMAKE_INSTALL_LIBDIR}) INSTALL (FILES xrootd-cta.cfg DESTINATION /etc/xrootd/)