From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.88; helo=mga01.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 1638F21189FBB for ; Thu, 1 Nov 2018 18:56:07 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Nov 2018 18:56:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,454,1534834800"; d="scan'208";a="87987513" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga006.jf.intel.com with ESMTP; 01 Nov 2018 18:56:07 -0700 Received: from fmsmsx120.amr.corp.intel.com (10.18.124.208) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 1 Nov 2018 18:56:06 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx120.amr.corp.intel.com (10.18.124.208) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 1 Nov 2018 18:56:06 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.117]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.102]) with mapi id 14.03.0415.000; Fri, 2 Nov 2018 09:56:04 +0800 From: "Gao, Liming" To: "Feng, Bob C" , "edk2-devel@lists.01.org" Thread-Topic: [Patch] BaseTools: Use common cc flag for building PcdValueInit. Thread-Index: AQHUcfYSEu2cU+/J2UyyG/lV0ealKqU7ukkA Date: Fri, 2 Nov 2018 01:56:03 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E3638A2@SHSMSX104.ccr.corp.intel.com> References: <20181101151749.54240-1-bob.c.feng@intel.com> In-Reply-To: <20181101151749.54240-1-bob.c.feng@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch] BaseTools: Use common cc flag for building PcdValueInit. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Nov 2018 01:56:08 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Bob: I find this patch can't handle below case to retrieve the common option. = Please help check it.=20 [BuildOptions] MSFT:*_*_IA32_CC_FLAGS =3D /D DISABLE_NEW_DEPRECATED_INTERFACES /DDEF_IA3= 2 MSFT:*_*_X64_CC_FLAGS =3D /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 ; Gao, Liming >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 >Cc: Liming Gao >--- > .../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 !=3D self.ToolChainFamily: > continue > Target, Tag, Arch, Tool, Attr =3D Options[1].split("_") > if Tool !=3D 'CC': > continue >- >+ if Attr !=3D "FLAGS": >+ continue > if Target =3D=3D "*" or Target =3D=3D self._Target: > if Tag =3D=3D "*" or Tag =3D=3D self._Toolchain: >+ if 'COMMON' not in BuildOptions: >+ BuildOptions['COMMON'] =3D set() > if Arch =3D=3D "*": >- if Tool not in BuildOptions: >- BuildOptions[Tool] =3D OrderedDict() >- if Attr !=3D "FLAGS" or Attr not in BuildOptions[= Tool] or >self.BuildOptions[Options].startswith('=3D'): >- BuildOptions[Tool][Attr] =3D self.BuildOption= s[Options] >- else: >- # append options for the same tool except PAT= H >- if Attr !=3D 'PATH': >- BuildOptions[Tool][Attr] +=3D " " + self.= BuildOptions[Options] >- else: >- BuildOptions[Tool][Attr] =3D self.BuildOp= tions[Options] >+ BuildOptions['COMMON'].add(self.BuildOptions[Opti= ons]) >+ if Arch in self.SupArchList: >+ if Arch not in BuildOptions: >+ BuildOptions[Arch] =3D set() >+ BuildOptions[Arch].add(self.BuildOptions[Options]= ) >+ > if BuildOptions: >- for Tool in BuildOptions: >- for Attr in BuildOptions[Tool]: >- if Attr =3D=3D "FLAGS": >- Value =3D BuildOptions[Tool][Attr] >- ValueList =3D Value.split() >- if ValueList: >- for Id, Item in enumerate(ValueList): >- if Item in ['-D', '/D', '-U', '/U']: >- CC_FLAGS +=3D ' ' + Item >- if Id + 1 < len(ValueList): >- CC_FLAGS +=3D ' ' + ValueList[Id = + 1] >- elif Item.startswith(('-D', '/D', '-U', '= /U')): >- CC_FLAGS +=3D ' ' + Item >+ ArchBuildOptions =3D {arch:flags for arch,flags in BuildOptio= ns.items() if >arch !=3D 'COMMON'} >+ if len(ArchBuildOptions.keys()) =3D=3D 1: >+ BuildOptions['COMMON'] |=3D (ArchBuildOptions.values()[0]= ) >+ else: >+ CommonBuildOptions =3D reduce(lambda x,y: x&y, >ArchBuildOptions.values()) >+ BuildOptions['COMMON'] |=3D CommonBuildOptions >+ ValueList =3D list(BuildOptions['COMMON']) >+ for Id, Item in enumerate(ValueList): >+ if Item in ['-D', '/D', '-U', '/U']: >+ CC_FLAGS +=3D ' ' + Item >+ if Id + 1 < len(ValueList): >+ CC_FLAGS +=3D ' ' + ValueList[Id + 1] >+ elif Item.startswith(('-D', '/D', '-U', '/U')): >+ CC_FLAGS +=3D ' ' + Item > MakeApp +=3D CC_FLAGS > > if sys.platform =3D=3D "win32": > MakeApp =3D MakeApp + PcdMakefileEnd > MakeApp =3D MakeApp + AppTarget % ("""\tcopy $(APPLICATION) >$(APPFILE) /y """) >-- >2.18.0.windows.1