1
0
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:
Dinesh Bolkensteyn 2018-01-14 10:02:53 +00:00 committed by GitHub
commit 8d98ebde40
5 changed files with 56 additions and 51 deletions

View File

@ -9,4 +9,4 @@ install:
- make install_deps
- source setup.bash
script:
- make && make test
- make

View File

@ -1,29 +1,11 @@
cmake_minimum_required(VERSION 2.8.3)
project(serial)
# Find catkin
find_package(catkin REQUIRED)
if(APPLE)
find_library(IOKIT_LIBRARY IOKit)
find_library(FOUNDATION_LIBRARY Foundation)
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
set(serial_SRCS
src/serial.cc
@ -45,7 +27,7 @@ else()
endif()
## Add serial library
add_library(${PROJECT_NAME} ${serial_SRCS})
add_library(${PROJECT_NAME} STATIC ${serial_SRCS})
if(APPLE)
target_link_libraries(${PROJECT_NAME} ${FOUNDATION_LIBRARY} ${IOKIT_LIBRARY})
elseif(UNIX)
@ -54,7 +36,7 @@ else()
target_link_libraries(${PROJECT_NAME} setupapi)
endif()
## Uncomment for example
## Add example project
add_executable(serial_example examples/serial_example.cc)
add_dependencies(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_directories(include)
## Install
set(INSTALL_LIB_DIR lib)
set(INSTALL_INCLUDE_DIR include)
set(INSTALL_CMAKE_DIR share/serial/cmake)
## Install executable
install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
DESTINATION ${INSTALL_LIB_DIR}
EXPORT ${PROJECT_NAME}-targets
)
## Install headers
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
if(CATKIN_ENABLE_TESTING)
add_subdirectory(tests)
endif()
# FIXME
#if(CATKIN_ENABLE_TESTING)
# add_subdirectory(tests)
#endif()

14
cmake/serialConfig.cmake Normal file
View 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)

View 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()

View File

@ -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>