Skip to content

Commit

Permalink
platform: use build.opt instead of build_opt.h
Browse files Browse the repository at this point in the history
See:
arduino/arduino-cli#1338

When the above issue will be fix. This change should be reviewed.

This is backward compatible.

Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
  • Loading branch information
fpistm committed Jul 12, 2021
1 parent 640eed4 commit d464426
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion platform.txt
Expand Up @@ -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
Expand Down
11 changes: 8 additions & 3 deletions system/extras/prebuild.sh
Expand Up @@ -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 <SrcWrapper.h>" >"$BUILD_PATH/sketch/SrcWrapper.cpp"
echo "#include <SrcWrapper.h>" > "$BUILD_PATH/sketch/SrcWrapper.cpp"

0 comments on commit d464426

Please sign in to comment.