mirror of
https://github.com/wjwwood/serial.git
synced 2026-01-22 19:54:57 +08:00
Merge aa328d690520261d662db64688a656153c943204 into 17e3223e6897a73479b1f7e1033086f9673ae4b1
This commit is contained in:
commit
21b9631fbb
@ -1,78 +1,50 @@
|
||||
cmake_minimum_required(VERSION 2.8.3)
|
||||
|
||||
project(serial)
|
||||
|
||||
# Find catkin
|
||||
find_package(catkin REQUIRED)
|
||||
|
||||
find_package(ament_cmake 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
|
||||
include/serial/serial.h
|
||||
include/serial/v8stdint.h
|
||||
)
|
||||
if(APPLE)
|
||||
# If OSX
|
||||
list(APPEND serial_SRCS src/impl/unix.cc)
|
||||
list(APPEND serial_SRCS src/impl/list_ports/list_ports_osx.cc)
|
||||
elseif(UNIX)
|
||||
# If unix
|
||||
list(APPEND serial_SRCS src/impl/unix.cc)
|
||||
list(APPEND serial_SRCS src/impl/list_ports/list_ports_linux.cc)
|
||||
else()
|
||||
# If windows
|
||||
list(APPEND serial_SRCS src/impl/win.cc)
|
||||
list(APPEND serial_SRCS src/impl/list_ports/list_ports_win.cc)
|
||||
find_library(IOKIT_LIBRARY IOKit)
|
||||
find_library(FOUNDATION_LIBRARY Foundation)
|
||||
endif()
|
||||
|
||||
## Add serial library
|
||||
add_library(${PROJECT_NAME} ${serial_SRCS})
|
||||
if(APPLE)
|
||||
target_link_libraries(${PROJECT_NAME} ${FOUNDATION_LIBRARY} ${IOKIT_LIBRARY})
|
||||
elseif(UNIX)
|
||||
target_link_libraries(${PROJECT_NAME} rt pthread)
|
||||
else()
|
||||
target_link_libraries(${PROJECT_NAME} setupapi)
|
||||
add_library(${PROJECT_NAME} SHARED
|
||||
src/serial.cc
|
||||
src/impl/unix.cc
|
||||
src/impl/list_ports/list_ports_osx.cc
|
||||
)
|
||||
elseif(UNIX)
|
||||
add_library(${PROJECT_NAME} SHARED
|
||||
src/serial.cc
|
||||
src/impl/unix.cc
|
||||
src/impl/list_ports/list_ports_linux.cc
|
||||
)
|
||||
endif()
|
||||
|
||||
## Uncomment for example
|
||||
add_executable(serial_example examples/serial_example.cc)
|
||||
add_dependencies(serial_example ${PROJECT_NAME})
|
||||
target_link_libraries(serial_example ${PROJECT_NAME})
|
||||
|
||||
if(APPLE)
|
||||
target_link_libraries(${PROJECT_NAME} ${FOUNDATION_LIBRARY} ${IOKIT_LIBRARY})
|
||||
elseif(UNIX)
|
||||
target_link_libraries(${PROJECT_NAME} rt pthread)
|
||||
endif()
|
||||
|
||||
ament_export_libraries(${PROJECT_NAME})
|
||||
|
||||
ament_package()
|
||||
|
||||
## Include headers
|
||||
include_directories(include)
|
||||
|
||||
## Install executable
|
||||
install(TARGETS ${PROJECT_NAME}
|
||||
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
|
||||
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
|
||||
install(
|
||||
TARGETS ${PROJECT_NAME}
|
||||
ARCHIVE DESTINATION lib
|
||||
LIBRARY DESTINATION lib
|
||||
RUNTIME DESTINATION bin
|
||||
)
|
||||
|
||||
## Install headers
|
||||
install(FILES include/serial/serial.h include/serial/v8stdint.h
|
||||
DESTINATION ${CATKIN_GLOBAL_INCLUDE_DESTINATION}/serial)
|
||||
|
||||
## Tests
|
||||
if(CATKIN_ENABLE_TESTING)
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
install(
|
||||
DIRECTORY include/
|
||||
DESTINATION include
|
||||
)
|
||||
|
||||
13
package.xml
13
package.xml
@ -1,11 +1,10 @@
|
||||
<?xml version="1.0"?>
|
||||
<package>
|
||||
<package format="2">
|
||||
<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>
|
||||
@ -14,11 +13,9 @@
|
||||
<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>
|
||||
<buildtool_depend>ament_cmake</buildtool_depend>
|
||||
|
||||
<export>
|
||||
<build_type>ament_cmake</build_type>
|
||||
</export>
|
||||
</package>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user