1## 2## ______ _ 3## / _____) _ | | 4## ( (____ _____ ____ _| |_ _____ ____| |__ 5## \____ \| ___ | (_ _) ___ |/ ___) _ \ 6## _____) ) ____| | | || |_| ____( (___| | | | 7## (______/|_____)_|_|_| \__)_____)\____)_| |_| 8## (C)2013-2017 Semtech 9## ___ _____ _ ___ _ _____ ___ ___ ___ ___ 10## / __|_ _/_\ / __| |/ / __/ _ \| _ \/ __| __| 11## \__ \ | |/ _ \ (__| ' <| _| (_) | / (__| _| 12## |___/ |_/_/ \_\___|_|\_\_| \___/|_|_\\___|___| 13## embedded.connectivity.solutions.============== 14## 15## License: Revised BSD License, see LICENSE.TXT file included in the project 16## Authors: Johannes Bruder (STACKFORCE), Miguel Luis (Semtech) 17## 18project(radio) 19cmake_minimum_required(VERSION 3.6) 20 21#--------------------------------------------------------------------------------------- 22# Options 23#--------------------------------------------------------------------------------------- 24 25# Allow switching of radios 26set(RADIO_LIST sx1272 sx1276 sx126x lr1110) 27set(RADIO sx1272 CACHE STRING "Default radio is sx1272") 28set_property(CACHE RADIO PROPERTY STRINGS ${RADIO_LIST}) 29set_property(CACHE RADIO PROPERTY ADVANCED) 30 31#--------------------------------------------------------------------------------------- 32# Radio drivers 33#--------------------------------------------------------------------------------------- 34 35if(${RADIO} STREQUAL lr1110) 36 list(APPEND ${PROJECT_NAME}_SOURCES 37 ${CMAKE_CURRENT_SOURCE_DIR}/lr1110/radio.c 38 ${CMAKE_CURRENT_SOURCE_DIR}/lr1110/lr1110_driver/src/lr1110_bootloader.c 39 ${CMAKE_CURRENT_SOURCE_DIR}/lr1110/lr1110_driver/src/lr1110_crypto_engine.c 40 ${CMAKE_CURRENT_SOURCE_DIR}/lr1110/lr1110_driver/src/lr1110_driver_version.c 41 ${CMAKE_CURRENT_SOURCE_DIR}/lr1110/lr1110_driver/src/lr1110_gnss.c 42 ${CMAKE_CURRENT_SOURCE_DIR}/lr1110/lr1110_driver/src/lr1110_radio.c 43 ${CMAKE_CURRENT_SOURCE_DIR}/lr1110/lr1110_driver/src/lr1110_regmem.c 44 ${CMAKE_CURRENT_SOURCE_DIR}/lr1110/lr1110_driver/src/lr1110_system.c 45 ${CMAKE_CURRENT_SOURCE_DIR}/lr1110/lr1110_driver/src/lr1110_wifi.c 46 ) 47elseif(${RADIO} STREQUAL sx126x) 48 list(APPEND ${PROJECT_NAME}_SOURCES 49 ${CMAKE_CURRENT_SOURCE_DIR}/sx126x/radio.c 50 ${CMAKE_CURRENT_SOURCE_DIR}/sx126x/sx126x.c 51 ) 52elseif(${RADIO} STREQUAL sx1272) 53 list(APPEND ${PROJECT_NAME}_SOURCES 54 ${CMAKE_CURRENT_SOURCE_DIR}/sx1272/sx1272.c 55 ) 56elseif(${RADIO} STREQUAL sx1276) 57 list(APPEND ${PROJECT_NAME}_SOURCES 58 ${CMAKE_CURRENT_SOURCE_DIR}/sx1276/sx1276.c 59 ) 60else() 61 message(FATAL_ERROR "Unsupported radio driver selected...") 62endif() 63 64add_library(${PROJECT_NAME} OBJECT EXCLUDE_FROM_ALL ${${PROJECT_NAME}_SOURCES}) 65 66add_dependencies(${PROJECT_NAME} board) 67 68if(${RADIO} STREQUAL lr1110 ) 69 list(APPEND ${PROJECT_NAME}_INCLUDES 70 ${CMAKE_CURRENT_SOURCE_DIR}/lr1110 71 ${CMAKE_CURRENT_SOURCE_DIR}/lr1110/lr1110_driver/src 72 ) 73elseif(${RADIO} STREQUAL sx126x) 74 list(APPEND ${PROJECT_NAME}_INCLUDES 75 ${CMAKE_CURRENT_SOURCE_DIR}/sx126x 76 ) 77elseif(${RADIO} STREQUAL sx1272) 78 list(APPEND ${PROJECT_NAME}_INCLUDES 79 ${CMAKE_CURRENT_SOURCE_DIR}/sx1272 80 ) 81elseif(${RADIO} STREQUAL sx1276) 82 list(APPEND ${PROJECT_NAME}_INCLUDES 83 ${CMAKE_CURRENT_SOURCE_DIR}/sx1276 84 ) 85else() 86 message(FATAL_ERROR "Unsupported radio driver selected...") 87endif() 88 89target_include_directories(${PROJECT_NAME} PUBLIC 90 ${CMAKE_CURRENT_SOURCE_DIR} 91 ${${PROJECT_NAME}_INCLUDES} 92 $<TARGET_PROPERTY:board,INTERFACE_INCLUDE_DIRECTORIES> 93 $<TARGET_PROPERTY:system,INTERFACE_INCLUDE_DIRECTORIES> 94) 95 96option(USE_RADIO_DEBUG "Enable Radio Debug GPIO's" OFF) 97target_compile_definitions(${PROJECT_NAME} PUBLIC $<$<BOOL:${USE_RADIO_DEBUG}>:USE_RADIO_DEBUG>) 98target_include_directories(${PROJECT_NAME} PUBLIC $<TARGET_PROPERTY:${BOARD},INTERFACE_INCLUDE_DIRECTORIES>) 99 100set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 11) 101