mirror of
https://github.com/westonrobot/ugv_sdk
synced 2023-04-08 06:32:14 +08:00
updated test config
This commit is contained in:
@@ -9,7 +9,7 @@ endif()
|
|||||||
project(wrp_sdk VERSION 0.1.5)
|
project(wrp_sdk VERSION 0.1.5)
|
||||||
|
|
||||||
## Project Options
|
## Project Options
|
||||||
set(BUILD_TESTS OFF)
|
option(BUILD_TESTS ON)
|
||||||
|
|
||||||
## Check if pkg is built with ROS catkin
|
## Check if pkg is built with ROS catkin
|
||||||
if(CATKIN_DEVEL_PREFIX)
|
if(CATKIN_DEVEL_PREFIX)
|
||||||
@@ -60,6 +60,8 @@ if(BUILD_WITHOUT_ROS)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Build libraries
|
# Build libraries
|
||||||
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
add_library(${PROJECT_NAME}
|
add_library(${PROJECT_NAME}
|
||||||
src/async_serial.cpp
|
src/async_serial.cpp
|
||||||
src/async_can.cpp
|
src/async_can.cpp
|
||||||
@@ -73,7 +75,7 @@ add_library(${PROJECT_NAME}
|
|||||||
src/platforms/scout_uart_parser.c
|
src/platforms/scout_uart_parser.c
|
||||||
)
|
)
|
||||||
target_compile_definitions(${PROJECT_NAME} PUBLIC "-DASIO_ENABLE_OLD_SERVICES -DASIO_HAS_POSIX_STREAM_DESCRIPTOR")
|
target_compile_definitions(${PROJECT_NAME} PUBLIC "-DASIO_ENABLE_OLD_SERVICES -DASIO_HAS_POSIX_STREAM_DESCRIPTOR")
|
||||||
target_link_libraries(${PROJECT_NAME} pthread)
|
target_link_libraries(${PROJECT_NAME} Threads::Threads)
|
||||||
target_include_directories(${PROJECT_NAME} PUBLIC
|
target_include_directories(${PROJECT_NAME} PUBLIC
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||||
$<INSTALL_INTERFACE:include>
|
$<INSTALL_INTERFACE:include>
|
||||||
@@ -97,10 +99,12 @@ endif()
|
|||||||
|
|
||||||
# Build tests
|
# Build tests
|
||||||
if(PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME AND BUILD_TESTS)
|
if(PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME AND BUILD_TESTS)
|
||||||
|
message(STATUS "Tests will be built")
|
||||||
enable_testing()
|
enable_testing()
|
||||||
include(GoogleTest)
|
include(GoogleTest)
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
add_subdirectory(unit_tests)
|
else()
|
||||||
|
message(STATUS "Tests will not be built")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
## Installation configuration
|
## Installation configuration
|
||||||
|
|||||||
@@ -1,22 +1,17 @@
|
|||||||
# Add executables
|
# Google tests
|
||||||
add_executable(test_aserial test_aserial.cpp)
|
message(STATUS "Build unit tests with Google Test.")
|
||||||
target_link_libraries(test_aserial wrp_sdk)
|
add_subdirectory(googletest)
|
||||||
|
|
||||||
add_executable(test_aserial_comm test_aserial_comm.cpp)
|
# reference: https://cliutils.gitlab.io/modern-cmake/chapters/testing/googletest.html
|
||||||
target_link_libraries(test_aserial_comm wrp_sdk)
|
mark_as_advanced(
|
||||||
|
BUILD_GMOCK BUILD_GTEST BUILD_SHARED_LIBS
|
||||||
|
gmock_build_tests gtest_build_samples gtest_build_tests
|
||||||
|
gtest_disable_pthreads gtest_force_shared_crt gtest_hide_internal_symbols
|
||||||
|
)
|
||||||
|
|
||||||
add_executable(test_asio_can test_asio_can.cpp)
|
# add unit tests
|
||||||
target_link_libraries(test_asio_can wrp_sdk)
|
set(GRAPH_TESTS
|
||||||
|
unit_tests/scout_can_protocol_test.cpp
|
||||||
add_executable(test_acan test_acan.cpp)
|
)
|
||||||
target_link_libraries(test_acan wrp_sdk)
|
add_executable(gtest_all ${GRAPH_TESTS})
|
||||||
|
target_link_libraries(gtest_all gtest gmock gtest_main wrp_sdk)
|
||||||
# hunter
|
|
||||||
add_executable(test_hunter_base test_hunter_base.cpp)
|
|
||||||
target_link_libraries(test_hunter_base wrp_sdk)
|
|
||||||
|
|
||||||
# scout
|
|
||||||
add_executable(test_scout_base test_scout_base.cpp)
|
|
||||||
target_link_libraries(test_scout_base wrp_sdk)
|
|
||||||
|
|
||||||
# tracer
|
|
||||||
|
|||||||
22
tests/devel_tests/CMakeLists.txt
Normal file
22
tests/devel_tests/CMakeLists.txt
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# Add executables
|
||||||
|
add_executable(test_aserial test_aserial.cpp)
|
||||||
|
target_link_libraries(test_aserial wrp_sdk)
|
||||||
|
|
||||||
|
add_executable(test_aserial_comm test_aserial_comm.cpp)
|
||||||
|
target_link_libraries(test_aserial_comm wrp_sdk)
|
||||||
|
|
||||||
|
add_executable(test_asio_can test_asio_can.cpp)
|
||||||
|
target_link_libraries(test_asio_can wrp_sdk)
|
||||||
|
|
||||||
|
add_executable(test_acan test_acan.cpp)
|
||||||
|
target_link_libraries(test_acan wrp_sdk)
|
||||||
|
|
||||||
|
# hunter
|
||||||
|
add_executable(test_hunter_base test_hunter_base.cpp)
|
||||||
|
target_link_libraries(test_hunter_base wrp_sdk)
|
||||||
|
|
||||||
|
# scout
|
||||||
|
add_executable(test_scout_base test_scout_base.cpp)
|
||||||
|
target_link_libraries(test_scout_base wrp_sdk)
|
||||||
|
|
||||||
|
# tracer
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user