* [Patch] BaseTools: Use common cc flag for building PcdValueInit.
@ 2018-11-01 15:17 BobCF
2018-11-02 1:56 ` Gao, Liming
0 siblings, 1 reply; 2+ messages in thread
From: BobCF @ 2018-11-01 15:17 UTC (permalink / raw)
To: edk2-devel; +Cc: Bob Feng, Liming Gao
Use common cc flags for building PcdValueInit. The common
cc flags include the cc flag which is under common Arch and
under all build Arches.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
---
.../Source/Python/Workspace/DscBuildData.py | 48 +++++++++----------
1 file changed, 24 insertions(+), 24 deletions(-)
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 6d596b2b54..4807fff489 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -2298,38 +2298,38 @@ class DscBuildData(PlatformBuildClassObject):
if Family and Family != self.ToolChainFamily:
continue
Target, Tag, Arch, Tool, Attr = Options[1].split("_")
if Tool != 'CC':
continue
-
+ if Attr != "FLAGS":
+ continue
if Target == "*" or Target == self._Target:
if Tag == "*" or Tag == self._Toolchain:
+ if 'COMMON' not in BuildOptions:
+ BuildOptions['COMMON'] = set()
if Arch == "*":
- if Tool not in BuildOptions:
- BuildOptions[Tool] = OrderedDict()
- if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or self.BuildOptions[Options].startswith('='):
- BuildOptions[Tool][Attr] = self.BuildOptions[Options]
- else:
- # append options for the same tool except PATH
- if Attr != 'PATH':
- BuildOptions[Tool][Attr] += " " + self.BuildOptions[Options]
- else:
- BuildOptions[Tool][Attr] = self.BuildOptions[Options]
+ BuildOptions['COMMON'].add(self.BuildOptions[Options])
+ if Arch in self.SupArchList:
+ if Arch not in BuildOptions:
+ BuildOptions[Arch] = set()
+ BuildOptions[Arch].add(self.BuildOptions[Options])
+
if BuildOptions:
- for Tool in BuildOptions:
- for Attr in BuildOptions[Tool]:
- if Attr == "FLAGS":
- Value = BuildOptions[Tool][Attr]
- ValueList = Value.split()
- if ValueList:
- for Id, Item in enumerate(ValueList):
- if Item in ['-D', '/D', '-U', '/U']:
- CC_FLAGS += ' ' + Item
- if Id + 1 < len(ValueList):
- CC_FLAGS += ' ' + ValueList[Id + 1]
- elif Item.startswith(('-D', '/D', '-U', '/U')):
- CC_FLAGS += ' ' + Item
+ ArchBuildOptions = {arch:flags for arch,flags in BuildOptions.items() if arch != 'COMMON'}
+ if len(ArchBuildOptions.keys()) == 1:
+ BuildOptions['COMMON'] |= (ArchBuildOptions.values()[0])
+ else:
+ CommonBuildOptions = reduce(lambda x,y: x&y, ArchBuildOptions.values())
+ BuildOptions['COMMON'] |= CommonBuildOptions
+ ValueList = list(BuildOptions['COMMON'])
+ for Id, Item in enumerate(ValueList):
+ if Item in ['-D', '/D', '-U', '/U']:
+ CC_FLAGS += ' ' + Item
+ if Id + 1 < len(ValueList):
+ CC_FLAGS += ' ' + ValueList[Id + 1]
+ elif Item.startswith(('-D', '/D', '-U', '/U')):
+ CC_FLAGS += ' ' + Item
MakeApp += CC_FLAGS
if sys.platform == "win32":
MakeApp = MakeApp + PcdMakefileEnd
MakeApp = MakeApp + AppTarget % ("""\tcopy $(APPLICATION) $(APPFILE) /y """)
--
2.18.0.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Patch] BaseTools: Use common cc flag for building PcdValueInit.
2018-11-01 15:17 [Patch] BaseTools: Use common cc flag for building PcdValueInit BobCF
@ 2018-11-02 1:56 ` Gao, Liming
0 siblings, 0 replies; 2+ messages in thread
From: Gao, Liming @ 2018-11-02 1:56 UTC (permalink / raw)
To: Feng, Bob C, edk2-devel@lists.01.org
Bob:
I find this patch can't handle below case to retrieve the common option. Please help check it.
[BuildOptions]
MSFT:*_*_IA32_CC_FLAGS = /D DISABLE_NEW_DEPRECATED_INTERFACES /DDEF_IA32
MSFT:*_*_X64_CC_FLAGS = /DDEF_X64 /D DISABLE_NEW_DEPRECATED_INTERFACES
Thanks
Liming
>-----Original Message-----
>From: Feng, Bob C
>Sent: Thursday, November 01, 2018 11:18 PM
>To: edk2-devel@lists.01.org
>Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>
>Subject: [Patch] BaseTools: Use common cc flag for building PcdValueInit.
>
>Use common cc flags for building PcdValueInit. The common
>cc flags include the cc flag which is under common Arch and
>under all build Arches.
>
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Bob Feng <bob.c.feng@intel.com>
>Cc: Liming Gao <liming.gao@intel.com>
>---
> .../Source/Python/Workspace/DscBuildData.py | 48 +++++++++----------
> 1 file changed, 24 insertions(+), 24 deletions(-)
>
>diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py
>b/BaseTools/Source/Python/Workspace/DscBuildData.py
>index 6d596b2b54..4807fff489 100644
>--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
>+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
>@@ -2298,38 +2298,38 @@ class DscBuildData(PlatformBuildClassObject):
> if Family and Family != self.ToolChainFamily:
> continue
> Target, Tag, Arch, Tool, Attr = Options[1].split("_")
> if Tool != 'CC':
> continue
>-
>+ if Attr != "FLAGS":
>+ continue
> if Target == "*" or Target == self._Target:
> if Tag == "*" or Tag == self._Toolchain:
>+ if 'COMMON' not in BuildOptions:
>+ BuildOptions['COMMON'] = set()
> if Arch == "*":
>- if Tool not in BuildOptions:
>- BuildOptions[Tool] = OrderedDict()
>- if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or
>self.BuildOptions[Options].startswith('='):
>- BuildOptions[Tool][Attr] = self.BuildOptions[Options]
>- else:
>- # append options for the same tool except PATH
>- if Attr != 'PATH':
>- BuildOptions[Tool][Attr] += " " + self.BuildOptions[Options]
>- else:
>- BuildOptions[Tool][Attr] = self.BuildOptions[Options]
>+ BuildOptions['COMMON'].add(self.BuildOptions[Options])
>+ if Arch in self.SupArchList:
>+ if Arch not in BuildOptions:
>+ BuildOptions[Arch] = set()
>+ BuildOptions[Arch].add(self.BuildOptions[Options])
>+
> if BuildOptions:
>- for Tool in BuildOptions:
>- for Attr in BuildOptions[Tool]:
>- if Attr == "FLAGS":
>- Value = BuildOptions[Tool][Attr]
>- ValueList = Value.split()
>- if ValueList:
>- for Id, Item in enumerate(ValueList):
>- if Item in ['-D', '/D', '-U', '/U']:
>- CC_FLAGS += ' ' + Item
>- if Id + 1 < len(ValueList):
>- CC_FLAGS += ' ' + ValueList[Id + 1]
>- elif Item.startswith(('-D', '/D', '-U', '/U')):
>- CC_FLAGS += ' ' + Item
>+ ArchBuildOptions = {arch:flags for arch,flags in BuildOptions.items() if
>arch != 'COMMON'}
>+ if len(ArchBuildOptions.keys()) == 1:
>+ BuildOptions['COMMON'] |= (ArchBuildOptions.values()[0])
>+ else:
>+ CommonBuildOptions = reduce(lambda x,y: x&y,
>ArchBuildOptions.values())
>+ BuildOptions['COMMON'] |= CommonBuildOptions
>+ ValueList = list(BuildOptions['COMMON'])
>+ for Id, Item in enumerate(ValueList):
>+ if Item in ['-D', '/D', '-U', '/U']:
>+ CC_FLAGS += ' ' + Item
>+ if Id + 1 < len(ValueList):
>+ CC_FLAGS += ' ' + ValueList[Id + 1]
>+ elif Item.startswith(('-D', '/D', '-U', '/U')):
>+ CC_FLAGS += ' ' + Item
> MakeApp += CC_FLAGS
>
> if sys.platform == "win32":
> MakeApp = MakeApp + PcdMakefileEnd
> MakeApp = MakeApp + AppTarget % ("""\tcopy $(APPLICATION)
>$(APPFILE) /y """)
>--
>2.18.0.windows.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-11-02 1:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-01 15:17 [Patch] BaseTools: Use common cc flag for building PcdValueInit BobCF
2018-11-02 1:56 ` Gao, Liming
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox