vcpkg/ports/clapack/FindLAPACK.cmake
Stefano Sinigardi 5898891125 [openexr,openimageio,suitesparse,theia] updates for non-win32 (#6371)
* [openexr,openimageio,suitesparse,theia] updates for non-win32

* [theia] use only valid cmake symbols

* [suitesparse] Fix build

* [lapack] still not properly integrating with other ports

* [lapack] intercept cmake module calls and substitute them with our defs

* [suitesparse,clapack] fixes for proper integration

* [ceres,clapack] bump CONTROL

* [suitesparse] remove unnecessary defs

* [clapack] improve wrapper logic

* [WIN32] remove wrong symbol

* [clapack] fix wrapper integration

* [Accelerate] use best framework when available

* [clapack] separate config from wrapper

* [clapack] fix paths and filenames

* [mlpack,armadillo,clapack] improve library handling

* [mlpack] remove unnecessary cmake option

* [clp,coinutils,osi,liblemon] dependencies of openmvg, improve compatibility with non-win32

* [openmvg] fix for case-sensitive filesystems

* [clp,coinutils,osi] simplify CMakeLists removing many unnecessary steps

* [sophus] Force rebuild

* [theia] fixes for linux, part1

* [io2d] remove broken sintax

* [fontconfig] bump version to remove CI cached failure

* [theia] fixes for linux, part2

* [theia] remove unnecessary empty folders and comments from portfile

* [theia] use correct build type removing forced vars in cmakelists.txt

* [openmvg] add missing suitesparse target detection

* [sophus] fix Suitesparse dependency

* [sophus,openmvg] use suitesparse lowercase for module compatibility on case-sensitive filesystems

* [suitesparse] fixes for case-sensitive filesystems

* [openmvg] use correct Eigen3 name for case-sensitive filesystems

* [sophus] trigger rebuild

* [shogun] use modern vcpkg style

* [shogun] add missing cmake system processor symbol
2019-05-31 15:48:17 -07:00

199 lines
7.1 KiB
CMake

#.rst:
# clapack config for vcpkg
# ------------
#
# Find the clapack includes and library.
#
# Result Variables
# ^^^^^^^^^^^^^^^^
#
# This script defines the following variables:
#
# ``CLAPACK_FOUND``
# True if clapack library found
#
# ``CLAPACK_VERSION``
# Containing the clapack version tag (manually defined)
#
# ``CLAPACK_INCLUDE_DIR``
# Location of clapack headers
#
# ``CLAPACK_LIBRARY``
# List of libraries to link with when using clapack
#
# Result Targets
# ^^^^^^^^^^^^^^
#
# This script defines the following targets:
#
# ``clapack::clapack``
# Target to use clapack
#
# Compatibility Variables
# ^^^^^^^^^^^^^^^^^^^^^^^
#
# This script defines the following variables for compatibility reasons:
#
# ``F2C_FOUND``
# True if f2c (fortran-to-c wrap layer) library found
#
# ``F2C_INCLUDE_DIR``
# Location of clapack headers
#
# ``F2C_LIBRARY``
# Library containing the fortran-to-c wrap layer, necessary for clapack and automatically included when used
#
# ``LAPACK_FOUND``
# True if clapack library found
#
# ``LAPACK_VERSION``
# Containing the clapack version tag (manually defined)
#
# ``LAPACK_INCLUDE_DIR``
# Location of clapack headers
#
# ``LAPACK_LIBRARY``
# List of libraries to link with when using clapack
#
# Compatibility Targets
# ^^^^^^^^^^^^^^
#
# This script defines the following targets for compatibility reasons:
#
# ``lapack``
# Target to use lapack
include(${CMAKE_ROOT}/Modules/SelectLibraryConfigurations.cmake)
include(${CMAKE_ROOT}/Modules/CheckSymbolExists.cmake)
include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
set(CLAPACK_VERSION "3.2.1")
if(UNIX)
find_library(ADDITIONAL_LAPACK_LIBRARY m)
endif()
if(NOT F2C_LIBRARY)
find_library(F2C_LIBRARY_RELEASE NAMES f2c libf2c)
find_library(F2C_LIBRARY_DEBUG NAMES f2cd libf2cd)
list(APPEND F2C_LIBRARY_RELEASE ${ADDITIONAL_LAPACK_LIBRARY})
list(APPEND F2C_LIBRARY_DEBUG ${ADDITIONAL_LAPACK_LIBRARY})
select_library_configurations(F2C)
endif()
find_package(BLAS)
if(NOT LAPACK_LIBRARY)
find_library(LAPACK_LIBRARY_RELEASE NAMES lapack)
find_library(LAPACK_LIBRARY_DEBUG NAMES lapackd)
list(APPEND LAPACK_LIBRARY_RELEASE ${F2C_LIBRARY_RELEASE})
list(APPEND LAPACK_LIBRARY_DEBUG ${F2C_LIBRARY_DEBUG})
select_library_configurations(LAPACK)
endif()
list(APPEND LAPACK_LIBRARY ${BLAS_LIBRARIES})
set(F2C_LIBRARIES "${F2C_LIBRARY}" CACHE STRING "" FORCE)
set(LAPACK_VERSION "${CLAPACK_VERSION}" CACHE STRING "" FORCE)
set(LAPACK_LIBRARIES "${LAPACK_LIBRARY}" CACHE STRING "" FORCE)
set(CLAPACK_LIBRARY "${LAPACK_LIBRARY}" CACHE STRING "" FORCE)
set(CLAPACK_LIBRARIES "${LAPACK_LIBRARY}" CACHE STRING "" FORCE)
if(NOT F2C_INCLUDE_DIR)
find_path(F2C_INCLUDE_DIR NAMES f2c.h)
endif()
if(NOT LAPACK_INCLUDE_DIR)
find_path(LAPACK_INCLUDE_DIR NAMES clapack.h)
endif()
list(APPEND LAPACK_INCLUDE_DIR ${F2C_INCLUDE_DIR})
set(LAPACK_INCLUDE_DIRS "${LAPACK_INCLUDE_DIR}" CACHE PATH "" FORCE)
set(CLAPACK_INCLUDE_DIR "${LAPACK_INCLUDE_DIR}" CACHE PATH "" FORCE)
set(CLAPACK_INCLUDE_DIRS "${LAPACK_INCLUDE_DIR}" CACHE PATH "" FORCE)
set(F2C_INCLUDE_DIRS "${F2C_INCLUDE_DIR}" CACHE PATH "" FORCE)
if(WIN32)
string( REPLACE ".lib" ".dll" LAPACK_LIBRARY_RELEASE_DLL "${LAPACK_LIBRARY_RELEASE}" )
string( REPLACE ".lib" ".dll" LAPACK_LIBRARY_DEBUG_DLL "${LAPACK_LIBRARY_DEBUG}" )
string( REPLACE ".lib" ".dll" F2C_LIBRARY_RELEASE_DLL "${F2C_LIBRARY_RELEASE}" )
string( REPLACE ".lib" ".dll" F2C_LIBRARY_DEBUG_DLL "${F2C_LIBRARY_DEBUG}" )
endif()
find_package_handle_standard_args(CLAPACK DEFAULT_MSG CLAPACK_LIBRARY CLAPACK_INCLUDE_DIR)
mark_as_advanced(CLAPACK_INCLUDE_DIR CLAPACK_LIBRARY)
find_package_handle_standard_args(LAPACK DEFAULT_MSG LAPACK_LIBRARY LAPACK_INCLUDE_DIR)
mark_as_advanced(LAPACK_INCLUDE_DIR LAPACK_LIBRARY)
find_package_handle_standard_args(F2C DEFAULT_MSG F2C_LIBRARY F2C_INCLUDE_DIR)
mark_as_advanced(F2C_INCLUDE_DIR F2C_LIBRARY)
#TARGETS
if( CLAPACK_FOUND AND NOT TARGET clapack::clapack )
if( EXISTS "${LAPACK_LIBRARY_RELEASE_DLL}" )
add_library( clapack::clapack SHARED IMPORTED )
set_target_properties( clapack::clapack PROPERTIES
IMPORTED_LOCATION_RELEASE "${LAPACK_LIBRARY_RELEASE_DLL}"
IMPORTED_IMPLIB "${LAPACK_LIBRARY_RELEASE}"
INTERFACE_INCLUDE_DIRECTORIES "${LAPACK_INCLUDE_DIR}"
IMPORTED_CONFIGURATIONS Release
IMPORTED_LINK_INTERFACE_LANGUAGES "C" )
if( EXISTS "${LAPACK_LIBRARY_DEBUG_DLL}" )
set_property( TARGET clapack::clapack APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
set_target_properties( clapack::clapack PROPERTIES
IMPORTED_LOCATION_DEBUG "${LAPACK_LIBRARY_DEBUG_DLL}"
IMPORTED_IMPLIB_DEBUG "${LAPACK_LIBRARY_DEBUG}" )
endif()
else()
add_library( clapack::clapack UNKNOWN IMPORTED )
set_target_properties( clapack::clapack PROPERTIES
IMPORTED_LOCATION_RELEASE "${LAPACK_LIBRARY_RELEASE}"
INTERFACE_INCLUDE_DIRECTORIES "${LAPACK_INCLUDE_DIR}"
IMPORTED_CONFIGURATIONS Release
IMPORTED_LINK_INTERFACE_LANGUAGES "C" )
if( EXISTS "${LAPACK_LIBRARY_DEBUG}" )
set_property( TARGET clapack::clapack APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
set_target_properties( clapack::clapack PROPERTIES
IMPORTED_LOCATION_DEBUG "${LAPACK_LIBRARY_DEBUG}" )
endif()
endif()
endif()
if( CLAPACK_FOUND AND NOT TARGET lapack )
if( EXISTS "${LAPACK_LIBRARY_RELEASE_DLL}" )
add_library( lapack SHARED IMPORTED )
set_target_properties( lapack PROPERTIES
IMPORTED_LOCATION_RELEASE "${LAPACK_LIBRARY_RELEASE_DLL}"
IMPORTED_IMPLIB "${LAPACK_LIBRARY_RELEASE}"
INTERFACE_INCLUDE_DIRECTORIES "${LAPACK_INCLUDE_DIR}"
IMPORTED_CONFIGURATIONS Release
IMPORTED_LINK_INTERFACE_LANGUAGES "C" )
if( EXISTS "${LAPACK_LIBRARY_DEBUG_DLL}" )
set_property( TARGET lapack APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
set_target_properties( lapack PROPERTIES
IMPORTED_LOCATION_DEBUG "${LAPACK_LIBRARY_DEBUG_DLL}"
IMPORTED_IMPLIB_DEBUG "${LAPACK_LIBRARY_DEBUG}" )
endif()
else()
add_library( lapack UNKNOWN IMPORTED )
set_target_properties( lapack PROPERTIES
IMPORTED_LOCATION_RELEASE "${LAPACK_LIBRARY_RELEASE}"
INTERFACE_INCLUDE_DIRECTORIES "${LAPACK_INCLUDE_DIR}"
IMPORTED_CONFIGURATIONS Release
IMPORTED_LINK_INTERFACE_LANGUAGES "C" )
if( EXISTS "${LAPACK_LIBRARY_DEBUG}" )
set_property( TARGET lapack APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug )
set_target_properties( lapack PROPERTIES
IMPORTED_LOCATION_DEBUG "${LAPACK_LIBRARY_DEBUG}" )
endif()
endif()
endif()
set(LAPACK_LIBRARY "${LAPACK_LIBRARY}" CACHE STRING "" FORCE)
set(F2C_LIBRARY "${F2C_LIBRARY}" CACHE STRING "" FORCE)
set(LAPACK_LIBRARY_RELEASE "${LAPACK_LIBRARY_RELEASE}" CACHE STRING "" FORCE)
set(LAPACK_LIBRARY_DEBUG "${LAPACK_LIBRARY_DEBUG}" CACHE STRING "" FORCE)
set(F2C_LIBRARY_RELEASE "${F2C_LIBRARY_RELEASE}" CACHE STRING "" FORCE)
set(F2C_LIBRARY_DEBUG "${F2C_LIBRARY_DEBUG}" CACHE STRING "" FORCE)