From: "Bob Feng" <bob.c.feng@intel.com>
To: devel@edk2.groups.io
Cc: Liming Gao <liming.gao@intel.com>, Bob Feng <bob.c.feng@intel.com>
Subject: [Patch 03/10 V7] BaseTools: Add functions to get platform scope build options
Date: Tue, 6 Aug 2019 15:15:04 +0800 [thread overview]
Message-ID: <20190806071511.11836-4-bob.c.feng@intel.com> (raw)
In-Reply-To: <20190806071511.11836-1-bob.c.feng@intel.com>
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1875
These functions are used for get platform scope
build options. They will be used in later patches.
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
---
BaseTools/Source/Python/AutoGen/AutoGen.py | 10 +++++++++-
.../Source/Python/Workspace/DscBuildData.py | 20 +++++++++++++++++++
.../Source/Python/Workspace/InfBuildData.py | 10 ++++++++++
3 files changed, 39 insertions(+), 1 deletion(-)
diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 122696f5cebf..bb0da46d74a9 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -2484,11 +2484,19 @@ class PlatformAutoGen(AutoGen):
if Attr != 'PATH':
BuildOptions[Tool][Attr] += " " + Options[Key]
else:
BuildOptions[Tool][Attr] = Options[Key]
return BuildOptions
-
+ def GetGlobalBuildOptions(self,Module):
+ ModuleTypeOptions = self.Platform.GetBuildOptionsByPkg(Module, Module.ModuleType)
+ ModuleTypeOptions = self._ExpandBuildOption(ModuleTypeOptions)
+ if Module in self.Platform.Modules:
+ PlatformModule = self.Platform.Modules[str(Module)]
+ PlatformModuleOptions = self._ExpandBuildOption(PlatformModule.BuildOptions)
+ else:
+ PlatformModuleOptions = {}
+ return ModuleTypeOptions, PlatformModuleOptions
## Append build options in platform to a module
#
# @param Module The module to which the build options will be appended
#
# @retval options The options appended with build options in platform
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 987d9cf13eea..fa41e57c4f45 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -1222,11 +1222,31 @@ class DscBuildData(PlatformBuildClassObject):
self._BuildOptions[CurKey] = Option
else:
if ' ' + Option not in self._BuildOptions[CurKey]:
self._BuildOptions[CurKey] += ' ' + Option
return self._BuildOptions
+ def GetBuildOptionsByPkg(self, Module, ModuleType):
+ local_pkg = os.path.split(Module.LocalPkg())[0]
+ if self._ModuleTypeOptions is None:
+ self._ModuleTypeOptions = OrderedDict()
+ if ModuleType not in self._ModuleTypeOptions:
+ options = OrderedDict()
+ self._ModuleTypeOptions[ ModuleType] = options
+ RecordList = self._RawData[MODEL_META_DATA_BUILD_OPTION, self._Arch]
+ for ToolChainFamily, ToolChain, Option, Dummy1, Dummy2, Dummy3, Dummy4, Dummy5 in RecordList:
+ if Dummy2 not in (TAB_COMMON,local_pkg.upper(),"EDKII"):
+ continue
+ Type = Dummy3
+ if Type.upper() == ModuleType.upper():
+ Key = (ToolChainFamily, ToolChain)
+ if Key not in options or not ToolChain.endswith('_FLAGS') or Option.startswith('='):
+ options[Key] = Option
+ else:
+ if ' ' + Option not in options[Key]:
+ options[Key] += ' ' + Option
+ return self._ModuleTypeOptions[ModuleType]
def GetBuildOptionsByModuleType(self, Edk, ModuleType):
if self._ModuleTypeOptions is None:
self._ModuleTypeOptions = OrderedDict()
if (Edk, ModuleType) not in self._ModuleTypeOptions:
options = OrderedDict()
diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/Source/Python/Workspace/InfBuildData.py
index 60970cd92836..da35391d3aff 100644
--- a/BaseTools/Source/Python/Workspace/InfBuildData.py
+++ b/BaseTools/Source/Python/Workspace/InfBuildData.py
@@ -817,11 +817,21 @@ class InfBuildData(ModuleBuildClassObject):
for Token in TokenList:
TemporaryDictionary[Arch, ModuleType] = TemporaryDictionary[Arch, ModuleType] + Token.strip() + ' '
for Arch, ModuleType in TemporaryDictionary:
RetVal[Arch, ModuleType] = TemporaryDictionary[Arch, ModuleType]
return RetVal
+ def LocalPkg(self):
+ module_path = self.MetaFile.File
+ subdir = os.path.split(module_path)[0]
+ TopDir = ""
+ while subdir:
+ subdir,TopDir = os.path.split(subdir)
+ for file_name in os.listdir(os.path.join(self.MetaFile.Root,TopDir)):
+ if file_name.upper().endswith("DEC"):
+ pkg = os.path.join(TopDir,file_name)
+ return pkg
@cached_class_function
def GetGuidsUsedByPcd(self):
self.Pcds
return self._GuidsUsedByPcd
--
2.20.1.windows.1
next prev parent reply other threads:[~2019-08-06 7:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-06 7:15 [Patch 00/10 V7] Enable multiple process AutoGen Bob Feng
2019-08-06 7:15 ` [Patch 01/10 V7] BaseTools: Singleton the object to handle build conf file Bob Feng
2019-08-06 7:15 ` [Patch 02/10 V7] BaseTools: Split WorkspaceAutoGen._InitWorker into multiple functions Bob Feng
2019-08-06 7:15 ` Bob Feng [this message]
2019-08-06 7:15 ` [Patch 04/10 V7] BaseTools: Decouple AutoGen Objects Bob Feng
2019-08-06 7:15 ` [Patch 05/10 V7] BaseTools: Enable Multiple Process AutoGen Bob Feng
2019-08-06 7:15 ` [Patch 06/10 V7] BaseTools: Add shared data for processes Bob Feng
2019-08-06 7:15 ` [Patch 07/10 V7] BaseTools: Add LogAgent to support multiple process Autogen Bob Feng
2019-08-06 7:15 ` [Patch 08/10 V7] BaseTools: Move BuildOption parser out of build.py Bob Feng
2019-08-06 7:15 ` [Patch 09/10 V7] BaseTools: Add the support for python 2 Bob Feng
2019-08-06 7:15 ` [Patch 10/10 V7] BaseTools: Enable block queue log agent Bob Feng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190806071511.11836-4-bob.c.feng@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox