11# This list is required for static linking and exported to CaffeConfig.cmake
22set (Caffe_LINKER_LIBS "" )
33
4+ find_package (PythonInterp ${python_version} )
5+
46# ---[ 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})
69include_directories (SYSTEM ${Boost_INCLUDE_DIR} )
710list (APPEND Caffe_LINKER_LIBS ${Boost_LIBRARIES} )
811
@@ -54,6 +57,10 @@ if(USE_LEVELDB)
5457 list (APPEND Caffe_LINKER_LIBS ${Snappy_LIBRARIES} )
5558endif ()
5659
60+ find_package (JPEGTurbo REQUIRED)
61+ include_directories (SYSTEM ${JPEGTurbo_INCLUDE_DIR} )
62+ list (APPEND Caffe_LINKER_LIBS ${JPEGTurbo_LIBRARIES} )
63+
5764# ---[ CUDA
5865include (cmake/Cuda.cmake)
5966if (NOT HAVE_CUDA)
@@ -68,23 +75,20 @@ if(NOT HAVE_CUDA)
6875endif ()
6976
7077# ---[ 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} " )
8385endif ()
86+ include_directories (SYSTEM ${OpenCV_INCLUDE_DIRS} )
87+ list (APPEND Caffe_LINKER_LIBS ${OpenCV_LIBS} )
8488
8589# ---[ BLAS
8690if (NOT APPLE )
87- set (BLAS "Atlas " CACHE STRING "Selected BLAS library" )
91+ set (BLAS "Open " CACHE STRING "Selected BLAS library" )
8892 set_property (CACHE BLAS PROPERTY STRINGS "Atlas;Open;MKL" )
8993
9094 if (BLAS STREQUAL "Atlas" OR BLAS STREQUAL "atlas" )
@@ -109,46 +113,14 @@ endif()
109113
110114# ---[ Python
111115if (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)
146118 if (PYTHONLIBS_FOUND AND NUMPY_FOUND AND Boost_PYTHON_FOUND)
147119 set (HAVE_PYTHON TRUE )
148120 if (BUILD_python_layer)
149121 add_definitions (-DWITH_PYTHON_LAYER)
150122 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} )
152124 endif ()
153125 endif ()
154126endif ()
@@ -186,7 +158,7 @@ else()
186158endif ()
187159if (NCCL_FOUND)
188160 add_definitions (-DUSE_NCCL)
189- include_directories (SYSTEM ${NCCL_INCLUDE } )
161+ include_directories (SYSTEM ${NCCL_INCLUDE_DIR } )
190162 list (APPEND Caffe_LINKER_LIBS ${NCCL_LIBRARY} )
191163endif ()
192164
0 commit comments