Loading .cmake-format +11 −11 Original line number Diff line number Diff line Loading @@ -36,14 +36,14 @@ with section("format"): # parenthesis on its own line. dangle_parens = True # If an argument group contains more than this many sub-groups (parg or kwarg # groups) then force it to a vertical layout. max_subgroups_hwrap = 2 # If a positional argument group contains more than this many arguments, then # force it to a vertical layout. max_pargs_hwrap = 2 # If a cmdline positional group consumes more than this many lines without # nesting, then invalidate the layout (and nest) max_rows_cmdline = 2 # # If an argument group contains more than this many sub-groups (parg or kwarg # # groups) then force it to a vertical layout. # max_subgroups_hwrap = 2 # # # If a positional argument group contains more than this many arguments, then # # force it to a vertical layout. # max_pargs_hwrap = 2 # # # If a cmdline positional group consumes more than this many lines without # # nesting, then invalidate the layout (and nest) # max_rows_cmdline = 2 CMakeLists.txt +22 −0 Original line number Diff line number Diff line Loading @@ -115,6 +115,28 @@ find_package( REQUIRED ) message(STATUS "[${PROJECT_NAME}] Checking for Mercury") find_package( Mercury 2.0.1 REQUIRED ) message(STATUS "[${PROJECT_NAME}] Checking for Argobots") find_package( Argobots 1.1 REQUIRED ) message(STATUS "[${PROJECT_NAME}] Checking for Margo") find_package( Margo 0.9.6 REQUIRED ) ### {fmt}: required for sensible output formatting message(STATUS "[${PROJECT_NAME}] Downloading and building {fmt}") FetchContent_Declare( Loading cmake/FindArgobots.cmake 0 → 100644 +209 −0 Original line number Diff line number Diff line ################################################################################ # Copyright 2021, Barcelona Supercomputing Center (BSC), Spain # # # # This software was partially supported by the EuroHPC-funded project ADMIRE # # (Project ID: 956748, https://www.admire-eurohpc.eu). # # # # This file is part of scord. # # # # scord is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation, either version 3 of the License, or # # (at your option) any later version. # # # # scord is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with scord. If not, see <https://www.gnu.org/licenses/>. # # # # SPDX-License-Identifier: GPL-3.0-or-later # ################################################################################ #[=======================================================================[.rst: FindArgobots --------- Find Argobots include dirs and libraries. Use this module by invoking find_package with the form:: find_package(Argobots [version] [EXACT] # Minimum or EXACT version e.g. 0.6.2 [REQUIRED] # Fail with error if Argobots is not found ) Imported Targets ^^^^^^^^^^^^^^^^ This module provides the following imported targets, if found: ``Argobots::Argobots`` The Argobots library Result Variables ^^^^^^^^^^^^^^^^ This will define the following variables: ``Argobots_FOUND`` True if the system has the Argobots library. ``Argobots_VERSION`` The version of the Argobots library which was found. ``Argobots_INCLUDE_DIRS`` Include directories needed to use Argobots. ``Argobots_LIBRARIES`` Libraries needed to link to Argobots. Cache Variables ^^^^^^^^^^^^^^^ The following cache variables may also be set: ``ARGOBOTS_INCLUDE_DIR`` The directory containing ``abt.h``. ``ARGOBOTS_LIBRARY`` The path to the Argobots library. #]=======================================================================] 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 ) 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" ) 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 ) 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() cmake/FindMargo.cmake 0 → 100644 +205 −0 Original line number Diff line number Diff line ################################################################################ # Copyright 2021, Barcelona Supercomputing Center (BSC), Spain # # # # This software was partially supported by the EuroHPC-funded project ADMIRE # # (Project ID: 956748, https://www.admire-eurohpc.eu). # # # # This file is part of scord. # # # # scord is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation, either version 3 of the License, or # # (at your option) any later version. # # # # scord is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with scord. If not, see <https://www.gnu.org/licenses/>. # # # # SPDX-License-Identifier: GPL-3.0-or-later # ################################################################################ #[=======================================================================[.rst: FindMargo --------- Find Margo include dirs and libraries. Use this module by invoking find_package with the form:: find_package(Margo [version] [EXACT] # Minimum or EXACT version e.g. 0.6.2 [REQUIRED] # Fail with error if Margo is not found ) Imported Targets ^^^^^^^^^^^^^^^^ This module provides the following imported targets, if found: ``Margo::Margo`` The Margo library Result Variables ^^^^^^^^^^^^^^^^ This will define the following variables: ``Margo_FOUND`` True if the system has the Margo library. ``Margo_VERSION`` The version of the Margo library which was found. ``Margo_INCLUDE_DIRS`` Include directories needed to use Margo. ``Margo_LIBRARIES`` Libraries needed to link to Margo. Cache Variables ^^^^^^^^^^^^^^^ The following cache variables may also be set: ``MARGO_INCLUDE_DIR`` The directory containing ``margo.h``. ``MARGO_LIBRARY`` The path to the Margo library. #]=======================================================================] 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 ) 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" ) 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 ) 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() cmake/FindMercury.cmake 0 → 100644 +272 −0 Original line number Diff line number Diff line ################################################################################ # Copyright 2021, Barcelona Supercomputing Center (BSC), Spain # # # # This software was partially supported by the EuroHPC-funded project ADMIRE # # (Project ID: 956748, https://www.admire-eurohpc.eu). # # # # This file is part of scord. # # # # scord is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation, either version 3 of the License, or # # (at your option) any later version. # # # # scord is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with scord. If not, see <https://www.gnu.org/licenses/>. # # # # SPDX-License-Identifier: GPL-3.0-or-later # ################################################################################ #[=======================================================================[.rst: FindMercury --------- Find Mercury include dirs and libraries. Use this module by invoking find_package with the form:: find_package(Mercury [version] [EXACT] # Minimum or EXACT version e.g. 0.6.2 [REQUIRED] # Fail with error if Mercury is not found ) Some variables one may set to control this module are:: Mercury_DEBUG - Set to ON to enable debug output from FindMercury. Imported Targets ^^^^^^^^^^^^^^^^ This module provides the following imported targets, if found: ``Mercury::Mercury`` The Mercury library Result Variables ^^^^^^^^^^^^^^^^ This will define the following variables: ``Mercury_FOUND`` True if the system has the Mercury library. ``Mercury_VERSION`` The version of the Mercury library which was found. ``Mercury_INCLUDE_DIRS`` Include directories needed to use Mercury. ``Mercury_LIBRARIES`` Libraries needed to link to Mercury. Cache Variables ^^^^^^^^^^^^^^^ The following cache variables may also be set: ``MERCURY_INCLUDE_DIR`` The directory containing ``mercury.h``. ``MERCURY_LIBRARY`` The path to the Mercury library. #]=======================================================================] # # Print debug text if Mercury_DEBUG is set. # Call example: # _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() 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}") 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}") 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}") endforeach() set_property(TARGET Mercury::${_component} APPEND PROPERTY INTERFACE_LINK_LIBRARIES ) mark_as_advanced(${_upper_component}_INCLUDE_DIR ${_upper_component}_LIBRARY) endmacro() ############################################################################### # Find Mercury headers and library ############################################################################### include(SelectLibraryConfigurations) set(_mercury_components na mchecksum mercury_util mercury_hl) # 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() 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 ) 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() 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}) set_target_properties(Mercury::Mercury PROPERTIES INTERFACE_LINK_LIBRARIES Mercury::${_component}) endforeach() endif() Loading
.cmake-format +11 −11 Original line number Diff line number Diff line Loading @@ -36,14 +36,14 @@ with section("format"): # parenthesis on its own line. dangle_parens = True # If an argument group contains more than this many sub-groups (parg or kwarg # groups) then force it to a vertical layout. max_subgroups_hwrap = 2 # If a positional argument group contains more than this many arguments, then # force it to a vertical layout. max_pargs_hwrap = 2 # If a cmdline positional group consumes more than this many lines without # nesting, then invalidate the layout (and nest) max_rows_cmdline = 2 # # If an argument group contains more than this many sub-groups (parg or kwarg # # groups) then force it to a vertical layout. # max_subgroups_hwrap = 2 # # # If a positional argument group contains more than this many arguments, then # # force it to a vertical layout. # max_pargs_hwrap = 2 # # # If a cmdline positional group consumes more than this many lines without # # nesting, then invalidate the layout (and nest) # max_rows_cmdline = 2
CMakeLists.txt +22 −0 Original line number Diff line number Diff line Loading @@ -115,6 +115,28 @@ find_package( REQUIRED ) message(STATUS "[${PROJECT_NAME}] Checking for Mercury") find_package( Mercury 2.0.1 REQUIRED ) message(STATUS "[${PROJECT_NAME}] Checking for Argobots") find_package( Argobots 1.1 REQUIRED ) message(STATUS "[${PROJECT_NAME}] Checking for Margo") find_package( Margo 0.9.6 REQUIRED ) ### {fmt}: required for sensible output formatting message(STATUS "[${PROJECT_NAME}] Downloading and building {fmt}") FetchContent_Declare( Loading
cmake/FindArgobots.cmake 0 → 100644 +209 −0 Original line number Diff line number Diff line ################################################################################ # Copyright 2021, Barcelona Supercomputing Center (BSC), Spain # # # # This software was partially supported by the EuroHPC-funded project ADMIRE # # (Project ID: 956748, https://www.admire-eurohpc.eu). # # # # This file is part of scord. # # # # scord is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation, either version 3 of the License, or # # (at your option) any later version. # # # # scord is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with scord. If not, see <https://www.gnu.org/licenses/>. # # # # SPDX-License-Identifier: GPL-3.0-or-later # ################################################################################ #[=======================================================================[.rst: FindArgobots --------- Find Argobots include dirs and libraries. Use this module by invoking find_package with the form:: find_package(Argobots [version] [EXACT] # Minimum or EXACT version e.g. 0.6.2 [REQUIRED] # Fail with error if Argobots is not found ) Imported Targets ^^^^^^^^^^^^^^^^ This module provides the following imported targets, if found: ``Argobots::Argobots`` The Argobots library Result Variables ^^^^^^^^^^^^^^^^ This will define the following variables: ``Argobots_FOUND`` True if the system has the Argobots library. ``Argobots_VERSION`` The version of the Argobots library which was found. ``Argobots_INCLUDE_DIRS`` Include directories needed to use Argobots. ``Argobots_LIBRARIES`` Libraries needed to link to Argobots. Cache Variables ^^^^^^^^^^^^^^^ The following cache variables may also be set: ``ARGOBOTS_INCLUDE_DIR`` The directory containing ``abt.h``. ``ARGOBOTS_LIBRARY`` The path to the Argobots library. #]=======================================================================] 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 ) 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" ) 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 ) 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()
cmake/FindMargo.cmake 0 → 100644 +205 −0 Original line number Diff line number Diff line ################################################################################ # Copyright 2021, Barcelona Supercomputing Center (BSC), Spain # # # # This software was partially supported by the EuroHPC-funded project ADMIRE # # (Project ID: 956748, https://www.admire-eurohpc.eu). # # # # This file is part of scord. # # # # scord is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation, either version 3 of the License, or # # (at your option) any later version. # # # # scord is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with scord. If not, see <https://www.gnu.org/licenses/>. # # # # SPDX-License-Identifier: GPL-3.0-or-later # ################################################################################ #[=======================================================================[.rst: FindMargo --------- Find Margo include dirs and libraries. Use this module by invoking find_package with the form:: find_package(Margo [version] [EXACT] # Minimum or EXACT version e.g. 0.6.2 [REQUIRED] # Fail with error if Margo is not found ) Imported Targets ^^^^^^^^^^^^^^^^ This module provides the following imported targets, if found: ``Margo::Margo`` The Margo library Result Variables ^^^^^^^^^^^^^^^^ This will define the following variables: ``Margo_FOUND`` True if the system has the Margo library. ``Margo_VERSION`` The version of the Margo library which was found. ``Margo_INCLUDE_DIRS`` Include directories needed to use Margo. ``Margo_LIBRARIES`` Libraries needed to link to Margo. Cache Variables ^^^^^^^^^^^^^^^ The following cache variables may also be set: ``MARGO_INCLUDE_DIR`` The directory containing ``margo.h``. ``MARGO_LIBRARY`` The path to the Margo library. #]=======================================================================] 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 ) 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" ) 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 ) 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()
cmake/FindMercury.cmake 0 → 100644 +272 −0 Original line number Diff line number Diff line ################################################################################ # Copyright 2021, Barcelona Supercomputing Center (BSC), Spain # # # # This software was partially supported by the EuroHPC-funded project ADMIRE # # (Project ID: 956748, https://www.admire-eurohpc.eu). # # # # This file is part of scord. # # # # scord is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation, either version 3 of the License, or # # (at your option) any later version. # # # # scord is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with scord. If not, see <https://www.gnu.org/licenses/>. # # # # SPDX-License-Identifier: GPL-3.0-or-later # ################################################################################ #[=======================================================================[.rst: FindMercury --------- Find Mercury include dirs and libraries. Use this module by invoking find_package with the form:: find_package(Mercury [version] [EXACT] # Minimum or EXACT version e.g. 0.6.2 [REQUIRED] # Fail with error if Mercury is not found ) Some variables one may set to control this module are:: Mercury_DEBUG - Set to ON to enable debug output from FindMercury. Imported Targets ^^^^^^^^^^^^^^^^ This module provides the following imported targets, if found: ``Mercury::Mercury`` The Mercury library Result Variables ^^^^^^^^^^^^^^^^ This will define the following variables: ``Mercury_FOUND`` True if the system has the Mercury library. ``Mercury_VERSION`` The version of the Mercury library which was found. ``Mercury_INCLUDE_DIRS`` Include directories needed to use Mercury. ``Mercury_LIBRARIES`` Libraries needed to link to Mercury. Cache Variables ^^^^^^^^^^^^^^^ The following cache variables may also be set: ``MERCURY_INCLUDE_DIR`` The directory containing ``mercury.h``. ``MERCURY_LIBRARY`` The path to the Mercury library. #]=======================================================================] # # Print debug text if Mercury_DEBUG is set. # Call example: # _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() 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}") 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}") 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}") endforeach() set_property(TARGET Mercury::${_component} APPEND PROPERTY INTERFACE_LINK_LIBRARIES ) mark_as_advanced(${_upper_component}_INCLUDE_DIR ${_upper_component}_LIBRARY) endmacro() ############################################################################### # Find Mercury headers and library ############################################################################### include(SelectLibraryConfigurations) set(_mercury_components na mchecksum mercury_util mercury_hl) # 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() 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 ) 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() 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}) set_target_properties(Mercury::Mercury PROPERTIES INTERFACE_LINK_LIBRARIES Mercury::${_component}) endforeach() endif()