diff --git a/CHANGELOG.md b/CHANGELOG.md index cc028bc4f4cc9527ef740bcf278fbabacbda7bd2..a21d430ee890331a9c009cb329390feed62a4c9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -71,6 +71,8 @@ replicas ([!166](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/141) - An issue that updated the last modified time of a file during `stat` operations was fixed([!176](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_request/176)). +- Fixed a dependency conflict within the pytest dependency marshmallow ([!197](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_request/197)). +- Fixed an issue with testing external symbolic links ([!198](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_request/198)). ## [0.9.2] - 2024-02 diff --git a/CMake/FindAGIOS.cmake b/CMake/FindAGIOS.cmake index 191e3ba133fcaadcb39b3e0a9414f9b322865f62..2f165214089c2c607bdfeee880997a0d53c6e5e8 100644 --- a/CMake/FindAGIOS.cmake +++ b/CMake/FindAGIOS.cmake @@ -27,9 +27,9 @@ ################################################################################ find_path( - AGIOS_INCLUDE_DIR - NAMES agios.h - PATH_SUFFIXES include + AGIOS_INCLUDE_DIR + NAMES agios.h + PATH_SUFFIXES include ) find_library(AGIOS_LIBRARY NAMES agios) @@ -41,21 +41,21 @@ mark_as_advanced(AGIOS_LIBRARY AGIOS_INCLUDE_DIR) include(FindPackageHandleStandardArgs) find_package_handle_standard_args( - AGIOS - FOUND_VAR AGIOS_FOUND - REQUIRED_VARS AGIOS_LIBRARY AGIOS_INCLUDE_DIR + AGIOS + FOUND_VAR AGIOS_FOUND + REQUIRED_VARS AGIOS_LIBRARY AGIOS_INCLUDE_DIR ) -if(AGIOS_FOUND) - set(AGIOS_INCLUDE_DIRS ${AGIOS_INCLUDE_DIR}) - set(AGIOS_LIBRARIES ${AGIOS_LIBRARY}) - if(NOT TARGET AGIOS::AGIOS) - add_library(AGIOS::AGIOS UNKNOWN IMPORTED) - set_target_properties( - AGIOS::AGIOS - PROPERTIES IMPORTED_LOCATION "${AGIOS_LIBRARY}" - INTERFACE_INCLUDE_DIRECTORIES "${AGIOS_INCLUDE_DIR}" - ) - endif() -endif( ) +if (AGIOS_FOUND) + set(AGIOS_INCLUDE_DIRS ${AGIOS_INCLUDE_DIR}) + set(AGIOS_LIBRARIES ${AGIOS_LIBRARY}) + if (NOT TARGET AGIOS::AGIOS) + add_library(AGIOS::AGIOS UNKNOWN IMPORTED) + set_target_properties( + AGIOS::AGIOS + PROPERTIES IMPORTED_LOCATION "${AGIOS_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${AGIOS_INCLUDE_DIR}" + ) + endif () +endif () diff --git a/CMake/FindAIO.cmake b/CMake/FindAIO.cmake index caefa0086256e15ed9ebe8dc8953f67d65930715..b3b086f20cb4cf4c0638ece7259c14ee53a5d739 100644 --- a/CMake/FindAIO.cmake +++ b/CMake/FindAIO.cmake @@ -27,9 +27,9 @@ # SPDX-License-Identifier: GPL-3.0-or-later # ################################################################################ find_path( - AIO_INCLUDE_DIR - NAMES aio.h - PATH_SUFFIXES include + AIO_INCLUDE_DIR + NAMES aio.h + PATH_SUFFIXES include ) find_library(AIO_LIBRARY NAMES rt) @@ -37,22 +37,22 @@ find_library(AIO_LIBRARY NAMES rt) mark_as_advanced(AIO_INCLUDE_DIR AIO_LIBRARY) find_package_handle_standard_args( - AIO - FOUND_VAR AIO_FOUND - REQUIRED_VARS AIO_INCLUDE_DIR AIO_LIBRARY + AIO + FOUND_VAR AIO_FOUND + REQUIRED_VARS AIO_INCLUDE_DIR AIO_LIBRARY ) -if(AIO_FOUND AND NOT TARGET AIO::AIO) - add_library(AIO::AIO UNKNOWN IMPORTED) - if(AIO_INCLUDE_DIR) +if (AIO_FOUND AND NOT TARGET AIO::AIO) + add_library(AIO::AIO UNKNOWN IMPORTED) + if (AIO_INCLUDE_DIR) + set_target_properties( + AIO::AIO PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${AIO_INCLUDE_DIR}" + ) + endif () + set_target_properties( - AIO::AIO PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${AIO_INCLUDE_DIR}" + AIO::AIO PROPERTIES IMPORTED_LOCATION "${AIO_LIBRARY}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" ) - endif() - - set_target_properties( - AIO::AIO PROPERTIES IMPORTED_LOCATION "${AIO_LIBRARY}" - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - ) -endif() +endif () diff --git a/CMake/FindArgobots.cmake b/CMake/FindArgobots.cmake index b05d07e78a8bd650dc2e747b20c091ddc3954806..d0854d0bb59d779cf07f6c5b2552125812285160 100644 --- a/CMake/FindArgobots.cmake +++ b/CMake/FindArgobots.cmake @@ -74,140 +74,140 @@ The following cache variables may also be set: #]=======================================================================] function(_get_pkgconfig_paths target_var) - set(_lib_dirs) - if(NOT DEFINED CMAKE_SYSTEM_NAME - OR (CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU)$" - AND NOT CMAKE_CROSSCOMPILING) - ) - if(EXISTS "/etc/debian_version") # is this a debian system ? - if(CMAKE_LIBRARY_ARCHITECTURE) - list(APPEND _lib_dirs "lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig") - endif() - else() - # not debian, check the FIND_LIBRARY_USE_LIB32_PATHS and FIND_LIBRARY_USE_LIB64_PATHS properties - get_property(uselib32 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS) - if(uselib32 AND CMAKE_SIZEOF_VOID_P EQUAL 4) - list(APPEND _lib_dirs "lib32/pkgconfig") - endif() - get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) - if(uselib64 AND CMAKE_SIZEOF_VOID_P EQUAL 8) - list(APPEND _lib_dirs "lib64/pkgconfig") - endif() - get_property(uselibx32 GLOBAL PROPERTY FIND_LIBRARY_USE_LIBX32_PATHS) - if(uselibx32 AND CMAKE_INTERNAL_PLATFORM_ABI STREQUAL "ELF X32") - list(APPEND _lib_dirs "libx32/pkgconfig") - endif() - endif() - endif() - if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" AND NOT CMAKE_CROSSCOMPILING) - list(APPEND _lib_dirs "libdata/pkgconfig") - endif() - list(APPEND _lib_dirs "lib/pkgconfig") - list(APPEND _lib_dirs "share/pkgconfig") - - set(_extra_paths) - list(APPEND _extra_paths ${CMAKE_PREFIX_PATH}) - list(APPEND _extra_paths ${CMAKE_FRAMEWORK_PATH}) - list(APPEND _extra_paths ${CMAKE_APPBUNDLE_PATH}) - - # Check if directories exist and eventually append them to the - # pkgconfig path list - foreach(_prefix_dir ${_extra_paths}) - foreach(_lib_dir ${_lib_dirs}) - if(EXISTS "${_prefix_dir}/${_lib_dir}") - list(APPEND _pkgconfig_paths "${_prefix_dir}/${_lib_dir}") - list(REMOVE_DUPLICATES _pkgconfig_paths) - endif() - endforeach() - endforeach() - - set("${target_var}" - ${_pkgconfig_paths} - PARENT_SCOPE - ) + set(_lib_dirs) + if (NOT DEFINED CMAKE_SYSTEM_NAME + OR (CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU)$" + AND NOT CMAKE_CROSSCOMPILING) + ) + if (EXISTS "/etc/debian_version") # is this a debian system ? + if (CMAKE_LIBRARY_ARCHITECTURE) + list(APPEND _lib_dirs "lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig") + endif () + else () + # not debian, check the FIND_LIBRARY_USE_LIB32_PATHS and FIND_LIBRARY_USE_LIB64_PATHS properties + get_property(uselib32 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS) + if (uselib32 AND CMAKE_SIZEOF_VOID_P EQUAL 4) + list(APPEND _lib_dirs "lib32/pkgconfig") + endif () + get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) + if (uselib64 AND CMAKE_SIZEOF_VOID_P EQUAL 8) + list(APPEND _lib_dirs "lib64/pkgconfig") + endif () + get_property(uselibx32 GLOBAL PROPERTY FIND_LIBRARY_USE_LIBX32_PATHS) + if (uselibx32 AND CMAKE_INTERNAL_PLATFORM_ABI STREQUAL "ELF X32") + list(APPEND _lib_dirs "libx32/pkgconfig") + endif () + endif () + endif () + if (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" AND NOT CMAKE_CROSSCOMPILING) + list(APPEND _lib_dirs "libdata/pkgconfig") + endif () + list(APPEND _lib_dirs "lib/pkgconfig") + list(APPEND _lib_dirs "share/pkgconfig") + + set(_extra_paths) + list(APPEND _extra_paths ${CMAKE_PREFIX_PATH}) + list(APPEND _extra_paths ${CMAKE_FRAMEWORK_PATH}) + list(APPEND _extra_paths ${CMAKE_APPBUNDLE_PATH}) + + # Check if directories exist and eventually append them to the + # pkgconfig path list + foreach (_prefix_dir ${_extra_paths}) + foreach (_lib_dir ${_lib_dirs}) + if (EXISTS "${_prefix_dir}/${_lib_dir}") + list(APPEND _pkgconfig_paths "${_prefix_dir}/${_lib_dir}") + list(REMOVE_DUPLICATES _pkgconfig_paths) + endif () + endforeach () + endforeach () + + set("${target_var}" + ${_pkgconfig_paths} + PARENT_SCOPE + ) endfunction() # prevent repeating work if the main CMakeLists.txt already called # find_package(PkgConfig) -if(NOT PKG_CONFIG_FOUND) - find_package(PkgConfig) -endif() - -if(PKG_CONFIG_FOUND) - pkg_check_modules(PC_ARGOBOTS QUIET argobots) - - find_path( - ARGOBOTS_INCLUDE_DIR - NAMES abt.h - PATHS ${PC_ARGOBOTS_INCLUDE_DIRS} - PATH_SUFFIXES include - ) - - find_library( - ARGOBOTS_LIBRARY - NAMES abt - PATHS ${PC_ARGOBOTS_LIBRARY_DIRS} - ) - - set(Argobots_VERSION ${PC_ARGOBOTS_VERSION}) -else() - find_path( - ARGOBOTS_INCLUDE_DIR - NAMES abt.h - PATH_SUFFIXES include - ) - - find_library(ARGOBOTS_LIBRARY NAMES abt) - - # even if pkg-config is not available, but Argobots still installs a .pc file - # that we can use to retrieve library information from. Try to find it at all - # possible pkgconfig subfolders (depending on the system). - _get_pkgconfig_paths(_pkgconfig_paths) - - find_file(_argobots_pc_file argobots.pc PATHS "${_pkgconfig_paths}") - - if(NOT _argobots_pc_file) - message( - FATAL_ERROR - "ERROR: Could not find 'argobots.pc' file. Unable to determine library version" +if (NOT PKG_CONFIG_FOUND) + find_package(PkgConfig) +endif () + +if (PKG_CONFIG_FOUND) + pkg_check_modules(PC_ARGOBOTS QUIET argobots) + + find_path( + ARGOBOTS_INCLUDE_DIR + NAMES abt.h + PATHS ${PC_ARGOBOTS_INCLUDE_DIRS} + PATH_SUFFIXES include + ) + + find_library( + ARGOBOTS_LIBRARY + NAMES abt + PATHS ${PC_ARGOBOTS_LIBRARY_DIRS} ) - endif() - file(STRINGS "${_argobots_pc_file}" _argobots_pc_file_contents - REGEX "Version: " - ) + set(Argobots_VERSION ${PC_ARGOBOTS_VERSION}) +else () + find_path( + ARGOBOTS_INCLUDE_DIR + NAMES abt.h + PATH_SUFFIXES include + ) + + find_library(ARGOBOTS_LIBRARY NAMES abt) + + # even if pkg-config is not available, but Argobots still installs a .pc file + # that we can use to retrieve library information from. Try to find it at all + # possible pkgconfig subfolders (depending on the system). + _get_pkgconfig_paths(_pkgconfig_paths) - if("${_argobots_pc_file_contents}" MATCHES - "Version: ([0-9]+\\.[0-9]+\\.[0-9])" - ) - set(Argobots_VERSION ${CMAKE_MATCH_1}) - else() - message(FATAL_ERROR "ERROR: Failed to determine library version") - endif() + find_file(_argobots_pc_file argobots.pc PATHS "${_pkgconfig_paths}") - unset(_pkg_config_paths) - unset(_argobots_pc_file_contents) -endif() + if (NOT _argobots_pc_file) + message( + FATAL_ERROR + "ERROR: Could not find 'argobots.pc' file. Unable to determine library version" + ) + endif () + + file(STRINGS "${_argobots_pc_file}" _argobots_pc_file_contents + REGEX "Version: " + ) + + if ("${_argobots_pc_file_contents}" MATCHES + "Version: ([0-9]+\\.[0-9]+\\.[0-9])" + ) + set(Argobots_VERSION ${CMAKE_MATCH_1}) + else () + message(FATAL_ERROR "ERROR: Failed to determine library version") + endif () + + unset(_pkg_config_paths) + unset(_argobots_pc_file_contents) +endif () mark_as_advanced(ARGOBOTS_INCLUDE_DIR ARGOBOTS_LIBRARY) include(FindPackageHandleStandardArgs) find_package_handle_standard_args( - Argobots - FOUND_VAR Argobots_FOUND - REQUIRED_VARS ARGOBOTS_LIBRARY ARGOBOTS_INCLUDE_DIR - VERSION_VAR Argobots_VERSION + Argobots + FOUND_VAR Argobots_FOUND + REQUIRED_VARS ARGOBOTS_LIBRARY ARGOBOTS_INCLUDE_DIR + VERSION_VAR Argobots_VERSION ) -if(Argobots_FOUND) - set(Argobots_INCLUDE_DIRS ${ARGOBOTS_INCLUDE_DIR}) - set(Argobots_LIBRARIES ${ARGOBOTS_LIBRARY}) - if(NOT TARGET Argobots::Argobots) - add_library(Argobots::Argobots UNKNOWN IMPORTED) - set_target_properties( - Argobots::Argobots - PROPERTIES IMPORTED_LOCATION "${ARGOBOTS_LIBRARY}" - INTERFACE_INCLUDE_DIRECTORIES "${ARGOBOTS_INCLUDE_DIR}" - ) - endif() -endif() +if (Argobots_FOUND) + set(Argobots_INCLUDE_DIRS ${ARGOBOTS_INCLUDE_DIR}) + set(Argobots_LIBRARIES ${ARGOBOTS_LIBRARY}) + if (NOT TARGET Argobots::Argobots) + add_library(Argobots::Argobots UNKNOWN IMPORTED) + set_target_properties( + Argobots::Argobots + PROPERTIES IMPORTED_LOCATION "${ARGOBOTS_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${ARGOBOTS_INCLUDE_DIR}" + ) + endif () +endif () diff --git a/CMake/FindFilesystem.cmake b/CMake/FindFilesystem.cmake index 74080895f73248dac2fd6cb27d8d79fc0f7f4d68..6b309b71dec31e6701ae513f06134cd9f7b2d2ba 100644 --- a/CMake/FindFilesystem.cmake +++ b/CMake/FindFilesystem.cmake @@ -97,10 +97,10 @@ Using `find_package(Filesystem)` with no component arguments: #]=======================================================================] -if(TARGET std::filesystem) +if (TARGET std::filesystem) # This module has already been processed. Don't do it again. return() -endif() +endif () cmake_minimum_required(VERSION 3.10) @@ -109,17 +109,17 @@ include(CheckIncludeFileCXX) # If we're not cross-compiling, try to run test executables. # Otherwise, assume that compile + link is a sufficient check. -if(CMAKE_CROSSCOMPILING) +if (CMAKE_CROSSCOMPILING) include(CheckCXXSourceCompiles) macro(_cmcm_check_cxx_source code var) check_cxx_source_compiles("${code}" ${var}) endmacro() -else() +else () include(CheckCXXSourceRuns) macro(_cmcm_check_cxx_source code var) check_cxx_source_runs("${code}" ${var}) endmacro() -endif() +endif () cmake_push_check_state() @@ -130,59 +130,59 @@ set(CMAKE_CXX_STANDARD 17) # Normalize and check the component list we were given set(want_components ${Filesystem_FIND_COMPONENTS}) -if(Filesystem_FIND_COMPONENTS STREQUAL "") +if (Filesystem_FIND_COMPONENTS STREQUAL "") set(want_components Final) -endif() +endif () # Warn on any unrecognized components set(extra_components ${want_components}) list(REMOVE_ITEM extra_components Final Experimental) -foreach(component IN LISTS extra_components) +foreach (component IN LISTS extra_components) message(WARNING "Extraneous find_package component for Filesystem: ${component}") -endforeach() +endforeach () # Detect which of Experimental and Final we should look for set(find_experimental TRUE) set(find_final TRUE) -if(NOT "Final" IN_LIST want_components) +if (NOT "Final" IN_LIST want_components) set(find_final FALSE) -endif() -if(NOT "Experimental" IN_LIST want_components) +endif () +if (NOT "Experimental" IN_LIST want_components) set(find_experimental FALSE) -endif() +endif () -if(find_final) +if (find_final) check_include_file_cxx("filesystem" _CXX_FILESYSTEM_HAVE_HEADER) mark_as_advanced(_CXX_FILESYSTEM_HAVE_HEADER) - if(_CXX_FILESYSTEM_HAVE_HEADER) + if (_CXX_FILESYSTEM_HAVE_HEADER) # We found the non-experimental header. Don't bother looking for the # experimental one. set(find_experimental FALSE) - endif() -else() + endif () +else () set(_CXX_FILESYSTEM_HAVE_HEADER FALSE) -endif() +endif () -if(find_experimental) +if (find_experimental) check_include_file_cxx("experimental/filesystem" _CXX_FILESYSTEM_HAVE_EXPERIMENTAL_HEADER) mark_as_advanced(_CXX_FILESYSTEM_HAVE_EXPERIMENTAL_HEADER) -else() +else () set(_CXX_FILESYSTEM_HAVE_EXPERIMENTAL_HEADER FALSE) -endif() +endif () -if(_CXX_FILESYSTEM_HAVE_HEADER) +if (_CXX_FILESYSTEM_HAVE_HEADER) set(_have_fs TRUE) set(_fs_header filesystem) set(_fs_namespace std::filesystem) set(_is_experimental FALSE) -elseif(_CXX_FILESYSTEM_HAVE_EXPERIMENTAL_HEADER) +elseif (_CXX_FILESYSTEM_HAVE_EXPERIMENTAL_HEADER) set(_have_fs TRUE) set(_fs_header experimental/filesystem) set(_fs_namespace std::experimental::filesystem) set(_is_experimental TRUE) -else() +else () set(_have_fs FALSE) -endif() +endif () set(CXX_FILESYSTEM_HAVE_FS ${_have_fs} CACHE BOOL "TRUE if we have the C++ filesystem headers") set(CXX_FILESYSTEM_HEADER ${_fs_header} CACHE STRING "The header that should be included to obtain the filesystem APIs") @@ -191,7 +191,7 @@ set(CXX_FILESYSTEM_IS_EXPERIMENTAL ${_is_experimental} CACHE BOOL "TRUE if the C set(_found FALSE) -if(CXX_FILESYSTEM_HAVE_FS) +if (CXX_FILESYSTEM_HAVE_FS) # We have some filesystem library available. Do link checks string(CONFIGURE [[ #include @@ -209,39 +209,39 @@ if(CXX_FILESYSTEM_HAVE_FS) set(can_link ${CXX_FILESYSTEM_NO_LINK_NEEDED}) - if(NOT CXX_FILESYSTEM_NO_LINK_NEEDED) + if (NOT CXX_FILESYSTEM_NO_LINK_NEEDED) set(prev_libraries ${CMAKE_REQUIRED_LIBRARIES}) # Add the libstdc++ flag set(CMAKE_REQUIRED_LIBRARIES ${prev_libraries} -lstdc++fs) _cmcm_check_cxx_source("${code}" CXX_FILESYSTEM_STDCPPFS_NEEDED) set(can_link ${CXX_FILESYSTEM_STDCPPFS_NEEDED}) - if(NOT CXX_FILESYSTEM_STDCPPFS_NEEDED) + if (NOT CXX_FILESYSTEM_STDCPPFS_NEEDED) # Try the libc++ flag set(CMAKE_REQUIRED_LIBRARIES ${prev_libraries} -lc++fs) _cmcm_check_cxx_source("${code}" CXX_FILESYSTEM_CPPFS_NEEDED) set(can_link ${CXX_FILESYSTEM_CPPFS_NEEDED}) - endif() - endif() + endif () + endif () - if(can_link) + if (can_link) add_library(std::filesystem INTERFACE IMPORTED) set_property(TARGET std::filesystem APPEND PROPERTY INTERFACE_COMPILE_FEATURES cxx_std_17) set(_found TRUE) - if(CXX_FILESYSTEM_NO_LINK_NEEDED) + if (CXX_FILESYSTEM_NO_LINK_NEEDED) # Nothing to add... - elseif(CXX_FILESYSTEM_STDCPPFS_NEEDED) + elseif (CXX_FILESYSTEM_STDCPPFS_NEEDED) set_property(TARGET std::filesystem APPEND PROPERTY INTERFACE_LINK_LIBRARIES -lstdc++fs) - elseif(CXX_FILESYSTEM_CPPFS_NEEDED) + elseif (CXX_FILESYSTEM_CPPFS_NEEDED) set_property(TARGET std::filesystem APPEND PROPERTY INTERFACE_LINK_LIBRARIES -lc++fs) - endif() - endif() -endif() + endif () + endif () +endif () cmake_pop_check_state() set(Filesystem_FOUND ${_found} CACHE BOOL "TRUE if we can run a program using std::filesystem" FORCE) -if(Filesystem_FIND_REQUIRED AND NOT Filesystem_FOUND) +if (Filesystem_FIND_REQUIRED AND NOT Filesystem_FOUND) message(FATAL_ERROR "Cannot run simple program using std::filesystem") -endif() \ No newline at end of file +endif () \ No newline at end of file diff --git a/CMake/FindMargo.cmake b/CMake/FindMargo.cmake index abc29a6a7d505308f315f308cec03d3f53100faa..c649db2b62651360317829261f03c7b633219aff 100644 --- a/CMake/FindMargo.cmake +++ b/CMake/FindMargo.cmake @@ -74,136 +74,136 @@ The following cache variables may also be set: #]=======================================================================] function(_get_pkgconfig_paths target_var) - set(_lib_dirs) - if(NOT DEFINED CMAKE_SYSTEM_NAME - OR (CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU)$" - AND NOT CMAKE_CROSSCOMPILING) - ) - if(EXISTS "/etc/debian_version") # is this a debian system ? - if(CMAKE_LIBRARY_ARCHITECTURE) - list(APPEND _lib_dirs "lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig") - endif() - else() - # not debian, check the FIND_LIBRARY_USE_LIB32_PATHS and FIND_LIBRARY_USE_LIB64_PATHS properties - get_property(uselib32 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS) - if(uselib32 AND CMAKE_SIZEOF_VOID_P EQUAL 4) - list(APPEND _lib_dirs "lib32/pkgconfig") - endif() - get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) - if(uselib64 AND CMAKE_SIZEOF_VOID_P EQUAL 8) - list(APPEND _lib_dirs "lib64/pkgconfig") - endif() - get_property(uselibx32 GLOBAL PROPERTY FIND_LIBRARY_USE_LIBX32_PATHS) - if(uselibx32 AND CMAKE_INTERNAL_PLATFORM_ABI STREQUAL "ELF X32") - list(APPEND _lib_dirs "libx32/pkgconfig") - endif() - endif() - endif() - if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" AND NOT CMAKE_CROSSCOMPILING) - list(APPEND _lib_dirs "libdata/pkgconfig") - endif() - list(APPEND _lib_dirs "lib/pkgconfig") - list(APPEND _lib_dirs "share/pkgconfig") - - set(_extra_paths) - list(APPEND _extra_paths ${CMAKE_PREFIX_PATH}) - list(APPEND _extra_paths ${CMAKE_FRAMEWORK_PATH}) - list(APPEND _extra_paths ${CMAKE_APPBUNDLE_PATH}) - - # Check if directories exist and eventually append them to the - # pkgconfig path list - foreach(_prefix_dir ${_extra_paths}) - foreach(_lib_dir ${_lib_dirs}) - if(EXISTS "${_prefix_dir}/${_lib_dir}") - list(APPEND _pkgconfig_paths "${_prefix_dir}/${_lib_dir}") - list(REMOVE_DUPLICATES _pkgconfig_paths) - endif() - endforeach() - endforeach() - - set("${target_var}" - ${_pkgconfig_paths} - PARENT_SCOPE - ) + set(_lib_dirs) + if (NOT DEFINED CMAKE_SYSTEM_NAME + OR (CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU)$" + AND NOT CMAKE_CROSSCOMPILING) + ) + if (EXISTS "/etc/debian_version") # is this a debian system ? + if (CMAKE_LIBRARY_ARCHITECTURE) + list(APPEND _lib_dirs "lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig") + endif () + else () + # not debian, check the FIND_LIBRARY_USE_LIB32_PATHS and FIND_LIBRARY_USE_LIB64_PATHS properties + get_property(uselib32 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS) + if (uselib32 AND CMAKE_SIZEOF_VOID_P EQUAL 4) + list(APPEND _lib_dirs "lib32/pkgconfig") + endif () + get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) + if (uselib64 AND CMAKE_SIZEOF_VOID_P EQUAL 8) + list(APPEND _lib_dirs "lib64/pkgconfig") + endif () + get_property(uselibx32 GLOBAL PROPERTY FIND_LIBRARY_USE_LIBX32_PATHS) + if (uselibx32 AND CMAKE_INTERNAL_PLATFORM_ABI STREQUAL "ELF X32") + list(APPEND _lib_dirs "libx32/pkgconfig") + endif () + endif () + endif () + if (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" AND NOT CMAKE_CROSSCOMPILING) + list(APPEND _lib_dirs "libdata/pkgconfig") + endif () + list(APPEND _lib_dirs "lib/pkgconfig") + list(APPEND _lib_dirs "share/pkgconfig") + + set(_extra_paths) + list(APPEND _extra_paths ${CMAKE_PREFIX_PATH}) + list(APPEND _extra_paths ${CMAKE_FRAMEWORK_PATH}) + list(APPEND _extra_paths ${CMAKE_APPBUNDLE_PATH}) + + # Check if directories exist and eventually append them to the + # pkgconfig path list + foreach (_prefix_dir ${_extra_paths}) + foreach (_lib_dir ${_lib_dirs}) + if (EXISTS "${_prefix_dir}/${_lib_dir}") + list(APPEND _pkgconfig_paths "${_prefix_dir}/${_lib_dir}") + list(REMOVE_DUPLICATES _pkgconfig_paths) + endif () + endforeach () + endforeach () + + set("${target_var}" + ${_pkgconfig_paths} + PARENT_SCOPE + ) endfunction() # prevent repeating work if the main CMakeLists.txt already called # find_package(PkgConfig) -if(NOT PKG_CONFIG_FOUND) - find_package(PkgConfig) -endif() - -if(PKG_CONFIG_FOUND) - pkg_check_modules(PC_MARGO QUIET margo) - - find_path( - MARGO_INCLUDE_DIR - NAMES margo.h - PATHS ${PC_MARGO_INCLUDE_DIRS} - PATH_SUFFIXES include - ) - - find_library( - MARGO_LIBRARY - NAMES margo - PATHS ${PC_MARGO_LIBRARY_DIRS} - ) - - set(Margo_VERSION ${PC_MARGO_VERSION}) -else() - find_path( - MARGO_INCLUDE_DIR - NAMES margo.h - PATH_SUFFIXES include - ) - - find_library(MARGO_LIBRARY NAMES margo) - - # even if pkg-config is not available, but Margo still installs a .pc file - # that we can use to retrieve library information from. Try to find it at all - # possible pkgconfig subfolders (depending on the system). - _get_pkgconfig_paths(_pkgconfig_paths) - - find_file(_margo_pc_file margo.pc PATHS "${_pkgconfig_paths}") - - if(NOT _margo_pc_file) - message( - FATAL_ERROR - "ERROR: Could not find 'margo.pc' file. Unable to determine library version" +if (NOT PKG_CONFIG_FOUND) + find_package(PkgConfig) +endif () + +if (PKG_CONFIG_FOUND) + pkg_check_modules(PC_MARGO QUIET margo) + + find_path( + MARGO_INCLUDE_DIR + NAMES margo.h + PATHS ${PC_MARGO_INCLUDE_DIRS} + PATH_SUFFIXES include + ) + + find_library( + MARGO_LIBRARY + NAMES margo + PATHS ${PC_MARGO_LIBRARY_DIRS} + ) + + set(Margo_VERSION ${PC_MARGO_VERSION}) +else () + find_path( + MARGO_INCLUDE_DIR + NAMES margo.h + PATH_SUFFIXES include ) - endif() - file(STRINGS "${_margo_pc_file}" _margo_pc_file_contents REGEX "Version: ") + find_library(MARGO_LIBRARY NAMES margo) - if("${_margo_pc_file_contents}" MATCHES "Version: ([0-9]+\\.[0-9]+\\.[0-9])") - set(Margo_VERSION ${CMAKE_MATCH_1}) - else() - message(FATAL_ERROR "ERROR: Failed to determine library version") - endif() + # even if pkg-config is not available, but Margo still installs a .pc file + # that we can use to retrieve library information from. Try to find it at all + # possible pkgconfig subfolders (depending on the system). + _get_pkgconfig_paths(_pkgconfig_paths) - unset(_pkg_config_paths) - unset(_margo_pc_file_contents) -endif() + find_file(_margo_pc_file margo.pc PATHS "${_pkgconfig_paths}") + + if (NOT _margo_pc_file) + message( + FATAL_ERROR + "ERROR: Could not find 'margo.pc' file. Unable to determine library version" + ) + endif () + + file(STRINGS "${_margo_pc_file}" _margo_pc_file_contents REGEX "Version: ") + + if ("${_margo_pc_file_contents}" MATCHES "Version: ([0-9]+\\.[0-9]+\\.[0-9])") + set(Margo_VERSION ${CMAKE_MATCH_1}) + else () + message(FATAL_ERROR "ERROR: Failed to determine library version") + endif () + + unset(_pkg_config_paths) + unset(_margo_pc_file_contents) +endif () mark_as_advanced(MARGO_INCLUDE_DIR MARGO_LIBRARY) include(FindPackageHandleStandardArgs) find_package_handle_standard_args( - Margo - FOUND_VAR Margo_FOUND - REQUIRED_VARS MARGO_LIBRARY MARGO_INCLUDE_DIR - VERSION_VAR Margo_VERSION + Margo + FOUND_VAR Margo_FOUND + REQUIRED_VARS MARGO_LIBRARY MARGO_INCLUDE_DIR + VERSION_VAR Margo_VERSION ) -if(Margo_FOUND) - set(Margo_INCLUDE_DIRS ${MARGO_INCLUDE_DIR}) - set(Margo_LIBRARIES ${MARGO_LIBRARY}) - if(NOT TARGET Margo::Margo) - add_library(Margo::Margo UNKNOWN IMPORTED) - set_target_properties( - Margo::Margo - PROPERTIES IMPORTED_LOCATION "${MARGO_LIBRARY}" - INTERFACE_INCLUDE_DIRECTORIES "${MARGO_INCLUDE_DIR}" - ) - endif() -endif() +if (Margo_FOUND) + set(Margo_INCLUDE_DIRS ${MARGO_INCLUDE_DIR}) + set(Margo_LIBRARIES ${MARGO_LIBRARY}) + if (NOT TARGET Margo::Margo) + add_library(Margo::Margo UNKNOWN IMPORTED) + set_target_properties( + Margo::Margo + PROPERTIES IMPORTED_LOCATION "${MARGO_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${MARGO_INCLUDE_DIR}" + ) + endif () +endif () diff --git a/CMake/FindMercury.cmake b/CMake/FindMercury.cmake index 451ed6d403ab2a3d4f4f2fb6cabb351179593add..596b41c9daf25f2c2ee1db04aeeda30a53cb3674 100644 --- a/CMake/FindMercury.cmake +++ b/CMake/FindMercury.cmake @@ -83,91 +83,91 @@ The following cache variables may also be set: # _mercury_DEBUG_PRINT("debug message") # function(_mercury_DEBUG_PRINT text) - if(Mercury_DEBUG) - message( - STATUS - "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_FUNCTION_LIST_LINE} ] ${text}" - ) - endif() + if (Mercury_DEBUG) + message( + STATUS + "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_FUNCTION_LIST_LINE} ] ${text}" + ) + endif () endfunction() macro(_mercury_find_component _component_name) - _mercury_debug_print("Searching for Mercury component: ${_component}") - - string(TOUPPER ${_component} _upper_component) - - # find component header - find_path( - ${_upper_component}_INCLUDE_DIR ${_component} - NAMES ${_component}.h - PATH_SUFFIXES include - PATHS ${PC_MERCURY_INCLUDE_DIRS} - ) - - # find component library (release version) - find_library( - ${_upper_component}_LIBRARY_RELEASE - NAMES ${_component} - PATHS ${PC_MERCURY_LIBRARY_DIRS} - ) - - # find component library (debug version) - find_library( - ${_upper_component}_LIBRARY_DEBUG - NAMES ${_component}_debug - PATHS ${PC_MERCURY_LIBRARY_DIRS} - ) - - # initialize ${_upper_component}_LIBRARY (e.g. NA_LIBRARY) - # with the appropriate library for this build configuration - select_library_configurations(${_upper_component}) - - _mercury_debug_print( - "${_upper_component}_INCLUDE_DIR: ${${_upper_component}_INCLUDE_DIR}" - ) - _mercury_debug_print( - "${_upper_component}_LIBRARY: ${${_upper_component}_LIBRARY}" - ) - - # define an imported target for the component - if (NOT TARGET Mercury::${_component}) - add_library(Mercury::${_component} UNKNOWN IMPORTED) - endif () - - if(${_upper_component}_LIBRARY_RELEASE) - set_property(TARGET Mercury::${_component} APPEND PROPERTY - IMPORTED_CONFIGURATIONS RELEASE) - set_target_properties(Mercury::${_component} PROPERTIES - IMPORTED_LOCATION_RELEASE "${${_upper_component}_LIBRARY_RELEASE}" + _mercury_debug_print("Searching for Mercury component: ${_component}") + + string(TOUPPER ${_component} _upper_component) + + # find component header + find_path( + ${_upper_component}_INCLUDE_DIR ${_component} + NAMES ${_component}.h + PATH_SUFFIXES include + PATHS ${PC_MERCURY_INCLUDE_DIRS} ) - endif() - if(${_upper_component}_LIBRARY_DEBUG) - set_property(TARGET Mercury::${_component} APPEND PROPERTY - IMPORTED_CONFIGURATIONS DEBUG) - set_target_properties(Mercury::${_component} PROPERTIES - IMPORTED_LOCATION_DEBUG "${${_upper_component}_LIBRARY_DEBUG}" - IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C" + # find component library (release version) + find_library( + ${_upper_component}_LIBRARY_RELEASE + NAMES ${_component} + PATHS ${PC_MERCURY_LIBRARY_DIRS} + ) + + # find component library (debug version) + find_library( + ${_upper_component}_LIBRARY_DEBUG + NAMES ${_component}_debug + PATHS ${PC_MERCURY_LIBRARY_DIRS} ) - endif() - set_target_properties( - Mercury::${_component} - PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${MERCURY_INCLUDE_DIR}" - ) + # initialize ${_upper_component}_LIBRARY (e.g. NA_LIBRARY) + # with the appropriate library for this build configuration + select_library_configurations(${_upper_component}) + + _mercury_debug_print( + "${_upper_component}_INCLUDE_DIR: ${${_upper_component}_INCLUDE_DIR}" + ) + _mercury_debug_print( + "${_upper_component}_LIBRARY: ${${_upper_component}_LIBRARY}" + ) + + # define an imported target for the component + if (NOT TARGET Mercury::${_component}) + add_library(Mercury::${_component} UNKNOWN IMPORTED) + endif () + + if (${_upper_component}_LIBRARY_RELEASE) + set_property(TARGET Mercury::${_component} APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(Mercury::${_component} PROPERTIES + IMPORTED_LOCATION_RELEASE "${${_upper_component}_LIBRARY_RELEASE}" + ) + endif () + + if (${_upper_component}_LIBRARY_DEBUG) + set_property(TARGET Mercury::${_component} APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(Mercury::${_component} PROPERTIES + IMPORTED_LOCATION_DEBUG "${${_upper_component}_LIBRARY_DEBUG}" + IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C" + ) + endif () + + set_target_properties( + Mercury::${_component} + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${MERCURY_INCLUDE_DIR}" + ) - get_target_property(_configs Mercury::${_component} IMPORTED_CONFIGURATIONS) - foreach(_config ${_configs}) - _mercury_DEBUG_PRINT("---> ${_config}") + get_target_property(_configs Mercury::${_component} IMPORTED_CONFIGURATIONS) + foreach (_config ${_configs}) + _mercury_DEBUG_PRINT("---> ${_config}") - endforeach() + endforeach () - set_property(TARGET Mercury::${_component} APPEND PROPERTY - INTERFACE_LINK_LIBRARIES ) + set_property(TARGET Mercury::${_component} APPEND PROPERTY + INTERFACE_LINK_LIBRARIES) - mark_as_advanced(${_upper_component}_INCLUDE_DIR ${_upper_component}_LIBRARY) + mark_as_advanced(${_upper_component}_INCLUDE_DIR ${_upper_component}_LIBRARY) endmacro() @@ -181,100 +181,100 @@ set(_mercury_components na mercury_util) # prevent repeating work if the main CMakeLists.txt already called # find_package(PkgConfig) -if(NOT PKG_CONFIG_FOUND) - find_package(PkgConfig REQUIRED) -endif() - -if(PKG_CONFIG_FOUND) - pkg_check_modules(PC_MERCURY QUIET mercury) - - # find mercury header - find_path( - MERCURY_INCLUDE_DIR - NAMES mercury.h - PATHS ${PC_MERCURY_INCLUDE_DIRS} - PATH_SUFFIXES include - ) - # find mercury library (release version) - find_library( - MERCURY_LIBRARY_RELEASE - NAMES mercury - PATHS ${PC_MERCURY_LIBRARY_DIRS} - ) - - # find mercury library (debug version) - find_library( - MERCURY_LIBRARY_DEBUG - NAMES mercury_debug - PATHS ${PC_MERCURY_LIBRARY_DIRS} - ) - - # initialize MERCURY_LIBRARY with the appropriate library for this build - # configuration - select_library_configurations(MERCURY) - - # Mercury_VERSION needs to be set to the appropriate value for the call - # to find_package_handle_standard_args() below to work as expected - set(Mercury_VERSION ${PC_MERCURY_VERSION}) -endif() +if (NOT PKG_CONFIG_FOUND) + find_package(PkgConfig REQUIRED) +endif () + +if (PKG_CONFIG_FOUND) + pkg_check_modules(PC_MERCURY QUIET mercury) + + # find mercury header + find_path( + MERCURY_INCLUDE_DIR + NAMES mercury.h + PATHS ${PC_MERCURY_INCLUDE_DIRS} + PATH_SUFFIXES include + ) + # find mercury library (release version) + find_library( + MERCURY_LIBRARY_RELEASE + NAMES mercury + PATHS ${PC_MERCURY_LIBRARY_DIRS} + ) + + # find mercury library (debug version) + find_library( + MERCURY_LIBRARY_DEBUG + NAMES mercury_debug + PATHS ${PC_MERCURY_LIBRARY_DIRS} + ) + + # initialize MERCURY_LIBRARY with the appropriate library for this build + # configuration + select_library_configurations(MERCURY) + + # Mercury_VERSION needs to be set to the appropriate value for the call + # to find_package_handle_standard_args() below to work as expected + set(Mercury_VERSION ${PC_MERCURY_VERSION}) +endif () mark_as_advanced(MERCURY_INCLUDE_DIR MERCURY_LIBRARY) include(FindPackageHandleStandardArgs) find_package_handle_standard_args( - Mercury - FOUND_VAR Mercury_FOUND - REQUIRED_VARS MERCURY_LIBRARY MERCURY_INCLUDE_DIR - VERSION_VAR Mercury_VERSION + Mercury + FOUND_VAR Mercury_FOUND + REQUIRED_VARS MERCURY_LIBRARY MERCURY_INCLUDE_DIR + VERSION_VAR Mercury_VERSION ) -if(Mercury_FOUND) - set(Mercury_INCLUDE_DIRS ${MERCURY_INCLUDE_DIR}) - set(Mercury_LIBRARIES ${MERCURY_LIBRARY}) +if (Mercury_FOUND) + set(Mercury_INCLUDE_DIRS ${MERCURY_INCLUDE_DIR}) + set(Mercury_LIBRARIES ${MERCURY_LIBRARY}) + + if (NOT TARGET Mercury::Mercury) + add_library(Mercury::Mercury UNKNOWN IMPORTED) + endif () + + if (MERCURY_LIBRARY_RELEASE) + set_property( + TARGET Mercury::Mercury + APPEND + PROPERTY IMPORTED_CONFIGURATIONS RELEASE + ) + set_target_properties( + Mercury::Mercury PROPERTIES IMPORTED_LOCATION_RELEASE + "${MERCURY_LIBRARY_RELEASE}" + ) + endif () + + if (MERCURY_LIBRARY_DEBUG) + set_property( + TARGET Mercury::Mercury + APPEND + PROPERTY IMPORTED_CONFIGURATIONS DEBUG + ) + set_target_properties( + Mercury::Mercury PROPERTIES IMPORTED_LOCATION_DEBUG + "${MERCURY_LIBRARY_DEBUG}" + ) + endif () - if(NOT TARGET Mercury::Mercury) - add_library(Mercury::Mercury UNKNOWN IMPORTED) - endif() - - if(MERCURY_LIBRARY_RELEASE) - set_property( - TARGET Mercury::Mercury - APPEND - PROPERTY IMPORTED_CONFIGURATIONS RELEASE - ) set_target_properties( - Mercury::Mercury PROPERTIES IMPORTED_LOCATION_RELEASE - "${MERCURY_LIBRARY_RELEASE}" - ) - endif() + Mercury::Mercury + PROPERTIES INTERFACE_COMPILE_OPTIONS "${PC_MERCURY_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${MERCURY_INCLUDE_DIR}" - if(MERCURY_LIBRARY_DEBUG) - set_property( - TARGET Mercury::Mercury - APPEND - PROPERTY IMPORTED_CONFIGURATIONS DEBUG ) - set_target_properties( - Mercury::Mercury PROPERTIES IMPORTED_LOCATION_DEBUG - "${MERCURY_LIBRARY_DEBUG}" - ) - endif() - - set_target_properties( - Mercury::Mercury - PROPERTIES INTERFACE_COMPILE_OPTIONS "${PC_MERCURY_CFLAGS_OTHER}" - INTERFACE_INCLUDE_DIRECTORIES "${MERCURY_INCLUDE_DIR}" - - ) - ############################################################################### - # Find headers and libraries for additional Mercury components - ############################################################################### - foreach(_component ${_mercury_components}) - _mercury_find_component(${_component}) + ############################################################################### + # Find headers and libraries for additional Mercury components + ############################################################################### + foreach (_component ${_mercury_components}) + _mercury_find_component(${_component}) - set_target_properties(Mercury::Mercury PROPERTIES - INTERFACE_LINK_LIBRARIES Mercury::${_component}) - endforeach() -endif() + set_target_properties(Mercury::Mercury PROPERTIES + INTERFACE_LINK_LIBRARIES Mercury::${_component}) + endforeach () +endif () diff --git a/CMake/FindParallax.cmake b/CMake/FindParallax.cmake index 61131d47c0755605684ab26484f3f534144f8f53..1bb89179de95b66bc0927d339cf2c3f4f750b77b 100644 --- a/CMake/FindParallax.cmake +++ b/CMake/FindParallax.cmake @@ -29,9 +29,9 @@ list(APPEND _parallax_components "log") find_path( - PARALLAX_INCLUDE_DIR - NAMES parallax.h - PATH_SUFFIXES include + PARALLAX_INCLUDE_DIR + NAMES parallax.h + PATH_SUFFIXES include ) find_library(PARALLAX_LIBRARY NAMES parallax) @@ -42,42 +42,42 @@ mark_as_advanced(PARALLAX_LIBRARY PARALLAX_INCLUDE_DIR PARALLAX_LOG_LIBRARY) include(FindPackageHandleStandardArgs) find_package_handle_standard_args( - Parallax - FOUND_VAR Parallax_FOUND - REQUIRED_VARS PARALLAX_LIBRARY PARALLAX_LOG_LIBRARY PARALLAX_INCLUDE_DIR + Parallax + FOUND_VAR Parallax_FOUND + REQUIRED_VARS PARALLAX_LIBRARY PARALLAX_LOG_LIBRARY PARALLAX_INCLUDE_DIR ) -if(Parallax_FOUND) - set(Parallax_INCLUDE_DIRS ${PARALLAX_INCLUDE_DIR}) - set(Parallax_LIBRARIES ${PARALLAX_LIBRARY} ${PARALLAX_LOG_LIBRARY}) +if (Parallax_FOUND) + set(Parallax_INCLUDE_DIRS ${PARALLAX_INCLUDE_DIR}) + set(Parallax_LIBRARIES ${PARALLAX_LIBRARY} ${PARALLAX_LOG_LIBRARY}) - if(NOT TARGET Parallax::parallax) - add_library(Parallax::parallax UNKNOWN IMPORTED) - endif() + if (NOT TARGET Parallax::parallax) + add_library(Parallax::parallax UNKNOWN IMPORTED) + endif () - set_target_properties( - Parallax::parallax - PROPERTIES IMPORTED_LOCATION "${PARALLAX_LIBRARY}" - INTERFACE_INCLUDE_DIRECTORIES "${PARALLAX_INCLUDE_DIR}" - IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" - ) + set_target_properties( + Parallax::parallax + PROPERTIES IMPORTED_LOCATION "${PARALLAX_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${PARALLAX_INCLUDE_DIR}" + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + ) - foreach(_component ${_parallax_components}) - if(NOT TARGET Parallax::${_component}) - add_library(Parallax::${_component} UNKNOWN IMPORTED) + foreach (_component ${_parallax_components}) + if (NOT TARGET Parallax::${_component}) + add_library(Parallax::${_component} UNKNOWN IMPORTED) - if(Parallax_INCLUDE_DIRS) - set_target_properties( - Parallax::${_component} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${PARALLAX_INCLUDE_DIR}" - ) + if (Parallax_INCLUDE_DIRS) + set_target_properties( + Parallax::${_component} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES + "${PARALLAX_INCLUDE_DIR}" + ) - set_target_properties( - Parallax::${_component} - PROPERTIES IMPORTED_LOCATION "${PARALLAX_LOG_LIBRARY}" - IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" - ) - endif() - endif() - endforeach() -endif() + set_target_properties( + Parallax::${_component} + PROPERTIES IMPORTED_LOCATION "${PARALLAX_LOG_LIBRARY}" + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + ) + endif () + endif () + endforeach () +endif () diff --git a/CMake/FindSnappy.cmake b/CMake/FindSnappy.cmake index 04c43c14910b691a4aa2728049d6452d7ae0fa70..977be71713ed4b67eb0c0cedf5ad9df3e64d3566 100644 --- a/CMake/FindSnappy.cmake +++ b/CMake/FindSnappy.cmake @@ -27,7 +27,7 @@ ################################################################################ find_library(Snappy_LIBRARY - NAMES snappy + NAMES snappy ) find_path(Snappy_INCLUDE_DIR @@ -42,6 +42,6 @@ include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Snappy DEFAULT_MSG Snappy_LIBRARY Snappy_INCLUDE_DIR) mark_as_advanced( - Snappy_LIBRARY - Snappy_INCLUDE_DIR + Snappy_LIBRARY + Snappy_INCLUDE_DIR ) diff --git a/CMake/FindSphinx.cmake b/CMake/FindSphinx.cmake index 35eb2d62ee433e1f3fd8cb7bed9230c72434cc2c..bf90f3258ac3ca7c6d1c58b8a9370a5f7b0e0b87 100644 --- a/CMake/FindSphinx.cmake +++ b/CMake/FindSphinx.cmake @@ -167,78 +167,78 @@ Functions include(FindPackageHandleStandardArgs) macro(_Sphinx_find_executable _exe) - string(TOUPPER "${_exe}" _uc) - # sphinx-(build|quickstart)-3 x.x.x - # FIXME: This works on Fedora (and probably most other UNIX like targets). - # Windows targets and PIP installs might need some work. - find_program( - SPHINX_${_uc}_EXECUTABLE - NAMES "sphinx-${_exe}-3" "sphinx-${_exe}" "sphinx-${_exe}.exe") - - if(SPHINX_${_uc}_EXECUTABLE) - execute_process( - COMMAND "${SPHINX_${_uc}_EXECUTABLE}" --version - RESULT_VARIABLE _result - OUTPUT_VARIABLE _output - OUTPUT_STRIP_TRAILING_WHITESPACE) - if(_result EQUAL 0 AND _output MATCHES " v?([0-9]+\\.[0-9]+\\.[0-9]+)$") - set(SPHINX_${_uc}_VERSION "${CMAKE_MATCH_1}") - endif() - - if(NOT TARGET Sphinx::${_exe}) - add_executable(Sphinx::${_exe} IMPORTED GLOBAL) - set_target_properties(Sphinx::${_exe} PROPERTIES - IMPORTED_LOCATION "${SPHINX_${_uc}_EXECUTABLE}") - endif() - set(Sphinx_${_exe}_FOUND TRUE) - else() - set(Sphinx_${_exe}_FOUND FALSE) - endif() - unset(_uc) + string(TOUPPER "${_exe}" _uc) + # sphinx-(build|quickstart)-3 x.x.x + # FIXME: This works on Fedora (and probably most other UNIX like targets). + # Windows targets and PIP installs might need some work. + find_program( + SPHINX_${_uc}_EXECUTABLE + NAMES "sphinx-${_exe}-3" "sphinx-${_exe}" "sphinx-${_exe}.exe") + + if (SPHINX_${_uc}_EXECUTABLE) + execute_process( + COMMAND "${SPHINX_${_uc}_EXECUTABLE}" --version + RESULT_VARIABLE _result + OUTPUT_VARIABLE _output + OUTPUT_STRIP_TRAILING_WHITESPACE) + if (_result EQUAL 0 AND _output MATCHES " v?([0-9]+\\.[0-9]+\\.[0-9]+)$") + set(SPHINX_${_uc}_VERSION "${CMAKE_MATCH_1}") + endif () + + if (NOT TARGET Sphinx::${_exe}) + add_executable(Sphinx::${_exe} IMPORTED GLOBAL) + set_target_properties(Sphinx::${_exe} PROPERTIES + IMPORTED_LOCATION "${SPHINX_${_uc}_EXECUTABLE}") + endif () + set(Sphinx_${_exe}_FOUND TRUE) + else () + set(Sphinx_${_exe}_FOUND FALSE) + endif () + unset(_uc) endmacro() macro(_Sphinx_find_module _name _module) - string(TOUPPER "${_name}" _Sphinx_uc) - if(SPHINX_PYTHON_EXECUTABLE) - execute_process( - COMMAND ${SPHINX_PYTHON_EXECUTABLE} -m ${_module} --version - RESULT_VARIABLE _result - OUTPUT_VARIABLE _output - OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_QUIET) - if(_result EQUAL 0) - if(_output MATCHES " v?([0-9]+\\.[0-9]+\\.[0-9]+)$") - set(SPHINX_${_Sphinx_uc}_VERSION "${CMAKE_MATCH_1}") - endif() - - if(NOT TARGET Sphinx::${_name}) - set(SPHINX_${_Sphinx_uc}_EXECUTABLE "${SPHINX_PYTHON_EXECUTABLE} -m ${_module}") - add_executable(Sphinx::${_name} IMPORTED GLOBAL) - set_target_properties(Sphinx::${_name} PROPERTIES - IMPORTED_LOCATION "${SPHINX_PYTHON_EXECUTABLE}") - endif() - set(Sphinx_${_name}_ARGS -m ${_module}) - set(Sphinx_${_name}_FOUND TRUE) - else() - set(Sphinx_${_name}_FOUND FALSE) - endif() - else() - set(Sphinx_${_name}_FOUND FALSE) - endif() - unset(_Sphinx_uc) + string(TOUPPER "${_name}" _Sphinx_uc) + if (SPHINX_PYTHON_EXECUTABLE) + execute_process( + COMMAND ${SPHINX_PYTHON_EXECUTABLE} -m ${_module} --version + RESULT_VARIABLE _result + OUTPUT_VARIABLE _output + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET) + if (_result EQUAL 0) + if (_output MATCHES " v?([0-9]+\\.[0-9]+\\.[0-9]+)$") + set(SPHINX_${_Sphinx_uc}_VERSION "${CMAKE_MATCH_1}") + endif () + + if (NOT TARGET Sphinx::${_name}) + set(SPHINX_${_Sphinx_uc}_EXECUTABLE "${SPHINX_PYTHON_EXECUTABLE} -m ${_module}") + add_executable(Sphinx::${_name} IMPORTED GLOBAL) + set_target_properties(Sphinx::${_name} PROPERTIES + IMPORTED_LOCATION "${SPHINX_PYTHON_EXECUTABLE}") + endif () + set(Sphinx_${_name}_ARGS -m ${_module}) + set(Sphinx_${_name}_FOUND TRUE) + else () + set(Sphinx_${_name}_FOUND FALSE) + endif () + else () + set(Sphinx_${_name}_FOUND FALSE) + endif () + unset(_Sphinx_uc) endmacro() macro(_Sphinx_find_extension _ext) - if(SPHINX_PYTHON_EXECUTABLE) - execute_process( - COMMAND ${SPHINX_PYTHON_EXECUTABLE} -c "import ${_ext}" - RESULT_VARIABLE _result) - if(_result EQUAL 0) - set(Sphinx_${_ext}_FOUND TRUE) - else() - set(Sphinx_${_ext}_FOUND FALSE) - endif() - endif() + if (SPHINX_PYTHON_EXECUTABLE) + execute_process( + COMMAND ${SPHINX_PYTHON_EXECUTABLE} -c "import ${_ext}" + RESULT_VARIABLE _result) + if (_result EQUAL 0) + set(Sphinx_${_ext}_FOUND TRUE) + else () + set(Sphinx_${_ext}_FOUND FALSE) + endif () + endif () endmacro() # @@ -248,96 +248,96 @@ endmacro() # Find sphinx-build shim. _Sphinx_find_executable(build) -if(SPHINX_BUILD_EXECUTABLE) - # Find sphinx-quickstart shim. - _Sphinx_find_executable(quickstart) - - # Locate Python executable - if(CMAKE_HOST_WIN32) - # script-build on Windows located under (when PIP is used): - # C:/Program Files/PythonXX/Scripts - # C:/Users/username/AppData/Roaming/Python/PythonXX/Sripts - # - # Python modules are installed under: - # C:/Program Files/PythonXX/Lib - # C:/Users/username/AppData/Roaming/Python/PythonXX/site-packages - # - # To verify a given module is installed, use the Python base directory - # and test if either Lib/module.py or site-packages/module.py exists. - get_filename_component(_Sphinx_directory "${SPHINX_BUILD_EXECUTABLE}" DIRECTORY) - get_filename_component(_Sphinx_directory "${_Sphinx_directory}" DIRECTORY) - if(EXISTS "${_Sphinx_directory}/python.exe") - set(SPHINX_PYTHON_EXECUTABLE "${_Sphinx_directory}/python.exe") - endif() - unset(_Sphinx_directory) - else() - file(READ "${SPHINX_BUILD_EXECUTABLE}" _Sphinx_script) - if(_Sphinx_script MATCHES "^#!([^\n]+)") - string(STRIP "${CMAKE_MATCH_1}" _Sphinx_shebang) - if(EXISTS "${_Sphinx_shebang}") - set(SPHINX_PYTHON_EXECUTABLE "${_Sphinx_shebang}") - endif() - endif() - unset(_Sphinx_script) - unset(_Sphinx_shebang) - endif() -endif() - -if(NOT SPHINX_PYTHON_EXECUTABLE) - # Python executable cannot be extracted from shim shebang or path if e.g. - # virtual environments are used, fallback to find package. Assume the - # correct installation is found, the setup is probably broken in more ways - # than one otherwise. - find_package(Python3 QUIET COMPONENTS Interpreter) - if(TARGET Python3::Interpreter) - set(SPHINX_PYTHON_EXECUTABLE ${Python3_EXECUTABLE}) - # Revert to "python -m sphinx" if shim cannot be found. - if(NOT SPHINX_BUILD_EXECUTABLE) - _Sphinx_find_module(build sphinx) - _Sphinx_find_module(quickstart sphinx.cmd.quickstart) - endif() - endif() -endif() +if (SPHINX_BUILD_EXECUTABLE) + # Find sphinx-quickstart shim. + _Sphinx_find_executable(quickstart) + + # Locate Python executable + if (CMAKE_HOST_WIN32) + # script-build on Windows located under (when PIP is used): + # C:/Program Files/PythonXX/Scripts + # C:/Users/username/AppData/Roaming/Python/PythonXX/Sripts + # + # Python modules are installed under: + # C:/Program Files/PythonXX/Lib + # C:/Users/username/AppData/Roaming/Python/PythonXX/site-packages + # + # To verify a given module is installed, use the Python base directory + # and test if either Lib/module.py or site-packages/module.py exists. + get_filename_component(_Sphinx_directory "${SPHINX_BUILD_EXECUTABLE}" DIRECTORY) + get_filename_component(_Sphinx_directory "${_Sphinx_directory}" DIRECTORY) + if (EXISTS "${_Sphinx_directory}/python.exe") + set(SPHINX_PYTHON_EXECUTABLE "${_Sphinx_directory}/python.exe") + endif () + unset(_Sphinx_directory) + else () + file(READ "${SPHINX_BUILD_EXECUTABLE}" _Sphinx_script) + if (_Sphinx_script MATCHES "^#!([^\n]+)") + string(STRIP "${CMAKE_MATCH_1}" _Sphinx_shebang) + if (EXISTS "${_Sphinx_shebang}") + set(SPHINX_PYTHON_EXECUTABLE "${_Sphinx_shebang}") + endif () + endif () + unset(_Sphinx_script) + unset(_Sphinx_shebang) + endif () +endif () + +if (NOT SPHINX_PYTHON_EXECUTABLE) + # Python executable cannot be extracted from shim shebang or path if e.g. + # virtual environments are used, fallback to find package. Assume the + # correct installation is found, the setup is probably broken in more ways + # than one otherwise. + find_package(Python3 QUIET COMPONENTS Interpreter) + if (TARGET Python3::Interpreter) + set(SPHINX_PYTHON_EXECUTABLE ${Python3_EXECUTABLE}) + # Revert to "python -m sphinx" if shim cannot be found. + if (NOT SPHINX_BUILD_EXECUTABLE) + _Sphinx_find_module(build sphinx) + _Sphinx_find_module(quickstart sphinx.cmd.quickstart) + endif () + endif () +endif () # # Verify components are available. # -if(SPHINX_BUILD_VERSION) - - # Breathe is required for Exhale - if("exhale" IN_LIST Sphinx_FIND_COMPONENTS AND NOT - "breathe" IN_LIST Sphinx_FIND_COMPONENTS) - list(APPEND Sphinx_FIND_COMPONENTS "breathe") - endif() - - # Find all requested components for Sphinx... - foreach(_Sphinx_component IN LISTS Sphinx_FIND_COMPONENTS) - if(_Sphinx_component STREQUAL "build") - # Do nothing, sphinx-build is always required. - continue() - elseif(_Sphinx_component STREQUAL "quickstart") - # Do nothing, sphinx-quickstart is optional, but looked up by default. - continue() - endif() - _Sphinx_find_extension(${_Sphinx_component}) - endforeach() - unset(_Sphinx_component) - - # - # Verify both executables are part of the Sphinx distribution. - # - if(SPHINX_QUICKSTART_VERSION AND NOT SPHINX_BUILD_VERSION STREQUAL SPHINX_QUICKSTART_VERSION) - message(FATAL_ERROR "Versions for sphinx-build (${SPHINX_BUILD_VERSION}) " - "and sphinx-quickstart (${SPHINX_QUICKSTART_VERSION}) " - "do not match") - endif() -endif() +if (SPHINX_BUILD_VERSION) + + # Breathe is required for Exhale + if ("exhale" IN_LIST Sphinx_FIND_COMPONENTS AND NOT + "breathe" IN_LIST Sphinx_FIND_COMPONENTS) + list(APPEND Sphinx_FIND_COMPONENTS "breathe") + endif () + + # Find all requested components for Sphinx... + foreach (_Sphinx_component IN LISTS Sphinx_FIND_COMPONENTS) + if (_Sphinx_component STREQUAL "build") + # Do nothing, sphinx-build is always required. + continue() + elseif (_Sphinx_component STREQUAL "quickstart") + # Do nothing, sphinx-quickstart is optional, but looked up by default. + continue() + endif () + _Sphinx_find_extension(${_Sphinx_component}) + endforeach () + unset(_Sphinx_component) + + # + # Verify both executables are part of the Sphinx distribution. + # + if (SPHINX_QUICKSTART_VERSION AND NOT SPHINX_BUILD_VERSION STREQUAL SPHINX_QUICKSTART_VERSION) + message(FATAL_ERROR "Versions for sphinx-build (${SPHINX_BUILD_VERSION}) " + "and sphinx-quickstart (${SPHINX_QUICKSTART_VERSION}) " + "do not match") + endif () +endif () find_package_handle_standard_args( - Sphinx - VERSION_VAR SPHINX_BUILD_VERSION - REQUIRED_VARS SPHINX_BUILD_EXECUTABLE SPHINX_BUILD_VERSION - HANDLE_COMPONENTS) + Sphinx + VERSION_VAR SPHINX_BUILD_VERSION + REQUIRED_VARS SPHINX_BUILD_EXECUTABLE SPHINX_BUILD_VERSION + HANDLE_COMPONENTS) # Generate a conf.py template file using sphinx-quickstart. # @@ -345,287 +345,287 @@ find_package_handle_standard_args( # specified as command line arguments, therefore its not required to parse the # generated conf.py. function(_Sphinx_generate_confpy _target _cachedir) - if(NOT TARGET Sphinx::quickstart) - message(FATAL_ERROR "sphinx-quickstart is not available, needed by" - "sphinx_add_docs for target ${_target}") - endif() - - if(NOT DEFINED SPHINX_PROJECT) - set(SPHINX_PROJECT ${PROJECT_NAME}) - endif() - - if(NOT DEFINED SPHINX_AUTHOR) - set(SPHINX_AUTHOR "${SPHINX_PROJECT} committers") - endif() - - if(NOT DEFINED SPHINX_COPYRIGHT) - string(TIMESTAMP "%Y, ${SPHINX_AUTHOR}" SPHINX_COPYRIGHT) - endif() - - if(NOT DEFINED SPHINX_VERSION) - set(SPHINX_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}") - endif() - - if(NOT DEFINED SPHINX_RELEASE) - set(SPHINX_RELEASE "${PROJECT_VERSION}") - endif() - - if(NOT DEFINED SPHINX_LANGUAGE) - set(SPHINX_LANGUAGE "en") - endif() - - if(NOT DEFINED SPHINX_MASTER) - set(SPHINX_MASTER "index") - endif() - - set(_known_exts autodoc doctest intersphinx todo coverage imgmath mathjax - ifconfig viewcode githubpages) - - if(DEFINED SPHINX_EXTENSIONS) - foreach(_ext ${SPHINX_EXTENSIONS}) - set(_is_known_ext FALSE) - foreach(_known_ext ${_known_exsts}) - if(_ext STREQUAL _known_ext) - set(_opts "${opts} --ext-${_ext}") - set(_is_known_ext TRUE) - break() - endif() - endforeach() - if(NOT _is_known_ext) - if(_exts) - set(_exts "${_exts},${_ext}") - else() - set(_exts "${_ext}") - endif() - endif() - endforeach() - endif() - - if(_exts) - set(_exts "--extensions=${_exts}") - endif() - - set(_templatedir "${CMAKE_CURRENT_BINARY_DIR}/${_target}.template") - file(MAKE_DIRECTORY "${_templatedir}") - string(REPLACE " " ";" _Sphinx_executable ${SPHINX_QUICKSTART_EXECUTABLE}) - execute_process( - COMMAND ${_Sphinx_executable} - -q --no-makefile --no-batchfile - -p "${SPHINX_PROJECT}" - -a "${SPHINX_AUTHOR}" - -v "${SPHINX_VERSION}" - -r "${SPHINX_RELEASE}" - -l "${SPHINX_LANGUAGE}" - --master "${SPHINX_MASTER}" - ${_opts} ${_exts} "${_templatedir}" - RESULT_VARIABLE _result - OUTPUT_QUIET) - unset(_Sphinx_executable) - - if(_result EQUAL 0 AND EXISTS "${_templatedir}/conf.py") - file(COPY "${_templatedir}/conf.py" DESTINATION "${_cachedir}") - endif() - - file(REMOVE_RECURSE "${_templatedir}") - - if(NOT _result EQUAL 0 OR NOT EXISTS "${_cachedir}/conf.py") - message(FATAL_ERROR "Sphinx configuration file not generated for " - "target ${_target}") - endif() + if (NOT TARGET Sphinx::quickstart) + message(FATAL_ERROR "sphinx-quickstart is not available, needed by" + "sphinx_add_docs for target ${_target}") + endif () + + if (NOT DEFINED SPHINX_PROJECT) + set(SPHINX_PROJECT ${PROJECT_NAME}) + endif () + + if (NOT DEFINED SPHINX_AUTHOR) + set(SPHINX_AUTHOR "${SPHINX_PROJECT} committers") + endif () + + if (NOT DEFINED SPHINX_COPYRIGHT) + string(TIMESTAMP "%Y, ${SPHINX_AUTHOR}" SPHINX_COPYRIGHT) + endif () + + if (NOT DEFINED SPHINX_VERSION) + set(SPHINX_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}") + endif () + + if (NOT DEFINED SPHINX_RELEASE) + set(SPHINX_RELEASE "${PROJECT_VERSION}") + endif () + + if (NOT DEFINED SPHINX_LANGUAGE) + set(SPHINX_LANGUAGE "en") + endif () + + if (NOT DEFINED SPHINX_MASTER) + set(SPHINX_MASTER "index") + endif () + + set(_known_exts autodoc doctest intersphinx todo coverage imgmath mathjax + ifconfig viewcode githubpages) + + if (DEFINED SPHINX_EXTENSIONS) + foreach (_ext ${SPHINX_EXTENSIONS}) + set(_is_known_ext FALSE) + foreach (_known_ext ${_known_exsts}) + if (_ext STREQUAL _known_ext) + set(_opts "${opts} --ext-${_ext}") + set(_is_known_ext TRUE) + break() + endif () + endforeach () + if (NOT _is_known_ext) + if (_exts) + set(_exts "${_exts},${_ext}") + else () + set(_exts "${_ext}") + endif () + endif () + endforeach () + endif () + + if (_exts) + set(_exts "--extensions=${_exts}") + endif () + + set(_templatedir "${CMAKE_CURRENT_BINARY_DIR}/${_target}.template") + file(MAKE_DIRECTORY "${_templatedir}") + string(REPLACE " " ";" _Sphinx_executable ${SPHINX_QUICKSTART_EXECUTABLE}) + execute_process( + COMMAND ${_Sphinx_executable} + -q --no-makefile --no-batchfile + -p "${SPHINX_PROJECT}" + -a "${SPHINX_AUTHOR}" + -v "${SPHINX_VERSION}" + -r "${SPHINX_RELEASE}" + -l "${SPHINX_LANGUAGE}" + --master "${SPHINX_MASTER}" + ${_opts} ${_exts} "${_templatedir}" + RESULT_VARIABLE _result + OUTPUT_QUIET) + unset(_Sphinx_executable) + + if (_result EQUAL 0 AND EXISTS "${_templatedir}/conf.py") + file(COPY "${_templatedir}/conf.py" DESTINATION "${_cachedir}") + endif () + + file(REMOVE_RECURSE "${_templatedir}") + + if (NOT _result EQUAL 0 OR NOT EXISTS "${_cachedir}/conf.py") + message(FATAL_ERROR "Sphinx configuration file not generated for " + "target ${_target}") + endif () endfunction() function(sphinx_add_docs _target) - set(_opts ALL) - set(_single_opts CONF_TEMPLATE BUILDER OUTPUT_DIRECTORY SOURCE_DIRECTORY COMMENT) - set(_multi_opts BREATHE_PROJECTS) - cmake_parse_arguments(_args "${_opts}" "${_single_opts}" "${_multi_opts}" ${ARGN}) - - unset(SPHINX_BREATHE_PROJECTS) - - if(NOT _args_COMMENT) - set(_args_COMMENT "Generating Sphinx API documentation for ${_target}") - endif() - - if(_args_CONF_TEMPLATE AND NOT EXISTS ${_args_CONF_TEMPLATE}) - message(FATAL_ERROR "CONF_TEMPLATE file '${_args_CONF_TEMPLATE}' does not exist") - endif() - - if(NOT EXHALE_CONTAINMENT_FOLDER) - set(EXHALE_CONTAINMENT_FOLDER "api") - endif() - - if(NOT EXHALE_ROOT_FILE_NAME) - set(EXHALE_ROOT_FILE_NAME "api.rst") - endif() - - if(NOT EXHALE_ROOT_FILE_TITLE) - set(EXHALE_ROOT_FILE_TITLE "${PROJECT_NAME} Reference") - endif() - - if(NOT _args_BUILDER) - message(FATAL_ERROR "Sphinx builder not specified for target ${_target}") - elseif(NOT _args_SOURCE_DIRECTORY) - message(FATAL_ERROR "Sphinx source directory not specified for target ${_target}") - else() - if(NOT IS_ABSOLUTE "${_args_SOURCE_DIRECTORY}") - get_filename_component(_sourcedir "${_args_SOURCE_DIRECTORY}" ABSOLUTE) - else() - set(_sourcedir "${_args_SOURCE_DIRECTORY}") - endif() - if(NOT IS_DIRECTORY "${_sourcedir}") - message(FATAL_ERROR "Sphinx source directory '${_sourcedir}' for" - "target ${_target} does not exist") - endif() - endif() - - set(_builder "${_args_BUILDER}") - if(_args_OUTPUT_DIRECTORY) - set(_outputdir "${_args_OUTPUT_DIRECTORY}") - else() - set(_outputdir "${CMAKE_CURRENT_BINARY_DIR}/${_target}") - endif() - - if(_args_BREATHE_PROJECTS) - if(NOT Sphinx_breathe_FOUND) - message(FATAL_ERROR "Sphinx extension 'breathe' is not available. Needed" - "by sphinx_add_docs for target ${_target}") - endif() - list(APPEND SPHINX_EXTENSIONS breathe) - - foreach(_doxygen_target ${_args_BREATHE_PROJECTS}) - if(TARGET ${_doxygen_target}) - list(APPEND _depends ${_doxygen_target}) - - # Doxygen targets are supported. Verify that a Doxyfile exists. - get_target_property(_dir ${_doxygen_target} BINARY_DIR) - set(_doxyfile "${_dir}/Doxyfile.${_doxygen_target}") - if(NOT EXISTS "${_doxyfile}") - message(FATAL_ERROR "Target ${_doxygen_target} is not a Doxygen" - "target, needed by sphinx_add_docs for target" - "${_target}") - endif() - - # Read the Doxyfile, verify XML generation is enabled and retrieve the - # output directory. - file(READ "${_doxyfile}" _contents) - if(NOT _contents MATCHES "GENERATE_XML *= *YES") - message(FATAL_ERROR "Doxygen target ${_doxygen_target} does not" - "generate XML, needed by sphinx_add_docs for" - "target ${_target}") - elseif(_contents MATCHES "OUTPUT_DIRECTORY *= *([^ ][^\n]*)") - string(STRIP "${CMAKE_MATCH_1}" _dir) - set(_name "${_doxygen_target}") - set(_dir "${_dir}/xml") - else() - message(FATAL_ERROR "Cannot parse Doxyfile generated by Doxygen" - "target ${_doxygen_target}, needed by" - "sphinx_add_docs for target ${_target}") - endif() - elseif(_doxygen_target MATCHES "([^: ]+) *: *(.*)") - set(_name "${CMAKE_MATCH_1}") - string(STRIP "${CMAKE_MATCH_2}" _dir) - endif() - - if(_name AND _dir) - if(_breathe_projects) - set(_breathe_projects "${_breathe_projects}, \"${_name}\": \"${_dir}\"") - else() - set(_breathe_projects "\"${_name}\": \"${_dir}\"") - endif() - if(NOT _breathe_default_project) - set(_breathe_default_project "${_name}") - endif() - endif() - endforeach() - endif() - - if(Sphinx_exhale_FOUND) - if(NOT Sphinx_breathe_FOUND) - message(FATAL_ERROR "Sphinx extension 'breathe' is not available, but is " - "required by exhale. Needed by sphinx_add_docs for " - "target ${_target}") - endif() - list(APPEND SPHINX_EXTENSIONS exhale) - endif() - - set(_cachedir "${CMAKE_CURRENT_BINARY_DIR}/${_target}.cache") - set(_cached_sourcesdir "${_cachedir}/_sources") - set(_cached_builddir "${_cachedir}/_build") - file(MAKE_DIRECTORY "${_cachedir}") - file(MAKE_DIRECTORY "${_cached_sourcesdir}") - file(MAKE_DIRECTORY "${_cached_builddir}") - file(MAKE_DIRECTORY "${_cached_builddir}/_static") - - # prepare Sphinx configuration file - set(_target_sphinx_conf "${_cached_builddir}/conf.py") - if(_args_CONF_TEMPLATE) - set(_sphinx_conf_template ${_args_CONF_TEMPLATE}) - - list(TRANSFORM SPHINX_EXTENSIONS REPLACE "^(.+)$" "'\\1'" OUTPUT_VARIABLE _foo) - list(JOIN _foo ",\n " SPHINX_EXTENSIONS) - unset(_foo) - - configure_file("${_sphinx_conf_template}" "${_target_sphinx_conf}" @ONLY) - else() - _Sphinx_generate_confpy(${_target} "${_cached_builddir}") - endif() - - if(_breathe_projects) - file(APPEND "${_target_sphinx_conf}" - "\n# Setup the breathe extension" - "\nbreathe_projects = { ${_breathe_projects} }" - "\nbreathe_default_project = '${_breathe_default_project}'" - "\n") - endif() - - if(Sphinx_exhale_FOUND) - set(_exhale_containment_folder "${_cached_sourcesdir}/${EXHALE_CONTAINMENT_FOLDER}") - set(_exhale_root_file_name ${EXHALE_ROOT_FILE_NAME}) - set(_exhale_root_file_title "${EXHALE_ROOT_FILE_TITLE}") - - file(APPEND "${_target_sphinx_conf}" - "\n# Setup the exhale extension" - "\nfrom exhale import utils" - "\nexhale_args = {" - "\n 'containmentFolder': '${_exhale_containment_folder}'," - "\n 'rootFileName': '${_exhale_root_file_name}'," - "\n 'rootFileTitle': '${_exhale_root_file_title}'," - "\n 'doxygenStripFromPath': '${CMAKE_SOURCE_DIR}'," - "\n 'createTreeView': True," - "\n 'customSpecificationsMapping': utils.makeCustomSpecificationsMapping(specificationsForKind)" - "\n}") - endif() - - unset(_all) - if(${_args_ALL}) - set(_all ALL) - endif() - - # Propagate some variables - set(SPHINX_OUTPUT_DIRECTORY "${_outputdir}" PARENT_SCOPE) - - string(REPLACE " " ";" _Sphinx_executable ${SPHINX_BUILD_EXECUTABLE}) - add_custom_target( - ${_target} ${_all} - COMMAND ${CMAKE_COMMAND} -E copy_directory ${_sourcedir} ${_cached_sourcesdir} - COMMAND ${_Sphinx_executable} - -b ${_builder} - -d "${_cached_builddir}/_doctrees" - -c "${_cached_builddir}" - "${_cached_sourcesdir}" - "${_outputdir}" - DEPENDS "${_target_sphinx_conf}" ${_depends} - COMMENT "${_args_COMMENT}") - unset(_Sphinx_executable) - - list(APPEND - _sphinx_generated_files - ${_cached_builddir}/_doctrees - ${_cached_builddir}/_static - ${_cached_sourcesdir} + set(_opts ALL) + set(_single_opts CONF_TEMPLATE BUILDER OUTPUT_DIRECTORY SOURCE_DIRECTORY COMMENT) + set(_multi_opts BREATHE_PROJECTS) + cmake_parse_arguments(_args "${_opts}" "${_single_opts}" "${_multi_opts}" ${ARGN}) + + unset(SPHINX_BREATHE_PROJECTS) + + if (NOT _args_COMMENT) + set(_args_COMMENT "Generating Sphinx API documentation for ${_target}") + endif () + + if (_args_CONF_TEMPLATE AND NOT EXISTS ${_args_CONF_TEMPLATE}) + message(FATAL_ERROR "CONF_TEMPLATE file '${_args_CONF_TEMPLATE}' does not exist") + endif () + + if (NOT EXHALE_CONTAINMENT_FOLDER) + set(EXHALE_CONTAINMENT_FOLDER "api") + endif () + + if (NOT EXHALE_ROOT_FILE_NAME) + set(EXHALE_ROOT_FILE_NAME "api.rst") + endif () + + if (NOT EXHALE_ROOT_FILE_TITLE) + set(EXHALE_ROOT_FILE_TITLE "${PROJECT_NAME} Reference") + endif () + + if (NOT _args_BUILDER) + message(FATAL_ERROR "Sphinx builder not specified for target ${_target}") + elseif (NOT _args_SOURCE_DIRECTORY) + message(FATAL_ERROR "Sphinx source directory not specified for target ${_target}") + else () + if (NOT IS_ABSOLUTE "${_args_SOURCE_DIRECTORY}") + get_filename_component(_sourcedir "${_args_SOURCE_DIRECTORY}" ABSOLUTE) + else () + set(_sourcedir "${_args_SOURCE_DIRECTORY}") + endif () + if (NOT IS_DIRECTORY "${_sourcedir}") + message(FATAL_ERROR "Sphinx source directory '${_sourcedir}' for" + "target ${_target} does not exist") + endif () + endif () + + set(_builder "${_args_BUILDER}") + if (_args_OUTPUT_DIRECTORY) + set(_outputdir "${_args_OUTPUT_DIRECTORY}") + else () + set(_outputdir "${CMAKE_CURRENT_BINARY_DIR}/${_target}") + endif () + + if (_args_BREATHE_PROJECTS) + if (NOT Sphinx_breathe_FOUND) + message(FATAL_ERROR "Sphinx extension 'breathe' is not available. Needed" + "by sphinx_add_docs for target ${_target}") + endif () + list(APPEND SPHINX_EXTENSIONS breathe) + + foreach (_doxygen_target ${_args_BREATHE_PROJECTS}) + if (TARGET ${_doxygen_target}) + list(APPEND _depends ${_doxygen_target}) + + # Doxygen targets are supported. Verify that a Doxyfile exists. + get_target_property(_dir ${_doxygen_target} BINARY_DIR) + set(_doxyfile "${_dir}/Doxyfile.${_doxygen_target}") + if (NOT EXISTS "${_doxyfile}") + message(FATAL_ERROR "Target ${_doxygen_target} is not a Doxygen" + "target, needed by sphinx_add_docs for target" + "${_target}") + endif () + + # Read the Doxyfile, verify XML generation is enabled and retrieve the + # output directory. + file(READ "${_doxyfile}" _contents) + if (NOT _contents MATCHES "GENERATE_XML *= *YES") + message(FATAL_ERROR "Doxygen target ${_doxygen_target} does not" + "generate XML, needed by sphinx_add_docs for" + "target ${_target}") + elseif (_contents MATCHES "OUTPUT_DIRECTORY *= *([^ ][^\n]*)") + string(STRIP "${CMAKE_MATCH_1}" _dir) + set(_name "${_doxygen_target}") + set(_dir "${_dir}/xml") + else () + message(FATAL_ERROR "Cannot parse Doxyfile generated by Doxygen" + "target ${_doxygen_target}, needed by" + "sphinx_add_docs for target ${_target}") + endif () + elseif (_doxygen_target MATCHES "([^: ]+) *: *(.*)") + set(_name "${CMAKE_MATCH_1}") + string(STRIP "${CMAKE_MATCH_2}" _dir) + endif () + + if (_name AND _dir) + if (_breathe_projects) + set(_breathe_projects "${_breathe_projects}, \"${_name}\": \"${_dir}\"") + else () + set(_breathe_projects "\"${_name}\": \"${_dir}\"") + endif () + if (NOT _breathe_default_project) + set(_breathe_default_project "${_name}") + endif () + endif () + endforeach () + endif () + + if (Sphinx_exhale_FOUND) + if (NOT Sphinx_breathe_FOUND) + message(FATAL_ERROR "Sphinx extension 'breathe' is not available, but is " + "required by exhale. Needed by sphinx_add_docs for " + "target ${_target}") + endif () + list(APPEND SPHINX_EXTENSIONS exhale) + endif () + + set(_cachedir "${CMAKE_CURRENT_BINARY_DIR}/${_target}.cache") + set(_cached_sourcesdir "${_cachedir}/_sources") + set(_cached_builddir "${_cachedir}/_build") + file(MAKE_DIRECTORY "${_cachedir}") + file(MAKE_DIRECTORY "${_cached_sourcesdir}") + file(MAKE_DIRECTORY "${_cached_builddir}") + file(MAKE_DIRECTORY "${_cached_builddir}/_static") + + # prepare Sphinx configuration file + set(_target_sphinx_conf "${_cached_builddir}/conf.py") + if (_args_CONF_TEMPLATE) + set(_sphinx_conf_template ${_args_CONF_TEMPLATE}) + + list(TRANSFORM SPHINX_EXTENSIONS REPLACE "^(.+)$" "'\\1'" OUTPUT_VARIABLE _foo) + list(JOIN _foo ",\n " SPHINX_EXTENSIONS) + unset(_foo) + + configure_file("${_sphinx_conf_template}" "${_target_sphinx_conf}" @ONLY) + else () + _Sphinx_generate_confpy(${_target} "${_cached_builddir}") + endif () + + if (_breathe_projects) + file(APPEND "${_target_sphinx_conf}" + "\n# Setup the breathe extension" + "\nbreathe_projects = { ${_breathe_projects} }" + "\nbreathe_default_project = '${_breathe_default_project}'" + "\n") + endif () + + if (Sphinx_exhale_FOUND) + set(_exhale_containment_folder "${_cached_sourcesdir}/${EXHALE_CONTAINMENT_FOLDER}") + set(_exhale_root_file_name ${EXHALE_ROOT_FILE_NAME}) + set(_exhale_root_file_title "${EXHALE_ROOT_FILE_TITLE}") + + file(APPEND "${_target_sphinx_conf}" + "\n# Setup the exhale extension" + "\nfrom exhale import utils" + "\nexhale_args = {" + "\n 'containmentFolder': '${_exhale_containment_folder}'," + "\n 'rootFileName': '${_exhale_root_file_name}'," + "\n 'rootFileTitle': '${_exhale_root_file_title}'," + "\n 'doxygenStripFromPath': '${CMAKE_SOURCE_DIR}'," + "\n 'createTreeView': True," + "\n 'customSpecificationsMapping': utils.makeCustomSpecificationsMapping(specificationsForKind)" + "\n}") + endif () + + unset(_all) + if (${_args_ALL}) + set(_all ALL) + endif () + + # Propagate some variables + set(SPHINX_OUTPUT_DIRECTORY "${_outputdir}" PARENT_SCOPE) + + string(REPLACE " " ";" _Sphinx_executable ${SPHINX_BUILD_EXECUTABLE}) + add_custom_target( + ${_target} ${_all} + COMMAND ${CMAKE_COMMAND} -E copy_directory ${_sourcedir} ${_cached_sourcesdir} + COMMAND ${_Sphinx_executable} + -b ${_builder} + -d "${_cached_builddir}/_doctrees" + -c "${_cached_builddir}" + "${_cached_sourcesdir}" + "${_outputdir}" + DEPENDS "${_target_sphinx_conf}" ${_depends} + COMMENT "${_args_COMMENT}") + unset(_Sphinx_executable) + + list(APPEND + _sphinx_generated_files + ${_cached_builddir}/_doctrees + ${_cached_builddir}/_static + ${_cached_sourcesdir} ) - set_target_properties(${_target} - PROPERTIES ADDITIONAL_CLEAN_FILES "${_sphinx_generated_files}") + set_target_properties(${_target} + PROPERTIES ADDITIONAL_CLEAN_FILES "${_sphinx_generated_files}") endfunction() diff --git a/CMake/FindSyscall_intercept.cmake b/CMake/FindSyscall_intercept.cmake index 427a3afca9dcb43e312e38e03bf2228f2411d1b5..a3d35580e0ccae8bf435b2a46c7d2cbed5ff3718 100644 --- a/CMake/FindSyscall_intercept.cmake +++ b/CMake/FindSyscall_intercept.cmake @@ -30,40 +30,40 @@ find_package(PkgConfig) pkg_check_modules(PC_Syscall_intercept QUIET libsyscall_intercept) find_path(Syscall_intercept_INCLUDE_DIR - NAMES libsyscall_intercept_hook_point.h - PATHS ${PC_Syscall_intercept_INCLUDE_DIRS} + NAMES libsyscall_intercept_hook_point.h + PATHS ${PC_Syscall_intercept_INCLUDE_DIRS} ) find_library(Syscall_intercept_LIBRARY - NAMES syscall_intercept - PATHS ${PC_Syscall_intercept_LIBRARY_DIRS} + NAMES syscall_intercept + PATHS ${PC_Syscall_intercept_LIBRARY_DIRS} ) include(FindPackageHandleStandardArgs) find_package_handle_standard_args( - Syscall_intercept - DEFAULT_MSG - Syscall_intercept_INCLUDE_DIR - Syscall_intercept_LIBRARY + Syscall_intercept + DEFAULT_MSG + Syscall_intercept_INCLUDE_DIR + Syscall_intercept_LIBRARY ) -if(Syscall_intercept_FOUND) - set(Syscall_intercept_LIBRARIES ${Syscall_intercept_LIBRARY}) - set(Syscall_intercept_INCLUDE_DIRS ${Syscall_intercept_INCLUDE_DIR}) - set(Syscall_intercept_DEFINITIONS ${PC_Syscall_intercept_CFLAGS_OTHER}) +if (Syscall_intercept_FOUND) + set(Syscall_intercept_LIBRARIES ${Syscall_intercept_LIBRARY}) + set(Syscall_intercept_INCLUDE_DIRS ${Syscall_intercept_INCLUDE_DIR}) + set(Syscall_intercept_DEFINITIONS ${PC_Syscall_intercept_CFLAGS_OTHER}) - if(NOT TARGET Syscall_intercept::Syscall_intercept) - add_library(Syscall_intercept::Syscall_intercept UNKNOWN IMPORTED) - set_target_properties(Syscall_intercept::Syscall_intercept PROPERTIES - IMPORTED_LOCATION "${Syscall_intercept_LIBRARY}" - INTERFACE_COMPILE_OPTIONS "${PC_Syscall_intercept_CFLAGS_OTHER}" - INTERFACE_INCLUDE_DIRECTORIES "${Syscall_intercept_INCLUDE_DIR}" - ) - endif() -endif() + if (NOT TARGET Syscall_intercept::Syscall_intercept) + add_library(Syscall_intercept::Syscall_intercept UNKNOWN IMPORTED) + set_target_properties(Syscall_intercept::Syscall_intercept PROPERTIES + IMPORTED_LOCATION "${Syscall_intercept_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${PC_Syscall_intercept_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${Syscall_intercept_INCLUDE_DIR}" + ) + endif () +endif () mark_as_advanced( - Syscall_intercept_INCLUDE_DIR - Syscall_intercept_LIBRARY + Syscall_intercept_INCLUDE_DIR + Syscall_intercept_LIBRARY ) diff --git a/CMake/FindZStd.cmake b/CMake/FindZStd.cmake index bcfb7c7e0fc9e772812b94cd5e91d5a1c8c65abe..22adb0166cc2b75eee7527aa35f4fc7fa7cdd381 100644 --- a/CMake/FindZStd.cmake +++ b/CMake/FindZStd.cmake @@ -36,11 +36,11 @@ find_path(ZStd_INCLUDE_DIR NAMES zstd.h - ) +) find_library(ZStd_LIBRARY NAMES zstd - ) +) set(ZStd_LIBRARIES ${ZStd_LIBRARY}) set(ZStd_INCLUDE_DIRS ${ZStd_INCLUDE_DIR}) @@ -49,7 +49,7 @@ include(FindPackageHandleStandardArgs) find_package_handle_standard_args(ZStd DEFAULT_MSG ZStd_LIBRARY ZStd_INCLUDE_DIR - ) +) mark_as_advanced( ZStd_LIBRARY diff --git a/CMake/gkfs-code-coverage.cmake b/CMake/gkfs-code-coverage.cmake index 21303184d812e0b2387560841278357ab28a9fea..f669765cfd81b27f21276cffa5c1df578342e858 100644 --- a/CMake/gkfs-code-coverage.cmake +++ b/CMake/gkfs-code-coverage.cmake @@ -30,147 +30,147 @@ option(GKFS_GENERATE_COVERAGE_REPORTS "Generate coverage reports" ON) macro(gkfs_enable_coverage_reports) - set(OPTIONS) - set(SINGLE_VALUE) - set(MULTI_VALUE EXCLUDE_DIRECTORIES) - cmake_parse_arguments( - ARGS "${OPTIONS}" "${SINGLE_VALUE}" "${MULTI_VALUE}" ${ARGN} - ) - - find_program(COVERAGE_PY - coverage.py - PATHS ${CMAKE_SOURCE_DIR}/scripts/dev - REQUIRED) - - if(NOT COVERAGE_OUTPUT_DIR) - set(COVERAGE_OUTPUT_DIR "${CMAKE_BINARY_DIR}/coverage") - endif() - - file(MAKE_DIRECTORY ${COVERAGE_OUTPUT_DIR}) - - if(NOT COVERAGE_ZEROCOUNT_TRACEFILE) - set(COVERAGE_ZEROCOUNT_TRACEFILE "${COVERAGE_OUTPUT_DIR}/zerocount.info") - endif() - - if(NOT COVERAGE_CAPTURE_TRACEFILE) - set(COVERAGE_CAPTURE_TRACEFILE "${COVERAGE_OUTPUT_DIR}/capture.info") - endif() - - if(NOT COVERAGE_UNIFIED_TRACEFILE) - set(COVERAGE_UNIFIED_TRACEFILE "${COVERAGE_OUTPUT_DIR}/coverage.info") - endif() - - if(NOT COVERAGE_HTML_REPORT_DIRECTORY) - set(COVERAGE_HTML_REPORT_DIRECTORY "${COVERAGE_OUTPUT_DIR}/coverage_html") - endif() - - if(NOT COVERAGE_XML_REPORT) - set(COVERAGE_XML_REPORT "${COVERAGE_OUTPUT_DIR}/coverage-cobertura.xml") - endif() - - # add a `coverage-zerocount` target for the initial baseline gathering of - # coverage information - add_custom_command( - OUTPUT "${COVERAGE_ZEROCOUNT_TRACEFILE}" - COMMAND - ${COVERAGE_PY} + set(OPTIONS) + set(SINGLE_VALUE) + set(MULTI_VALUE EXCLUDE_DIRECTORIES) + cmake_parse_arguments( + ARGS "${OPTIONS}" "${SINGLE_VALUE}" "${MULTI_VALUE}" ${ARGN} + ) + + find_program(COVERAGE_PY + coverage.py + PATHS ${CMAKE_SOURCE_DIR}/scripts/dev + REQUIRED) + + if (NOT COVERAGE_OUTPUT_DIR) + set(COVERAGE_OUTPUT_DIR "${CMAKE_BINARY_DIR}/coverage") + endif () + + file(MAKE_DIRECTORY ${COVERAGE_OUTPUT_DIR}) + + if (NOT COVERAGE_ZEROCOUNT_TRACEFILE) + set(COVERAGE_ZEROCOUNT_TRACEFILE "${COVERAGE_OUTPUT_DIR}/zerocount.info") + endif () + + if (NOT COVERAGE_CAPTURE_TRACEFILE) + set(COVERAGE_CAPTURE_TRACEFILE "${COVERAGE_OUTPUT_DIR}/capture.info") + endif () + + if (NOT COVERAGE_UNIFIED_TRACEFILE) + set(COVERAGE_UNIFIED_TRACEFILE "${COVERAGE_OUTPUT_DIR}/coverage.info") + endif () + + if (NOT COVERAGE_HTML_REPORT_DIRECTORY) + set(COVERAGE_HTML_REPORT_DIRECTORY "${COVERAGE_OUTPUT_DIR}/coverage_html") + endif () + + if (NOT COVERAGE_XML_REPORT) + set(COVERAGE_XML_REPORT "${COVERAGE_OUTPUT_DIR}/coverage-cobertura.xml") + endif () + + # add a `coverage-zerocount` target for the initial baseline gathering of + # coverage information + add_custom_command( + OUTPUT "${COVERAGE_ZEROCOUNT_TRACEFILE}" + COMMAND + ${COVERAGE_PY} capture --initial --root-directory "${CMAKE_BINARY_DIR}" --output-file "${COVERAGE_ZEROCOUNT_TRACEFILE}" --sources-directory "${CMAKE_SOURCE_DIR}" "$<$:--exclude;$>" - COMMAND_EXPAND_LISTS VERBATIM - COMMENT "Generating zerocount coverage tracefile" - ) - - add_custom_target(coverage-zerocount - DEPENDS ${COVERAGE_ZEROCOUNT_TRACEFILE}) - - # add a `coverage-capture` target to capture coverage data from any - # of the existing .gcda files - add_custom_command( - OUTPUT "${COVERAGE_CAPTURE_TRACEFILE}" - COMMAND - ${COVERAGE_PY} - capture - --root-directory "${CMAKE_BINARY_DIR}" - --output-file "${COVERAGE_CAPTURE_TRACEFILE}" - --sources-directory "${CMAKE_SOURCE_DIR}" - "$<$:--exclude;$>" - COMMAND_EXPAND_LISTS VERBATIM - COMMENT "Generating capture coverage tracefile" - ) - - add_custom_target(coverage-capture DEPENDS ${COVERAGE_CAPTURE_TRACEFILE}) - - # add a `coverage-unified` target to merge all coverage data available in - # ${COVERAGE_OUTPUT_DIR} into a unified coverage trace - add_custom_command( - OUTPUT ${COVERAGE_UNIFIED_TRACEFILE} - DEPENDS ${COVERAGE_CAPTURE_TRACEFILE} - COMMAND - ${COVERAGE_PY} - merge - --search-pattern "${COVERAGE_OUTPUT_DIR}/*.info" - --output-file "${COVERAGE_UNIFIED_TRACEFILE}" - VERBATIM - COMMENT "Generating unified coverage tracefile" - ) - - add_custom_target( - coverage-unified - DEPENDS "${COVERAGE_UNIFIED_TRACEFILE}" - ) - - # add a `coverage-summary` target to print a summary of coverage data - add_custom_target( - coverage-summary - COMMAND - ${COVERAGE_PY} - summary - --input-tracefile ${COVERAGE_UNIFIED_TRACEFILE} - DEPENDS ${COVERAGE_UNIFIED_TRACEFILE} - COMMENT "Gathering coverage information" - ) - - # add a `coverage-html` target to generate a coverage HTML report - add_custom_command(OUTPUT - "${COVERAGE_HTML_REPORT_DIRECTORY}" - COMMAND - ${COVERAGE_PY} - html_report - --input-tracefile "${COVERAGE_UNIFIED_TRACEFILE}" - --prefix "${CMAKE_SOURCE_DIR}" - --output-directory "${COVERAGE_HTML_REPORT_DIRECTORY}" - DEPENDS ${COVERAGE_UNIFIED_TRACEFILE} - VERBATIM - COMMENT "Generating HTML report" + COMMAND_EXPAND_LISTS VERBATIM + COMMENT "Generating zerocount coverage tracefile" ) - add_custom_target( - coverage-html - DEPENDS "${COVERAGE_HTML_REPORT_DIRECTORY}") - - # add a `coverage-cobertura` target to generate a Cobertura XML report - add_custom_command(OUTPUT - "${COVERAGE_XML_REPORT}" - COMMAND - ${COVERAGE_PY} - cobertura - --input-tracefile "${COVERAGE_UNIFIED_TRACEFILE}" - --base-dir "${CMAKE_SOURCE_DIR}" - --output-file "${COVERAGE_XML_REPORT}" - DEPENDS ${COVERAGE_UNIFIED_TRACEFILE} - VERBATIM - COMMENT "Generating Cobertura report" + add_custom_target(coverage-zerocount + DEPENDS ${COVERAGE_ZEROCOUNT_TRACEFILE}) + + # add a `coverage-capture` target to capture coverage data from any + # of the existing .gcda files + add_custom_command( + OUTPUT "${COVERAGE_CAPTURE_TRACEFILE}" + COMMAND + ${COVERAGE_PY} + capture + --root-directory "${CMAKE_BINARY_DIR}" + --output-file "${COVERAGE_CAPTURE_TRACEFILE}" + --sources-directory "${CMAKE_SOURCE_DIR}" + "$<$:--exclude;$>" + COMMAND_EXPAND_LISTS VERBATIM + COMMENT "Generating capture coverage tracefile" + ) + + add_custom_target(coverage-capture DEPENDS ${COVERAGE_CAPTURE_TRACEFILE}) + + # add a `coverage-unified` target to merge all coverage data available in + # ${COVERAGE_OUTPUT_DIR} into a unified coverage trace + add_custom_command( + OUTPUT ${COVERAGE_UNIFIED_TRACEFILE} + DEPENDS ${COVERAGE_CAPTURE_TRACEFILE} + COMMAND + ${COVERAGE_PY} + merge + --search-pattern "${COVERAGE_OUTPUT_DIR}/*.info" + --output-file "${COVERAGE_UNIFIED_TRACEFILE}" + VERBATIM + COMMENT "Generating unified coverage tracefile" + ) + + add_custom_target( + coverage-unified + DEPENDS "${COVERAGE_UNIFIED_TRACEFILE}" + ) + + # add a `coverage-summary` target to print a summary of coverage data + add_custom_target( + coverage-summary + COMMAND + ${COVERAGE_PY} + summary + --input-tracefile ${COVERAGE_UNIFIED_TRACEFILE} + DEPENDS ${COVERAGE_UNIFIED_TRACEFILE} + COMMENT "Gathering coverage information" ) - add_custom_target( - coverage-cobertura - DEPENDS "${COVERAGE_XML_REPORT}" - ) - set_target_properties( - coverage-cobertura PROPERTIES ADDITIONAL_CLEAN_FILES ${COVERAGE_XML_REPORT} - ) + # add a `coverage-html` target to generate a coverage HTML report + add_custom_command(OUTPUT + "${COVERAGE_HTML_REPORT_DIRECTORY}" + COMMAND + ${COVERAGE_PY} + html_report + --input-tracefile "${COVERAGE_UNIFIED_TRACEFILE}" + --prefix "${CMAKE_SOURCE_DIR}" + --output-directory "${COVERAGE_HTML_REPORT_DIRECTORY}" + DEPENDS ${COVERAGE_UNIFIED_TRACEFILE} + VERBATIM + COMMENT "Generating HTML report" + ) + + add_custom_target( + coverage-html + DEPENDS "${COVERAGE_HTML_REPORT_DIRECTORY}") + + # add a `coverage-cobertura` target to generate a Cobertura XML report + add_custom_command(OUTPUT + "${COVERAGE_XML_REPORT}" + COMMAND + ${COVERAGE_PY} + cobertura + --input-tracefile "${COVERAGE_UNIFIED_TRACEFILE}" + --base-dir "${CMAKE_SOURCE_DIR}" + --output-file "${COVERAGE_XML_REPORT}" + DEPENDS ${COVERAGE_UNIFIED_TRACEFILE} + VERBATIM + COMMENT "Generating Cobertura report" + ) + + add_custom_target( + coverage-cobertura + DEPENDS "${COVERAGE_XML_REPORT}" + ) + set_target_properties( + coverage-cobertura PROPERTIES ADDITIONAL_CLEAN_FILES ${COVERAGE_XML_REPORT} + ) endmacro() diff --git a/CMake/gkfs-options.cmake b/CMake/gkfs-options.cmake index de9c59951ed30b5e2a9814abeb8c5df326c49792..07891c69bc00b36ca90fc8c7321a181e7a25aa10 100644 --- a/CMake/gkfs-options.cmake +++ b/CMake/gkfs-options.cmake @@ -28,173 +28,173 @@ function(_get_feature_summary _output _property) - set(_currentFeatureText "") - get_property(_features GLOBAL PROPERTY ${_property}) - - if(_features) - list(REMOVE_DUPLICATES _features) - endif() - - foreach(_f ${_features}) - string(APPEND _currentFeatureText "\n-- * ${_f}") - get_property(_info GLOBAL PROPERTY _CMAKE_${_f}_DESCRIPTION) - if(_info) - string(APPEND _currentFeatureText ": ${_info}") - else() - get_property(_info GLOBAL PROPERTY _CMAKE_${_f}_HELP_TEXT) - string(APPEND _currentFeatureText ": ${_info}") - endif() - get_property(_info GLOBAL PROPERTY _CMAKE_${_f}_DEPENDS) - if(_info) - string(APPEND _currentFeatureText " [${${_info}}]") - endif() - get_property(_info GLOBAL PROPERTY _CMAKE_${_f}_EXTRA_INFO) - if(_info) - string(APPEND _currentFeatureText "\n-- ${_info}") - endif() - - endforeach() - - set(${_output} - "${_currentFeatureText}" - PARENT_SCOPE - ) + set(_currentFeatureText "") + get_property(_features GLOBAL PROPERTY ${_property}) + + if (_features) + list(REMOVE_DUPLICATES _features) + endif () + + foreach (_f ${_features}) + string(APPEND _currentFeatureText "\n-- * ${_f}") + get_property(_info GLOBAL PROPERTY _CMAKE_${_f}_DESCRIPTION) + if (_info) + string(APPEND _currentFeatureText ": ${_info}") + else () + get_property(_info GLOBAL PROPERTY _CMAKE_${_f}_HELP_TEXT) + string(APPEND _currentFeatureText ": ${_info}") + endif () + get_property(_info GLOBAL PROPERTY _CMAKE_${_f}_DEPENDS) + if (_info) + string(APPEND _currentFeatureText " [${${_info}}]") + endif () + get_property(_info GLOBAL PROPERTY _CMAKE_${_f}_EXTRA_INFO) + if (_info) + string(APPEND _currentFeatureText "\n-- ${_info}") + endif () + + endforeach () + + set(${_output} + "${_currentFeatureText}" + PARENT_SCOPE + ) endfunction() function(_add_feature_info _name _depends _help) - set(_enabled 1) - foreach(_d ${_depends}) - string(REGEX REPLACE " +" ";" _d "${_d}") - if(${_d}) - - else() - set(_enabled 0) - break() - endif() - endforeach() - if(${_enabled}) - set_property(GLOBAL APPEND PROPERTY GKFS_ENABLED_FEATURES "${_name}") - else() - set_property(GLOBAL APPEND PROPERTY GKFS_DISABLED_FEATURES "${_name}") - endif() - - set_property(GLOBAL PROPERTY _CMAKE_${_name}_DEPENDS ${_depends}) - set_property(GLOBAL PROPERTY _CMAKE_${_name}_HELP_TEXT "${_help}") - - if(ARGC GREATER_EQUAL 4) - set_property(GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION "${ARGV3}") - if(ARGC EQUAL 5) - set_property(GLOBAL PROPERTY _CMAKE_${_name}_EXTRA_INFO "${ARGV4}") - endif() - endif() + set(_enabled 1) + foreach (_d ${_depends}) + string(REGEX REPLACE " +" ";" _d "${_d}") + if (${_d}) + + else () + set(_enabled 0) + break() + endif () + endforeach () + if (${_enabled}) + set_property(GLOBAL APPEND PROPERTY GKFS_ENABLED_FEATURES "${_name}") + else () + set_property(GLOBAL APPEND PROPERTY GKFS_DISABLED_FEATURES "${_name}") + endif () + + set_property(GLOBAL PROPERTY _CMAKE_${_name}_DEPENDS ${_depends}) + set_property(GLOBAL PROPERTY _CMAKE_${_name}_HELP_TEXT "${_help}") + + if (ARGC GREATER_EQUAL 4) + set_property(GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION "${ARGV3}") + if (ARGC EQUAL 5) + set_property(GLOBAL PROPERTY _CMAKE_${_name}_EXTRA_INFO "${ARGV4}") + endif () + endif () endfunction() function(gkfs_feature_summary) - set(OPTIONS) - set(SINGLE_VALUE DESCRIPTION) - set(MULTI_VALUE) - - cmake_parse_arguments( - ARGS "${OPTIONS}" "${SINGLE_VALUE}" "${MULTI_VALUE}" ${ARGN} - ) - - if(ARGS_UNPARSED_ARGUMENTS) - message( - FATAL_ERROR - "Unknown keywords given to gkfs_feature_summary(): \"${ARGS_UNPARSED_ARGUMENTS}\"" - ) - endif() + set(OPTIONS) + set(SINGLE_VALUE DESCRIPTION) + set(MULTI_VALUE) - if(NOT ARGS_DESCRIPTION) - message( - FATAL_ERROR - "Missing mandatory keyword DESCRIPTION for gkfs_feature_summary()" + cmake_parse_arguments( + ARGS "${OPTIONS}" "${SINGLE_VALUE}" "${MULTI_VALUE}" ${ARGN} ) - endif() - - list(APPEND _what GKFS_ENABLED_FEATURES GKFS_DISABLED_FEATURES) - - set(_text "\n-- ") - string(APPEND _text "\n-- ====================================") - string(APPEND _text "\n-- ${ARGS_DESCRIPTION}") - string(APPEND _text "\n-- ====================================") - foreach(_w ${_what}) - set(_tmp) - _get_feature_summary(_tmp ${_w}) - if(_tmp) - if(_text) - string(APPEND _text "\n-- ${_tmp}") - endif() - endif() - endforeach() - - string(APPEND _text "\n-- ") - - message(STATUS "${_text}") + if (ARGS_UNPARSED_ARGUMENTS) + message( + FATAL_ERROR + "Unknown keywords given to gkfs_feature_summary(): \"${ARGS_UNPARSED_ARGUMENTS}\"" + ) + endif () + + if (NOT ARGS_DESCRIPTION) + message( + FATAL_ERROR + "Missing mandatory keyword DESCRIPTION for gkfs_feature_summary()" + ) + endif () + + list(APPEND _what GKFS_ENABLED_FEATURES GKFS_DISABLED_FEATURES) + + set(_text "\n-- ") + string(APPEND _text "\n-- ====================================") + string(APPEND _text "\n-- ${ARGS_DESCRIPTION}") + string(APPEND _text "\n-- ====================================") + foreach (_w ${_what}) + set(_tmp) + _get_feature_summary(_tmp ${_w}) + + if (_tmp) + if (_text) + string(APPEND _text "\n-- ${_tmp}") + endif () + endif () + endforeach () + + string(APPEND _text "\n-- ") + + message(STATUS "${_text}") endfunction() function(gkfs_define_option varName) - set(OPTIONS) - set(SINGLE_VALUE HELP_TEXT DEFAULT_VALUE FEATURE_NAME DESCRIPTION EXTRA_INFO) - set(MULTI_VALUE) - - cmake_parse_arguments( - ARGS "${OPTIONS}" "${SINGLE_VALUE}" "${MULTI_VALUE}" ${ARGN} - ) + set(OPTIONS) + set(SINGLE_VALUE HELP_TEXT DEFAULT_VALUE FEATURE_NAME DESCRIPTION EXTRA_INFO) + set(MULTI_VALUE) - if(ARGS_UNPARSED_ARGUMENTS) - message( - FATAL_ERROR - "Unknown keywords given to gkfs_define_option(): \"${ARGS_UNPARSED_ARGUMENTS}\"" + cmake_parse_arguments( + ARGS "${OPTIONS}" "${SINGLE_VALUE}" "${MULTI_VALUE}" ${ARGN} ) - endif() - if(NOT ARGS_HELP_TEXT) - message( - FATAL_ERROR "Missing mandatory keyword HELP_TEXT for gkfs_define_option()" + if (ARGS_UNPARSED_ARGUMENTS) + message( + FATAL_ERROR + "Unknown keywords given to gkfs_define_option(): \"${ARGS_UNPARSED_ARGUMENTS}\"" + ) + endif () + + if (NOT ARGS_HELP_TEXT) + message( + FATAL_ERROR "Missing mandatory keyword HELP_TEXT for gkfs_define_option()" + ) + endif () + + if (NOT ARGS_FEATURE_NAME) + set(ARGS_FEATURE_NAME ${varName}) + endif () + + _add_feature_info( + ${ARGS_FEATURE_NAME} ${varName} ${ARGS_HELP_TEXT} ${ARGS_DESCRIPTION} + ${ARGS_EXTRA_INFO} ) - endif() - if(NOT ARGS_FEATURE_NAME) - set(ARGS_FEATURE_NAME ${varName}) - endif() - - _add_feature_info( - ${ARGS_FEATURE_NAME} ${varName} ${ARGS_HELP_TEXT} ${ARGS_DESCRIPTION} - ${ARGS_EXTRA_INFO} - ) - - option(${varName} ${ARGS_HELP_TEXT} ${ARGS_DEFAULT_VALUE}) + option(${varName} ${ARGS_HELP_TEXT} ${ARGS_DEFAULT_VALUE}) endfunction() function(gkfs_define_variable varName value type docstring) - set(OPTIONS ADVANCED) - set(SINGLE_VALUE) - set(MULTI_VALUE) - - cmake_parse_arguments( - ARGS "${OPTIONS}" "${SINGLE_VALUE}" "${MULTI_VALUE}" ${ARGN} - ) + set(OPTIONS ADVANCED) + set(SINGLE_VALUE) + set(MULTI_VALUE) - if(ARGS_UNPARSED_ARGUMENTS) - message( - FATAL_ERROR - "Unknown keywords given to gkfs_define_variable(): \"${ARGS_UNPARSED_ARGUMENTS}\"" + cmake_parse_arguments( + ARGS "${OPTIONS}" "${SINGLE_VALUE}" "${MULTI_VALUE}" ${ARGN} ) - endif() - set(${varName} ${value} CACHE ${type} ${docstring}) - _add_feature_info(${varName} ${varName} ${docstring}) + if (ARGS_UNPARSED_ARGUMENTS) + message( + FATAL_ERROR + "Unknown keywords given to gkfs_define_variable(): \"${ARGS_UNPARSED_ARGUMENTS}\"" + ) + endif () - if(ARGS_ADVANCED) - mark_as_advanced(varName) - endif() + set(${varName} ${value} CACHE ${type} ${docstring}) + _add_feature_info(${varName} ${varName} ${docstring}) + + if (ARGS_ADVANCED) + mark_as_advanced(varName) + endif () endfunction() @@ -205,11 +205,11 @@ endfunction() # build documentation gkfs_define_option( - GKFS_BUILD_DOCUMENTATION - HELP_TEXT "Build documentation" - DEFAULT_VALUE OFF - DESCRIPTION "Generate documentation based on Sphinx+Doxygen" - FEATURE_NAME "DOCS" + GKFS_BUILD_DOCUMENTATION + HELP_TEXT "Build documentation" + DEFAULT_VALUE OFF + DESCRIPTION "Generate documentation based on Sphinx+Doxygen" + FEATURE_NAME "DOCS" ) # build tests @@ -222,9 +222,9 @@ gkfs_define_option( # build tests gkfs_define_option( - GKFS_BUILD_TESTS - HELP_TEXT "Build ${PROJECT_NAME} self tests" - DEFAULT_VALUE OFF + GKFS_BUILD_TESTS + HELP_TEXT "Build ${PROJECT_NAME} self tests" + DEFAULT_VALUE OFF ) # build tools @@ -237,9 +237,9 @@ gkfs_define_option( # use old resolve function gkfs_define_option( - GKFS_USE_LEGACY_PATH_RESOLVE - HELP_TEXT "Use the old implementation of the resolve function" - DEFAULT_VALUE OFF + GKFS_USE_LEGACY_PATH_RESOLVE + HELP_TEXT "Use the old implementation of the resolve function" + DEFAULT_VALUE OFF ) cmake_dependent_option(GKFS_INSTALL_TESTS "Install GekkoFS self tests" OFF "GKFS_BUILD_TESTS" OFF) @@ -251,34 +251,34 @@ cmake_dependent_option(GKFS_INSTALL_TESTS "Install GekkoFS self tests" OFF "GKFS ## check before create gkfs_define_option( - GKFS_CREATE_CHECK_PARENTS - HELP_TEXT "Enable checking parent directory for existence before creating children" - DEFAULT_VALUE ON - DESCRIPTION "Verify that a parent directory exists before creating new files or directories" + GKFS_CREATE_CHECK_PARENTS + HELP_TEXT "Enable checking parent directory for existence before creating children" + DEFAULT_VALUE ON + DESCRIPTION "Verify that a parent directory exists before creating new files or directories" ) ## symbolic link support gkfs_define_option( - GKFS_SYMLINK_SUPPORT - HELP_TEXT "Enable support for symlinks" - DEFAULT_VALUE ON - DESCRIPTION "Enable support for symbolic links in paths" + GKFS_SYMLINK_SUPPORT + HELP_TEXT "Enable support for symlinks" + DEFAULT_VALUE OFF + DESCRIPTION "Enable support for symbolic links in paths" ) ## rename support gkfs_define_option( - GKFS_RENAME_SUPPORT - HELP_TEXT "Enable support for rename" - DEFAULT_VALUE OFF - DESCRIPTION "Compile with support for rename ops (experimental)" + GKFS_RENAME_SUPPORT + HELP_TEXT "Enable support for rename" + DEFAULT_VALUE OFF + DESCRIPTION "Compile with support for rename ops (experimental)" ) ## external link support gkfs_define_option( - GKFS_FOLLOW_EXTERNAL_SYMLINKS - HELP_TEXT "Enable support for following external links for resolving the path" - DEFAULT_VALUE OFF - DESCRIPTION "Compile with lstat usage in path resolve" + GKFS_FOLLOW_EXTERNAL_SYMLINKS + HELP_TEXT "Enable support for following external links for resolving the path" + DEFAULT_VALUE OFF + DESCRIPTION "Compile with lstat usage in path resolve" ) @@ -288,55 +288,55 @@ gkfs_define_option( ## Maximum number of internal file descriptors reserved for GekkoFS gkfs_define_variable(GKFS_MAX_INTERNAL_FDS 256 - STRING "Number of file descriptors reserved for internal use" ADVANCED + STRING "Number of file descriptors reserved for internal use" ADVANCED ) ## Maximum number of open file descriptors for GekkoFS execute_process(COMMAND getconf OPEN_MAX - OUTPUT_VARIABLE _GETCONF_MAX_FDS - OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_QUIET) + OUTPUT_VARIABLE _GETCONF_MAX_FDS + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET) if (NOT _GETCONF_MAX_FDS) - set(_GETCONF_MAX_FDS=512) + set(_GETCONF_MAX_FDS=512) endif () gkfs_define_variable( - GKFS_MAX_OPEN_FDS - ${_GETCONF_MAX_FDS} - STRING - "Maximum number of open file descriptors supported" - ADVANCED) + GKFS_MAX_OPEN_FDS + ${_GETCONF_MAX_FDS} + STRING + "Maximum number of open file descriptors supported" + ADVANCED) ## RocksDB support gkfs_define_option( - GKFS_ENABLE_ROCKSDB - HELP_TEXT "Enable RocksDB metadata backend" - DEFAULT_VALUE ON - DESCRIPTION "Use RocksDB key-value store for the metadata backend" + GKFS_ENABLE_ROCKSDB + HELP_TEXT "Enable RocksDB metadata backend" + DEFAULT_VALUE ON + DESCRIPTION "Use RocksDB key-value store for the metadata backend" ) ## Parallax support gkfs_define_option( - GKFS_ENABLE_PARALLAX - HELP_TEXT "Enable Parallax support" - DEFAULT_VALUE OFF - DESCRIPTION "Support using the Parallax key-value store in the metadata backend" + GKFS_ENABLE_PARALLAX + HELP_TEXT "Enable Parallax support" + DEFAULT_VALUE OFF + DESCRIPTION "Support using the Parallax key-value store in the metadata backend" ) ## Guided distribution gkfs_define_variable( - GKFS_USE_GUIDED_DISTRIBUTION_PATH - "/tmp/guided.txt" - STRING - "File Path for guided distributor" + GKFS_USE_GUIDED_DISTRIBUTION_PATH + "/tmp/guided.txt" + STRING + "File Path for guided distributor" ) gkfs_define_option( - GKFS_USE_GUIDED_DISTRIBUTION - HELP_TEXT "Use guided data distributor" - DEFAULT_VALUE OFF - DESCRIPTION "Use a guided data distribution instead of GekkoFS' wide striping" - EXTRA_INFO "Guided data distributor input file path: ${GKFS_USE_GUIDED_DISTRIBUTION_PATH}" + GKFS_USE_GUIDED_DISTRIBUTION + HELP_TEXT "Use guided data distributor" + DEFAULT_VALUE OFF + DESCRIPTION "Use a guided data distribution instead of GekkoFS' wide striping" + EXTRA_INFO "Guided data distributor input file path: ${GKFS_USE_GUIDED_DISTRIBUTION_PATH}" ) @@ -346,24 +346,24 @@ gkfs_define_option( ## Client logging support gkfs_define_option( - GKFS_ENABLE_CLIENT_LOG HELP_TEXT "Enable logging messages in clients" - DEFAULT_VALUE ON + GKFS_ENABLE_CLIENT_LOG HELP_TEXT "Enable logging messages in clients" + DEFAULT_VALUE ON ) gkfs_define_variable( - GKFS_CLIENT_LOG_MESSAGE_SIZE - 1024 - STRING - "Maximum size of a log message in the client library" - ADVANCED + GKFS_CLIENT_LOG_MESSAGE_SIZE + 1024 + STRING + "Maximum size of a log message in the client library" + ADVANCED ) ## Prometheus tracing support gkfs_define_option( - GKFS_ENABLE_PROMETHEUS - HELP_TEXT "Enable Prometheus Push" - DEFAULT_VALUE OFF - DESCRIPTION "Enable the collection of stats using Prometheus" + GKFS_ENABLE_PROMETHEUS + HELP_TEXT "Enable Prometheus Push" + DEFAULT_VALUE OFF + DESCRIPTION "Enable the collection of stats using Prometheus" ) @@ -373,10 +373,10 @@ gkfs_define_option( ## Scheduling in I/O forwarding mode gkfs_define_option( - GKFS_ENABLE_AGIOS - HELP_TEXT "Enable AGIOS scheduling library" - DEFAULT_VALUE OFF - DESCRIPTION "If GKFS_ENABLE_FORWARDING is ON, use AGIOS for scheduling I/Os" + GKFS_ENABLE_AGIOS + HELP_TEXT "Enable AGIOS scheduling library" + DEFAULT_VALUE OFF + DESCRIPTION "If GKFS_ENABLE_FORWARDING is ON, use AGIOS for scheduling I/Os" ) ################################################################################ diff --git a/CMake/gkfs-python-testing.cmake b/CMake/gkfs-python-testing.cmake index f0be7d2b5b30d80dd5e40dbc1beadebe18b00909..960e40b781dc6df0fd2261fd42315a3bf03a4bad 100644 --- a/CMake/gkfs-python-testing.cmake +++ b/CMake/gkfs-python-testing.cmake @@ -34,45 +34,45 @@ function(gkfs_enable_python_testing) cmake_parse_arguments(PYTEST "${OPTION}" "${SINGLE}" "${MULTI}" ${ARGN}) - if(PYTEST_UNPARSED_ARGUMENTS) + if (PYTEST_UNPARSED_ARGUMENTS) message(WARNING "Unparsed arguments in gkfs_enable_python_testing: This often indicates typos!") - endif() + endif () - if(PYTEST_BINARY_DIRECTORIES) + if (PYTEST_BINARY_DIRECTORIES) set(GKFS_PYTEST_BINARY_DIRECTORIES ${PYTEST_BINARY_DIRECTORIES} PARENT_SCOPE) - endif() + endif () - if(PYTEST_LIBRARY_PREFIX_DIRECTORIES) + if (PYTEST_LIBRARY_PREFIX_DIRECTORIES) set(GKFS_PYTEST_LIBRARY_PREFIX_DIRECTORIES ${PYTEST_LIBRARY_PREFIX_DIRECTORIES} PARENT_SCOPE) - endif() + endif () set(PYTEST_BINDIR_ARGS, "") - if(PYTEST_BINARY_DIRECTORIES) - foreach(dir IN LISTS PYTEST_BINARY_DIRECTORIES) + if (PYTEST_BINARY_DIRECTORIES) + foreach (dir IN LISTS PYTEST_BINARY_DIRECTORIES) list(APPEND PYTEST_BINDIR_ARGS "--bin-dir=${dir}") - endforeach() - endif() + endforeach () + endif () set(PYTEST_LIBDIR_ARGS, "") - if(PYTEST_LIBRARY_PREFIX_DIRECTORIES) - foreach(dir IN LISTS PYTEST_LIBRARY_PREFIX_DIRECTORIES) + if (PYTEST_LIBRARY_PREFIX_DIRECTORIES) + foreach (dir IN LISTS PYTEST_LIBRARY_PREFIX_DIRECTORIES) - if(NOT IS_ABSOLUTE ${dir}) + if (NOT IS_ABSOLUTE ${dir}) set(dir ${CMAKE_BINARY_DIR}/${dir}) - endif() + endif () file(TO_CMAKE_PATH "${dir}/lib" libdir) file(TO_CMAKE_PATH "${dir}/lib64" lib64dir) - if(EXISTS ${libdir}) + if (EXISTS ${libdir}) list(APPEND PYTEST_LIBDIR_ARGS "--lib-dir=${libdir}") - endif() + endif () - if(EXISTS ${lib64dir}) + if (EXISTS ${lib64dir}) list(APPEND PYTEST_LIBDIR_ARGS "--lib-dir=${lib64dir}") - endif() - endforeach() - endif() + endif () + endforeach () + endif () # convert path lists to space separated arguments string(REPLACE ";" " " PYTEST_BINDIR_ARGS "${PYTEST_BINDIR_ARGS}") @@ -82,7 +82,7 @@ function(gkfs_enable_python_testing) configure_file(conftest.py.in conftest.py @ONLY) configure_file(harness/cli.py harness/cli.py COPYONLY) - if(GKFS_INSTALL_TESTS) + if (GKFS_INSTALL_TESTS) configure_file(pytest.install.ini.in pytest.install.ini @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pytest.install.ini DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/gkfs/tests/integration @@ -93,9 +93,9 @@ function(gkfs_enable_python_testing) DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/gkfs/tests/integration ) - if(NOT PYTEST_VIRTUALENV) + if (NOT PYTEST_VIRTUALENV) set(PYTEST_VIRTUALENV ${CMAKE_INSTALL_FULL_DATAROOTDIR}/gkfs/tests/integration/pytest-venv) - endif() + endif () # Python's virtual environments are not relocatable, we need to # recreate the virtualenv at the appropriate install location @@ -105,9 +105,9 @@ function(gkfs_enable_python_testing) REQUIRED COMPONENTS Interpreter) - if(NOT Python3_FOUND) + if (NOT Python3_FOUND) message(FATAL_ERROR "Unable to find Python 3") - endif() + endif () install( CODE "message(\"Install pytest virtual environment...\")" @@ -147,7 +147,7 @@ function(gkfs_enable_python_testing) message(FATAL_ERROR \"Installation of pytest dependencies failed. Check 'cmake_install_stdout.log' and 'cmake_install_stderr.log' for details\") endif()" ) - endif() + endif () # enable testing set(GKFS_PYTHON_TESTING_ENABLED ON PARENT_SCOPE) @@ -156,9 +156,9 @@ endfunction() function(gkfs_add_python_test) # ignore call if testing is not enabled - if(NOT CMAKE_TESTING_ENABLED OR NOT GKFS_PYTHON_TESTING_ENABLED) + if (NOT CMAKE_TESTING_ENABLED OR NOT GKFS_PYTHON_TESTING_ENABLED) return() - endif() + endif () # Parse arguments set(OPTION) @@ -167,68 +167,68 @@ function(gkfs_add_python_test) cmake_parse_arguments(PYTEST "${OPTION}" "${SINGLE}" "${MULTI}" ${ARGN}) - if(PYTEST_UNPARSED_ARGUMENTS) + if (PYTEST_UNPARSED_ARGUMENTS) message(WARNING "Unparsed arguments in gkfs_add_python_test: This often indicates typos!") - endif() + endif () - if(NOT PYTEST_NAME) + if (NOT PYTEST_NAME) message(FATAL_ERROR "gkfs_add_python_test requires a NAME argument") - endif() + endif () # set default values for arguments not provided - if(NOT PYTEST_PYTHON_VERSION) + if (NOT PYTEST_PYTHON_VERSION) set(PYTEST_PYTHON_VERSION 3.0) - endif() + endif () - if(NOT PYTEST_WORKING_DIRECTORY) + if (NOT PYTEST_WORKING_DIRECTORY) set(PYTEST_WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - endif() + endif () - if(NOT PYTEST_VIRTUALENV) + if (NOT PYTEST_VIRTUALENV) set(PYTEST_VIRTUALENV ${CMAKE_CURRENT_BINARY_DIR}/pytest-venv) - endif() + endif () # if the test doesn't provide a list of binary or library prefix # directories, use the one set on gkfs_enable_python_testing() - if(NOT PYTEST_BINARY_DIRECTORIES) + if (NOT PYTEST_BINARY_DIRECTORIES) set(PYTEST_BINARY_DIRECTORIES ${GKFS_PYTEST_BINARY_DIRECTORIES}) - endif() + endif () - if(NOT PYTEST_LIBRARY_PREFIX_DIRECTORIES) + if (NOT PYTEST_LIBRARY_PREFIX_DIRECTORIES) set(PYTEST_LIBRARY_PREFIX_DIRECTORIES ${GKFS_PYTEST_LIBRARY_PREFIX_DIRECTORIES}) - endif() + endif () set(PYTEST_COMMAND_ARGS, "") - if(PYTEST_BINARY_DIRECTORIES) - foreach(dir IN LISTS PYTEST_BINARY_DIRECTORIES) + if (PYTEST_BINARY_DIRECTORIES) + foreach (dir IN LISTS PYTEST_BINARY_DIRECTORIES) list(APPEND PYTEST_COMMAND_ARGS "--bin-dir=${dir}") - endforeach() - endif() + endforeach () + endif () - if(PYTEST_LIBRARY_PREFIX_DIRECTORIES) - foreach(dir IN LISTS PYTEST_LIBRARY_PREFIX_DIRECTORIES) + if (PYTEST_LIBRARY_PREFIX_DIRECTORIES) + foreach (dir IN LISTS PYTEST_LIBRARY_PREFIX_DIRECTORIES) - if(NOT IS_ABSOLUTE ${dir}) + if (NOT IS_ABSOLUTE ${dir}) set(dir ${CMAKE_BINARY_DIR}/${dir}) - endif() + endif () file(TO_CMAKE_PATH "${dir}/lib" libdir) file(TO_CMAKE_PATH "${dir}/lib64" lib64dir) - if(EXISTS "${dir}/lib") + if (EXISTS "${dir}/lib") list(APPEND PYTEST_COMMAND_ARGS "--lib-dir=${libdir}") - endif() + endif () - if(EXISTS "${dir}/lib64") + if (EXISTS "${dir}/lib64") list(APPEND PYTEST_COMMAND_ARGS "--lib-dir=${lib64dir}") - endif() - endforeach() - endif() + endif () + endforeach () + endif () # Extend the given virtualenv to be a full path. - if(NOT IS_ABSOLUTE ${PYTEST_VIRTUALENV}) + if (NOT IS_ABSOLUTE ${PYTEST_VIRTUALENV}) set(PYTEST_VIRTUALENV ${CMAKE_BINARY_DIR}/${PYTEST_VIRTUALENV}) - endif() + endif () # find an appropriate python interpreter find_package(Python3 @@ -250,7 +250,7 @@ function(gkfs_add_python_test) COMMAND ${PYTEST_VIRTUALENV_PIP} install -r requirements.txt --upgrade -q ) - if(NOT TARGET venv) + if (NOT TARGET venv) # ensure that the virtual environment is created by the build process # (this is required because we can't add dependencies between # "test targets" and "normal targets" @@ -258,14 +258,14 @@ function(gkfs_add_python_test) ALL DEPENDS ${PYTEST_VIRTUALENV} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/requirements.txt) - endif() + endif () add_test(NAME ${PYTEST_NAME} - COMMAND ${PYTEST_VIRTUALENV_INTERPRETER} - -m pytest -v -s - ${PYTEST_COMMAND_ARGS} - ${PYTEST_SOURCE} - WORKING_DIRECTORY ${PYTEST_WORKING_DIRECTORY}) + COMMAND ${PYTEST_VIRTUALENV_INTERPRETER} + -m pytest -v -s + ${PYTEST_COMMAND_ARGS} + ${PYTEST_SOURCE} + WORKING_DIRECTORY ${PYTEST_WORKING_DIRECTORY}) # instruct Python to not create __pycache__ directories, # otherwise they will pollute ${PYTEST_WORKING_DIRECTORY} which diff --git a/CMake/gkfs-utils.cmake b/CMake/gkfs-utils.cmake index 2f70815eab71024861bd13d52afd72164f11bf4f..b7e010da42b60422284fe2746089cb3f82444af6 100644 --- a/CMake/gkfs-utils.cmake +++ b/CMake/gkfs-utils.cmake @@ -40,42 +40,42 @@ return all variables NOT MATCHING the provided ````. #]=======================================================================] function(get_cmake_variables OUTPUT_VARIABLE) - set(OPTIONS EXCLUDE) - set(SINGLE_VALUE REGEX) - set(MULTI_VALUE) # no multiple value args for now - - cmake_parse_arguments( - ARGS "${OPTIONS}" "${SINGLE_VALUE}" "${MULTI_VALUE}" ${ARGN} - ) - - if(ARGS_UNPARSED_ARGUMENTS) - message(WARNING "Unparsed arguments in get_cmake_variables(): " - "this often indicates typos!\n" - "Unparsed arguments: ${ARGS_UNPARSED_ARGUMENTS}" - ) - endif() + set(OPTIONS EXCLUDE) + set(SINGLE_VALUE REGEX) + set(MULTI_VALUE) # no multiple value args for now - get_cmake_property(_var_names VARIABLES) + cmake_parse_arguments( + ARGS "${OPTIONS}" "${SINGLE_VALUE}" "${MULTI_VALUE}" ${ARGN} + ) - if(NOT ARGS_REGEX) + if (ARGS_UNPARSED_ARGUMENTS) + message(WARNING "Unparsed arguments in get_cmake_variables(): " + "this often indicates typos!\n" + "Unparsed arguments: ${ARGS_UNPARSED_ARGUMENTS}" + ) + endif () + + get_cmake_property(_var_names VARIABLES) + + if (NOT ARGS_REGEX) + set(${OUTPUT_VARIABLE} + ${_var_names} + PARENT_SCOPE + ) + return() + endif () + + if (ARGS_EXCLUDE) + set(_mode EXCLUDE) + else () + set(_mode INCLUDE) + endif () + + list(FILTER _var_names ${_mode} REGEX ${ARGS_REGEX}) set(${OUTPUT_VARIABLE} ${_var_names} PARENT_SCOPE ) - return() - endif() - - if(ARGS_EXCLUDE) - set(_mode EXCLUDE) - else() - set(_mode INCLUDE) - endif() - - list(FILTER _var_names ${_mode} REGEX ${ARGS_REGEX}) - set(${OUTPUT_VARIABLE} - ${_var_names} - PARENT_SCOPE - ) endfunction() #[=======================================================================[.rst: @@ -89,30 +89,30 @@ the provided ````. #]=======================================================================] function(dump_cmake_variables) - set(OPTIONS EXCLUDE) - set(SINGLE_VALUE REGEX) - set(MULTI_VALUE) # no multiple value args for now - - cmake_parse_arguments( - ARGS "${OPTIONS}" "${SINGLE_VALUE}" "${MULTI_VALUE}" ${ARGN} - ) + set(OPTIONS EXCLUDE) + set(SINGLE_VALUE REGEX) + set(MULTI_VALUE) # no multiple value args for now - if(ARGS_UNPARSED_ARGUMENTS) - message(WARNING "Unparsed arguments in dump_cmake_variables(): " - "this often indicates typos!" - "Unparsed arguments: ${ARGS_UNPARSED_ARGUMENTS}" + cmake_parse_arguments( + ARGS "${OPTIONS}" "${SINGLE_VALUE}" "${MULTI_VALUE}" ${ARGN} ) - endif() - if(ARGS_EXCLUDE AND NOT ARGS_REGEX) - message(ERROR "EXCLUDE option doesn't make sense without REGEX.") - endif() + if (ARGS_UNPARSED_ARGUMENTS) + message(WARNING "Unparsed arguments in dump_cmake_variables(): " + "this often indicates typos!" + "Unparsed arguments: ${ARGS_UNPARSED_ARGUMENTS}" + ) + endif () - get_cmake_variables(_var_names REGEX ${ARGS_REGEX} ${ARGS_EXCLUDE}) + if (ARGS_EXCLUDE AND NOT ARGS_REGEX) + message(ERROR "EXCLUDE option doesn't make sense without REGEX.") + endif () - foreach(_var ${_var_names}) - message(STATUS "${_var}=${${_var}}") - endforeach() + get_cmake_variables(_var_names REGEX ${ARGS_REGEX} ${ARGS_EXCLUDE}) + + foreach (_var ${_var_names}) + message(STATUS "${_var}=${${_var}}") + endforeach () endfunction() #[=======================================================================[.rst: @@ -123,28 +123,28 @@ Mark all CMake variables matching ``regular_expression`` as advanced. #]=======================================================================] function(mark_variables_as_advanced) - set(OPTIONS) # no options for now - set(SINGLE_VALUE REGEX) - set(MULTI_VALUE) # no multiple value args for now - - cmake_parse_arguments( - ARGS "${OPTIONS}" "${SINGLE_VALUE}" "${MULTI_VALUE}" ${ARGN} - ) + set(OPTIONS) # no options for now + set(SINGLE_VALUE REGEX) + set(MULTI_VALUE) # no multiple value args for now - if(ARGS_UNPARSED_ARGUMENTS) - message(WARNING "Unparsed arguments in mark_variables_as_advanced(): " - "this often indicates typos!\n" - "Unparsed arguments: ${ARGS_UNPARSED_ARGUMENTS}" + cmake_parse_arguments( + ARGS "${OPTIONS}" "${SINGLE_VALUE}" "${MULTI_VALUE}" ${ARGN} ) - endif() - get_cmake_property(_var_names VARIABLES) + if (ARGS_UNPARSED_ARGUMENTS) + message(WARNING "Unparsed arguments in mark_variables_as_advanced(): " + "this often indicates typos!\n" + "Unparsed arguments: ${ARGS_UNPARSED_ARGUMENTS}" + ) + endif () - list(FILTER _var_names INCLUDE REGEX ${ARGS_REGEX}) + get_cmake_property(_var_names VARIABLES) - foreach(_var ${_var_names}) - mark_as_advanced(${_var}) - endforeach() + list(FILTER _var_names INCLUDE REGEX ${ARGS_REGEX}) + + foreach (_var ${_var_names}) + mark_as_advanced(${_var}) + endforeach () endfunction() @@ -195,56 +195,56 @@ populated and potentially added to the build by the time it returns. #]=======================================================================] function(include_from_source contentName) - set(OPTIONS) - set(SINGLE_VALUE MESSAGE SOURCE_DIR GIT_REPOSITORY GIT_TAG) - set(MULTI_VALUE) - - cmake_parse_arguments(ARGS "${OPTIONS}" "${SINGLE_VALUE}" "${MULTI_VALUE}" ${ARGN}) - - if(ARGS_MESSAGE) - message(STATUS ${ARGS_MESSAGE}) - endif() - - include(FetchContent) - - if (EXISTS ${ARGS_SOURCE_DIR}) - file(GLOB_RECURSE SOURCE_FILES "${ARGS_SOURCE_DIR}/*") - if(SOURCE_FILES STREQUAL "") - message(FATAL_ERROR - "The '${ARGS_SOURCE_DIR}' source directory appears " - "to be empty. If it corresponds to a git submodule it may not have " - "been properly initialized. Running:\n" - " 'git submodule update --init --recursive'\n" - "may fix the issue. If the directory corresponds to a manually " - "downloaded dependency, please download it again.") - endif() - - message(STATUS "Found source directory for '${contentName}'. Building.") - FetchContent_Declare( - ${contentName} - SOURCE_DIR ${ARGS_SOURCE_DIR} - ) - else() - message(STATUS - "Source directory for '${contentName}' not found.\n" - "Downloading and building from remote Git repository.") - - if(NOT ARGS_GIT_REPOSITORY) - message(FATAL_ERROR "GIT_REPOSITORY for \"${contentName}\" not defined") - endif() - - if(NOT ARGS_GIT_TAG) - message(FATAL_ERROR "GIT_TAG for \"${contentName}\" not defined") - endif() - - FetchContent_Declare( - ${contentName} - GIT_REPOSITORY ${ARGS_GIT_REPOSITORY} - GIT_TAG ${ARGS_GIT_TAG} - GIT_SHALLOW ON - GIT_PROGRESS ON - ) - endif() - - FetchContent_MakeAvailable(${contentName}) + set(OPTIONS) + set(SINGLE_VALUE MESSAGE SOURCE_DIR GIT_REPOSITORY GIT_TAG) + set(MULTI_VALUE) + + cmake_parse_arguments(ARGS "${OPTIONS}" "${SINGLE_VALUE}" "${MULTI_VALUE}" ${ARGN}) + + if (ARGS_MESSAGE) + message(STATUS ${ARGS_MESSAGE}) + endif () + + include(FetchContent) + + if (EXISTS ${ARGS_SOURCE_DIR}) + file(GLOB_RECURSE SOURCE_FILES "${ARGS_SOURCE_DIR}/*") + if (SOURCE_FILES STREQUAL "") + message(FATAL_ERROR + "The '${ARGS_SOURCE_DIR}' source directory appears " + "to be empty. If it corresponds to a git submodule it may not have " + "been properly initialized. Running:\n" + " 'git submodule update --init --recursive'\n" + "may fix the issue. If the directory corresponds to a manually " + "downloaded dependency, please download it again.") + endif () + + message(STATUS "Found source directory for '${contentName}'. Building.") + FetchContent_Declare( + ${contentName} + SOURCE_DIR ${ARGS_SOURCE_DIR} + ) + else () + message(STATUS + "Source directory for '${contentName}' not found.\n" + "Downloading and building from remote Git repository.") + + if (NOT ARGS_GIT_REPOSITORY) + message(FATAL_ERROR "GIT_REPOSITORY for \"${contentName}\" not defined") + endif () + + if (NOT ARGS_GIT_TAG) + message(FATAL_ERROR "GIT_TAG for \"${contentName}\" not defined") + endif () + + FetchContent_Declare( + ${contentName} + GIT_REPOSITORY ${ARGS_GIT_REPOSITORY} + GIT_TAG ${ARGS_GIT_TAG} + GIT_SHALLOW ON + GIT_PROGRESS ON + ) + endif () + + FetchContent_MakeAvailable(${contentName}) endfunction() diff --git a/README.md b/README.md index 6201fa9642b70350cc0f9149ab817d90d4df0bd2..631431f267764badee4cb1cd42e12d54b14f82f5 100644 --- a/README.md +++ b/README.md @@ -478,8 +478,7 @@ srun: sending Ctrl-C to StepId=282378.2 - `GKFS_MAX_INTERNAL_FDS` - Number of file descriptors reserved for internal use (default: 256) - `GKFS_MAX_OPEN_FDS` - Maximum number of open file descriptors supported (default: 1024) - `GKFS_RENAME_SUPPORT` - Enable support for rename (default: OFF) -- `GKFS_SYMLINK_SUPPORT` - Enable support for symlinks (default: ON) -- `GKFS_FOLLOW_EXTERNAL_SYMLINKS` - Enable support for following external links for resolving the path (default: OFF) +- `GKFS_FOLLOW_EXTERNAL_SYMLINKS` - Enable support for following external links into the GekkoFS namespace (default: OFF) - `GKFS_USE_LEGACY_PATH_RESOLVE` - Use the legacy implementation of the resolve function, deprecated (default: OFF) - `GKFS_USE_GUIDED_DISTRIBUTION` - Use guided data distributor (default: OFF) - `GKFS_USE_GUIDED_DISTRIBUTION_PATH` - File Path for guided distributor (default: /tmp/guided.txt) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a77ecbfe97ab4fcb34c6da34d21c0a3f47ee3685..08bb8099b9c86bf6fa17de2c7a95c555f4fb6530 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -55,14 +55,14 @@ add_executable(gkfs_test_lseek lseek.cpp) add_executable(gkfs_test_symlink symlink_test.cpp) find_package(MPI) -if(${MPI_FOUND}) +if (${MPI_FOUND}) set(SOURCE_FILES_MPI main_MPI.cpp) add_executable(gkfs_test_MPI ${SOURCE_FILES_MPI}) - if(TARGET MPI::MPI_CXX) + if (TARGET MPI::MPI_CXX) # should be defined for CMAKE > 3.9 target_link_libraries(gkfs_test_MPI MPI::MPI_CXX ${MPI_LIBRARIES}) - else() + else () target_link_libraries(gkfs_test_MPI ${MPI_CXX_LIBRARIES}) target_include_directories(gkfs_test_MPI PUBLIC ${MPI_CXX_INCLUDE_PATH}) - endif() -endif() \ No newline at end of file + endif () +endif () \ No newline at end of file diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 319e354095a7f89de3a1a568c75dba4d81605762..9a492fa4ecbbdb3d0b39b2e50e84d4399048051f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -28,16 +28,16 @@ include(gkfs-testing) -if(GKFS_GENERATE_COVERAGE_REPORTS) - gkfs_enable_coverage_reports(EXCLUDE_DIRECTORIES - "${FETCHCONTENT_BASE_DIR}/*" "${CMAKE_SOURCE_DIR}/external/*" ) -endif() +if (GKFS_GENERATE_COVERAGE_REPORTS) + gkfs_enable_coverage_reports(EXCLUDE_DIRECTORIES + "${FETCHCONTENT_BASE_DIR}/*" "${CMAKE_SOURCE_DIR}/external/*") +endif () add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} - --force-new-ctest-process - --verbose - --output-on-failure + --force-new-ctest-process + --verbose + --output-on-failure ) # integration tests diff --git a/tests/integration/CMakeLists.txt b/tests/integration/CMakeLists.txt index 0bccbd274b9837724b022dd35bd8537760275877..db55e302ae19409556822fb88455c602faa73553 100644 --- a/tests/integration/CMakeLists.txt +++ b/tests/integration/CMakeLists.txt @@ -32,44 +32,48 @@ add_subdirectory(harness) # Create daemon factories from template, depending of the databases unset(DBS) if (GKFS_ENABLE_ROCKSDB) - set (DBS "'gkfs_daemon_rocksdb'") -endif() + set(DBS "'gkfs_daemon_rocksdb'") +endif () if (GKFS_ENABLE_PARALLAX) if (DBS) - set (DBS "${DBS},'gkfs_daemon_parallaxdb'") - else() - set (DBS "'gkfs_daemon_parallaxdb'") - endif() -endif() + set(DBS "${DBS},'gkfs_daemon_parallaxdb'") + else () + set(DBS "'gkfs_daemon_parallaxdb'") + endif () +endif () if (GKFS_ENABLE_PARALLAX AND GKFS_ENABLE_ROCKSDB) - set (DBS "'gkfs_daemon_rocksdb','gkfs_daemon_parallaxdb'") -endif() + set(DBS "'gkfs_daemon_rocksdb','gkfs_daemon_parallaxdb'") +endif () # We enable rocksdb by default if (NOT DBS) - set (DBS "'gkfs_daemon_rocksdb'") -endif() + set(DBS "'gkfs_daemon_rocksdb'") +endif () -FIND_PATH(BUILD_PATH CMakeLists.txt . ) +FIND_PATH(BUILD_PATH CMakeLists.txt .) FILE(READ ${BUILD_PATH}/conftest.template CONF_TEST_FILE) -STRING(REGEX REPLACE "'gkfs_daemon_rocksdb'" "${DBS}" MOD_CONF_TEST_FILE "${CONF_TEST_FILE}" ) +STRING(REGEX REPLACE "'gkfs_daemon_rocksdb'" "${DBS}" MOD_CONF_TEST_FILE "${CONF_TEST_FILE}") FILE(WRITE ${BUILD_PATH}/conftest.py "${MOD_CONF_TEST_FILE}") gkfs_enable_python_testing( BINARY_DIRECTORIES ${CMAKE_BINARY_DIR}/src/daemon/ - ${CMAKE_BINARY_DIR}/src/client/ - ${CMAKE_BINARY_DIR}/tests/integration/harness/ - ${CMAKE_BINARY_DIR}/examples/gfind/ + ${CMAKE_BINARY_DIR}/src/client/ + ${CMAKE_BINARY_DIR}/tests/integration/harness/ + ${CMAKE_BINARY_DIR}/examples/gfind/ LIBRARY_PREFIX_DIRECTORIES ${CMAKE_PREFIX_PATH} ) # define CTest tests for functional test groups +set(DIRECTORY_TESTS "directories/test_directories.py;directories/test_pathresolution.py") +if (GKFS_FOLLOW_EXTERNAL_SYMLINKS) + set(DIRECTORY_TESTS "${DIRECTORY_TESTS}" ";directories/test_external_symlink.py") +endif () gkfs_add_python_test( NAME test_directories PYTHON_VERSION 3.6 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests/integration - SOURCE directories/ + SOURCE ${DIRECTORY_TESTS} ) if (GLIBC_HAS_STATX) @@ -79,7 +83,7 @@ if (GLIBC_HAS_STATX) WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests/integration SOURCE status/test_status.py ) -endif() +endif () gkfs_add_python_test( NAME test_operations @@ -89,13 +93,13 @@ gkfs_add_python_test( ) if (GLIBC_HAS_STATX) -gkfs_add_python_test( - NAME test_lseek - PYTHON_VERSION 3.6 - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests/integration - SOURCE position/test_lseek.py -) -endif() + gkfs_add_python_test( + NAME test_lseek + PYTHON_VERSION 3.6 + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests/integration + SOURCE position/test_lseek.py + ) +endif () gkfs_add_python_test( NAME test_shell @@ -105,12 +109,12 @@ gkfs_add_python_test( ) if (GKFS_TESTS_FORWARDING) -gkfs_add_python_test( - NAME forwarding - PYTHON_VERSION 3.6 - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests/integration - SOURCE forwarding/ -) + gkfs_add_python_test( + NAME forwarding + PYTHON_VERSION 3.6 + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests/integration + SOURCE forwarding/ + ) endif () gkfs_add_python_test( @@ -128,111 +132,111 @@ gkfs_add_python_test( ) if (GKFS_RENAME_SUPPORT) -gkfs_add_python_test( - NAME test_rename - PYTHON_VERSION 3.6 - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests/integration - SOURCE rename/ -) -endif() + gkfs_add_python_test( + NAME test_rename + PYTHON_VERSION 3.6 + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests/integration + SOURCE rename/ + ) +endif () -if(GKFS_INSTALL_TESTS) +if (GKFS_INSTALL_TESTS) install(DIRECTORY harness DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/gkfs/tests/integration FILES_MATCHING - REGEX ".*\\.py" - PATTERN "__pycache__" EXCLUDE - PATTERN ".pytest_cache" EXCLUDE - PATTERN "gkfs.io" EXCLUDE + REGEX ".*\\.py" + PATTERN "__pycache__" EXCLUDE + PATTERN ".pytest_cache" EXCLUDE + PATTERN "gkfs.io" EXCLUDE ) - if(GKFS_SYMLINK_SUPPORT) + if (GKFS_FOLLOW_EXTERNAL_SYMLINKS) install(DIRECTORY directories DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/gkfs/tests/integration FILES_MATCHING - REGEX ".*\\.py" - PATTERN "__pycache__" EXCLUDE - PATTERN ".pytest_cache" EXCLUDE + REGEX ".*\\.py" + PATTERN "__pycache__" EXCLUDE + PATTERN ".pytest_cache" EXCLUDE ) - else() + else () install(DIRECTORY directories - DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/gkfs/tests/integration - FILES_MATCHING - REGEX ".*\\.py" - PATTERN "__pycache__" EXCLUDE - PATTERN ".pytest_cache" EXCLUDE - PATTERN "test_symlink.py" EXCLUDE + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/gkfs/tests/integration + FILES_MATCHING + REGEX ".*\\.py" + PATTERN "__pycache__" EXCLUDE + PATTERN ".pytest_cache" EXCLUDE + PATTERN "test_external_symlink.py" EXCLUDE - ) - endif() + ) + endif () install(DIRECTORY status DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/gkfs/tests/integration FILES_MATCHING - REGEX ".*\\.py" - PATTERN "__pycache__" EXCLUDE - PATTERN ".pytest_cache" EXCLUDE + REGEX ".*\\.py" + PATTERN "__pycache__" EXCLUDE + PATTERN ".pytest_cache" EXCLUDE ) install(DIRECTORY operations DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/gkfs/tests/integration FILES_MATCHING - REGEX ".*\\.py" - PATTERN "__pycache__" EXCLUDE - PATTERN ".pytest_cache" EXCLUDE + REGEX ".*\\.py" + PATTERN "__pycache__" EXCLUDE + PATTERN ".pytest_cache" EXCLUDE ) install(DIRECTORY position DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/gkfs/tests/integration FILES_MATCHING - REGEX ".*\\.py" - PATTERN "__pycache__" EXCLUDE - PATTERN ".pytest_cache" EXCLUDE + REGEX ".*\\.py" + PATTERN "__pycache__" EXCLUDE + PATTERN ".pytest_cache" EXCLUDE ) install(DIRECTORY data DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/gkfs/tests/integration FILES_MATCHING - REGEX ".*\\.py" - PATTERN "__pycache__" EXCLUDE - PATTERN ".pytest_cache" EXCLUDE + REGEX ".*\\.py" + PATTERN "__pycache__" EXCLUDE + PATTERN ".pytest_cache" EXCLUDE ) install(DIRECTORY syscalls - DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/gkfs/tests/integration - FILES_MATCHING + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/gkfs/tests/integration + FILES_MATCHING REGEX ".*\\.py" PATTERN "__pycache__" EXCLUDE PATTERN ".pytest_cache" EXCLUDE -) + ) install(DIRECTORY shell DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/gkfs/tests/integration FILES_MATCHING - REGEX ".*\\.py" - PATTERN "__pycache__" EXCLUDE - PATTERN ".pytest_cache" EXCLUDE + REGEX ".*\\.py" + PATTERN "__pycache__" EXCLUDE + PATTERN ".pytest_cache" EXCLUDE ) if (GKFS_TESTS_FORWARDING) - install(DIRECTORY forwarding - DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/gkfs/tests/integration - FILES_MATCHING + install(DIRECTORY forwarding + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/gkfs/tests/integration + FILES_MATCHING REGEX ".*\\.py" PATTERN "__pycache__" EXCLUDE PATTERN ".pytest_cache" EXCLUDE - ) + ) endif () if (GKFS_RENAME_SUPPORT) - install(DIRECTORY rename - DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/gkfs/tests/integration - FILES_MATCHING + install(DIRECTORY rename + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/gkfs/tests/integration + FILES_MATCHING REGEX ".*\\.py" PATTERN "__pycache__" EXCLUDE PATTERN ".pytest_cache" EXCLUDE - ) - endif() -endif() + ) + endif () +endif () diff --git a/tests/integration/directories/test_symlink.py b/tests/integration/directories/test_external_symlink.py similarity index 98% rename from tests/integration/directories/test_symlink.py rename to tests/integration/directories/test_external_symlink.py index 03df2782ae31fdcbbd9e0a78936710932dbf7f65..a579c42e4a8c219d5d685e600c360cf9f15c2101 100644 --- a/tests/integration/directories/test_symlink.py +++ b/tests/integration/directories/test_external_symlink.py @@ -40,7 +40,7 @@ from harness.logger import logger nonexisting = "nonexisting" #@pytest.mark.xfail(reason="invalid errno returned on success") -def test_symlink(gkfs_daemon, gkfs_client): +def test_external_symlink(gkfs_daemon, gkfs_client): """Testing different path resolution capabilities: symlinks""" pid = os.getpid().__str__() mountdir = gkfs_daemon.mountdir diff --git a/tests/integration/harness/CMakeLists.txt b/tests/integration/harness/CMakeLists.txt index 03d73b6bf96bed9c2439fecae4568350eec7b912..efe58be15b64f05b616b6e93caff1d84ac5ee3f1 100644 --- a/tests/integration/harness/CMakeLists.txt +++ b/tests/integration/harness/CMakeLists.txt @@ -81,10 +81,10 @@ target_link_libraries(gkfs.io fmt::fmt CLI11::CLI11 std::filesystem - ) +) -if(GKFS_INSTALL_TESTS) +if (GKFS_INSTALL_TESTS) install(TARGETS gkfs.io DESTINATION ${CMAKE_INSTALL_BINDIR} ) -endif() +endif () diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt index c8ba51f0d2e5049093cf1fc0019fa39dbedbb977..210446e8bc32e8a5fb86ed1078a8bbbd78a3b314 100644 --- a/tests/unit/CMakeLists.txt +++ b/tests/unit/CMakeLists.txt @@ -35,7 +35,7 @@ FetchContent_Declare(catch2 GIT_TAG 216713a4066b79d9803d374f261ccb30c0fb451f # v2.13.8 GIT_SHALLOW ON GIT_PROGRESS ON - ) +) FetchContent_GetProperties(catch2) @@ -55,7 +55,7 @@ add_library(catch2_main STATIC) target_sources(catch2_main PRIVATE catch_main.cpp) target_link_libraries(catch2_main Catch2::Catch2 - ) +) # define executables for tests and make them depend on the convenience # library (and Catch2 transitively) and fmt @@ -66,9 +66,9 @@ target_sources(tests ${CMAKE_CURRENT_LIST_DIR}/test_path.cpp ${CMAKE_CURRENT_LIST_DIR}/test_helpers.cpp) -if(GKFS_TESTS_GUIDED_DISTRIBUTION) +if (GKFS_TESTS_GUIDED_DISTRIBUTION) target_sources(tests PRIVATE ${CMAKE_CURRENT_LIST_DIR}/test_guided_distributor.cpp) -endif() +endif () target_link_libraries(tests PRIVATE @@ -78,7 +78,7 @@ target_link_libraries(tests arithmetic distributor gkfs_user_lib - ) +) # Catch2's contrib folder includes some helper functions # to auto-discover Catch tests and register them in CTest @@ -86,10 +86,10 @@ set(CMAKE_MODULE_PATH "${catch2_SOURCE_DIR}/contrib" ${CMAKE_MODULE_PATH}) include(Catch) catch_discover_tests(tests PROPERTIES LABELS "unit::all" - ) +) if (GKFS_INSTALL_TESTS) install(TARGETS tests DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/gkfs/tests/unit - ) + ) endif () diff --git a/tests/unit/helpers/CMakeLists.txt b/tests/unit/helpers/CMakeLists.txt index d46c8282300c0023f2859f0b37cbd6f6544f3b62..fcfcf848049ed809de84aa8ecc88eee362adc16e 100644 --- a/tests/unit/helpers/CMakeLists.txt +++ b/tests/unit/helpers/CMakeLists.txt @@ -29,15 +29,15 @@ add_library(helpers STATIC) target_sources(helpers - PRIVATE + PRIVATE helpers.hpp random_string.cpp temporary_directory.cpp temporary_file.cpp - ) +) target_link_libraries(helpers - PUBLIC + PUBLIC fmt::fmt std::filesystem - ) +)