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(peripherals) 19cmake_minimum_required(VERSION 3.6) 20 21#--------------------------------------------------------------------------------------- 22# Target 23#--------------------------------------------------------------------------------------- 24 25if(${SECURE_ELEMENT} MATCHES SOFT_SE) 26 file(GLOB ${PROJECT_NAME}_SOURCES "*.c" "soft-se/*.c") 27else() 28 if(${SECURE_ELEMENT} MATCHES LR1110_SE) 29 if (${RADIO} MATCHES lr1110) 30 file(GLOB ${PROJECT_NAME}_SOURCES "*.c" "lr1110-se/*.c") 31 else() 32 message(FATAL_ERROR "LR1110_SE secure elemeent can only be used when LR1110 radio is selected.") 33 endif() 34 elseif((${SECURE_ELEMENT} MATCHES ATECC608A_TNGLORA_SE)) 35 file(GLOB ${PROJECT_NAME}_SOURCES "*.c" 36 "atecc608a-tnglora-se/*.c" 37 "atecc608a-tnglora-se/cryptoauthlib/lib/*.c" 38 "atecc608a-tnglora-se/cryptoauthlib/lib/basic/*.c" 39 "atecc608a-tnglora-se/cryptoauthlib/lib/crypto/*.c" 40 "atecc608a-tnglora-se/cryptoauthlib/lib/crypto/hashes/*.c" 41 "atecc608a-tnglora-se/cryptoauthlib/lib/hal/atca_hal.c" 42 "atecc608a-tnglora-se/cryptoauthlib/lib/host/*.c" 43 ) 44 else() 45 message(FATAL_ERROR "No secure-element selected.") 46 endif() 47endif() 48 49add_library(${PROJECT_NAME} OBJECT EXCLUDE_FROM_ALL ${${PROJECT_NAME}_SOURCES}) 50 51if(${SECURE_ELEMENT_PRE_PROVISIONED} MATCHES ON) 52 target_compile_definitions(${PROJECT_NAME} PRIVATE -DSECURE_ELEMENT_PRE_PROVISIONED) 53endif() 54 55if(${SECURE_ELEMENT} MATCHES SOFT_SE) 56 target_include_directories( ${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/soft-se) 57 target_compile_definitions(${PROJECT_NAME} PRIVATE -DSOFT_SE) 58else() 59 if(${SECURE_ELEMENT} MATCHES LR1110_SE) 60 if(${RADIO} MATCHES lr1110) 61 target_include_directories( ${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/lr1110-se) 62 endif() 63 elseif((${SECURE_ELEMENT} MATCHES ATECC608A_TNGLORA_SE)) 64 target_include_directories( ${PROJECT_NAME} PUBLIC 65 ${CMAKE_CURRENT_SOURCE_DIR}/atecc608a-tnglora-se 66 ${CMAKE_CURRENT_SOURCE_DIR}/atecc608a-tnglora-se/cryptoauthlib/lib 67 ${CMAKE_CURRENT_SOURCE_DIR}/atecc608a-tnglora-se/cryptoauthlib/lib/basic 68 ${CMAKE_CURRENT_SOURCE_DIR}/atecc608a-tnglora-se/cryptoauthlib/lib/crypto 69 ${CMAKE_CURRENT_SOURCE_DIR}/atecc608a-tnglora-se/cryptoauthlib/lib/crypto/hashes 70 ${CMAKE_CURRENT_SOURCE_DIR}/atecc608a-tnglora-se/cryptoauthlib/lib/hal 71 ${CMAKE_CURRENT_SOURCE_DIR}/atecc608a-tnglora-se/cryptoauthlib/lib/host 72 ) 73 endif() 74endif() 75 76target_include_directories( ${PROJECT_NAME} PUBLIC 77 ${CMAKE_CURRENT_SOURCE_DIR} 78 $<TARGET_PROPERTY:board,INTERFACE_INCLUDE_DIRECTORIES> 79 $<TARGET_PROPERTY:system,INTERFACE_INCLUDE_DIRECTORIES> 80 $<TARGET_PROPERTY:mac,INTERFACE_INCLUDE_DIRECTORIES> 81 $<TARGET_PROPERTY:radio,INTERFACE_INCLUDE_DIRECTORIES> 82) 83 84set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 11) 85