1
0
Fork 0
mirror of https://github.com/cosmo-sims/MUSIC.git synced 2024-09-16 13:33:46 +02:00

updated RPC/XDR routines to compile against TIRPC library since RPC is missing from modern glibc

This commit is contained in:
Oliver Hahn 2021-11-30 22:47:40 +01:00
parent 1e98bde1fa
commit fdb6e73fc3
4 changed files with 66 additions and 0 deletions

View file

@ -29,6 +29,10 @@ if(POLICY CMP0074)
endif()
find_package(FFTW3 COMPONENTS SINGLE DOUBLE THREADS)
########################################################################################################################
# TIRPC, needed only for Tipsy format
find_package(TIRPC)
########################################################################################################################
# Add a custom command that produces version.cc, plus
# a dummy output that's not actually produced, in order
@ -106,6 +110,12 @@ if(HDF5_FOUND)
target_compile_options(${PRGNAME} PRIVATE "-DH5_USE_16_API")
endif(HDF5_FOUND)
if(TIRPC_FOUND)
target_link_libraries(${PRGNAME} ${TIRPC_LIBRARIES})
target_include_directories(${PRGNAME} PRIVATE ${TIRPC_INCLUDE_DIRS})
target_compile_options(${PRGNAME} PRIVATE "-DHAVE_TIRPC")
endif(TIRPC_FOUND)
target_link_libraries(${PRGNAME} ${FFTW3_LIBRARIES})
target_include_directories(${PRGNAME} PRIVATE ${FFTW3_INCLUDE_DIRS})

47
FindTIRPC.cmake Normal file
View file

@ -0,0 +1,47 @@
# FindTIRPC
# ---------
#
# OH: taken from https://github.com/snort3/snort3/blob/master/cmake/FindTIRPC.cmake
#
# Find the native TIRPC includes and library.
#
# Result Variables
# ^^^^^^^^^^^^^^^^
#
# This module will set the following variables in your project:
#
# ``TIRPC_INCLUDE_DIRS``
# where to find rpc.h, etc.
# ``TIRPC_LIBRARIES``
# the libraries to link against to use TIRPC.
# ``TIRPC_VERSION``
# the version of TIRPC found.
# ``TIRPC_FOUND``
# true if the TIRPC headers and libraries were found.
#
find_package(PkgConfig QUIET)
pkg_check_modules(PC_TIRPC libtirpc)
find_path(TIRPC_INCLUDE_DIRS
NAMES netconfig.h
PATH_SUFFIXES tirpc
HINTS ${PC_TIRPC_INCLUDE_DIRS}
)
find_library(TIRPC_LIBRARIES
NAMES tirpc
HINTS ${PC_TIRPC_LIBRARY_DIRS}
)
set(TIRPC_VERSION ${PC_TIRPC_VERSION})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(TIRPC
REQUIRED_VARS TIRPC_LIBRARIES TIRPC_INCLUDE_DIRS
VERSION_VAR TIRPC_VERSION
)
mark_as_advanced(TIRPC_INCLUDE_DIRS TIRPC_LIBRARIES)

View file

@ -7,6 +7,8 @@
// Copyright 2011 KIPAC/SLAC. All rights reserved.
//
#if defined(HAVE_TIRPC) // needed for RPC/XDR functions
#include <unistd.h>
#include <stdio.h>
#include <rpc/types.h>
@ -1109,3 +1111,6 @@ namespace{
output_plugin_creator_concrete< tipsy_output_plugin<double> > creator2("tipsy_double");
//#endif
}
#endif //defined(HAVE_TIRPC)

View file

@ -8,6 +8,8 @@
//
#if defined(HAVE_TIRPC) // needed for RPC/XDR functions
#include <stdio.h>
#include <rpc/types.h>
#include <rpc/xdr.h>
@ -1398,3 +1400,5 @@ namespace
output_plugin_creator_concrete< tipsy_output_plugin_res<double> >creator2 ("tipsy_double_resample");
#endif
}
#endif // defined(HAVE_TIRPC)