Skip to content
Snippets Groups Projects
Commit e17afd73 authored by Podhorszki, Norbert's avatar Podhorszki, Norbert
Browse files

rename everything ADIOS to ADIOS1 in FindADIOS1.cmake

parent 4103536a
No related branches found
No related tags found
1 merge request!41ADIOS1 Write engine, Selections, Variable.SetSelection() and updated Heat Transfer example
# - Find ADIOS library, routines for scientific, parallel IO # - Find ADIOS 1.x library, routines for scientific, parallel IO
# https://www.olcf.ornl.gov/center-projects/adios/ # https://www.olcf.ornl.gov/center-projects/adios/
# #
# Use this module by invoking find_package with the form: # Use this module by invoking find_package with the form:
# find_package(ADIOS # find_package(ADIOS1
# [version] [EXACT] # Minimum or EXACT version, e.g. 1.6.0 # [version] [EXACT] # Minimum or EXACT version, e.g. 1.6.0
# [REQUIRED] # Fail with an error if ADIOS or a required # [REQUIRED] # Fail with an error if ADIOS or a required
# # component is not found # # component is not found
...@@ -11,46 +11,46 @@ ...@@ -11,46 +11,46 @@
# sequential (all are case insentative) # sequential (all are case insentative)
# ) # )
# #
# Module that finds the includes and libraries for a working ADIOS install. # Module that finds the includes and libraries for a working ADIOS 1.x install.
# This module invokes the `adios_config` script that should be installed with # This module invokes the `adios_config` script that should be installed with
# the other ADIOS tools. # the other ADIOS tools.
# #
# To provide a hint to the module where to find the ADIOS installation, # To provide a hint to the module where to find the ADIOS installation,
# set the ADIOS_ROOT environment variable. # set the ADIOS1_ROOT or ADIOS1_DIR environment variable.
# #
# If this variable is not set, make sure that at least the according `bin/` # If this variable is not set, make sure that at least the according `bin/`
# directory of ADIOS is in your PATH environment variable. # directory of ADIOS 1.x is in your PATH environment variable.
# #
# Set the following CMake variables BEFORE calling find_packages to # Set the following CMake variables BEFORE calling find_packages to
# influence this module: # influence this module:
# ADIOS_USE_STATIC_LIBS - Set to ON to force the use of static # ADIOS1_USE_STATIC_LIBS - Set to ON to force the use of static
# libraries. Default: OFF # libraries. Default: OFF
# #
# This module will define the following variables: # This module will define the following variables:
# ADIOS_INCLUDE_DIRS - Include directories for the ADIOS headers. # ADIOS1_INCLUDE_DIRS - Include directories for the ADIOS 1.x headers.
# ADIOS_LIBRARY_PATH - Full path of the libadios library (.a or .so file) # ADIOS1_LIBRARY_PATH - Full path of the libadios library (.a or .so file)
# ADIOS_DEPENDENCY_LIBRARIES - ADIOS dependency libraries. # ADIOS1_DEPENDENCY_LIBRARIES - ADIOS 1.x dependency libraries.
# ADIOS_FOUND - TRUE if FindADIOS found a working install # ADIOS1_FOUND - TRUE if FindADIOS1 found a working install
# ADIOS_VERSION - Version in format Major.Minor.Patch # ADIOS1_VERSION - Version in format Major.Minor.Patch
# #
# Not used for now: # Not used for now:
# ADIOS_DEFINITIONS - Compiler definitions you should add with # ADIOS1_DEFINITIONS - Compiler definitions you should add with
# add_definitions(${ADIOS_DEFINITIONS}) # add_definitions(${ADIOS1_DEFINITIONS})
# #
# Example to find ADIOS (default) # Example to find ADIOS 1.x (default)
# find_package(ADIOS) # find_package(ADIOS1)
# if(ADIOS_FOUND) # if(ADIOS1_FOUND)
# include_directories(${ADIOS_INCLUDE_DIRS}) # include_directories(${ADIOS1_INCLUDE_DIRS})
# add_executable(foo foo.c) # add_executable(foo foo.c)
# target_link_libraries(foo ${ADIOS_LIBRARY_PATH} ADIOS_DEPENDENCY_LIBRARIES) # target_link_libraries(foo ${ADIOS1_LIBRARY_PATH} ADIOS1_DEPENDENCY_LIBRARIES)
# endif() # endif()
# Example to find ADIOS using component # Example to find ADIOS 1.x using component
# find_package(ADIOS COMPONENTS fortran) # find_package(ADIOS1 COMPONENTS fortran)
# if(ADIOS_FOUND) # if(ADIOS1_FOUND)
# include_directories(${ADIOS_INCLUDE_DIRS}) # include_directories(${ADIOS1_INCLUDE_DIRS})
# add_executable(foo foo.c) # add_executable(foo foo.c)
# target_link_libraries(foo ${ADIOS_LIBRARY_PATH} ${ADIOS_DEPENDENCY_LIBRARIES}) # target_link_libraries(foo ${ADIOS1_LIBRARY_PATH} ${ADIOS1_DEPENDENCY_LIBRARIES})
# endif() # endif()
############################################################################### ###############################################################################
#Copyright (c) 2014, Axel Huebl and Felix Schmitt from http://picongpu.hzdr.de #Copyright (c) 2014, Axel Huebl and Felix Schmitt from http://picongpu.hzdr.de
...@@ -96,8 +96,8 @@ cmake_minimum_required(VERSION 2.8.5) ...@@ -96,8 +96,8 @@ cmake_minimum_required(VERSION 2.8.5)
# get flags for adios_config, -l is the default # get flags for adios_config, -l is the default
#-f for fortran, -r for readonly, -s for sequential (nompi) #-f for fortran, -r for readonly, -s for sequential (nompi)
set(OPTLIST "-l") set(OPTLIST "-l")
if(ADIOS_FIND_COMPONENTS) if(ADIOS1_FIND_COMPONENTS)
foreach(COMP ${ADIOS_FIND_COMPONENTS}) foreach(COMP ${ADIOS1_FIND_COMPONENTS})
string(TOLOWER ${COMP} comp) string(TOLOWER ${COMP} comp)
if(comp STREQUAL "fortran") if(comp STREQUAL "fortran")
set(OPTLIST "${OPTLIST}f") set(OPTLIST "${OPTLIST}f")
...@@ -106,102 +106,102 @@ if(ADIOS_FIND_COMPONENTS) ...@@ -106,102 +106,102 @@ if(ADIOS_FIND_COMPONENTS)
elseif(comp STREQUAL "sequential") elseif(comp STREQUAL "sequential")
set(OPTLIST "${OPTLIST}s") set(OPTLIST "${OPTLIST}s")
else() else()
message("ADIOS component ${COMP} is not supported. Please use fortran, readonly, or sequential") message("ADIOS 1.x component ${COMP} is not supported. Please use fortran, readonly, or sequential")
endif() endif()
endforeach() endforeach()
endif() endif()
# we start by assuming we found ADIOS and falsify it if some # we start by assuming we found ADIOS and falsify it if some
# dependencies are missing (or if we did not find ADIOS at all) # dependencies are missing (or if we did not find ADIOS at all)
set(ADIOS_FOUND TRUE) set(ADIOS1_FOUND TRUE)
# find `adios_config` program ################################################# # find `adios_config` program #################################################
# check the ADIOS_ROOT hint and the normal PATH # check the ADIOS1_ROOT and ADIOS1_DIR hint and the normal PATH
find_file(ADIOS_CONFIG find_file(ADIOS1_CONFIG
NAME adios_config NAME adios_config
PATHS $ENV{ADIOS_ROOT}/bin $ENV{ADIOS_DIR}/bin $ENV{INSTALL_PREFIX}/bin $ENV{PATH}) PATHS $ENV{ADIOS1_ROOT}/bin $ENV{ADIOS1_DIR}/bin $ENV{INSTALL_PREFIX}/bin $ENV{PATH})
if(ADIOS_CONFIG) if(ADIOS1_CONFIG)
message(STATUS "Found 'adios_config': ${ADIOS_CONFIG}") message(STATUS "Found 'adios_config': ${ADIOS1_CONFIG}")
else(ADIOS_CONFIG) else(ADIOS1_CONFIG)
set(ADIOS_FOUND FALSE) set(ADIOS1_FOUND FALSE)
message(STATUS "Can NOT find 'adios_config' - set ADIOS_ROOT, ADIOS_DIR or INSTALL_PREFIX, or check your PATH") message(STATUS "Can NOT find 'adios_config' - set ADIOS1_ROOT, ADIOS1_DIR or INSTALL_PREFIX, or check your PATH")
endif(ADIOS_CONFIG) endif(ADIOS1_CONFIG)
# check `adios_config` program ################################################ # check `adios_config` program ################################################
if(ADIOS_FOUND) if(ADIOS1_FOUND)
execute_process(COMMAND ${ADIOS_CONFIG} ${OPTLIST} execute_process(COMMAND ${ADIOS1_CONFIG} ${OPTLIST}
OUTPUT_VARIABLE ADIOS_LINKFLAGS OUTPUT_VARIABLE ADIOS1_LINKFLAGS
RESULT_VARIABLE ADIOS_CONFIG_RETURN RESULT_VARIABLE ADIOS1_CONFIG_RETURN
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT ADIOS_CONFIG_RETURN EQUAL 0) if(NOT ADIOS1_CONFIG_RETURN EQUAL 0)
set(ADIOS_FOUND FALSE) set(ADIOS1_FOUND FALSE)
message(STATUS "Can NOT execute 'adios_config' - check file permissions") message(STATUS "Can NOT execute 'adios_config' - check file permissions")
endif() endif()
# find ADIOS_ROOT_DIR # find ADIOS1_ROOT_DIR
execute_process(COMMAND ${ADIOS_CONFIG} -d execute_process(COMMAND ${ADIOS1_CONFIG} -d
OUTPUT_VARIABLE ADIOS_ROOT_DIR OUTPUT_VARIABLE ADIOS1_ROOT_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT IS_DIRECTORY "${ADIOS_ROOT_DIR}") if(NOT IS_DIRECTORY "${ADIOS1_ROOT_DIR}")
set(ADIOS_FOUND FALSE) set(ADIOS1_FOUND FALSE)
message(STATUS "The directory provided by 'adios_config -d' does not exist: ${ADIOS_ROOT_DIR}") message(STATUS "The directory provided by 'adios_config -d' does not exist: ${ADIOS1_ROOT_DIR}")
endif() endif()
endif(ADIOS_FOUND) endif(ADIOS1_FOUND)
# option: use only static libs ################################################ # option: use only static libs ################################################
if(ADIOS_USE_STATIC_LIBS) if(ADIOS1_USE_STATIC_LIBS)
# carfully: we have to restore the original path in the end # carfully: we have to restore the original path in the end
set(_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) set(_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(CMAKE_FIND_LIBRARY_SUFFIXES .a) set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
endif() endif()
# we found something in ADIOS_ROOT_DIR and adios_config works ################# # we found something in ADIOS1_ROOT_DIR and adios_config works #################
if(ADIOS_FOUND) if(ADIOS1_FOUND)
# ADIOS headers # ADIOS headers
list(APPEND ADIOS_INCLUDE_DIRS ${ADIOS_ROOT_DIR}/include) list(APPEND ADIOS1_INCLUDE_DIRS ${ADIOS1_ROOT_DIR}/include)
# check for compiled in dependencies, recomve ";" in ADIOS_LINKFLAGS (from cmake build) # check for compiled in dependencies, recomve ";" in ADIOS1_LINKFLAGS (from cmake build)
string(REGEX REPLACE ";" " " ADIOS_LINKFLAGS "${ADIOS_LINKFLAGS}") string(REGEX REPLACE ";" " " ADIOS1_LINKFLAGS "${ADIOS1_LINKFLAGS}")
message(STATUS "ADIOS linker flags (unparsed): ${ADIOS_LINKFLAGS}") message(STATUS " ADIOS1 linker flags (unparsed): ${ADIOS1_LINKFLAGS}")
# find all library paths -L # find all library paths -L
# note: this can cause trouble if some libs are specified twice from # note: this can cause trouble if some libs are specified twice from
# different sources (quite unlikely) # different sources (quite unlikely)
# http://www.cmake.org/pipermail/cmake/2008-November/025128.html # http://www.cmake.org/pipermail/cmake/2008-November/025128.html
set(ADIOS_LIBRARY_DIRS "") set(ADIOS1_LIBRARY_DIRS "")
string(REGEX MATCHALL " -L([A-Za-z_0-9/\\.-]+)" _ADIOS_LIBDIRS " ${ADIOS_LINKFLAGS}") string(REGEX MATCHALL " -L([A-Za-z_0-9/\\.-]+)" _ADIOS1_LIBDIRS " ${ADIOS1_LINKFLAGS}")
foreach(_LIBDIR ${_ADIOS_LIBDIRS}) foreach(_LIBDIR ${_ADIOS1_LIBDIRS})
string(REPLACE " -L" "" _LIBDIR ${_LIBDIR}) string(REPLACE " -L" "" _LIBDIR ${_LIBDIR})
list(APPEND ADIOS_LIBRARY_DIRS ${_LIBDIR}) list(APPEND ADIOS1_LIBRARY_DIRS ${_LIBDIR})
endforeach() endforeach()
# we could append ${CMAKE_PREFIX_PATH} now but that is not really necessary # we could append ${CMAKE_PREFIX_PATH} now but that is not really necessary
#message(STATUS "ADIOS DIRS to look for libs: ${ADIOS_LIBRARY_DIRS}") #message(STATUS "ADIOS1 DIRS to look for libs: ${ADIOS1_LIBRARY_DIRS}")
# parse all -lname libraries and find an absolute path for them # parse all -lname libraries and find an absolute path for them
string(REGEX MATCHALL " -l([A-Za-z_0-9\\.-]+)" _ADIOS_LIBS " ${ADIOS_LINKFLAGS}") string(REGEX MATCHALL " -l([A-Za-z_0-9\\.-]+)" _ADIOS1_LIBS " ${ADIOS1_LINKFLAGS}")
foreach(_LIB ${_ADIOS_LIBS}) foreach(_LIB ${_ADIOS1_LIBS})
string(REPLACE " -l" "" _LIB ${_LIB}) string(REPLACE " -l" "" _LIB ${_LIB})
# find static lib: absolute path in -L then default # find static lib: absolute path in -L then default
find_library(_LIB_DIR NAMES ${_LIB} PATHS ${ADIOS_LIBRARY_DIRS} CMAKE_FIND_ROOT_PATH_BOTH) find_library(_LIB_DIR NAMES ${_LIB} PATHS ${ADIOS1_LIBRARY_DIRS} CMAKE_FIND_ROOT_PATH_BOTH)
# found? # found?
if(_LIB_DIR) if(_LIB_DIR)
message(STATUS "Found ${_LIB} in ${_LIB_DIR}")
if(_LIB STREQUAL "adios") if(_LIB STREQUAL "adios")
message(STATUS " Found the adios main lib as ${_LIB_DIR}") message(STATUS " Found the main adios library in ${_LIB_DIR}")
set(ADIOS_LIBRARY_PATH "${_LIB_DIR}") set(ADIOS1_LIBRARY_PATH "${_LIB_DIR}")
message(STATUS " ADIOS_LIBRARY_PATH set to ${ADIOS_LIBRARY_PATH}") #message(STATUS " ADIOS1_LIBRARY_PATH set to ${ADIOS1_LIBRARY_PATH}")
else() else()
list(APPEND ADIOS_DEPENDENCY_LIBRARIES "${_LIB_DIR}") message(STATUS " Found ${_LIB} in ${_LIB_DIR}")
list(APPEND ADIOS1_DEPENDENCY_LIBRARIES "${_LIB_DIR}")
endif() endif()
else(_LIB_DIR) else(_LIB_DIR)
set(ADIOS_FOUND FALSE) set(ADIOS1_FOUND FALSE)
message(STATUS "ADIOS: Could NOT find library '${_LIB}'") message(STATUS "ADIOS1: Could NOT find library '${_LIB}'")
endif(_LIB_DIR) endif(_LIB_DIR)
# clean cached var # clean cached var
...@@ -210,26 +210,26 @@ if(ADIOS_FOUND) ...@@ -210,26 +210,26 @@ if(ADIOS_FOUND)
endforeach() endforeach()
#add libraries which are already using cmake format #add libraries which are already using cmake format
string(REGEX MATCHALL "/([A-Za-z_0-9/\\.-]+)\\.([a|so]+)" _ADIOS_LIBS_SUB "${ADIOS_LINKFLAGS}") string(REGEX MATCHALL "/([A-Za-z_0-9/\\.-]+)\\.([a|so]+)" _ADIOS1_LIBS_SUB "${ADIOS1_LINKFLAGS}")
list(APPEND ADIOS_DEPENDENCY_LIBRARIES "${_ADIOS_LIBS_SUB}") list(APPEND ADIOS1_DEPENDENCY_LIBRARIES "${_ADIOS1_LIBS_SUB}")
# add the version string # add the version string
execute_process(COMMAND ${ADIOS_CONFIG} -v execute_process(COMMAND ${ADIOS1_CONFIG} -v
OUTPUT_VARIABLE ADIOS_VERSION OUTPUT_VARIABLE ADIOS1_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE)
endif(ADIOS_FOUND) endif(ADIOS1_FOUND)
# unset checked variables if not found # unset checked variables if not found
if(NOT ADIOS_FOUND) if(NOT ADIOS1_FOUND)
unset(ADIOS_INCLUDE_DIRS) unset(ADIOS1_INCLUDE_DIRS)
unset(ADIOS_DEPENDENCY_LIBRARIES) unset(ADIOS1_DEPENDENCY_LIBRARIES)
unset(ADIOS_LIBRARY_PATH) unset(ADIOS1_LIBRARY_PATH)
endif(NOT ADIOS_FOUND) endif(NOT ADIOS1_FOUND)
# restore CMAKE_FIND_LIBRARY_SUFFIXES if manipulated by this module ########### # restore CMAKE_FIND_LIBRARY_SUFFIXES if manipulated by this module ###########
if(ADIOS_USE_STATIC_LIBS) if(ADIOS1_USE_STATIC_LIBS)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) set(CMAKE_FIND_LIBRARY_SUFFIXES ${_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
endif() endif()
...@@ -240,21 +240,21 @@ endif() ...@@ -240,21 +240,21 @@ endif()
# handles the REQUIRED, QUIET and version-related arguments for find_package # handles the REQUIRED, QUIET and version-related arguments for find_package
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ADIOS find_package_handle_standard_args(ADIOS1
REQUIRED_VARS ADIOS_LIBRARY_PATH ADIOS_DEPENDENCY_LIBRARIES ADIOS_INCLUDE_DIRS REQUIRED_VARS ADIOS1_LIBRARY_PATH ADIOS1_DEPENDENCY_LIBRARIES ADIOS1_INCLUDE_DIRS
VERSION_VAR ADIOS_VERSION VERSION_VAR ADIOS1_VERSION
) )
########################################################################## ##########################################################################
# Add target and dependencies to ADIOS2 # Add target and dependencies to ADIOS2
########################################################################## ##########################################################################
message(STATUS "ADIOS1 Find ended with ${ADIOS_FOUND}") #message(STATUS "ADIOS1 Find ended with ${ADIOS1_FOUND}")
if(ADIOS_FOUND AND NOT TARGET adios1::adios) if(ADIOS1_FOUND AND NOT TARGET adios1::adios)
message(STATUS "Add library ADIOS1 to the build") message(STATUS "Add library ADIOS1 to the build")
add_library(adios1::adios UNKNOWN IMPORTED) add_library(adios1::adios UNKNOWN IMPORTED)
set_target_properties(adios1::adios PROPERTIES set_target_properties(adios1::adios PROPERTIES
IMPORTED_LOCATION "${ADIOS_LIBRARY_PATH}" IMPORTED_LOCATION "${ADIOS1_LIBRARY_PATH}"
INTERFACE_LINK_LIBRARIES "${ADIOS_DEPENDENCY_LIBRARIES}" INTERFACE_LINK_LIBRARIES "${ADIOS1_DEPENDENCY_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${ADIOS_INCLUDE_DIRS}" INTERFACE_INCLUDE_DIRECTORIES "${ADIOS1_INCLUDE_DIRS}"
) )
endif() endif()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment