forked from lrse/whycon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
57 lines (46 loc) · 2.4 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
cmake_minimum_required(VERSION 2.8)
project(circle-detector)
SET(CMAKE_BUILD_TYPE debug)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O4 -march=native -Wfatal-errors")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake-configs")
option(ENABLE_MAVCONN "Enable MAVCONN support for running localization system as a service" OFF)
option(ENABLE_VIEWER "Enable 3D viewer support (requires PointClound library and MAVCONN enabled)" OFF)
option(ENABLE_FULL_UNDISTORT "Undistort the whole frame" OFF)
option(ENABLE_RANDOMIZED_THRESHOLD "Use rand() instead of binary-like search for threshold" OFF)
set(whycon_srcs circle_detector.cpp many_circle_detector.cpp localization_system.cpp sysmat.cpp)
## Check dependencies
find_package(OpenCV REQUIRED)
find_package(Boost COMPONENTS program_options thread system REQUIRED)
if (ENABLE_MAVCONN)
find_package(MAVLINK QUIET)
find_package(MAVCONN QUIET)
include_directories(${MAVCONN_INCLUDE_DIR} ${MAVLINK_INCLUDE_DIR} ${MAVLINK_INCLUDE_DIR}/..)
set(MAVCONN_LIBS mavconn_lcm lcm)
set(whycon_srcs ${whycon_srcs} localization_service.cpp)
find_package(PythonInterp 2 REQUIRED)
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_LIST_DIR}/mavlink/whycon/mavlink.h
COMMAND ${PYTHON_EXECUTABLE} ${MAVLINK_MAVGEN} --lang=C --output=mavlink whycon.xml --wire-protocol=1.0
DEPENDS ${CMAKE_CURRENT_LIST_DIR}/whycon.xml
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
)
add_custom_target(mavlink_headers ALL DEPENDS ${CMAKE_CURRENT_LIST_DIR}/mavlink/whycon/mavlink.h)
if (ENABLE_VIEWER)
add_subdirectory(viewer)
endif()
endif()
# create config file
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/config.h.cmake ${CMAKE_SOURCE_DIR}/config.h)
# generate whycon shared library
add_library(whycon SHARED ${whycon_srcs})
# generate extra executables
add_executable(localization-system main.cpp)
target_link_libraries(localization-system whycon ${OpenCV_LIBS} ${Boost_LIBRARIES} ${MAVCONN_LIBS})
SET(camera_calibrator_sources camera_calibrator.cpp)
add_executable(camera_calibrator ${camera_calibrator_sources})
target_link_libraries(camera_calibrator ${OpenCV_LIBS})
# install targets
install(TARGETS whycon DESTINATION lib)
install(TARGETS localization-system camera_calibrator DESTINATION bin)
install(FILES circle_detector.h config.h localization_system.h many_circle_detector.h DESTINATION include/whycon)
install(FILES cmake-configs/FindWhyCon.cmake DESTINATION share/cmake/Modules)