Skip to content

Commit

Permalink
[XrdCeph] Update CMake build system to be like other plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
amadio committed Mar 8, 2024
1 parent a3dec2f commit 7ac46fd
Show file tree
Hide file tree
Showing 67 changed files with 69 additions and 4,407 deletions.
1 change: 1 addition & 0 deletions .ci/config.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
set(FORCE_ENABLED 0 CACHE BOOL "")
set(ENABLE_ASAN 0 CACHE BOOL "")
set(ENABLE_TSAN 0 CACHE BOOL "")
set(ENABLE_CEPH 1 CACHE BOOL "")
set(ENABLE_FUSE 1 CACHE BOOL "")
set(ENABLE_HTTP 1 CACHE BOOL "")
set(ENABLE_KRB5 1 CACHE BOOL "")
Expand Down
2 changes: 1 addition & 1 deletion src/XrdCeph/cmake/Findceph.cmake → cmake/Findceph.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ find_library(
set(RADOS_LIBS ${RADOS_LIB} ${RADOSSTRIPER_LIB})

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ceph DEFAULT_MSG RADOS_INCLUDE_DIR RADOS_LIBS)
find_package_handle_standard_args(ceph REQUIRED_VARS RADOS_INCLUDE_DIR RADOS_LIB RADOSSTRIPER_LIB)
6 changes: 6 additions & 0 deletions cmake/XRootDDefaults.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ endif()
include( CMakeDependentOption )

define_default( PLUGIN_VERSION 5 )
option( ENABLE_CEPH "Enable XrdCeph plugins." FALSE )
option( ENABLE_FUSE "Enable the fuse filesystem driver if possible." TRUE )
option( ENABLE_KRB5 "Enable the Kerberos 5 authentication if possible." TRUE )
option( ENABLE_READLINE "Enable the lib readline support in the commandline utilities." TRUE )
Expand All @@ -32,3 +33,8 @@ cmake_dependent_option( ENABLE_MACAROONS "Enable Macaroons plugin." TRUE "NOT XR
option( FORCE_ENABLED "Fail build if enabled components cannot be built." FALSE )
cmake_dependent_option( USE_SYSTEM_ISAL "Use isa-l installed in the system" FALSE "ENABLE_XRDEC" FALSE )
define_default( XRD_PYTHON_REQ_VERSION 3 )

# backward compatibility
if(XRDCEPH_SUBMODULE)
set(ENABLE_CEPH TRUE)
endif()
2 changes: 1 addition & 1 deletion cmake/XRootDSummary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Print the configuration summary
#-------------------------------------------------------------------------------
set( TRUE_VAR TRUE )
component_status( CEPH XRDCEPH_SUBMODULE TRUE_VAR)
component_status( CEPH ENABLE_CEPH BUILD_CEPH )
component_status( FUSE BUILD_FUSE FUSE_FOUND )
component_status( HTTP BUILD_HTTP OPENSSL_FOUND )
component_status( KRB5 BUILD_KRB5 KERBEROS5_FOUND )
Expand Down
4 changes: 2 additions & 2 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export DEB_BUILD_MAINT_OPTIONS = hardening=+all optimize=-lto

override_dh_auto_configure:
dh_auto_configure -- \
-DENABLE_CEPH:BOOL=1 \
-DENABLE_FUSE:BOOL=1 \
-DENABLE_HTTP:BOOL=1 \
-DENABLE_KRB5:BOOL=1 \
Expand All @@ -23,8 +24,7 @@ override_dh_auto_configure:
-DENABLE_TESTS:BOOL=1 \
-DFORCE_ENABLED:BOOL=1 \
-DINSTALL_PYTHON_BINDINGS:BOOL=0 \
-DUSE_SYSTEM_ISAL:BOOL=1 \
-DXRDCEPH_SUBMODULE:BOOL=1
-DUSE_SYSTEM_ISAL:BOOL=1

override_dh_auto_build:
dh_auto_build
Expand Down
4 changes: 1 addition & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ if( NOT XRDCL_ONLY )
include( XrdVoms )
endif()

if( XRDCEPH_SUBMODULE )
add_subdirectory( XrdCeph )
endif()
add_subdirectory( XrdCeph )

if( BUILD_SCITOKENS )
include( XrdSciTokens )
Expand Down
1 change: 0 additions & 1 deletion src/XrdCeph/.gitattributes

This file was deleted.

58 changes: 0 additions & 58 deletions src/XrdCeph/.gitignore

This file was deleted.

75 changes: 0 additions & 75 deletions src/XrdCeph/.gitlab-ci.yml

This file was deleted.

22 changes: 0 additions & 22 deletions src/XrdCeph/.travis.yml

This file was deleted.

100 changes: 45 additions & 55 deletions src/XrdCeph/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,62 +1,52 @@
#-------------------------------------------------------------------------------
# Project description
#-------------------------------------------------------------------------------
cmake_minimum_required(VERSION 3.16...3.25)

project( xrootd-ceph )

set( CMAKE_MODULE_PATH
${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/cmake )
if(NOT ENABLE_CEPH)
unset(BUILD_CEPH CACHE)
return()
endif()

if( NOT XRDCEPH_SUBMODULE )
if(NOT (CMAKE_VERSION VERSION_LESS "3.1"))
cmake_policy(SET CMP0054 OLD)
if(FORCE_ENABLED)
find_package(ceph REQUIRED)
else()
find_package(ceph)
if(NOT CEPH_FOUND)
unset(BUILD_CEPH CACHE)
return()
endif()
endif()

include( XRootDUtils )
CheckBuildDirectory()

include( XRootDOSDefs )
include( XRootDDefaults )
include( XRootDFindLibs )

add_definitions( -DXRDPLUGIN_SOVERSION="${PLUGIN_VERSION}" )

#-------------------------------------------------------------------------------
# Generate the version header
#-------------------------------------------------------------------------------
if( NOT XRDCEPH_SUBMODULE )
execute_process(
COMMAND ${CMAKE_SOURCE_DIR}/genversion.sh --print-only ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE XROOTD_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE )

add_custom_target(
XrdVersion.hh
${CMAKE_SOURCE_DIR}/genversion.sh ${CMAKE_SOURCE_DIR} )

# sigh, yet another ugly hack :(
macro( add_library _target )
_add_library( ${_target} ${ARGN} )
add_dependencies( ${_target} XrdVersion.hh )
endmacro()

macro( add_executable _target )
_add_executable( ${_target} ${ARGN} )
add_dependencies( ${_target} XrdVersion.hh )
endmacro()
endif()
set(BUILD_CEPH TRUE CACHE BOOL INTERNAL FORCE)

#-------------------------------------------------------------------------------
# Build in subdirectories
#-------------------------------------------------------------------------------
add_subdirectory( src )
add_library(XrdCephPosix SHARED
XrdCephPosix.cc XrdCephPosix.hh)

if( BUILD_TESTS )
ENABLE_TESTING()
add_subdirectory( tests )
endif()
target_compile_options(XrdCephPosix
PRIVATE -Wno-deprecated-declarations)

target_link_libraries(XrdCephPosix
PRIVATE XrdUtils ${RADOS_LIBS})

target_include_directories(XrdCephPosix
PUBLIC ${RADOS_INCLUDE_DIR} $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src>)

set_target_properties(XrdCephPosix
PROPERTIES VERSION 0.0.1 SOVERSION 0)

set(LIB_XRD_CEPH XrdCeph-${PLUGIN_VERSION})

add_library(${LIB_XRD_CEPH} MODULE
XrdCephOss.cc XrdCephOss.hh
XrdCephOssFile.cc XrdCephOssFile.hh
XrdCephOssDir.cc XrdCephOssDir.hh)

target_link_libraries(${LIB_XRD_CEPH}
PRIVATE ${XROOTD_LIBRARIES} XrdCephPosix)

set(LIB_XRD_CEPH_XATTR XrdCephXattr-${PLUGIN_VERSION})

add_library(${LIB_XRD_CEPH_XATTR} MODULE
XrdCephXAttr.cc XrdCephXAttr.hh)

target_link_libraries(${LIB_XRD_CEPH_XATTR}
PRIVATE ${XROOTD_LIBRARIES} XrdCephPosix)

include( XRootDSummary )
install(TARGETS XrdCephPosix ${LIB_XRD_CEPH} ${LIB_XRD_CEPH_XATTR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
Loading

0 comments on commit 7ac46fd

Please sign in to comment.