Skip to content

Commit

Permalink
review supported CMake options
Browse files Browse the repository at this point in the history
also defaults RF24_DRIVER to SPIDEV (per nRF24/RF24#971)
  • Loading branch information
2bndy5 committed Jun 28, 2024
1 parent add581b commit 7328803
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 24 deletions.
7 changes: 3 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,9 @@ if(DEFINED MESH_WRITE_TIMEOUT)
message(STATUS "MESH_WRITE_TIMEOUT set to ${MESH_WRITE_TIMEOUT}")
target_compile_definitions(${LibTargetName} PUBLIC MESH_WRITE_TIMEOUT=${MESH_WRITE_TIMEOUT})
endif()
# conditionally disable interruot support (a pigpio specific feature)
if("${LibPIGPIO}" STREQUAL "LibPIGPIO-NOTFOUND" OR DEFINED RF24_NO_INTERRUPT)
message(STATUS "Disabling IRQ pin support")
target_compile_definitions(${LibTargetName} PUBLIC RF24_NO_INTERRUPT)
if(DEFINED RF24MESH_CONN_CHECK_TYPE)
message(STATUS "RF24MESH_CONN_CHECK_TYPE set to ${RF24MESH_CONN_CHECK_TYPE}")
target_compile_definitions(${LibTargetName} PUBLIC RF24MESH_CONN_CHECK_TYPE=${RF24MESH_CONN_CHECK_TYPE})
endif()


Expand Down
42 changes: 22 additions & 20 deletions cmake/AutoConfig_RF24_DRIVER.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,33 @@ else()
endif()


if(${RF24_DRIVER} STREQUAL "UNKNOWN") # invokes automatic configuration
if("${SOC}" STREQUAL "BCM2708" OR "${SOC}" STREQUAL "BCM2709" OR "${SOC}" STREQUAL "BCM2835")
set(RF24_DRIVER RPi CACHE STRING "using folder /utility/RPi" FORCE)
elseif(NOT "${LibPIGPIO}" STREQUAL "LibPIGPIO-NOTFOUND")
message(STATUS "Found pigpio library: ${LibPIGPIO}")
set(RF24_DRIVER pigpio CACHE STRING "using folder /utility/pigpio" FORCE)
elseif(NOT "${LibWiringPi}" STREQUAL "LibWiringPi-NOTFOUND")
message(STATUS "Found wiringPi library: ${LibWiringPi}")
set(RF24_DRIVER wiringPi CACHE STRING "using folder /utility/wiringPi" FORCE)
elseif(NOT "${LibLittleWire}" STREQUAL "LibLittleWire-NOTFOUND")
message(STATUS "Found LittleWire library: ${LibLittleWire}")
set(RF24_DRIVER LittleWire CACHE STRING "using folder /utility/LittleWire" FORCE)
elseif(NOT "${LibMRAA}" STREQUAL "LibMRAA-NOTFOUND")
message(STATUS "Found MRAA library: ${LibMRAA}")
set(RF24_DRIVER MRAA CACHE STRING "using folder /utility/MRAA" FORCE)
elseif(SPIDEV_EXISTS) # should be a non-empty string if SPI is enabled
message(STATUS "detected that SPIDEV is enabled: ${SPIDEV_EXISTS}")
set(RF24_DRIVER SPIDEV CACHE STRING "using folder /utility/SPIDEV" FORCE)
endif()
endif()
# if(${RF24_DRIVER} STREQUAL "UNKNOWN") # invokes automatic configuration
# if("${SOC}" STREQUAL "BCM2708" OR "${SOC}" STREQUAL "BCM2709" OR "${SOC}" STREQUAL "BCM2835")
# set(RF24_DRIVER RPi CACHE STRING "using folder /utility/RPi" FORCE)
# elseif(NOT "${LibPIGPIO}" STREQUAL "LibPIGPIO-NOTFOUND")
# message(STATUS "Found pigpio library: ${LibPIGPIO}")
# set(RF24_DRIVER pigpio CACHE STRING "using folder /utility/pigpio" FORCE)
# elseif(NOT "${LibWiringPi}" STREQUAL "LibWiringPi-NOTFOUND")
# message(STATUS "Found wiringPi library: ${LibWiringPi}")
# set(RF24_DRIVER wiringPi CACHE STRING "using folder /utility/wiringPi" FORCE)
# elseif(NOT "${LibLittleWire}" STREQUAL "LibLittleWire-NOTFOUND")
# message(STATUS "Found LittleWire library: ${LibLittleWire}")
# set(RF24_DRIVER LittleWire CACHE STRING "using folder /utility/LittleWire" FORCE)
# elseif(NOT "${LibMRAA}" STREQUAL "LibMRAA-NOTFOUND")
# message(STATUS "Found MRAA library: ${LibMRAA}")
# set(RF24_DRIVER MRAA CACHE STRING "using folder /utility/MRAA" FORCE)
# elseif(SPIDEV_EXISTS) # should be a non-empty string if SPI is enabled
# message(STATUS "detected that SPIDEV is enabled: ${SPIDEV_EXISTS}")
# set(RF24_DRIVER SPIDEV CACHE STRING "using folder /utility/SPIDEV" FORCE)
# endif()
# endif()

# override the auto-detect if RF24_DRIVER is defined in an env var
if(DEFINED ENV{RF24_DRIVER})
message(STATUS "RF24_DRIVER (set from env var) = $ENV{RF24_DRIVER}")
set(RF24_DRIVER $ENV{RF24_DRIVER} CACHE STRING "" FORCE)
elseif(${RF24_DRIVER} STREQUAL "UNKNOWN")
set(RF24_DRIVER SPIDEV CACHE STRING "using folder RF24/utility/SPIDEV" FORCE)
endif()

message(STATUS "Using driver: ${RF24_DRIVER}")

0 comments on commit 7328803

Please sign in to comment.