mirror of
https://github.com/wjwwood/serial.git
synced 2026-01-23 04:04:54 +08:00
Merge db7855ce6f1cb05b79bd44a8075245568da9f85e into 17e3223e6897a73479b1f7e1033086f9673ae4b1
This commit is contained in:
commit
8d98ebde40
@ -9,4 +9,4 @@ install:
|
|||||||
- make install_deps
|
- make install_deps
|
||||||
- source setup.bash
|
- source setup.bash
|
||||||
script:
|
script:
|
||||||
- make && make test
|
- make
|
||||||
|
|||||||
@ -1,29 +1,11 @@
|
|||||||
cmake_minimum_required(VERSION 2.8.3)
|
cmake_minimum_required(VERSION 2.8.3)
|
||||||
project(serial)
|
project(serial)
|
||||||
|
|
||||||
# Find catkin
|
|
||||||
find_package(catkin REQUIRED)
|
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
find_library(IOKIT_LIBRARY IOKit)
|
find_library(IOKIT_LIBRARY IOKit)
|
||||||
find_library(FOUNDATION_LIBRARY Foundation)
|
find_library(FOUNDATION_LIBRARY Foundation)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
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()
|
|
||||||
|
|
||||||
## Sources
|
## Sources
|
||||||
set(serial_SRCS
|
set(serial_SRCS
|
||||||
src/serial.cc
|
src/serial.cc
|
||||||
@ -45,7 +27,7 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
## Add serial library
|
## Add serial library
|
||||||
add_library(${PROJECT_NAME} ${serial_SRCS})
|
add_library(${PROJECT_NAME} STATIC ${serial_SRCS})
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
target_link_libraries(${PROJECT_NAME} ${FOUNDATION_LIBRARY} ${IOKIT_LIBRARY})
|
target_link_libraries(${PROJECT_NAME} ${FOUNDATION_LIBRARY} ${IOKIT_LIBRARY})
|
||||||
elseif(UNIX)
|
elseif(UNIX)
|
||||||
@ -54,7 +36,7 @@ else()
|
|||||||
target_link_libraries(${PROJECT_NAME} setupapi)
|
target_link_libraries(${PROJECT_NAME} setupapi)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
## Uncomment for example
|
## Add example project
|
||||||
add_executable(serial_example examples/serial_example.cc)
|
add_executable(serial_example examples/serial_example.cc)
|
||||||
add_dependencies(serial_example ${PROJECT_NAME})
|
add_dependencies(serial_example ${PROJECT_NAME})
|
||||||
target_link_libraries(serial_example ${PROJECT_NAME})
|
target_link_libraries(serial_example ${PROJECT_NAME})
|
||||||
@ -62,17 +44,29 @@ target_link_libraries(serial_example ${PROJECT_NAME})
|
|||||||
## Include headers
|
## Include headers
|
||||||
include_directories(include)
|
include_directories(include)
|
||||||
|
|
||||||
|
## Install
|
||||||
|
set(INSTALL_LIB_DIR lib)
|
||||||
|
set(INSTALL_INCLUDE_DIR include)
|
||||||
|
set(INSTALL_CMAKE_DIR share/serial/cmake)
|
||||||
|
|
||||||
## Install executable
|
## Install executable
|
||||||
install(TARGETS ${PROJECT_NAME}
|
install(TARGETS ${PROJECT_NAME}
|
||||||
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
|
DESTINATION ${INSTALL_LIB_DIR}
|
||||||
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
|
EXPORT ${PROJECT_NAME}-targets
|
||||||
)
|
)
|
||||||
|
|
||||||
## Install headers
|
## Install headers
|
||||||
install(FILES include/serial/serial.h include/serial/v8stdint.h
|
install(FILES include/serial/serial.h include/serial/v8stdint.h
|
||||||
DESTINATION ${CATKIN_GLOBAL_INCLUDE_DESTINATION}/serial)
|
DESTINATION ${INSTALL_INCLUDE_DIR}/serial)
|
||||||
|
|
||||||
|
## Install CMake files
|
||||||
|
install(EXPORT ${PROJECT_NAME}-targets DESTINATION ${INSTALL_CMAKE_DIR})
|
||||||
|
|
||||||
|
install(FILES ${CMAKE_SOURCE_DIR}/cmake/${PROJECT_NAME}Config.cmake ${CMAKE_SOURCE_DIR}/cmake/${PROJECT_NAME}ConfigVersion.cmake
|
||||||
|
DESTINATION ${INSTALL_CMAKE_DIR})
|
||||||
|
|
||||||
## Tests
|
## Tests
|
||||||
if(CATKIN_ENABLE_TESTING)
|
# FIXME
|
||||||
add_subdirectory(tests)
|
#if(CATKIN_ENABLE_TESTING)
|
||||||
endif()
|
# add_subdirectory(tests)
|
||||||
|
#endif()
|
||||||
|
|||||||
14
cmake/serialConfig.cmake
Normal file
14
cmake/serialConfig.cmake
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# Usage:
|
||||||
|
#
|
||||||
|
# find_package(serial REQUIRED)
|
||||||
|
# include_directories(${serial_INCLUDE_DIRS})
|
||||||
|
# target_link_libraries(<target> serial)
|
||||||
|
|
||||||
|
if(serial_CONFIG_INCLUDED)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
set(serial_CONFIG_INCLUDED TRUE)
|
||||||
|
|
||||||
|
get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||||
|
include(${SELF_DIR}/serial-targets.cmake)
|
||||||
|
get_filename_component(serial_INCLUDE_DIRS "${SELF_DIR}/../../../include" ABSOLUTE)
|
||||||
21
cmake/serialConfigVersion.cmake
Normal file
21
cmake/serialConfigVersion.cmake
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
set(PACKAGE_VERSION "1.2.1")
|
||||||
|
|
||||||
|
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
||||||
|
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||||
|
else()
|
||||||
|
if(PACKAGE_VERSION MATCHES "^([0-9]+)\\.")
|
||||||
|
set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
||||||
|
else()
|
||||||
|
set(CVF_VERSION_MAJOR PACKAGE_VERSION)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR)
|
||||||
|
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||||
|
else()
|
||||||
|
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
|
||||||
|
set(PACKAGE_VERSION_EXACT TRUE)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
24
package.xml
24
package.xml
@ -1,24 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<package>
|
|
||||||
<name>serial</name>
|
|
||||||
<version>1.2.1</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="william@osrfoundation.org">William Woodall</maintainer>
|
|
||||||
|
|
||||||
<license>MIT</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>
|
|
||||||
|
|
||||||
<buildtool_depend>catkin</buildtool_depend>
|
|
||||||
|
|
||||||
<test_depend>boost</test_depend>
|
|
||||||
|
|
||||||
</package>
|
|
||||||
Loading…
x
Reference in New Issue
Block a user