Skip to content

Commit 5bbd643

Browse files
committed
Use file GLOB to include aetcc608a-tnglora-se cryptoauthlib
1 parent d1f801a commit 5bbd643

File tree

1 file changed

+87
-26
lines changed

1 file changed

+87
-26
lines changed

as-lib/peripheral/CMakeLists.txt

Lines changed: 87 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,17 @@ if (NOT TARGET ${PROJECT_NAME})
1414
add_library(${PROJECT_NAME} STATIC)
1515

1616
if (LORAMAC_SECURE_ELEMENT MATCHES SOFT_SE)
17-
target_sources(
18-
${PROJECT_NAME}
19-
PUBLIC
17+
list(
18+
APPEND
19+
${PROJECT_NAME}_HEADERS
2020
${LORAMAC_SOURCE_DIR}/peripherals/soft-se/aes.h
2121
${LORAMAC_SOURCE_DIR}/peripherals/soft-se/cmac.h
2222
${LORAMAC_SOURCE_DIR}/peripherals/soft-se/se-identity.h
2323
${LORAMAC_SOURCE_DIR}/peripherals/soft-se/soft-se-hal.h
24-
25-
PRIVATE
24+
)
25+
list(
26+
APPEND
27+
${PROJECT_NAME}_SOURCES
2628
${LORAMAC_SOURCE_DIR}/peripherals/soft-se/aes.c
2729
${LORAMAC_SOURCE_DIR}/peripherals/soft-se/cmac.c
2830
${LORAMAC_SOURCE_DIR}/peripherals/soft-se/soft-se.c
@@ -34,48 +36,107 @@ if (NOT TARGET ${PROJECT_NAME})
3436
SOFT_SE
3537
$<$<BOOL:${LORAMAC_SOFT_SE_AES_DEC_PREKEYED}>:AES_DEC_PREKEYED>
3638
)
39+
target_include_directories(
40+
${PROJECT_NAME}
41+
PUBLIC
42+
${LORAMAC_SOURCE_DIR}/peripherals/soft-se
43+
${LORAMAC_SOURCE_DIR}/mac
44+
)
3745
elseif(LORAMAC_SECURE_ELEMENT MATCHES LR1110_SE)
3846
if (LORAMAC_RADIO MATCHES lr1110)
39-
target_sources(
40-
${PROJECT_NAME}
41-
PUBLIC
47+
list(
48+
APPEND
49+
${PROJECT_NAME}_HEADERS
4250
${LORAMAC_SOURCE_DIR}/peripherals/lr1110-se/lr1110-se-hal.h
4351
${LORAMAC_SOURCE_DIR}/peripherals/lr1110-se/se-identity.h
44-
45-
PRIVATE
52+
)
53+
list(
54+
APPEND
55+
${PROJECT_NAME}_SOURCES
4656
${LORAMAC_SOURCE_DIR}/peripherals/lr1110-se/lr1110-se.c
4757
${LORAMAC_SOURCE_DIR}/peripherals/lr1110-se/lr1110-se-hal.c
4858
)
59+
target_include_directories(
60+
${PROJECT_NAME} PUBLIC
61+
${LORAMAC_SOURCE_DIR}/peripherals/lr1110-se
62+
)
4963
else()
5064
message(FATAL_ERROR "LR1110_SE secure element can only be used when LR1110 radio is selected.")
5165
endif()
5266
elseif(LORAMAC_SECURE_ELEMENT MATCHES ATECC608A_TNGLORA_SE)
53-
target_sources(
54-
${PROJECT_NAME}
55-
PUBLIC
56-
${LORAMAC_SOURCE_DIR}/peripherals/atecc608a-tnglora-se/atca_config.h
57-
${LORAMAC_SOURCE_DIR}/peripherals/atecc608a-tnglora-se/atecc608a-tnglora-se-hal.h
58-
${LORAMAC_SOURCE_DIR}/peripherals/atecc608a-tnglora-se/se-identity.h
59-
60-
PRIVATE
61-
${LORAMAC_SOURCE_DIR}/peripherals/atecc608a-tnglora-se/atecc608a-tnglora-se.c
62-
${LORAMAC_SOURCE_DIR}/peripherals/atecc608a-tnglora-se/atecc608a-tnglora-se-hal.c
67+
file(
68+
GLOB
69+
${PROJECT_NAME}_HEADERS
70+
${LORAMAC_SOURCE_DIR}/peripherals/atecc608a-tnglora-se/*.h
71+
${LORAMAC_SOURCE_DIR}/peripherals/atecc608a-tnglora-se/cryptoauthlib/lib/*.h
72+
${LORAMAC_SOURCE_DIR}/peripherals/atecc608a-tnglora-se/cryptoauthlib/lib/basic/*.h
73+
${LORAMAC_SOURCE_DIR}/peripherals/atecc608a-tnglora-se/cryptoauthlib/lib/crypto/*.h
74+
${LORAMAC_SOURCE_DIR}/peripherals/atecc608a-tnglora-se/cryptoauthlib/lib/crypto/hashes/*.h
75+
${LORAMAC_SOURCE_DIR}/peripherals/atecc608a-tnglora-se/cryptoauthlib/lib/hal/atca_hal.h
76+
${LORAMAC_SOURCE_DIR}/peripherals/atecc608a-tnglora-se/cryptoauthlib/lib/host/*.h
77+
)
78+
file(
79+
GLOB
80+
${PROJECT_NAME}_SOURCES
81+
${LORAMAC_SOURCE_DIR}/peripherals/atecc608a-tnglora-se/*.c
82+
${LORAMAC_SOURCE_DIR}/peripherals/atecc608a-tnglora-se/cryptoauthlib/lib/*.c
83+
${LORAMAC_SOURCE_DIR}/peripherals/atecc608a-tnglora-se/cryptoauthlib/lib/basic/*.c
84+
${LORAMAC_SOURCE_DIR}/peripherals/atecc608a-tnglora-se/cryptoauthlib/lib/crypto/*.c
85+
${LORAMAC_SOURCE_DIR}/peripherals/atecc608a-tnglora-se/cryptoauthlib/lib/crypto/hashes/*.c
86+
${LORAMAC_SOURCE_DIR}/peripherals/atecc608a-tnglora-se/cryptoauthlib/lib/hal/atca_hal.c
87+
${LORAMAC_SOURCE_DIR}/peripherals/atecc608a-tnglora-se/cryptoauthlib/lib/host/*.c
88+
)
89+
target_include_directories(
90+
${PROJECT_NAME} PUBLIC
91+
${LORAMAC_SOURCE_DIR}/peripherals/atecc608a-tnglora-se
92+
${LORAMAC_SOURCE_DIR}/peripherals/atecc608a-tnglora-se/cryptoauthlib/lib
93+
${LORAMAC_SOURCE_DIR}/peripherals/atecc608a-tnglora-se/cryptoauthlib/lib/basic
94+
${LORAMAC_SOURCE_DIR}/peripherals/atecc608a-tnglora-se/cryptoauthlib/lib/crypto
95+
${LORAMAC_SOURCE_DIR}/peripherals/atecc608a-tnglora-se/cryptoauthlib/lib/crypto/hashes
96+
${LORAMAC_SOURCE_DIR}/peripherals/atecc608a-tnglora-se/cryptoauthlib/lib/hal
97+
${LORAMAC_SOURCE_DIR}/peripherals/atecc608a-tnglora-se/cryptoauthlib/lib/host
6398
)
6499
else()
65100
message(FATAL_ERROR "LORAMAC_SECURE_ELEMENT not defined")
66101
endif()
67102

68-
target_compile_definitions(
103+
list(
104+
APPEND
105+
${PROJECT_NAME}_HEADERS
106+
${LORAMAC_SOURCE_DIR}/peripherals/gpio-ioe.h
107+
${LORAMAC_SOURCE_DIR}/peripherals/mag3110.h
108+
${LORAMAC_SOURCE_DIR}/peripherals/mma8451.h
109+
${LORAMAC_SOURCE_DIR}/peripherals/mpl3115.h
110+
${LORAMAC_SOURCE_DIR}/peripherals/pam7q.h
111+
${LORAMAC_SOURCE_DIR}/peripherals/sx1509.h
112+
${LORAMAC_SOURCE_DIR}/peripherals/sx9500.h
113+
)
114+
115+
list(
116+
APPEND
117+
${PROJECT_NAME}_SOURCES
118+
${LORAMAC_SOURCE_DIR}/peripherals/gpio-ioe.c
119+
${LORAMAC_SOURCE_DIR}/peripherals/mag3110.c
120+
${LORAMAC_SOURCE_DIR}/peripherals/mma8451.c
121+
${LORAMAC_SOURCE_DIR}/peripherals/mpl3115.c
122+
${LORAMAC_SOURCE_DIR}/peripherals/pam7q.c
123+
${LORAMAC_SOURCE_DIR}/peripherals/sx1509.c
124+
${LORAMAC_SOURCE_DIR}/peripherals/sx9500.c
125+
)
126+
127+
target_sources(
69128
${PROJECT_NAME}
129+
PUBLIC
130+
${${PROJECT_NAME}_HEADERS}
131+
70132
PRIVATE
71-
$<$<BOOL:${LORAMAC_SECURE_ELEMENT_PRE_PROVISIONED}>:SECURE_ELEMENT_PRE_PROVISIONED>
133+
${${PROJECT_NAME}_SOURCES}
72134
)
73135

74-
target_include_directories(
136+
target_compile_definitions(
75137
${PROJECT_NAME}
76-
PUBLIC
77-
${LORAMAC_SOURCE_DIR}/peripherals/soft-se
78-
${LORAMAC_SOURCE_DIR}/mac
138+
PRIVATE
139+
$<$<BOOL:${LORAMAC_SECURE_ELEMENT_PRE_PROVISIONED}>:SECURE_ELEMENT_PRE_PROVISIONED>
79140
)
80141

81142
target_link_libraries(

0 commit comments

Comments
 (0)