Skip to content
Snippets Groups Projects
Commit 40686658 authored by Michael Davis's avatar Michael Davis
Browse files

[xrd_ssi] Refactors EOS-CTA protocol buffer build system

Now the submodule does not provide a CMakeLists.txt file, this is now
provided by the main project (eos_cta/CMakeLists.txt)
parent 7545b91b
No related branches found
No related tags found
No related merge requests found
......@@ -102,7 +102,6 @@ ELSE(DEFINED PackageOnly)
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/xrootd-ssi-protobuf-interface/cmake)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
include(GNUInstallDirs)
set(CMAKE_INSTALL_PREFIX "/")
......@@ -131,9 +130,9 @@ ELSE(DEFINED PackageOnly)
#
# Location of git submodule containing the XRootD SSI Protocol Buffer bindings
#
set(XRD_SSI_PB_DIR xrootd-ssi-protobuf-interface)
set(XRD_SSI_PB_DIR ${PROJECT_SOURCE_DIR}/xrootd-ssi-protobuf-interface)
add_subdirectory(xrootd-ssi-protobuf-interface)
add_subdirectory(eos_cta)
add_subdirectory(cmdline)
add_subdirectory(xroot_plugins)
......
# From, https://raw.githubusercontent.com/Kitware/CMake/master/Modules/FindProtobuf.cmake
# cut down to solve our problem and nothing more
#=============================================================================
# Copyright 2009 Kitware, Inc.
# Copyright 2009-2011 Philip Lowman <philip@yhbt.com>
# Copyright 2008 Esben Mose Hansen, Ange Optimization ApS
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
set(PROTOBUF3_RPATH /usr/lib64/protobuf3)
message(STATUS "PROTOBUF3_RPATH=${PROTOBUF3_RPATH}")
set(PROTOBUF3_INCLUDE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
find_program(PROTOBUF3_PROTOC3_EXECUTABLE
NAMES protoc3
DOC "Version 3 of The Google Protocol Buffers Compiler"
)
message(STATUS "protoc3 is at ${PROTOBUF3_PROTOC3_EXECUTABLE} ")
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 ${PROTOBUF3_RPATH}
NO_DEFAULT_PATH)
message(STATUS "PROTOBUF3_LIBRARIES=${PROTOBUF3_LIBRARIES}")
function(PROTOBUF3_GENERATE_CPP SRCS HDRS)
if(NOT ARGN)
message(SEND_ERROR "Error: PROTOBUF3_GENERATE_CPP() called without any proto files")
return()
endif()
set(_protobuf_include_path -I ${PROTOBUF3_INCLUDE_PATH})
set(${SRCS})
set(${HDRS})
foreach(FIL ${ARGN})
get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
get_filename_component(FIL_WE ${FIL} NAME_WE)
list(APPEND ${SRCS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.cc")
list(APPEND ${HDRS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h")
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.cc"
"${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h"
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}"
VERBATIM )
endforeach()
set_source_files_properties(${${SRCS}} ${${HDRS}} PROPERTIES GENERATED TRUE)
set(${SRCS} ${${SRCS}} PARENT_SCOPE)
set(${HDRS} ${${HDRS}} PARENT_SCOPE)
endfunction()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Protobuf3 DEFAULT_MSG
PROTOBUF3_INCLUDE_DIRS PROTOBUF3_LIBRARIES PROTOBUF3_RPATH)
# - Find xroot
# Finds the header files of xrootd-devel by searching for XrdVersion.hh
# Finds the header files of xrootd-private-devel by searching for XrdOssApi.hh
#
# XROOTD_FOUND - true if xrootd has been found
# XROOTD_INCLUDE_DIR - location of the xrootd-devel header files
# XROOTD_PRIVATE_INCLUDE_DIR - location of the private xrootd files, in other
# words the header files that do not contribute to
# the xrootd ABI.
# XROOTD_XRDCL_LIB - location of the XrdCl library
# XROOTD_XRDCLIENT_LIB - location of the XrdClient library
# XROOTD_XRDSERVER_LIB - location of the XrdServer library
# XROOTD_XRDUTILS_LIB - location of the XrdUtils library
# XROOTD_XRDPOSIX_LIB - location of the XrdPosix library
# Be silent if XROOTD_INCLUDE_DIR is already cached
if (XROOTD_INCLUDE_DIR)
set(XROOTD_FIND_QUIETLY TRUE)
endif (XROOTD_INCLUDE_DIR)
find_path (XROOTD_INCLUDE_DIR XrdVersion.hh
PATH_SUFFIXES include/xrootd
)
find_path (XROOTD_PRIVATE_INCLUDE_DIR XrdOss/XrdOssApi.hh
PATH_SUFFIXES include/xrootd/private
)
find_library (XROOTD_XRDCL_LIB XrdCl)
find_library (XROOTD_XRDCLIENT_LIB XrdClient)
find_library (XROOTD_XRDSERVER_LIB XrdServer)
find_library (XROOTD_XRDUTILS_LIB XrdUtils)
find_library (XROOTD_XRDPOSIX_LIB XrdPosixPreload)
message (STATUS "XROOTD_INCLUDE_DIR = ${XROOTD_INCLUDE_DIR}")
message (STATUS "XROOTD_PRIVATE_INCLUDE_DIR = ${XROOTD_PRIVATE_INCLUDE_DIR}")
message (STATUS "XROOTD_XRDCL_LIB = ${XROOTD_XRDCL_LIB}")
message (STATUS "XROOTD_XRDCLIENT_LIB = ${XROOTD_XRDCLIENT_LIB}")
message (STATUS "XROOTD_XRDSERVER_LIB = ${XROOTD_XRDSERVER_LIB}")
message (STATUS "XROOTD_XRDPOSIX_LIB = ${XROOTD_XRDPOSIX_LIB}")
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (xrootd DEFAULT_MSG
XROOTD_INCLUDE_DIR
XROOTD_PRIVATE_INCLUDE_DIR
XROOTD_XRDCL_LIB
XROOTD_XRDCLIENT_LIB
XROOTD_XRDSERVER_LIB
XROOTD_XRDUTILS_LIB
XROOTD_XRDPOSIX_LIB)
\ No newline at end of file
# - Find xrootclient
# Finds the header files of xrootd-devel by searching for XrdVersion.hh
#
# XROOTD_FOUND - true if xrootd has been found
# XROOTD_INCLUDE_DIR - location of the xrootd-devel header files
# words the header files that do not contribute to
# the xrootd ABI.
# XROOTD_XRDCL_LIB - location of the XrdCl library
# XROOTD_XRDCLIENT_LIB - location of the XrdClient library
# Be silent if XROOTD_INCLUDE_DIR is already cached
if (XROOTD_INCLUDE_DIR)
set(XROOTD_FIND_QUIETLY TRUE)
endif (XROOTD_INCLUDE_DIR)
find_path (XROOTD_INCLUDE_DIR XrdVersion.hh
PATH_SUFFIXES include/xrootd
)
find_library (XROOTD_XRDCL_LIB XrdCl)
find_library (XROOTD_XRDCLIENT_LIB XrdClient)
message (STATUS "XROOTD_INCLUDE_DIR = ${XROOTD_INCLUDE_DIR}")
message (STATUS "XROOTD_XRDCL_LIB = ${XROOTD_XRDCL_LIB}")
message (STATUS "XROOTD_XRDCLIENT_LIB = ${XROOTD_XRDCLIENT_LIB}")
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (xrootd DEFAULT_MSG
XROOTD_INCLUDE_DIR
XROOTD_XRDCL_LIB
XROOTD_XRDCLIENT_LIB)
......@@ -30,12 +30,12 @@ include_directories(${XROOTD_INCLUDE_DIR} ${XROOTD_INCLUDE_DIR}/private)
#
# XRootD SSI Protocol Buffer bindings
#
include_directories(${CMAKE_SOURCE_DIR}/${XRD_SSI_PB_DIR}/include ${CMAKE_SOURCE_DIR}/${XRD_SSI_PB_DIR}/eos_cta/include)
include_directories(${XRD_SSI_PB_DIR}/include ${XRD_SSI_PB_DIR}/eos_cta/include)
#
# Compiled protocol buffers
#
include_directories(${CMAKE_BINARY_DIR}/${XRD_SSI_PB_DIR}/eos_cta/protobuf ${PROTOBUF3_INCLUDE_DIRS})
include_directories(${CMAKE_BINARY_DIR}/eos_cta ${PROTOBUF3_INCLUDE_DIRS})
#
# eoscta_stub is a drop-in replacement for "cta archive|retrieve|delete"
......
# The CERN Tape Archive (CTA) project
# Copyright 2018 CERN
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
cmake_minimum_required(VERSION 2.6)
find_package(Protobuf3 REQUIRED)
set(PROTOBUF3_INCLUDE_PATH ${XRD_SSI_PB_DIR}/eos_cta/protobuf/)
file(GLOB ProtoFiles "${PROTOBUF3_INCLUDE_PATH}/*.proto")
PROTOBUF3_GENERATE_CPP(ProtoSources ProtoHeaders ${ProtoFiles})
set_source_files_properties(
${ProtoSources} ${ProtoHeaders}
PROPERTIES GENERATED 1)
foreach(PROTO_SRC ${ProtoSources})
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)
set(CTA_FRONT_END_MESSAGES_SRC_FILES ${ProtoSources})
include_directories(${PROTOBUF3_INCLUDE_DIRS})
add_library(XrdSsiPbEosCta ${CTA_FRONT_END_MESSAGES_SRC_FILES})
set_target_properties(XrdSsiPbEosCta PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(XrdSsiPbEosCta ${PROTOBUF3_LIBRARIES})
......@@ -25,12 +25,12 @@ include_directories(${CMAKE_SOURCE_DIR}/tapeserver)
#
# XRootD SSI Protocol Buffer bindings
#
include_directories(${CMAKE_SOURCE_DIR}/${XRD_SSI_PB_DIR}/include ${CMAKE_SOURCE_DIR}/${XRD_SSI_PB_DIR}/eos_cta/include)
include_directories(${XRD_SSI_PB_DIR}/include ${XRD_SSI_PB_DIR}/eos_cta/include)
#
# Compiled protocol buffers
#
include_directories(${CMAKE_BINARY_DIR}/${XRD_SSI_PB_DIR}/eos_cta/protobuf ${PROTOBUF3_INCLUDE_DIRS})
include_directories(${CMAKE_BINARY_DIR}/eos_cta ${PROTOBUF3_INCLUDE_DIRS})
#
# XRootD SSI plugin for CTA Frontend
......
Subproject commit d0edce3d03d584b2a52c577aa4fc681c69d2fe4c
Subproject commit d36f5a1848a4164b9a1182f21614e36e854f3785
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