Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make TUI optional
  • Loading branch information
David committed Mar 22, 2023
1 parent 8b3043e commit ffb2b05
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 29 deletions.
53 changes: 25 additions & 28 deletions CMakeLists.txt
Expand Up @@ -4,21 +4,20 @@ set(CMAKE_CXX_STANDARD 17)

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()
if( TUI )
# --- 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_MakeAvailable(ftxui)
# ------------------------------------------------------------------------------
endif()



# location of source code files
Expand Down Expand Up @@ -155,17 +154,15 @@ target_link_libraries( example_calibration PUBLIC simple_adas )
#target_link_libraries( accel 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 )
if( TUI )
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 )
endif()
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -31,7 +31,7 @@ This API is based on the [Official Formula Student API](https://github.com/FS-AI
>:octocat: **Compiling the Project**
>
>To build the projects run:
>`cmake . && cmake --build .`
>`cmake -DTUI=1 . && cmake --build .`

>:octocat: **Running the Terminal User Interface**
Expand Down

0 comments on commit ffb2b05

Please sign in to comment.