arduino / arduino-builder

A command line tool for compiling Arduino sketches
GNU General Public License v2.0
458 stars 114 forks source link

Include sketch directory to include search path #354

Closed luni64 closed 3 years ago

luni64 commented 4 years ago

When doing libraries with project scope settings I usually do something like

config.h:

#pragma once

#if __has_include("userConfig.h")
    #include "userConfig.h"
#else
    #include "defaultConfig.h"
#endif

If the user want's to override the default settings he can copy defaultConfig.h to the sketch folder and rename it to userConfig.h. Settings will then be read from userConfig.h which works perfectly with platformIO and makefile builds.

However, looks like the Arduino builder doesn't include the sketch folder in the search path for include files, so this pattern doesn't work with the Arduino IDE.

Proposal: Include the sketch folder in the search path

per1234 commented 3 years ago

Thanks for taking the time to submit an issue @luni64.

I see we already have a prior issue report about this at https://github.com/arduino/Arduino/issues/2547 (which seems to have been considered equivalent to the discussion of an alternative proposal at https://github.com/arduino/arduino-builder/issues/15).

It's best to have only a single issue per subject so we can consolidate all relevant discussion to one place, so I'll go ahead and close this in favor of the other.

If you end up with additional information to share, feel free to comment in the other thread.