@@ -20,6 +20,8 @@ elseif("RASPBERRY_PI_PICO" IN_LIST MBED_TARGET_LABELS)
20
20
set (ARDUINO_VARIANT_NAME "RASPBERRY_PI_PICO" )
21
21
elseif ("ARDUINO_NICLA_SENSE_ME" IN_LIST MBED_TARGET_LABELS)
22
22
set (ARDUINO_VARIANT_NAME "ARDUINO_NICLA_SENSE_ME" )
23
+ elseif ("ARDUINO_GIGA" IN_LIST MBED_TARGET_LABELS)
24
+ set (ARDUINO_VARIANT_NAME "ARDUINO_GIGA" )
23
25
else ()
24
26
message (FATAL_ERROR "This MBED_TARGET is currently not supported by the arduino core!" )
25
27
endif ()
@@ -80,8 +82,8 @@ endif()
80
82
81
83
if ("FEATURE_BLE=1" IN_LIST MBED_TARGET_DEFINITIONS)
82
84
83
- # Note: There are circular dependencies between the BLE libraries, so we have to list some of them twice .
84
- list ( APPEND MBED_LIBS_TO_INSTALL
85
+ # Note: There are circular dependencies between the BLE libraries, so we have to list some of them multiple times .
86
+ set (BLE_LIBRARIES
85
87
mbed-ble
86
88
mbed-ble-cordio_ll
87
89
mbed-ble-cordio
@@ -91,6 +93,20 @@ if("FEATURE_BLE=1" IN_LIST MBED_TARGET_DEFINITIONS)
91
93
mbed-ble
92
94
mbed-ble-cordio_ll
93
95
mbed-ble-cordio)
96
+
97
+ # filter out any Cordio libraries that don't exist for the current target
98
+ foreach (LIBRARY ${BLE_LIBRARIES} )
99
+ if (NOT TARGET ${LIBRARY} )
100
+ list (REMOVE_ITEM BLE_LIBRARIES ${LIBRARY} )
101
+ endif ()
102
+ endforeach ()
103
+
104
+ list (APPEND MBED_LIBS_TO_INSTALL ${BLE_LIBRARIES} )
105
+ endif ()
106
+
107
+ if ("COMPONENT_QSPIF=1" IN_LIST MBED_TARGET_DEFINITIONS)
108
+ list (APPEND MBED_LIBS_TO_INSTALL
109
+ mbed-storage-qspif)
94
110
endif ()
95
111
96
112
# We also need to know about any precompiled .a files
@@ -115,122 +131,7 @@ install(TARGETS ${MBED_UNIQUE_LIBS_TO_INSTALL} DESTINATION "variants/${ARDUINO_V
115
131
116
132
# Generate compile option files for Arduino IDE
117
133
# ---------------------------------------------------------
118
-
119
- # Iterate though the Mbed main build target and the optional targets and collect include dirs / defines / etc.
120
- set (TARGETS_TO_SCAN mbed-os ${MBED_UNIQUE_LIBS_TO_INSTALL} )
121
- set (SCANNED_INCLUDE_DIRS "" )
122
- set (SCANNED_DEFINES "" )
123
- foreach (TARGET ${TARGETS_TO_SCAN} )
124
- get_property (TARGET_INCLUDE_DIRS TARGET ${TARGET} PROPERTY INTERFACE_INCLUDE_DIRECTORIES )
125
- get_property (TARGET_COMPILE_DEFINITIONS TARGET ${TARGET} PROPERTY INTERFACE_COMPILE_DEFINITIONS )
126
-
127
- # For include dirs, if the include dir points to generated-headers, that's in the bin dir so we will handle it separately.
128
- foreach (INCLUDE_DIR ${TARGET_INCLUDE_DIRS} )
129
- if (NOT "${INCLUDE_DIR} " MATCHES "generated-headers" )
130
- list (APPEND SCANNED_INCLUDE_DIRS ${INCLUDE_DIR} )
131
- endif ()
132
- endforeach ()
133
-
134
- # Defines can just be passed through
135
- list (APPEND SCANNED_DEFINES ${TARGET_COMPILE_DEFINITIONS} )
136
- endforeach ()
137
-
138
- # Generate defines file.
139
- # TODO do we need to escape defines with spaces?
140
- set (DEFINES_TXT_CONTENTS "" )
141
- foreach (DEFINE ${SCANNED_DEFINES} )
142
- string (APPEND DEFINES_TXT_CONTENTS "-D${DEFINE} \n " )
143
- endforeach ()
144
- file (GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR} /defines.txt CONTENT ${DEFINES_TXT_CONTENTS} )
145
- install (FILES ${CMAKE_CURRENT_BINARY_DIR} /defines.txt DESTINATION "variants/${ARDUINO_VARIANT_NAME} " )
146
-
147
- # Generate includes file.
148
- set (INCLUDES_TXT_CONTENTS "" )
149
- foreach (INCLUDE_DIR ${SCANNED_INCLUDE_DIRS} )
150
-
151
- # Make each include path relative to the current source dir
152
- # (so it starts with the first path component after mbed-os/)
153
- cmake_path(RELATIVE_PATH INCLUDE_DIR BASE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} /mbed-os OUTPUT_VARIABLE REL_INCLUDE_DIR)
154
-
155
- string (APPEND INCLUDES_TXT_CONTENTS "-iwithprefixbefore/mbed/${REL_INCLUDE_DIR} \n " )
156
- endforeach ()
157
- file (GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR} /includes.txt CONTENT ${INCLUDES_TXT_CONTENTS} )
158
- install (FILES ${CMAKE_CURRENT_BINARY_DIR} /includes.txt DESTINATION "variants/${ARDUINO_VARIANT_NAME} " )
159
-
160
- # Generate compile options files.
161
- foreach (LANG C CXX)
162
-
163
- # The profile-specific compile options are set as a property on the mbed-core-flags
164
- # target so they get applied everywhere.
165
- # (see e.g. profiles/develop.cmake)
166
- get_property (MBED_${LANG} _PROFILE_COMPILE_FLAGS TARGET mbed-core-flags PROPERTY INTERFACE_COMPILE_OPTIONS)
167
-
168
- # Slightly janky, but we need to simulate expanding the generator expressions in this property.
169
- # Use a regex to replace the generator expressions for the language we want, and then
170
- # use another regex to get rid of the genexes for the other languages.
171
- string (REGEX REPLACE
172
- "\\ $<\\ $<COMPILE_LANGUAGE:${LANG} >:([^>]+)>" "\\ 1"
173
- MBED_${LANG} _PROFILE_COMPILE_FLAGS "${MBED_${LANG} _PROFILE_COMPILE_FLAGS}" )
174
- string (GENEX_STRIP "${MBED_${LANG} _PROFILE_COMPILE_FLAGS}" MBED_${LANG} _PROFILE_COMPILE_FLAGS)
175
-
176
- # For the profile flags, we want to strip out the "-include;xxx/mbed-target-config.h" flag
177
- # as it contains a path specific to the build machine and isn't needed by Arduino anyway.
178
- # So, remove "-include" and the option after it.
179
- string (REGEX REPLACE
180
- "-include;[^;]+" ""
181
- MBED_${LANG} _PROFILE_COMPILE_FLAGS "${MBED_${LANG} _PROFILE_COMPILE_FLAGS}" )
182
-
183
- # for the toolchain flags (processor target, warnings, etc) those get put in CMAKE_<LANG>_FLAGS
184
- # by the app.cmake toolchain file.
185
- separate_arguments (CMAKE_${LANG} _FLAGS_LIST NATIVE_COMMAND ${CMAKE_${LANG} _FLAGS})
186
-
187
- # Annoyingly, the "--std" argument won't be in these lists because it's added by CMake.
188
- # We'll have to do that ourselves.
189
- if (${LANG} STREQUAL "C" )
190
- set (C_STD_ARGUMENT --std=gnu${CMAKE_C_STANDARD} )
191
- else () # CXX
192
- set (CXX_STD_ARGUMENT --std=gnu++${CMAKE_CXX_STANDARD} )
193
- endif ()
194
-
195
- set (MBED_${LANG} _COMPILE_FLAGS
196
- ${MBED_${LANG} _PROFILE_COMPILE_FLAGS}
197
- ${CMAKE_${LANG} _FLAGS_LIST}
198
- ${${LANG} _STD_ARGUMENT})
199
-
200
- # Write list to a file, with one element on each line
201
- list (JOIN MBED_${LANG} _COMPILE_FLAGS "\n " ${LANG} _FLAG_FILE_CONTENTS)
202
- string (TOLOWER "${LANG} flags.txt" ${LANG} _FLAG_FILE_NAME)
203
- file (GENERATE
204
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR} /${${LANG} _FLAG_FILE_NAME}
205
- CONTENT "${${LANG} _FLAG_FILE_CONTENTS}" )
206
- install (FILES
207
- ${CMAKE_CURRENT_BINARY_DIR} /${${LANG} _FLAG_FILE_NAME}
208
- DESTINATION variants/${ARDUINO_VARIANT_NAME} )
209
- endforeach ()
210
-
211
- # Generate linker options file
212
-
213
- # The profile-specific linker options are set as a property on the mbed-core-flags
214
- # target so they get applied everywhere.
215
- # (see e.g. profiles/develop.cmake)
216
- get_property (MBED_PROFILE_LINKER_FLAGS TARGET mbed-core-flags PROPERTY INTERFACE_LINK_OPTIONS)
217
-
218
- # for the toolchain flags (processor target, warnings, etc) those get put in CMAKE_<LANG>_FLAGS
219
- # by the app.cmake toolchain file.
220
- separate_arguments (CMAKE_EXE_LINKER_FLAGS_LIST NATIVE_COMMAND ${CMAKE_EXE_LINKER_FLAGS} )
221
-
222
- set (MBED_LINKER_FLAGS
223
- ${MBED_PROFILE_LINKER_FLAGS}
224
- ${CMAKE_EXE_LINKER_FLAGS_LIST} )
225
-
226
- # Write list to a file, with one element on each line
227
- list (JOIN MBED_LINKER_FLAGS "\n " LD_FLAG_FILE_CONTENTS)
228
- file (GENERATE
229
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR} /ldflags.txt
230
- CONTENT "${LD_FLAG_FILE_CONTENTS} " )
231
- install (FILES
232
- ${CMAKE_CURRENT_BINARY_DIR} /ldflags.txt
233
- DESTINATION variants/${ARDUINO_VARIANT_NAME} )
134
+ include (GenerateArduinoIDEFlagTxtFiles.cmake)
234
135
235
136
# Copy sources and headers into the install dir as needed
236
137
# ---------------------------------------------------------
0 commit comments