Unverified Commit dd51cf5b authored by Atkins, Charles Vernon's avatar Atkins, Charles Vernon Committed by GitHub
Browse files

Merge pull request #1082 from chuckatkins/fix-osx-fortran-rpath-problems

Fix osx fortran rpath problems
parents a2b1d75f e3461ced
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -126,6 +126,10 @@ if(ADIOS2_HAVE_MPI)
  add_definitions(-DOMPI_SKIP_MPICXX -DMPICH_SKIP_MPICXX)
endif()

# Various homebrew MPI fortran installations break rpath usage on OSX
if(APPLE AND ADIOS2_HAVE_Fortran AND ADIOS2_HAVE_MPI)
  set(CMAKE_MACOSX_RPATH OFF)
endif()

set(ADIOS2_CONFIG_OPTS
  BZip2 ZFP SZ MGARD MPI DataMan SST ZeroMQ HDF5 Python Fortran SysVShMem
+18 −23
Original line number Diff line number Diff line
@@ -63,6 +63,24 @@ cmake_dependent_option(BUILD_SHARED_LIBS
)
mark_as_advanced(BUILD_SHARED_LIBS)

# Setup PIC defaults.  If explicitly specified somehow, then default 
# to that.  Otherwise base the default on whether or not shared libs are even
# supported.
if(DEFINED EVPATH_ENABLE_PIC)
  set(EVPATH_ENABLE_PIC_DEFAULT ${EVPATH_ENABLE_PIC})
elseif(DEFINED CMAKE_POSITION_INDEPENDENT_CODE)
  set(EVPATH_ENABLE_PIC_DEFAULT ${CMAKE_POSITION_INDEPENDENT_CODE})
else()
  set(EVPATH_ENABLE_PIC_DEFAULT ${SHARED_LIBS_SUPPORTED})
endif()
cmake_dependent_option(EVPATH_ENABLE_PIC
  "Build with Position Independent Code" ${EVPATH_ENABLE_PIC_DEFAULT}
  "SHARED_LIBS_SUPPORTED" OFF
)
mark_as_advanced(EVPATH_ENABLE_PIC)
set(CMAKE_POSITION_INDEPENDENT_CODE ${EVPATH_ENABLE_PIC})
mark_as_advanced(CMAKE_POSITION_INDEPENDENT_CODE)

if(MSVC)
  # Force to always compile with W4
  if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
@@ -76,29 +94,6 @@ elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall ")
endif()

# use, i.e. don't skip the full RPATH for the build tree
set(CMAKE_SKIP_BUILD_RPATH  FALSE)

# when building, don't use the install RPATH already
# (but later on when installing)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) 

set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")

# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)


# the RPATH to be used when installing, but only if it's not a system directory
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
  "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
if(isSystemDir EQUAL -1)
  set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
endif()

set(CMAKE_MACOSX_RPATH 1)

add_library(EVPath
  cm.c cm_control.c cm_formats.c cm_util.c cm_transport.c 
  cm_lock.c cm_perf.c cm_pbio.c cm_interface.c version.c
+28 −44
Original line number Diff line number Diff line
@@ -4,63 +4,47 @@
#  LIBFABRIC_FOUND - System has libfabric
#  LIBFABRIC_INCLUDE_DIRS - The libfabric include directories
#  LIBFABRIC_LIBRARIES - The libraries needed to use libfabric
#  LIBFABRIC_DEFINITIONS - The extra CFLAGS needed to use libfabric

######################################################

# This is a bit of a wierd pattern but it allows to bypass pkg-config and
# manually specify library information
if(NOT (PC_LIBFABRIC_FOUND STREQUAL "IGNORE"))
  find_package(PkgConfig)
  if(PKG_CONFIG_FOUND)
    set(_CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH})
    if(LIBFABRIC_ROOT)
      list(INSERT CMAKE_PREFIX_PATH 0 "${LIBFABRIC_ROOT}")
    elseif(NOT ENV{LIBFABRIC_ROOT} STREQUAL "")
      list(INSERT CMAKE_PREFIX_PATH 0 "$ENV{LIBFABRIC_ROOT}")
set(LIBFABRIC_PREFIX "" CACHE STRING "Help cmake to find libfabric library (https://github.com/ofiwg/libfabric) into your system.")
mark_as_advanced(LIBFABRIC_PREFIX)
if(NOT LIBFABRIC_ROOT AND "$ENV{LIBFABRIC_ROOT}" STREQUAL "")
  set(LIBFABRIC_ROOT ${LIBFABRIC_PREFIX})
endif()
    set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH ON)

    pkg_check_modules(PC_LIBFABRIC libfabric)

    set(CMAKE_PREFIX_PATH ${_CMAKE_PREFIX_PATH})
unset(_CMAKE_PREFIX_PATH)

    if(PC_LIBFABRIC_FOUND)
      if(BUILD_SHARED_LIBS)
        set(_PC_TYPE)
if(POLICY CMP0074)
  cmake_policy(SET CMP0074 NEW)
else()
        set(_PF_TYPE _STATIC)
  if(NOT LIBFABRIC_ROOT)
    set(LIBFABRIC_ROOT "$ENV{LIBFABRIC_ROOT}")
  endif()
      set(LIBFABRIC_INCLUDE_DIRS ${PC_LIBFABRIC${_PC_TYPE}_INCLUDE_DIRS})
      set(LIBFABRIC_LIBRARIES ${PC_LIBFABRIC${_PC_TYPE}_LDFLAGS})
      set(LIBFABRIC_DEFINITIONS ${PC_LIBFABRIC${PC_TYPE}_CFLAGS_OTHER})
  if(LIBFABRIC_ROOT)
    set(_CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH})
    list(INSERT CMAKE_PREFIX_PATH 0 ${LIBFABRIC_ROOT})
  endif()
endif()

find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
  set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE)
  pkg_check_modules(LIBFABRIC IMPORTED_TARGET libfabric)
endif()

include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(LIBFABRIC DEFAULT_MSG LIBFABRIC_LIBRARIES)
if(_CMAKE_PREFIX_PATH)
  set(CMAKE_PREFIX_PATH ${_CMAKE_PREFIX_PATH})
  unset(_CMAKE_PREFIX_PATH)
endif()

if(LIBFABRIC_FOUND)
  if(NOT TARGET libfabric::libfabric)
    add_library(libfabric::libfabric INTERFACE IMPORTED)
    if(LIBFABRIC_INCLUDE_DIRS)
      set_target_properties(libfabric::libfabric PROPERTIES
        INTERFACE_INCLUDE_DIRECTORIES "${LIBFABRIC_INCLUDE_DIRS}"
      )
    endif()
    if(LIBFABRIC_DEFINITIONS)
    if(NOT BUILD_SHARED_LIBS AND TARGET PkgConfig::LIBFABRIC-static)
      set_target_properties(libfabric::libfabric PROPERTIES
        INTERFACE_COMPILE_OPTIONS     "${LIBFABRIC_DEFINITIONS}"
      )
    endif()
    if(LIBFABRIC_LIBRARIES)
        INTERFACE_LINK_LIBRARIES PkgConfig::LIBFABRIC-static)
    else()
      set_target_properties(libfabric::libfabric PROPERTIES
        INTERFACE_LINK_LIBRARIES      "${LIBFABRIC_LIBRARIES}"
      )
        INTERFACE_LINK_LIBRARIES PkgConfig::LIBFABRIC)
    endif()
  endif()
endif()
+11 −0
Original line number Diff line number Diff line
#------------------------------------------------------------------------------#
# Distributed under the OSI-approved Apache License, Version 2.0.  See
# accompanying file Copyright.txt for details.
#------------------------------------------------------------------------------#

# This module is already included in new versions of CMake
if(CMAKE_VERSION VERSION_LESS 3.12)
  include(${CMAKE_CURRENT_LIST_DIR}/upstream/FindPkgConfig.cmake)
else()
  include(${CMAKE_ROOT}/Modules/FindPkgConfig.cmake)
endif()
+732 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading