Skip to content

Commit

Permalink
automate building of ncurses example
Browse files Browse the repository at this point in the history
  • Loading branch information
2bndy5 committed Jun 12, 2021
1 parent 4ee2e51 commit d1c3217
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ jobs:
working-directory: ${{ github.workspace }}/build
# doesn't build the RF24Mesh_Ncurses_Master example because we haven't cross-compiled it in this workflow
run: |
make RF24Mesh_Example RF24Mesh_Example_Master
cmake --build .
file ./RF24Mesh_Example
# cross-compiling a python C extension is better done with pypa/cibuildwheel action
Expand Down
15 changes: 15 additions & 0 deletions cmake/enableNcursesExample.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
find_package(Curses)
if(Curses_FOUND)
include_directories(${CURSES_INCLUDE_DIR})
option(BUILD_NCURSES_EXAMPLE
"Enable/Disable building the ncurses example (requires libncurses5-dev installed)"
ON
)
else()
message(STATUS "libncurses5-dev not found. Skipping ncurses example")
option(BUILD_NCURSES_EXAMPLE
"Enable/Disable building the ncurses example (requires libncurses5-dev installed)"
OFF
)
endif()
message(STATUS "BUILD_NCURSES_EXAMPLE set to ${BUILD_NCURSES_EXAMPLE}")
5 changes: 4 additions & 1 deletion examples_RPi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,7 @@ foreach(example ${EXAMPLES_LIST})
target_link_libraries(${example} PUBLIC ${RF24} pthread ${RF24Network} ${RF24Mesh})
endforeach()

add_subdirectory(ncurses)
include(../cmake/enableNcursesExample.cmake)
if(BUILD_NCURSES_EXAMPLE)
add_subdirectory(ncurses)
endif()

0 comments on commit d1c3217

Please sign in to comment.