Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build options in source comments #1408

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions platform.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ build.opt.path={build.path}/sketch/{build.opt.name}
extras.path={build.system.path}/extras

# Create empty {build.opt} if not exists in the output sketch dir and force include of SrcWrapper library
recipe.hooks.prebuild.1.pattern="{extras.path}/prebuild.sh" "{build.path}" "{build.source.path}"
recipe.hooks.prebuild.1.pattern.windows="{runtime.tools.STM32Tools.path}/win/busybox.exe" sh "{extras.path}/prebuild.sh" "{build.path}" "{build.source.path}"
recipe.hooks.prebuild.1.pattern="{extras.path}/prebuild.sh" "{build.path}" "{build.source.path}" "{build.project_name}"
recipe.hooks.prebuild.1.pattern.windows="{runtime.tools.STM32Tools.path}/win/busybox.exe" sh "{extras.path}/prebuild.sh" "{build.path}" "{build.source.path}" "{build.project_name}"

# compile patterns
# ---------------------
Expand Down
6 changes: 6 additions & 0 deletions system/extras/prebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

BUILD_PATH="$1"
BUILD_SOURCE_PATH="$2"
BUILD_PROJECT_NAME="$3"

# Create sketch dir if not exists
if [ ! -f "$BUILD_PATH/sketch" ]; then
Expand All @@ -13,5 +14,10 @@ if [ ! -f "$BUILD_SOURCE_PATH/build_opt.h" ]; then
touch "$BUILD_PATH/sketch/build_opt.h"
fi

# add build options in source comments
if [ -f "$BUILD_SOURCE_PATH/$BUILD_PROJECT_NAME" ]; then
grep '\/\/ build-opt' "$BUILD_SOURCE_PATH/$BUILD_PROJECT_NAME" | sed -e 's/\/\/ build-opt//' >> "$BUILD_PATH/sketch/build_opt.h"
fi

# Force include of SrcWrapper library
echo "#include <SrcWrapper.h>" >"$BUILD_PATH/sketch/SrcWrapper.cpp"