platformio / platformio-docs

PlatformIO Documentation
https://docs.platformio.org
Apache License 2.0
240 stars 325 forks source link

Add example with env.BuildSources() #209

Closed maxgerhardt closed 3 years ago

maxgerhardt commented 3 years ago

Looking at this I was quite suprised that you could do that.

With code like

build_path = env.subst("$BUILD_DIR")
generated_src_dir = os.path.join(build_path, 'mylib', 'generated')
generated_build_dir = os.path.join(build_path, 'mylib', 'generated', 'build')
env.Append(CPPPATH=[generated_src_dir])
env.BuildSources(generated_build_dir, generated_src_dir)

an script can add arbitrary sources to the build system. As far as I see, this is not documented in https://docs.platformio.org/en/latest/projectconf/advanced_scripting.html yet, but might be interesting for some people.