1
0
mirror of https://github.com/wjwwood/serial.git synced 2026-01-22 19:54:57 +08:00

Adding catkin build files and a new Makefile.

This commit is contained in:
William Woodall 2012-10-23 23:47:11 -07:00
parent 73371a144d
commit 7174d62e1b
3 changed files with 115 additions and 21 deletions

View File

@ -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) if(UNIX AND NOT APPLE)
option(SERIAL_BUILD_WIHOUT_ROS "Build without ROS?" OFF) # If Linux, add rt and pthread
else(DEFINED ROS_ROOT) catkin_package(
option(SERIAL_BUILD_WIHOUT_ROS "Build without ROS?" ON) LIBRARIES ${PROJECT_NAME}
endif(DEFINED ROS_ROOT) 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) ## Sources
# Build with ROS set(serial_SRCS
include(serial_ros.cmake) src/serial.cc
message("Building with ROS") # include/serial/serial.h
build_serial() # include/serial/v8stdint.h
else(DEFINED ROS_ROOT AND NOT SERIAL_BUILD_WIHOUT_ROS) )
# Build normally if (UNIX)
include(serial.cmake) # If unix
message("Building stand alone") list (APPEND serial_SRCS src/impl/unix.cc)
build_serial() else()
endif(DEFINED ROS_ROOT AND NOT SERIAL_BUILD_WIHOUT_ROS) # 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})

View File

@ -1,5 +1,39 @@
ifdef ROS_ROOT all: serial
include $(shell rospack find mk)/cmake.mk
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 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 endif

23
package.xml Normal file
View 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>