This is an automated email from the ASF dual-hosted git repository.
jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newt.git
The following commit(s) were added to refs/heads/master by this push:
new 9dbd3da3 Fix CmakeList.txt $(...) compiler flags
9dbd3da3 is described below
commit 9dbd3da3f3ab9e0db3540b9232ac9bd20b07b86d
Author: Michal Gorecki <[email protected]>
AuthorDate: Tue Jun 20 15:25:14 2023 +0200
Fix CmakeList.txt $(...) compiler flags
This fixes the issue: https://github.com/apache/mynewt-newt/issues/516
---
newt/toolchain/compiler.go | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/newt/toolchain/compiler.go b/newt/toolchain/compiler.go
index 1a074c67..01083956 100644
--- a/newt/toolchain/compiler.go
+++ b/newt/toolchain/compiler.go
@@ -23,6 +23,7 @@ import (
"fmt"
"io/ioutil"
"mynewt.apache.org/newt/newt/cfgv"
+ "mynewt.apache.org/newt/newt/pkg"
"os"
"path"
"path/filepath"
@@ -315,12 +316,50 @@ func loadFlags(yc ycfg.YCfg, settings *cfgv.Settings, key
string, cfg *cfgv.Sett
return flags
}
+func getConfigMap(compilerDir string) (map[string]string, error) {
+ dstMap := make(map[string]string)
+
+ scfg, err := config.ReadFile(compilerDir + "/" +
pkg.SYSCFG_YAML_FILENAME)
+ if err != nil {
+ return nil, err
+ }
+
+ for _, setting := range scfg.AllSettings() {
+ aSetting, ok := setting.(map[interface{}]interface{})
+ if ok {
+ for settingName, settingFields := range aSetting {
+ aSettingName := settingName.(string)
+ aSettingFields, ok :=
settingFields.(map[interface{}]interface{})
+ if ok {
+ for settingField, fieldValue := range
aSettingFields {
+ if settingField == "value" {
+ aFieldValue, ok :=
fieldValue.(string)
+ if ok {
+
dstMap[aSettingName] = aFieldValue
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return dstMap, nil
+}
+
func (c *Compiler) load(compilerDir string, buildProfile string, cfg
*cfgv.Settings) error {
yc, err := config.ReadFile(compilerDir + "/" + COMPILER_FILENAME)
if err != nil {
return err
}
+ if cfg == nil {
+ cfgMap, err := getConfigMap(compilerDir)
+ if err == nil {
+ cfg = cfgv.NewSettingsFromMap(cfgMap)
+ }
+ }
+
settings := cfgv.NewSettingsFromMap(map[string]string{
buildProfile: "1",
strings.ToUpper(runtime.GOOS): "1",