Update CMakeLists.txt

This commit is contained in:
John Zhao
2018-05-11 16:15:26 +08:00
parent 76d12ccec7
commit ff70cc47f3
16 changed files with 171 additions and 156 deletions

View File

@@ -19,6 +19,7 @@ project(mynteye_samples VERSION 2.0.0 LANGUAGES C CXX)
get_filename_component(PRO_DIR ${PROJECT_SOURCE_DIR} DIRECTORY)
include(${PRO_DIR}/cmake/Common.cmake)
include(${PRO_DIR}/cmake/Utils.cmake)
# options
@@ -54,21 +55,9 @@ LIST(APPEND CMAKE_PREFIX_PATH ${PRO_DIR}/_install/lib/cmake)
find_package(mynteye REQUIRED)
message(STATUS "Found mynteye: ${mynteye_VERSION}")
LIST(APPEND CMAKE_MODULE_PATH ${PRO_DIR}/cmake)
include(${PRO_DIR}/cmake/DetectOpenCV.cmake)
find_package(OpenCV REQUIRED)
message(STATUS "Found OpenCV: ${OpenCV_VERSION}")
if(OpenCV_VERSION VERSION_LESS 3.0)
add_definitions(-DUSE_OPENCV2)
else()
add_definitions(-DUSE_OPENCV3)
endif()
if(OS_WIN)
get_filename_component(OpenCV_LIB_SEARCH_PATH "${OpenCV_LIB_PATH}/../bin" ABSOLUTE)
else()
set(OpenCV_LIB_SEARCH_PATH "${OpenCV_LIB_PATH}")
endif()
#LIST(APPEND CMAKE_MODULE_PATH ${PRO_DIR}/cmake)
# targets

View File

@@ -22,15 +22,8 @@ set_outdir(
## camera_a
add_executable(camera_a camera.cc)
target_link_libraries(camera_a mynteye ${OpenCV_LIBS})
target_create_scripts(camera_a DLL_SEARCH_PATHS
${PRO_DIR}/_install/bin
${OpenCV_LIB_SEARCH_PATH}
make_executable(camera_a
SRCS camera.cc
LINK_LIBS mynteye ${OpenCV_LIBS}
DLL_SEARCH_PATHS ${PRO_DIR}/_install/bin ${OpenCV_LIB_SEARCH_PATH}
)
if(OS_WIN)
target_compile_definitions(camera_a
PUBLIC GLOG_NO_ABBREVIATED_SEVERITIES
)
endif()

View File

@@ -22,15 +22,8 @@ set_outdir(
## camera_d
add_executable(camera_d camera.cc)
target_link_libraries(camera_d mynteye ${OpenCV_LIBS})
target_create_scripts(camera_d DLL_SEARCH_PATHS
${PRO_DIR}/_install/bin
${OpenCV_LIB_SEARCH_PATH}
make_executable(camera_d
SRCS camera.cc
LINK_LIBS mynteye ${OpenCV_LIBS}
DLL_SEARCH_PATHS ${PRO_DIR}/_install/bin ${OpenCV_LIB_SEARCH_PATH}
)
if(OS_WIN)
target_compile_definitions(camera_d
PUBLIC GLOG_NO_ABBREVIATED_SEVERITIES
)
endif()

View File

@@ -24,11 +24,11 @@ set_outdir(
"${OUT_DIR}/bin/${DIR_NAME}"
)
# make_executable(NAME
# [SRCS src1 src2 ...])
# make_executable2(NAME
# [SRCS src1 src2 ...]
# [WITH_OPENCV]
# [WITH_PCL])
macro(make_executable NAME)
macro(make_executable2 NAME)
set(options WITH_OPENCV WITH_PCL)
set(oneValueArgs)
set(multiValueArgs SRCS)
@@ -88,29 +88,29 @@ endif()
# data
make_executable(get_device_info SRCS data/get_device_info.cc)
make_executable(get_img_params SRCS data/get_img_params.cc)
make_executable(get_imu_params SRCS data/get_imu_params.cc)
make_executable2(get_device_info SRCS data/get_device_info.cc)
make_executable2(get_img_params SRCS data/get_img_params.cc)
make_executable2(get_imu_params SRCS data/get_imu_params.cc)
make_executable(get_stereo SRCS data/get_stereo.cc WITH_OPENCV)
make_executable(get_stereo_rectified SRCS data/get_stereo_rectified.cc WITH_OPENCV)
make_executable(get_disparity SRCS data/get_disparity.cc WITH_OPENCV)
make_executable(get_depth SRCS data/get_depth.cc WITH_OPENCV)
make_executable2(get_stereo SRCS data/get_stereo.cc WITH_OPENCV)
make_executable2(get_stereo_rectified SRCS data/get_stereo_rectified.cc WITH_OPENCV)
make_executable2(get_disparity SRCS data/get_disparity.cc WITH_OPENCV)
make_executable2(get_depth SRCS data/get_depth.cc WITH_OPENCV)
if(PCL_FOUND)
make_executable(get_points
make_executable2(get_points
SRCS data/get_points.cc data/pc_viewer.cc
WITH_OPENCV WITH_PCL
)
endif()
make_executable(get_imu SRCS data/get_imu.cc data/cv_painter.cc WITH_OPENCV)
make_executable(get_from_callbacks
make_executable2(get_imu SRCS data/get_imu.cc data/cv_painter.cc WITH_OPENCV)
make_executable2(get_from_callbacks
SRCS data/get_from_callbacks.cc data/cv_painter.cc
WITH_OPENCV
)
make_executable(get_with_plugin SRCS data/get_with_plugin.cc WITH_OPENCV)
make_executable2(get_with_plugin SRCS data/get_with_plugin.cc WITH_OPENCV)
# control
make_executable(ctrl_infrared SRCS control/infrared.cc WITH_OPENCV)
make_executable2(ctrl_infrared SRCS control/infrared.cc WITH_OPENCV)
endif()

View File

@@ -26,15 +26,8 @@ include_directories(
## camera_u
add_executable(camera_u camera.cc)
target_link_libraries(camera_u mynteye ${OpenCV_LIBS})
target_create_scripts(camera_u DLL_SEARCH_PATHS
${PRO_DIR}/_install/bin
${OpenCV_LIB_SEARCH_PATH}
make_executable(camera_u
SRCS camera.cc
LINK_LIBS mynteye ${OpenCV_LIBS}
DLL_SEARCH_PATHS ${PRO_DIR}/_install/bin ${OpenCV_LIB_SEARCH_PATH}
)
if(OS_WIN)
target_compile_definitions(camera_u
PUBLIC GLOG_NO_ABBREVIATED_SEVERITIES
)
endif()