code compiles with new structure

This commit is contained in:
Ruixiang Du
2020-06-17 11:18:04 +08:00
parent 8bbca03528
commit 44b89ee5f9
4100 changed files with 292 additions and 489458 deletions

View File

@@ -1,8 +1,8 @@
cmake_minimum_required(VERSION 3.1.0)
project(wrp_sdk)
# Find catkin
find_package(catkin REQUIRED)
# # Find catkin
# find_package(catkin REQUIRED)
# generate symbols for IDE indexer
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
@@ -18,10 +18,6 @@ set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
set(ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
## Use GNUInstallDirs to install libraries into correct
# locations on all platforms.
include(GNUInstallDirs)
## Chosse build type
set(CMAKE_BUILD_TYPE Release)
# set(CMAKE_BUILD_TYPE Debug)
@@ -37,7 +33,7 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
endif()
## Optionally built modules: ON/OFF
set(BUILD_TESTS OFF)
set(BUILD_TESTS ON)
set(BUILD_MONITOR ON)
# Disable monitor if ncurses library is not found
@@ -49,36 +45,71 @@ if(BUILD_MONITOR AND NOT CURSES_FOUND)
message(STATUS "Monitor app will not be built due to missing ncurses library, try: sudo apt install libncurses5-dev")
endif()
## Add source directories
add_subdirectory(src)
# Add libraries
set(WRP_SDK_SRC
src/async_serial.cpp
src/async_can.cpp
src/asyncio_utils.cpp
# agilex mobile platforms
src/platforms/hunter_base.cpp
src/platforms/hunter_can_parser.c
src/platforms/scout_base.cpp
src/platforms/scout_can_parser.c
src/platforms/scout_uart_parser.c
)
add_library(wrpsdk STATIC ${WRP_SDK_SRC})
target_compile_definitions(wrpsdk PUBLIC "-DASIO_ENABLE_OLD_SERVICES -DASIO_HAS_POSIX_STREAM_DESCRIPTOR")
target_link_libraries(wrpsdk pthread)
target_include_directories(wrpsdk PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
PRIVATE src)
# install(TARGETS asyncio
# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION})
# install(DIRECTORY include asio
# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION})
# Add executables
if(BUILD_TESTS)
add_subdirectory(tests)
endif()
if(BUILD_TESTS)
add_subdirectory(unit_tests)
endif()
## Export catkin targets
set(EXPORTED_LIBS
asyncio
stopwatch
scout_protocol
scoutbase
hunter_protocol
hunterbase
)
set(INCLUDE_DIRS
src/common/async_io/asio
src/common/async_io/include
src/common/utilities/stopwatch/include
src/scout_sdk/scout_protocol/include
src/scout_sdk/scout_base/include
src/hunter_sdk/hunter_protocol/include
src/hunter_sdk/hunter_base/include
)
catkin_package(
LIBRARIES ${EXPORTED_LIBS}
INCLUDE_DIRS ${INCLUDE_DIRS}
# DEPENDS rt pthread
)
## Use GNUInstallDirs to install libraries into correct
# locations on all platforms.
include(GNUInstallDirs)
# ## Export catkin targets
# set(EXPORTED_LIBS
# asyncio
# stopwatch
# scout_protocol
# scoutbase
# hunter_protocol
# hunterbase
# )
# set(INCLUDE_DIRS
# src/common/async_io/asio
# src/common/async_io/include
# src/common/utilities/stopwatch/include
# src/scout_sdk/scout_protocol/include
# src/scout_sdk/scout_base/include
# src/hunter_sdk/hunter_protocol/include
# src/hunter_sdk/hunter_base/include
# )
# catkin_package(
# LIBRARIES ${EXPORTED_LIBS}
# INCLUDE_DIRS ${INCLUDE_DIRS}
# # DEPENDS rt pthread
# )
## Add catkin install targets
# install(TARGETS ${EXPORTED_LIBS}