CMakeLists.txt 9.24 KB
Newer Older
Bock's avatar
Bock committed
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
cmake_minimum_required(VERSION 2.8.3)
project(crs)


set(CMAKE_BUILD_MODE Release)
####################################### General #######################################
# disable ANY optimization in debug mode
IF(CMAKE_COMPILER_IS_GNUCC)
 set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Werror=return-type -fuse-ld=gold -lfreetype -lharfbuzz")
 set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0")
 set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0")
ENDIF(CMAKE_COMPILER_IS_GNUCC)

# enforce c++ 17
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)



####################################### ROS & Catkin #######################################
find_package(catkin REQUIRED COMPONENTS
        roscpp
        std_msgs
        visualization_msgs
        sensor_msgs
        message_generation
        pcl_ros
        cv_bridge
        )

add_message_files(
        FILES
        ER1ControlMsg.msg
CRS-User's avatar
asd  
CRS-User committed
34
        ER1ControlMsgStudent.msg
Bock's avatar
Bock committed
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 112 113 114 115 116 117 118
)

generate_messages(
        DEPENDENCIES
        std_msgs
)

catkin_package(
        INCLUDE_DIRS include
        LIBRARIES comon er1driver
        CATKIN_DEPENDS roscpp std_msgs message_runtime
)

include_directories(
        ${CMAKE_CURRENT_LIST_DIR}/include
        ${catkin_INCLUDE_DIRS}
)

####################################### Boost #######################################
FIND_PACKAGE(Boost REQUIRED filesystem thread system graph)
include_directories(${Boost_INCLUDE_DIRS})

####################################### CGAL #######################################
find_package(CGAL REQUIRED COMPONENTS CORE )
include(${CGAL_USE_FILE})

####################################### PCL #######################################
find_package(PCL REQUIRED COMPONENTS common io)
include_directories({PCL_INCLUDE_DIRS})

####################################### OpenCV #######################################
find_package(OpenCV REQUIRED)
include_directories({OpenCV_INCLUDE_DIRS})


####################################### TBB #######################################
find_package(TBB REQUIRED)
include_directories(${TBB_INCLUDE_DIR})

####################################### SDL2 #######################################
# TODO: use a proper find cmake package file
set(SDL2_LIBRARY /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so)
set(SDL2_INCLUDE_DIR /usr/include/})
include_directories(${SDL2_INCLUDE_DIR})


####################################### Comon #######################################
set(comon_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/include/comon/)
file(GLOB_RECURSE comon_HEADERS ${comon_INCLUDE_DIR}/*.h*)

# the libraries "scopeguard", "better_enum" and "threadpool" are embedded directly into comon
set(scopeguard_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/include/scopeguard/)
file(GLOB_RECURSE scopeguard_HEADERS ${comon_INCLUDE_DIR}/*.h*)

set(threadpool_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/include/threadpool/)
file(GLOB_RECURSE threadpool_HEADERS ${threadpool_INCLUDE_DIR}/*.h*)

set(better_enum_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/include/better_enum/)
file(GLOB_RECURSE better_enum_HEADERS ${better_enum_INCLUDE_DIR}/*.h*)


set(comon_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/src/comon/)
file(GLOB comon_SOURCES ${comon_SOURCE_DIR}/*.c*)

add_library(comon ${comon_SOURCES} ${comon_HEADERS} ${threadpool_HEADERS} ${scopeguard_HEADERS} ${better_enum_HEADERS})

target_link_libraries(comon ${TBB_LIBRARIES})


add_dependencies(comon crs_generate_messages_cpp)


####################################### er1driver #######################################
set(er1driver_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/include/er1driver/)
file(GLOB er1driver_HEADERS ${er1driver_INCLUDE_DIR}/*.h*)

set(er1driver_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/src/er1driver/)
file(GLOB er1driver_SOURCES ${er1driver_SOURCE_DIR}/*.c*)

add_library(er1driver ${er1driver_SOURCES} ${er1driver_HEADERS})
add_dependencies(er1driver comon)
target_link_libraries(er1driver comon)


CRS-User's avatar
asd  
CRS-User committed
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
####################################### er1_driver_node_student #######################################
set(er1_driver_node_student_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/include/er1_driver_node_student/)
file(GLOB er1_driver_node_student_HEADERS ${er1_driver_node_student_INCLUDE_DIR}/*.h*)

set(er1_driver_node_student_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/src/er1_driver_node_student/)
file(GLOB er1_driver_node_student_SOURCES ${er1_driver_node_student_SOURCE_DIR}/*.c*)

add_executable(er1_driver_node_student ${er1_driver_node_student_SOURCES} ${er1_driver_node_student_HEADERS})
add_dependencies(er1_driver_node_student comon er1driver)
target_link_libraries(er1_driver_node_student comon er1driver ${catkin_LIBRARIES})

####################################### er1_control_node_student #######################################
set(er1_control_node_student_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/include/er1_control_node_student/)
file(GLOB er1_control_node_student_HEADERS ${er1_control_node_student_INCLUDE_DIR}/*.h*)

set(er1_control_node_student_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/src/er1_control_node_student/)
file(GLOB er1_control_node_student_SOURCES ${er1_control_node_student_SOURCE_DIR}/*.c*)

add_executable(er1_control_node_student ${er1_control_node_student_SOURCES} ${er1_control_node_student_HEADERS})
add_dependencies(er1_control_node_student er1driver)
target_link_libraries(er1_control_node_student er1driver ${SDL2_LIBRARY} ${catkin_LIBRARIES})

Bock's avatar
Bock committed
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
####################################### er1_driver_node #######################################
set(er1_driver_node_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/include/er1_driver_node/)
file(GLOB er1_driver_node_HEADERS ${er1_driver_node_INCLUDE_DIR}/*.h*)

set(er1_driver_node_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/src/er1_driver_node/)
file(GLOB er1_driver_node_SOURCES ${er1_driver_node_SOURCE_DIR}/*.c*)

add_executable(er1_driver_node ${er1_driver_node_SOURCES} ${er1_driver_node_HEADERS})
add_dependencies(er1_driver_node comon er1driver)
target_link_libraries(er1_driver_node comon er1driver ${catkin_LIBRARIES})

####################################### er1_control_node #######################################
set(er1_control_node_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/include/er1_control_node/)
file(GLOB er1_control_node_HEADERS ${er1_control_node_INCLUDE_DIR}/*.h*)

set(er1_control_node_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/src/er1_control_node/)
file(GLOB er1_control_node_SOURCES ${er1_control_node_SOURCE_DIR}/*.c*)

add_executable(er1_control_node ${er1_control_node_SOURCES} ${er1_control_node_HEADERS})
add_dependencies(er1_control_node er1driver)
target_link_libraries(er1_control_node er1driver ${SDL2_LIBRARY} ${catkin_LIBRARIES})


CRS-User's avatar
sad  
CRS-User committed
164
if (0)
Bock's avatar
Bock committed
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230
####################################### student_image_node #######################################
set(student_image_node_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/include/student_image_node/)
file(GLOB student_image_node_HEADERS ${student_image_node_INCLUDE_DIR}/*.h*)

set(student_image_node_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/src/student_image_node/)
file(GLOB student_image_node_SOURCES ${student_image_node_SOURCE_DIR}/*.c*)

add_executable(student_image_node ${student_image_node_SOURCES} ${student_image_node_HEADERS})
add_dependencies(student_image_node er1driver)
target_link_libraries(student_image_node 
	comon
	${Boost_LIBRARIES}
        ${PCL_COMMON_LIBRARIES}
        ${OpenCV_LIBS} 
)



####################################### student_pointcloud_node #######################################
set(student_pointcloud_node_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/include/student_pointcloud_node/)
file(GLOB student_pointcloud_node_HEADERS ${student_pointcloud_node_INCLUDE_DIR}/*.h*)

set(student_pointcloud_node_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/src/student_pointcloud_node/)
file(GLOB student_pointcloud_node_SOURCES ${student_pointcloud_node_SOURCE_DIR}/*.c*)

add_executable(student_pointcloud_node ${student_pointcloud_node_SOURCES} ${student_pointcloud_node_HEADERS})
target_link_libraries(student_pointcloud_node ${catkin_LIBRARIES}  
	comon
	${Boost_LIBRARIES}
        ${PCL_COMMON_LIBRARIES}
        ${OpenCV_LIBS}
)


####################################### student_fun_node_a #######################################
set(student_fun_node_a_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/include/student_fun_node_a/)
file(GLOB student_fun_node_a_HEADERS ${student_fun_node_a_INCLUDE_DIR}/*.h*)

set(student_fun_node_a_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/src/student_fun_node_a/)
file(GLOB student_fun_node_a_SOURCES ${student_fun_node_a_SOURCE_DIR}/*.c*)

add_executable(student_fun_node_a ${student_fun_node_a_SOURCES} ${student_fun_node_a_HEADERS})
target_link_libraries(student_fun_node_a ${catkin_LIBRARIES}  
	comon
	${Boost_LIBRARIES}
        ${PCL_COMMON_LIBRARIES}
        ${OpenCV_LIBS}
)

####################################### student_fun_node_b #######################################
set(student_fun_node_b_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/include/student_fun_node_b/)
file(GLOB student_fun_node_b_HEADERS ${student_fun_node_b_INCLUDE_DIR}/*.h*)

set(student_fun_node_b_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/src/student_fun_node_b/)
file(GLOB student_fun_node_b_SOURCES ${student_fun_node_b_SOURCE_DIR}/*.c*)

add_executable(student_fun_node_b ${student_fun_node_b_SOURCES} ${student_fun_node_b_HEADERS})
add_dependencies(student_fun_node_b er1driver)
target_link_libraries(student_fun_node_b ${catkin_LIBRARIES}  
	comon
	${Boost_LIBRARIES}
        ${PCL_COMMON_LIBRARIES}
        ${OpenCV_LIBS}
)


CRS-User's avatar
sad  
CRS-User committed
231 232 233
endif()


Bock's avatar
Bock committed
234 235 236