2012-01-01 01:12:00 -06:00
|
|
|
macro(build_serial)
|
|
|
|
|
cmake_minimum_required(VERSION 2.4.6)
|
|
|
|
|
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
|
|
|
|
|
|
|
|
|
|
# Set the build type. Options are:
|
|
|
|
|
# Coverage : w/ debug symbols, w/o optimization, w/ code-coverage
|
|
|
|
|
# Debug : w/ debug symbols, w/o optimization
|
|
|
|
|
# Release : w/o debug symbols, w/ optimization
|
|
|
|
|
# RelWithDebInfo : w/ debug symbols, w/ optimization
|
|
|
|
|
# MinSizeRel : w/o debug symbols, w/ optimization, stripped binaries
|
|
|
|
|
set(ROS_BUILD_TYPE RelWithDebInfo)
|
|
|
|
|
|
|
|
|
|
rosbuild_init()
|
|
|
|
|
|
|
|
|
|
#set the default path for built executables to the "bin" directory
|
|
|
|
|
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
|
|
|
|
|
#set the default path for built libraries to the "lib" directory
|
|
|
|
|
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
|
|
|
|
|
|
2012-01-13 11:40:59 -06:00
|
|
|
include_directories(include)
|
|
|
|
|
|
|
|
|
|
set(SERIAL_SRCS src/serial.cc)
|
|
|
|
|
if(UNIX)
|
|
|
|
|
list(APPEND SERIAL_SRCS src/impl/unix.cc)
|
|
|
|
|
else(UNIX)
|
|
|
|
|
list(APPEND SERIAL_SRCS src/impl/windows.cc)
|
|
|
|
|
endif(UNIX)
|
|
|
|
|
list(APPEND SERIAL_SRCS src/serial_listener.cc)
|
2012-01-01 01:12:00 -06:00
|
|
|
|
|
|
|
|
# Build the serial library
|
2012-01-13 11:40:59 -06:00
|
|
|
rosbuild_add_library(${PROJECT_NAME} ${SERIAL_SRCS})
|
2012-01-01 01:12:00 -06:00
|
|
|
|
|
|
|
|
# Add boost dependencies
|
|
|
|
|
rosbuild_add_boost_directories()
|
|
|
|
|
rosbuild_link_boost(${PROJECT_NAME} system filesystem thread)
|
|
|
|
|
|
|
|
|
|
# Build example
|
2012-01-13 11:40:59 -06:00
|
|
|
rosbuild_add_executable(serial_example examples/serial_example.cc)
|
2012-01-01 01:12:00 -06:00
|
|
|
target_link_libraries(serial_example ${PROJECT_NAME})
|
2012-01-01 01:32:38 -06:00
|
|
|
|
2012-01-13 11:40:59 -06:00
|
|
|
rosbuild_add_executable(serial_listener_example
|
|
|
|
|
examples/serial_listener_example.cc)
|
|
|
|
|
target_link_libraries(serial_listener_example ${PROJECT_NAME})
|
|
|
|
|
|
2012-01-01 01:12:00 -06:00
|
|
|
endmacro(build_serial)
|