@@ -1246,7 +1246,6 @@ def _get_installed_pip_packages():
1246
1246
project_flags = get_app_flags (project_config , default_config )
1247
1247
link_args = extract_link_args (elf_config )
1248
1248
app_includes = get_app_includes (elf_config )
1249
- project_lib_includes = get_project_lib_includes (env )
1250
1249
1251
1250
#
1252
1251
# Compile bootloader
@@ -1301,32 +1300,6 @@ def _skip_prj_source_files(node):
1301
1300
1302
1301
env .AddBuildMiddleware (_skip_prj_source_files )
1303
1302
1304
- # Project files should be compiled only when a special
1305
- # option is enabled when running 'test' command
1306
- if "__test" not in COMMAND_LINE_TARGETS or env .GetProjectOption (
1307
- "test_build_project_src"
1308
- ):
1309
- project_env = env .Clone ()
1310
- if project_target_name != "__idf_main" :
1311
- # Manually add dependencies to CPPPATH since ESP-IDF build system doesn't generate
1312
- # this info if the folder with sources is not named 'main'
1313
- # https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/build-system.html#rename-main
1314
- project_env .AppendUnique (CPPPATH = app_includes ["plain_includes" ])
1315
-
1316
- # Add include dirs from PlatformIO build system to project CPPPATH so
1317
- # they're visible to PIOBUILDFILES
1318
- project_env .Append (
1319
- CPPPATH = ["$PROJECT_INCLUDE_DIR" , "$PROJECT_SRC_DIR" ] + project_lib_includes
1320
- )
1321
-
1322
- env .Append (
1323
- PIOBUILDFILES = compile_source_files (
1324
- target_configs .get (project_target_name ),
1325
- project_env ,
1326
- project_env .subst ("$PROJECT_DIR" ),
1327
- )
1328
- )
1329
-
1330
1303
#
1331
1304
# Generate partition table
1332
1305
#
@@ -1387,6 +1360,52 @@ def _skip_prj_source_files(node):
1387
1360
],
1388
1361
)
1389
1362
1363
+ #
1364
+ # Propagate Arduino defines to the main build environment
1365
+ #
1366
+
1367
+ if "arduino" in env .subst ("$PIOFRAMEWORK" ):
1368
+ arduino_config_name = list (
1369
+ filter (
1370
+ lambda config_name : config_name .startswith (
1371
+ "__idf_framework-arduinoespressif32"
1372
+ ),
1373
+ target_configs ,
1374
+ )
1375
+ )[0 ]
1376
+ env .AppendUnique (
1377
+ CPPDEFINES = extract_defines (
1378
+ target_configs .get (arduino_config_name , {}).get ("compileGroups" , [])[0 ]
1379
+ )
1380
+ )
1381
+
1382
+ # Project files should be compiled only when a special
1383
+ # option is enabled when running 'test' command
1384
+ if "__test" not in COMMAND_LINE_TARGETS or env .GetProjectOption (
1385
+ "test_build_project_src"
1386
+ ):
1387
+ project_env = env .Clone ()
1388
+ if project_target_name != "__idf_main" :
1389
+ # Manually add dependencies to CPPPATH since ESP-IDF build system doesn't generate
1390
+ # this info if the folder with sources is not named 'main'
1391
+ # https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/build-system.html#rename-main
1392
+ project_env .AppendUnique (CPPPATH = app_includes ["plain_includes" ])
1393
+
1394
+ # Add include dirs from PlatformIO build system to project CPPPATH so
1395
+ # they're visible to PIOBUILDFILES
1396
+ project_env .AppendUnique (
1397
+ CPPPATH = ["$PROJECT_INCLUDE_DIR" , "$PROJECT_SRC_DIR" ]
1398
+ + get_project_lib_includes (env )
1399
+ )
1400
+
1401
+ env .Append (
1402
+ PIOBUILDFILES = compile_source_files (
1403
+ target_configs .get (project_target_name ),
1404
+ project_env ,
1405
+ project_env .subst ("$PROJECT_DIR" ),
1406
+ )
1407
+ )
1408
+
1390
1409
#
1391
1410
# Generate mbedtls bundle
1392
1411
#
0 commit comments