SINGA-203 Add OpenCV detection for cmake compilation If USE_OPENCV is ON (default OFF), the compilation will search for OpenCV libraries installed in the system.
Project: http://git-wip-us.apache.org/repos/asf/incubator-singa/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-singa/commit/67ee3c5b Tree: http://git-wip-us.apache.org/repos/asf/incubator-singa/tree/67ee3c5b Diff: http://git-wip-us.apache.org/repos/asf/incubator-singa/diff/67ee3c5b Branch: refs/heads/dev Commit: 67ee3c5bb97c484f9b4da3db45b5ab55310ae0b9 Parents: bef1db0 Author: xiezl <[email protected]> Authored: Tue Jun 21 17:51:59 2016 +0800 Committer: jixin <[email protected]> Committed: Thu Jun 23 17:20:38 2016 +0800 ---------------------------------------------------------------------- cmake/Dependencies.cmake | 7 +++++++ test/CMakeLists.txt | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/67ee3c5b/cmake/Dependencies.cmake ---------------------------------------------------------------------- diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake index 11823b7..ab869fb 100644 --- a/cmake/Dependencies.cmake +++ b/cmake/Dependencies.cmake @@ -33,6 +33,13 @@ INCLUDE_DIRECTORIES(SYSTEM ${GLOG_INCLUDE_DIRS}) LIST(APPEND SINGA_LINKER_LIBS ${GLOG_LIBRARIES}) #MESSAGE(STATUS "Found glog at ${GLOG_INCLUDE_DIRS}") +IF(USE_OPENCV) + FIND_PACKAGE(OpenCV REQUIRED) + MESSAGE(STATUS "Found OpenCV_${OpenCV_VERSION} at ${OpenCV_INCLUDE_DIRS}") + INCLUDE_DIRECTORIES(SYSTEM ${OpenCV_INCLUDE_DIRS}) + LIST(APPEND SINGA_LINKER_LIBS ${OpenCV_LIBRARIES}) +ENDIF() + #LIST(APPEND SINGA_LINKER_LIBS "/home/wangwei/local/lib/libopenblas.so") #MESSAGE(STATUS "link lib : " ${SINGA_LINKER_LIBS}) http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/67ee3c5b/test/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 92401ad..95c3cf7 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -7,5 +7,6 @@ AUX_SOURCE_DIRECTORY(singa singa_test_source) ADD_EXECUTABLE(test_singa "gtest/gtest_main.cc" ${singa_test_source}) ADD_DEPENDENCIES(test_singa singa_core singa_utils) MESSAGE(STATUS "link libs" ${singa_linker_libs}) -TARGET_LINK_LIBRARIES(test_singa gtest singa_core singa_utils singa_model proto protobuf ${SINGA_LINKER_LIBS}) +TARGET_LINK_LIBRARIES(test_singa gtest singa_core singa_utils singa_model + singa_io proto protobuf ${SINGA_LINKER_LIBS}) SET_TARGET_PROPERTIES(test_singa PROPERTIES LINK_FLAGS "${LINK_FLAGS} -pthread")
