Skip to content

Commit 61a13be

Browse files
committed
Fallback search for precompiled libraries in non-fpu specific directories
1 parent 2ffd7a3 commit 61a13be

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

legacy/builder/constants/constants.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ const MSG_FIND_INCLUDES_FAILED = "Error while detecting libraries included by {0
9595
const MSG_INVALID_QUOTING = "Invalid quoting: no closing [{0}] char found."
9696
const MSG_LIB_LEGACY = "(legacy)"
9797
const MSG_LIBRARIES_MULTIPLE_LIBS_FOUND_FOR = "Multiple libraries were found for \"{0}\""
98-
const MSG_PRECOMPILED_LIBRARY_NOT_FOUND_FOR = "Library \"{0}\" declared precompiled but folder \"{1}\" does not exist"
9998
const MSG_LIBRARIES_NOT_USED = " Not used: {0}"
10099
const MSG_LIBRARIES_USED = " Used: {0}"
101100
const MSG_LIBRARY_CAN_USE_SRC_AND_UTILITY_FOLDERS = "Library can't use both 'src' and 'utility' folders. Double check {0}"

legacy/builder/phases/libraries_builder.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -87,25 +87,25 @@ func findExpectedPrecompiledLibFolder(ctx *types.Context, library *libraries.Lib
8787
}
8888

8989
logger := ctx.GetLogger()
90+
logger.Fprintln(os.Stdout, constants.LOG_LEVEL_INFO, "Library {0} has been declared precompiled:", library.Name)
91+
92+
// Try directory with full fpuSpecs first, if available
9093
if len(fpuSpecs) > 0 {
9194
fpuSpecs = strings.TrimRight(fpuSpecs, "-")
92-
if library.SourceDir.Join(mcu).Join(fpuSpecs).Exist() {
93-
return library.SourceDir.Join(mcu).Join(fpuSpecs)
94-
} else {
95-
// we are unsure, compile from sources
96-
logger.Fprintln(os.Stdout, constants.LOG_LEVEL_INFO,
97-
constants.MSG_PRECOMPILED_LIBRARY_NOT_FOUND_FOR, library.Name, library.SourceDir.Join(mcu).Join(fpuSpecs))
98-
return nil
95+
fullPrecompDir := library.SourceDir.Join(mcu).Join(fpuSpecs)
96+
if fullPrecompDir.Exist() {
97+
logger.Fprintln(os.Stdout, constants.LOG_LEVEL_INFO, "Using precompiled library in {0}", fullPrecompDir)
98+
return fullPrecompDir
9999
}
100+
logger.Fprintln(os.Stdout, constants.LOG_LEVEL_INFO, "Precompiled library in \"{0}\" not found", fullPrecompDir)
100101
}
101102

102-
if library.SourceDir.Join(mcu).Exist() {
103-
return library.SourceDir.Join(mcu)
103+
precompDir := library.SourceDir.Join(mcu)
104+
if precompDir.Exist() {
105+
logger.Fprintln(os.Stdout, constants.LOG_LEVEL_INFO, "Using precompiled library in {0}", precompDir)
106+
return precompDir
104107
}
105-
106-
logger.Fprintln(os.Stdout, constants.LOG_LEVEL_INFO,
107-
constants.MSG_PRECOMPILED_LIBRARY_NOT_FOUND_FOR, library.Name, library.SourceDir.Join(mcu))
108-
108+
logger.Fprintln(os.Stdout, constants.LOG_LEVEL_INFO, "Precompiled library in \"{0}\" not found", precompDir)
109109
return nil
110110
}
111111

0 commit comments

Comments
 (0)