提交 de54408c 编写于 作者: B Bikramjot Hanzra 提交者: Gines

Minor CMake Bugs Fixed (#420)

* minor CMake bugs fixed.
上级 1d9776de
......@@ -183,7 +183,14 @@ if (UNIX AND NOT APPLE)
endif ()
find_package(GFlags)
find_package(Glog)
find_package(OpenCV)
if (OpenCV_CONFIG_FILE)
include (${OpenCV_CONFIG_FILE})
elseif (OpenCV_INCLUDE_DIRS AND OpenCV_LIBS_DIR)
file(GLOB_RECURSE OpenCV_LIBS "${OpenCV_LIBS_DIR}*.so")
set(OpenCV_FOUND 1)
else ()
find_package(OpenCV)
endif (OpenCV_CONFIG_FILE)
# 3D
if (BUILD_MODULE_3D)
......@@ -307,12 +314,6 @@ if (UNIX AND NOT APPLE)
set(Caffe_FOUND 1)
endif (Caffe_INCLUDE_DIRS AND Caffe_LIBS AND NOT BUILD_CAFFE)
# Check if caffe is installed in known paths
if (NOT Caffe_FOUND AND NOT BUILD_CAFFE)
message(STATUS "Looking for caffe around in expected paths.")
find_package(Caffe)
endif (NOT Caffe_FOUND AND NOT BUILD_CAFFE)
# Else build from scratch
if (BUILD_CAFFE)
......
......@@ -12,14 +12,15 @@ find_path(Caffe_INCLUDE_DIRS NAMES
caffe/proto/caffe.pb.h
caffe/util/io.hpp
HINTS
/usr/local/include
${CMAKE_BINARY_DIR}/caffe/include)
${CMAKE_BINARY_DIR}/caffe/include
NO_DEFAULT_PATH)
find_library(Caffe_LIBS NAMES caffe
HINTS
/usr/local/lib
${CMAKE_BINARY_DIR}/caffe/lib
${CMAKE_BINARY_DIR}/caffe/lib/x86_64-linux-gnu)
${CMAKE_BINARY_DIR}/caffe/lib/x86_64-linux-gnu
NO_DEFAULT_PATH)
if (Caffe_LIBS AND Caffe_INCLUDE_DIRS)
set(Caffe_FOUND 1)
......
......@@ -269,9 +269,16 @@ cmake ..
```
##### SCENARIO 2 -- Caffe installed and OpenCV build from source
In this example, we assume that Caffe and OpenCV are already present. The user needs to supply the paths of the library to CMake. For OpenCV, specify the `OpenCV_DIR` which is where the user build OpenCV. For Caffe, specify the include directory and library using the `Caffe_INCLUDE_DIRS` and `Caffe_LIBS` variables. This will be where you installed Caffe. Below is an example of the same.
In this example, we assume that Caffe and OpenCV are already present. The user needs to supply the paths of the libraries and the include directories to CMake. For OpenCV, specify the include directories and the libraries directory using `OpenCV_INCLUDE_DIRS` and `OpenCV_LIBS_DIR` variables respectively. Alternatively, the user can also specify the path to the `OpenCVConfig.cmake` file by setting the `OpenCV_CONFIG_FILE` variable. For Caffe, specify the include directory and library using the `Caffe_INCLUDE_DIRS` and `Caffe_LIBS` variables. This will be where you installed Caffe. Below is an example of the same.
```bash
cmake -DOpenCV_DIR=/home/"${USER}"/softwares/opencv/build \
cmake -DOpenCV_INCLUDE_DIRS=/home/"${USER}"/softwares/opencv/build/install/include \
-DOpenCV_LIBS_DIR=/home/"${USER}"/softwares/opencv/build/install/lib \
-DCaffe_INCLUDE_DIRS=/home/"${USER}"/softwares/caffe/build/install/include \
-DCaffe_LIBS=/home/"${USER}"/softwares/caffe/build/install/lib/libcaffe.so -DBUILD_CAFFE=OFF ..
```
```bash
cmake -DOpenCV_CONFIG_FILE=/home/"${USER}"/softwares/opencv/build/install/share/OpenCV/OpenCVConfig.cmake \
-DCaffe_INCLUDE_DIRS=/home/"${USER}"/softwares/caffe/build/install/include \
-DCaffe_LIBS=/home/"${USER}"/softwares/caffe/build/install/lib/libcaffe.so -DBUILD_CAFFE=OFF ..
```
......@@ -279,5 +286,10 @@ cmake -DOpenCV_DIR=/home/"${USER}"/softwares/opencv/build \
##### SCENARIO 3 -- OpenCV already installed
If Caffe is not already present but OpenCV is, then use the below command.
```bash
cmake -DOpenCV_DIR=/home/"${USER}"/softwares/opencv/build
cmake -DOpenCV_INCLUDE_DIRS=/home/"${USER}"/softwares/opencv/build/install/include \
-DOpenCV_LIBS_DIR=/home/"${USER}"/softwares/opencv/build/install/lib ..
```
```bash
cmake -DOpenCV_CONFIG_FILE=/home/"${USER}"/softwares/opencv/build/install/share/OpenCV/OpenCVConfig.cmake ..
```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册