OpenCVFindAtlas.cmake 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. # Find the Atlas (and Lapack) libraries
  46. #
  47. # The following variables are optionally searched for defaults
  48. # Atlas_ROOT_DIR: Base directory where all Atlas components are found
  49. #
  50. # The following are set after configuration is done:
  51. # Atlas_FOUND
  52. # Atlas_INCLUDE_DIRS
  53. # Atlas_LIBRARIES
  54. # Atlas_LIBRARYRARY_DIRS
  55. set(Atlas_INCLUDE_SEARCH_PATHS
  56. /usr/include/atlas
  57. /usr/include/atlas-base
  58. $ENV{Atlas_ROOT_DIR}
  59. $ENV{Atlas_ROOT_DIR}/include
  60. )
  61. set(Atlas_LIB_SEARCH_PATHS
  62. /usr/lib/atlas
  63. /usr/lib/atlas-base
  64. $ENV{Atlas_ROOT_DIR}
  65. $ENV{Atlas_ROOT_DIR}/lib
  66. )
  67. find_path(Atlas_CBLAS_INCLUDE_DIR NAMES cblas.h PATHS ${Atlas_INCLUDE_SEARCH_PATHS})
  68. find_path(Atlas_CLAPACK_INCLUDE_DIR NAMES lapacke.h PATHS ${Atlas_INCLUDE_SEARCH_PATHS})
  69. find_library(Atlas_CBLAS_LIBRARY NAMES ptcblas_r ptcblas cblas_r cblas PATHS ${Atlas_LIB_SEARCH_PATHS})
  70. find_library(Atlas_BLAS_LIBRARY NAMES atlas_r atlas PATHS ${Atlas_LIB_SEARCH_PATHS})
  71. find_library(Atlas_LAPACK_LIBRARY NAMES lapack alapack_r alapack lapack_atlas PATHS ${Atlas_LIB_SEARCH_PATHS})
  72. set(LOOKED_FOR
  73. Atlas_CBLAS_INCLUDE_DIR
  74. Atlas_CLAPACK_INCLUDE_DIR
  75. Atlas_CBLAS_LIBRARY
  76. Atlas_BLAS_LIBRARY
  77. Atlas_LAPACK_LIBRARY
  78. )
  79. include(FindPackageHandleStandardArgs)
  80. find_package_handle_standard_args(Atlas DEFAULT_MSG ${LOOKED_FOR})
  81. if(ATLAS_FOUND)
  82. set(Atlas_INCLUDE_DIR ${Atlas_CBLAS_INCLUDE_DIR} ${Atlas_CLAPACK_INCLUDE_DIR})
  83. set(Atlas_LIBRARIES ${Atlas_LAPACK_LIBRARY} ${Atlas_CBLAS_LIBRARY} ${Atlas_BLAS_LIBRARY})
  84. mark_as_advanced(${LOOKED_FOR})
  85. message(STATUS "Found Atlas (include: ${Atlas_CBLAS_INCLUDE_DIR}, library: ${Atlas_BLAS_LIBRARY})")
  86. endif(ATLAS_FOUND)