FindCBLAS.cmake 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. # ==================================================================================================
  2. # This file is part of the CLBlast project. The project is licensed under Apache Version 2.0. This
  3. # project loosely follows the Google C++ styleguide and uses a tab-size of two spaces and a max-
  4. # width of 100 characters per line.
  5. #
  6. # Author(s):
  7. # Cedric Nugteren <www.cedricnugteren.nl>
  8. #
  9. # ==================================================================================================
  10. #
  11. # Defines the following variables:
  12. # CBLAS_FOUND Boolean holding whether or not the Netlib BLAS library was found
  13. # CBLAS_INCLUDE_DIRS The Netlib BLAS include directory
  14. # CBLAS_LIBRARIES The Netlib BLAS library
  15. #
  16. # In case BLAS is not installed in the default directory, set the CBLAS_ROOT variable to point to
  17. # the root of BLAS, such that 'cblas.h' can be found in $CBLAS_ROOT/include. This can either be
  18. # done using an environmental variable (e.g. export CBLAS_ROOT=/path/to/BLAS) or using a CMake
  19. # variable (e.g. cmake -DCBLAS_ROOT=/path/to/BLAS ..).
  20. #
  21. # ==================================================================================================
  22. # Sets the possible install locations
  23. set(CBLAS_HINTS
  24. ${CBLAS_ROOT}
  25. $ENV{CBLAS_ROOT}
  26. )
  27. set(CBLAS_PATHS
  28. /usr
  29. /usr/local
  30. /usr/local/opt
  31. /System/Library/Frameworks
  32. )
  33. # Finds the include directories
  34. find_path(CBLAS_INCLUDE_DIRS
  35. NAMES cblas.h
  36. HINTS ${CBLAS_HINTS}
  37. PATH_SUFFIXES
  38. include inc include/x86_64 include/x64
  39. openblas/include include/blis blis/include blis/include/blis
  40. Accelerate.framework/Versions/Current/Frameworks/vecLib.framework/Versions/Current/Headers
  41. PATHS ${CBLAS_PATHS}
  42. DOC "Netlib BLAS include header cblas.h"
  43. )
  44. mark_as_advanced(CBLAS_INCLUDE_DIRS)
  45. # Finds the library
  46. find_library(CBLAS_LIBRARIES
  47. NAMES cblas blas blis openblas accelerate
  48. HINTS ${CBLAS_HINTS}
  49. PATH_SUFFIXES
  50. lib lib64 lib/x86_64 lib/x64 lib/x86 lib/Win32 lib/import lib64/import
  51. openblas/lib blis/lib lib/atlas-base
  52. PATHS ${CBLAS_PATHS}
  53. DOC "Netlib BLAS library"
  54. )
  55. mark_as_advanced(CBLAS_LIBRARIES)
  56. # ==================================================================================================
  57. # Notification messages
  58. if(NOT CBLAS_INCLUDE_DIRS)
  59. message(STATUS "Could NOT find 'cblas.h', install a CPU Netlib BLAS or set CBLAS_ROOT")
  60. endif()
  61. if(NOT CBLAS_LIBRARIES)
  62. message(STATUS "Could NOT find a CPU Netlib BLAS library, install it or set CBLAS_ROOT")
  63. endif()
  64. # Determines whether or not BLAS was found
  65. include(FindPackageHandleStandardArgs)
  66. find_package_handle_standard_args(CBLAS DEFAULT_MSG CBLAS_INCLUDE_DIRS CBLAS_LIBRARIES)
  67. # ==================================================================================================