Interesting pull request to add build options
- RogerClark
- Posts: 8416
- Joined: Mon Apr 27, 2015 10:36 am
- Location: Melbourne, Australia
- Contact:
Re: Interesting pull request to add build options
Frederic
Thanks
I have a Mac, so I will try to test it later
Thanks
I have a Mac, so I will try to test it later
Re: Interesting pull request to add build options
So, no it's not possible as the library file are copied in {build.path}/libraries/fpiSTM wrote: ↑Tue Dec 12, 2017 5:17 am
I will check that Roger.RogerClark wrote: ↑Mon Dec 11, 2017 7:43 pmDo you know if libraries can supply this file or whether it’s only the main sketch ? ( because I know the IDE does strange things like copying various files to a temp directory to compile them, I wonder if this file put inside a library could end up in the temp build directory
It should be possible by adding the same mechanism with the recipe.hooks.libraries.prebuild.NUMBER.pattern (called before libraries compilation)
But I think it will add too much issue (different file name, what about having several libraries....).
Currently, I advise to use only one build options file at sketch level to avoid any confusion.
- RogerClark
- Posts: 8416
- Joined: Mon Apr 27, 2015 10:36 am
- Location: Melbourne, Australia
- Contact:
Re: Interesting pull request to add build options
Frederic
I agree. It is not worth the effort etc to have this for libraries at the moment
I agree. It is not worth the effort etc to have this for libraries at the moment
Re: Interesting pull request to add build options
I've made some test and succeed to enable some options for libs.
One example using the STM32Ethernet and LwIP libraries:
Adding in build_opt.h:
Allow to enable some debug without need to edit core or libraries files. Only at sketch level.
But there is a limitation. Even if the "Aggressively cache compiled core" is disabled.
When project has been built one time, changing build option in the file will not be taken into account as build see no change on source file (Using previously compiled file)
Only way to take it into account is to reopen IDE or clean the tmp build dir.

One example using the STM32Ethernet and LwIP libraries:
Adding in build_opt.h:
Code: Select all
-DLWIP_DEBUG=1 -DLWIP_DBG_TYPES_ON=LWIP_DBG_ON -DIP_DEBUG=LWIP_DBG_ON "-DAPI_LIB_DEBUG LWIP_DBG_ON"
But there is a limitation. Even if the "Aggressively cache compiled core" is disabled.
When project has been built one time, changing build option in the file will not be taken into account as build see no change on source file (Using previously compiled file)
Only way to take it into account is to reopen IDE or clean the tmp build dir.




- RogerClark
- Posts: 8416
- Joined: Mon Apr 27, 2015 10:36 am
- Location: Melbourne, Australia
- Contact:
Re: Interesting pull request to add build options
OK
Normally I find I can edit the source in a library, using an external editor (Notepad++) and I don't need to reopen the IDE etc
The only time I need to close and open the IDE is when I make changes to platform.txt or boards.txt
Normally I find I can edit the source in a library, using an external editor (Notepad++) and I don't need to reopen the IDE etc
The only time I need to close and open the IDE is when I make changes to platform.txt or boards.txt
Re: Interesting pull request to add build options
Yes when you edit the source it is rebuilt but in this case it is not part of the source that's why it is not rebuilt as it do not see any change.
with Arduino 1.8.x, change in the platform.txt do not require restart of the IDE. only the boards.txt requires a restart or at least open the boards manager.
with Arduino 1.8.x, change in the platform.txt do not require restart of the IDE. only the boards.txt requires a restart or at least open the boards manager.
- RogerClark
- Posts: 8416
- Joined: Mon Apr 27, 2015 10:36 am
- Location: Melbourne, Australia
- Contact:
Re: Interesting pull request to add build options
Frederic
I didn't realise Arduino 1.8.x didnt need to restart for changes to platform.txt, that's useful to know.
I didn't realise Arduino 1.8.x didnt need to restart for changes to platform.txt, that's useful to know.
- mrburnette
- Posts: 3001
- Joined: Mon Apr 27, 2015 12:50 pm
- Location: Greater Atlanta
- Contact:
Re: Interesting pull request to add build options
Oh my, my, my ...
I really have mixed emotions about this implementation; In My Experience, work-arounds are rarely completely thought-out. Which is to say that they become fragile since the implementation is often implemented without a full team vote.
In any event, the need for programmer override of the runline has been needed for a long time. There is only one correct place to put such a feature and that is in the JAVA IDE ... be it a menu driven option or be it in a "fixed" tab. Personally, when the IDE loads a boards file, that file and any other pertinent files should be parsed and loaded into the IDE for observation/modification in building a NEW project and then written out into the project folder to be re-read and used in the future. Arduino makes it crazy difficult to 'snap' a project for delivering to a larger audience. In this regard, it needs to work like the Cypress IDE where a new project copies into the project all named libraries and configurable options such that a project can be easily backed-up.
Ray
I really have mixed emotions about this implementation; In My Experience, work-arounds are rarely completely thought-out. Which is to say that they become fragile since the implementation is often implemented without a full team vote.
In any event, the need for programmer override of the runline has been needed for a long time. There is only one correct place to put such a feature and that is in the JAVA IDE ... be it a menu driven option or be it in a "fixed" tab. Personally, when the IDE loads a boards file, that file and any other pertinent files should be parsed and loaded into the IDE for observation/modification in building a NEW project and then written out into the project folder to be re-read and used in the future. Arduino makes it crazy difficult to 'snap' a project for delivering to a larger audience. In this regard, it needs to work like the Cypress IDE where a new project copies into the project all named libraries and configurable options such that a project can be easily backed-up.
Ray
- Rick Kimball
- Posts: 1400
- Joined: Tue Apr 28, 2015 1:26 am
- Location: Eastern NC, US
- Contact:
Re: Interesting pull request to add build options
Even though I proposed this, I'm only half excited about it. I really wasn't advocating for its immediate implementation. I agree with mrburnette that it would be better implemented in the Arduino IDE. Sadly, it seems change happens on the IDE at a glacial pace with little regard for things that benefit Non-Arduino boards.
I think Fred has done a nice job implementing it. Maybe his stm32 core can be a guinea pig and we can see what issues appear. For the libmaple core, I think we should take a wait and see approach.
I think Fred has done a nice job implementing it. Maybe his stm32 core can be a guinea pig and we can see what issues appear. For the libmaple core, I think we should take a wait and see approach.
-rick
Re: Interesting pull request to add build options
Yes you're right. It definitely have to be in the IDE.
Anyway, instead of adding several custom menus or modifying boards.txt, I think hooks feature could help to make those customization easier for the end user.
I will extend it to rebuild all if the build options file is changed.
Anyway, instead of adding several custom menus or modifying boards.txt, I think hooks feature could help to make those customization easier for the end user.
I will extend it to rebuild all if the build options file is changed.