mirror of
https://github.com/wjwwood/serial.git
synced 2026-01-23 04:04:54 +08:00
Convert package to ament_cmake
This commit is contained in:
parent
683e12d2f6
commit
f6bd881bab
@ -1,31 +1,14 @@
|
|||||||
cmake_minimum_required(VERSION 2.8.3)
|
cmake_minimum_required(VERSION 3.5)
|
||||||
project(serial)
|
project(serial)
|
||||||
|
|
||||||
# Find catkin
|
# Find ament_cmake
|
||||||
find_package(catkin REQUIRED)
|
find_package(ament_cmake 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
|
|
||||||
set(rt_LIBRARIES rt)
|
|
||||||
set(pthread_LIBRARIES 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
|
||||||
@ -66,15 +49,20 @@ include_directories(include)
|
|||||||
|
|
||||||
## Install executable
|
## Install executable
|
||||||
install(TARGETS ${PROJECT_NAME}
|
install(TARGETS ${PROJECT_NAME}
|
||||||
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
|
ARCHIVE DESTINATION lib
|
||||||
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
|
LIBRARY DESTINATION lib
|
||||||
)
|
)
|
||||||
|
|
||||||
## 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 include/serial)
|
||||||
|
|
||||||
## Tests
|
## Tests
|
||||||
if(CATKIN_ENABLE_TESTING)
|
if(BUILD_TESTING)
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
ament_export_include_directories(include)
|
||||||
|
ament_export_libraries(${PROJECT_NAME})
|
||||||
|
|
||||||
|
ament_package()
|
||||||
|
|||||||
@ -19,8 +19,12 @@
|
|||||||
<author email="wjwwood@gmail.com">William Woodall</author>
|
<author email="wjwwood@gmail.com">William Woodall</author>
|
||||||
<author email="ash.gti@gmail.com">John Harrison</author>
|
<author email="ash.gti@gmail.com">John Harrison</author>
|
||||||
|
|
||||||
<buildtool_depend>catkin</buildtool_depend>
|
<buildtool_depend>ament_cmake</buildtool_depend>
|
||||||
|
|
||||||
|
<test_depend>ament_cmake_gtest</test_depend>
|
||||||
<test_depend>boost</test_depend>
|
<test_depend>boost</test_depend>
|
||||||
|
|
||||||
|
<export>
|
||||||
|
<build_type>ament_cmake</build_type>
|
||||||
|
</export>
|
||||||
</package>
|
</package>
|
||||||
|
|||||||
@ -1,12 +1,15 @@
|
|||||||
if(UNIX)
|
if(UNIX)
|
||||||
catkin_add_gtest(${PROJECT_NAME}-test unix_serial_tests.cc)
|
find_package(ament_cmake_gtest REQUIRED)
|
||||||
|
find_package(Boost REQUIRED)
|
||||||
|
|
||||||
|
ament_add_gtest(${PROJECT_NAME}-test unix_serial_tests.cc)
|
||||||
target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME} ${Boost_LIBRARIES})
|
target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME} ${Boost_LIBRARIES})
|
||||||
if(NOT APPLE)
|
if(NOT APPLE)
|
||||||
target_link_libraries(${PROJECT_NAME}-test util)
|
target_link_libraries(${PROJECT_NAME}-test util)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT APPLE) # these tests are unreliable on macOS
|
if(NOT APPLE) # these tests are unreliable on macOS
|
||||||
catkin_add_gtest(${PROJECT_NAME}-test-timer unit/unix_timer_tests.cc)
|
ament_add_gtest(${PROJECT_NAME}-test-timer unit/unix_timer_tests.cc)
|
||||||
target_link_libraries(${PROJECT_NAME}-test-timer ${PROJECT_NAME})
|
target_link_libraries(${PROJECT_NAME}-test-timer ${PROJECT_NAME})
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user