OLD | NEW |
---|---|
1 | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
2 using System; | 4 using System; |
3 using System.Collections.Generic; | 5 using System.Collections.Generic; |
4 using System.Text; | 6 using System.Text; |
5 using System.Collections; | 7 using System.Collections; |
6 using System.IO; | 8 using System.IO; |
7 using System.Reflection; | 9 using System.Reflection; |
8 using System.Resources; | 10 using System.Resources; |
9 using System.Windows.Forms; | 11 using System.Windows.Forms; |
10 using Microsoft.Build.Framework; | 12 using Microsoft.Build.Framework; |
11 using Microsoft.Win32; | 13 using Microsoft.Win32; |
(...skipping 17 matching lines...) Expand all Loading... | |
29 [Required] | 31 [Required] |
30 public bool OutputCommandLine { get; set; } | 32 public bool OutputCommandLine { get; set; } |
31 | 33 |
32 [Required] | 34 [Required] |
33 public string Platform { get; set; } | 35 public string Platform { get; set; } |
34 | 36 |
35 public int ProcessorNumber { get; set; } | 37 public int ProcessorNumber { get; set; } |
36 | 38 |
37 public bool MultiProcessorCompilation { get; set; } | 39 public bool MultiProcessorCompilation { get; set; } |
38 | 40 |
41 [Required] | |
42 public string ConfigurationType { get; set; } | |
43 | |
39 [Obsolete] | 44 [Obsolete] |
40 protected override StringDictionary EnvironmentOverride | 45 protected override StringDictionary EnvironmentOverride |
41 { | 46 { |
42 get { | 47 get { |
43 string show = OutputCommandLine ? "1" : "0"; | 48 string show = OutputCommandLine ? "1" : "0"; |
44 string cores = Convert.ToString(ProcessorNumber); | 49 string cores = Convert.ToString(ProcessorNumber); |
45 return new StringDictionary() { | 50 return new StringDictionary() { |
46 {"NACL_GCC_CORES", cores}, | 51 {"NACL_GCC_CORES", cores}, |
47 {"NACL_GCC_SHOW_COMMANDS", show } | 52 {"NACL_GCC_SHOW_COMMANDS", show } |
48 }; | 53 }; |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
221 } | 226 } |
222 } | 227 } |
223 } | 228 } |
224 | 229 |
225 protected string GenerateCommandLineFromProps(ITaskItem sourceFile, bool fullOutputName=false) | 230 protected string GenerateCommandLineFromProps(ITaskItem sourceFile, bool fullOutputName=false) |
226 { | 231 { |
227 StringBuilder commandLine = new StringBuilder(GCCUtilities.s_Command LineLength); | 232 StringBuilder commandLine = new StringBuilder(GCCUtilities.s_Command LineLength); |
228 | 233 |
229 if (sourceFile != null) | 234 if (sourceFile != null) |
230 { | 235 { |
236 //build command line from components and add required switches | |
237 string props = xamlParser.Parse(sourceFile, fullOutputName); | |
238 commandLine.Append(props); | |
239 commandLine.Append(" -c "); | |
240 | |
231 // Remove rtti items as they are not relevant in C compilation a nd will produce warnings | 241 // Remove rtti items as they are not relevant in C compilation a nd will produce warnings |
binji
2012/11/08 19:13:06
nit: wrap at 100
| |
232 if (SourceIsC(sourceFile.ToString())) | 242 if (SourceIsC(sourceFile.ToString())) |
233 { | 243 { |
234 commandLine.Replace("-fno-rtti", ""); | 244 commandLine.Replace("-fno-rtti", ""); |
235 commandLine.Replace("-frtti", ""); | 245 commandLine.Replace("-frtti", ""); |
236 } | 246 } |
237 | 247 |
238 //build command line from components and add required switches | 248 if (ConfigurationType == "DynamicLibrary") |
239 string props = xamlParser.Parse(sourceFile, fullOutputName); | 249 { |
240 commandLine.Append(props); | 250 commandLine.Append(" -fPIC "); |
241 commandLine.Append(" -c "); | 251 } |
242 } | 252 } |
243 | 253 |
244 return commandLine.ToString(); | 254 return commandLine.ToString(); |
245 } | 255 } |
246 | 256 |
247 protected ITaskItem[] MergeOutOfDateSources(ITaskItem[] outOfDateSources FromTracking, List<ITaskItem> outOfDateSourcesFromCommandLineChanges) | 257 protected ITaskItem[] MergeOutOfDateSources(ITaskItem[] outOfDateSources FromTracking, List<ITaskItem> outOfDateSourcesFromCommandLineChanges) |
248 { | 258 { |
249 List<ITaskItem> mergedSources = new List<ITaskItem>(outOfDateSources FromTracking); | 259 List<ITaskItem> mergedSources = new List<ITaskItem>(outOfDateSources FromTracking); |
250 | 260 |
251 foreach (ITaskItem item in outOfDateSourcesFromCommandLineChanges) | 261 foreach (ITaskItem item in outOfDateSourcesFromCommandLineChanges) |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
309 } | 319 } |
310 | 320 |
311 private int CompileSerial(string pathToTool) | 321 private int CompileSerial(string pathToTool) |
312 { | 322 { |
313 int returnCode = 0; | 323 int returnCode = 0; |
314 foreach (ITaskItem sourceItem in CompileSourceList) | 324 foreach (ITaskItem sourceItem in CompileSourceList) |
315 { | 325 { |
316 try | 326 try |
317 { | 327 { |
318 string commandLine = GenerateCommandLineFromProps(sourceItem , true); | 328 string commandLine = GenerateCommandLineFromProps(sourceItem , true); |
319 commandLine += "\"" + GCCUtilities.ConvertPathWindowsToPosix (sourceItem.ToString()) + "\""; | 329 commandLine += GCCUtilities.ConvertPathWindowsToPosix(source Item.ToString()); |
320 | 330 |
321 if (OutputCommandLine) | 331 if (OutputCommandLine) |
322 { | 332 { |
323 string logMessage = pathToTool + " " + commandLine; | 333 string logMessage = pathToTool + " " + commandLine; |
324 Log.LogMessage(logMessage); | 334 Log.LogMessage(logMessage); |
325 } | 335 } |
326 else | 336 else |
327 { | 337 { |
328 base.Log.LogMessage(Path.GetFileName(sourceItem.ToString ())); | 338 base.Log.LogMessage(Path.GetFileName(sourceItem.ToString ())); |
329 } | 339 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
370 pythonScript = Path.Combine(pythonScript, "compiler_wrapper.py"); | 380 pythonScript = Path.Combine(pythonScript, "compiler_wrapper.py"); |
371 | 381 |
372 foreach (KeyValuePair<string, List<ITaskItem>> entry in srcGroups) | 382 foreach (KeyValuePair<string, List<ITaskItem>> entry in srcGroups) |
373 { | 383 { |
374 string commandLine = entry.Key; | 384 string commandLine = entry.Key; |
375 string cmd = "\"" + pathToTool + "\" " + commandLine + "--"; | 385 string cmd = "\"" + pathToTool + "\" " + commandLine + "--"; |
376 List<ITaskItem> sources = entry.Value; | 386 List<ITaskItem> sources = entry.Value; |
377 | 387 |
378 foreach (ITaskItem sourceItem in sources) | 388 foreach (ITaskItem sourceItem in sources) |
379 { | 389 { |
380 string src = GCCUtilities.ConvertPathWindowsToPosix(sourceIt em.ToString()); | 390 cmd += GCCUtilities.ConvertPathWindowsToPosix(sourceItem.ToS tring()); |
381 cmd += " \"" + src + "\""; | |
382 } | 391 } |
383 | 392 |
384 try | 393 try |
385 { | 394 { |
386 // compile this group of sources | 395 // compile this group of sources |
387 returnCode = base.ExecuteTool("python", cmd, "\"" + pythonSc ript + "\""); | 396 returnCode = base.ExecuteTool("python", cmd, "\"" + pythonSc ript + "\""); |
388 } | 397 } |
389 catch (Exception e) | 398 catch (Exception e) |
390 { | 399 { |
391 Log.LogMessage("compiler exception: {0}", e); | 400 Log.LogMessage("compiler exception: {0}", e); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
539 protected override string ToolName | 548 protected override string ToolName |
540 { | 549 { |
541 get | 550 get |
542 { | 551 { |
543 return NaCLCompilerPath; | 552 return NaCLCompilerPath; |
544 } | 553 } |
545 } | 554 } |
546 | 555 |
547 } | 556 } |
548 } | 557 } |
OLD | NEW |