OpenCVFindOpenBLAS.cmake 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. #COPYRIGHT
  2. #
  3. #All contributions by the University of California:
  4. #Copyright (c) 2014, 2015, The Regents of the University of California (Regents)
  5. #All rights reserved.
  6. #
  7. #All other contributions:
  8. #Copyright (c) 2014, 2015, the respective contributors
  9. #All rights reserved.
  10. #
  11. #Caffe uses a shared copyright model: each contributor holds copyright over
  12. #their contributions to Caffe. The project versioning records all such
  13. #contribution and copyright details. If a contributor wants to further mark
  14. #their specific copyright on a particular contribution, they should indicate
  15. #their copyright solely in the commit message of the change when it is
  16. #committed.
  17. #
  18. #LICENSE
  19. #
  20. #Redistribution and use in source and binary forms, with or without
  21. #modification, are permitted provided that the following conditions are met:
  22. #
  23. #1. Redistributions of source code must retain the above copyright notice, this
  24. # list of conditions and the following disclaimer.
  25. #2. Redistributions in binary form must reproduce the above copyright notice,
  26. # this list of conditions and the following disclaimer in the documentation
  27. # and/or other materials provided with the distribution.
  28. #
  29. #THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  30. #ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  31. #WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  32. #DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
  33. #ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  34. #(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  35. #LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  36. #ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  37. #(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  38. #SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  39. #
  40. #CONTRIBUTION AGREEMENT
  41. #
  42. #By contributing to the BVLC/caffe repository through pull-request, comment,
  43. #or otherwise, the contributor releases their content to the
  44. #license and copyright terms herein.
  45. SET(Open_BLAS_INCLUDE_SEARCH_PATHS
  46. $ENV{OpenBLAS_HOME}
  47. $ENV{OpenBLAS_HOME}/include
  48. $ENV{OpenBLAS_HOME}/include/openblas
  49. /opt/OpenBLAS/include
  50. /usr/local/include/openblas
  51. /usr/include/openblas
  52. /usr/local/include/openblas-base
  53. /usr/include/openblas-base
  54. /usr/local/include
  55. /usr/include
  56. )
  57. SET(Open_BLAS_LIB_SEARCH_PATHS
  58. $ENV{OpenBLAS}
  59. $ENV{OpenBLAS}/lib
  60. $ENV{OpenBLAS_HOME}
  61. $ENV{OpenBLAS_HOME}/lib
  62. /opt/OpenBLAS/lib
  63. /usr/local/lib64
  64. /usr/local/lib
  65. /lib/openblas-base
  66. /lib64/
  67. /lib/
  68. /usr/lib/openblas-base
  69. /usr/lib64
  70. /usr/lib
  71. )
  72. FIND_PATH(OpenBLAS_INCLUDE_DIR NAMES cblas.h PATHS ${Open_BLAS_INCLUDE_SEARCH_PATHS} NO_DEFAULT_PATH)
  73. FIND_LIBRARY(OpenBLAS_LIB NAMES openblas PATHS ${Open_BLAS_LIB_SEARCH_PATHS} NO_DEFAULT_PATH)
  74. SET(OpenBLAS_FOUND ON)
  75. # Check include files
  76. IF(NOT OpenBLAS_INCLUDE_DIR)
  77. SET(OpenBLAS_FOUND OFF)
  78. MESSAGE(STATUS "Could not find OpenBLAS include. Turning OpenBLAS_FOUND off")
  79. ENDIF()
  80. # Check libraries
  81. IF(NOT OpenBLAS_LIB)
  82. SET(OpenBLAS_FOUND OFF)
  83. MESSAGE(STATUS "Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off")
  84. ENDIF()
  85. IF (OpenBLAS_FOUND)
  86. IF (NOT OpenBLAS_FIND_QUIETLY)
  87. MESSAGE(STATUS "Found OpenBLAS libraries: ${OpenBLAS_LIB}")
  88. MESSAGE(STATUS "Found OpenBLAS include: ${OpenBLAS_INCLUDE_DIR}")
  89. ENDIF (NOT OpenBLAS_FIND_QUIETLY)
  90. ELSE (OpenBLAS_FOUND)
  91. IF (OpenBLAS_FIND_REQUIRED)
  92. MESSAGE(FATAL_ERROR "Could not find OpenBLAS")
  93. ENDIF (OpenBLAS_FIND_REQUIRED)
  94. ENDIF (OpenBLAS_FOUND)
  95. MARK_AS_ADVANCED(
  96. OpenBLAS_INCLUDE_DIR
  97. OpenBLAS_LIB
  98. OpenBLAS
  99. )