Src_dir doesnt work inside a specified environment

Is this intended? If so would be a nice thing to add in case i want to compile multiple different codes inside one single project.
Also heres my platformio.ini

default_envs = esp32dev_tx

monitor_speed = 115200
lib_deps =
  tmrh20/RF24 ;hasnt been updated to nRF24/RF24

platform = espressif32
board = esp32dev
framework = arduino
src_dir = src_tx

platform = espressif32
board = esp32dev
framework = arduino
src_dir = src_rx

src_dir is a global setting for the [platformio] section and does not work per-environment.

Already possible using src_filter. Just -<src_rx/> and -<src_tx/> it in the first and second env respectively.

Allowing the src_dir parameter in the env sections does more sense then the src_filter option, to me. I have been try to figure out this issue for days now, until i saw that it was ignored earlier today.

Just tried your solution but now the main.cpp is not found because the root src folder is empty, i think.

LDF: Library Dependency Finder ->
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 34 compatible libraries
Scanning dependencies...
No dependencies
Error: Nothing to build. Please put your source code files to 'C:\Users\HP\Documents\PlatformIO\Projects\nowTalk\src' folder
============================= [FAILED] Took 1.28 seconds =============================

Environment    Status    Duration
-------------  --------  ------------
Bridge         FAILED    00:00:01.279
======================== 1 failed, 0 succeeded in 00:00:01.279 ========================The terminal process "C:\Users\HP\.platformio\penv\Scripts\platformio.exe 'run', '--environment', 'Bridge'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

Feature-request can be made in Issues Β· platformio/platformio-core Β· GitHub.

Not reproducable.

If I adapt your code from Src_dir is not being read - #3 by nielsnl68, follow the documentation regarding the standard value and do it like

description = NowTalk

platform = espressif32
board = esp32dev
framework = arduino
upload_port = COM11
src_filter = +<*> -<bridge>

board = esp32cam
platform = espressif32
framework = arduino
upload_port = COM8
src_filter = +<*> -<commBadge>

it works. In the CommBadge environment I get

Processing CommBadge (platform: espressif32; board: esp32dev; framework: arduino)
Compiling .pio/build/CommBadge/src/commBadge/main.cpp.o

and in the bridge environment I get

Processing Bridge (board: esp32cam; platform: espressif32; framework: arduino)
Compiling .pio/build/Bridge/src/bridge/main.cpp.o

That is with the folder structure

β”œβ”€β”€ src
β”‚   β”œβ”€β”€ bridge
β”‚   β”‚   └── main.cpp
β”‚   └── commBadge
β”‚       └── main.cpp
1 Like

ok. i will test that, AND YES this is how it works. Thanks for the examples. Just wondering would this work as well -<*> +.
going to test that, now i have just 2 sub projects maybe later i want to add more sub projects.

I will however doe the request as well.

Yes that works as well

src_filter= -<*> +<your_sub_project>