Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
cmake_minimum_required(VERSION 3.0)
set(CMAKE_CXX_STANDARD 17)
# add_compile_options(-Wall -Wextra -pedantic -g)
project(adas_api C CXX)
# --- Fetch FTXUI --------------------------------------------------------------
include(FetchContent)
set(FETCHCONTENT_UPDATES_DISCONNECTED TRUE)
FetchContent_Declare(ftxui
GIT_REPOSITORY https://github.com/ArthurSonzogni/ftxui
GIT_TAG v3.0.0
)
FetchContent_GetProperties(ftxui)
if(NOT ftxui_POPULATED)
FetchContent_Populate(ftxui)
add_subdirectory(${ftxui_SOURCE_DIR} ${ftxui_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()
# ------------------------------------------------------------------------------
# location of source code files
include_directories( include )
# tell cmake where to put the executables that it creates
file( MAKE_DIRECTORY bin )
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY bin )
# where to put the object files it creates
file( MAKE_DIRECTORY lib )
SET( LIBRARY_OUTPUT_PATH lib )
# autogenerate code from the DBC file
file( MAKE_DIRECTORY src_autogen )
add_custom_command( OUTPUT src_autogen/candata.h src_autogen/candata.c
COMMAND python3 -m cantools generate_c_source ${CMAKE_CURRENT_SOURCE_DIR}/docs/candata.dbc -o src_autogen
MAIN_DEPENDENCY docs/candata.dbc
COMMENT "Autogenerate code from DBC file" )
# create shared library of the autogenerated code from the DBC file
add_library( candata SHARED src_autogen/candata.c )
target_include_directories( candata PUBLIC src_autogen )
add_library( process_frame SHARED src/status/process_frame.cpp )
target_include_directories( process_frame PUBLIC include )
# input frames
add_library( brake_frame SHARED src/status/brake_frame.cpp )
target_include_directories( brake_frame PUBLIC include )
target_link_libraries( brake_frame PUBLIC candata )
target_link_libraries( brake_frame PUBLIC process_frame )
add_library( axle_torque_frame SHARED src/status/axle_torque_frame.cpp )
target_include_directories( axle_torque_frame PUBLIC include )
target_link_libraries( axle_torque_frame PUBLIC candata )
target_link_libraries( axle_torque_frame PUBLIC process_frame )
add_library( steering_frame SHARED src/status/steering_frame.cpp )
target_include_directories( steering_frame PUBLIC include )
target_link_libraries( steering_frame PRIVATE candata )
target_link_libraries( steering_frame PUBLIC process_frame )
add_library( status_frame SHARED src/status/status_frame.cpp )
target_include_directories( status_frame PUBLIC include )
target_link_libraries( status_frame PRIVATE candata )
target_link_libraries( status_frame PUBLIC process_frame )
add_library( wheel_counts_frame SHARED src/status/wheel_counts_frame.cpp )
target_include_directories( wheel_counts_frame PUBLIC include )
target_link_libraries( wheel_counts_frame PRIVATE candata )
target_link_libraries( wheel_counts_frame PUBLIC process_frame )
add_library( wheel_speeds_frame SHARED src/status/wheel_speeds_frame.cpp )
target_include_directories( wheel_speeds_frame PUBLIC include )
target_link_libraries( wheel_speeds_frame PRIVATE candata )
target_link_libraries( wheel_speeds_frame PUBLIC process_frame )
add_library( status_frames SHARED src/status_frames.cpp )
target_include_directories( status_frames PUBLIC include )
target_link_libraries( status_frames PUBLIC axle_torque_frame
brake_frame
status_frame
steering_frame
wheel_counts_frame
wheel_speeds_frame )
# output frames
add_library( control_frame SHARED src/control/control_frame.cpp )
target_include_directories( control_frame PUBLIC include )
add_library( axle_control_frame SHARED src/control/axle_control_frame.cpp )
target_include_directories( axle_control_frame PUBLIC include )
target_link_libraries( axle_control_frame PUBLIC control_frame axle_torque_frame )
target_link_libraries( axle_control_frame PRIVATE candata )
add_library( brake_control_frame SHARED src/control/brake_control_frame.cpp )
target_include_directories( brake_control_frame PUBLIC include )
target_link_libraries( brake_control_frame PUBLIC control_frame axle_torque_frame )
target_link_libraries( brake_control_frame PRIVATE candata )
add_library( status_control_frame SHARED src/control/status_control_frame.cpp )
target_include_directories( status_control_frame PUBLIC include )
target_link_libraries( status_control_frame PUBLIC control_frame steering_frame )
target_link_libraries( status_control_frame PRIVATE candata )
add_library( steering_control_frame SHARED src/control/steering_control_frame.cpp )
target_include_directories( steering_control_frame PUBLIC include )
target_link_libraries( steering_control_frame PUBLIC control_frame steering_frame )
target_link_libraries( steering_control_frame PRIVATE candata )
add_library( control_frames SHARED src/control_frames.cpp )
target_include_directories( control_frames PUBLIC include )
target_link_libraries( control_frames PUBLIC axle_control_frame
brake_control_frame
status_control_frame
steering_control_frame )
add_library( adas SHARED src/adas.cpp )
target_include_directories( adas PUBLIC include )
target_link_libraries( adas PUBLIC control_frames status_frames )
add_library( simple_adas SHARED src/simple_adas.cpp )
target_include_directories( simple_adas PUBLIC include )
target_link_libraries( simple_adas PUBLIC adas )
# examples
add_executable( example_frame_reader src/example_frame_reader.cpp )
target_link_libraries( example_frame_reader PRIVATE candata status_frames )
#add_executable( example_control src/example_control.cpp )
#target_link_libraries( example_control PRIVATE candata control_frames status_frames )
add_executable( example_straight_line src/example_straight_line.cpp )
target_link_libraries( example_straight_line PUBLIC simple_adas )
add_executable( example_wiggle src/example_wiggle.cpp )
target_link_libraries( example_wiggle PUBLIC simple_adas )
# demo
add_library( demo_ui STATIC src/demo_ui.cpp )
target_include_directories( demo_ui PRIVATE include )
target_link_libraries( demo_ui
PUBLIC ftxui::screen
PUBLIC ftxui::dom
PUBLIC ftxui::component
PUBLIC candata adas )
add_executable( demo src/demo.cpp )
target_link_libraries( demo demo_ui )
#PRIVATE ftxui::screen
#PRIVATE ftxui::dom
#PRIVATE ftxui::component
#PRIVATE candata adas demo_ui )