Add python3-setuptools dependency for python 3.12
[platform/upstream/opencv.git] / cmake / OpenCVFindOpenBLAS.cmake
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
46 SET(Open_BLAS_INCLUDE_SEARCH_PATHS
47   $ENV{OpenBLAS_HOME}
48   $ENV{OpenBLAS_HOME}/include
49   $ENV{OpenBLAS_HOME}/include/openblas
50   /opt/OpenBLAS/include
51   /usr/local/include/openblas
52   /usr/include/openblas
53   /usr/local/include/openblas-base
54   /usr/include/openblas-base
55   /usr/local/include
56   /usr/include
57 )
58
59 SET(Open_BLAS_LIB_SEARCH_PATHS
60         $ENV{OpenBLAS}
61         $ENV{OpenBLAS}/lib
62         $ENV{OpenBLAS_HOME}
63         $ENV{OpenBLAS_HOME}/lib
64         /opt/OpenBLAS/lib
65         /usr/local/lib64
66         /usr/local/lib
67         /lib/openblas-base
68         /lib64/
69         /lib/
70         /usr/lib/openblas-base
71         /usr/lib64
72         /usr/lib
73  )
74
75 FIND_PATH(OpenBLAS_INCLUDE_DIR NAMES cblas.h PATHS ${Open_BLAS_INCLUDE_SEARCH_PATHS} NO_DEFAULT_PATH)
76 FIND_LIBRARY(OpenBLAS_LIB NAMES openblas PATHS ${Open_BLAS_LIB_SEARCH_PATHS}  NO_DEFAULT_PATH)
77
78 SET(OpenBLAS_FOUND ON)
79
80 #    Check include files
81 IF(NOT OpenBLAS_INCLUDE_DIR)
82     SET(OpenBLAS_FOUND OFF)
83     MESSAGE(STATUS "Could not find OpenBLAS include. Turning OpenBLAS_FOUND off")
84 ENDIF()
85
86 #    Check libraries
87 IF(NOT OpenBLAS_LIB)
88     SET(OpenBLAS_FOUND OFF)
89     MESSAGE(STATUS "Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off")
90 ENDIF()
91
92 IF (OpenBLAS_FOUND)
93   IF (NOT OpenBLAS_FIND_QUIETLY)
94     MESSAGE(STATUS "Found OpenBLAS libraries: ${OpenBLAS_LIB}")
95     MESSAGE(STATUS "Found OpenBLAS include: ${OpenBLAS_INCLUDE_DIR}")
96   ENDIF (NOT OpenBLAS_FIND_QUIETLY)
97 ELSE (OpenBLAS_FOUND)
98   IF (OpenBLAS_FIND_REQUIRED)
99     MESSAGE(FATAL_ERROR "Could not find OpenBLAS")
100   ENDIF (OpenBLAS_FIND_REQUIRED)
101 ENDIF (OpenBLAS_FOUND)
102
103 MARK_AS_ADVANCED(
104     OpenBLAS_INCLUDE_DIR
105     OpenBLAS_LIB
106     OpenBLAS
107 )