Before Build: Add sources & Makefile imitation

Hi there,

is there a natural solution to the following:
I want to add source code to the project, which is located “away” from the project folder
I just don’t want to copy them to SRC folder every time
something like:

INI add_modules = 
    $FRAMEWORK_FIR/foo/all_files/
    folder/boo/one_file.c
    folder/Makefile.py //// execute script for building

I basically did it the hard way (and it works great) … looking for the easy way

https://docs.platformio.org/en/latest/projectconf/sections/env/options/library/lib_extra_dirs.html

Deprecated since version 6.0…

It’s working for now…

Do you mean Build external sources?

becomes
but maybe it needs to be improved, if it’s not… i’ll test it soon

extra_scripts = 
    pre:FOLDER/script.py
    pre:FOLDER/one_file.c
    pre:ONLY_FOLDER/ ... looking there default_script_name.py

I did something like that
custom_modules = list…

is there an “magic” PIO-API function that loads a python file that contains
Import(“env”)

( as external script “format” )
I want from a platform_builder_xxx.py file to load one
?ScriptLoad(“path/script/name.py”)

env.SConscript ( path, exports=“env” ) ?

1 Like

:slight_smile: :slight_smile: :slight_smile:

I’m too lazy to write a description right now ( later )
Generally works like Make / Makefile … for ALL ARM Microcontrollers

as example - RPI Pico … minimal build :slight_smile:
( above there is also an example of STM32 )

Hi Max,

where it disappeared ( env key ) PLATFORM_MANIFEST ?
env[‘PLATFORM_MANIFEST’]

Why do you need PLATFORM_MANIFEST? Please use env.PioPlatform(). This is an instance of Platform class where you can get a platform folder via env.PioPlatform().get_dir().

1 Like

Ivan, Thanks
env.PioPlatform().get_dir()
this is exactly what i need
i was getting platform folder from PLATFORM_MANIFEST
but the variable disappeared from Windows 7

and in Windows 10 it is there