Skip to content

Commit

Permalink
Feature: CMSJson (#2)
Browse files Browse the repository at this point in the history
* Add json tfc

* Update cmake

* bump specfile

* update gitignore

* add tests

* add storarge.json
  • Loading branch information
guyzsarun authored Aug 8, 2023
1 parent 8445bc3 commit 1017d2a
Show file tree
Hide file tree
Showing 11 changed files with 653 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ cmake_install.cmake
CMakeFiles
CMakeCache.txt
Makefile
build/*
41 changes: 35 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
cmake_minimum_required( VERSION 2.6 )
cmake_minimum_required( VERSION 3.1 )
project( xrootd-cmstfc )

set( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake )

find_package( Xrootd REQUIRED )
find_package( XercesC REQUIRED )
find_package( Pcre REQUIRED )
find_package( Jsoncpp REQUIRED )

if( CMAKE_COMPILER_IS_GNUCXX )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror" )
Expand All @@ -15,22 +16,42 @@ if( CMAKE_COMPILER_IS_GNUCC )
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror" )
endif()

include_directories( "${PROJECT_SOURCE_DIR}" "${XROOTD_INCLUDES}"
"${XERCES_INCLUDES}" "${PCRE_INCLUDES}" )
include_directories( "${PROJECT_SOURCE_DIR}" "${XROOTD_INCLUDES}" "${XERCES_INCLUDES}" "${PCRE_INCLUDES}" "${JSONCPP_INCLUDES}")

add_library( XrdCmsTfc MODULE src/xml/XrdCmsTfc.cc src/xml/XrdCmsTfc.hh )
add_library( XrdCmsJson MODULE src/json/XrdCmsJson.cc src/json/XrdCmsJson.hh )

add_library( XrdCmsTfc MODULE src/XrdCmsTfc.cc src/XrdCmsTfc.hh )
target_link_libraries(XrdCmsTfc ${XROOTD_UTILS} ${XERCES_LIB} ${PCRE_LIB})
target_link_libraries(XrdCmsJson ${XROOTD_UTILS} ${JSONCPP_LIBRARIES})


if(BUILD_TEST)
add_executable(test_xml.o src/xml/XrdCmsTfc.cc src/xml/XrdCmsTfc.hh tests/test_xml.cc)
target_link_libraries(test_xml.o ${XROOTD_UTILS} ${XERCES_LIB} ${PCRE_LIB})

add_executable(test_json.o src/json/XrdCmsJson.cc src/json/XrdCmsJson.hh tests/test_json.cc)
target_link_libraries(test_json.o ${XROOTD_UTILS} ${JSONCPP_LIBRARIES})

endif()

if (NOT DEFINED CMAKE_INSTALL_LIBDIR)
SET(CMAKE_INSTALL_LIBDIR "lib")
SET(CMAKE_INSTALL_LIBDIR "lib64")
endif()

install(
TARGETS XrdCmsTfc
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} )

install(
FILES ${CMAKE_SOURCE_DIR}/src/XrdCmsTfc.hh
TARGETS XrdCmsJson
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} )

install(
FILES ${CMAKE_SOURCE_DIR}/src/xml/XrdCmsTfc.hh
DESTINATION include )

install(
FILES ${CMAKE_SOURCE_DIR}/src/json/XrdCmsJson.hh
DESTINATION include )

set_target_properties(
Expand All @@ -40,3 +61,11 @@ set_target_properties(
SOVERSION "0"
LINK_INTERFACE_LIBRARIES "" )

set_target_properties(
XrdCmsJson
PROPERTIES
VERSION "0.0.1"
SOVERSION "0"
LINK_INTERFACE_LIBRARIES "" )


24 changes: 24 additions & 0 deletions cmake/FindJsoncpp.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

FIND_PATH(JSONCPP_INCLUDES json.h
HINTS
${JSONCPP_DIR}
$ENV{JSONCPP_DIR}
/usr
/opt/jsoncpp/
PATH_SUFFIXES include/json
PATHS /opt/json
)


FIND_LIBRARY(JSONCPP_LIBRARIES jsoncpp
HINTS
${JSONCPP_DIR}
$ENV{JSONCPP_DIR}
/usr
/opt/jsoncpp/
PATH_SUFFIXES lib
)

INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Jsoncpp DEFAULT_MSG JSONCPP_LIBRARIES JSONCPP_INCLUDES)

19 changes: 8 additions & 11 deletions spec/xrootd-cmstfc.spec
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Name: xrootd-cmstfc
Version: 1.5.2
Release: 7%{?dist}
Version: 2.0.0
Release: 1%{?dist}
Summary: CMS TFC plugin for xrootd

Group: System Environment/Daemons
License: BSD
URL: https://github.com/bbockelm/xrootd-cmstfc
URL: https://github.com/CMSCompOps/xrootd-cmstfc
# Generated from:
# git-archive master | gzip -7 > ~/rpmbuild/SOURCES/xrootd-lcmaps.tar.gz
Source0: %{name}.tar.gz
Expand All @@ -25,15 +25,9 @@ BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)

BuildRequires: xrootd-devel >= 1:%{xrootd_current_major}.0.0-1
BuildRequires: xrootd-devel < 1:%{xrootd_next_major}.0.0-1
BuildRequires: pcre-devel
BuildRequires: cmake pcre-devel xerces-c-devel jsoncpp-devel >= 1.9.4

BuildRequires: xerces-c-devel

BuildRequires: cmake
#BuildRequires: xrootd-compat-libs

Requires: /usr/bin/xrootd pcre xerces-c
#Requires: xrootd-compat-libs
Requires: /usr/bin/xrootd pcre xerces-c jsoncpp >= 1.9.4

#%if 0%%{?rhel} < 7
#Requires: xrootd4 >= 1:4.1.0
Expand Down Expand Up @@ -71,12 +65,15 @@ rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%{_libdir}/libXrdCmsTfc.so
%{_libdir}/libXrdCmsJson.so
%if 0%{?rhel} < 8
%{_libdir}/libXrdCmsTfc.so.*
%{_libdir}/libXrdCmsJson.so.*
%endif
%files devel
%defattr(-,root,root,-)
%{_includedir}/XrdCmsTfc.hh
%{_includedir}/XrdCmsJson.hh

%changelog
* Fri Jul 28 2023 Mátyás Selmeci <[email protected]> - 1.5.2-7
Expand Down
Loading

0 comments on commit 1017d2a

Please sign in to comment.