1
1
# This list is required for static linking and exported to CaffeConfig.cmake
2
2
set (Caffe_LINKER_LIBS "" )
3
3
4
+ find_package (PythonInterp ${python_version} )
5
+
4
6
# ---[ Boost
5
- find_package (Boost 1.46 REQUIRED COMPONENTS system thread filesystem)
7
+ find_package (Boost 1.54 REQUIRED COMPONENTS system thread filesystem regex python-py${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR} )
8
+ set (Boost_PYTHON_FOUND ${Boost_PYTHON-PY${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR} _FOUND})
6
9
include_directories (SYSTEM ${Boost_INCLUDE_DIR} )
7
10
list (APPEND Caffe_LINKER_LIBS ${Boost_LIBRARIES} )
8
11
@@ -54,6 +57,10 @@ if(USE_LEVELDB)
54
57
list (APPEND Caffe_LINKER_LIBS ${Snappy_LIBRARIES} )
55
58
endif ()
56
59
60
+ find_package (JPEGTurbo REQUIRED)
61
+ include_directories (SYSTEM ${JPEGTurbo_INCLUDE_DIR} )
62
+ list (APPEND Caffe_LINKER_LIBS ${JPEGTurbo_LIBRARIES} )
63
+
57
64
# ---[ CUDA
58
65
include (cmake/Cuda.cmake)
59
66
if (NOT HAVE_CUDA)
@@ -68,23 +75,20 @@ if(NOT HAVE_CUDA)
68
75
endif ()
69
76
70
77
# ---[ OpenCV
71
- if (USE_OPENCV)
72
- find_package (OpenCV QUIET COMPONENTS imgcodecs)
73
- if (OPENCV_IMGCODECS_FOUND)
74
- find_package (OpenCV REQUIRED COMPONENTS core imgcodecs imgproc)
75
- message (STATUS "Found OpenCV 3.x: ${OpenCV_CONFIG_PATH} " )
76
- else ()
77
- find_package (OpenCV REQUIRED COMPONENTS core highgui imgproc)
78
- message (STATUS "Found OpenCV 2.x: ${OpenCV_CONFIG_PATH} " )
79
- endif ()
80
- include_directories (SYSTEM ${OpenCV_INCLUDE_DIRS} )
81
- list (APPEND Caffe_LINKER_LIBS ${OpenCV_LIBS} )
82
- add_definitions (-DUSE_OPENCV)
78
+ find_package (OpenCV QUIET COMPONENTS imgcodecs)
79
+ if (OPENCV_IMGCODECS_FOUND)
80
+ find_package (OpenCV REQUIRED COMPONENTS core imgcodecs imgproc)
81
+ message (STATUS "Found OpenCV 3.x: ${OpenCV_CONFIG_PATH} " )
82
+ else ()
83
+ find_package (OpenCV REQUIRED COMPONENTS core highgui imgproc)
84
+ message (STATUS "Found OpenCV 2.x: ${OpenCV_CONFIG_PATH} " )
83
85
endif ()
86
+ include_directories (SYSTEM ${OpenCV_INCLUDE_DIRS} )
87
+ list (APPEND Caffe_LINKER_LIBS ${OpenCV_LIBS} )
84
88
85
89
# ---[ BLAS
86
90
if (NOT APPLE )
87
- set (BLAS "Atlas " CACHE STRING "Selected BLAS library" )
91
+ set (BLAS "Open " CACHE STRING "Selected BLAS library" )
88
92
set_property (CACHE BLAS PROPERTY STRINGS "Atlas;Open;MKL" )
89
93
90
94
if (BLAS STREQUAL "Atlas" OR BLAS STREQUAL "atlas" )
@@ -109,46 +113,14 @@ endif()
109
113
110
114
# ---[ Python
111
115
if (BUILD_python)
112
- if (NOT "${python_version} " VERSION_LESS "3.0.0" )
113
- # use python3
114
- find_package (PythonInterp 3.0)
115
- find_package (PythonLibs 3.0)
116
- find_package (NumPy 1.7.1)
117
- # Find the matching boost python implementation
118
- set (version ${PYTHONLIBS_VERSION_STRING} )
119
-
120
- STRING ( REGEX REPLACE "[^0-9]" "" boost_py_version ${version} )
121
- find_package (Boost 1.46 COMPONENTS "python-py${boost_py_version} " )
122
- set (Boost_PYTHON_FOUND ${Boost_PYTHON-PY${boost_py_version} _FOUND})
123
-
124
- while (NOT "${version} " STREQUAL "" AND NOT Boost_PYTHON_FOUND)
125
- STRING ( REGEX REPLACE "([0-9.]+).[0-9]+" "\\ 1" version ${version} )
126
-
127
- STRING ( REGEX REPLACE "[^0-9]" "" boost_py_version ${version} )
128
- find_package (Boost 1.46 COMPONENTS "python-py${boost_py_version} " )
129
- set (Boost_PYTHON_FOUND ${Boost_PYTHON-PY${boost_py_version} _FOUND})
130
-
131
- STRING ( REGEX MATCHALL "([0-9.]+).[0-9]+" has_more_version ${version} )
132
- if ("${has_more_version} " STREQUAL "" )
133
- break ()
134
- endif ()
135
- endwhile ()
136
- if (NOT Boost_PYTHON_FOUND)
137
- find_package (Boost 1.46 COMPONENTS python)
138
- endif ()
139
- else ()
140
- # disable Python 3 search
141
- find_package (PythonInterp 2.7)
142
- find_package (PythonLibs 2.7)
143
- find_package (NumPy 1.7.1)
144
- find_package (Boost 1.46 COMPONENTS python)
145
- endif ()
116
+ find_package (PythonLibs ${python_version} )
117
+ find_package (NumPy 1.7.1)
146
118
if (PYTHONLIBS_FOUND AND NUMPY_FOUND AND Boost_PYTHON_FOUND)
147
119
set (HAVE_PYTHON TRUE )
148
120
if (BUILD_python_layer)
149
121
add_definitions (-DWITH_PYTHON_LAYER)
150
122
include_directories (SYSTEM ${PYTHON_INCLUDE_DIRS} ${NUMPY_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} )
151
- list (APPEND Caffe_LINKER_LIBS ${PYTHON_LIBRARIES} ${Boost_LIBRARIES} )
123
+ list (APPEND Caffe_LINKER_LIBS ${PYTHON_LIBRARIES} )
152
124
endif ()
153
125
endif ()
154
126
endif ()
@@ -186,7 +158,7 @@ else()
186
158
endif ()
187
159
if (NCCL_FOUND)
188
160
add_definitions (-DUSE_NCCL)
189
- include_directories (SYSTEM ${NCCL_INCLUDE } )
161
+ include_directories (SYSTEM ${NCCL_INCLUDE_DIR } )
190
162
list (APPEND Caffe_LINKER_LIBS ${NCCL_LIBRARY} )
191
163
endif ()
192
164
0 commit comments