From 1801d919e7000e90c124722cf1f543f93e6cd126 Mon Sep 17 00:00:00 2001 From: Justin Carpentier Date: Mon, 12 Feb 2024 16:17:18 +0100 Subject: [PATCH] external/accelerate: add FindAccelerate.cmake --- find-external/Accelerate/FindAccelerate.cmake | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 find-external/Accelerate/FindAccelerate.cmake diff --git a/find-external/Accelerate/FindAccelerate.cmake b/find-external/Accelerate/FindAccelerate.cmake new file mode 100644 index 000000000..341ce8395 --- /dev/null +++ b/find-external/Accelerate/FindAccelerate.cmake @@ -0,0 +1,35 @@ +if(Accelerate_INCLUDES AND Accelerate_LIBRARIES) + set(Accelerate_FIND_QUIETLY TRUE) +endif() + +find_path( + Accelerate_INCLUDES + NAMES Accelerate.h + PATHS $ENV{ACCELERATEDIR}) + +find_library(Accelerate_LIBRARIES Accelerate PATHS $ENV{ACCELERATEDIR}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Accelerate DEFAULT_MSG Accelerate_INCLUDES + Accelerate_LIBRARIES) + +if(Accelerate_FOUND) + get_filename_component(Accelerate_PARENTDIR ${Accelerate_INCLUDES} DIRECTORY) + + file(GLOB_RECURSE SparseHeader ${Accelerate_PARENTDIR}/Sparse.h) + + if("${SparseHeader}" STREQUAL "") + message(STATUS "Accelerate sparse matrix support was not found.") + set(Accelerate_FOUND FALSE) + endif() +endif() + +if(Accelerate_FOUND) + add_library(Accelerate SHARED IMPORTED) + set_target_properties( + Accelerate + PROPERTIES IMPORTED_LOCATION "${Accelerate_LIBRARIES}" + INTERFACE_INCLUDE_DIRECTORIES "${Accelerate_INCLUDES}") +endif(Accelerate_FOUND) + +mark_as_advanced(Accelerate_INCLUDES Accelerate_LIBRARIES)