[openrtm-commit:01119] r89 - in branches/newCMakeForVC2010/ImageProcessing/opencv/components/PGRCamera: cmake src
openrtm @ openrtm.org
openrtm @ openrtm.org
2013年 8月 6日 (火) 15:18:33 JST
Author: kawauchi
Date: 2013-08-06 15:18:33 +0900 (Tue, 06 Aug 2013)
New Revision: 89
Added:
branches/newCMakeForVC2010/ImageProcessing/opencv/components/PGRCamera/cmake/FindFlyCapture.cmake
Modified:
branches/newCMakeForVC2010/ImageProcessing/opencv/components/PGRCamera/src/CMakeLists.txt
Log:
Automatic link corresponding FlyCapture2 SDK library. refs #2704
Added: branches/newCMakeForVC2010/ImageProcessing/opencv/components/PGRCamera/cmake/FindFlyCapture.cmake
===================================================================
--- branches/newCMakeForVC2010/ImageProcessing/opencv/components/PGRCamera/cmake/FindFlyCapture.cmake (rev 0)
+++ branches/newCMakeForVC2010/ImageProcessing/opencv/components/PGRCamera/cmake/FindFlyCapture.cmake 2013-08-06 06:18:33 UTC (rev 89)
@@ -0,0 +1,104 @@
+# Find FlyCapture2 on Windows/Linux.
+#
+# Once loaded this will define
+# FLYCAPTURE_FOUND - system has FlyCapture2
+# FLYCAPTURE_INCLUDE_DIR - include directory for FlyCapture2
+# FLYCAPTURE_LIBRARY_DIRS - library directries for FlyCapture2
+# FLYCAPTURE2_LIB - FlyCapture2.lib you need to link to
+# FLYCAPTURE2_DLL - FlyCapture2.dll you need to link to
+
+if(MSVC)
+ if(CMAKE_CL_64)
+
+ if(EXISTS "C:\\Program Files\\Point Grey Research\\FlyCapture2")
+ set(FLYCAPTURE_ROOT "C:\\Program Files\\Point Grey Research\\FlyCapture2")
+
+ else(EXISTS "C:\\Program Files\\Point Grey Research\\FlyCapture2")
+
+ if(EXISTS "C:\\Program Files (x86)\\Point Grey Research\\FlyCapture2")
+ set(FLYCAPTURE_ROOT "C:\\Program Files (x86)\\Point Grey Research\\FlyCapture2")
+ endif(EXISTS "C:\\Program Files (x86)\\Point Grey Research\\FlyCapture2")
+ endif(EXISTS "C:\\Program Files\\Point Grey Research\\FlyCapture2")
+
+ else(CMAKE_CL_64)
+
+ if(EXISTS "C:\\Program Files (x86)\\Point Grey Research\\FlyCapture2")
+ set(FLYCAPTURE_ROOT "C:\\Program Files (x86)\\Point Grey Research\\FlyCapture2")
+
+ else(EXISTS "C:\\Program Files (x86)\\Point Grey Research\\FlyCapture2")
+
+ if(EXISTS "C:\\Program Files\\Point Grey Research\\FlyCapture2")
+ set(FLYCAPTURE_ROOT "C:\\Program Files\\Point Grey Research\\FlyCapture2")
+ endif(EXISTS "C:\\Program Files\\Point Grey Research\\FlyCapture2")
+ endif(EXISTS "C:\\Program Files (x86)\\Point Grey Research\\FlyCapture2")
+
+ endif(CMAKE_CL_64)
+ message(STATUS "FLYCAPTURE_ROOT : ${FLYCAPTURE_ROOT}")
+
+ if(FLYCAPTURE_ROOT)
+ set(FLYCAPTURE_INCLUDE_DIR "${FLYCAPTURE_ROOT}/include")
+ message(STATUS "FLYCAPTURE_INCLUDE_DIR : ${FLYCAPTURE_INCLUDE_DIR}")
+ endif(FLYCAPTURE_ROOT)
+
+ if(FLYCAPTURE_INCLUDE_DIR)
+ if(CMAKE_CL_64)
+ if(EXISTS "${FLYCAPTURE_ROOT}/lib64")
+ set(FLYCAPTURE_LIBRARY_DIR "${FLYCAPTURE_ROOT}/lib64")
+ set(FLYCAPTURE_DLL_DIR "${FLYCAPTURE_ROOT}/bin64")
+
+ else(EXISTS "${FLYCAPTURE_ROOT}/lib64")
+ set(FLYCAPTURE_LIBRARY_DIR "${FLYCAPTURE_ROOT}/lib")
+ set(FLYCAPTURE_DLL_DIR "${FLYCAPTURE_ROOT}/bin")
+ endif(EXISTS "${FLYCAPTURE_ROOT}/lib64")
+
+ else(CMAKE_CL_64)
+ if(EXISTS "${FLYCAPTURE_ROOT}/lib")
+ set(FLYCAPTURE_LIBRARY_DIR "${FLYCAPTURE_ROOT}/lib")
+ set(FLYCAPTURE_DLL_DIR "${FLYCAPTURE_ROOT}/bin")
+
+ else(EXISTS "${FLYCAPTURE_ROOT}/lib")
+ set(FLYCAPTURE_LIBRARY_DIR "${FLYCAPTURE_ROOT}/lib64")
+ set(FLYCAPTURE_DLL_DIR "${FLYCAPTURE_ROOT}/bin64")
+ endif(EXISTS "${FLYCAPTURE_ROOT}/lib")
+
+ endif(CMAKE_CL_64)
+
+ find_library(FLYCAPTURE2_LIB
+ NAMES FlyCapture2
+ PATHS
+ "${FLYCAPTURE_LIBRARY_DIR}"
+ )
+ find_library(FLYCAPTURE2_DLL
+ NAMES FlyCapture2
+ PATHS
+ "${FLYCAPTURE_DLL_DIR}"
+ )
+ endif(FLYCAPTURE_INCLUDE_DIR)
+
+else(MSVC)
+
+ find_path(FLYCAPTURE_INCLUDE_DIR
+ NAMES FlyCapture2.h
+ PATHS "/usr/include/flycapture"
+ )
+
+ if(FLYCAPTURE_INCLUDE_DIR)
+ set(FLYCAPTURE_LIBRARY_DIR /usr/lib/)
+ find_library(FLYCAPTURE2_LIB
+ NAMES flycapture
+ PATHS
+ "${FLYCAPTURE_LIBRARY_DIR}"
+ )
+ endif(FLYCAPTURE_INCLUDE_DIR)
+endif(MSVC)
+
+message(STATUS "FLYCAPTURE_LIBRARY_DIR : ${FLYCAPTURE_LIBRARY_DIR}")
+message(STATUS "FLYCAPTURE2_LIB : ${FLYCAPTURE2_LIB}")
+
+if(FLYCAPTURE2_LIB)
+ set(FLYCAPTURE_FOUND TRUE)
+else(FLYCAPTURE2_LIB)
+ message(STATUS "Warning: cannot find FlyCapture2")
+endif(FLYCAPTURE2_LIB)
+
+
Modified: branches/newCMakeForVC2010/ImageProcessing/opencv/components/PGRCamera/src/CMakeLists.txt
===================================================================
--- branches/newCMakeForVC2010/ImageProcessing/opencv/components/PGRCamera/src/CMakeLists.txt 2013-08-06 05:28:43 UTC (rev 88)
+++ branches/newCMakeForVC2010/ImageProcessing/opencv/components/PGRCamera/src/CMakeLists.txt 2013-08-06 06:18:33 UTC (rev 89)
@@ -2,6 +2,7 @@
set(standalone_srcs PGRCameraComp.cpp)
find_package(OpenCV REQUIRED)
+include(../cmake/FindFlyCapture.cmake)
if (DEFINED OPENRTM_INCLUDE_DIRS)
string(REGEX REPLACE "-I" ";"
@@ -30,6 +31,7 @@
include_directories(${PROJECT_BINARY_DIR}/idl)
include_directories(${OPENRTM_INCLUDE_DIRS})
include_directories(${OMNIORB_INCLUDE_DIRS})
+include_directories(${FLYCAPTURE_INCLUDE_DIR})
add_definitions(${OPENRTM_CFLAGS})
add_definitions(${OMNIORB_CFLAGS})
@@ -37,17 +39,19 @@
link_directories(${OPENRTM_LIBRARY_DIRS})
link_directories(${OMNIORB_LIBRARY_DIRS})
+link_directories(${FLYCAPTURE_LIBRARY_DIRS})
add_library(${PROJECT_NAME} ${LIB_TYPE} ${comp_srcs}
${comp_headers} ${ALL_IDL_SRCS})
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
set_source_files_properties(${ALL_IDL_SRCS} PROPERTIES GENERATED 1)
add_dependencies(${PROJECT_NAME} ALL_IDL_TGT)
-target_link_libraries(${PROJECT_NAME} ${OPENRTM_LIBRARIES} ${OpenCV_LIBS})
+target_link_libraries(${PROJECT_NAME} ${OPENRTM_LIBRARIES} ${OpenCV_LIBS} ${FLYCAPTURE2_LIB})
+
add_executable(${PROJECT_NAME}Comp ${standalone_srcs}
${comp_srcs} ${comp_headers} ${ALL_IDL_SRCS})
-target_link_libraries(${PROJECT_NAME}Comp ${OPENRTM_LIBRARIES} ${OpenCV_LIBS})
+target_link_libraries(${PROJECT_NAME}Comp ${OPENRTM_LIBRARIES} ${OpenCV_LIBS} ${FLYCAPTURE2_LIB})
install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}Comp
EXPORT ${PROJECT_NAME}
@@ -57,3 +61,28 @@
install(EXPORT ${PROJECT_NAME}
DESTINATION ${LIB_INSTALL_DIR}/${PROJECT_NAME}
FILE ${PROJECT_NAME}Depends.cmake)
+
+if (SolutionDir)
+ if (MSVC)
+ add_custom_command(
+ TARGET ${PROJECT_NAME}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E
+ copy ${PROJECT_BINARY_DIR}/src/Release/${PROJECT_NAME}.dll ${SolutionDir}/bin
+ )
+ add_custom_command(
+ TARGET ${PROJECT_NAME}Comp
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E
+ copy ${PROJECT_BINARY_DIR}/src/Release/${PROJECT_NAME}Comp.exe ${SolutionDir}/bin
+ )
+
+ else (MSVC)
+ add_custom_command(
+ TARGET ${PROJECT_NAME}Comp
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E
+ copy ${PROJECT_BINARY_DIR}/src/${PROJECT_NAME}Comp ${SolutionDir}/bin
+ )
+ endif (MSVC)
+endif (SolutionDir)
More information about the openrtm-commit
mailing list