mirror of
https://github.com/wjwwood/serial.git
synced 2026-01-23 04:04:54 +08:00
Adding catkin build files and a new Makefile.
This commit is contained in:
parent
73371a144d
commit
7174d62e1b
@ -1,21 +1,58 @@
|
||||
cmake_minimum_required(VERSION 2.4.6)
|
||||
cmake_minimum_required(VERSION 2.8.3)
|
||||
project(serial)
|
||||
|
||||
set(ROS_ROOT $ENV{ROS_ROOT})
|
||||
# Find catkin
|
||||
find_package(catkin REQUIRED)
|
||||
|
||||
if(DEFINED ROS_ROOT)
|
||||
option(SERIAL_BUILD_WIHOUT_ROS "Build without ROS?" OFF)
|
||||
else(DEFINED ROS_ROOT)
|
||||
option(SERIAL_BUILD_WIHOUT_ROS "Build without ROS?" ON)
|
||||
endif(DEFINED ROS_ROOT)
|
||||
if(UNIX AND NOT APPLE)
|
||||
# If Linux, add rt and pthread
|
||||
catkin_package(
|
||||
LIBRARIES ${PROJECT_NAME}
|
||||
INCLUDE_DIRS include
|
||||
DEPENDS rt pthread
|
||||
)
|
||||
else ()
|
||||
# Otherwise normal call
|
||||
catkin_package(
|
||||
LIBRARIES ${PROJECT_NAME}
|
||||
INCLUDE_DIRS include
|
||||
)
|
||||
endif ()
|
||||
|
||||
if(DEFINED ROS_ROOT AND NOT SERIAL_BUILD_WIHOUT_ROS)
|
||||
# Build with ROS
|
||||
include(serial_ros.cmake)
|
||||
message("Building with ROS")
|
||||
build_serial()
|
||||
else(DEFINED ROS_ROOT AND NOT SERIAL_BUILD_WIHOUT_ROS)
|
||||
# Build normally
|
||||
include(serial.cmake)
|
||||
message("Building stand alone")
|
||||
build_serial()
|
||||
endif(DEFINED ROS_ROOT AND NOT SERIAL_BUILD_WIHOUT_ROS)
|
||||
## Sources
|
||||
set(serial_SRCS
|
||||
src/serial.cc
|
||||
# include/serial/serial.h
|
||||
# include/serial/v8stdint.h
|
||||
)
|
||||
if (UNIX)
|
||||
# If unix
|
||||
list (APPEND serial_SRCS src/impl/unix.cc)
|
||||
else()
|
||||
# If windows
|
||||
list (APPEND serial_SRCS src/impl/win.cc)
|
||||
endif()
|
||||
|
||||
## Add serial library
|
||||
add_library(${PROJECT_NAME}
|
||||
${serial_SRCS}
|
||||
)
|
||||
|
||||
## Uncomment for example
|
||||
add_executable(serial_example examples/serial_example.cc)
|
||||
add_dependencies(serial_example ${PROJECT_NAME})
|
||||
target_link_libraries(serial_example ${PROJECT_NAME})
|
||||
|
||||
## Include headers
|
||||
include_directories(include)
|
||||
|
||||
## Install executable
|
||||
install(
|
||||
TARGETS ${PROJECT_NAME}
|
||||
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
|
||||
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
|
||||
)
|
||||
|
||||
## Tests
|
||||
catkin_add_gtest(${PROJECT_NAME}-test tests/serial_tests.cc)
|
||||
target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
|
||||
|
||||
40
Makefile
40
Makefile
@ -1,5 +1,39 @@
|
||||
ifdef ROS_ROOT
|
||||
include $(shell rospack find mk)/cmake.mk
|
||||
all: serial
|
||||
|
||||
CMAKE_FLAGS := -DCMAKE_INSTALL_PREFIX=/tmp/usr/local
|
||||
|
||||
install:
|
||||
cd build && make install
|
||||
|
||||
uninstall:
|
||||
cd build && make uninstall
|
||||
|
||||
serial:
|
||||
@mkdir -p build
|
||||
cd build && cmake $(CMAKE_FLAGS) ..
|
||||
ifneq ($(MAKE),)
|
||||
cd build && $(MAKE)
|
||||
else
|
||||
include serial.makefile
|
||||
cd build && make
|
||||
endif
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -rf build
|
||||
|
||||
.PHONY: doc
|
||||
doc:
|
||||
@doxygen doc/Doxyfile
|
||||
ifeq ($(UNAME),Darwin)
|
||||
@open doc/html/index.html
|
||||
endif
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
@mkdir -p build
|
||||
cd build && cmake $(CMAKE_FLAGS) ..
|
||||
ifneq ($(MAKE),)
|
||||
cd build && $(MAKE) run_tests
|
||||
else
|
||||
cd build && make run_tests
|
||||
endif
|
||||
|
||||
23
package.xml
Normal file
23
package.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0"?>
|
||||
<package>
|
||||
<name>serial</name>
|
||||
<version abi="1.1.0">1.1.0</version>
|
||||
<description>
|
||||
Serial is a cross-platform, simple to use library for using serial ports on computers. This library provides a C++, object oriented interface for interacting with RS-232 like devices on Linux and Windows.
|
||||
</description>
|
||||
|
||||
<maintainer email="wwoodall@willowgarage.com">William Woodall</maintainer>
|
||||
|
||||
<license>BSD</license>
|
||||
|
||||
<url type="website">http://wjwwood.github.com/serial/</url>
|
||||
<url type="repository">https://github.com/wjwwood/serial</url>
|
||||
<url type="bugtracker">https://github.com/wjwwood/serial/issues</url>
|
||||
|
||||
<author email="wjwwood@gmail.com">William Woodall</author>
|
||||
<author email="ash.gti@gmail.com">John Harrison</author>
|
||||
|
||||
<build_depend>cmake</build_depend>
|
||||
<build_depend>catkin</build_depend>
|
||||
|
||||
</package>
|
||||
Loading…
x
Reference in New Issue
Block a user