-
Notifications
You must be signed in to change notification settings - Fork 12
/
CMakeLists.txt
111 lines (91 loc) · 3.5 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
PROJECT(ut_automata)
CMAKE_MINIMUM_REQUIRED(VERSION 3.1.0)
MESSAGE(STATUS "Compilers found: ${CMAKE_CXX_COMPILER_LIST}")
MESSAGE(STATUS "Using compiler: ${CMAKE_CXX_COMPILER}")
MESSAGE(STATUS "Build Type: ${CMAKE_BUILD_TYPE}")
MESSAGE(STATUS "Build Mode: ${CMAKE_BUILD_MODE}")
MESSAGE(STATUS "Arch: ${CMAKE_SYSTEM_PROCESSOR}")
SET(CMAKE_AUTOMOC ON)
SET(CMAKE_AUTORCC ON)
SET(CMAKE_AUTOUIC ON)
IF(CMAKE_VERSION VERSION_LESS "3.7.0")
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
ENDIF()
SET(CMAKE_CXX_FLAGS "-std=c++11 -march=native -Werror -Wall -g")
IF(${CMAKE_BUILD_TYPE} MATCHES "Release")
MESSAGE(STATUS "Additional Flags for Release mode")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp -O3 -DNDEBUG")
ELSEIF(${CMAKE_BUILD_TYPE} MATCHES "Debug")
MESSAGE(STATUS "Additional Flags for Debug mode")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
SET(BUILD_SPECIFIC_LIBRARIES "")
ENDIF()
INCLUDE($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
ROSBUILD_INIT()
SET(ROS_BUILD_STATIC_LIBS true)
SET(ROS_BUILD_SHARED_LIBS false)
FIND_PACKAGE(Qt5 COMPONENTS Core Widgets Gui WebSockets OpenGL REQUIRED)
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
MESSAGE(STATUS "ROS-Overrride Build Type: ${CMAKE_BUILD_TYPE}")
MESSAGE(STATUS "CXX Flags: ${CMAKE_CXX_FLAGS}")
MESSAGE(STATUS "Build-Specific Libraries: ${BUILD_SPECIFIC_LIBRARIES}")
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/submodules")
INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR})
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR})
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src)
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/include)
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/submodules/config_reader/include)
ROSBUILD_GENMSG()
ADD_SUBDIRECTORY(src/shared)
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/shared)
SET(libs roslib roscpp glog gflags amrl_shared_lib
${BUILD_SPECIFIC_LIBRARIES} rosbag X11 lua5.1 boost_system)
IF(${CMAKE_BUILD_MODE} MATCHES "Hardware")
MESSAGE(STATUS "Building hardware drivers")
rosbuild_add_executable(vesc_driver
src/vesc_driver/serial.cc
src/vesc_driver/vesc_driver_node.cpp
src/vesc_driver/vesc_driver.cpp
src/vesc_driver/vesc_interface.cpp
src/vesc_driver/vesc_packet.cpp
src/vesc_driver/vesc_packet_factory.cpp)
target_link_libraries(vesc_driver ${libs})
ROSBUILD_ADD_EXECUTABLE(gui
src/gui/gui_main.cc
src/gui/gui_mainwindow.cc
src/gui/vector_display.cc
${GUI_MOC_SRCS})
TARGET_LINK_LIBRARIES(gui
Qt5::Core
Qt5::Gui
Qt5::Widgets
Qt5::OpenGL
${libs} ${OPENGL_LIBRARY} GL)
ROSBUILD_ADD_EXECUTABLE(joystick
src/joystick/joystick.cc
src/joystick/joystick_driver.cc)
TARGET_LINK_LIBRARIES(joystick ${libs})
ENDIF()
MESSAGE(STATUS "Building simulator")
ROSBUILD_ADD_EXECUTABLE(simulator
src/simulator/simulator.cc
src/simulator/vector_map.cc
src/simulator/simulator_main.cc)
TARGET_LINK_LIBRARIES(simulator ${libs})
ROSBUILD_ADD_EXECUTABLE(step_simulator
src/simulator/simulator.cc
src/simulator/vector_map.cc
src/simulator/step_simulator_main.cc)
TARGET_LINK_LIBRARIES(step_simulator ${libs})
ROSBUILD_ADD_EXECUTABLE(websocket
src/websocket/websocket_main.cc
src/websocket/websocket.cc
)
TARGET_LINK_LIBRARIES(websocket
Qt5::Core
Qt5::Gui
Qt5::Widgets
Qt5::WebSockets
${libs})