2018-05-10 09:46:34 +03:00
|
|
|
# Copyright 2018 Slightech Co., Ltd. All rights reserved.
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
2018-03-22 07:03:08 +02:00
|
|
|
cmake_minimum_required(VERSION 3.0)
|
|
|
|
|
|
|
|
project(mynteye_samples VERSION 2.0.0 LANGUAGES C CXX)
|
|
|
|
|
|
|
|
get_filename_component(PRO_DIR ${PROJECT_SOURCE_DIR} DIRECTORY)
|
|
|
|
|
2018-04-23 18:11:11 +03:00
|
|
|
include(${PRO_DIR}/cmake/Common.cmake)
|
2018-05-11 11:15:26 +03:00
|
|
|
include(${PRO_DIR}/cmake/Utils.cmake)
|
2018-04-23 18:11:11 +03:00
|
|
|
|
2018-04-25 11:06:38 +03:00
|
|
|
# options
|
|
|
|
|
|
|
|
include(${PRO_DIR}/cmake/Option.cmake)
|
|
|
|
|
2018-03-22 07:03:08 +02:00
|
|
|
# flags
|
|
|
|
|
2018-04-23 18:11:11 +03:00
|
|
|
if(OS_WIN)
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
|
|
|
else()
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
|
|
|
|
endif()
|
2018-03-22 07:03:08 +02:00
|
|
|
|
|
|
|
include(${PRO_DIR}/cmake/DetectCXX11.cmake)
|
|
|
|
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
|
|
|
|
|
|
|
|
string(STRIP "${CMAKE_C_FLAGS}" CMAKE_C_FLAGS)
|
|
|
|
string(STRIP "${CMAKE_CXX_FLAGS}" CMAKE_CXX_FLAGS)
|
|
|
|
message(STATUS "C_FLAGS: ${CMAKE_C_FLAGS}")
|
|
|
|
message(STATUS "CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
|
|
|
|
|
|
|
|
# packages
|
|
|
|
|
|
|
|
LIST(APPEND CMAKE_PREFIX_PATH ${PRO_DIR}/_install/lib/cmake)
|
|
|
|
find_package(mynteye REQUIRED)
|
|
|
|
message(STATUS "Found mynteye: ${mynteye_VERSION}")
|
|
|
|
|
2018-05-11 11:15:26 +03:00
|
|
|
include(${PRO_DIR}/cmake/DetectOpenCV.cmake)
|
2018-03-22 07:03:08 +02:00
|
|
|
|
2018-11-16 10:30:13 +02:00
|
|
|
if(mynteye_WITH_GLOG)
|
|
|
|
include(${PRO_DIR}/cmake/DetectGLog.cmake)
|
|
|
|
endif()
|
|
|
|
|
2018-05-11 11:15:26 +03:00
|
|
|
#LIST(APPEND CMAKE_MODULE_PATH ${PRO_DIR}/cmake)
|
2018-04-25 07:08:25 +03:00
|
|
|
|
2019-08-23 10:28:56 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
2018-03-22 07:03:08 +02:00
|
|
|
# targets
|
|
|
|
|
|
|
|
set(OUT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/_output")
|
2018-03-30 11:24:43 +03:00
|
|
|
|
2019-08-23 10:28:56 +03:00
|
|
|
|
|
|
|
include_directories(
|
|
|
|
${PRO_DIR}/src
|
|
|
|
)
|
|
|
|
|
|
|
|
set_outdir(
|
|
|
|
"${OUT_DIR}/lib"
|
|
|
|
"${OUT_DIR}/lib"
|
|
|
|
"${OUT_DIR}/bin"
|
|
|
|
)
|
|
|
|
|
2018-12-28 04:18:37 +02:00
|
|
|
if(OS_MAC)
|
|
|
|
# samples above uvc layer
|
2018-04-25 11:06:38 +03:00
|
|
|
|
2019-08-23 10:28:56 +03:00
|
|
|
make_executable(camera_u
|
|
|
|
SRCS uvc_camera.cc
|
|
|
|
LINK_LIBS mynteye ${OpenCV_LIBS}
|
|
|
|
DLL_SEARCH_PATHS ${PRO_DIR}/_install/bin ${OpenCV_LIB_SEARCH_PATH}
|
|
|
|
)
|
2018-12-28 04:18:37 +02:00
|
|
|
else()
|
|
|
|
# samples above device layer
|
2018-04-04 05:50:27 +03:00
|
|
|
|
2019-08-26 10:56:31 +03:00
|
|
|
make_executable(camera_with_junior_device_api
|
2019-08-23 10:28:56 +03:00
|
|
|
SRCS device_camera.cc
|
|
|
|
LINK_LIBS mynteye ${OpenCV_LIBS}
|
|
|
|
DLL_SEARCH_PATHS ${PRO_DIR}/_install/bin ${OpenCV_LIB_SEARCH_PATH}
|
|
|
|
)
|
2018-04-04 05:50:27 +03:00
|
|
|
|
2019-08-23 10:28:56 +03:00
|
|
|
# samples above api layer
|
2018-03-30 11:24:43 +03:00
|
|
|
|
2018-12-28 04:18:37 +02:00
|
|
|
if(WITH_API)
|
2019-08-23 10:28:56 +03:00
|
|
|
## camera_a
|
|
|
|
|
2019-08-26 10:56:31 +03:00
|
|
|
make_executable(camera_with_senior_api
|
2019-08-23 10:28:56 +03:00
|
|
|
SRCS api_camera.cc
|
|
|
|
LINK_LIBS mynteye ${OpenCV_LIBS}
|
|
|
|
DLL_SEARCH_PATHS ${PRO_DIR}/_install/bin ${OpenCV_LIB_SEARCH_PATH}
|
|
|
|
)
|
|
|
|
|
|
|
|
## get_depth_with_region
|
|
|
|
|
|
|
|
make_executable(get_depth_with_region
|
|
|
|
SRCS api_get_depth_with_region.cc
|
|
|
|
LINK_LIBS mynteye ${OpenCV_LIBS}
|
|
|
|
DLL_SEARCH_PATHS ${PRO_DIR}/_install/bin ${OpenCV_LIB_SEARCH_PATH}
|
|
|
|
)
|
2018-12-28 04:18:37 +02:00
|
|
|
endif()
|
2019-08-23 10:28:56 +03:00
|
|
|
endif()
|
2018-05-03 11:40:09 +03:00
|
|
|
|
|
|
|
|
2019-08-23 10:28:56 +03:00
|
|
|
|
|
|
|
# targets
|
|
|
|
|
|
|
|
include_directories(
|
|
|
|
${OpenCV_INCLUDE_DIRS}
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
# tutorials
|
|
|
|
|
|
|
|
if(WITH_API)
|
|
|
|
|
|
|
|
# make_executable2(NAME
|
|
|
|
# [SRCS src1 src2 ...]
|
|
|
|
# [WITH_OPENCV]
|
|
|
|
# [WITH_PCL])
|
|
|
|
macro(make_executable2 NAME)
|
|
|
|
set(options WITH_OPENCV WITH_PCL)
|
|
|
|
set(oneValueArgs)
|
|
|
|
set(multiValueArgs SRCS)
|
|
|
|
cmake_parse_arguments(THIS "${options}" "${oneValueArgs}"
|
|
|
|
"${multiValueArgs}" ${ARGN})
|
|
|
|
|
|
|
|
set(__link_libs mynteye)
|
|
|
|
set(__dll_search_paths ${PRO_DIR}/_install/bin)
|
|
|
|
if(THIS_WITH_OPENCV)
|
|
|
|
list(APPEND __link_libs ${OpenCV_LIBS})
|
|
|
|
list(APPEND __dll_search_paths ${OpenCV_LIB_SEARCH_PATH})
|
|
|
|
endif()
|
|
|
|
if(THIS_WITH_PCL)
|
|
|
|
list(APPEND __link_libs ${PCL_LIBRARIES})
|
|
|
|
#list(APPEND __link_libs pcl::pcl)
|
|
|
|
list(APPEND __dll_search_paths ${PCL_LIB_SEARCH_PATH})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_executable(${NAME} ${THIS_SRCS})
|
|
|
|
target_link_libraries(${NAME} ${__link_libs})
|
|
|
|
target_create_scripts(${NAME} DLL_SEARCH_PATHS ${__dll_search_paths})
|
|
|
|
|
|
|
|
if(THIS_WITH_PCL)
|
|
|
|
target_include_directories(${NAME} PRIVATE ${PCL_INCLUDE_DIRS})
|
|
|
|
#target_compile_definitions(${NAME} PRIVATE ${PCL_DEFINITIONS})
|
|
|
|
#target_compile_options(${NAME} PRIVATE ${PCL_COMPILE_OPTIONS})
|
|
|
|
endif()
|
|
|
|
if(OS_WIN)
|
|
|
|
target_compile_definitions(${NAME}
|
|
|
|
PUBLIC GLOG_NO_ABBREVIATED_SEVERITIES
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
# packages
|
|
|
|
|
|
|
|
# If you install PCL to different directory, please set CMAKE_PREFIX_PATH to find it.
|
|
|
|
#LIST(APPEND CMAKE_PREFIX_PATH /usr/local/share)
|
|
|
|
find_package(PCL)
|
|
|
|
if(PCL_FOUND)
|
|
|
|
message(STATUS "Found PCL: ${PCL_VERSION}")
|
|
|
|
|
|
|
|
#message(STATUS "PCL_LIBRARIES: ${PCL_LIBRARIES}")
|
|
|
|
#message(STATUS "PCL_INCLUDE_DIRS: ${PCL_INCLUDE_DIRS}")
|
|
|
|
#message(STATUS "PCL_LIBRARY_DIRS: ${PCL_LIBRARY_DIRS}")
|
|
|
|
#message(STATUS "PCL_DEFINITIONS: ${PCL_DEFINITIONS}")
|
|
|
|
#message(STATUS "PCL_COMPILE_OPTIONS: ${PCL_COMPILE_OPTIONS}")
|
|
|
|
|
|
|
|
if(OS_WIN)
|
|
|
|
get_filename_component(PCL_LIB_SEARCH_PATH "${PCL_LIBRARY_DIRS}/../bin" ABSOLUTE)
|
|
|
|
else()
|
|
|
|
set(PCL_LIB_SEARCH_PATH "${PCL_LIBRARY_DIRS}")
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
message(WARNING "PCL not found :(")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# beginner level
|
|
|
|
|
|
|
|
## data
|
|
|
|
|
|
|
|
make_executable2(get_device_info SRCS data_get_device_info.cc WITH_OPENCV)
|
|
|
|
make_executable2(get_img_params SRCS data_get_img_params.cc WITH_OPENCV)
|
|
|
|
make_executable2(get_imu_params SRCS data_get_imu_params.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)
|
|
|
|
|
|
|
|
make_executable2(get_data_without_select SRCS data_get_data_without_select.cc WITH_OPENCV)
|
|
|
|
make_executable2(get_imu_correspondence
|
|
|
|
SRCS data_get_imu_correspondence.cc util_cv_painter.cc
|
|
|
|
WITH_OPENCV
|
|
|
|
)
|
|
|
|
make_executable2(get_imu SRCS data_get_imu.cc util_cv_painter.cc WITH_OPENCV)
|
|
|
|
make_executable2(save_single_image SRCS data_save_single_image.cc WITH_OPENCV)
|
|
|
|
make_executable2(get_from_callbacks
|
|
|
|
SRCS data_get_from_callbacks.cc util_cv_painter.cc
|
|
|
|
WITH_OPENCV
|
|
|
|
)
|
|
|
|
make_executable2(get_with_plugin SRCS data_get_with_plugin.cc WITH_OPENCV)
|
|
|
|
|
|
|
|
## control
|
|
|
|
|
|
|
|
make_executable2(ctrl_framerate SRCS control_framerate.cc WITH_OPENCV)
|
|
|
|
make_executable2(ctrl_imu_low_pass_filter SRCS control_imu_low_pass_filter.cc WITH_OPENCV)
|
|
|
|
make_executable2(ctrl_imu_range SRCS control_imu_range.cc WITH_OPENCV)
|
|
|
|
make_executable2(ctrl_infrared SRCS control_infrared.cc WITH_OPENCV)
|
|
|
|
make_executable2(ctrl_iic_adress SRCS control_iic_address.cc WITH_OPENCV)
|
|
|
|
make_executable2(ctrl_sync_timestamp SRCS control_sync_timestamp.cc WITH_OPENCV)
|
|
|
|
make_executable2(ctrl_auto_exposure
|
|
|
|
SRCS control_auto_exposure.cc util_cv_painter.cc
|
|
|
|
WITH_OPENCV
|
|
|
|
)
|
|
|
|
make_executable2(ctrl_manual_exposure
|
|
|
|
SRCS control_manual_exposure.cc util_cv_painter.cc
|
|
|
|
WITH_OPENCV
|
|
|
|
)
|
|
|
|
|
|
|
|
if(PCL_FOUND)
|
|
|
|
|
|
|
|
make_executable2(get_depth_and_points
|
|
|
|
SRCS intermediate_get_depth_and_points.cc util_cv_painter.cc util_pc_viewer.cc
|
|
|
|
WITH_OPENCV WITH_PCL
|
|
|
|
)
|
|
|
|
|
2018-12-28 04:18:37 +02:00
|
|
|
endif()
|
2018-07-11 07:59:56 +03:00
|
|
|
endif()
|
2019-08-23 10:28:56 +03:00
|
|
|
|
|
|
|
|