# build a platform or a module\r
#\r
# Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR>\r
-# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
#\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
import traceback\r
import encodings.ascii\r
import itertools\r
+import multiprocessing\r
\r
from struct import *\r
from threading import *\r
self.SkipAutoGen = BuildOptions.SkipAutoGen\r
self.Reparse = BuildOptions.Reparse\r
self.SkuId = BuildOptions.SkuId\r
+ if self.SkuId:\r
+ GlobalData.gSKUID_CMD = self.SkuId\r
self.ConfDirectory = BuildOptions.ConfDirectory\r
self.SpawnMode = True\r
self.BuildReport = BuildReport(BuildOptions.ReportFile, BuildOptions.ReportType)\r
self.AutoGenTime = 0\r
self.MakeTime = 0\r
self.GenFdsTime = 0\r
- GlobalData.BuildOptionPcd = BuildOptions.OptionPcd\r
+ GlobalData.BuildOptionPcd = BuildOptions.OptionPcd if BuildOptions.OptionPcd else {}\r
#Set global flag for build mode\r
GlobalData.gIgnoreSource = BuildOptions.IgnoreSources\r
GlobalData.gUseHashCache = BuildOptions.UseHashCache\r
if not os.path.isabs(BinCacheSource):\r
BinCacheSource = mws.join(self.WorkspaceDir, BinCacheSource)\r
GlobalData.gBinCacheSource = BinCacheSource\r
+ else:\r
+ if GlobalData.gBinCacheSource != None:\r
+ EdkLogger.error("build", OPTION_VALUE_INVALID, ExtraData="Invalid value of option --binary-source.")\r
\r
if GlobalData.gBinCacheDest:\r
BinCacheDest = os.path.normpath(GlobalData.gBinCacheDest)\r
if not os.path.isabs(BinCacheDest):\r
BinCacheDest = mws.join(self.WorkspaceDir, BinCacheDest)\r
GlobalData.gBinCacheDest = BinCacheDest\r
+ else:\r
+ if GlobalData.gBinCacheDest != None:\r
+ EdkLogger.error("build", OPTION_VALUE_INVALID, ExtraData="Invalid value of option --binary-destination.")\r
\r
if self.ConfDirectory:\r
# Get alternate Conf location, if it is absolute, then just use the absolute directory name\r
self.ThreadNumber = int(self.ThreadNumber, 0)\r
\r
if self.ThreadNumber == 0:\r
- self.ThreadNumber = 1\r
+ try:\r
+ self.ThreadNumber = multiprocessing.cpu_count()\r
+ except (ImportError, NotImplementedError):\r
+ self.ThreadNumber = 1\r
\r
if not self.PlatformFile:\r
PlatformFile = self.TargetTxt.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_ACTIVE_PLATFORM]\r
help="Using this name of SKU ID to build the platform, overriding SKUID_IDENTIFIER in DSC file.")\r
\r
Parser.add_option("-n", action="callback", type="int", dest="ThreadNumber", callback=SingleCheckCallback,\r
- help="Build the platform using multi-threaded compiler. The value overrides target.txt's MAX_CONCURRENT_THREAD_NUMBER. Less than 2 will disable multi-thread builds.")\r
+ help="Build the platform using multi-threaded compiler. The value overrides target.txt's MAX_CONCURRENT_THREAD_NUMBER. When value is set to 0, tool automatically detect number of "\\r
+ "processor threads, set value to 1 means disable multi-thread build, and set value to more than 1 means user specify the threads number to build.")\r
\r
Parser.add_option("-f", "--fdf", action="callback", type="string", dest="FdfFile", callback=SingleCheckCallback,\r
help="The name of the FDF file to use, which overrides the setting in the DSC file.")\r