-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
77 lines (66 loc) · 2.2 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
cmake_minimum_required(VERSION 3.16)
project(HSRobot LANGUAGES CXX)
option(USE_WEBOTS ON)
option(USE_BLUETOOTH OFF)
option(SHOW_OPENCV_WINDOWS ON)
option(BUILD_ONLY_DOCS OFF)
if(NOT BUILD_ONLY_DOCS)
set(SOURCES
"src/main.cpp"
"src/robot/robot.hpp"
"src/robot/webots_robot.hpp"
"src/robot/webots_robot.cpp"
"src/robot/hs_robot.hpp"
"src/robot/hs_robot.cpp"
"src/behaviour/behaviour.hpp"
"src/behaviour/behaviour.cpp"
"src/behaviour/manager.hpp"
"src/behaviour/manager.cpp"
"src/behaviour/manual.hpp"
"src/behaviour/manual.cpp"
"src/behaviour/line_follower.hpp"
"src/behaviour/line_follower.cpp"
"src/app/app.hpp"
"src/app/app.cpp"
"src/app/webots_app.hpp"
"src/app/webots_app.cpp"
"src/app/hs_app.hpp"
"src/app/hs_app.cpp"
)
add_executable(controller ${SOURCES})
set_property(TARGET controller PROPERTY CXX_STANDARD 17)
if(SHOW_OPENCV_WINDOWS)
target_compile_definitions(controller PUBLIC SHOW_OPENCV_WINDOWS)
endif()
# Link OpenCV
find_package(OpenCV REQUIRED)
target_link_libraries(controller PUBLIC ${OpenCV_LIBS})
# Link Webots
if(USE_WEBOTS)
target_include_directories(controller PUBLIC
$ENV{WEBOTS_HOME}/include/controller/c
$ENV{WEBOTS_HOME}/include/controller/cpp
${OpenCV_INCLUDE_DIRS}
)
target_link_libraries(controller PUBLIC ${CMAKE_SHARED_LIBRARY_PREFIX}Controller${CMAKE_SHARED_LIBRARY_SUFFIX})
target_link_directories(controller PUBLIC $ENV{WEBOTS_HOME}/lib/controller)
target_compile_definitions(controller PUBLIC USE_WEBOTS)
endif()
# Link bluetooth libraries
if(USE_BLUETOOTH)
target_link_libraries(controller PUBLIC bluetooth)
target_compile_definitions(controller PUBLIC USE_BLUETOOTH)
endif()
endif()
# Doxygen documentation
find_package(Doxygen COMPONENTS dot)
if (Doxygen_FOUND)
set(DOXYGEN_SHOW_NAMESPACES YES)
set(DOXYGEN_GENERATE_TREEVIEW YES)
set(DOXYGEN_JAVADOC_AUTOBRIEF YES)
doxygen_add_docs(
doxygen
"src"
COMMENT "Generate documentation"
)
endif()