ADD: new track message, Entity class and Position class

This commit is contained in:
Henry Winkel
2022-12-20 17:20:35 +01:00
parent 469ecfb099
commit 98ebb563a8
2114 changed files with 482360 additions and 24 deletions

View File

@@ -0,0 +1,50 @@
cmake_minimum_required(VERSION 3.4.3)
if(CMAKE_COMPILER_IS_GNUCXX)
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
message(FATAL_ERROR "host compiler - gcc version must be > 4.8")
endif()
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
if (${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 3.6)
message(FATAL_ERROR "host compiler - clang version must be > 3.6")
endif()
endif()
if(MSVC)
set(ComputeCpp_STL_CHECK_SRC __STL_check)
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${ComputeCpp_STL_CHECK_SRC}.cpp
"#include <ios>\n"
"int main() { return 0; }\n")
execute_process(
COMMAND ${ComputeCpp_DEVICE_COMPILER_EXECUTABLE}
${COMPUTECPP_DEVICE_COMPILER_FLAGS}
-isystem ${ComputeCpp_INCLUDE_DIRS}
-o ${ComputeCpp_STL_CHECK_SRC}.sycl
-c ${ComputeCpp_STL_CHECK_SRC}.cpp
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
RESULT_VARIABLE ComputeCpp_STL_CHECK_RESULT
ERROR_QUIET
OUTPUT_QUIET)
if(NOT ${ComputeCpp_STL_CHECK_RESULT} EQUAL 0)
# Try disabling compiler version checks
execute_process(
COMMAND ${ComputeCpp_DEVICE_COMPILER_EXECUTABLE}
${COMPUTECPP_DEVICE_COMPILER_FLAGS}
-D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH
-isystem ${ComputeCpp_INCLUDE_DIRS}
-o ${ComputeCpp_STL_CHECK_SRC}.cpp.sycl
-c ${ComputeCpp_STL_CHECK_SRC}.cpp
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
RESULT_VARIABLE ComputeCpp_STL_CHECK_RESULT
ERROR_QUIET
OUTPUT_QUIET)
if(NOT ${ComputeCpp_STL_CHECK_RESULT} EQUAL 0)
message(STATUS "Device compiler cannot consume hosted STL headers. Using any parts of the STL will likely result in device compiler errors.")
else()
message(STATUS "Device compiler does not meet certain STL version requirements. Disabling version checks and hoping for the best.")
list(APPEND COMPUTECPP_DEVICE_COMPILER_FLAGS -D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH)
endif()
endif()
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/${ComputeCpp_STL_CHECK_SRC}.cpp
${CMAKE_CURRENT_BINARY_DIR}/${ComputeCpp_STL_CHECK_SRC}.cpp.sycl)
endif(MSVC)

View File

@@ -0,0 +1,18 @@
cmake_minimum_required(VERSION 3.4.3)
# These should match the types of IR output by compute++
set(IR_MAP_spir bc)
set(IR_MAP_spir64 bc)
set(IR_MAP_spir32 bc)
set(IR_MAP_spirv spv)
set(IR_MAP_spirv64 spv)
set(IR_MAP_spirv32 spv)
set(IR_MAP_aorta-x86_64 o)
set(IR_MAP_aorta-aarch64 o)
set(IR_MAP_aorta-rcar-cve o)
set(IR_MAP_custom-spir64 bc)
set(IR_MAP_custom-spir32 bc)
set(IR_MAP_custom-spirv64 spv)
set(IR_MAP_custom-spirv32 spv)
set(IR_MAP_ptx64 s)
set(IR_MAP_amdgcn s)

View File

@@ -0,0 +1,23 @@
# This file exports the Eigen3::Eigen CMake target which should be passed to the
# target_link_libraries command.
@PACKAGE_INIT@
if (NOT TARGET eigen)
include ("${CMAKE_CURRENT_LIST_DIR}/Eigen3Targets.cmake")
endif ()
# Legacy variables, do *not* use. May be removed in the future.
set (EIGEN3_FOUND 1)
set (EIGEN3_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/UseEigen3.cmake")
set (EIGEN3_DEFINITIONS "@EIGEN_DEFINITIONS@")
set (EIGEN3_INCLUDE_DIR "@PACKAGE_EIGEN_INCLUDE_DIR@")
set (EIGEN3_INCLUDE_DIRS "@PACKAGE_EIGEN_INCLUDE_DIR@")
set (EIGEN3_ROOT_DIR "@PACKAGE_EIGEN_ROOT_DIR@")
set (EIGEN3_VERSION_STRING "@EIGEN_VERSION_STRING@")
set (EIGEN3_VERSION_MAJOR "@EIGEN_VERSION_MAJOR@")
set (EIGEN3_VERSION_MINOR "@EIGEN_VERSION_MINOR@")
set (EIGEN3_VERSION_PATCH "@EIGEN_VERSION_PATCH@")

View File

@@ -0,0 +1,30 @@
# -*- cmake -*-
#
# Eigen3Config.cmake(.in)
# Use the following variables to compile and link against Eigen:
# EIGEN3_FOUND - True if Eigen was found on your system
# EIGEN3_USE_FILE - The file making Eigen usable
# EIGEN3_DEFINITIONS - Definitions needed to build with Eigen
# EIGEN3_INCLUDE_DIR - Directory where signature_of_eigen3_matrix_library can be found
# EIGEN3_INCLUDE_DIRS - List of directories of Eigen and it's dependencies
# EIGEN3_ROOT_DIR - The base directory of Eigen
# EIGEN3_VERSION_STRING - A human-readable string containing the version
# EIGEN3_VERSION_MAJOR - The major version of Eigen
# EIGEN3_VERSION_MINOR - The minor version of Eigen
# EIGEN3_VERSION_PATCH - The patch version of Eigen
@PACKAGE_INIT@
set ( EIGEN3_FOUND 1 )
set ( EIGEN3_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/UseEigen3.cmake" )
set ( EIGEN3_DEFINITIONS "@EIGEN_DEFINITIONS@" )
set ( EIGEN3_INCLUDE_DIR "@PACKAGE_EIGEN_INCLUDE_DIR@" )
set ( EIGEN3_INCLUDE_DIRS "@PACKAGE_EIGEN_INCLUDE_DIR@" )
set ( EIGEN3_ROOT_DIR "@PACKAGE_EIGEN_ROOT_DIR@" )
set ( EIGEN3_VERSION_STRING "@EIGEN_VERSION_STRING@" )
set ( EIGEN3_VERSION_MAJOR "@EIGEN_VERSION_MAJOR@" )
set ( EIGEN3_VERSION_MINOR "@EIGEN_VERSION_MINOR@" )
set ( EIGEN3_VERSION_PATCH "@EIGEN_VERSION_PATCH@" )

View File

@@ -0,0 +1,58 @@
include(EigenTesting)
include(CheckCXXSourceCompiles)
# configure the "site" and "buildname"
ei_set_sitename()
# retrieve and store the build string
ei_set_build_string()
add_custom_target(buildtests)
add_custom_target(check COMMAND "ctest")
add_dependencies(check buildtests)
# check whether /bin/bash exists (disabled as not used anymore)
# find_file(EIGEN_BIN_BASH_EXISTS "/bin/bash" PATHS "/" NO_DEFAULT_PATH)
# This call activates testing and generates the DartConfiguration.tcl
include(CTest)
set(EIGEN_TEST_BUILD_FLAGS "" CACHE STRING "Options passed to the build command of unit tests")
set(EIGEN_DASHBOARD_BUILD_TARGET "buildtests" CACHE STRING "Target to be built in dashboard mode, default is buildtests")
set(EIGEN_CTEST_ERROR_EXCEPTION "" CACHE STRING "Regular expression for build error messages to be filtered out")
# Overwrite default DartConfiguration.tcl such that ctest can build our unit tests.
# Recall that our unit tests are not in the "all" target, so we have to explicitly ask ctest to build our custom 'buildtests' target.
# At this stage, we can also add custom flags to the build tool through the user defined EIGEN_TEST_BUILD_FLAGS variable.
file(READ "${CMAKE_CURRENT_BINARY_DIR}/DartConfiguration.tcl" EIGEN_DART_CONFIG_FILE)
# try to grab the default flags
string(REGEX MATCH "MakeCommand:.*-- (.*)\nDefaultCTestConfigurationType" EIGEN_DUMMY ${EIGEN_DART_CONFIG_FILE})
if(NOT CMAKE_MATCH_1)
string(REGEX MATCH "MakeCommand:.*[^c]make (.*)\nDefaultCTestConfigurationType" EIGEN_DUMMY ${EIGEN_DART_CONFIG_FILE})
endif()
string(REGEX REPLACE "MakeCommand:.*DefaultCTestConfigurationType" "MakeCommand: ${CMAKE_COMMAND} --build . --target ${EIGEN_DASHBOARD_BUILD_TARGET} --config \"\${CTEST_CONFIGURATION_TYPE}\" -- ${CMAKE_MATCH_1} ${EIGEN_TEST_BUILD_FLAGS}\nDefaultCTestConfigurationType"
EIGEN_DART_CONFIG_FILE2 ${EIGEN_DART_CONFIG_FILE})
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/DartConfiguration.tcl" ${EIGEN_DART_CONFIG_FILE2})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CTestCustom.cmake.in ${CMAKE_BINARY_DIR}/CTestCustom.cmake)
# some documentation of this function would be nice
ei_init_testing()
# configure Eigen related testing options
option(EIGEN_NO_ASSERTION_CHECKING "Disable checking of assertions using exceptions" OFF)
option(EIGEN_DEBUG_ASSERTS "Enable advanced debugging of assertions" OFF)
if(CMAKE_COMPILER_IS_GNUCXX)
option(EIGEN_COVERAGE_TESTING "Enable/disable gcov" OFF)
if(EIGEN_COVERAGE_TESTING)
set(COVERAGE_FLAGS "-fprofile-arcs -ftest-coverage")
set(CTEST_CUSTOM_COVERAGE_EXCLUDE "/test/")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COVERAGE_FLAGS}")
endif()
elseif(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D_CRT_SECURE_NO_WARNINGS /D_SCL_SECURE_NO_WARNINGS")
endif()

View File

@@ -0,0 +1,46 @@
# The utility function DetermineOSVersion aims at providing an
# improved version of the CMake variable ${CMAKE_SYSTEM} on Windows
# machines.
#
# Usage:
# include(EigenDetermineOSVersion)
# DetermineOSVersion(OS_VERSION)
# message("OS: ${OS_VERSION}")
# - A little helper variable which should not be directly called
function(DetermineShortWindowsName WIN_VERSION win_num_version)
if (${win_num_version} VERSION_EQUAL "6.1")
set(_version "win7")
elseif(${win_num_version} VERSION_EQUAL "6.0")
set(_version "winVista")
elseif(${win_num_version} VERSION_EQUAL "5.2")
set(_version "winXpProf")
elseif(${win_num_version} VERSION_EQUAL "5.1")
set(_version "winXp")
elseif(${win_num_version} VERSION_EQUAL "5.0")
set(_version "win2000Prof")
else()
set(_version "unknownWin")
endif()
set(${WIN_VERSION} ${_version} PARENT_SCOPE)
endfunction()
function(DetermineOSVersion OS_VERSION)
if (WIN32 AND CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
file (TO_NATIVE_PATH "$ENV{COMSPEC}" SHELL)
exec_program( ${SHELL} ARGS "/c" "ver" OUTPUT_VARIABLE ver_output)
string(REGEX MATCHALL "[0-9]+"
ver_list "${ver_output}")
list(GET ver_list 0 _major)
list(GET ver_list 1 _minor)
set(win_num_version ${_major}.${_minor})
DetermineShortWindowsName(win_version "${win_num_version}")
if(win_version)
set(${OS_VERSION} ${win_version} PARENT_SCOPE)
endif()
else()
set(${OS_VERSION} ${CMAKE_SYSTEM} PARENT_SCOPE)
endif()
endfunction()

View File

@@ -0,0 +1,41 @@
include(CMakeDetermineVSServicePack)
# The code is almost identical to the CMake version. The only difference is that we remove
# _DetermineVSServicePack_FastCheckVersionWithCompiler which lead to errors on some systems.
function(EigenDetermineVSServicePack _pack)
if(NOT DETERMINED_VS_SERVICE_PACK OR NOT ${_pack})
if(NOT DETERMINED_VS_SERVICE_PACK)
_DetermineVSServicePack_CheckVersionWithTryCompile(DETERMINED_VS_SERVICE_PACK _cl_version)
if(NOT DETERMINED_VS_SERVICE_PACK)
_DetermineVSServicePack_CheckVersionWithTryRun(DETERMINED_VS_SERVICE_PACK _cl_version)
endif()
endif()
if(DETERMINED_VS_SERVICE_PACK)
if(_cl_version)
# Call helper function to determine VS version
_DetermineVSServicePackFromCompiler(_sp "${_cl_version}")
# temporary fix, until CMake catches up
if (NOT _sp)
if(${_cl_version} VERSION_EQUAL "17.00.50727.1")
set(_sp "vc110")
elseif(${_cl_version} VERSION_EQUAL "17.00.51106.1")
set(_sp "vc110sp1")
elseif(${_cl_version} VERSION_EQUAL "17.00.60315.1")
set(_sp "vc110sp2")
elseif(${_cl_version} VERSION_EQUAL "17.00.60610.1")
set(_sp "vc110sp3")
else()
set(_sp ${CMAKE_CXX_COMPILER_VERSION})
endif()
endif()
if(_sp)
set(${_pack} ${_sp} CACHE INTERNAL
"The Visual Studio Release with Service Pack")
endif()
endif()
endif()
endif()
endfunction()

View File

@@ -0,0 +1,131 @@
# List of tests that will be build and run during Eigen's smoke testing. If one
# of these tests doesn't exists or cannot be build with the current configuration
# it will just be skipped.
set(ei_smoke_test_list
adjoint_1
alignedvector3
array_cwise_7
array_cwise_8
array_for_matrix_1
array_of_string
array_replicate_1
array_reverse_1
autodiff_1
autodiff_scalar_1
bandmatrix
bdcsvd_9
bessel_functions_1
bfloat16_float
blasutil_1
block_5
BVH
cholesky_1
cholmod_support_23
cholmod_support_24
conservative_resize_1
constructor_1
corners_1
ctorleakmiscmatrices_4
dense_storage
determinant_1
diagonal_1
diagonal_2
diagonalmatrices_1
dynalloc
eigensolver_complex_1
eigensolver_selfadjoint_8
EulerAngles_1
exceptions
fastmath
first_aligned
geo_alignedbox_2
geo_eulerangles_1
geo_homogeneous_1
geo_hyperplane_1
geo_orthomethods_1
geo_parametrizedline_1
geo_transformations_7
half_float
hessenberg_1
hessenberg_6qr_10
householder_8
indexed_view_1
inplace_decomposition_1
integer_types_1
inverse_1
is_same_dense
jacobi_1
jacobisvd_1
kronecker_product
linearstructure_1
mapped_matrix_1
mapstaticmethods_1
mapstride_1
matrix_square_root_1
meta
minres_2
miscmatrices_1
mixingtypes_7
nestbyvalue
nesting_ops_1
nomalloc_1
nullary_1
num_dimensions
NumericalDiff
numext
packetmath
permutationmatrices_1
polynomialsolver_1
prec_inverse_4x4_1
product_extra_5
product_selfadjoint_1
product_small_7
product_symm_1
product_syrk_1
product_trmm_1
product_trmv_1
product_trsolve_5
qr_1
qr_colpivoting_7
qr_fullpivoting_4
rand
real_qz_1
redux_1
ref_1
resize
rvalue_types_1
schur_complex_1
schur_real_1
selfadjoint_1
sizeof
sizeoverflow
smallvectors
sparse_basic_3
sparse_block_1
sparse_extra_4
sparse_permutations_2
sparse_product_4
sparse_ref_1
sparse_solvers_1
sparse_vector_1
special_functions_1
special_numbers_1
special_packetmath_1
spqr_support_2
stable_norm_1
stddeque_1
stddeque_overload_1
stdlist_1
stdlist_overload_1
stdvector_1
stdvector_overload_1
stl_iterators_1
swap_1
symbolic_index_1
triangular_1
type_aliaslu_9
umeyama_3
unalignedassert
unalignedcount
vectorwiseop_1
visitor_1)

View File

@@ -0,0 +1,782 @@
macro(ei_add_property prop value)
get_property(previous GLOBAL PROPERTY ${prop})
if ((NOT previous) OR (previous STREQUAL ""))
set_property(GLOBAL PROPERTY ${prop} "${value}")
else()
set_property(GLOBAL PROPERTY ${prop} "${previous} ${value}")
endif()
endmacro()
#internal. See documentation of ei_add_test for details.
macro(ei_add_test_internal testname testname_with_suffix)
set(targetname ${testname_with_suffix})
if(EIGEN_ADD_TEST_FILENAME_EXTENSION)
set(filename ${testname}.${EIGEN_ADD_TEST_FILENAME_EXTENSION})
else()
set(filename ${testname}.cpp)
endif()
# Add the current target to the list of subtest targets
get_property(EIGEN_SUBTESTS_LIST GLOBAL PROPERTY EIGEN_SUBTESTS_LIST)
set(EIGEN_SUBTESTS_LIST "${EIGEN_SUBTESTS_LIST}${targetname}\n")
set_property(GLOBAL PROPERTY EIGEN_SUBTESTS_LIST "${EIGEN_SUBTESTS_LIST}")
if(EIGEN_ADD_TEST_FILENAME_EXTENSION STREQUAL cu)
if(EIGEN_TEST_HIP)
hip_reset_flags()
hip_add_executable(${targetname} ${filename} HIPCC_OPTIONS "-DEIGEN_USE_HIP ${ARGV2}")
elseif(EIGEN_TEST_CUDA_CLANG)
set_source_files_properties(${filename} PROPERTIES LANGUAGE CXX)
if(CUDA_64_BIT_DEVICE_CODE AND (EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/lib64"))
link_directories("${CUDA_TOOLKIT_ROOT_DIR}/lib64")
else()
link_directories("${CUDA_TOOLKIT_ROOT_DIR}/lib")
endif()
if (${ARGC} GREATER 2)
add_executable(${targetname} ${filename})
else()
add_executable(${targetname} ${filename} OPTIONS ${ARGV2})
endif()
set(CUDA_CLANG_LINK_LIBRARIES "cudart_static" "cuda" "dl" "pthread")
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(CUDA_CLANG_LINK_LIBRARIES ${CUDA_CLANG_LINK_LIBRARIES} "rt")
endif()
target_link_libraries(${targetname} ${CUDA_CLANG_LINK_LIBRARIES})
else()
if (${ARGC} GREATER 2)
cuda_add_executable(${targetname} ${filename} OPTIONS ${ARGV2})
else()
cuda_add_executable(${targetname} ${filename})
endif()
endif()
else()
add_executable(${targetname} ${filename})
endif()
if (targetname MATCHES "^eigen2_")
add_dependencies(eigen2_buildtests ${targetname})
else()
add_dependencies(buildtests ${targetname})
endif()
if(EIGEN_NO_ASSERTION_CHECKING)
ei_add_target_property(${targetname} COMPILE_FLAGS "-DEIGEN_NO_ASSERTION_CHECKING=1")
else()
if(EIGEN_DEBUG_ASSERTS)
ei_add_target_property(${targetname} COMPILE_FLAGS "-DEIGEN_DEBUG_ASSERTS=1")
endif()
endif()
ei_add_target_property(${targetname} COMPILE_FLAGS "-DEIGEN_TEST_MAX_SIZE=${EIGEN_TEST_MAX_SIZE}")
if(MSVC)
ei_add_target_property(${targetname} COMPILE_FLAGS "/bigobj")
endif()
# let the user pass flags.
if(${ARGC} GREATER 2)
ei_add_target_property(${targetname} COMPILE_FLAGS "${ARGV2}")
endif()
if(EIGEN_TEST_CUSTOM_CXX_FLAGS)
ei_add_target_property(${targetname} COMPILE_FLAGS "${EIGEN_TEST_CUSTOM_CXX_FLAGS}")
endif()
if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
target_link_libraries(${targetname} ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})
endif()
if(EXTERNAL_LIBS)
target_link_libraries(${targetname} ${EXTERNAL_LIBS})
endif()
if(EIGEN_TEST_CUSTOM_LINKER_FLAGS)
target_link_libraries(${targetname} ${EIGEN_TEST_CUSTOM_LINKER_FLAGS})
endif()
if(${ARGC} GREATER 3)
set(libs_to_link ${ARGV3})
# it could be that some cmake module provides a bad library string " " (just spaces),
# and that severely breaks target_link_libraries ("can't link to -l-lstdc++" errors).
# so we check for strings containing only spaces.
string(STRIP "${libs_to_link}" libs_to_link_stripped)
string(LENGTH "${libs_to_link_stripped}" libs_to_link_stripped_length)
if(${libs_to_link_stripped_length} GREATER 0)
# notice: no double quotes around ${libs_to_link} here. It may be a list.
target_link_libraries(${targetname} ${libs_to_link})
endif()
endif()
add_test(${testname_with_suffix} "${targetname}")
# Specify target and test labels according to EIGEN_CURRENT_SUBPROJECT
get_property(current_subproject GLOBAL PROPERTY EIGEN_CURRENT_SUBPROJECT)
if ((current_subproject) AND (NOT (current_subproject STREQUAL "")))
set_property(TARGET ${targetname} PROPERTY LABELS "Build${current_subproject}")
add_dependencies("Build${current_subproject}" ${targetname})
set_property(TEST ${testname_with_suffix} PROPERTY LABELS "${current_subproject}")
endif()
if(EIGEN_SYCL)
# Force include of the SYCL file at the end to avoid errors.
set_property(TARGET ${targetname} PROPERTY COMPUTECPP_INCLUDE_AFTER 1)
# Set COMPILE_FLAGS to COMPILE_DEFINITIONS instead to avoid having to duplicate the flags
# to the device compiler.
get_target_property(target_compile_flags ${targetname} COMPILE_FLAGS)
separate_arguments(target_compile_flags)
foreach(flag ${target_compile_flags})
if(${flag} MATCHES "^-D.*")
string(REPLACE "-D" "" definition_flag ${flag})
set_property(TARGET ${targetname} APPEND PROPERTY COMPILE_DEFINITIONS ${definition_flag})
list(REMOVE_ITEM target_compile_flags ${flag})
endif()
endforeach()
set_property(TARGET ${targetname} PROPERTY COMPILE_FLAGS ${target_compile_flags})
# Link against pthread and add sycl to target
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
target_link_libraries(${targetname} Threads::Threads)
add_sycl_to_target(TARGET ${targetname} SOURCES ${filename})
endif(EIGEN_SYCL)
endmacro(ei_add_test_internal)
# Macro to add a test
#
# the unique mandatory parameter testname must correspond to a file
# <testname>.cpp which follows this pattern:
#
# #include "main.h"
# void test_<testname>() { ... }
#
# Depending on the contents of that file, this macro can have 2 behaviors,
# see below.
#
# The optional 2nd parameter is libraries to link to.
#
# A. Default behavior
#
# this macro adds an executable <testname> as well as a ctest test
# named <testname> too.
#
# On platforms with bash simply run:
# "ctest -V" or "ctest -V -R <testname>"
# On other platform use ctest as usual
#
# B. Multi-part behavior
#
# If the source file matches the regexp
# CALL_SUBTEST_[0-9]+|EIGEN_TEST_PART_[0-9]+
# then it is interpreted as a multi-part test. The behavior then depends on the
# CMake option EIGEN_SPLIT_LARGE_TESTS, which is ON by default.
#
# If EIGEN_SPLIT_LARGE_TESTS is OFF, the behavior is the same as in A (the multi-part
# aspect is ignored).
#
# If EIGEN_SPLIT_LARGE_TESTS is ON, the test is split into multiple executables
# test_<testname>_<N>
# where N runs from 1 to the greatest occurrence found in the source file. Each of these
# executables is built passing -DEIGEN_TEST_PART_N. This allows to split large tests
# into smaller executables.
#
# Moreover, targets <testname> are still generated, they
# have the effect of building all the parts of the test.
#
# Again, ctest -R allows to run all matching tests.
macro(ei_add_test testname)
get_property(EIGEN_TESTS_LIST GLOBAL PROPERTY EIGEN_TESTS_LIST)
set(EIGEN_TESTS_LIST "${EIGEN_TESTS_LIST}${testname}\n")
set_property(GLOBAL PROPERTY EIGEN_TESTS_LIST "${EIGEN_TESTS_LIST}")
if(EIGEN_ADD_TEST_FILENAME_EXTENSION)
set(filename ${testname}.${EIGEN_ADD_TEST_FILENAME_EXTENSION})
else()
set(filename ${testname}.cpp)
endif()
file(READ "${filename}" test_source)
string(REGEX MATCHALL "CALL_SUBTEST_[0-9]+|EIGEN_TEST_PART_[0-9]+|EIGEN_SUFFIXES(;[0-9]+)+"
occurrences "${test_source}")
string(REGEX REPLACE "CALL_SUBTEST_|EIGEN_TEST_PART_|EIGEN_SUFFIXES" "" suffixes "${occurrences}")
list(REMOVE_DUPLICATES suffixes)
set(explicit_suffixes "")
if( (NOT EIGEN_SPLIT_LARGE_TESTS) AND suffixes)
# Check whether we have EIGEN_TEST_PART_* statements, in which case we likely must enforce splitting.
# For instance, indexed_view activate a different c++ version for each part.
string(REGEX MATCHALL "EIGEN_TEST_PART_[0-9]+" occurrences "${test_source}")
string(REGEX REPLACE "EIGEN_TEST_PART_" "" explicit_suffixes "${occurrences}")
list(REMOVE_DUPLICATES explicit_suffixes)
endif()
if( (EIGEN_SPLIT_LARGE_TESTS AND suffixes) OR explicit_suffixes)
add_custom_target(${testname})
foreach(suffix ${suffixes})
ei_add_test_internal(${testname} ${testname}_${suffix}
"${ARGV1} -DEIGEN_TEST_PART_${suffix}=1" "${ARGV2}")
add_dependencies(${testname} ${testname}_${suffix})
endforeach()
else()
ei_add_test_internal(${testname} ${testname} "${ARGV1} -DEIGEN_TEST_PART_ALL=1" "${ARGV2}")
endif()
endmacro()
# adds a failtest, i.e. a test that succeed if the program fails to compile
# note that the test runner for these is CMake itself, when passed -DEIGEN_FAILTEST=ON
# so here we're just running CMake commands immediately, we're not adding any targets.
macro(ei_add_failtest testname)
set(test_target_ok ${testname}_ok)
set(test_target_ko ${testname}_ko)
# Add executables
add_executable(${test_target_ok} ${testname}.cpp)
add_executable(${test_target_ko} ${testname}.cpp)
# Remove them from the normal build process
set_target_properties(${test_target_ok} ${test_target_ko} PROPERTIES
EXCLUDE_FROM_ALL TRUE
EXCLUDE_FROM_DEFAULT_BUILD TRUE)
# Configure the failing test
target_compile_definitions(${test_target_ko} PRIVATE EIGEN_SHOULD_FAIL_TO_BUILD)
# Add the tests to ctest.
add_test(NAME ${test_target_ok}
COMMAND ${CMAKE_COMMAND} --build . --target ${test_target_ok} --config $<CONFIGURATION>
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
add_test(NAME ${test_target_ko}
COMMAND ${CMAKE_COMMAND} --build . --target ${test_target_ko} --config $<CONFIGURATION>
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
# Expect the second test to fail
set_tests_properties(${test_target_ko} PROPERTIES WILL_FAIL TRUE)
endmacro()
# print a summary of the different options
macro(ei_testing_print_summary)
message(STATUS "************************************************************")
message(STATUS "*** Eigen's unit tests configuration summary ***")
message(STATUS "************************************************************")
message(STATUS "")
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
message(STATUS "Build site: ${SITE}")
message(STATUS "Build string: ${BUILDNAME}")
get_property(EIGEN_TESTING_SUMMARY GLOBAL PROPERTY EIGEN_TESTING_SUMMARY)
get_property(EIGEN_TESTED_BACKENDS GLOBAL PROPERTY EIGEN_TESTED_BACKENDS)
get_property(EIGEN_MISSING_BACKENDS GLOBAL PROPERTY EIGEN_MISSING_BACKENDS)
message(STATUS "Enabled backends: ${EIGEN_TESTED_BACKENDS}")
message(STATUS "Disabled backends: ${EIGEN_MISSING_BACKENDS}")
if(EIGEN_DEFAULT_TO_ROW_MAJOR)
message(STATUS "Default order: Row-major")
else()
message(STATUS "Default order: Column-major")
endif()
if(EIGEN_TEST_NO_EXPLICIT_ALIGNMENT)
message(STATUS "Explicit alignment (hence vectorization) disabled")
elseif(EIGEN_TEST_NO_EXPLICIT_VECTORIZATION)
message(STATUS "Explicit vectorization disabled (alignment kept enabled)")
else()
message(STATUS "Maximal matrix/vector size: ${EIGEN_TEST_MAX_SIZE}")
if(EIGEN_TEST_SSE2)
message(STATUS "SSE2: ON")
else()
message(STATUS "SSE2: Using architecture defaults")
endif()
if(EIGEN_TEST_SSE3)
message(STATUS "SSE3: ON")
else()
message(STATUS "SSE3: Using architecture defaults")
endif()
if(EIGEN_TEST_SSSE3)
message(STATUS "SSSE3: ON")
else()
message(STATUS "SSSE3: Using architecture defaults")
endif()
if(EIGEN_TEST_SSE4_1)
message(STATUS "SSE4.1: ON")
else()
message(STATUS "SSE4.1: Using architecture defaults")
endif()
if(EIGEN_TEST_SSE4_2)
message(STATUS "SSE4.2: ON")
else()
message(STATUS "SSE4.2: Using architecture defaults")
endif()
if(EIGEN_TEST_AVX)
message(STATUS "AVX: ON")
else()
message(STATUS "AVX: Using architecture defaults")
endif()
if(EIGEN_TEST_AVX2)
message(STATUS "AVX2: ON")
else()
message(STATUS "AVX2: Using architecture defaults")
endif()
if(EIGEN_TEST_FMA)
message(STATUS "FMA: ON")
else()
message(STATUS "FMA: Using architecture defaults")
endif()
if(EIGEN_TEST_AVX512)
message(STATUS "AVX512: ON")
else()
message(STATUS "AVX512: Using architecture defaults")
endif()
if(EIGEN_TEST_AVX512DQ)
message(STATUS "AVX512DQ: ON")
else()
message(STATUS "AVX512DQ: Using architecture defaults")
endif()
if(EIGEN_TEST_ALTIVEC)
message(STATUS "Altivec: ON")
else()
message(STATUS "Altivec: Using architecture defaults")
endif()
if(EIGEN_TEST_VSX)
message(STATUS "VSX: ON")
else()
message(STATUS "VSX: Using architecture defaults")
endif()
if(EIGEN_TEST_MSA)
message(STATUS "MIPS MSA: ON")
else()
message(STATUS "MIPS MSA: Using architecture defaults")
endif()
if(EIGEN_TEST_NEON)
message(STATUS "ARM NEON: ON")
else()
message(STATUS "ARM NEON: Using architecture defaults")
endif()
if(EIGEN_TEST_NEON64)
message(STATUS "ARMv8 NEON: ON")
else()
message(STATUS "ARMv8 NEON: Using architecture defaults")
endif()
if(EIGEN_TEST_ZVECTOR)
message(STATUS "S390X ZVECTOR: ON")
else()
message(STATUS "S390X ZVECTOR: Using architecture defaults")
endif()
if(EIGEN_TEST_CXX11)
message(STATUS "C++11: ON")
else()
message(STATUS "C++11: OFF")
endif()
if(EIGEN_TEST_SYCL)
if(EIGEN_SYCL_TRISYCL)
message(STATUS "SYCL: ON (using triSYCL)")
else()
message(STATUS "SYCL: ON (using computeCPP)")
endif()
else()
message(STATUS "SYCL: OFF")
endif()
if(EIGEN_TEST_CUDA)
if(EIGEN_TEST_CUDA_CLANG)
message(STATUS "CUDA: ON (using clang)")
else()
message(STATUS "CUDA: ON (using nvcc)")
endif()
else()
message(STATUS "CUDA: OFF")
endif()
if(EIGEN_TEST_HIP)
message(STATUS "HIP: ON (using hipcc)")
else()
message(STATUS "HIP: OFF")
endif()
endif() # vectorization / alignment options
message(STATUS "\n${EIGEN_TESTING_SUMMARY}")
message(STATUS "************************************************************")
endmacro()
macro(ei_init_testing)
define_property(GLOBAL PROPERTY EIGEN_CURRENT_SUBPROJECT BRIEF_DOCS " " FULL_DOCS " ")
define_property(GLOBAL PROPERTY EIGEN_TESTED_BACKENDS BRIEF_DOCS " " FULL_DOCS " ")
define_property(GLOBAL PROPERTY EIGEN_MISSING_BACKENDS BRIEF_DOCS " " FULL_DOCS " ")
define_property(GLOBAL PROPERTY EIGEN_TESTING_SUMMARY BRIEF_DOCS " " FULL_DOCS " ")
define_property(GLOBAL PROPERTY EIGEN_TESTS_LIST BRIEF_DOCS " " FULL_DOCS " ")
define_property(GLOBAL PROPERTY EIGEN_SUBTESTS_LIST BRIEF_DOCS " " FULL_DOCS " ")
set_property(GLOBAL PROPERTY EIGEN_TESTED_BACKENDS "")
set_property(GLOBAL PROPERTY EIGEN_MISSING_BACKENDS "")
set_property(GLOBAL PROPERTY EIGEN_TESTING_SUMMARY "")
set_property(GLOBAL PROPERTY EIGEN_TESTS_LIST "")
set_property(GLOBAL PROPERTY EIGEN_SUBTESTS_LIST "")
define_property(GLOBAL PROPERTY EIGEN_FAILTEST_FAILURE_COUNT BRIEF_DOCS " " FULL_DOCS " ")
define_property(GLOBAL PROPERTY EIGEN_FAILTEST_COUNT BRIEF_DOCS " " FULL_DOCS " ")
set_property(GLOBAL PROPERTY EIGEN_FAILTEST_FAILURE_COUNT "0")
set_property(GLOBAL PROPERTY EIGEN_FAILTEST_COUNT "0")
# uncomment anytime you change the ei_get_compilerver_from_cxx_version_string macro
# ei_test_get_compilerver_from_cxx_version_string()
endmacro()
macro(ei_set_sitename)
# if the sitename is not yet set, try to set it
if(NOT ${SITE} OR ${SITE} STREQUAL "")
set(eigen_computername $ENV{COMPUTERNAME})
set(eigen_hostname $ENV{HOSTNAME})
if(eigen_hostname)
set(SITE ${eigen_hostname})
elseif(eigen_computername)
set(SITE ${eigen_computername})
endif()
endif()
# in case it is already set, enforce lower case
if(SITE)
string(TOLOWER ${SITE} SITE)
endif()
endmacro()
macro(ei_get_compilerver VAR)
if(MSVC)
# on windows system, we use a modified CMake script
include(EigenDetermineVSServicePack)
EigenDetermineVSServicePack( my_service_pack )
if( my_service_pack )
set(${VAR} ${my_service_pack})
else()
set(${VAR} "na")
endif()
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "PGI")
set(${VAR} "${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION}")
else()
# on all other system we rely on ${CMAKE_CXX_COMPILER}
# supporting a "--version" or "/version" flag
if(WIN32 AND ${CMAKE_CXX_COMPILER_ID} EQUAL "Intel")
set(EIGEN_CXX_FLAG_VERSION "/version")
else()
set(EIGEN_CXX_FLAG_VERSION "--version")
endif()
execute_process(COMMAND ${CMAKE_CXX_COMPILER} ${EIGEN_CXX_FLAG_VERSION}
OUTPUT_VARIABLE eigen_cxx_compiler_version_string OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REGEX REPLACE "^[ \n\r]+" "" eigen_cxx_compiler_version_string ${eigen_cxx_compiler_version_string})
string(REGEX REPLACE "[\n\r].*" "" eigen_cxx_compiler_version_string ${eigen_cxx_compiler_version_string})
ei_get_compilerver_from_cxx_version_string("${eigen_cxx_compiler_version_string}" CNAME CVER)
set(${VAR} "${CNAME}-${CVER}")
endif()
endmacro()
# Extract compiler name and version from a raw version string
# WARNING: if you edit this macro, then please test it by uncommenting
# the testing macro call in ei_init_testing() of the EigenTesting.cmake file.
# See also the ei_test_get_compilerver_from_cxx_version_string macro at the end
# of the file
macro(ei_get_compilerver_from_cxx_version_string VERSTRING CNAME CVER)
# extract possible compiler names
string(REGEX MATCH "g\\+\\+" ei_has_gpp ${VERSTRING})
string(REGEX MATCH "llvm|LLVM" ei_has_llvm ${VERSTRING})
string(REGEX MATCH "gcc|GCC" ei_has_gcc ${VERSTRING})
string(REGEX MATCH "icpc|ICC" ei_has_icpc ${VERSTRING})
string(REGEX MATCH "clang|CLANG" ei_has_clang ${VERSTRING})
string(REGEX MATCH "mingw32" ei_has_mingw ${VERSTRING})
# combine them
if((ei_has_llvm) AND (ei_has_gpp OR ei_has_gcc))
set(${CNAME} "llvm-g++")
elseif((ei_has_llvm) AND (ei_has_clang))
set(${CNAME} "llvm-clang++")
elseif(ei_has_clang)
set(${CNAME} "clang++")
elseif ((ei_has_mingw) AND (ei_has_gpp OR ei_has_gcc))
set(${CNAME} "mingw32-g++")
elseif(ei_has_icpc)
set(${CNAME} "icpc")
elseif(ei_has_gpp OR ei_has_gcc)
set(${CNAME} "g++")
else()
set(${CNAME} "_")
endif()
# extract possible version numbers
# first try to extract 3 isolated numbers:
string(REGEX MATCH " [0-9]+\\.[0-9]+\\.[0-9]+" eicver ${VERSTRING})
if(NOT eicver)
# try to extract 2 isolated ones:
string(REGEX MATCH " [0-9]+\\.[0-9]+" eicver ${VERSTRING})
if(NOT eicver)
# try to extract 3:
string(REGEX MATCH "[^0-9][0-9]+\\.[0-9]+\\.[0-9]+" eicver ${VERSTRING})
if(NOT eicver)
# try to extract 2:
string(REGEX MATCH "[^0-9][0-9]+\\.[0-9]+" eicver ${VERSTRING})
if (NOT eicver AND ei_has_mingw)
# try to extract 1 number plus suffix:
string(REGEX MATCH "[^0-9][0-9]+-win32" eicver ${VERSTRING})
endif()
endif()
endif()
endif()
if (NOT eicver)
set(eicver " _")
endif()
string(REGEX REPLACE ".(.*)" "\\1" ${CVER} ${eicver})
endmacro()
macro(ei_get_cxxflags VAR)
set(${VAR} "")
ei_is_64bit_env(IS_64BIT_ENV)
if(EIGEN_TEST_NEON)
set(${VAR} NEON)
elseif(EIGEN_TEST_NEON64)
set(${VAR} NEON)
elseif(EIGEN_TEST_ZVECTOR)
set(${VAR} ZVECTOR)
elseif(EIGEN_TEST_VSX)
set(${VAR} VSX)
elseif(EIGEN_TEST_ALTIVEC)
set(${VAR} ALVEC)
elseif(EIGEN_TEST_FMA)
set(${VAR} FMA)
elseif(EIGEN_TEST_AVX)
set(${VAR} AVX)
elseif(EIGEN_TEST_SSE4_2)
set(${VAR} SSE42)
elseif(EIGEN_TEST_SSE4_1)
set(${VAR} SSE41)
elseif(EIGEN_TEST_SSSE3)
set(${VAR} SSSE3)
elseif(EIGEN_TEST_SSE3)
set(${VAR} SSE3)
elseif(EIGEN_TEST_SSE2 OR IS_64BIT_ENV)
set(${VAR} SSE2)
elseif(EIGEN_TEST_MSA)
set(${VAR} MSA)
endif()
if(EIGEN_TEST_OPENMP)
if (${VAR} STREQUAL "")
set(${VAR} OMP)
else()
set(${VAR} ${${VAR}}-OMP)
endif()
endif()
if(EIGEN_DEFAULT_TO_ROW_MAJOR)
if (${VAR} STREQUAL "")
set(${VAR} ROW)
else()
set(${VAR} ${${VAR}}-ROWMAJ)
endif()
endif()
endmacro()
macro(ei_set_build_string)
ei_get_compilerver(LOCAL_COMPILER_VERSION)
ei_get_cxxflags(LOCAL_COMPILER_FLAGS)
include(EigenDetermineOSVersion)
DetermineOSVersion(OS_VERSION)
set(TMP_BUILD_STRING ${OS_VERSION}-${LOCAL_COMPILER_VERSION})
if (NOT ${LOCAL_COMPILER_FLAGS} STREQUAL "")
set(TMP_BUILD_STRING ${TMP_BUILD_STRING}-${LOCAL_COMPILER_FLAGS})
endif()
if(EIGEN_TEST_EXTERNAL_BLAS)
set(TMP_BUILD_STRING ${TMP_BUILD_STRING}-external_blas)
endif()
ei_is_64bit_env(IS_64BIT_ENV)
if(NOT IS_64BIT_ENV)
set(TMP_BUILD_STRING ${TMP_BUILD_STRING}-32bit)
else()
set(TMP_BUILD_STRING ${TMP_BUILD_STRING}-64bit)
endif()
if(EIGEN_TEST_CXX11)
set(TMP_BUILD_STRING ${TMP_BUILD_STRING}-cxx11)
endif()
if(EIGEN_BUILD_STRING_SUFFIX)
set(TMP_BUILD_STRING ${TMP_BUILD_STRING}-${EIGEN_BUILD_STRING_SUFFIX})
endif()
string(TOLOWER ${TMP_BUILD_STRING} BUILDNAME)
endmacro()
macro(ei_is_64bit_env VAR)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(${VAR} 1)
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(${VAR} 0)
else()
message(WARNING "Unsupported pointer size. Please contact the authors.")
endif()
endmacro()
# helper macro for testing ei_get_compilerver_from_cxx_version_string
# STR: raw version string
# REFNAME: expected compiler name
# REFVER: expected compiler version
macro(ei_test1_get_compilerver_from_cxx_version_string STR REFNAME REFVER)
ei_get_compilerver_from_cxx_version_string(${STR} CNAME CVER)
if((NOT ${REFNAME} STREQUAL ${CNAME}) OR (NOT ${REFVER} STREQUAL ${CVER}))
message("STATUS ei_get_compilerver_from_cxx_version_string error:")
message("Expected \"${REFNAME}-${REFVER}\", got \"${CNAME}-${CVER}\"")
endif()
endmacro()
# macro for testing ei_get_compilerver_from_cxx_version_string
# feel free to add more version strings
macro(ei_test_get_compilerver_from_cxx_version_string)
ei_test1_get_compilerver_from_cxx_version_string("g++ (SUSE Linux) 4.5.3 20110428 [gcc-4_5-branch revision 173117]" "g++" "4.5.3")
ei_test1_get_compilerver_from_cxx_version_string("c++ (GCC) 4.5.1 20100924 (Red Hat 4.5.1-4)" "g++" "4.5.1")
ei_test1_get_compilerver_from_cxx_version_string("icpc (ICC) 11.0 20081105" "icpc" "11.0")
ei_test1_get_compilerver_from_cxx_version_string("g++-3.4 (GCC) 3.4.6" "g++" "3.4.6")
ei_test1_get_compilerver_from_cxx_version_string("SUSE Linux clang version 3.0 (branches/release_30 145598) (based on LLVM 3.0)" "llvm-clang++" "3.0")
ei_test1_get_compilerver_from_cxx_version_string("icpc (ICC) 12.0.5 20110719" "icpc" "12.0.5")
ei_test1_get_compilerver_from_cxx_version_string("Apple clang version 2.1 (tags/Apple/clang-163.7.1) (based on LLVM 3.0svn)" "llvm-clang++" "2.1")
ei_test1_get_compilerver_from_cxx_version_string("i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)" "llvm-g++" "4.2.1")
ei_test1_get_compilerver_from_cxx_version_string("g++-mp-4.4 (GCC) 4.4.6" "g++" "4.4.6")
ei_test1_get_compilerver_from_cxx_version_string("g++-mp-4.4 (GCC) 2011" "g++" "4.4")
ei_test1_get_compilerver_from_cxx_version_string("x86_64-w64-mingw32-g++ (GCC) 10-win32 20210110" "mingw32-g++" "10-win32")
endmacro()
# Split all tests listed in EIGEN_TESTS_LIST into num_splits many targets
# named buildtestspartN with N = { 0, ..., num_splits-1}.
#
# The intention behind the existance of this macro is the size of Eigen's
# testsuite. Together with the relativly big compile-times building all tests
# can take a substantial amount of time depending on the available hardware.
#
# The last buildtestspartN target will build possible remaining tests.
#
# An example:
#
# EIGEN_TESTS_LIST= [ test1, test2, test3, test4, test5, test6, test7 ]
#
# A call to ei_split_testsuite(3) creates the following targets with dependencies
#
# Target Dependencies
# ------ ------------
# buildtestspart0 test1, test2
# buildtestspart1 test3, test4
# buildtestspart2 test5, test6, test7
#
macro(ei_split_testsuite num_splits)
get_property(EIGEN_TESTS_LIST GLOBAL PROPERTY EIGEN_TESTS_LIST)
# Translate EIGEN_TESTS_LIST into a CMake list
string(REGEX REPLACE "\n" " " EIGEN_TESTS_LIST "${EIGEN_TESTS_LIST}")
set(EIGEN_TESTS_LIST "${EIGEN_TESTS_LIST}")
separate_arguments(EIGEN_TESTS_LIST)
set(eigen_test_count "0")
foreach(t IN ITEMS ${EIGEN_TESTS_LIST})
math(EXPR eigen_test_count "${eigen_test_count}+1")
endforeach()
# Get number of tests per target
math(EXPR num_tests_per_target "${eigen_test_count}/${num_splits} - ${eigen_test_count}/${num_splits} % 1")
set(test_idx "0")
math(EXPR target_bound "${num_splits}-1")
foreach(part RANGE "0" "${target_bound}")
# Create target
set(current_target "buildtestspart${part}")
add_custom_target("${current_target}")
math(EXPR upper_bound "${test_idx} + ${num_tests_per_target} - 1")
foreach(test_idx RANGE "${test_idx}" "${upper_bound}")
list(GET EIGEN_TESTS_LIST "${test_idx}" curr_test)
add_dependencies("${current_target}" "${curr_test}")
endforeach()
math(EXPR test_idx "${test_idx} + ${num_tests_per_target}")
endforeach()
# Handle the possibly remaining tests
math(EXPR test_idx "${num_splits} * ${num_tests_per_target}")
math(EXPR target_bound "${eigen_test_count} - 1")
foreach(test_idx RANGE "${test_idx}" "${target_bound}")
list(GET EIGEN_TESTS_LIST "${test_idx}" curr_test)
add_dependencies("${current_target}" "${curr_test}")
endforeach()
endmacro(ei_split_testsuite num_splits)
# Defines the custom command buildsmoketests to build a number of tests
# specified in smoke_test_list.
#
# Test in smoke_test_list can be either test targets (e.g. packetmath) or
# subtests targets (e.g. packetmath_2). If any of the test are not available
# in the current configuration they are just skipped.
#
# All tests added via this macro are labeled with the smoketest label. This
# allows running smoketests only using ctest.
#
# Smoke tests are intended to be run before the whole test suite is invoked,
# e.g., to smoke test patches.
macro(ei_add_smoke_tests smoke_test_list)
# Set the build target to build smoketests
set(buildtarget "buildsmoketests")
add_custom_target("${buildtarget}")
# Get list of all tests and translate it into a CMake list
get_property(EIGEN_TESTS_LIST GLOBAL PROPERTY EIGEN_TESTS_LIST)
string(REGEX REPLACE "\n" " " EIGEN_TESTS_LIST "${EIGEN_TESTS_LIST}")
set(EIGEN_TESTS_LIST "${EIGEN_TESTS_LIST}")
separate_arguments(EIGEN_TESTS_LIST)
# Check if the test in smoke_test_list is a currently valid test target
foreach(test IN ITEMS ${smoke_test_list})
# Add tests in smoke_test_list to our smoke test target but only if the test
# is currently available, i.e., is in EIGEN_SUBTESTS_LIST
if ("${test}" IN_LIST EIGEN_TESTS_LIST)
add_dependencies("${buildtarget}" "${test}")
# In the case of a test we match all subtests
set(ctest_regex "${ctest_regex}^${test}_[0-9]+$$|")
endif()
endforeach()
# Get list of all subtests and translate it into a CMake list
get_property(EIGEN_SUBTESTS_LIST GLOBAL PROPERTY EIGEN_SUBTESTS_LIST)
string(REGEX REPLACE "\n" " " EIGEN_SUBTESTS_LIST "${EIGEN_SUBTESTS_LIST}")
set(EIGEN_SUBTESTS_LIST "${EIGEN_SUBTESTS_LIST}")
separate_arguments(EIGEN_SUBTESTS_LIST)
# Check if the test in smoke_test_list is a currently valid subtest target
foreach(test IN ITEMS ${smoke_test_list})
# Add tests in smoke_test_list to our smoke test target but only if the test
# is currently available, i.e., is in EIGEN_SUBTESTS_LIST
if ("${test}" IN_LIST EIGEN_SUBTESTS_LIST)
add_dependencies("${buildtarget}" "${test}")
# Add label smoketest to be able to run smoketests using ctest
get_property(test_labels TEST ${test} PROPERTY LABELS)
set_property(TEST ${test} PROPERTY LABELS "${test_labels};smoketest")
endif()
endforeach()
endmacro(ei_add_smoke_tests)

View File

@@ -0,0 +1,40 @@
################ CMake Uninstall Template #######################
# CMake Template file for uninstallation of files
# mentioned in 'install_manifest.txt'
#
# Used by uinstall target
#################################################################
set(MANIFEST "${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt")
if(EXISTS ${MANIFEST})
message(STATUS "============== Uninstalling Eigen ===================")
file(STRINGS ${MANIFEST} files)
foreach(file ${files})
if(EXISTS ${file})
message(STATUS "Removing file: '${file}'")
execute_process(
COMMAND ${CMAKE_COMMAND} -E remove ${file}
OUTPUT_VARIABLE rm_out
RESULT_VARIABLE rm_retval
)
if(NOT "${rm_retval}" STREQUAL 0)
message(FATAL_ERROR "Failed to remove file: '${file}'.")
endif()
else()
message(STATUS "File '${file}' does not exist.")
endif()
endforeach()
message(STATUS "========== Finished Uninstalling Eigen ==============")
else()
message(STATUS "Cannot find install manifest: '${MANIFEST}'")
message(STATUS "Probably make install has not been performed")
message(STATUS " or install_manifest.txt has been deleted.")
endif()

View File

@@ -0,0 +1,20 @@
if (ADOLC_INCLUDES AND ADOLC_LIBRARIES)
set(ADOLC_FIND_QUIETLY TRUE)
endif ()
find_path(ADOLC_INCLUDES
NAMES adolc/adtl.h
PATHS $ENV{ADOLCDIR} $ENV{ADOLCDIR}/include ${INCLUDE_INSTALL_DIR}
)
find_library(ADOLC_LIBRARIES
adolc
PATHS $ENV{ADOLCDIR} ${LIB_INSTALL_DIR}
PATH_SUFFIXES lib lib64)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Adolc DEFAULT_MSG
ADOLC_INCLUDES ADOLC_LIBRARIES)
mark_as_advanced(ADOLC_INCLUDES ADOLC_LIBRARIES)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,384 @@
###
#
# @copyright (c) 2009-2014 The University of Tennessee and The University
# of Tennessee Research Foundation.
# All rights reserved.
# @copyright (c) 2012-2016 Inria. All rights reserved.
# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
#
###
#
# - Find BLAS EXTENDED for MORSE projects: find include dirs and libraries
#
# This module allows to find BLAS libraries by calling the official FindBLAS module
# and handles the creation of different library lists whether the user wishes to link
# with a sequential BLAS or a multihreaded (BLAS_SEQ_LIBRARIES and BLAS_PAR_LIBRARIES).
# BLAS is detected with a FindBLAS call then if the BLAS vendor is Intel10_64lp, ACML
# or IBMESSLMT then the module attempts to find the corresponding multithreaded libraries.
#
# The following variables have been added to manage links with sequential or multithreaded
# versions:
# BLAS_INCLUDE_DIRS - BLAS include directories
# BLAS_LIBRARY_DIRS - Link directories for BLAS libraries
# BLAS_SEQ_LIBRARIES - BLAS component libraries to be linked (sequential)
# BLAS_PAR_LIBRARIES - BLAS component libraries to be linked (multithreaded)
#=============================================================================
# Copyright 2012-2013 Inria
# Copyright 2012-2013 Emmanuel Agullo
# Copyright 2012-2013 Mathieu Faverge
# Copyright 2012 Cedric Castagnede
# Copyright 2013-2016 Florent Pruvost
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file MORSE-Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of Morse, substitute the full
# License text for the above reference.)
# macro to factorize this call
include(CMakeFindDependencyMacro)
macro(find_package_blas)
if(BLASEXT_FIND_REQUIRED)
if(BLASEXT_FIND_QUIETLY)
find_dependency(BLAS REQUIRED QUIET)
else()
find_dependency(BLAS REQUIRED)
endif()
else()
if(BLASEXT_FIND_QUIETLY)
find_dependency(BLAS QUIET)
else()
find_dependency(BLAS)
endif()
endif()
endmacro()
# add a cache variable to let the user specify the BLAS vendor
set(BLA_VENDOR "" CACHE STRING "list of possible BLAS vendor:
Open, Eigen, Goto, ATLAS PhiPACK, CXML, DXML, SunPerf, SCSL, SGIMATH, IBMESSL, IBMESSLMT,
Intel10_32 (intel mkl v10 32 bit),
Intel10_64lp (intel mkl v10 64 bit, lp thread model, lp64 model),
Intel10_64lp_seq (intel mkl v10 64 bit, sequential code, lp64 model),
Intel( older versions of mkl 32 and 64 bit),
ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic")
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "In FindBLASEXT")
message(STATUS "If you want to force the use of one specific library, "
"\n please specify the BLAS vendor by setting -DBLA_VENDOR=blas_vendor_name"
"\n at cmake configure.")
message(STATUS "List of possible BLAS vendor: Goto, ATLAS PhiPACK, CXML, "
"\n DXML, SunPerf, SCSL, SGIMATH, IBMESSL, IBMESSLMT, Intel10_32 (intel mkl v10 32 bit),"
"\n Intel10_64lp (intel mkl v10 64 bit, lp thread model, lp64 model),"
"\n Intel10_64lp_seq (intel mkl v10 64 bit, sequential code, lp64 model),"
"\n Intel( older versions of mkl 32 and 64 bit),"
"\n ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic")
endif()
if (NOT BLAS_FOUND)
# First try to detect two cases:
# 1: only SEQ libs are handled
# 2: both SEQ and PAR libs are handled
find_package_blas()
endif ()
# detect the cases where SEQ and PAR libs are handled
if(BLA_VENDOR STREQUAL "All" AND
(BLAS_mkl_core_LIBRARY OR BLAS_mkl_core_dll_LIBRARY)
)
set(BLA_VENDOR "Intel")
if(BLAS_mkl_intel_LIBRARY)
set(BLA_VENDOR "Intel10_32")
endif()
if(BLAS_mkl_intel_lp64_LIBRARY)
set(BLA_VENDOR "Intel10_64lp")
endif()
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "A BLAS library has been found (${BLAS_LIBRARIES}) but we"
"\n have also potentially detected some multithreaded BLAS libraries from the MKL."
"\n We try to find both libraries lists (Sequential/Multithreaded).")
endif()
set(BLAS_FOUND "")
elseif(BLA_VENDOR STREQUAL "All" AND BLAS_acml_LIBRARY)
set(BLA_VENDOR "ACML")
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "A BLAS library has been found (${BLAS_LIBRARIES}) but we"
"\n have also potentially detected some multithreaded BLAS libraries from the ACML."
"\n We try to find both libraries lists (Sequential/Multithreaded).")
endif()
set(BLAS_FOUND "")
elseif(BLA_VENDOR STREQUAL "All" AND BLAS_essl_LIBRARY)
set(BLA_VENDOR "IBMESSL")
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "A BLAS library has been found (${BLAS_LIBRARIES}) but we"
"\n have also potentially detected some multithreaded BLAS libraries from the ESSL."
"\n We try to find both libraries lists (Sequential/Multithreaded).")
endif()
set(BLAS_FOUND "")
endif()
# Intel case
if(BLA_VENDOR MATCHES "Intel*")
###
# look for include path if the BLAS vendor is Intel
###
# gather system include paths
unset(_inc_env)
if(WIN32)
string(REPLACE ":" ";" _inc_env "$ENV{INCLUDE}")
else()
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{CPATH}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}")
list(APPEND _inc_env "${_path_env}")
endif()
list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}")
list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}")
set(ENV_MKLROOT "$ENV{MKLROOT}")
if (ENV_MKLROOT)
list(APPEND _inc_env "${ENV_MKLROOT}/include")
endif()
list(REMOVE_DUPLICATES _inc_env)
# find mkl.h inside known include paths
set(BLAS_mkl.h_INCLUDE_DIRS "BLAS_mkl.h_INCLUDE_DIRS-NOTFOUND")
if(BLAS_INCDIR)
set(BLAS_mkl.h_INCLUDE_DIRS "BLAS_mkl.h_INCLUDE_DIRS-NOTFOUND")
find_path(BLAS_mkl.h_INCLUDE_DIRS
NAMES mkl.h
HINTS ${BLAS_INCDIR})
else()
if(BLAS_DIR)
set(BLAS_mkl.h_INCLUDE_DIRS "BLAS_mkl.h_INCLUDE_DIRS-NOTFOUND")
find_path(BLAS_mkl.h_INCLUDE_DIRS
NAMES mkl.h
HINTS ${BLAS_DIR}
PATH_SUFFIXES include)
else()
set(BLAS_mkl.h_INCLUDE_DIRS "BLAS_mkl.h_INCLUDE_DIRS-NOTFOUND")
find_path(BLAS_mkl.h_INCLUDE_DIRS
NAMES mkl.h
HINTS ${_inc_env})
endif()
endif()
mark_as_advanced(BLAS_mkl.h_INCLUDE_DIRS)
## Print status if not found
## -------------------------
#if (NOT BLAS_mkl.h_INCLUDE_DIRS AND MORSE_VERBOSE)
# Print_Find_Header_Status(blas mkl.h)
#endif ()
set(BLAS_INCLUDE_DIRS "")
if(BLAS_mkl.h_INCLUDE_DIRS)
list(APPEND BLAS_INCLUDE_DIRS "${BLAS_mkl.h_INCLUDE_DIRS}" )
endif()
###
# look for libs
###
# if Intel 10 64 bit -> look for sequential and multithreaded versions
if(BLA_VENDOR MATCHES "Intel10_64lp*")
## look for the sequential version
set(BLA_VENDOR "Intel10_64lp_seq")
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "Look for the sequential version Intel10_64lp_seq")
endif()
find_package_blas()
if(BLAS_FOUND)
set(BLAS_SEQ_LIBRARIES "${BLAS_LIBRARIES}")
else()
set(BLAS_SEQ_LIBRARIES "${BLAS_SEQ_LIBRARIES-NOTFOUND}")
endif()
## look for the multithreaded version
set(BLA_VENDOR "Intel10_64lp")
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "Look for the multithreaded version Intel10_64lp")
endif()
find_package_blas()
if(BLAS_FOUND)
set(BLAS_PAR_LIBRARIES "${BLAS_LIBRARIES}")
else()
set(BLAS_PAR_LIBRARIES "${BLAS_PAR_LIBRARIES-NOTFOUND}")
endif()
else()
if(BLAS_FOUND)
set(BLAS_SEQ_LIBRARIES "${BLAS_LIBRARIES}")
else()
set(BLAS_SEQ_LIBRARIES "${BLAS_SEQ_LIBRARIES-NOTFOUND}")
endif()
endif()
# ACML case
elseif(BLA_VENDOR MATCHES "ACML*")
## look for the sequential version
set(BLA_VENDOR "ACML")
find_package_blas()
if(BLAS_FOUND)
set(BLAS_SEQ_LIBRARIES "${BLAS_LIBRARIES}")
else()
set(BLAS_SEQ_LIBRARIES "${BLAS_SEQ_LIBRARIES-NOTFOUND}")
endif()
## look for the multithreaded version
set(BLA_VENDOR "ACML_MP")
find_package_blas()
if(BLAS_FOUND)
set(BLAS_PAR_LIBRARIES "${BLAS_LIBRARIES}")
else()
set(BLAS_PAR_LIBRARIES "${BLAS_PAR_LIBRARIES-NOTFOUND}")
endif()
# IBMESSL case
elseif(BLA_VENDOR MATCHES "IBMESSL*")
## look for the sequential version
set(BLA_VENDOR "IBMESSL")
find_package_blas()
if(BLAS_FOUND)
set(BLAS_SEQ_LIBRARIES "${BLAS_LIBRARIES}")
else()
set(BLAS_SEQ_LIBRARIES "${BLAS_SEQ_LIBRARIES-NOTFOUND}")
endif()
## look for the multithreaded version
set(BLA_VENDOR "IBMESSLMT")
find_package_blas()
if(BLAS_FOUND)
set(BLAS_PAR_LIBRARIES "${BLAS_LIBRARIES}")
else()
set(BLAS_PAR_LIBRARIES "${BLAS_PAR_LIBRARIES-NOTFOUND}")
endif()
else()
if(BLAS_FOUND)
# define the SEQ libs as the BLAS_LIBRARIES
set(BLAS_SEQ_LIBRARIES "${BLAS_LIBRARIES}")
else()
set(BLAS_SEQ_LIBRARIES "${BLAS_SEQ_LIBRARIES-NOTFOUND}")
endif()
set(BLAS_PAR_LIBRARIES "${BLAS_PAR_LIBRARIES-NOTFOUND}")
endif()
if(BLAS_SEQ_LIBRARIES)
set(BLAS_LIBRARIES "${BLAS_SEQ_LIBRARIES}")
endif()
# extract libs paths
# remark: because it is not given by find_package(BLAS)
set(BLAS_LIBRARY_DIRS "")
string(REPLACE " " ";" BLAS_LIBRARIES "${BLAS_LIBRARIES}")
foreach(blas_lib ${BLAS_LIBRARIES})
if (EXISTS "${blas_lib}")
get_filename_component(a_blas_lib_dir "${blas_lib}" PATH)
list(APPEND BLAS_LIBRARY_DIRS "${a_blas_lib_dir}" )
else()
string(REPLACE "-L" "" blas_lib "${blas_lib}")
if (EXISTS "${blas_lib}")
list(APPEND BLAS_LIBRARY_DIRS "${blas_lib}" )
else()
get_filename_component(a_blas_lib_dir "${blas_lib}" PATH)
if (EXISTS "${a_blas_lib_dir}")
list(APPEND BLAS_LIBRARY_DIRS "${a_blas_lib_dir}" )
endif()
endif()
endif()
endforeach()
if (BLAS_LIBRARY_DIRS)
list(REMOVE_DUPLICATES BLAS_LIBRARY_DIRS)
endif ()
# check that BLAS has been found
# ---------------------------------
include(FindPackageHandleStandardArgs)
if(BLA_VENDOR MATCHES "Intel*")
if(BLA_VENDOR MATCHES "Intel10_64lp*")
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "BLAS found is Intel MKL:"
"\n we manage two lists of libs, one sequential and one parallel if found"
"\n (see BLAS_SEQ_LIBRARIES and BLAS_PAR_LIBRARIES)")
message(STATUS "BLAS sequential libraries stored in BLAS_SEQ_LIBRARIES")
endif()
find_package_handle_standard_args(BLASEXT DEFAULT_MSG
BLAS_SEQ_LIBRARIES
BLAS_LIBRARY_DIRS
BLAS_INCLUDE_DIRS)
if(BLAS_PAR_LIBRARIES)
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "BLAS parallel libraries stored in BLAS_PAR_LIBRARIES")
endif()
find_package_handle_standard_args(BLASEXT DEFAULT_MSG
BLAS_PAR_LIBRARIES)
endif()
else()
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "BLAS sequential libraries stored in BLAS_SEQ_LIBRARIES")
endif()
find_package_handle_standard_args(BLASEXT DEFAULT_MSG
BLAS_SEQ_LIBRARIES
BLAS_LIBRARY_DIRS
BLAS_INCLUDE_DIRS)
endif()
elseif(BLA_VENDOR MATCHES "ACML*")
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "BLAS found is ACML:"
"\n we manage two lists of libs, one sequential and one parallel if found"
"\n (see BLAS_SEQ_LIBRARIES and BLAS_PAR_LIBRARIES)")
message(STATUS "BLAS sequential libraries stored in BLAS_SEQ_LIBRARIES")
endif()
find_package_handle_standard_args(BLASEXT DEFAULT_MSG
BLAS_SEQ_LIBRARIES
BLAS_LIBRARY_DIRS)
if(BLAS_PAR_LIBRARIES)
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "BLAS parallel libraries stored in BLAS_PAR_LIBRARIES")
endif()
find_package_handle_standard_args(BLASEXT DEFAULT_MSG
BLAS_PAR_LIBRARIES)
endif()
elseif(BLA_VENDOR MATCHES "IBMESSL*")
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "BLAS found is ESSL:"
"\n we manage two lists of libs, one sequential and one parallel if found"
"\n (see BLAS_SEQ_LIBRARIES and BLAS_PAR_LIBRARIES)")
message(STATUS "BLAS sequential libraries stored in BLAS_SEQ_LIBRARIES")
endif()
find_package_handle_standard_args(BLASEXT DEFAULT_MSG
BLAS_SEQ_LIBRARIES
BLAS_LIBRARY_DIRS)
if(BLAS_PAR_LIBRARIES)
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "BLAS parallel libraries stored in BLAS_PAR_LIBRARIES")
endif()
find_package_handle_standard_args(BLASEXT DEFAULT_MSG
BLAS_PAR_LIBRARIES)
endif()
else()
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "BLAS sequential libraries stored in BLAS_SEQ_LIBRARIES")
endif()
find_package_handle_standard_args(BLASEXT DEFAULT_MSG
BLAS_SEQ_LIBRARIES
BLAS_LIBRARY_DIRS)
endif()
# Callers expect BLAS_FOUND to be set as well.
set(BLAS_FOUND BLASEXT_FOUND)

View File

@@ -0,0 +1,89 @@
# CHOLMOD lib usually requires linking to a blas and lapack library.
# It is up to the user of this module to find a BLAS and link to it.
if (CHOLMOD_INCLUDES AND CHOLMOD_LIBRARIES)
set(CHOLMOD_FIND_QUIETLY TRUE)
endif ()
find_path(CHOLMOD_INCLUDES
NAMES
cholmod.h
PATHS
$ENV{CHOLMODDIR}
${INCLUDE_INSTALL_DIR}
PATH_SUFFIXES
suitesparse
ufsparse
)
find_library(CHOLMOD_LIBRARIES cholmod PATHS $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR})
if(CHOLMOD_LIBRARIES)
get_filename_component(CHOLMOD_LIBDIR ${CHOLMOD_LIBRARIES} PATH)
find_library(AMD_LIBRARY amd PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR})
if (AMD_LIBRARY)
set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARIES} ${AMD_LIBRARY})
else ()
set(CHOLMOD_LIBRARIES FALSE)
endif ()
endif()
if(CHOLMOD_LIBRARIES)
find_library(COLAMD_LIBRARY colamd PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR})
if (COLAMD_LIBRARY)
set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARIES} ${COLAMD_LIBRARY})
else ()
set(CHOLMOD_LIBRARIES FALSE)
endif ()
endif()
if(CHOLMOD_LIBRARIES)
find_library(CAMD_LIBRARY camd PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR})
if (CAMD_LIBRARY)
set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARIES} ${CAMD_LIBRARY})
else ()
set(CHOLMOD_LIBRARIES FALSE)
endif ()
endif()
if(CHOLMOD_LIBRARIES)
find_library(CCOLAMD_LIBRARY ccolamd PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR})
if (CCOLAMD_LIBRARY)
set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARIES} ${CCOLAMD_LIBRARY})
else ()
set(CHOLMOD_LIBRARIES FALSE)
endif ()
endif()
if(CHOLMOD_LIBRARIES)
find_library(CHOLMOD_METIS_LIBRARY metis PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR})
if (CHOLMOD_METIS_LIBRARY)
set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARIES} ${CHOLMOD_METIS_LIBRARY})
endif ()
endif()
if(CHOLMOD_LIBRARIES)
find_library(SUITESPARSE_LIBRARY SuiteSparse PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR})
if (SUITESPARSE_LIBRARY)
set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARIES} ${SUITESPARSE_LIBRARY})
endif ()
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CHOLMOD DEFAULT_MSG
CHOLMOD_INCLUDES CHOLMOD_LIBRARIES)
mark_as_advanced(CHOLMOD_INCLUDES CHOLMOD_LIBRARIES AMD_LIBRARY COLAMD_LIBRARY SUITESPARSE_LIBRARY CAMD_LIBRARY CCOLAMD_LIBRARY CHOLMOD_METIS_LIBRARY)

View File

@@ -0,0 +1,455 @@
#.rst:
# FindComputeCpp
#---------------
#
# Copyright 2016-2018 Codeplay Software Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use these files except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#########################
# FindComputeCpp.cmake
#########################
#
# Tools for finding and building with ComputeCpp.
#
# User must define ComputeCpp_DIR pointing to the ComputeCpp
# installation.
#
# Latest version of this file can be found at:
# https://github.com/codeplaysoftware/computecpp-sdk
cmake_minimum_required(VERSION 3.4.3)
include(FindPackageHandleStandardArgs)
include(ComputeCppIRMap)
set(COMPUTECPP_USER_FLAGS "" CACHE STRING "User flags for compute++")
separate_arguments(COMPUTECPP_USER_FLAGS)
mark_as_advanced(COMPUTECPP_USER_FLAGS)
set(COMPUTECPP_BITCODE "spir64" CACHE STRING
"Bitcode type to use as SYCL target in compute++")
mark_as_advanced(COMPUTECPP_BITCODE)
include(CMakeFindDependencyMacro)
find_dependency(OpenCL REQUIRED)
# Find ComputeCpp package
if(DEFINED ComputeCpp_DIR)
set(computecpp_find_hint ${ComputeCpp_DIR})
elseif(DEFINED ENV{COMPUTECPP_DIR})
set(computecpp_find_hint $ENV{COMPUTECPP_DIR})
endif()
# Used for running executables on the host
set(computecpp_host_find_hint ${computecpp_find_hint})
if(CMAKE_CROSSCOMPILING)
# ComputeCpp_HOST_DIR is used to find executables that are run on the host
if(DEFINED ComputeCpp_HOST_DIR)
set(computecpp_host_find_hint ${ComputeCpp_HOST_DIR})
elseif(DEFINED ENV{COMPUTECPP_HOST_DIR})
set(computecpp_host_find_hint $ENV{COMPUTECPP_HOST_DIR})
endif()
endif()
find_program(ComputeCpp_DEVICE_COMPILER_EXECUTABLE compute++
HINTS ${computecpp_host_find_hint}
PATH_SUFFIXES bin
NO_SYSTEM_ENVIRONMENT_PATH)
find_program(ComputeCpp_INFO_EXECUTABLE computecpp_info
HINTS ${computecpp_host_find_hint}
PATH_SUFFIXES bin
NO_SYSTEM_ENVIRONMENT_PATH)
find_library(COMPUTECPP_RUNTIME_LIBRARY
NAMES ComputeCpp ComputeCpp_vs2015
HINTS ${computecpp_find_hint}
PATH_SUFFIXES lib
DOC "ComputeCpp Runtime Library")
find_library(COMPUTECPP_RUNTIME_LIBRARY_DEBUG
NAMES ComputeCpp_d ComputeCpp ComputeCpp_vs2015_d
HINTS ${computecpp_find_hint}
PATH_SUFFIXES lib
DOC "ComputeCpp Debug Runtime Library")
find_path(ComputeCpp_INCLUDE_DIRS
NAMES "CL/sycl.hpp"
HINTS ${computecpp_find_hint}/include
DOC "The ComputeCpp include directory")
get_filename_component(ComputeCpp_INCLUDE_DIRS ${ComputeCpp_INCLUDE_DIRS} ABSOLUTE)
get_filename_component(computecpp_canonical_root_dir "${ComputeCpp_INCLUDE_DIRS}/.." ABSOLUTE)
set(ComputeCpp_ROOT_DIR "${computecpp_canonical_root_dir}" CACHE PATH
"The root of the ComputeCpp install")
if(NOT ComputeCpp_INFO_EXECUTABLE)
message(WARNING "Can't find computecpp_info - check ComputeCpp_DIR")
else()
execute_process(COMMAND ${ComputeCpp_INFO_EXECUTABLE} "--dump-version"
OUTPUT_VARIABLE ComputeCpp_VERSION
RESULT_VARIABLE ComputeCpp_INFO_EXECUTABLE_RESULT OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT ComputeCpp_INFO_EXECUTABLE_RESULT EQUAL "0")
message(WARNING "Package version - Error obtaining version!")
endif()
execute_process(COMMAND ${ComputeCpp_INFO_EXECUTABLE} "--dump-is-supported"
OUTPUT_VARIABLE COMPUTECPP_PLATFORM_IS_SUPPORTED
RESULT_VARIABLE ComputeCpp_INFO_EXECUTABLE_RESULT OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT ComputeCpp_INFO_EXECUTABLE_RESULT EQUAL "0")
message(WARNING "platform - Error checking platform support!")
else()
mark_as_advanced(COMPUTECPP_PLATFORM_IS_SUPPORTED)
if (COMPUTECPP_PLATFORM_IS_SUPPORTED)
message(STATUS "platform - your system can support ComputeCpp")
else()
message(STATUS "platform - your system is not officially supported")
endif()
endif()
endif()
find_package_handle_standard_args(ComputeCpp
REQUIRED_VARS ComputeCpp_ROOT_DIR
ComputeCpp_DEVICE_COMPILER_EXECUTABLE
ComputeCpp_INFO_EXECUTABLE
COMPUTECPP_RUNTIME_LIBRARY
COMPUTECPP_RUNTIME_LIBRARY_DEBUG
ComputeCpp_INCLUDE_DIRS
VERSION_VAR ComputeCpp_VERSION)
mark_as_advanced(ComputeCpp_ROOT_DIR
ComputeCpp_DEVICE_COMPILER_EXECUTABLE
ComputeCpp_INFO_EXECUTABLE
COMPUTECPP_RUNTIME_LIBRARY
COMPUTECPP_RUNTIME_LIBRARY_DEBUG
ComputeCpp_INCLUDE_DIRS
ComputeCpp_VERSION)
if(NOT ComputeCpp_FOUND)
return()
endif()
list(APPEND COMPUTECPP_DEVICE_COMPILER_FLAGS -O2 -mllvm -inline-threshold=1000 -intelspirmetadata)
mark_as_advanced(COMPUTECPP_DEVICE_COMPILER_FLAGS)
if(CMAKE_CROSSCOMPILING)
if(NOT COMPUTECPP_DONT_USE_TOOLCHAIN)
list(APPEND COMPUTECPP_DEVICE_COMPILER_FLAGS --gcc-toolchain=${COMPUTECPP_TOOLCHAIN_DIR})
endif()
list(APPEND COMPUTECPP_DEVICE_COMPILER_FLAGS --sysroot=${COMPUTECPP_SYSROOT_DIR})
list(APPEND COMPUTECPP_DEVICE_COMPILER_FLAGS -target ${COMPUTECPP_TARGET_TRIPLE})
endif()
list(APPEND COMPUTECPP_DEVICE_COMPILER_FLAGS -sycl-target ${COMPUTECPP_BITCODE})
message(STATUS "compute++ flags - ${COMPUTECPP_DEVICE_COMPILER_FLAGS}")
include(ComputeCppCompilerChecks)
if(NOT TARGET OpenCL::OpenCL)
add_library(OpenCL::OpenCL UNKNOWN IMPORTED)
set_target_properties(OpenCL::OpenCL PROPERTIES
IMPORTED_LOCATION "${OpenCL_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${OpenCL_INCLUDE_DIRS}"
)
endif()
if(NOT TARGET ComputeCpp::ComputeCpp)
add_library(ComputeCpp::ComputeCpp UNKNOWN IMPORTED)
set_target_properties(ComputeCpp::ComputeCpp PROPERTIES
IMPORTED_LOCATION_DEBUG "${COMPUTECPP_RUNTIME_LIBRARY_DEBUG}"
IMPORTED_LOCATION_RELWITHDEBINFO "${COMPUTECPP_RUNTIME_LIBRARY}"
IMPORTED_LOCATION "${COMPUTECPP_RUNTIME_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${ComputeCpp_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "OpenCL::OpenCL"
)
endif()
# This property allows targets to specify that their sources should be
# compiled with the integration header included after the user's
# sources, not before (e.g. when an enum is used in a kernel name, this
# is not technically valid SYCL code but can work with ComputeCpp)
define_property(
TARGET PROPERTY COMPUTECPP_INCLUDE_AFTER
BRIEF_DOCS "Include integration header after user source"
FULL_DOCS "Changes compiler arguments such that the source file is
actually the integration header, and the .cpp file is included on
the command line so that it is seen by the compiler first. Enables
non-standards-conformant SYCL code to compile with ComputeCpp."
)
define_property(
TARGET PROPERTY INTERFACE_COMPUTECPP_FLAGS
BRIEF_DOCS "Interface compile flags to provide compute++"
FULL_DOCS "Set additional compile flags to pass to compute++ when compiling
any target which links to this one."
)
define_property(
SOURCE PROPERTY COMPUTECPP_SOURCE_FLAGS
BRIEF_DOCS "Source file compile flags for compute++"
FULL_DOCS "Set additional compile flags for compiling the SYCL integration
header for the given source file."
)
####################
# __build_ir
####################
#
# Adds a custom target for running compute++ and adding a dependency for the
# resulting integration header and kernel binary.
#
# TARGET : Name of the target.
# SOURCE : Source file to be compiled.
# COUNTER : Counter included in name of custom target. Different counter
# values prevent duplicated names of custom target when source files with
# the same name, but located in different directories, are used for the
# same target.
#
function(__build_ir)
set(options)
set(one_value_args
TARGET
SOURCE
COUNTER
)
set(multi_value_args)
cmake_parse_arguments(SDK_BUILD_IR
"${options}"
"${one_value_args}"
"${multi_value_args}"
${ARGN}
)
get_filename_component(sourceFileName ${SDK_BUILD_IR_SOURCE} NAME)
# Set the path to the integration header.
# The .sycl filename must depend on the target so that different targets
# using the same source file will be generated with a different rule.
set(baseSyclName ${CMAKE_CURRENT_BINARY_DIR}/${SDK_BUILD_IR_TARGET}_${sourceFileName})
set(outputSyclFile ${baseSyclName}.sycl)
set(outputDeviceFile ${baseSyclName}.${IR_MAP_${COMPUTECPP_BITCODE}})
set(depFileName ${baseSyclName}.sycl.d)
set(include_directories "$<TARGET_PROPERTY:${SDK_BUILD_IR_TARGET},INCLUDE_DIRECTORIES>")
set(compile_definitions "$<TARGET_PROPERTY:${SDK_BUILD_IR_TARGET},COMPILE_DEFINITIONS>")
set(generated_include_directories
$<$<BOOL:${include_directories}>:-I\"$<JOIN:${include_directories},\"\t-I\">\">)
set(generated_compile_definitions
$<$<BOOL:${compile_definitions}>:-D$<JOIN:${compile_definitions},\t-D>>)
# Obtain language standard of the file
set(device_compiler_cxx_standard)
get_target_property(targetCxxStandard ${SDK_BUILD_IR_TARGET} CXX_STANDARD)
if (targetCxxStandard MATCHES 17)
set(device_compiler_cxx_standard "-std=c++1z")
elseif (targetCxxStandard MATCHES 14)
set(device_compiler_cxx_standard "-std=c++14")
elseif (targetCxxStandard MATCHES 11)
set(device_compiler_cxx_standard "-std=c++11")
elseif (targetCxxStandard MATCHES 98)
message(FATAL_ERROR "SYCL applications cannot be compiled using C++98")
else ()
set(device_compiler_cxx_standard "")
endif()
get_property(source_compile_flags
SOURCE ${SDK_BUILD_IR_SOURCE}
PROPERTY COMPUTECPP_SOURCE_FLAGS
)
separate_arguments(source_compile_flags)
if(source_compile_flags)
list(APPEND computecpp_source_flags ${source_compile_flags})
endif()
list(APPEND COMPUTECPP_DEVICE_COMPILER_FLAGS
${device_compiler_cxx_standard}
${COMPUTECPP_USER_FLAGS}
${computecpp_source_flags}
)
set(ir_dependencies ${SDK_BUILD_IR_SOURCE})
get_target_property(target_libraries ${SDK_BUILD_IR_TARGET} LINK_LIBRARIES)
if(target_libraries)
foreach(library ${target_libraries})
if(TARGET ${library})
list(APPEND ir_dependencies ${library})
endif()
endforeach()
endif()
# Depfile support was only added in CMake 3.7
# CMake throws an error if it is unsupported by the generator (i. e. not ninja)
if((NOT CMAKE_VERSION VERSION_LESS 3.7.0) AND
CMAKE_GENERATOR MATCHES "Ninja")
file(RELATIVE_PATH relOutputFile ${CMAKE_BINARY_DIR} ${outputDeviceFile})
set(generate_depfile -MMD -MF ${depFileName} -MT ${relOutputFile})
set(enable_depfile DEPFILE ${depFileName})
endif()
# Add custom command for running compute++
add_custom_command(
OUTPUT ${outputDeviceFile} ${outputSyclFile}
COMMAND ${ComputeCpp_DEVICE_COMPILER_EXECUTABLE}
${COMPUTECPP_DEVICE_COMPILER_FLAGS}
${generated_include_directories}
${generated_compile_definitions}
-sycl-ih ${outputSyclFile}
-o ${outputDeviceFile}
-c ${SDK_BUILD_IR_SOURCE}
${generate_depfile}
DEPENDS ${ir_dependencies}
IMPLICIT_DEPENDS CXX ${SDK_BUILD_IR_SOURCE}
${enable_depfile}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Building ComputeCpp integration header file ${outputSyclFile}")
# Name: (user-defined name)_(source file)_(counter)_ih
set(headerTargetName
${SDK_BUILD_IR_TARGET}_${sourceFileName}_${SDK_BUILD_IR_COUNTER}_ih)
if(NOT MSVC)
# Add a custom target for the generated integration header
add_custom_target(${headerTargetName} DEPENDS ${outputDeviceFile} ${outputSyclFile})
add_dependencies(${SDK_BUILD_IR_TARGET} ${headerTargetName})
endif()
# This property can be set on a per-target basis to indicate that the
# integration header should appear after the main source listing
get_target_property(includeAfter ${SDK_ADD_SYCL_TARGET} COMPUTECPP_INCLUDE_AFTER)
if(includeAfter)
# Change the source file to the integration header - e.g.
# g++ -c source_file_name.cpp.sycl
get_target_property(current_sources ${SDK_BUILD_IR_TARGET} SOURCES)
# Remove absolute path to source file
list(REMOVE_ITEM current_sources ${SDK_BUILD_IR_SOURCE})
# Remove relative path to source file
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" ""
rel_source_file ${SDK_BUILD_IR_SOURCE}
)
list(REMOVE_ITEM current_sources ${rel_source_file})
# Add SYCL header to source list
list(APPEND current_sources ${outputSyclFile})
set_property(TARGET ${SDK_BUILD_IR_TARGET}
PROPERTY SOURCES ${current_sources})
# CMake/gcc don't know what language a .sycl file is, so tell them
set_property(SOURCE ${outputSyclFile} PROPERTY LANGUAGE CXX)
set(includedFile ${SDK_BUILD_IR_SOURCE})
set(cppFile ${outputSyclFile})
else()
set_property(SOURCE ${outputSyclFile} PROPERTY HEADER_FILE_ONLY ON)
set(includedFile ${outputSyclFile})
set(cppFile ${SDK_BUILD_IR_SOURCE})
endif()
# Force inclusion of the integration header for the host compiler
if(MSVC)
# Group SYCL files inside Visual Studio
source_group("SYCL" FILES ${outputSyclFile})
if(includeAfter)
# Allow the source file to be edited using Visual Studio.
# It will be added as a header file so it won't be compiled.
set_property(SOURCE ${SDK_BUILD_IR_SOURCE} PROPERTY HEADER_FILE_ONLY true)
endif()
# Add both source and the sycl files to the VS solution.
target_sources(${SDK_BUILD_IR_TARGET} PUBLIC ${SDK_BUILD_IR_SOURCE} ${outputSyclFile})
set(forceIncludeFlags "/FI${includedFile} /TP")
else()
set(forceIncludeFlags "-include ${includedFile} -x c++")
endif()
set_property(
SOURCE ${cppFile}
APPEND_STRING PROPERTY COMPILE_FLAGS "${forceIncludeFlags}"
)
endfunction(__build_ir)
#######################
# add_sycl_to_target
#######################
#
# Adds a SYCL compilation custom command associated with an existing
# target and sets a dependancy on that new command.
#
# TARGET : Name of the target to add SYCL to.
# SOURCES : Source files to be compiled for SYCL.
#
function(add_sycl_to_target)
set(options)
set(one_value_args
TARGET
)
set(multi_value_args
SOURCES
)
cmake_parse_arguments(SDK_ADD_SYCL
"${options}"
"${one_value_args}"
"${multi_value_args}"
${ARGN}
)
set_target_properties(${SDK_ADD_SYCL_TARGET} PROPERTIES LINKER_LANGUAGE CXX)
# If the CXX compiler is set to compute++ enable the driver.
get_filename_component(cmakeCxxCompilerFileName "${CMAKE_CXX_COMPILER}" NAME)
if("${cmakeCxxCompilerFileName}" STREQUAL "compute++")
if(MSVC)
message(FATAL_ERROR "The compiler driver is not supported by this system,
revert the CXX compiler to your default host compiler.")
endif()
get_target_property(includeAfter ${SDK_ADD_SYCL_TARGET} COMPUTECPP_INCLUDE_AFTER)
if(includeAfter)
list(APPEND COMPUTECPP_USER_FLAGS -fsycl-ih-last)
endif()
list(INSERT COMPUTECPP_DEVICE_COMPILER_FLAGS 0 -sycl-driver)
# Prepend COMPUTECPP_DEVICE_COMPILER_FLAGS and append COMPUTECPP_USER_FLAGS
foreach(prop COMPILE_OPTIONS INTERFACE_COMPILE_OPTIONS)
get_target_property(target_compile_options ${SDK_ADD_SYCL_TARGET} ${prop})
if(NOT target_compile_options)
set(target_compile_options "")
endif()
set_property(
TARGET ${SDK_ADD_SYCL_TARGET}
PROPERTY ${prop}
${COMPUTECPP_DEVICE_COMPILER_FLAGS}
${target_compile_options}
${COMPUTECPP_USER_FLAGS}
)
endforeach()
else()
set(fileCounter 0)
list(INSERT COMPUTECPP_DEVICE_COMPILER_FLAGS 0 -sycl)
# Add custom target to run compute++ and generate the integration header
foreach(sourceFile ${SDK_ADD_SYCL_SOURCES})
if(NOT IS_ABSOLUTE ${sourceFile})
set(sourceFile "${CMAKE_CURRENT_SOURCE_DIR}/${sourceFile}")
endif()
__build_ir(
TARGET ${SDK_ADD_SYCL_TARGET}
SOURCE ${sourceFile}
COUNTER ${fileCounter}
)
MATH(EXPR fileCounter "${fileCounter} + 1")
endforeach()
endif()
set_property(TARGET ${SDK_ADD_SYCL_TARGET}
APPEND PROPERTY LINK_LIBRARIES ComputeCpp::ComputeCpp)
set_property(TARGET ${SDK_ADD_SYCL_TARGET}
APPEND PROPERTY INTERFACE_LINK_LIBRARIES ComputeCpp::ComputeCpp)
endfunction(add_sycl_to_target)

View File

@@ -0,0 +1,80 @@
# - Try to find Eigen2 lib
#
# This module supports requiring a minimum version, e.g. you can do
# find_package(Eigen2 2.0.3)
# to require version 2.0.3 to newer of Eigen2.
#
# Once done this will define
#
# EIGEN2_FOUND - system has eigen lib with correct version
# EIGEN2_INCLUDE_DIR - the eigen include directory
# EIGEN2_VERSION - eigen version
# Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>
# Copyright (c) 2008, 2009 Gael Guennebaud, <g.gael@free.fr>
# Redistribution and use is allowed according to the terms of the BSD license.
if(NOT Eigen2_FIND_VERSION)
if(NOT Eigen2_FIND_VERSION_MAJOR)
set(Eigen2_FIND_VERSION_MAJOR 2)
endif()
if(NOT Eigen2_FIND_VERSION_MINOR)
set(Eigen2_FIND_VERSION_MINOR 0)
endif()
if(NOT Eigen2_FIND_VERSION_PATCH)
set(Eigen2_FIND_VERSION_PATCH 0)
endif()
set(Eigen2_FIND_VERSION "${Eigen2_FIND_VERSION_MAJOR}.${Eigen2_FIND_VERSION_MINOR}.${Eigen2_FIND_VERSION_PATCH}")
endif()
macro(_eigen2_check_version)
file(READ "${EIGEN2_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen2_version_header)
string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen2_world_version_match "${_eigen2_version_header}")
set(EIGEN2_WORLD_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen2_major_version_match "${_eigen2_version_header}")
set(EIGEN2_MAJOR_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen2_minor_version_match "${_eigen2_version_header}")
set(EIGEN2_MINOR_VERSION "${CMAKE_MATCH_1}")
set(EIGEN2_VERSION ${EIGEN2_WORLD_VERSION}.${EIGEN2_MAJOR_VERSION}.${EIGEN2_MINOR_VERSION})
if((${EIGEN2_WORLD_VERSION} NOTEQUAL 2) OR (${EIGEN2_MAJOR_VERSION} GREATER 10) OR (${EIGEN2_VERSION} VERSION_LESS ${Eigen2_FIND_VERSION}))
set(EIGEN2_VERSION_OK FALSE)
else()
set(EIGEN2_VERSION_OK TRUE)
endif()
if(NOT EIGEN2_VERSION_OK)
message(STATUS "Eigen2 version ${EIGEN2_VERSION} found in ${EIGEN2_INCLUDE_DIR}, "
"but at least version ${Eigen2_FIND_VERSION} is required")
endif()
endmacro()
if (EIGEN2_INCLUDE_DIR)
# in cache already
_eigen2_check_version()
set(EIGEN2_FOUND ${EIGEN2_VERSION_OK})
else ()
find_path(EIGEN2_INCLUDE_DIR NAMES Eigen/Core
PATHS
${INCLUDE_INSTALL_DIR}
${KDE4_INCLUDE_DIR}
PATH_SUFFIXES eigen2
)
if(EIGEN2_INCLUDE_DIR)
_eigen2_check_version()
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Eigen2 DEFAULT_MSG EIGEN2_INCLUDE_DIR EIGEN2_VERSION_OK)
mark_as_advanced(EIGEN2_INCLUDE_DIR)
endif()

View File

@@ -0,0 +1,107 @@
# - Try to find Eigen3 lib
#
# This module supports requiring a minimum version, e.g. you can do
# find_package(Eigen3 3.1.2)
# to require version 3.1.2 or newer of Eigen3.
#
# Once done this will define
#
# EIGEN3_FOUND - system has eigen lib with correct version
# EIGEN3_INCLUDE_DIR - the eigen include directory
# EIGEN3_VERSION - eigen version
#
# and the following imported target:
#
# Eigen3::Eigen - The header-only Eigen library
#
# This module reads hints about search locations from
# the following environment variables:
#
# EIGEN3_ROOT
# EIGEN3_ROOT_DIR
# Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>
# Copyright (c) 2008, 2009 Gael Guennebaud, <g.gael@free.fr>
# Copyright (c) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>
# Redistribution and use is allowed according to the terms of the 2-clause BSD license.
if(NOT Eigen3_FIND_VERSION)
if(NOT Eigen3_FIND_VERSION_MAJOR)
set(Eigen3_FIND_VERSION_MAJOR 2)
endif()
if(NOT Eigen3_FIND_VERSION_MINOR)
set(Eigen3_FIND_VERSION_MINOR 91)
endif()
if(NOT Eigen3_FIND_VERSION_PATCH)
set(Eigen3_FIND_VERSION_PATCH 0)
endif()
set(Eigen3_FIND_VERSION "${Eigen3_FIND_VERSION_MAJOR}.${Eigen3_FIND_VERSION_MINOR}.${Eigen3_FIND_VERSION_PATCH}")
endif()
macro(_eigen3_check_version)
file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen3_version_header)
string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen3_world_version_match "${_eigen3_version_header}")
set(EIGEN3_WORLD_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen3_major_version_match "${_eigen3_version_header}")
set(EIGEN3_MAJOR_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen3_minor_version_match "${_eigen3_version_header}")
set(EIGEN3_MINOR_VERSION "${CMAKE_MATCH_1}")
set(EIGEN3_VERSION ${EIGEN3_WORLD_VERSION}.${EIGEN3_MAJOR_VERSION}.${EIGEN3_MINOR_VERSION})
if(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
set(EIGEN3_VERSION_OK FALSE)
else()
set(EIGEN3_VERSION_OK TRUE)
endif()
if(NOT EIGEN3_VERSION_OK)
message(STATUS "Eigen3 version ${EIGEN3_VERSION} found in ${EIGEN3_INCLUDE_DIR}, "
"but at least version ${Eigen3_FIND_VERSION} is required")
endif()
endmacro()
if (EIGEN3_INCLUDE_DIR)
# in cache already
_eigen3_check_version()
set(EIGEN3_FOUND ${EIGEN3_VERSION_OK})
set(Eigen3_FOUND ${EIGEN3_VERSION_OK})
else ()
# search first if an Eigen3Config.cmake is available in the system,
# if successful this would set EIGEN3_INCLUDE_DIR and the rest of
# the script will work as usual
find_package(Eigen3 ${Eigen3_FIND_VERSION} NO_MODULE QUIET)
if(NOT EIGEN3_INCLUDE_DIR)
find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library
HINTS
ENV EIGEN3_ROOT
ENV EIGEN3_ROOT_DIR
PATHS
${CMAKE_INSTALL_PREFIX}/include
${KDE4_INCLUDE_DIR}
PATH_SUFFIXES eigen3 eigen
)
endif()
if(EIGEN3_INCLUDE_DIR)
_eigen3_check_version()
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Eigen3 DEFAULT_MSG EIGEN3_INCLUDE_DIR EIGEN3_VERSION_OK)
mark_as_advanced(EIGEN3_INCLUDE_DIR)
endif()
if(EIGEN3_FOUND AND NOT TARGET Eigen3::Eigen)
add_library(Eigen3::Eigen INTERFACE IMPORTED)
set_target_properties(Eigen3::Eigen PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${EIGEN3_INCLUDE_DIR}")
endif()

View File

@@ -0,0 +1,120 @@
# - Find the FFTW library
#
# Usage:
# find_package(FFTW [REQUIRED] [QUIET] )
#
# It sets the following variables:
# FFTW_FOUND ... true if fftw is found on the system
# FFTW_LIBRARIES ... full path to fftw library
# FFTW_INCLUDES ... fftw include directory
#
# The following variables will be checked by the function
# FFTW_USE_STATIC_LIBS ... if true, only static libraries are found
# FFTW_ROOT ... if set, the libraries are exclusively searched
# under this path
# FFTW_LIBRARY ... fftw library to use
# FFTW_INCLUDE_DIR ... fftw include directory
#
#If environment variable FFTWDIR is specified, it has same effect as FFTW_ROOT
if( NOT FFTW_ROOT AND ENV{FFTWDIR} )
set( FFTW_ROOT $ENV{FFTWDIR} )
endif()
# Check if we can use PkgConfig
include(CMakeFindDependencyMacro)
find_dependency(PkgConfig)
#Determine from PKG
if( PKG_CONFIG_FOUND AND NOT FFTW_ROOT )
pkg_check_modules( PKG_FFTW QUIET "fftw3" )
endif()
#Check whether to search static or dynamic libs
set( CMAKE_FIND_LIBRARY_SUFFIXES_SAV ${CMAKE_FIND_LIBRARY_SUFFIXES} )
if( ${FFTW_USE_STATIC_LIBS} )
set( CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX} )
else()
set( CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_LIBRARY_SUFFIX} )
endif()
if( FFTW_ROOT )
#find libs
find_library(
FFTW_LIB
NAMES "fftw3"
PATHS ${FFTW_ROOT}
PATH_SUFFIXES "lib" "lib64"
NO_DEFAULT_PATH
)
find_library(
FFTWF_LIB
NAMES "fftw3f"
PATHS ${FFTW_ROOT}
PATH_SUFFIXES "lib" "lib64"
NO_DEFAULT_PATH
)
find_library(
FFTWL_LIB
NAMES "fftw3l"
PATHS ${FFTW_ROOT}
PATH_SUFFIXES "lib" "lib64"
NO_DEFAULT_PATH
)
#find includes
find_path(
FFTW_INCLUDES
NAMES "fftw3.h"
PATHS ${FFTW_ROOT}
PATH_SUFFIXES "include"
NO_DEFAULT_PATH
)
else()
find_library(
FFTW_LIB
NAMES "fftw3"
PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR}
)
find_library(
FFTWF_LIB
NAMES "fftw3f"
PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR}
)
find_library(
FFTWL_LIB
NAMES "fftw3l"
PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR}
)
find_path(
FFTW_INCLUDES
NAMES "fftw3.h"
PATHS ${PKG_FFTW_INCLUDE_DIRS} ${INCLUDE_INSTALL_DIR}
)
endif()
set(FFTW_LIBRARIES ${FFTW_LIB} ${FFTWF_LIB})
if(FFTWL_LIB)
set(FFTW_LIBRARIES ${FFTW_LIBRARIES} ${FFTWL_LIB})
endif()
set( CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_SAV} )
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(FFTW DEFAULT_MSG
FFTW_INCLUDES FFTW_LIBRARIES)
mark_as_advanced(FFTW_INCLUDES FFTW_LIBRARIES FFTW_LIB FFTWF_LIB FFTWL_LIB)

View File

@@ -0,0 +1,105 @@
# Copyright (c) 2009 Boudewijn Rempt <boud@valdyas.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
# - try to find glew library and include files
# GLEW_INCLUDE_DIR, where to find GL/glew.h, etc.
# GLEW_LIBRARIES, the libraries to link against
# GLEW_FOUND, If false, do not try to use GLEW.
# Also defined, but not for general use are:
# GLEW_GLEW_LIBRARY = the full path to the glew library.
if (WIN32)
if(CYGWIN)
find_path( GLEW_INCLUDE_DIR GL/glew.h)
find_library( GLEW_GLEW_LIBRARY glew32
${OPENGL_LIBRARY_DIR}
/usr/lib/w32api
/usr/X11R6/lib
)
else(CYGWIN)
find_path( GLEW_INCLUDE_DIR GL/glew.h
$ENV{GLEW_ROOT_PATH}/include
)
find_library( GLEW_GLEW_LIBRARY
NAMES glew glew32
PATHS
$ENV{GLEW_ROOT_PATH}/lib
${OPENGL_LIBRARY_DIR}
)
endif(CYGWIN)
else (WIN32)
if (APPLE)
# These values for Apple could probably do with improvement.
find_path( GLEW_INCLUDE_DIR glew.h
/System/Library/Frameworks/GLEW.framework/Versions/A/Headers
${OPENGL_LIBRARY_DIR}
)
set(GLEW_GLEW_LIBRARY "-framework GLEW" CACHE STRING "GLEW library for OSX")
set(GLEW_cocoa_LIBRARY "-framework Cocoa" CACHE STRING "Cocoa framework for OSX")
else (APPLE)
find_path( GLEW_INCLUDE_DIR GL/glew.h
/usr/include/GL
/usr/openwin/share/include
/usr/openwin/include
/usr/X11R6/include
/usr/include/X11
/opt/graphics/OpenGL/include
/opt/graphics/OpenGL/contrib/libglew
)
find_library( GLEW_GLEW_LIBRARY GLEW
/usr/openwin/lib
/usr/X11R6/lib
)
endif (APPLE)
endif (WIN32)
set( GLEW_FOUND "NO" )
if(GLEW_INCLUDE_DIR)
if(GLEW_GLEW_LIBRARY)
# Is -lXi and -lXmu required on all platforms that have it?
# If not, we need some way to figure out what platform we are on.
set( GLEW_LIBRARIES
${GLEW_GLEW_LIBRARY}
${GLEW_cocoa_LIBRARY}
)
set( GLEW_FOUND "YES" )
#The following deprecated settings are for backwards compatibility with CMake1.4
set (GLEW_LIBRARY ${GLEW_LIBRARIES})
set (GLEW_INCLUDE_PATH ${GLEW_INCLUDE_DIR})
endif(GLEW_GLEW_LIBRARY)
endif(GLEW_INCLUDE_DIR)
if(GLEW_FOUND)
if(NOT GLEW_FIND_QUIETLY)
message(STATUS "Found Glew: ${GLEW_LIBRARIES}")
endif(NOT GLEW_FIND_QUIETLY)
else(GLEW_FOUND)
if(GLEW_FIND_REQUIRED)
message(FATAL_ERROR "Could not find Glew")
endif(GLEW_FIND_REQUIRED)
endif(GLEW_FOUND)
mark_as_advanced(
GLEW_INCLUDE_DIR
GLEW_GLEW_LIBRARY
GLEW_Xmu_LIBRARY
GLEW_Xi_LIBRARY
)

View File

@@ -0,0 +1,21 @@
# Try to find the GNU Multiple Precision Arithmetic Library (GMP)
# See http://gmplib.org/
if (GMP_INCLUDES AND GMP_LIBRARIES)
set(GMP_FIND_QUIETLY TRUE)
endif ()
find_path(GMP_INCLUDES
NAMES
gmp.h
PATHS
$ENV{GMPDIR}
${INCLUDE_INSTALL_DIR}
)
find_library(GMP_LIBRARIES gmp PATHS $ENV{GMPDIR} ${LIB_INSTALL_DIR})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GMP DEFAULT_MSG
GMP_INCLUDES GMP_LIBRARIES)
mark_as_advanced(GMP_INCLUDES GMP_LIBRARIES)

View File

@@ -0,0 +1,170 @@
# Try to find gnu scientific library GSL
# See
# http://www.gnu.org/software/gsl/ and
# http://gnuwin32.sourceforge.net/packages/gsl.htm
#
# Once run this will define:
#
# GSL_FOUND = system has GSL lib
#
# GSL_LIBRARIES = full path to the libraries
# on Unix/Linux with additional linker flags from "gsl-config --libs"
#
# CMAKE_GSL_CXX_FLAGS = Unix compiler flags for GSL, essentially "`gsl-config --cxxflags`"
#
# GSL_INCLUDE_DIR = where to find headers
#
# GSL_LINK_DIRECTORIES = link directories, useful for rpath on Unix
# GSL_EXE_LINKER_FLAGS = rpath on Unix
#
# Felix Woelk 07/2004
# Jan Woetzel
#
# www.mip.informatik.uni-kiel.de
# --------------------------------
if(WIN32)
# JW tested with gsl-1.8, Windows XP, MSVS 7.1
set(GSL_POSSIBLE_ROOT_DIRS
${GSL_ROOT_DIR}
$ENV{GSL_ROOT_DIR}
${GSL_DIR}
${GSL_HOME}
$ENV{GSL_DIR}
$ENV{GSL_HOME}
$ENV{EXTRA}
"C:/Program Files/GnuWin32"
)
find_path(GSL_INCLUDE_DIR
NAMES gsl/gsl_cdf.h gsl/gsl_randist.h
PATHS ${GSL_POSSIBLE_ROOT_DIRS}
PATH_SUFFIXES include
DOC "GSL header include dir"
)
find_library(GSL_GSL_LIBRARY
NAMES libgsl.dll.a gsl libgsl
PATHS ${GSL_POSSIBLE_ROOT_DIRS}
PATH_SUFFIXES lib
DOC "GSL library" )
if(NOT GSL_GSL_LIBRARY)
find_file(GSL_GSL_LIBRARY
NAMES libgsl.dll.a
PATHS ${GSL_POSSIBLE_ROOT_DIRS}
PATH_SUFFIXES lib
DOC "GSL library")
endif()
find_library(GSL_GSLCBLAS_LIBRARY
NAMES libgslcblas.dll.a gslcblas libgslcblas
PATHS ${GSL_POSSIBLE_ROOT_DIRS}
PATH_SUFFIXES lib
DOC "GSL cblas library dir" )
if(NOT GSL_GSLCBLAS_LIBRARY)
find_file(GSL_GSLCBLAS_LIBRARY
NAMES libgslcblas.dll.a
PATHS ${GSL_POSSIBLE_ROOT_DIRS}
PATH_SUFFIXES lib
DOC "GSL library")
endif()
set(GSL_LIBRARIES ${GSL_GSL_LIBRARY})
#message("DBG\n"
# "GSL_GSL_LIBRARY=${GSL_GSL_LIBRARY}\n"
# "GSL_GSLCBLAS_LIBRARY=${GSL_GSLCBLAS_LIBRARY}\n"
# "GSL_LIBRARIES=${GSL_LIBRARIES}")
else(WIN32)
if(UNIX)
set(GSL_CONFIG_PREFER_PATH
"$ENV{GSL_DIR}/bin"
"$ENV{GSL_DIR}"
"$ENV{GSL_HOME}/bin"
"$ENV{GSL_HOME}"
CACHE STRING "preferred path to GSL (gsl-config)")
find_program(GSL_CONFIG gsl-config
${GSL_CONFIG_PREFER_PATH}
/usr/bin/
)
# message("DBG GSL_CONFIG ${GSL_CONFIG}")
if (GSL_CONFIG)
# set CXXFLAGS to be fed into CXX_FLAGS by the user:
set(GSL_CXX_FLAGS "`${GSL_CONFIG} --cflags`")
# set INCLUDE_DIRS to prefix+include
exec_program(${GSL_CONFIG}
ARGS --prefix
OUTPUT_VARIABLE GSL_PREFIX)
set(GSL_INCLUDE_DIR ${GSL_PREFIX}/include CACHE STRING INTERNAL)
# set link libraries and link flags
#set(GSL_LIBRARIES "`${GSL_CONFIG} --libs`")
exec_program(${GSL_CONFIG}
ARGS --libs
OUTPUT_VARIABLE GSL_LIBRARIES )
# extract link dirs for rpath
exec_program(${GSL_CONFIG}
ARGS --libs
OUTPUT_VARIABLE GSL_CONFIG_LIBS )
# extract version
exec_program(${GSL_CONFIG}
ARGS --version
OUTPUT_VARIABLE GSL_FULL_VERSION )
# split version as major/minor
string(REGEX MATCH "(.)\\..*" GSL_VERSION_MAJOR_ "${GSL_FULL_VERSION}")
set(GSL_VERSION_MAJOR ${CMAKE_MATCH_1})
string(REGEX MATCH ".\\.(.*)" GSL_VERSION_MINOR_ "${GSL_FULL_VERSION}")
set(GSL_VERSION_MINOR ${CMAKE_MATCH_1})
# split off the link dirs (for rpath)
# use regular expression to match wildcard equivalent "-L*<endchar>"
# with <endchar> is a space or a semicolon
string(REGEX MATCHALL "[-][L]([^ ;])+"
GSL_LINK_DIRECTORIES_WITH_PREFIX
"${GSL_CONFIG_LIBS}" )
# message("DBG GSL_LINK_DIRECTORIES_WITH_PREFIX=${GSL_LINK_DIRECTORIES_WITH_PREFIX}")
# remove prefix -L because we need the pure directory for LINK_DIRECTORIES
if (GSL_LINK_DIRECTORIES_WITH_PREFIX)
string(REGEX REPLACE "[-][L]" "" GSL_LINK_DIRECTORIES ${GSL_LINK_DIRECTORIES_WITH_PREFIX} )
endif (GSL_LINK_DIRECTORIES_WITH_PREFIX)
set(GSL_EXE_LINKER_FLAGS "-Wl,-rpath,${GSL_LINK_DIRECTORIES}" CACHE STRING INTERNAL)
# message("DBG GSL_LINK_DIRECTORIES=${GSL_LINK_DIRECTORIES}")
# message("DBG GSL_EXE_LINKER_FLAGS=${GSL_EXE_LINKER_FLAGS}")
# add_definitions("-DHAVE_GSL")
# set(GSL_DEFINITIONS "-DHAVE_GSL")
mark_as_advanced(
GSL_CXX_FLAGS
GSL_INCLUDE_DIR
GSL_LIBRARIES
GSL_LINK_DIRECTORIES
GSL_DEFINITIONS
)
message(STATUS "Using GSL from ${GSL_PREFIX}")
else(GSL_CONFIG)
message("FindGSL.cmake: gsl-config not found. Please set it manually. GSL_CONFIG=${GSL_CONFIG}")
endif(GSL_CONFIG)
endif(UNIX)
endif(WIN32)
if(GSL_LIBRARIES)
if(GSL_INCLUDE_DIR OR GSL_CXX_FLAGS)
set(GSL_FOUND 1)
endif(GSL_INCLUDE_DIR OR GSL_CXX_FLAGS)
endif(GSL_LIBRARIES)

View File

@@ -0,0 +1,23 @@
if (GOOGLEHASH_INCLUDES AND GOOGLEHASH_LIBRARIES)
set(GOOGLEHASH_FIND_QUIETLY TRUE)
endif ()
find_path(GOOGLEHASH_INCLUDES
NAMES
google/dense_hash_map
PATHS
${INCLUDE_INSTALL_DIR}
)
if(GOOGLEHASH_INCLUDES)
# let's make sure it compiles with the current compiler
file(WRITE ${CMAKE_BINARY_DIR}/googlehash_test.cpp
"#include <google/sparse_hash_map>\n#include <google/dense_hash_map>\nint main(int argc, char** argv) { google::dense_hash_map<int,float> a; google::sparse_hash_map<int,float> b; return 0;}\n")
try_compile(GOOGLEHASH_COMPILE ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/googlehash_test.cpp OUTPUT_VARIABLE GOOGLEHASH_COMPILE_RESULT)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GoogleHash DEFAULT_MSG GOOGLEHASH_INCLUDES GOOGLEHASH_COMPILE)
mark_as_advanced(GOOGLEHASH_INCLUDES)

View File

@@ -0,0 +1,332 @@
###
#
# @copyright (c) 2009-2014 The University of Tennessee and The University
# of Tennessee Research Foundation.
# All rights reserved.
# @copyright (c) 2012-2014 Inria. All rights reserved.
# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
#
###
#
# - Find HWLOC include dirs and libraries
# Use this module by invoking find_package with the form:
# find_package(HWLOC
# [REQUIRED]) # Fail with error if hwloc is not found
#
# This module finds headers and hwloc library.
# Results are reported in variables:
# HWLOC_FOUND - True if headers and requested libraries were found
# HWLOC_INCLUDE_DIRS - hwloc include directories
# HWLOC_LIBRARY_DIRS - Link directories for hwloc libraries
# HWLOC_LIBRARIES - hwloc component libraries to be linked
#
# The user can give specific paths where to find the libraries adding cmake
# options at configure (ex: cmake path/to/project -DHWLOC_DIR=path/to/hwloc):
# HWLOC_DIR - Where to find the base directory of hwloc
# HWLOC_INCDIR - Where to find the header files
# HWLOC_LIBDIR - Where to find the library files
# The module can also look for the following environment variables if paths
# are not given as cmake variable: HWLOC_DIR, HWLOC_INCDIR, HWLOC_LIBDIR
#=============================================================================
# Copyright 2012-2013 Inria
# Copyright 2012-2013 Emmanuel Agullo
# Copyright 2012-2013 Mathieu Faverge
# Copyright 2012 Cedric Castagnede
# Copyright 2013 Florent Pruvost
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file MORSE-Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of Morse, substitute the full
# License text for the above reference.)
include(CheckStructHasMember)
include(CheckCSourceCompiles)
if (NOT HWLOC_FOUND)
set(HWLOC_DIR "" CACHE PATH "Installation directory of HWLOC library")
if (NOT HWLOC_FIND_QUIETLY)
message(STATUS "A cache variable, namely HWLOC_DIR, has been set to specify the install directory of HWLOC")
endif()
endif()
set(ENV_HWLOC_DIR "$ENV{HWLOC_DIR}")
set(ENV_HWLOC_INCDIR "$ENV{HWLOC_INCDIR}")
set(ENV_HWLOC_LIBDIR "$ENV{HWLOC_LIBDIR}")
set(HWLOC_GIVEN_BY_USER "FALSE")
if ( HWLOC_DIR OR ( HWLOC_INCDIR AND HWLOC_LIBDIR) OR ENV_HWLOC_DIR OR (ENV_HWLOC_INCDIR AND ENV_HWLOC_LIBDIR) )
set(HWLOC_GIVEN_BY_USER "TRUE")
endif()
# Optionally use pkg-config to detect include/library dirs (if pkg-config is available)
# -------------------------------------------------------------------------------------
include(CMakeFindDependencyMacro)
# include(FindPkgConfig)
find_dependency(PkgConfig QUIET)
if( PKG_CONFIG_EXECUTABLE AND NOT HWLOC_GIVEN_BY_USER )
pkg_search_module(HWLOC hwloc)
if (NOT HWLOC_FIND_QUIETLY)
if (HWLOC_FOUND AND HWLOC_LIBRARIES)
message(STATUS "Looking for HWLOC - found using PkgConfig")
#if(NOT HWLOC_INCLUDE_DIRS)
# message("${Magenta}HWLOC_INCLUDE_DIRS is empty using PkgConfig."
# "Perhaps the path to hwloc headers is already present in your"
# "C(PLUS)_INCLUDE_PATH environment variable.${ColourReset}")
#endif()
else()
message(STATUS "${Magenta}Looking for HWLOC - not found using PkgConfig."
"\n Perhaps you should add the directory containing hwloc.pc to"
"\n the PKG_CONFIG_PATH environment variable.${ColourReset}")
endif()
endif()
endif()
if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT HWLOC_FOUND) OR (HWLOC_GIVEN_BY_USER) )
if (NOT HWLOC_FIND_QUIETLY)
message(STATUS "Looking for HWLOC - PkgConfig not used")
endif()
# Looking for include
# -------------------
# Add system include paths to search include
# ------------------------------------------
unset(_inc_env)
if(ENV_HWLOC_INCDIR)
list(APPEND _inc_env "${ENV_HWLOC_INCDIR}")
elseif(ENV_HWLOC_DIR)
list(APPEND _inc_env "${ENV_HWLOC_DIR}")
list(APPEND _inc_env "${ENV_HWLOC_DIR}/include")
list(APPEND _inc_env "${ENV_HWLOC_DIR}/include/hwloc")
else()
if(WIN32)
string(REPLACE ":" ";" _inc_env "$ENV{INCLUDE}")
else()
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{CPATH}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}")
list(APPEND _inc_env "${_path_env}")
endif()
endif()
list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}")
list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}")
list(REMOVE_DUPLICATES _inc_env)
# set paths where to look for
set(PATH_TO_LOOK_FOR "${_inc_env}")
# Try to find the hwloc header in the given paths
# -------------------------------------------------
# call cmake macro to find the header path
if(HWLOC_INCDIR)
set(HWLOC_hwloc.h_DIRS "HWLOC_hwloc.h_DIRS-NOTFOUND")
find_path(HWLOC_hwloc.h_DIRS
NAMES hwloc.h
HINTS ${HWLOC_INCDIR})
else()
if(HWLOC_DIR)
set(HWLOC_hwloc.h_DIRS "HWLOC_hwloc.h_DIRS-NOTFOUND")
find_path(HWLOC_hwloc.h_DIRS
NAMES hwloc.h
HINTS ${HWLOC_DIR}
PATH_SUFFIXES "include" "include/hwloc")
else()
set(HWLOC_hwloc.h_DIRS "HWLOC_hwloc.h_DIRS-NOTFOUND")
find_path(HWLOC_hwloc.h_DIRS
NAMES hwloc.h
HINTS ${PATH_TO_LOOK_FOR}
PATH_SUFFIXES "hwloc")
endif()
endif()
mark_as_advanced(HWLOC_hwloc.h_DIRS)
# Add path to cmake variable
# ------------------------------------
if (HWLOC_hwloc.h_DIRS)
set(HWLOC_INCLUDE_DIRS "${HWLOC_hwloc.h_DIRS}")
else ()
set(HWLOC_INCLUDE_DIRS "HWLOC_INCLUDE_DIRS-NOTFOUND")
if(NOT HWLOC_FIND_QUIETLY)
message(STATUS "Looking for hwloc -- hwloc.h not found")
endif()
endif ()
if (HWLOC_INCLUDE_DIRS)
list(REMOVE_DUPLICATES HWLOC_INCLUDE_DIRS)
endif ()
# Looking for lib
# ---------------
# Add system library paths to search lib
# --------------------------------------
unset(_lib_env)
if(ENV_HWLOC_LIBDIR)
list(APPEND _lib_env "${ENV_HWLOC_LIBDIR}")
elseif(ENV_HWLOC_DIR)
list(APPEND _lib_env "${ENV_HWLOC_DIR}")
list(APPEND _lib_env "${ENV_HWLOC_DIR}/lib")
else()
if(WIN32)
string(REPLACE ":" ";" _lib_env "$ENV{LIB}")
else()
if(APPLE)
string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}")
else()
string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}")
endif()
list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")
list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
endif()
endif()
list(REMOVE_DUPLICATES _lib_env)
# set paths where to look for
set(PATH_TO_LOOK_FOR "${_lib_env}")
# Try to find the hwloc lib in the given paths
# ----------------------------------------------
# call cmake macro to find the lib path
if(HWLOC_LIBDIR)
set(HWLOC_hwloc_LIBRARY "HWLOC_hwloc_LIBRARY-NOTFOUND")
find_library(HWLOC_hwloc_LIBRARY
NAMES hwloc
HINTS ${HWLOC_LIBDIR})
else()
if(HWLOC_DIR)
set(HWLOC_hwloc_LIBRARY "HWLOC_hwloc_LIBRARY-NOTFOUND")
find_library(HWLOC_hwloc_LIBRARY
NAMES hwloc
HINTS ${HWLOC_DIR}
PATH_SUFFIXES lib lib32 lib64)
else()
set(HWLOC_hwloc_LIBRARY "HWLOC_hwloc_LIBRARY-NOTFOUND")
find_library(HWLOC_hwloc_LIBRARY
NAMES hwloc
HINTS ${PATH_TO_LOOK_FOR})
endif()
endif()
mark_as_advanced(HWLOC_hwloc_LIBRARY)
# If found, add path to cmake variable
# ------------------------------------
if (HWLOC_hwloc_LIBRARY)
get_filename_component(hwloc_lib_path ${HWLOC_hwloc_LIBRARY} PATH)
# set cmake variables (respects naming convention)
set(HWLOC_LIBRARIES "${HWLOC_hwloc_LIBRARY}")
set(HWLOC_LIBRARY_DIRS "${hwloc_lib_path}")
else ()
set(HWLOC_LIBRARIES "HWLOC_LIBRARIES-NOTFOUND")
set(HWLOC_LIBRARY_DIRS "HWLOC_LIBRARY_DIRS-NOTFOUND")
if(NOT HWLOC_FIND_QUIETLY)
message(STATUS "Looking for hwloc -- lib hwloc not found")
endif()
endif ()
if (HWLOC_LIBRARY_DIRS)
list(REMOVE_DUPLICATES HWLOC_LIBRARY_DIRS)
endif ()
# check a function to validate the find
if(HWLOC_LIBRARIES)
set(REQUIRED_INCDIRS)
set(REQUIRED_LIBDIRS)
set(REQUIRED_LIBS)
# HWLOC
if (HWLOC_INCLUDE_DIRS)
set(REQUIRED_INCDIRS "${HWLOC_INCLUDE_DIRS}")
endif()
if (HWLOC_LIBRARY_DIRS)
set(REQUIRED_LIBDIRS "${HWLOC_LIBRARY_DIRS}")
endif()
set(REQUIRED_LIBS "${HWLOC_LIBRARIES}")
# set required libraries for link
set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
set(CMAKE_REQUIRED_LIBRARIES)
foreach(lib_dir ${REQUIRED_LIBDIRS})
list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
endforeach()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}")
string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
# test link
unset(HWLOC_WORKS CACHE)
include(CheckFunctionExists)
check_function_exists(hwloc_topology_init HWLOC_WORKS)
mark_as_advanced(HWLOC_WORKS)
if(NOT HWLOC_WORKS)
if(NOT HWLOC_FIND_QUIETLY)
message(STATUS "Looking for hwloc : test of hwloc_topology_init with hwloc library fails")
message(STATUS "CMAKE_REQUIRED_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}")
message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}")
message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
endif()
endif()
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_FLAGS)
set(CMAKE_REQUIRED_LIBRARIES)
endif()
endif()
if (HWLOC_LIBRARIES)
if (HWLOC_LIBRARY_DIRS)
list(GET HWLOC_LIBRARY_DIRS 0 first_lib_path)
else()
list(GET HWLOC_LIBRARIES 0 first_lib)
get_filename_component(first_lib_path "${first_lib}" PATH)
endif()
if (${first_lib_path} MATCHES "/lib(32|64)?$")
string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}")
set(HWLOC_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of HWLOC library" FORCE)
else()
set(HWLOC_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of HWLOC library" FORCE)
endif()
endif()
mark_as_advanced(HWLOC_DIR)
mark_as_advanced(HWLOC_DIR_FOUND)
# check that HWLOC has been found
# -------------------------------
include(FindPackageHandleStandardArgs)
if (PKG_CONFIG_EXECUTABLE AND HWLOC_FOUND)
find_package_handle_standard_args(HWLOC DEFAULT_MSG
HWLOC_LIBRARIES)
else()
find_package_handle_standard_args(HWLOC DEFAULT_MSG
HWLOC_LIBRARIES
HWLOC_WORKS)
endif()
if (HWLOC_FOUND)
set(HWLOC_SAVE_CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES})
list(APPEND CMAKE_REQUIRED_INCLUDES ${HWLOC_INCLUDE_DIRS})
# test headers to guess the version
check_struct_has_member( "struct hwloc_obj" parent hwloc.h HAVE_HWLOC_PARENT_MEMBER )
check_struct_has_member( "struct hwloc_cache_attr_s" size hwloc.h HAVE_HWLOC_CACHE_ATTR )
check_c_source_compiles( "#include <hwloc.h>
int main(void) { hwloc_obj_t o; o->type = HWLOC_OBJ_PU; return 0;}" HAVE_HWLOC_OBJ_PU)
include(CheckLibraryExists)
check_library_exists(${HWLOC_LIBRARIES} hwloc_bitmap_free "" HAVE_HWLOC_BITMAP)
set(CMAKE_REQUIRED_INCLUDES ${HWLOC_SAVE_CMAKE_REQUIRED_INCLUDES})
endif()

View File

@@ -0,0 +1,48 @@
# KLU lib usually requires linking to a blas library.
# It is up to the user of this module to find a BLAS and link to it.
if (KLU_INCLUDES AND KLU_LIBRARIES)
set(KLU_FIND_QUIETLY TRUE)
endif ()
find_path(KLU_INCLUDES
NAMES
klu.h
PATHS
$ENV{KLUDIR}
${INCLUDE_INSTALL_DIR}
PATH_SUFFIXES
suitesparse
ufsparse
)
find_library(KLU_LIBRARIES klu PATHS $ENV{KLUDIR} ${LIB_INSTALL_DIR})
if(KLU_LIBRARIES)
if(NOT KLU_LIBDIR)
get_filename_component(KLU_LIBDIR ${KLU_LIBRARIES} PATH)
endif()
find_library(COLAMD_LIBRARY colamd PATHS ${KLU_LIBDIR} $ENV{KLUDIR} ${LIB_INSTALL_DIR})
if(COLAMD_LIBRARY)
set(KLU_LIBRARIES ${KLU_LIBRARIES} ${COLAMD_LIBRARY})
endif ()
find_library(AMD_LIBRARY amd PATHS ${KLU_LIBDIR} $ENV{KLUDIR} ${LIB_INSTALL_DIR})
if(AMD_LIBRARY)
set(KLU_LIBRARIES ${KLU_LIBRARIES} ${AMD_LIBRARY})
endif ()
find_library(BTF_LIBRARY btf PATHS $ENV{KLU_LIBDIR} $ENV{KLUDIR} ${LIB_INSTALL_DIR})
if(BTF_LIBRARY)
set(KLU_LIBRARIES ${KLU_LIBRARIES} ${BTF_LIBRARY})
endif()
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(KLU DEFAULT_MSG
KLU_INCLUDES KLU_LIBRARIES)
mark_as_advanced(KLU_INCLUDES KLU_LIBRARIES AMD_LIBRARY COLAMD_LIBRARY BTF_LIBRARY)

View File

@@ -0,0 +1,274 @@
# Find LAPACK library
#
# This module finds an installed library that implements the LAPACK
# linear-algebra interface (see http://www.netlib.org/lapack/).
# The approach follows mostly that taken for the autoconf macro file, acx_lapack.m4
# (distributed at http://ac-archive.sourceforge.net/ac-archive/acx_lapack.html).
#
# This module sets the following variables:
# LAPACK_FOUND - set to true if a library implementing the LAPACK interface
# is found
# LAPACK_INCLUDE_DIR - Directories containing the LAPACK header files
# LAPACK_DEFINITIONS - Compilation options to use LAPACK
# LAPACK_LINKER_FLAGS - Linker flags to use LAPACK (excluding -l
# and -L).
# LAPACK_LIBRARIES_DIR - Directories containing the LAPACK libraries.
# May be null if LAPACK_LIBRARIES contains libraries name using full path.
# LAPACK_LIBRARIES - List of libraries to link against LAPACK interface.
# May be null if the compiler supports auto-link (e.g. VC++).
# LAPACK_USE_FILE - The name of the cmake module to include to compile
# applications or libraries using LAPACK.
#
# This module was modified by CGAL team:
# - find libraries for a C++ compiler, instead of Fortran
# - added LAPACK_INCLUDE_DIR, LAPACK_DEFINITIONS and LAPACK_LIBRARIES_DIR
# - removed LAPACK95_LIBRARIES
include(CheckFunctionExists)
include(CMakeFindDependencyMacro)
# This macro checks for the existence of the combination of fortran libraries
# given by _list. If the combination is found, this macro checks (using the
# check_function_exists macro) whether can link against that library
# combination using the name of a routine given by _name using the linker
# flags given by _flags. If the combination of libraries is found and passes
# the link test, LIBRARIES is set to the list of complete library paths that
# have been found and DEFINITIONS to the required definitions.
# Otherwise, LIBRARIES is set to FALSE.
# N.B. _prefix is the prefix applied to the names of all cached variables that
# are generated internally and marked advanced by this macro.
macro(check_lapack_libraries DEFINITIONS LIBRARIES _prefix _name _flags _list _blas _path)
#message("DEBUG: check_lapack_libraries(${_list} in ${_path} with ${_blas})")
# Check for the existence of the libraries given by _list
set(_libraries_found TRUE)
set(_libraries_work FALSE)
set(${DEFINITIONS} "")
set(${LIBRARIES} "")
set(_combined_name)
foreach(_library ${_list})
set(_combined_name ${_combined_name}_${_library})
if(_libraries_found)
# search first in ${_path}
find_library(${_prefix}_${_library}_LIBRARY
NAMES ${_library}
PATHS ${_path} NO_DEFAULT_PATH
)
# if not found, search in environment variables and system
if ( WIN32 )
find_library(${_prefix}_${_library}_LIBRARY
NAMES ${_library}
PATHS ENV LIB
)
elseif ( APPLE )
find_library(${_prefix}_${_library}_LIBRARY
NAMES ${_library}
PATHS /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV DYLD_LIBRARY_PATH
)
else ()
find_library(${_prefix}_${_library}_LIBRARY
NAMES ${_library}
PATHS /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV LD_LIBRARY_PATH
)
endif()
mark_as_advanced(${_prefix}_${_library}_LIBRARY)
set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})
set(_libraries_found ${${_prefix}_${_library}_LIBRARY})
endif()
endforeach()
if(_libraries_found)
set(_libraries_found ${${LIBRARIES}})
endif()
# Test this combination of libraries with the Fortran/f2c interface.
# We test the Fortran interface first as it is well standardized.
if(_libraries_found AND NOT _libraries_work)
set(${DEFINITIONS} "-D${_prefix}_USE_F2C")
set(${LIBRARIES} ${_libraries_found})
# Some C++ linkers require the f2c library to link with Fortran libraries.
# I do not know which ones, thus I just add the f2c library if it is available.
find_dependency( F2C QUIET )
if ( F2C_FOUND )
set(${DEFINITIONS} ${${DEFINITIONS}} ${F2C_DEFINITIONS})
set(${LIBRARIES} ${${LIBRARIES}} ${F2C_LIBRARIES})
endif()
set(CMAKE_REQUIRED_DEFINITIONS ${${DEFINITIONS}})
set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_blas})
#message("DEBUG: CMAKE_REQUIRED_DEFINITIONS = ${CMAKE_REQUIRED_DEFINITIONS}")
#message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
# Check if function exists with f2c calling convention (ie a trailing underscore)
check_function_exists(${_name}_ ${_prefix}_${_name}_${_combined_name}_f2c_WORKS)
set(CMAKE_REQUIRED_DEFINITIONS} "")
set(CMAKE_REQUIRED_LIBRARIES "")
mark_as_advanced(${_prefix}_${_name}_${_combined_name}_f2c_WORKS)
set(_libraries_work ${${_prefix}_${_name}_${_combined_name}_f2c_WORKS})
endif()
# If not found, test this combination of libraries with a C interface.
# A few implementations (ie ACML) provide a C interface. Unfortunately, there is no standard.
if(_libraries_found AND NOT _libraries_work)
set(${DEFINITIONS} "")
set(${LIBRARIES} ${_libraries_found})
set(CMAKE_REQUIRED_DEFINITIONS "")
set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_blas})
#message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
check_function_exists(${_name} ${_prefix}_${_name}${_combined_name}_WORKS)
set(CMAKE_REQUIRED_LIBRARIES "")
mark_as_advanced(${_prefix}_${_name}${_combined_name}_WORKS)
set(_libraries_work ${${_prefix}_${_name}${_combined_name}_WORKS})
endif()
# on failure
if(NOT _libraries_work)
set(${DEFINITIONS} "")
set(${LIBRARIES} FALSE)
endif()
#message("DEBUG: ${DEFINITIONS} = ${${DEFINITIONS}}")
#message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}")
endmacro()
#
# main
#
# LAPACK requires BLAS
if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
find_dependency(BLAS)
else()
find_dependency(BLAS REQUIRED)
endif()
if (NOT BLAS_FOUND)
message(STATUS "LAPACK requires BLAS.")
set(LAPACK_FOUND FALSE)
# Is it already configured?
elseif (LAPACK_LIBRARIES_DIR OR LAPACK_LIBRARIES)
set(LAPACK_FOUND TRUE)
else()
# reset variables
set( LAPACK_INCLUDE_DIR "" )
set( LAPACK_DEFINITIONS "" )
set( LAPACK_LINKER_FLAGS "" ) # unused (yet)
set( LAPACK_LIBRARIES "" )
set( LAPACK_LIBRARIES_DIR "" )
#
# If Unix, search for LAPACK function in possible libraries
#
#intel mkl lapack?
if(NOT LAPACK_LIBRARIES)
check_lapack_libraries(
LAPACK_DEFINITIONS
LAPACK_LIBRARIES
LAPACK
cheev
""
"mkl_lapack"
"${BLAS_LIBRARIES}"
"${CGAL_TAUCS_LIBRARIES_DIR} ENV LAPACK_LIB_DIR"
)
endif()
#acml lapack?
if(NOT LAPACK_LIBRARIES)
check_lapack_libraries(
LAPACK_DEFINITIONS
LAPACK_LIBRARIES
LAPACK
cheev
""
"acml"
"${BLAS_LIBRARIES}"
"${CGAL_TAUCS_LIBRARIES_DIR} ENV LAPACK_LIB_DIR"
)
endif()
# Apple LAPACK library?
if(NOT LAPACK_LIBRARIES)
check_lapack_libraries(
LAPACK_DEFINITIONS
LAPACK_LIBRARIES
LAPACK
cheev
""
"Accelerate"
"${BLAS_LIBRARIES}"
"${CGAL_TAUCS_LIBRARIES_DIR} ENV LAPACK_LIB_DIR"
)
endif()
if ( NOT LAPACK_LIBRARIES )
check_lapack_libraries(
LAPACK_DEFINITIONS
LAPACK_LIBRARIES
LAPACK
cheev
""
"vecLib"
"${BLAS_LIBRARIES}"
"${CGAL_TAUCS_LIBRARIES_DIR} ENV LAPACK_LIB_DIR"
)
endif ()
# Generic LAPACK library?
# This configuration *must* be the last try as this library is notably slow.
if ( NOT LAPACK_LIBRARIES )
check_lapack_libraries(
LAPACK_DEFINITIONS
LAPACK_LIBRARIES
LAPACK
cheev
""
"lapack"
"${BLAS_LIBRARIES}"
"${CGAL_TAUCS_LIBRARIES_DIR} ENV LAPACK_LIB_DIR"
)
endif()
if(LAPACK_LIBRARIES_DIR OR LAPACK_LIBRARIES)
set(LAPACK_FOUND TRUE)
else()
set(LAPACK_FOUND FALSE)
endif()
if(NOT LAPACK_FIND_QUIETLY)
if(LAPACK_FOUND)
message(STATUS "A library with LAPACK API found.")
else()
if(LAPACK_FIND_REQUIRED)
message(FATAL_ERROR "A required library with LAPACK API not found. Please specify library location.")
else()
message(STATUS "A library with LAPACK API not found. Please specify library location.")
endif()
endif()
endif()
# Add variables to cache
set( LAPACK_INCLUDE_DIR "${LAPACK_INCLUDE_DIR}"
CACHE PATH "Directories containing the LAPACK header files" FORCE )
set( LAPACK_DEFINITIONS "${LAPACK_DEFINITIONS}"
CACHE STRING "Compilation options to use LAPACK" FORCE )
set( LAPACK_LINKER_FLAGS "${LAPACK_LINKER_FLAGS}"
CACHE STRING "Linker flags to use LAPACK" FORCE )
set( LAPACK_LIBRARIES "${LAPACK_LIBRARIES}"
CACHE FILEPATH "LAPACK libraries name" FORCE )
set( LAPACK_LIBRARIES_DIR "${LAPACK_LIBRARIES_DIR}"
CACHE PATH "Directories containing the LAPACK libraries" FORCE )
#message("DEBUG: LAPACK_INCLUDE_DIR = ${LAPACK_INCLUDE_DIR}")
#message("DEBUG: LAPACK_DEFINITIONS = ${LAPACK_DEFINITIONS}")
#message("DEBUG: LAPACK_LINKER_FLAGS = ${LAPACK_LINKER_FLAGS}")
#message("DEBUG: LAPACK_LIBRARIES = ${LAPACK_LIBRARIES}")
#message("DEBUG: LAPACK_LIBRARIES_DIR = ${LAPACK_LIBRARIES_DIR}")
#message("DEBUG: LAPACK_FOUND = ${LAPACK_FOUND}")
endif()

View File

@@ -0,0 +1,83 @@
# Try to find the MPFR library
# See http://www.mpfr.org/
#
# This module supports requiring a minimum version, e.g. you can do
# find_package(MPFR 2.3.0)
# to require version 2.3.0 to newer of MPFR.
#
# Once done this will define
#
# MPFR_FOUND - system has MPFR lib with correct version
# MPFR_INCLUDES - the MPFR include directory
# MPFR_LIBRARIES - the MPFR library
# MPFR_VERSION - MPFR version
# Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>
# Copyright (c) 2008, 2009 Gael Guennebaud, <g.gael@free.fr>
# Copyright (c) 2010 Jitse Niesen, <jitse@maths.leeds.ac.uk>
# Redistribution and use is allowed according to the terms of the BSD license.
# Set MPFR_INCLUDES
find_path(MPFR_INCLUDES
NAMES
mpfr.h
PATHS
$ENV{GMPDIR}
${INCLUDE_INSTALL_DIR}
)
# Set MPFR_FIND_VERSION to 1.0.0 if no minimum version is specified
if(NOT MPFR_FIND_VERSION)
if(NOT MPFR_FIND_VERSION_MAJOR)
set(MPFR_FIND_VERSION_MAJOR 1)
endif()
if(NOT MPFR_FIND_VERSION_MINOR)
set(MPFR_FIND_VERSION_MINOR 0)
endif()
if(NOT MPFR_FIND_VERSION_PATCH)
set(MPFR_FIND_VERSION_PATCH 0)
endif()
set(MPFR_FIND_VERSION "${MPFR_FIND_VERSION_MAJOR}.${MPFR_FIND_VERSION_MINOR}.${MPFR_FIND_VERSION_PATCH}")
endif()
if(MPFR_INCLUDES)
# Set MPFR_VERSION
file(READ "${MPFR_INCLUDES}/mpfr.h" _mpfr_version_header)
string(REGEX MATCH "define[ \t]+MPFR_VERSION_MAJOR[ \t]+([0-9]+)" _mpfr_major_version_match "${_mpfr_version_header}")
set(MPFR_MAJOR_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+MPFR_VERSION_MINOR[ \t]+([0-9]+)" _mpfr_minor_version_match "${_mpfr_version_header}")
set(MPFR_MINOR_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+MPFR_VERSION_PATCHLEVEL[ \t]+([0-9]+)" _mpfr_patchlevel_version_match "${_mpfr_version_header}")
set(MPFR_PATCHLEVEL_VERSION "${CMAKE_MATCH_1}")
set(MPFR_VERSION ${MPFR_MAJOR_VERSION}.${MPFR_MINOR_VERSION}.${MPFR_PATCHLEVEL_VERSION})
# Check whether found version exceeds minimum version
if(${MPFR_VERSION} VERSION_LESS ${MPFR_FIND_VERSION})
set(MPFR_VERSION_OK FALSE)
message(STATUS "MPFR version ${MPFR_VERSION} found in ${MPFR_INCLUDES}, "
"but at least version ${MPFR_FIND_VERSION} is required")
else()
set(MPFR_VERSION_OK TRUE)
endif()
endif()
# Set MPFR_LIBRARIES
find_library(MPFR_LIBRARIES mpfr PATHS $ENV{GMPDIR} ${LIB_INSTALL_DIR})
# Epilogue
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MPFR DEFAULT_MSG
MPFR_INCLUDES MPFR_LIBRARIES MPFR_VERSION_OK)
mark_as_advanced(MPFR_INCLUDES MPFR_LIBRARIES)

View File

@@ -0,0 +1,103 @@
# Try to find the MPFR C++ (MPREAL) library
# See http://www.holoborodko.com/pavel/mpreal/
#
# This module supports requiring a minimum version, e.g. you can do
# find_package(MPREAL 1.8.6)
# to require version 1.8.6 or newer of MPREAL C++.
#
# Once done this will define
#
# MPREAL_FOUND - system has MPREAL lib with correct version
# MPREAL_INCLUDES - MPREAL required include directories
# MPREAL_LIBRARIES - MPREAL required libraries
# MPREAL_VERSION - MPREAL version
# Copyright (c) 2020 The Eigen Authors.
# Redistribution and use is allowed according to the terms of the BSD license.
include(CMakeFindDependencyMacro)
find_dependency(MPFR)
find_dependency(GMP)
# Set MPREAL_INCLUDES
find_path(MPREAL_INCLUDES
NAMES
mpreal.h
PATHS
$ENV{GMPDIR}
${INCLUDE_INSTALL_DIR}
)
# Set MPREAL_FIND_VERSION to 1.0.0 if no minimum version is specified
if(NOT MPREAL_FIND_VERSION)
if(NOT MPREAL_FIND_VERSION_MAJOR)
set(MPREAL_FIND_VERSION_MAJOR 1)
endif()
if(NOT MPREAL_FIND_VERSION_MINOR)
set(MPREAL_FIND_VERSION_MINOR 0)
endif()
if(NOT MPREAL_FIND_VERSION_PATCH)
set(MPREAL_FIND_VERSION_PATCH 0)
endif()
set(MPREAL_FIND_VERSION "${MPREAL_FIND_VERSION_MAJOR}.${MPREAL_FIND_VERSION_MINOR}.${MPREAL_FIND_VERSION_PATCH}")
endif()
# Check bugs
# - https://github.com/advanpix/mpreal/issues/7
# - https://github.com/advanpix/mpreal/issues/9
set(MPREAL_TEST_PROGRAM "
#include <mpreal.h>
#include <algorithm>
int main(int argc, char** argv) {
const mpfr::mpreal one = 1.0;
const mpfr::mpreal zero = 0.0;
using namespace std;
const mpfr::mpreal smaller = min(one, zero);
return 0;
}")
if(MPREAL_INCLUDES)
# Set MPREAL_VERSION
file(READ "${MPREAL_INCLUDES}/mpreal.h" _mpreal_version_header)
string(REGEX MATCH "define[ \t]+MPREAL_VERSION_MAJOR[ \t]+([0-9]+)" _mpreal_major_version_match "${_mpreal_version_header}")
set(MPREAL_MAJOR_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+MPREAL_VERSION_MINOR[ \t]+([0-9]+)" _mpreal_minor_version_match "${_mpreal_version_header}")
set(MPREAL_MINOR_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+MPREAL_VERSION_PATCHLEVEL[ \t]+([0-9]+)" _mpreal_patchlevel_version_match "${_mpreal_version_header}")
set(MPREAL_PATCHLEVEL_VERSION "${CMAKE_MATCH_1}")
set(MPREAL_VERSION ${MPREAL_MAJOR_VERSION}.${MPREAL_MINOR_VERSION}.${MPREAL_PATCHLEVEL_VERSION})
# Check whether found version exceeds minimum version
if(${MPREAL_VERSION} VERSION_LESS ${MPREAL_FIND_VERSION})
set(MPREAL_VERSION_OK FALSE)
message(STATUS "MPREAL version ${MPREAL_VERSION} found in ${MPREAL_INCLUDES}, "
"but at least version ${MPREAL_FIND_VERSION} is required")
else()
set(MPREAL_VERSION_OK TRUE)
list(APPEND MPREAL_INCLUDES "${MPFR_INCLUDES}" "${GMP_INCLUDES}")
list(REMOVE_DUPLICATES MPREAL_INCLUDES)
list(APPEND MPREAL_LIBRARIES "${MPFR_LIBRARIES}" "${GMP_LIBRARIES}")
list(REMOVE_DUPLICATES MPREAL_LIBRARIES)
# Make sure it compiles with the current compiler.
unset(MPREAL_WORKS CACHE)
include(CheckCXXSourceCompiles)
set(CMAKE_REQUIRED_INCLUDES "${MPREAL_INCLUDES}")
set(CMAKE_REQUIRED_LIBRARIES "${MPREAL_LIBRARIES}")
check_cxx_source_compiles("${MPREAL_TEST_PROGRAM}" MPREAL_WORKS)
endif()
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MPREAL DEFAULT_MSG
MPREAL_INCLUDES MPREAL_VERSION_OK MPREAL_WORKS)
mark_as_advanced(MPREAL_INCLUDES)

View File

@@ -0,0 +1,265 @@
###
#
# @copyright (c) 2009-2014 The University of Tennessee and The University
# of Tennessee Research Foundation.
# All rights reserved.
# @copyright (c) 2012-2014 Inria. All rights reserved.
# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
#
###
#
# - Find METIS include dirs and libraries
# Use this module by invoking find_package with the form:
# find_package(METIS
# [REQUIRED] # Fail with error if metis is not found
# )
#
# This module finds headers and metis library.
# Results are reported in variables:
# METIS_FOUND - True if headers and requested libraries were found
# METIS_INCLUDE_DIRS - metis include directories
# METIS_LIBRARY_DIRS - Link directories for metis libraries
# METIS_LIBRARIES - metis component libraries to be linked
#
# The user can give specific paths where to find the libraries adding cmake
# options at configure (ex: cmake path/to/project -DMETIS_DIR=path/to/metis):
# METIS_DIR - Where to find the base directory of metis
# METIS_INCDIR - Where to find the header files
# METIS_LIBDIR - Where to find the library files
# The module can also look for the following environment variables if paths
# are not given as cmake variable: METIS_DIR, METIS_INCDIR, METIS_LIBDIR
#=============================================================================
# Copyright 2012-2013 Inria
# Copyright 2012-2013 Emmanuel Agullo
# Copyright 2012-2013 Mathieu Faverge
# Copyright 2012 Cedric Castagnede
# Copyright 2013 Florent Pruvost
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file MORSE-Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of Morse, substitute the full
# License text for the above reference.)
if (NOT METIS_FOUND)
set(METIS_DIR "" CACHE PATH "Installation directory of METIS library")
if (NOT METIS_FIND_QUIETLY)
message(STATUS "A cache variable, namely METIS_DIR, has been set to specify the install directory of METIS")
endif()
endif()
# Looking for include
# -------------------
# Add system include paths to search include
# ------------------------------------------
unset(_inc_env)
set(ENV_METIS_DIR "$ENV{METIS_DIR}")
set(ENV_METIS_INCDIR "$ENV{METIS_INCDIR}")
if(ENV_METIS_INCDIR)
list(APPEND _inc_env "${ENV_METIS_INCDIR}")
elseif(ENV_METIS_DIR)
list(APPEND _inc_env "${ENV_METIS_DIR}")
list(APPEND _inc_env "${ENV_METIS_DIR}/include")
list(APPEND _inc_env "${ENV_METIS_DIR}/include/metis")
else()
if(WIN32)
string(REPLACE ":" ";" _inc_env "$ENV{INCLUDE}")
else()
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{CPATH}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}")
list(APPEND _inc_env "${_path_env}")
endif()
endif()
list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}")
list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}")
list(REMOVE_DUPLICATES _inc_env)
# Try to find the metis header in the given paths
# -------------------------------------------------
# call cmake macro to find the header path
if(METIS_INCDIR)
set(METIS_metis.h_DIRS "METIS_metis.h_DIRS-NOTFOUND")
find_path(METIS_metis.h_DIRS
NAMES metis.h
HINTS ${METIS_INCDIR})
else()
if(METIS_DIR)
set(METIS_metis.h_DIRS "METIS_metis.h_DIRS-NOTFOUND")
find_path(METIS_metis.h_DIRS
NAMES metis.h
HINTS ${METIS_DIR}
PATH_SUFFIXES "include" "include/metis")
else()
set(METIS_metis.h_DIRS "METIS_metis.h_DIRS-NOTFOUND")
find_path(METIS_metis.h_DIRS
NAMES metis.h
HINTS ${_inc_env})
endif()
endif()
mark_as_advanced(METIS_metis.h_DIRS)
# If found, add path to cmake variable
# ------------------------------------
if (METIS_metis.h_DIRS)
set(METIS_INCLUDE_DIRS "${METIS_metis.h_DIRS}")
else ()
set(METIS_INCLUDE_DIRS "METIS_INCLUDE_DIRS-NOTFOUND")
if(NOT METIS_FIND_QUIETLY)
message(STATUS "Looking for metis -- metis.h not found")
endif()
endif()
# Looking for lib
# ---------------
# Add system library paths to search lib
# --------------------------------------
unset(_lib_env)
set(ENV_METIS_LIBDIR "$ENV{METIS_LIBDIR}")
if(ENV_METIS_LIBDIR)
list(APPEND _lib_env "${ENV_METIS_LIBDIR}")
elseif(ENV_METIS_DIR)
list(APPEND _lib_env "${ENV_METIS_DIR}")
list(APPEND _lib_env "${ENV_METIS_DIR}/lib")
else()
if(WIN32)
string(REPLACE ":" ";" _lib_env "$ENV{LIB}")
else()
if(APPLE)
string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}")
else()
string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}")
endif()
list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")
list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
endif()
endif()
list(REMOVE_DUPLICATES _lib_env)
# Try to find the metis lib in the given paths
# ----------------------------------------------
# call cmake macro to find the lib path
if(METIS_LIBDIR)
set(METIS_metis_LIBRARY "METIS_metis_LIBRARY-NOTFOUND")
find_library(METIS_metis_LIBRARY
NAMES metis
HINTS ${METIS_LIBDIR})
else()
if(METIS_DIR)
set(METIS_metis_LIBRARY "METIS_metis_LIBRARY-NOTFOUND")
find_library(METIS_metis_LIBRARY
NAMES metis
HINTS ${METIS_DIR}
PATH_SUFFIXES lib lib32 lib64)
else()
set(METIS_metis_LIBRARY "METIS_metis_LIBRARY-NOTFOUND")
find_library(METIS_metis_LIBRARY
NAMES metis
HINTS ${_lib_env})
endif()
endif()
mark_as_advanced(METIS_metis_LIBRARY)
# If found, add path to cmake variable
# ------------------------------------
if (METIS_metis_LIBRARY)
get_filename_component(metis_lib_path "${METIS_metis_LIBRARY}" PATH)
# set cmake variables
set(METIS_LIBRARIES "${METIS_metis_LIBRARY}")
set(METIS_LIBRARY_DIRS "${metis_lib_path}")
else ()
set(METIS_LIBRARIES "METIS_LIBRARIES-NOTFOUND")
set(METIS_LIBRARY_DIRS "METIS_LIBRARY_DIRS-NOTFOUND")
if(NOT METIS_FIND_QUIETLY)
message(STATUS "Looking for metis -- lib metis not found")
endif()
endif ()
# check a function to validate the find
if(METIS_LIBRARIES)
set(REQUIRED_INCDIRS)
set(REQUIRED_LIBDIRS)
set(REQUIRED_LIBS)
# METIS
if (METIS_INCLUDE_DIRS)
set(REQUIRED_INCDIRS "${METIS_INCLUDE_DIRS}")
endif()
if (METIS_LIBRARY_DIRS)
set(REQUIRED_LIBDIRS "${METIS_LIBRARY_DIRS}")
endif()
set(REQUIRED_LIBS "${METIS_LIBRARIES}")
# m
find_library(M_LIBRARY NAMES m)
mark_as_advanced(M_LIBRARY)
if(M_LIBRARY)
list(APPEND REQUIRED_LIBS "-lm")
endif()
# set required libraries for link
set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
set(CMAKE_REQUIRED_LIBRARIES)
foreach(lib_dir ${REQUIRED_LIBDIRS})
list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
endforeach()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}")
string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
# test link
unset(METIS_WORKS CACHE)
include(CheckFunctionExists)
check_function_exists(METIS_NodeND METIS_WORKS)
mark_as_advanced(METIS_WORKS)
if(NOT METIS_WORKS)
if(NOT METIS_FIND_QUIETLY)
message(STATUS "Looking for METIS : test of METIS_NodeND with METIS library fails")
message(STATUS "CMAKE_REQUIRED_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}")
message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}")
message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
endif()
endif()
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_FLAGS)
set(CMAKE_REQUIRED_LIBRARIES)
endif()
if (METIS_LIBRARIES)
list(GET METIS_LIBRARIES 0 first_lib)
get_filename_component(first_lib_path "${first_lib}" PATH)
if (${first_lib_path} MATCHES "/lib(32|64)?$")
string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}")
set(METIS_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of METIS library" FORCE)
else()
set(METIS_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of METIS library" FORCE)
endif()
endif()
mark_as_advanced(METIS_DIR)
mark_as_advanced(METIS_DIR_FOUND)
# check that METIS has been found
# ---------------------------------
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(METIS DEFAULT_MSG
METIS_LIBRARIES
METIS_WORKS
METIS_INCLUDE_DIRS)
#
# TODO: Add possibility to check for specific functions in the library
#

View File

@@ -0,0 +1,704 @@
###
#
# @copyright (c) 2009-2014 The University of Tennessee and The University
# of Tennessee Research Foundation.
# All rights reserved.
# @copyright (c) 2012-2014 Inria. All rights reserved.
# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
#
###
#
# - Find PASTIX include dirs and libraries
# Use this module by invoking find_package with the form:
# find_package(PASTIX
# [REQUIRED] # Fail with error if pastix is not found
# [COMPONENTS <comp1> <comp2> ...] # dependencies
# )
#
# PASTIX depends on the following libraries:
# - Threads, m, rt
# - MPI
# - HWLOC
# - BLAS
#
# COMPONENTS are optional libraries PASTIX could be linked with,
# Use it to drive detection of a specific compilation chain
# COMPONENTS can be some of the following:
# - MPI: to activate detection of the parallel MPI version (default)
# it looks for Threads, HWLOC, BLAS, MPI and ScaLAPACK libraries
# - SEQ: to activate detection of the sequential version (exclude MPI version)
# - STARPU: to activate detection of StarPU version
# it looks for MPI version of StarPU (default behaviour)
# if SEQ and STARPU are given, it looks for a StarPU without MPI
# - STARPU_CUDA: to activate detection of StarPU with CUDA
# - STARPU_FXT: to activate detection of StarPU with FxT
# - SCOTCH: to activate detection of PASTIX linked with SCOTCH
# - PTSCOTCH: to activate detection of PASTIX linked with SCOTCH
# - METIS: to activate detection of PASTIX linked with SCOTCH
#
# This module finds headers and pastix library.
# Results are reported in variables:
# PASTIX_FOUND - True if headers and requested libraries were found
# PASTIX_LINKER_FLAGS - list of required linker flags (excluding -l and -L)
# PASTIX_INCLUDE_DIRS - pastix include directories
# PASTIX_LIBRARY_DIRS - Link directories for pastix libraries
# PASTIX_LIBRARIES - pastix libraries
# PASTIX_INCLUDE_DIRS_DEP - pastix + dependencies include directories
# PASTIX_LIBRARY_DIRS_DEP - pastix + dependencies link directories
# PASTIX_LIBRARIES_DEP - pastix libraries + dependencies
#
# The user can give specific paths where to find the libraries adding cmake
# options at configure (ex: cmake path/to/project -DPASTIX_DIR=path/to/pastix):
# PASTIX_DIR - Where to find the base directory of pastix
# PASTIX_INCDIR - Where to find the header files
# PASTIX_LIBDIR - Where to find the library files
# The module can also look for the following environment variables if paths
# are not given as cmake variable: PASTIX_DIR, PASTIX_INCDIR, PASTIX_LIBDIR
#=============================================================================
# Copyright 2012-2013 Inria
# Copyright 2012-2013 Emmanuel Agullo
# Copyright 2012-2013 Mathieu Faverge
# Copyright 2012 Cedric Castagnede
# Copyright 2013 Florent Pruvost
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file MORSE-Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of Morse, substitute the full
# License text for the above reference.)
if (NOT PASTIX_FOUND)
set(PASTIX_DIR "" CACHE PATH "Installation directory of PASTIX library")
if (NOT PASTIX_FIND_QUIETLY)
message(STATUS "A cache variable, namely PASTIX_DIR, has been set to specify the install directory of PASTIX")
endif()
endif()
# Set the version to find
set(PASTIX_LOOK_FOR_MPI ON)
set(PASTIX_LOOK_FOR_SEQ OFF)
set(PASTIX_LOOK_FOR_STARPU OFF)
set(PASTIX_LOOK_FOR_STARPU_CUDA OFF)
set(PASTIX_LOOK_FOR_STARPU_FXT OFF)
set(PASTIX_LOOK_FOR_SCOTCH ON)
set(PASTIX_LOOK_FOR_PTSCOTCH OFF)
set(PASTIX_LOOK_FOR_METIS OFF)
if( PASTIX_FIND_COMPONENTS )
foreach( component ${PASTIX_FIND_COMPONENTS} )
if (${component} STREQUAL "SEQ")
# means we look for the sequential version of PaStiX (without MPI)
set(PASTIX_LOOK_FOR_SEQ ON)
set(PASTIX_LOOK_FOR_MPI OFF)
endif()
if (${component} STREQUAL "MPI")
# means we look for the MPI version of PaStiX (default)
set(PASTIX_LOOK_FOR_SEQ OFF)
set(PASTIX_LOOK_FOR_MPI ON)
endif()
if (${component} STREQUAL "STARPU")
# means we look for PaStiX with StarPU
set(PASTIX_LOOK_FOR_STARPU ON)
endif()
if (${component} STREQUAL "STARPU_CUDA")
# means we look for PaStiX with StarPU + CUDA
set(PASTIX_LOOK_FOR_STARPU ON)
set(PASTIX_LOOK_FOR_STARPU_CUDA ON)
endif()
if (${component} STREQUAL "STARPU_FXT")
# means we look for PaStiX with StarPU + FxT
set(PASTIX_LOOK_FOR_STARPU_FXT ON)
endif()
if (${component} STREQUAL "SCOTCH")
set(PASTIX_LOOK_FOR_SCOTCH ON)
endif()
if (${component} STREQUAL "PTSCOTCH")
set(PASTIX_LOOK_FOR_PTSCOTCH ON)
endif()
if (${component} STREQUAL "METIS")
set(PASTIX_LOOK_FOR_METIS ON)
endif()
endforeach()
endif()
# Dependencies detection
# ----------------------
# Required dependencies
# ---------------------
include(CMakeFindDependencyMacro)
if (NOT PASTIX_FIND_QUIETLY)
message(STATUS "Looking for PASTIX - Try to detect pthread")
endif()
if (PASTIX_FIND_REQUIRED)
find_dependency(Threads REQUIRED QUIET)
else()
find_dependency(Threads QUIET)
endif()
set(PASTIX_EXTRA_LIBRARIES "")
if( THREADS_FOUND )
list(APPEND PASTIX_EXTRA_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
endif ()
# Add math library to the list of extra
# it normally exists on all common systems provided with a C compiler
if (NOT PASTIX_FIND_QUIETLY)
message(STATUS "Looking for PASTIX - Try to detect libm")
endif()
set(PASTIX_M_LIBRARIES "")
if(UNIX OR WIN32)
find_library(
PASTIX_M_m_LIBRARY
NAMES m
)
mark_as_advanced(PASTIX_M_m_LIBRARY)
if (PASTIX_M_m_LIBRARY)
list(APPEND PASTIX_M_LIBRARIES "${PASTIX_M_m_LIBRARY}")
list(APPEND PASTIX_EXTRA_LIBRARIES "${PASTIX_M_m_LIBRARY}")
else()
if (PASTIX_FIND_REQUIRED)
message(FATAL_ERROR "Could NOT find libm on your system."
"Are you sure to a have a C compiler installed?")
endif()
endif()
endif()
# Try to find librt (libposix4 - POSIX.1b Realtime Extensions library)
# on Unix systems except Apple ones because it does not exist on it
if (NOT PASTIX_FIND_QUIETLY)
message(STATUS "Looking for PASTIX - Try to detect librt")
endif()
set(PASTIX_RT_LIBRARIES "")
if(UNIX AND NOT APPLE)
find_library(
PASTIX_RT_rt_LIBRARY
NAMES rt
)
mark_as_advanced(PASTIX_RT_rt_LIBRARY)
if (PASTIX_RT_rt_LIBRARY)
list(APPEND PASTIX_RT_LIBRARIES "${PASTIX_RT_rt_LIBRARY}")
list(APPEND PASTIX_EXTRA_LIBRARIES "${PASTIX_RT_rt_LIBRARY}")
else()
if (PASTIX_FIND_REQUIRED)
message(FATAL_ERROR "Could NOT find librt on your system")
endif()
endif()
endif()
# PASTIX depends on HWLOC
#------------------------
if (NOT PASTIX_FIND_QUIETLY)
message(STATUS "Looking for PASTIX - Try to detect HWLOC")
endif()
if (PASTIX_FIND_REQUIRED)
find_dependency(HWLOC REQUIRED QUIET)
else()
find_dependency(HWLOC QUIET)
endif()
# PASTIX depends on BLAS
#-----------------------
if (NOT PASTIX_FIND_QUIETLY)
message(STATUS "Looking for PASTIX - Try to detect BLAS")
endif()
if (PASTIX_FIND_REQUIRED)
find_dependency(BLASEXT REQUIRED QUIET)
else()
find_dependency(BLASEXT QUIET)
endif()
# Optional dependencies
# ---------------------
# PASTIX may depend on MPI
#-------------------------
if (NOT MPI_FOUND AND PASTIX_LOOK_FOR_MPI)
if (NOT PASTIX_FIND_QUIETLY)
message(STATUS "Looking for PASTIX - Try to detect MPI")
endif()
# allows to use an external mpi compilation by setting compilers with
# -DMPI_C_COMPILER=path/to/mpicc -DMPI_Fortran_COMPILER=path/to/mpif90
# at cmake configure
if(NOT MPI_C_COMPILER)
set(MPI_C_COMPILER mpicc)
endif()
if (PASTIX_FIND_REQUIRED AND PASTIX_FIND_REQUIRED_MPI)
find_dependency(MPI REQUIRED QUIET)
else()
find_dependency(MPI QUIET)
endif()
if (MPI_FOUND)
mark_as_advanced(MPI_LIBRARY)
mark_as_advanced(MPI_EXTRA_LIBRARY)
endif()
endif ()
# PASTIX may depend on STARPU
#----------------------------
if( NOT STARPU_FOUND AND PASTIX_LOOK_FOR_STARPU)
if (NOT PASTIX_FIND_QUIETLY)
message(STATUS "Looking for PASTIX - Try to detect StarPU")
endif()
set(PASTIX_STARPU_VERSION "1.1" CACHE STRING "oldest STARPU version desired")
# create list of components in order to make a single call to find_package(starpu...)
# we explicitly need a StarPU version built with hwloc
set(STARPU_COMPONENT_LIST "HWLOC")
# StarPU may depend on MPI
# allows to use an external mpi compilation by setting compilers with
# -DMPI_C_COMPILER=path/to/mpicc -DMPI_Fortran_COMPILER=path/to/mpif90
# at cmake configure
if (PASTIX_LOOK_FOR_MPI)
if(NOT MPI_C_COMPILER)
set(MPI_C_COMPILER mpicc)
endif()
list(APPEND STARPU_COMPONENT_LIST "MPI")
endif()
if (PASTIX_LOOK_FOR_STARPU_CUDA)
list(APPEND STARPU_COMPONENT_LIST "CUDA")
endif()
if (PASTIX_LOOK_FOR_STARPU_FXT)
list(APPEND STARPU_COMPONENT_LIST "FXT")
endif()
# set the list of optional dependencies we may discover
if (PASTIX_FIND_REQUIRED AND PASTIX_FIND_REQUIRED_STARPU)
find_dependency(STARPU ${PASTIX_STARPU_VERSION} REQUIRED
COMPONENTS ${STARPU_COMPONENT_LIST})
else()
find_dependency(STARPU ${PASTIX_STARPU_VERSION}
COMPONENTS ${STARPU_COMPONENT_LIST})
endif()
endif()
# PASTIX may depends on SCOTCH
#-----------------------------
if (NOT SCOTCH_FOUND AND PASTIX_LOOK_FOR_SCOTCH)
if (NOT PASTIX_FIND_QUIETLY)
message(STATUS "Looking for PASTIX - Try to detect SCOTCH")
endif()
if (PASTIX_FIND_REQUIRED AND PASTIX_FIND_REQUIRED_SCOTCH)
find_dependency(SCOTCH REQUIRED QUIET)
else()
find_dependency(SCOTCH QUIET)
endif()
endif()
# PASTIX may depends on PTSCOTCH
#-------------------------------
if (NOT PTSCOTCH_FOUND AND PASTIX_LOOK_FOR_PTSCOTCH)
if (NOT PASTIX_FIND_QUIETLY)
message(STATUS "Looking for PASTIX - Try to detect PTSCOTCH")
endif()
if (PASTIX_FIND_REQUIRED AND PASTIX_FIND_REQUIRED_PTSCOTCH)
find_dependency(PTSCOTCH REQUIRED QUIET)
else()
find_dependency(PTSCOTCH QUIET)
endif()
endif()
# PASTIX may depends on METIS
#----------------------------
if (NOT METIS_FOUND AND PASTIX_LOOK_FOR_METIS)
if (NOT PASTIX_FIND_QUIETLY)
message(STATUS "Looking for PASTIX - Try to detect METIS")
endif()
if (PASTIX_FIND_REQUIRED AND PASTIX_FIND_REQUIRED_METIS)
find_dependency(METIS REQUIRED QUIET)
else()
find_dependency(METIS QUIET)
endif()
endif()
# Error if pastix required and no partitioning lib found
if (PASTIX_FIND_REQUIRED AND NOT SCOTCH_FOUND AND NOT PTSCOTCH_FOUND AND NOT METIS_FOUND)
message(FATAL_ERROR "Could NOT find any partitioning library on your system"
" (install scotch, ptscotch or metis)")
endif()
# Looking for PaStiX
# ------------------
# Looking for include
# -------------------
# Add system include paths to search include
# ------------------------------------------
unset(_inc_env)
set(ENV_PASTIX_DIR "$ENV{PASTIX_DIR}")
set(ENV_PASTIX_INCDIR "$ENV{PASTIX_INCDIR}")
if(ENV_PASTIX_INCDIR)
list(APPEND _inc_env "${ENV_PASTIX_INCDIR}")
elseif(ENV_PASTIX_DIR)
list(APPEND _inc_env "${ENV_PASTIX_DIR}")
list(APPEND _inc_env "${ENV_PASTIX_DIR}/include")
list(APPEND _inc_env "${ENV_PASTIX_DIR}/include/pastix")
else()
if(WIN32)
string(REPLACE ":" ";" _inc_env "$ENV{INCLUDE}")
else()
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{CPATH}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}")
list(APPEND _inc_env "${_path_env}")
endif()
endif()
list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}")
list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}")
list(REMOVE_DUPLICATES _inc_env)
# Try to find the pastix header in the given paths
# ---------------------------------------------------
# call cmake macro to find the header path
if(PASTIX_INCDIR)
set(PASTIX_pastix.h_DIRS "PASTIX_pastix.h_DIRS-NOTFOUND")
find_path(PASTIX_pastix.h_DIRS
NAMES pastix.h
HINTS ${PASTIX_INCDIR})
else()
if(PASTIX_DIR)
set(PASTIX_pastix.h_DIRS "PASTIX_pastix.h_DIRS-NOTFOUND")
find_path(PASTIX_pastix.h_DIRS
NAMES pastix.h
HINTS ${PASTIX_DIR}
PATH_SUFFIXES "include" "include/pastix")
else()
set(PASTIX_pastix.h_DIRS "PASTIX_pastix.h_DIRS-NOTFOUND")
find_path(PASTIX_pastix.h_DIRS
NAMES pastix.h
HINTS ${_inc_env}
PATH_SUFFIXES "pastix")
endif()
endif()
mark_as_advanced(PASTIX_pastix.h_DIRS)
# If found, add path to cmake variable
# ------------------------------------
if (PASTIX_pastix.h_DIRS)
set(PASTIX_INCLUDE_DIRS "${PASTIX_pastix.h_DIRS}")
else ()
set(PASTIX_INCLUDE_DIRS "PASTIX_INCLUDE_DIRS-NOTFOUND")
if(NOT PASTIX_FIND_QUIETLY)
message(STATUS "Looking for pastix -- pastix.h not found")
endif()
endif()
# Looking for lib
# ---------------
# Add system library paths to search lib
# --------------------------------------
unset(_lib_env)
set(ENV_PASTIX_LIBDIR "$ENV{PASTIX_LIBDIR}")
if(ENV_PASTIX_LIBDIR)
list(APPEND _lib_env "${ENV_PASTIX_LIBDIR}")
elseif(ENV_PASTIX_DIR)
list(APPEND _lib_env "${ENV_PASTIX_DIR}")
list(APPEND _lib_env "${ENV_PASTIX_DIR}/lib")
else()
if(WIN32)
string(REPLACE ":" ";" _lib_env "$ENV{LIB}")
else()
if(APPLE)
string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}")
else()
string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}")
endif()
list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")
list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
endif()
endif()
list(REMOVE_DUPLICATES _lib_env)
# Try to find the pastix lib in the given paths
# ------------------------------------------------
# create list of libs to find
set(PASTIX_libs_to_find "pastix_murge;pastix")
# call cmake macro to find the lib path
if(PASTIX_LIBDIR)
foreach(pastix_lib ${PASTIX_libs_to_find})
set(PASTIX_${pastix_lib}_LIBRARY "PASTIX_${pastix_lib}_LIBRARY-NOTFOUND")
find_library(PASTIX_${pastix_lib}_LIBRARY
NAMES ${pastix_lib}
HINTS ${PASTIX_LIBDIR})
endforeach()
else()
if(PASTIX_DIR)
foreach(pastix_lib ${PASTIX_libs_to_find})
set(PASTIX_${pastix_lib}_LIBRARY "PASTIX_${pastix_lib}_LIBRARY-NOTFOUND")
find_library(PASTIX_${pastix_lib}_LIBRARY
NAMES ${pastix_lib}
HINTS ${PASTIX_DIR}
PATH_SUFFIXES lib lib32 lib64)
endforeach()
else()
foreach(pastix_lib ${PASTIX_libs_to_find})
set(PASTIX_${pastix_lib}_LIBRARY "PASTIX_${pastix_lib}_LIBRARY-NOTFOUND")
find_library(PASTIX_${pastix_lib}_LIBRARY
NAMES ${pastix_lib}
HINTS ${_lib_env})
endforeach()
endif()
endif()
# If found, add path to cmake variable
# ------------------------------------
foreach(pastix_lib ${PASTIX_libs_to_find})
get_filename_component(${pastix_lib}_lib_path ${PASTIX_${pastix_lib}_LIBRARY} PATH)
# set cmake variables (respects naming convention)
if (PASTIX_LIBRARIES)
list(APPEND PASTIX_LIBRARIES "${PASTIX_${pastix_lib}_LIBRARY}")
else()
set(PASTIX_LIBRARIES "${PASTIX_${pastix_lib}_LIBRARY}")
endif()
if (PASTIX_LIBRARY_DIRS)
list(APPEND PASTIX_LIBRARY_DIRS "${${pastix_lib}_lib_path}")
else()
set(PASTIX_LIBRARY_DIRS "${${pastix_lib}_lib_path}")
endif()
mark_as_advanced(PASTIX_${pastix_lib}_LIBRARY)
endforeach()
# check a function to validate the find
if(PASTIX_LIBRARIES)
set(REQUIRED_LDFLAGS)
set(REQUIRED_INCDIRS)
set(REQUIRED_LIBDIRS)
set(REQUIRED_LIBS)
# PASTIX
if (PASTIX_INCLUDE_DIRS)
set(REQUIRED_INCDIRS "${PASTIX_INCLUDE_DIRS}")
endif()
foreach(libdir ${PASTIX_LIBRARY_DIRS})
if (libdir)
list(APPEND REQUIRED_LIBDIRS "${libdir}")
endif()
endforeach()
set(REQUIRED_LIBS "${PASTIX_LIBRARIES}")
# STARPU
if (PASTIX_LOOK_FOR_STARPU AND STARPU_FOUND)
if (STARPU_INCLUDE_DIRS_DEP)
list(APPEND REQUIRED_INCDIRS "${STARPU_INCLUDE_DIRS_DEP}")
elseif (STARPU_INCLUDE_DIRS)
list(APPEND REQUIRED_INCDIRS "${STARPU_INCLUDE_DIRS}")
endif()
if(STARPU_LIBRARY_DIRS_DEP)
list(APPEND REQUIRED_LIBDIRS "${STARPU_LIBRARY_DIRS_DEP}")
elseif(STARPU_LIBRARY_DIRS)
list(APPEND REQUIRED_LIBDIRS "${STARPU_LIBRARY_DIRS}")
endif()
if (STARPU_LIBRARIES_DEP)
list(APPEND REQUIRED_LIBS "${STARPU_LIBRARIES_DEP}")
elseif (STARPU_LIBRARIES)
foreach(lib ${STARPU_LIBRARIES})
if (EXISTS ${lib} OR ${lib} MATCHES "^-")
list(APPEND REQUIRED_LIBS "${lib}")
else()
list(APPEND REQUIRED_LIBS "-l${lib}")
endif()
endforeach()
endif()
endif()
# CUDA
if (PASTIX_LOOK_FOR_STARPU_CUDA AND CUDA_FOUND)
if (CUDA_INCLUDE_DIRS)
list(APPEND REQUIRED_INCDIRS "${CUDA_INCLUDE_DIRS}")
endif()
foreach(libdir ${CUDA_LIBRARY_DIRS})
if (libdir)
list(APPEND REQUIRED_LIBDIRS "${libdir}")
endif()
endforeach()
list(APPEND REQUIRED_LIBS "${CUDA_CUBLAS_LIBRARIES};${CUDA_LIBRARIES}")
endif()
# MPI
if (PASTIX_LOOK_FOR_MPI AND MPI_FOUND)
if (MPI_C_INCLUDE_PATH)
list(APPEND REQUIRED_INCDIRS "${MPI_C_INCLUDE_PATH}")
endif()
if (MPI_C_LINK_FLAGS)
if (${MPI_C_LINK_FLAGS} MATCHES " -")
string(REGEX REPLACE " -" "-" MPI_C_LINK_FLAGS ${MPI_C_LINK_FLAGS})
endif()
list(APPEND REQUIRED_LDFLAGS "${MPI_C_LINK_FLAGS}")
endif()
list(APPEND REQUIRED_LIBS "${MPI_C_LIBRARIES}")
endif()
# HWLOC
if (HWLOC_FOUND)
if (HWLOC_INCLUDE_DIRS)
list(APPEND REQUIRED_INCDIRS "${HWLOC_INCLUDE_DIRS}")
endif()
foreach(libdir ${HWLOC_LIBRARY_DIRS})
if (libdir)
list(APPEND REQUIRED_LIBDIRS "${libdir}")
endif()
endforeach()
foreach(lib ${HWLOC_LIBRARIES})
if (EXISTS ${lib} OR ${lib} MATCHES "^-")
list(APPEND REQUIRED_LIBS "${lib}")
else()
list(APPEND REQUIRED_LIBS "-l${lib}")
endif()
endforeach()
endif()
# BLAS
if (BLAS_FOUND)
if (BLAS_INCLUDE_DIRS)
list(APPEND REQUIRED_INCDIRS "${BLAS_INCLUDE_DIRS}")
endif()
foreach(libdir ${BLAS_LIBRARY_DIRS})
if (libdir)
list(APPEND REQUIRED_LIBDIRS "${libdir}")
endif()
endforeach()
list(APPEND REQUIRED_LIBS "${BLAS_LIBRARIES}")
if (BLAS_LINKER_FLAGS)
list(APPEND REQUIRED_LDFLAGS "${BLAS_LINKER_FLAGS}")
endif()
endif()
# SCOTCH
if (PASTIX_LOOK_FOR_SCOTCH AND SCOTCH_FOUND)
if (SCOTCH_INCLUDE_DIRS)
list(APPEND REQUIRED_INCDIRS "${SCOTCH_INCLUDE_DIRS}")
endif()
foreach(libdir ${SCOTCH_LIBRARY_DIRS})
if (libdir)
list(APPEND REQUIRED_LIBDIRS "${libdir}")
endif()
endforeach()
list(APPEND REQUIRED_LIBS "${SCOTCH_LIBRARIES}")
endif()
# PTSCOTCH
if (PASTIX_LOOK_FOR_PTSCOTCH AND PTSCOTCH_FOUND)
if (PTSCOTCH_INCLUDE_DIRS)
list(APPEND REQUIRED_INCDIRS "${PTSCOTCH_INCLUDE_DIRS}")
endif()
foreach(libdir ${PTSCOTCH_LIBRARY_DIRS})
if (libdir)
list(APPEND REQUIRED_LIBDIRS "${libdir}")
endif()
endforeach()
list(APPEND REQUIRED_LIBS "${PTSCOTCH_LIBRARIES}")
endif()
# METIS
if (PASTIX_LOOK_FOR_METIS AND METIS_FOUND)
if (METIS_INCLUDE_DIRS)
list(APPEND REQUIRED_INCDIRS "${METIS_INCLUDE_DIRS}")
endif()
foreach(libdir ${METIS_LIBRARY_DIRS})
if (libdir)
list(APPEND REQUIRED_LIBDIRS "${libdir}")
endif()
endforeach()
list(APPEND REQUIRED_LIBS "${METIS_LIBRARIES}")
endif()
# Fortran
if (CMAKE_C_COMPILER_ID MATCHES "GNU")
find_library(
FORTRAN_gfortran_LIBRARY
NAMES gfortran
HINTS ${_lib_env}
)
mark_as_advanced(FORTRAN_gfortran_LIBRARY)
if (FORTRAN_gfortran_LIBRARY)
list(APPEND REQUIRED_LIBS "${FORTRAN_gfortran_LIBRARY}")
endif()
elseif (CMAKE_C_COMPILER_ID MATCHES "Intel")
find_library(
FORTRAN_ifcore_LIBRARY
NAMES ifcore
HINTS ${_lib_env}
)
mark_as_advanced(FORTRAN_ifcore_LIBRARY)
if (FORTRAN_ifcore_LIBRARY)
list(APPEND REQUIRED_LIBS "${FORTRAN_ifcore_LIBRARY}")
endif()
endif()
# EXTRA LIBS such that pthread, m, rt
list(APPEND REQUIRED_LIBS ${PASTIX_EXTRA_LIBRARIES})
# set required libraries for link
set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
set(CMAKE_REQUIRED_LIBRARIES)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}")
foreach(lib_dir ${REQUIRED_LIBDIRS})
list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
endforeach()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}")
list(APPEND CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}")
string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
# test link
unset(PASTIX_WORKS CACHE)
include(CheckFunctionExists)
check_function_exists(pastix PASTIX_WORKS)
mark_as_advanced(PASTIX_WORKS)
if(PASTIX_WORKS)
# save link with dependencies
set(PASTIX_LIBRARIES_DEP "${REQUIRED_LIBS}")
set(PASTIX_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
set(PASTIX_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
set(PASTIX_LINKER_FLAGS "${REQUIRED_LDFLAGS}")
list(REMOVE_DUPLICATES PASTIX_LIBRARY_DIRS_DEP)
list(REMOVE_DUPLICATES PASTIX_INCLUDE_DIRS_DEP)
list(REMOVE_DUPLICATES PASTIX_LINKER_FLAGS)
else()
if(NOT PASTIX_FIND_QUIETLY)
message(STATUS "Looking for PASTIX : test of pastix() fails")
message(STATUS "CMAKE_REQUIRED_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}")
message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}")
message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
message(STATUS "Maybe PASTIX is linked with specific libraries. "
"Have you tried with COMPONENTS (MPI/SEQ, STARPU, STARPU_CUDA, SCOTCH, PTSCOTCH, METIS)? "
"See the explanation in FindPASTIX.cmake.")
endif()
endif()
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_FLAGS)
set(CMAKE_REQUIRED_LIBRARIES)
endif()
if (PASTIX_LIBRARIES)
list(GET PASTIX_LIBRARIES 0 first_lib)
get_filename_component(first_lib_path "${first_lib}" PATH)
if (${first_lib_path} MATCHES "/lib(32|64)?$")
string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}")
set(PASTIX_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of PASTIX library" FORCE)
else()
set(PASTIX_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of PASTIX library" FORCE)
endif()
endif()
mark_as_advanced(PASTIX_DIR)
mark_as_advanced(PASTIX_DIR_FOUND)
# check that PASTIX has been found
# ---------------------------------
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PASTIX DEFAULT_MSG
PASTIX_LIBRARIES
PASTIX_WORKS)

View File

@@ -0,0 +1,422 @@
###
#
# @copyright (c) 2009-2014 The University of Tennessee and The University
# of Tennessee Research Foundation.
# All rights reserved.
# @copyright (c) 2012-2016 Inria. All rights reserved.
# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
#
###
#
# - Find PTSCOTCH include dirs and libraries
# Use this module by invoking find_package with the form:
# find_package(PTSCOTCH
# [REQUIRED] # Fail with error if ptscotch is not found
# [COMPONENTS <comp1> <comp2> ...] # dependencies
# )
#
# PTSCOTCH depends on the following libraries:
# - Threads
# - MPI
#
# COMPONENTS can be some of the following:
# - ESMUMPS: to activate detection of PT-Scotch with the esmumps interface
#
# This module finds headers and ptscotch library.
# Results are reported in variables:
# PTSCOTCH_FOUND - True if headers and requested libraries were found
# PTSCOTCH_LINKER_FLAGS - list of required linker flags (excluding -l and -L)
# PTSCOTCH_INCLUDE_DIRS - ptscotch include directories
# PTSCOTCH_LIBRARY_DIRS - Link directories for ptscotch libraries
# PTSCOTCH_LIBRARIES - ptscotch component libraries to be linked
# PTSCOTCH_INCLUDE_DIRS_DEP - ptscotch + dependencies include directories
# PTSCOTCH_LIBRARY_DIRS_DEP - ptscotch + dependencies link directories
# PTSCOTCH_LIBRARIES_DEP - ptscotch libraries + dependencies
# PTSCOTCH_INTSIZE - Number of octets occupied by a SCOTCH_Num
#
# The user can give specific paths where to find the libraries adding cmake
# options at configure (ex: cmake path/to/project -DPTSCOTCH=path/to/ptscotch):
# PTSCOTCH_DIR - Where to find the base directory of ptscotch
# PTSCOTCH_INCDIR - Where to find the header files
# PTSCOTCH_LIBDIR - Where to find the library files
# The module can also look for the following environment variables if paths
# are not given as cmake variable: PTSCOTCH_DIR, PTSCOTCH_INCDIR, PTSCOTCH_LIBDIR
#=============================================================================
# Copyright 2012-2013 Inria
# Copyright 2012-2013 Emmanuel Agullo
# Copyright 2012-2013 Mathieu Faverge
# Copyright 2012 Cedric Castagnede
# Copyright 2013-2016 Florent Pruvost
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file MORSE-Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of Morse, substitute the full
# License text for the above reference.)
if (NOT PTSCOTCH_FOUND)
set(PTSCOTCH_DIR "" CACHE PATH "Installation directory of PTSCOTCH library")
if (NOT PTSCOTCH_FIND_QUIETLY)
message(STATUS "A cache variable, namely PTSCOTCH_DIR, has been set to specify the install directory of PTSCOTCH")
endif()
endif()
# Set the version to find
set(PTSCOTCH_LOOK_FOR_ESMUMPS OFF)
if( PTSCOTCH_FIND_COMPONENTS )
foreach( component ${PTSCOTCH_FIND_COMPONENTS} )
if (${component} STREQUAL "ESMUMPS")
# means we look for esmumps library
set(PTSCOTCH_LOOK_FOR_ESMUMPS ON)
endif()
endforeach()
endif()
# PTSCOTCH depends on Threads, try to find it
include(CMakeFindDependencyMacro)
if (NOT THREADS_FOUND)
if (PTSCOTCH_FIND_REQUIRED)
find_dependency(Threads REQUIRED)
else()
find_dependency(Threads)
endif()
endif()
# PTSCOTCH depends on MPI, try to find it
if (NOT MPI_FOUND)
if (PTSCOTCH_FIND_REQUIRED)
find_dependency(MPI REQUIRED)
else()
find_dependency(MPI)
endif()
endif()
# Looking for include
# -------------------
# Add system include paths to search include
# ------------------------------------------
unset(_inc_env)
set(ENV_PTSCOTCH_DIR "$ENV{PTSCOTCH_DIR}")
set(ENV_PTSCOTCH_INCDIR "$ENV{PTSCOTCH_INCDIR}")
if(ENV_PTSCOTCH_INCDIR)
list(APPEND _inc_env "${ENV_PTSCOTCH_INCDIR}")
elseif(ENV_PTSCOTCH_DIR)
list(APPEND _inc_env "${ENV_PTSCOTCH_DIR}")
list(APPEND _inc_env "${ENV_PTSCOTCH_DIR}/include")
list(APPEND _inc_env "${ENV_PTSCOTCH_DIR}/include/ptscotch")
else()
if(WIN32)
string(REPLACE ":" ";" _inc_env "$ENV{INCLUDE}")
else()
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{CPATH}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}")
list(APPEND _inc_env "${_path_env}")
endif()
endif()
list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}")
list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}")
list(REMOVE_DUPLICATES _inc_env)
# Try to find the ptscotch header in the given paths
# -------------------------------------------------
set(PTSCOTCH_hdrs_to_find "ptscotch.h;scotch.h")
# call cmake macro to find the header path
if(PTSCOTCH_INCDIR)
foreach(ptscotch_hdr ${PTSCOTCH_hdrs_to_find})
set(PTSCOTCH_${ptscotch_hdr}_DIRS "PTSCOTCH_${ptscotch_hdr}_DIRS-NOTFOUND")
find_path(PTSCOTCH_${ptscotch_hdr}_DIRS
NAMES ${ptscotch_hdr}
HINTS ${PTSCOTCH_INCDIR})
mark_as_advanced(PTSCOTCH_${ptscotch_hdr}_DIRS)
endforeach()
else()
if(PTSCOTCH_DIR)
foreach(ptscotch_hdr ${PTSCOTCH_hdrs_to_find})
set(PTSCOTCH_${ptscotch_hdr}_DIRS "PTSCOTCH_${ptscotch_hdr}_DIRS-NOTFOUND")
find_path(PTSCOTCH_${ptscotch_hdr}_DIRS
NAMES ${ptscotch_hdr}
HINTS ${PTSCOTCH_DIR}
PATH_SUFFIXES "include" "include/scotch")
mark_as_advanced(PTSCOTCH_${ptscotch_hdr}_DIRS)
endforeach()
else()
foreach(ptscotch_hdr ${PTSCOTCH_hdrs_to_find})
set(PTSCOTCH_${ptscotch_hdr}_DIRS "PTSCOTCH_${ptscotch_hdr}_DIRS-NOTFOUND")
find_path(PTSCOTCH_${ptscotch_hdr}_DIRS
NAMES ${ptscotch_hdr}
HINTS ${_inc_env}
PATH_SUFFIXES "scotch")
mark_as_advanced(PTSCOTCH_${ptscotch_hdr}_DIRS)
endforeach()
endif()
endif()
# If found, add path to cmake variable
# ------------------------------------
foreach(ptscotch_hdr ${PTSCOTCH_hdrs_to_find})
if (PTSCOTCH_${ptscotch_hdr}_DIRS)
list(APPEND PTSCOTCH_INCLUDE_DIRS "${PTSCOTCH_${ptscotch_hdr}_DIRS}")
else ()
if (NOT PTSCOTCH_FIND_QUIETLY)
message(STATUS "Looking for ptscotch -- ${ptscotch_hdr} not found")
endif()
endif()
endforeach()
list(REMOVE_DUPLICATES PTSCOTCH_INCLUDE_DIRS)
# Looking for lib
# ---------------
# Add system library paths to search lib
# --------------------------------------
unset(_lib_env)
set(ENV_PTSCOTCH_LIBDIR "$ENV{PTSCOTCH_LIBDIR}")
if(ENV_PTSCOTCH_LIBDIR)
list(APPEND _lib_env "${ENV_PTSCOTCH_LIBDIR}")
elseif(ENV_PTSCOTCH_DIR)
list(APPEND _lib_env "${ENV_PTSCOTCH_DIR}")
list(APPEND _lib_env "${ENV_PTSCOTCH_DIR}/lib")
else()
if(WIN32)
string(REPLACE ":" ";" _lib_env "$ENV{LIB}")
else()
if(APPLE)
string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}")
else()
string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}")
endif()
list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")
list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
endif()
endif()
list(REMOVE_DUPLICATES _lib_env)
# Try to find the ptscotch lib in the given paths
# ----------------------------------------------
set(PTSCOTCH_libs_to_find "ptscotch;ptscotcherr")
if (PTSCOTCH_LOOK_FOR_ESMUMPS)
list(INSERT PTSCOTCH_libs_to_find 0 "ptesmumps")
list(APPEND PTSCOTCH_libs_to_find "esmumps" )
endif()
list(APPEND PTSCOTCH_libs_to_find "scotch;scotcherr")
# call cmake macro to find the lib path
if(PTSCOTCH_LIBDIR)
foreach(ptscotch_lib ${PTSCOTCH_libs_to_find})
set(PTSCOTCH_${ptscotch_lib}_LIBRARY "PTSCOTCH_${ptscotch_lib}_LIBRARY-NOTFOUND")
find_library(PTSCOTCH_${ptscotch_lib}_LIBRARY
NAMES ${ptscotch_lib}
HINTS ${PTSCOTCH_LIBDIR})
endforeach()
else()
if(PTSCOTCH_DIR)
foreach(ptscotch_lib ${PTSCOTCH_libs_to_find})
set(PTSCOTCH_${ptscotch_lib}_LIBRARY "PTSCOTCH_${ptscotch_lib}_LIBRARY-NOTFOUND")
find_library(PTSCOTCH_${ptscotch_lib}_LIBRARY
NAMES ${ptscotch_lib}
HINTS ${PTSCOTCH_DIR}
PATH_SUFFIXES lib lib32 lib64)
endforeach()
else()
foreach(ptscotch_lib ${PTSCOTCH_libs_to_find})
set(PTSCOTCH_${ptscotch_lib}_LIBRARY "PTSCOTCH_${ptscotch_lib}_LIBRARY-NOTFOUND")
find_library(PTSCOTCH_${ptscotch_lib}_LIBRARY
NAMES ${ptscotch_lib}
HINTS ${_lib_env})
endforeach()
endif()
endif()
set(PTSCOTCH_LIBRARIES "")
set(PTSCOTCH_LIBRARY_DIRS "")
# If found, add path to cmake variable
# ------------------------------------
foreach(ptscotch_lib ${PTSCOTCH_libs_to_find})
if (PTSCOTCH_${ptscotch_lib}_LIBRARY)
get_filename_component(${ptscotch_lib}_lib_path "${PTSCOTCH_${ptscotch_lib}_LIBRARY}" PATH)
# set cmake variables
list(APPEND PTSCOTCH_LIBRARIES "${PTSCOTCH_${ptscotch_lib}_LIBRARY}")
list(APPEND PTSCOTCH_LIBRARY_DIRS "${${ptscotch_lib}_lib_path}")
else ()
if (NOT PTSCOTCH_FIND_QUIETLY)
message(STATUS "Looking for ptscotch -- lib ${ptscotch_lib} not found")
endif()
endif ()
mark_as_advanced(PTSCOTCH_${ptscotch_lib}_LIBRARY)
endforeach()
list(REMOVE_DUPLICATES PTSCOTCH_LIBRARY_DIRS)
# check a function to validate the find
if(PTSCOTCH_LIBRARIES)
set(REQUIRED_LDFLAGS)
set(REQUIRED_INCDIRS)
set(REQUIRED_LIBDIRS)
set(REQUIRED_LIBS)
# PTSCOTCH
if (PTSCOTCH_INCLUDE_DIRS)
set(REQUIRED_INCDIRS "${PTSCOTCH_INCLUDE_DIRS}")
endif()
if (PTSCOTCH_LIBRARY_DIRS)
set(REQUIRED_LIBDIRS "${PTSCOTCH_LIBRARY_DIRS}")
endif()
set(REQUIRED_LIBS "${PTSCOTCH_LIBRARIES}")
# MPI
if (MPI_FOUND)
if (MPI_C_INCLUDE_PATH)
list(APPEND CMAKE_REQUIRED_INCLUDES "${MPI_C_INCLUDE_PATH}")
endif()
if (MPI_C_LINK_FLAGS)
if (${MPI_C_LINK_FLAGS} MATCHES " -")
string(REGEX REPLACE " -" "-" MPI_C_LINK_FLAGS ${MPI_C_LINK_FLAGS})
endif()
list(APPEND REQUIRED_LDFLAGS "${MPI_C_LINK_FLAGS}")
endif()
list(APPEND REQUIRED_LIBS "${MPI_C_LIBRARIES}")
endif()
# THREADS
if(CMAKE_THREAD_LIBS_INIT)
list(APPEND REQUIRED_LIBS "${CMAKE_THREAD_LIBS_INIT}")
endif()
set(Z_LIBRARY "Z_LIBRARY-NOTFOUND")
find_library(Z_LIBRARY NAMES z)
mark_as_advanced(Z_LIBRARY)
if(Z_LIBRARY)
list(APPEND REQUIRED_LIBS "-lz")
endif()
set(M_LIBRARY "M_LIBRARY-NOTFOUND")
find_library(M_LIBRARY NAMES m)
mark_as_advanced(M_LIBRARY)
if(M_LIBRARY)
list(APPEND REQUIRED_LIBS "-lm")
endif()
set(RT_LIBRARY "RT_LIBRARY-NOTFOUND")
find_library(RT_LIBRARY NAMES rt)
mark_as_advanced(RT_LIBRARY)
if(RT_LIBRARY)
list(APPEND REQUIRED_LIBS "-lrt")
endif()
# set required libraries for link
set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
set(CMAKE_REQUIRED_LIBRARIES)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}")
foreach(lib_dir ${REQUIRED_LIBDIRS})
list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
endforeach()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}")
list(APPEND CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}")
string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
# test link
unset(PTSCOTCH_WORKS CACHE)
include(CheckFunctionExists)
check_function_exists(SCOTCH_dgraphInit PTSCOTCH_WORKS)
mark_as_advanced(PTSCOTCH_WORKS)
if(PTSCOTCH_WORKS)
# save link with dependencies
set(PTSCOTCH_LIBRARIES_DEP "${REQUIRED_LIBS}")
set(PTSCOTCH_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
set(PTSCOTCH_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
set(PTSCOTCH_LINKER_FLAGS "${REQUIRED_LDFLAGS}")
list(REMOVE_DUPLICATES PTSCOTCH_LIBRARY_DIRS_DEP)
list(REMOVE_DUPLICATES PTSCOTCH_INCLUDE_DIRS_DEP)
list(REMOVE_DUPLICATES PTSCOTCH_LINKER_FLAGS)
else()
if(NOT PTSCOTCH_FIND_QUIETLY)
message(STATUS "Looking for PTSCOTCH : test of SCOTCH_dgraphInit with PTSCOTCH library fails")
message(STATUS "CMAKE_REQUIRED_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}")
message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}")
message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
endif()
endif()
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_FLAGS)
set(CMAKE_REQUIRED_LIBRARIES)
endif()
if (PTSCOTCH_LIBRARIES)
list(GET PTSCOTCH_LIBRARIES 0 first_lib)
get_filename_component(first_lib_path "${first_lib}" PATH)
if (${first_lib_path} MATCHES "/lib(32|64)?$")
string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}")
set(PTSCOTCH_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of PTSCOTCH library" FORCE)
else()
set(PTSCOTCH_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of PTSCOTCH library" FORCE)
endif()
endif()
mark_as_advanced(PTSCOTCH_DIR)
mark_as_advanced(PTSCOTCH_DIR_FOUND)
# Check the size of SCOTCH_Num
# ---------------------------------
set(CMAKE_REQUIRED_INCLUDES ${PTSCOTCH_INCLUDE_DIRS})
include(CheckCSourceRuns)
#stdio.h and stdint.h should be included by scotch.h directly
set(PTSCOTCH_C_TEST_SCOTCH_Num_4 "
#include <stdio.h>
#include <stdint.h>
#include <ptscotch.h>
int main(int argc, char **argv) {
if (sizeof(SCOTCH_Num) == 4)
return 0;
else
return 1;
}
")
set(PTSCOTCH_C_TEST_SCOTCH_Num_8 "
#include <stdio.h>
#include <stdint.h>
#include <ptscotch.h>
int main(int argc, char **argv) {
if (sizeof(SCOTCH_Num) == 8)
return 0;
else
return 1;
}
")
check_c_source_runs("${PTSCOTCH_C_TEST_SCOTCH_Num_4}" PTSCOTCH_Num_4)
if(NOT PTSCOTCH_Num_4)
check_c_source_runs("${PTSCOTCH_C_TEST_SCOTCH_Num_8}" PTSCOTCH_Num_8)
if(NOT PTSCOTCH_Num_8)
set(PTSCOTCH_INTSIZE -1)
else()
set(PTSCOTCH_INTSIZE 8)
endif()
else()
set(PTSCOTCH_INTSIZE 4)
endif()
set(CMAKE_REQUIRED_INCLUDES "")
# check that PTSCOTCH has been found
# ---------------------------------
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PTSCOTCH DEFAULT_MSG
PTSCOTCH_LIBRARIES
PTSCOTCH_WORKS)
#
# TODO: Add possibility to check for specific functions in the library
#

View File

@@ -0,0 +1,370 @@
###
#
# @copyright (c) 2009-2014 The University of Tennessee and The University
# of Tennessee Research Foundation.
# All rights reserved.
# @copyright (c) 2012-2014 Inria. All rights reserved.
# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
#
###
#
# - Find SCOTCH include dirs and libraries
# Use this module by invoking find_package with the form:
# find_package(SCOTCH
# [REQUIRED] # Fail with error if scotch is not found
# [COMPONENTS <comp1> <comp2> ...] # dependencies
# )
#
# COMPONENTS can be some of the following:
# - ESMUMPS: to activate detection of Scotch with the esmumps interface
#
# This module finds headers and scotch library.
# Results are reported in variables:
# SCOTCH_FOUND - True if headers and requested libraries were found
# SCOTCH_INCLUDE_DIRS - scotch include directories
# SCOTCH_LIBRARY_DIRS - Link directories for scotch libraries
# SCOTCH_LIBRARIES - scotch component libraries to be linked
# SCOTCH_INTSIZE - Number of octets occupied by a SCOTCH_Num
#
# The user can give specific paths where to find the libraries adding cmake
# options at configure (ex: cmake path/to/project -DSCOTCH=path/to/scotch):
# SCOTCH_DIR - Where to find the base directory of scotch
# SCOTCH_INCDIR - Where to find the header files
# SCOTCH_LIBDIR - Where to find the library files
# The module can also look for the following environment variables if paths
# are not given as cmake variable: SCOTCH_DIR, SCOTCH_INCDIR, SCOTCH_LIBDIR
#=============================================================================
# Copyright 2012-2013 Inria
# Copyright 2012-2013 Emmanuel Agullo
# Copyright 2012-2013 Mathieu Faverge
# Copyright 2012 Cedric Castagnede
# Copyright 2013 Florent Pruvost
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file MORSE-Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of Morse, substitute the full
# License text for the above reference.)
if (NOT SCOTCH_FOUND)
set(SCOTCH_DIR "" CACHE PATH "Installation directory of SCOTCH library")
if (NOT SCOTCH_FIND_QUIETLY)
message(STATUS "A cache variable, namely SCOTCH_DIR, has been set to specify the install directory of SCOTCH")
endif()
endif()
# Set the version to find
set(SCOTCH_LOOK_FOR_ESMUMPS OFF)
if( SCOTCH_FIND_COMPONENTS )
foreach( component ${SCOTCH_FIND_COMPONENTS} )
if (${component} STREQUAL "ESMUMPS")
# means we look for esmumps library
set(SCOTCH_LOOK_FOR_ESMUMPS ON)
endif()
endforeach()
endif()
# SCOTCH may depend on Threads, try to find it
include(CMakeFindDependencyMacro)
if (NOT THREADS_FOUND)
if (SCOTCH_FIND_REQUIRED)
find_dependency(Threads REQUIRED)
else()
find_dependency(Threads)
endif()
endif()
# Looking for include
# -------------------
# Add system include paths to search include
# ------------------------------------------
unset(_inc_env)
set(ENV_SCOTCH_DIR "$ENV{SCOTCH_DIR}")
set(ENV_SCOTCH_INCDIR "$ENV{SCOTCH_INCDIR}")
if(ENV_SCOTCH_INCDIR)
list(APPEND _inc_env "${ENV_SCOTCH_INCDIR}")
elseif(ENV_SCOTCH_DIR)
list(APPEND _inc_env "${ENV_SCOTCH_DIR}")
list(APPEND _inc_env "${ENV_SCOTCH_DIR}/include")
list(APPEND _inc_env "${ENV_SCOTCH_DIR}/include/scotch")
else()
if(WIN32)
string(REPLACE ":" ";" _inc_env "$ENV{INCLUDE}")
else()
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{CPATH}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}")
list(APPEND _inc_env "${_path_env}")
endif()
endif()
list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}")
list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}")
list(REMOVE_DUPLICATES _inc_env)
# Try to find the scotch header in the given paths
# -------------------------------------------------
# call cmake macro to find the header path
if(SCOTCH_INCDIR)
set(SCOTCH_scotch.h_DIRS "SCOTCH_scotch.h_DIRS-NOTFOUND")
find_path(SCOTCH_scotch.h_DIRS
NAMES scotch.h
HINTS ${SCOTCH_INCDIR})
else()
if(SCOTCH_DIR)
set(SCOTCH_scotch.h_DIRS "SCOTCH_scotch.h_DIRS-NOTFOUND")
find_path(SCOTCH_scotch.h_DIRS
NAMES scotch.h
HINTS ${SCOTCH_DIR}
PATH_SUFFIXES "include" "include/scotch")
else()
set(SCOTCH_scotch.h_DIRS "SCOTCH_scotch.h_DIRS-NOTFOUND")
find_path(SCOTCH_scotch.h_DIRS
NAMES scotch.h
HINTS ${_inc_env}
PATH_SUFFIXES "scotch")
endif()
endif()
mark_as_advanced(SCOTCH_scotch.h_DIRS)
# If found, add path to cmake variable
# ------------------------------------
if (SCOTCH_scotch.h_DIRS)
set(SCOTCH_INCLUDE_DIRS "${SCOTCH_scotch.h_DIRS}")
else ()
set(SCOTCH_INCLUDE_DIRS "SCOTCH_INCLUDE_DIRS-NOTFOUND")
if (NOT SCOTCH_FIND_QUIETLY)
message(STATUS "Looking for scotch -- scotch.h not found")
endif()
endif()
list(REMOVE_DUPLICATES SCOTCH_INCLUDE_DIRS)
# Looking for lib
# ---------------
# Add system library paths to search lib
# --------------------------------------
unset(_lib_env)
set(ENV_SCOTCH_LIBDIR "$ENV{SCOTCH_LIBDIR}")
if(ENV_SCOTCH_LIBDIR)
list(APPEND _lib_env "${ENV_SCOTCH_LIBDIR}")
elseif(ENV_SCOTCH_DIR)
list(APPEND _lib_env "${ENV_SCOTCH_DIR}")
list(APPEND _lib_env "${ENV_SCOTCH_DIR}/lib")
else()
if(WIN32)
string(REPLACE ":" ";" _lib_env "$ENV{LIB}")
else()
if(APPLE)
string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}")
else()
string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}")
endif()
list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")
list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
endif()
endif()
list(REMOVE_DUPLICATES _lib_env)
# Try to find the scotch lib in the given paths
# ----------------------------------------------
set(SCOTCH_libs_to_find "scotch;scotcherrexit")
if (SCOTCH_LOOK_FOR_ESMUMPS)
list(INSERT SCOTCH_libs_to_find 0 "esmumps")
endif()
# call cmake macro to find the lib path
if(SCOTCH_LIBDIR)
foreach(scotch_lib ${SCOTCH_libs_to_find})
set(SCOTCH_${scotch_lib}_LIBRARY "SCOTCH_${scotch_lib}_LIBRARY-NOTFOUND")
find_library(SCOTCH_${scotch_lib}_LIBRARY
NAMES ${scotch_lib}
HINTS ${SCOTCH_LIBDIR})
endforeach()
else()
if(SCOTCH_DIR)
foreach(scotch_lib ${SCOTCH_libs_to_find})
set(SCOTCH_${scotch_lib}_LIBRARY "SCOTCH_${scotch_lib}_LIBRARY-NOTFOUND")
find_library(SCOTCH_${scotch_lib}_LIBRARY
NAMES ${scotch_lib}
HINTS ${SCOTCH_DIR}
PATH_SUFFIXES lib lib32 lib64)
endforeach()
else()
foreach(scotch_lib ${SCOTCH_libs_to_find})
set(SCOTCH_${scotch_lib}_LIBRARY "SCOTCH_${scotch_lib}_LIBRARY-NOTFOUND")
find_library(SCOTCH_${scotch_lib}_LIBRARY
NAMES ${scotch_lib}
HINTS ${_lib_env})
endforeach()
endif()
endif()
set(SCOTCH_LIBRARIES "")
set(SCOTCH_LIBRARY_DIRS "")
# If found, add path to cmake variable
# ------------------------------------
foreach(scotch_lib ${SCOTCH_libs_to_find})
if (SCOTCH_${scotch_lib}_LIBRARY)
get_filename_component(${scotch_lib}_lib_path "${SCOTCH_${scotch_lib}_LIBRARY}" PATH)
# set cmake variables
list(APPEND SCOTCH_LIBRARIES "${SCOTCH_${scotch_lib}_LIBRARY}")
list(APPEND SCOTCH_LIBRARY_DIRS "${${scotch_lib}_lib_path}")
else ()
list(APPEND SCOTCH_LIBRARIES "${SCOTCH_${scotch_lib}_LIBRARY}")
if (NOT SCOTCH_FIND_QUIETLY)
message(STATUS "Looking for scotch -- lib ${scotch_lib} not found")
endif()
endif ()
mark_as_advanced(SCOTCH_${scotch_lib}_LIBRARY)
endforeach()
list(REMOVE_DUPLICATES SCOTCH_LIBRARY_DIRS)
# check a function to validate the find
if(SCOTCH_LIBRARIES)
set(REQUIRED_INCDIRS)
set(REQUIRED_LIBDIRS)
set(REQUIRED_LIBS)
# SCOTCH
if (SCOTCH_INCLUDE_DIRS)
set(REQUIRED_INCDIRS "${SCOTCH_INCLUDE_DIRS}")
endif()
if (SCOTCH_LIBRARY_DIRS)
set(REQUIRED_LIBDIRS "${SCOTCH_LIBRARY_DIRS}")
endif()
set(REQUIRED_LIBS "${SCOTCH_LIBRARIES}")
# THREADS
if(CMAKE_THREAD_LIBS_INIT)
list(APPEND REQUIRED_LIBS "${CMAKE_THREAD_LIBS_INIT}")
endif()
set(Z_LIBRARY "Z_LIBRARY-NOTFOUND")
find_library(Z_LIBRARY NAMES z)
mark_as_advanced(Z_LIBRARY)
if(Z_LIBRARY)
list(APPEND REQUIRED_LIBS "-lz")
endif()
set(M_LIBRARY "M_LIBRARY-NOTFOUND")
find_library(M_LIBRARY NAMES m)
mark_as_advanced(M_LIBRARY)
if(M_LIBRARY)
list(APPEND REQUIRED_LIBS "-lm")
endif()
set(RT_LIBRARY "RT_LIBRARY-NOTFOUND")
find_library(RT_LIBRARY NAMES rt)
mark_as_advanced(RT_LIBRARY)
if(RT_LIBRARY)
list(APPEND REQUIRED_LIBS "-lrt")
endif()
# set required libraries for link
set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
set(CMAKE_REQUIRED_LIBRARIES)
foreach(lib_dir ${REQUIRED_LIBDIRS})
list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
endforeach()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}")
string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
# test link
unset(SCOTCH_WORKS CACHE)
include(CheckFunctionExists)
check_function_exists(SCOTCH_graphInit SCOTCH_WORKS)
mark_as_advanced(SCOTCH_WORKS)
if(SCOTCH_WORKS)
# save link with dependencies
set(SCOTCH_LIBRARIES "${REQUIRED_LIBS}")
else()
if(NOT SCOTCH_FIND_QUIETLY)
message(STATUS "Looking for SCOTCH : test of SCOTCH_graphInit with SCOTCH library fails")
message(STATUS "CMAKE_REQUIRED_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}")
message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}")
message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
endif()
endif()
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_FLAGS)
set(CMAKE_REQUIRED_LIBRARIES)
endif()
if (SCOTCH_LIBRARIES)
list(GET SCOTCH_LIBRARIES 0 first_lib)
get_filename_component(first_lib_path "${first_lib}" PATH)
if (${first_lib_path} MATCHES "/lib(32|64)?$")
string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}")
set(SCOTCH_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of SCOTCH library" FORCE)
else()
set(SCOTCH_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of SCOTCH library" FORCE)
endif()
endif()
mark_as_advanced(SCOTCH_DIR)
mark_as_advanced(SCOTCH_DIR_FOUND)
# Check the size of SCOTCH_Num
# ---------------------------------
set(CMAKE_REQUIRED_INCLUDES ${SCOTCH_INCLUDE_DIRS})
include(CheckCSourceRuns)
#stdio.h and stdint.h should be included by scotch.h directly
set(SCOTCH_C_TEST_SCOTCH_Num_4 "
#include <stdio.h>
#include <stdint.h>
#include <scotch.h>
int main(int argc, char **argv) {
if (sizeof(SCOTCH_Num) == 4)
return 0;
else
return 1;
}
")
set(SCOTCH_C_TEST_SCOTCH_Num_8 "
#include <stdio.h>
#include <stdint.h>
#include <scotch.h>
int main(int argc, char **argv) {
if (sizeof(SCOTCH_Num) == 8)
return 0;
else
return 1;
}
")
check_c_source_runs("${SCOTCH_C_TEST_SCOTCH_Num_4}" SCOTCH_Num_4)
if(NOT SCOTCH_Num_4)
check_c_source_runs("${SCOTCH_C_TEST_SCOTCH_Num_8}" SCOTCH_Num_8)
if(NOT SCOTCH_Num_8)
set(SCOTCH_INTSIZE -1)
else()
set(SCOTCH_INTSIZE 8)
endif()
else()
set(SCOTCH_INTSIZE 4)
endif()
set(CMAKE_REQUIRED_INCLUDES "")
# check that SCOTCH has been found
# ---------------------------------
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SCOTCH DEFAULT_MSG
SCOTCH_LIBRARIES
SCOTCH_WORKS)
#
# TODO: Add possibility to check for specific functions in the library
#

View File

@@ -0,0 +1,41 @@
# SPQR lib usually requires linking to a blas and lapack library.
# It is up to the user of this module to find a BLAS and link to it.
# SPQR lib requires Cholmod, colamd and amd as well.
# FindCholmod.cmake can be used to find those packages before finding spqr
if (SPQR_INCLUDES AND SPQR_LIBRARIES)
set(SPQR_FIND_QUIETLY TRUE)
endif ()
find_path(SPQR_INCLUDES
NAMES
SuiteSparseQR.hpp
PATHS
$ENV{SPQRDIR}
${INCLUDE_INSTALL_DIR}
PATH_SUFFIXES
suitesparse
ufsparse
)
find_library(SPQR_LIBRARIES spqr $ENV{SPQRDIR} ${LIB_INSTALL_DIR})
if(SPQR_LIBRARIES)
find_library(SUITESPARSE_LIBRARY SuiteSparse PATHS $ENV{SPQRDIR} ${LIB_INSTALL_DIR})
if (SUITESPARSE_LIBRARY)
set(SPQR_LIBRARIES ${SPQR_LIBRARIES} ${SUITESPARSE_LIBRARY})
endif()
find_library(CHOLMOD_LIBRARY cholmod PATHS $ENV{UMFPACK_LIBDIR} $ENV{UMFPACKDIR} ${LIB_INSTALL_DIR})
if(CHOLMOD_LIBRARY)
set(SPQR_LIBRARIES ${SPQR_LIBRARIES} ${CHOLMOD_LIBRARY})
endif()
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SPQR DEFAULT_MSG SPQR_INCLUDES SPQR_LIBRARIES)
mark_as_advanced(SPQR_INCLUDES SPQR_LIBRARIES)

View File

@@ -0,0 +1,70 @@
# - Try to find how to link to the standard math library, if anything at all is needed to do.
# On most platforms this is automatic, but for example it's not automatic on QNX.
#
# Once done this will define
#
# STANDARD_MATH_LIBRARY_FOUND - we found how to successfully link to the standard math library
# STANDARD_MATH_LIBRARY - the name of the standard library that one has to link to.
# -- this will be left empty if it's automatic (most platforms).
# -- this will be set to "m" on platforms where one must explicitly
# pass the "-lm" linker flag.
#
# Copyright (c) 2010 Benoit Jacob <jacob.benoit.1@gmail.com>
# 2020 Susi Lehtola <susi.lehtola@gmail.com>
# Redistribution and use is allowed according to the terms of the 2-clause BSD license.
include(CheckCXXSourceCompiles)
# a little test program for c++ math functions.
# notice the std:: is required on some platforms such as QNX
# notice the (void) is required if -Wall (-Wunused-value) is added to CMAKE_CXX_FLAG
# We read in the arguments from standard input to avoid the compiler optimizing away the calls
set(find_standard_math_library_test_program
"
#include<cmath>
int main(int argc, char **){
return int(std::sin(double(argc)) + std::log(double(argc)));
}")
# first try compiling/linking the test program without any linker flags
set(CMAKE_REQUIRED_FLAGS "")
set(CMAKE_REQUIRED_LIBRARIES "")
CHECK_CXX_SOURCE_COMPILES(
"${find_standard_math_library_test_program}"
standard_math_library_linked_to_automatically
)
if(standard_math_library_linked_to_automatically)
# the test program linked successfully without any linker flag.
set(STANDARD_MATH_LIBRARY "")
set(STANDARD_MATH_LIBRARY_FOUND TRUE)
else()
# the test program did not link successfully without any linker flag.
# This is a very uncommon case that so far we only saw on QNX. The next try is the
# standard name 'm' for the standard math library.
set(CMAKE_REQUIRED_LIBRARIES "m")
CHECK_CXX_SOURCE_COMPILES(
"${find_standard_math_library_test_program}"
standard_math_library_linked_to_as_m)
if(standard_math_library_linked_to_as_m)
# the test program linked successfully when linking to the 'm' library
set(STANDARD_MATH_LIBRARY "m")
set(STANDARD_MATH_LIBRARY_FOUND TRUE)
else()
# the test program still doesn't link successfully
set(STANDARD_MATH_LIBRARY_FOUND FALSE)
endif()
endif()

View File

@@ -0,0 +1,97 @@
# Umfpack lib usually requires linking to a blas library.
# It is up to the user of this module to find a BLAS and link to it.
if (SUPERLU_INCLUDES AND SUPERLU_LIBRARIES)
set(SUPERLU_FIND_QUIETLY TRUE)
endif ()
find_path(SUPERLU_INCLUDES
NAMES
supermatrix.h
PATHS
$ENV{SUPERLUDIR}
${INCLUDE_INSTALL_DIR}
PATH_SUFFIXES
superlu
SRC
)
find_library(SUPERLU_LIBRARIES
NAMES "superlu_5.2.1" "superlu_5.2" "superlu_5.1.1" "superlu_5.1" "superlu_5.0" "superlu_4.3" "superlu_4.2" "superlu_4.1" "superlu_4.0" "superlu_3.1" "superlu_3.0" "superlu"
PATHS $ENV{SUPERLUDIR} ${LIB_INSTALL_DIR}
PATH_SUFFIXES lib)
if(SUPERLU_INCLUDES AND SUPERLU_LIBRARIES)
include(CheckCXXSourceCompiles)
include(CMakePushCheckState)
cmake_push_check_state()
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${SUPERLU_INCLUDES})
# check whether struct mem_usage_t is globally defined
check_cxx_source_compiles("
typedef int int_t;
#include <supermatrix.h>
#include <slu_util.h>
int main() {
mem_usage_t mem;
return 0;
}"
SUPERLU_HAS_GLOBAL_MEM_USAGE_T)
check_cxx_source_compiles("
typedef int int_t;
#include <supermatrix.h>
#include <superlu_enum_consts.h>
int main() {
return SLU_SINGLE;
}"
SUPERLU_HAS_CLEAN_ENUMS)
check_cxx_source_compiles("
typedef int int_t;
#include <supermatrix.h>
#include <slu_util.h>
int main(void)
{
GlobalLU_t glu;
return 0;
}"
SUPERLU_HAS_GLOBALLU_T)
if(SUPERLU_HAS_GLOBALLU_T)
# at least 5.0
set(SUPERLU_VERSION_VAR "5.0")
elseif(SUPERLU_HAS_CLEAN_ENUMS)
# at least 4.3
set(SUPERLU_VERSION_VAR "4.3")
elseif(SUPERLU_HAS_GLOBAL_MEM_USAGE_T)
# at least 4.0
set(SUPERLU_VERSION_VAR "4.0")
else()
set(SUPERLU_VERSION_VAR "3.0")
endif()
cmake_pop_check_state()
if(SuperLU_FIND_VERSION)
if(${SUPERLU_VERSION_VAR} VERSION_LESS ${SuperLU_FIND_VERSION})
set(SUPERLU_VERSION_OK FALSE)
else()
set(SUPERLU_VERSION_OK TRUE)
endif()
else()
set(SUPERLU_VERSION_OK TRUE)
endif()
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SuperLU
REQUIRED_VARS SUPERLU_INCLUDES SUPERLU_LIBRARIES SUPERLU_VERSION_OK
VERSION_VAR SUPERLU_VERSION_VAR)
mark_as_advanced(SUPERLU_INCLUDES SUPERLU_LIBRARIES)

View File

@@ -0,0 +1,173 @@
#.rst:
# FindTriSYCL
#---------------
#
# TODO : insert Copyright and licence
#########################
# FindTriSYCL.cmake
#########################
#
# Tools for finding and building with TriSYCL.
#
# User must define TRISYCL_INCLUDE_DIR pointing to the triSYCL
# include directory.
#
# Latest version of this file can be found at:
# https://github.com/triSYCL/triSYCL
# Requite CMake version 3.5 or higher
cmake_minimum_required (VERSION 3.5)
# Check that a supported host compiler can be found
if(CMAKE_COMPILER_IS_GNUCXX)
# Require at least gcc 5.4
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.4)
message(FATAL_ERROR
"host compiler - Not found! (gcc version must be at least 5.4)")
else()
message(STATUS "host compiler - gcc ${CMAKE_CXX_COMPILER_VERSION}")
endif()
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# Require at least clang 3.9
if (${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 3.9)
message(FATAL_ERROR
"host compiler - Not found! (clang version must be at least 3.9)")
else()
message(STATUS "host compiler - clang ${CMAKE_CXX_COMPILER_VERSION}")
endif()
else()
message(WARNING
"host compiler - Not found! (triSYCL supports GCC and Clang)")
endif()
#triSYCL options
option(TRISYCL_OPENMP "triSYCL multi-threading with OpenMP" ON)
option(TRISYCL_OPENCL "triSYCL OpenCL interoperability mode" OFF)
option(TRISYCL_NO_ASYNC "triSYCL use synchronous kernel execution" OFF)
option(TRISYCL_DEBUG "triSCYL use debug mode" OFF)
option(TRISYCL_DEBUG_STRUCTORS "triSYCL trace of object lifetimes" OFF)
option(TRISYCL_TRACE_KERNEL "triSYCL trace of kernel execution" OFF)
mark_as_advanced(TRISYCL_OPENMP)
mark_as_advanced(TRISYCL_OPENCL)
mark_as_advanced(TRISYCL_NO_ASYNC)
mark_as_advanced(TRISYCL_DEBUG)
mark_as_advanced(TRISYCL_DEBUG_STRUCTORS)
mark_as_advanced(TRISYCL_TRACE_KERNEL)
#triSYCL definitions
set(CL_SYCL_LANGUAGE_VERSION 220 CACHE STRING
"Host language version to be used by trisYCL (default is: 220)")
set(TRISYCL_CL_LANGUAGE_VERSION 220 CACHE STRING
"Device language version to be used by trisYCL (default is: 220)")
# triSYCL now requires c++17
set(CMAKE_CXX_STANDARD 17)
set(CXX_STANDARD_REQUIRED ON)
# Find OpenCL package
include(CMakeFindDependencyMacro)
if(TRISYCL_OPENCL)
find_dependency(OpenCL REQUIRED)
if(UNIX)
set(BOOST_COMPUTE_INCPATH /usr/include/compute CACHE PATH
"Path to Boost.Compute headers (default is: /usr/include/compute)")
endif()
endif()
# Find OpenMP package
if(TRISYCL_OPENMP)
find_dependency(OpenMP REQUIRED)
endif()
# Find Boost
find_dependency(Boost 1.58 REQUIRED COMPONENTS chrono log)
# If debug or trace we need boost log
if(TRISYCL_DEBUG OR TRISYCL_DEBUG_STRUCTORS OR TRISYCL_TRACE_KERNEL)
set(LOG_NEEDED ON)
else()
set(LOG_NEEDED OFF)
endif()
find_dependency(Threads REQUIRED)
# Find triSYCL directory
if (TRISYCL_INCLUDES AND TRISYCL_LIBRARIES)
set(TRISYCL_FIND_QUIETLY TRUE)
endif ()
find_path(TRISYCL_INCLUDE_DIR
NAMES sycl.hpp
PATHS $ENV{TRISYCLDIR} $ENV{TRISYCLDIR}/include ${INCLUDE_INSTALL_DIR}
PATH_SUFFIXES triSYCL
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(TriSYCL DEFAULT_MSG
TRISYCL_INCLUDE_DIR)
if(NOT TRISYCL_INCLUDE_DIR)
message(FATAL_ERROR
"triSYCL include directory - Not found! (please set TRISYCL_INCLUDE_DIR")
else()
message(STATUS "triSYCL include directory - Found ${TRISYCL_INCLUDE_DIR}")
endif()
include(CMakeParseArguments)
#######################
# add_sycl_to_target
#######################
function(add_sycl_to_target)
set(options)
set(one_value_args
TARGET
)
set(multi_value_args
SOURCES
)
cmake_parse_arguments(ADD_SYCL_ARGS
"${options}"
"${one_value_args}"
"${multi_value_args}"
${ARGN}
)
# Add include directories to the "#include <>" paths
target_include_directories (${ADD_SYCL_ARGS_TARGET} PUBLIC
${TRISYCL_INCLUDE_DIR}
${Boost_INCLUDE_DIRS}
$<$<BOOL:${TRISYCL_OPENCL}>:${OpenCL_INCLUDE_DIRS}>
$<$<BOOL:${TRISYCL_OPENCL}>:${BOOST_COMPUTE_INCPATH}>)
# Link dependencies
target_link_libraries(${ADD_SYCL_ARGS_TARGET}
$<$<BOOL:${TRISYCL_OPENCL}>:${OpenCL_LIBRARIES}>
Threads::Threads
$<$<BOOL:${LOG_NEEDED}>:Boost::log>
Boost::chrono)
# Compile definitions
target_compile_definitions(${ADD_SYCL_ARGS_TARGET} PUBLIC
EIGEN_SYCL_TRISYCL
$<$<BOOL:${TRISYCL_NO_ASYNC}>:TRISYCL_NO_ASYNC>
$<$<BOOL:${TRISYCL_OPENCL}>:TRISYCL_OPENCL>
$<$<BOOL:${TRISYCL_DEBUG}>:TRISYCL_DEBUG>
$<$<BOOL:${TRISYCL_DEBUG_STRUCTORS}>:TRISYCL_DEBUG_STRUCTORS>
$<$<BOOL:${TRISYCL_TRACE_KERNEL}>:TRISYCL_TRACE_KERNEL>
$<$<BOOL:${LOG_NEEDED}>:BOOST_LOG_DYN_LINK>)
# C++ and OpenMP requirements
target_compile_options(${ADD_SYCL_ARGS_TARGET} PUBLIC
${TRISYCL_COMPILE_OPTIONS}
$<$<BOOL:${TRISYCL_OPENMP}>:${OpenMP_CXX_FLAGS}>)
if(${TRISYCL_OPENMP} AND (NOT WIN32))
# Does not support generator expressions
set_target_properties(${ADD_SYCL_ARGS_TARGET}
PROPERTIES
LINK_FLAGS ${OpenMP_CXX_FLAGS})
endif()
endfunction()

View File

@@ -0,0 +1,53 @@
# Umfpack lib usually requires linking to a blas library.
# It is up to the user of this module to find a BLAS and link to it.
if (UMFPACK_INCLUDES AND UMFPACK_LIBRARIES)
set(UMFPACK_FIND_QUIETLY TRUE)
endif ()
find_path(UMFPACK_INCLUDES
NAMES
umfpack.h
PATHS
$ENV{UMFPACKDIR}
${INCLUDE_INSTALL_DIR}
PATH_SUFFIXES
suitesparse
ufsparse
)
find_library(UMFPACK_LIBRARIES umfpack PATHS $ENV{UMFPACKDIR} ${LIB_INSTALL_DIR})
if(UMFPACK_LIBRARIES)
if(NOT UMFPACK_LIBDIR)
get_filename_component(UMFPACK_LIBDIR ${UMFPACK_LIBRARIES} PATH)
endif()
find_library(COLAMD_LIBRARY colamd PATHS ${UMFPACK_LIBDIR} $ENV{UMFPACKDIR} ${LIB_INSTALL_DIR})
if(COLAMD_LIBRARY)
set(UMFPACK_LIBRARIES ${UMFPACK_LIBRARIES} ${COLAMD_LIBRARY})
endif ()
find_library(AMD_LIBRARY amd PATHS ${UMFPACK_LIBDIR} $ENV{UMFPACKDIR} ${LIB_INSTALL_DIR})
if(AMD_LIBRARY)
set(UMFPACK_LIBRARIES ${UMFPACK_LIBRARIES} ${AMD_LIBRARY})
endif ()
find_library(SUITESPARSE_LIBRARY SuiteSparse PATHS ${UMFPACK_LIBDIR} $ENV{UMFPACKDIR} ${LIB_INSTALL_DIR})
if(SUITESPARSE_LIBRARY)
set(UMFPACK_LIBRARIES ${UMFPACK_LIBRARIES} ${SUITESPARSE_LIBRARY})
endif ()
find_library(CHOLMOD_LIBRARY cholmod PATHS $ENV{UMFPACK_LIBDIR} $ENV{UMFPACKDIR} ${LIB_INSTALL_DIR})
if(CHOLMOD_LIBRARY)
set(UMFPACK_LIBRARIES ${UMFPACK_LIBRARIES} ${CHOLMOD_LIBRARY})
endif()
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(UMFPACK DEFAULT_MSG
UMFPACK_INCLUDES UMFPACK_LIBRARIES)
mark_as_advanced(UMFPACK_INCLUDES UMFPACK_LIBRARIES AMD_LIBRARY COLAMD_LIBRARY CHOLMOD_LIBRARY SUITESPARSE_LIBRARY)

View File

@@ -0,0 +1,19 @@
function(escape_string_as_regex _str_out _str_in)
string(REGEX REPLACE "\\\\" "\\\\\\\\" FILETEST2 "${_str_in}")
string(REGEX REPLACE "([.$+*?|-])" "\\\\\\1" FILETEST2 "${FILETEST2}")
string(REGEX REPLACE "\\^" "\\\\^" FILETEST2 "${FILETEST2}")
string(REGEX REPLACE "\\(" "\\\\(" FILETEST2 "${FILETEST2}")
string(REGEX REPLACE "\\)" "\\\\)" FILETEST2 "${FILETEST2}")
string(REGEX REPLACE "\\[" "\\\\[" FILETEST2 "${FILETEST2}")
string(REGEX REPLACE "\\]" "\\\\]" FILETEST2 "${FILETEST2}")
set(${_str_out} "${FILETEST2}" PARENT_SCOPE)
endfunction()
function(test_escape_string_as_regex)
set(test1 "\\.^$-+*()[]?|")
escape_string_as_regex(test2 "${test1}")
set(testRef "\\\\\\.\\^\\$\\-\\+\\*\\(\\)\\[\\]\\?\\|")
if(NOT test2 STREQUAL testRef)
message("Error in the escape_string_for_regex function : \n ${test1} was escaped as ${test2}, should be ${testRef}")
endif()
endfunction()

View File

@@ -0,0 +1,6 @@
# -*- cmake -*-
#
# UseEigen3.cmake
add_definitions ( ${EIGEN3_DEFINITIONS} )
include_directories ( ${EIGEN3_INCLUDE_DIRS} )