diff --git a/platform.txt b/platform.txt index 7dc8afb5fc..7d9ae27e36 100644 --- a/platform.txt +++ b/platform.txt @@ -105,7 +105,7 @@ build.flags.ldspecs=--specs=nano.specs build.flash_offset=0 # Pre and post build hooks -build.opt.name=build_opt.h +build.opt.name=build.opt build.opt.path={build.path}/sketch/{build.opt.name} extras.path={build.system.path}/extras diff --git a/system/extras/prebuild.sh b/system/extras/prebuild.sh index 2b5076a8ae..8870921a3d 100755 --- a/system/extras/prebuild.sh +++ b/system/extras/prebuild.sh @@ -8,10 +8,15 @@ if [ ! -f "$BUILD_PATH/sketch" ]; then mkdir -p "$BUILD_PATH/sketch" fi -# Create empty build.opt.h if not exists in the original sketch dir +# Create empty build.opt if build_opt.h does not exists in the original sketch dir if [ ! -f "$BUILD_SOURCE_PATH/build_opt.h" ]; then - touch "$BUILD_PATH/sketch/build_opt.h" + touch "$BUILD_PATH/sketch/build.opt" +else + # Else copy the build_opt.h as build.opt + # Workaround to the header file preprocessing done by arduino-cli + # See https://github.com/arduino/arduino-cli/issues/1338 + cp "$BUILD_SOURCE_PATH/build_opt.h" "$BUILD_PATH/sketch/build.opt" fi # Force include of SrcWrapper library -echo "#include " >"$BUILD_PATH/sketch/SrcWrapper.cpp" +echo "#include " > "$BUILD_PATH/sketch/SrcWrapper.cpp"