8000 Add variants_dir support to pio build, allowing local variants in pro… · BritvaBo/arduino-pico@15eb459 · GitHub
[go: up one dir, main page]

Skip to content

Commit 15eb459

Browse files
Add variants_dir support to pio build, allowing local variants in project repos (earlephilhower#1911)
1 parent 3160fde commit 15eb459

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tools/platformio-build.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,15 @@ def configure_network_flags(cpp_defines):
321321

322322
variant = board.get("build.arduino.earlephilhower.variant", board.get("build.variant", ""))
323323

324+
# The following 3 lines are adapted from espressif/arduino-esp32, also licensed under apache2
325+
variants_dir = os.path.join(FRAMEWORK_DIR, "variants")
326+
327+
if "build.variants_dir" in board:
328+
variants_dir = os.path.join("$PROJECT_DIR", board.get("build.variants_dir"))
329+
324330
if variant != "":
325331
env.Append(CPPPATH=[
326-
os.path.join(FRAMEWORK_DIR, "variants", variant)
332+
os.path.join(variants_dir, variant)
327333
])
328334

329335
env.Append(CPPDEFINES=[
@@ -335,7 +341,7 @@ def configure_network_flags(cpp_defines):
335341
# otherwise weak function overriding won't work in the linking stage.
336342
env.BuildSources(
337343
os.path.join("$BUILD_DIR", "FrameworkArduinoVariant"),
338-
os.path.join(FRAMEWORK_DIR, "variants", variant))
344+
os.path.join(variants_dir, variant))
339345

340346
libs.append(
341347
env.BuildLibrary(

0 commit comments

Comments
 (0)
0