Unverified Commit 2d7e3d19 authored by Cristian Maglie's avatar Cristian Maglie Committed by GitHub

Fix -DARDUINO_LIB_DISCOVERY_PHASE automatic flag incompatiblity in some rare circumstances (#838)

* Revert "Add macro -DARDUINO_LIB_DISCOVERY_PHASE during lib discovery phase (#633)"

This reverts commit 985b2c99.

* Set {build.library_discovery_phase} to 1 during lib discovery

Previously we used to add `-DARDUINO_LIB_DISCOVERY_PHASE` to the gcc
command line but this produced some incompatiblity with compilers using
non-standard `-d` flag instead of `-D`:

https://github.com/arduino/arduino-cli/pull/633#issuecomment-659529026
parent 858cda31
......@@ -57,6 +57,7 @@ func GCCPreprocRunnerForDiscoveringIncludes(ctx *types.Context, sourceFilePath *
func prepareGCCPreprocRecipeProperties(ctx *types.Context, sourceFilePath *paths.Path, targetFilePath *paths.Path, includes paths.PathList) (*exec.Cmd, error) {
properties := ctx.BuildProperties.Clone()
properties.Set("build.library_discovery_phase", "1")
properties.SetPath(constants.BUILD_PROPERTIES_SOURCE_FILE, sourceFilePath)
properties.SetPath(constants.BUILD_PROPERTIES_PREPROCESSED_FILE_PATH, targetFilePath)
......@@ -77,8 +78,6 @@ func prepareGCCPreprocRecipeProperties(ctx *types.Context, sourceFilePath *paths
// to create a /dev/null.d dependency file, which won't work.
cmd.Args = utils.Filter(cmd.Args, func(a string) bool { return a != "-MMD" })
cmd.Args = append(cmd.Args, "-DARDUINO_LIB_DISCOVERY_PHASE")
return cmd, nil
}
......
......@@ -67,6 +67,7 @@ func (s *SetupBuildProperties) Run(ctx *types.Context) error {
buildProperties.Set("build.fqbn", ctx.FQBN.String())
buildProperties.Set("ide_version", ctx.ArduinoAPIVersion)
buildProperties.Set("runtime.os", properties.GetOSSuffix())
buildProperties.Set("build.library_discovery_phase", "0")
if ctx.OptimizeForDebug {
if buildProperties.ContainsKey("compiler.optimization_flags.debug") {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment