From d46442624306375622f7ee288020722d75de34a1 Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Mon, 12 Jul 2021 16:46:22 +0200 Subject: [PATCH] platform: use build.opt instead of build_opt.h See: https://github.com/arduino/arduino-cli/issues/1338 When the above issue will be fix. This change should be reviewed. This is backward compatible. Signed-off-by: Frederic Pillon --- platform.txt | 2 +- system/extras/prebuild.sh | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) 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"