diff --git a/iping/CMakeLists.txt b/iping/CMakeLists.txt index ea83520..58e49f6 100644 --- a/iping/CMakeLists.txt +++ b/iping/CMakeLists.txt @@ -1,39 +1,63 @@ cmake_minimum_required(VERSION 3.5.0 FATAL_ERROR) #CPACK_DEBIAN__PACKAGE_NAME -find_package(IRODS 4.2.8 EXACT REQUIRED) +set(IRODS_IPING_VERSION_MAJOR "4") +set(IRODS_IPING_VERSION_MINOR "3") +set(IRODS_IPING_VERSION_PATCH "0") +set(IRODS_IPING_VERSION "${IRODS_IPING_VERSION_MAJOR}.${IRODS_IPING_VERSION_MINOR}.${IRODS_IPING_VERSION_PATCH}") -set(CMAKE_C_COMPILER ${IRODS_EXTERNALS_FULLPATH_CLANG}/bin/clang) -set(CMAKE_CXX_COMPILER ${IRODS_EXTERNALS_FULLPATH_CLANG}/bin/clang++) +find_package(IRODS ${IRODS_IPING_VERSION} EXACT REQUIRED CONFIG) -project(iping C CXX) +include(IrodsCXXCompiler) +set(CMAKE_CXX_STANDARD ${IRODS_CXX_STANDARD}) +set(CMAKE_EXE_LINKER_FLAGS_INIT "-rdynamic -Wl,--export-dynamic -Wl,--enable-new-dtags -Wl,--as-needed -Wl,-z,defs") +set(CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT "-Wl,--gc-sections -Wl,-z,combreloc") + +include(IrodsExternals) + +project(iping + VERSION "${IRODS_IPING_VERSION}" + LANGUAGES C CXX) include(${IRODS_TARGETS_PATH}) +include(GNUInstallDirs) + if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build {Debug, Release}." FORCE) - message(STATUS "Setting unspecified CMAKE_BUILD_TYPE to '${CMAKE_BUILD_TYPE}'. This is the correct setting for normal builds.") + message(STATUS "Setting unspecified CMAKE_BUILD_TYPE to '${CMAKE_BUILD_TYPE}'") endif() -if (NOT CMAKE_INSTALL_PREFIX) - set(CMAKE_INSTALL_PREFIX "/" CACHE STRING "Install root path. Change from \"/\" for run-in-place installations." FORCE) - message(STATUS "Setting unspecified CMAKE_INSTALL_PREFIX to '${CMAKE_INSTALL_PREFIX}'. This is the correct setting for normal builds.") +if (CMAKE_CXX_COMPILER_ID MATCHES ".*Clang") + set(IRODS_BUILD_WITH_WERROR_DEFAULT ON) +else() + set(IRODS_BUILD_WITH_WERROR_DEFAULT OFF) endif() -if (NOT CPACK_PACKAGING_INSTALL_PREFIX) - set(CPACK_PACKAGING_INSTALL_PREFIX "/" CACHE STRING "Package root path. \"/\" is correct for normal package builds.." FORCE) - message(STATUS "Setting unspecified CPACK_PACKAGING_INSTALL_PREFIX to '${CPACK_PACKAGING_INSTALL_PREFIX}'. This is the correct setting for normal builds.") +set(IRODS_BUILD_WITH_WERROR ${IRODS_BUILD_WITH_WERROR_DEFAULT} CACHE BOOL "Choose whether to compile with -Werror.") + +include(UseLibCXX) + +if (NOT DEFINED THREADS_PREFER_PTHREAD_FLAG) + set(THREADS_PREFER_PTHREAD_FLAG TRUE) +endif() + +find_package(Threads REQUIRED) +find_package(nlohmann_json "3.6.1" REQUIRED) +find_package(OpenSSL REQUIRED) + +if (IRODS_BUILD_WITH_WERROR) + add_compile_options(-Werror) endif() -set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) -set(CMAKE_INSTALL_RPATH ${IRODS_EXTERNALS_FULLPATH_CLANG_RUNTIME}/lib) +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + add_compile_options($<$:-fpermissive>) +endif() + +if(CMAKE_CXX_COMPILER_ID STREQUAL "CLANG") + include_directories(${IRODS_EXTERNALS_FULLPATH_CLANG}/include/c++/v1) +endif() -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++") -set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -stdlib=libc++") -set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -stdlib=libc++") -add_compile_options(-nostdinc++ -Wall -Wextra -Werror -Wno-unused-function -Wno-unused-parameter) -link_libraries(c++abi) -include_directories(${IRODS_EXTERNALS_FULLPATH_CLANG}/include/c++/v1 - ${IRODS_EXTERNALS_FULLPATH_JSON}/include) +add_compile_options(-Wall -Wextra -Wno-unused-parameter) set( IPING_EXECUTABLE @@ -51,12 +75,8 @@ target_link_libraries( irods_client irods_plugin_dependencies irods_common - ${IRODS_EXTERNALS_FULLPATH_BOOST}/lib/libboost_chrono.so ${IRODS_EXTERNALS_FULLPATH_BOOST}/lib/libboost_filesystem.so - ${IRODS_EXTERNALS_FULLPATH_BOOST}/lib/libboost_regex.so - ${IRODS_EXTERNALS_FULLPATH_BOOST}/lib/libboost_program_options.so ${IRODS_EXTERNALS_FULLPATH_BOOST}/lib/libboost_system.so - ${IRODS_EXTERNALS_FULLPATH_BOOST}/lib/libboost_thread.so ${IRODS_EXTERNALS_FULLPATH_FMT}/lib/libfmt.so ${IRODS_EXTERNALS_FULLPATH_ZMQ}/lib/libzmq.so ) @@ -66,13 +86,11 @@ target_include_directories( PRIVATE ${IRODS_INCLUDE_DIRS} ${IRODS_EXTERNALS_FULLPATH_BOOST}/include - ${IRODS_EXTERNALS_FULLPATH_JSON}/include + ${IRODS_EXTERNALS_FULLPATH_FMT}/include ${IRODS_EXTERNALS_FULLPATH_ZMQ}/include ) -target_compile_definitions(${IPING_EXECUTABLE} PRIVATE RODS_SERVER ${IRODS_COMPILE_DEFINITIONS} BOOST_SYSTEM_NO_DEPRECATED) -target_compile_options(${IPING_EXECUTABLE} PRIVATE -Wno-write-strings) -set_property(TARGET ${IPING_EXECUTABLE} PROPERTY CXX_STANDARD ${IRODS_CXX_STANDARD}) +target_compile_definitions(${IPING_EXECUTABLE} PRIVATE ${IRODS_COMPILE_DEFINITIONS_PRIVATE}) install( TARGETS @@ -87,49 +105,46 @@ install( PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE ) -#install( - #DIRECTORY ${CMAKE_SOURCE_DIR}/test -# DESTINATION usr/lib/irods/clients/icommands -# ) +if (NOT CPACK_PACKAGING_INSTALL_PREFIX) + set(CPACK_PACKAGING_INSTALL_PREFIX "/" CACHE STRING "Package root path. \"/\" is correct for normal package builds.." FORCE) + message(STATUS "Setting unspecified CPACK_PACKAGING_INSTALL_PREFIX to '${CPACK_PACKAGING_INSTALL_PREFIX}'. This is the correct setting for normal builds.") +endif() + +include(IrodsCPackCommon) -set(CPACK_PACKAGE_FILE_NAME "irods-iping${IRODS_PACKAGE_FILE_NAME_SUFFIX}") set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF) set(CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY OFF) set(CPACK_COMPONENTS_GROUPING IGNORE) -set(CPACK_PACKAGE_VERSION ${IRODS_VERSION}) -set(CPACK_PACKAGE_VERSION_MAJOR ${IRODS_VERSION_MAJOR}) -set(CPACK_PACKAGE_VERSION_MINOR ${IRODS_VERSION_MINOR}) -set(CPACK_PACKAGE_VERSION_PATCH ${IRODS_VERSION_PATCH}) +set(CPACK_PACKAGE_VERSION ${IRODS_IPING_VERSION}) set(CPACK_PACKAGE_CONTACT "Renaissance Computing Institute ") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The integrated Rule-Oriented Data System") set(CPACK_PACKAGE_VENDOR "Renaissance Computing Institute ") set(CPACK_DEB_COMPONENT_INSTALL OFF) +set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OFF) +set(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION ON) set(CPACK_DEBIAN_PACKAGE_SECTION "contrib/science") set(CPACK_DEBIAN_COMPRESSION_TYPE "gzip") set(CPACK_DEBIAN_PACKAGE_PRIORITY "extra") set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://irods.org") -set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OFF) -set(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION ON) set(CPACK_RPM_COMPONENT_INSTALL OFF) set(CPACK_RPM_PACKAGE_RELEASE "1") set(CPACK_RPM_PACKAGE_LICENSE "BSD-3-Clause") -set(CPACK_RPM_PACKAGE_VENDOR "iRODS Consortium") -set(CPACK_RPM_PACKAGE_URL "https://irods.org") set(CPACK_RPM_PACKAGE_AUTOREQ 0) set(CPACK_RPM_PACKAGE_AUTOPROV 0) +set(CPACK_RPM_PACKAGE_VENDOR "iRODS Consortium") +set(CPACK_RPM_PACKAGE_URL "https://irods.org") + +set(CPACK_RPM_PACKAGE_RELEASE "${IRODS_PACKAGE_REVISION}") +set(CPACK_RPM_FILE_NAME RPM-DEFAULT) -set(CPACK_ARCHIVE_COMPONENT_INSTALL OFF) +set(CPACK_ARCHIVE_COMPONENT_INSTALL ON) set(CPACK_DEBIAN_PACKAGE_NAME "irods-iping") set(CPACK_DEBIAN_PACKAGE_DEPENDS "${IRODS_PACKAGE_DEPENDENCIES_STRING}, irods-runtime (= ${IRODS_VERSION}), libc6, libssl1.0.0") -set(CPACK_DEBIAN_PACKAGE_REPLACES "irods-icat, irods-resource") -set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/preinst") set(CPACK_RPM_PACKAGE_NAME "irods-iping") -set(CPACK_RPM_PACKAGE_OBSOLETES "irods-icat, irods-resource") -set(CPACK_RPM_PRE_INSTALL_SCRIPT_FILE "${CMAKE_SOURCE_DIR}/preinst") if (IRODS_LINUX_DISTRIBUTION_NAME STREQUAL "centos" OR IRODS_LINUX_DISTRIBUTION_NAME STREQUAL "centos linux") set(CPACK_RPM_PACKAGE_REQUIRES "${IRODS_PACKAGE_DEPENDENCIES_STRING}, irods-runtime = ${IRODS_VERSION}, openssl") elseif (IRODS_LINUX_DISTRIBUTION_NAME STREQUAL "opensuse") diff --git a/iping/src/iping.cpp b/iping/src/iping.cpp index 26c3910..16ef268 100644 --- a/iping/src/iping.cpp +++ b/iping/src/iping.cpp @@ -2,15 +2,15 @@ * iping - App that "pings" an iRODS server. */ -#include "rodsClient.h" -#include "parseCommandLine.h" -#include "rodsPath.h" -#include "lsUtil.h" +#include +#include +#include +#include -#include "irods_buffer_encryption.hpp" -#include "irods_client_api_table.hpp" -#include "irods_pack_table.hpp" +#include +#include +#include #include "boost/lexical_cast.hpp" #include @@ -32,8 +32,8 @@ int main( int argc, char **argv ) { signal( SIGPIPE, SIG_IGN ); - char *rodsHost = "localhost"; - char *rodsPortStr = "1247"; + char const *rodsHost = "localhost"; + char const *rodsPortStr = "1247"; int c; while ((c = getopt(argc, argv, "h:p:")) != -1) {