Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (c) 2012 Google Inc. All rights reserved. | 1 # Copyright (c) 2012 Google Inc. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import gyp | 5 import gyp |
| 6 import gyp.common | 6 import gyp.common |
| 7 import gyp.system_test | 7 import gyp.system_test |
| 8 import gyp.xcode_emulation | 8 import gyp.xcode_emulation |
| 9 import os.path | 9 import os.path |
| 10 import re | 10 import re |
| (...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 662 assert self.is_mac_bundle | 662 assert self.is_mac_bundle |
| 663 path = self.ExpandSpecial(generator_default_variables['PRODUCT_DIR']) | 663 path = self.ExpandSpecial(generator_default_variables['PRODUCT_DIR']) |
| 664 return os.path.join(path, self.xcode_settings.GetWrapperName()) | 664 return os.path.join(path, self.xcode_settings.GetWrapperName()) |
| 665 | 665 |
| 666 def ComputeMacBundleBinaryOutput(self, spec): | 666 def ComputeMacBundleBinaryOutput(self, spec): |
| 667 """Return the 'output' (full output path) to the binary in a bundle.""" | 667 """Return the 'output' (full output path) to the binary in a bundle.""" |
| 668 assert self.is_mac_bundle | 668 assert self.is_mac_bundle |
| 669 path = self.ExpandSpecial(generator_default_variables['PRODUCT_DIR']) | 669 path = self.ExpandSpecial(generator_default_variables['PRODUCT_DIR']) |
| 670 return os.path.join(path, self.xcode_settings.GetExecutablePath()) | 670 return os.path.join(path, self.xcode_settings.GetExecutablePath()) |
| 671 | 671 |
| 672 | |
| 673 def ComputeOutputFileName(self, spec): | 672 def ComputeOutputFileName(self, spec): |
| 674 """Compute the filename of the final output for the current target.""" | 673 """Compute the filename of the final output for the current target.""" |
| 675 | 674 |
| 676 # Compute filename prefix: the product prefix, or a default for | 675 # Compute filename prefix: the product prefix, or a default for |
| 677 # the product type. | 676 # the product type. |
| 678 DEFAULT_PREFIX = { | 677 DEFAULT_PREFIX = { |
| 679 'loadable_module': 'lib', | 678 'loadable_module': 'lib', |
| 680 'shared_library': 'lib', | 679 'shared_library': 'lib', |
| 681 'static_library': 'lib', | 680 'static_library': 'lib', |
| 682 } | 681 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 723 else: | 722 else: |
| 724 filename = self.ComputeOutputFileName(spec) | 723 filename = self.ComputeOutputFileName(spec) |
| 725 | 724 |
| 726 if 'product_dir' in spec: | 725 if 'product_dir' in spec: |
| 727 path = os.path.join(spec['product_dir'], filename) | 726 path = os.path.join(spec['product_dir'], filename) |
| 728 return self.ExpandSpecial(path) | 727 return self.ExpandSpecial(path) |
| 729 | 728 |
| 730 # Executables and loadable modules go into the output root, | 729 # Executables and loadable modules go into the output root, |
| 731 # libraries go into shared library dir, and everything else | 730 # libraries go into shared library dir, and everything else |
| 732 # goes into the normal place. | 731 # goes into the normal place. |
| 733 if spec['type'] in ('executable', 'loadable_module'): | 732 # On Mac, shared and static libraries go into the output root, |
| 733 # too. | |
|
Evan Martin
2012/01/06 18:50:00
Should we instead compute some sort of "output_dir
Nico
2012/01/06 18:54:49
Done.
| |
| 734 if (spec['type'] in ('executable', 'loadable_module') or | |
| 735 self.flavor == 'mac' and self.toolset == 'target' and | |
| 736 spec['type'] in ('shared_library', 'static_library')): | |
| 734 return filename | 737 return filename |
| 735 elif spec['type'] == 'shared_library': | 738 elif spec['type'] == 'shared_library': |
| 736 libdir = 'lib' | 739 libdir = 'lib' |
| 737 if self.toolset != 'target': | 740 if self.toolset != 'target': |
| 738 libdir = 'lib/%s' % self.toolset | 741 libdir = 'lib/%s' % self.toolset |
| 739 return os.path.join(libdir, filename) | 742 return os.path.join(libdir, filename) |
| 740 elif spec['type'] == 'static_library' and self.flavor == 'mac': | |
| 741 # Static libraries go into the output root on mac, too. | |
| 742 return filename | |
| 743 else: | 743 else: |
| 744 return self.GypPathToUniqueOutput(filename, qualified=False) | 744 return self.GypPathToUniqueOutput(filename, qualified=False) |
| 745 | 745 |
| 746 def WriteVariableList(self, var, values): | 746 def WriteVariableList(self, var, values): |
| 747 if values is None: | 747 if values is None: |
| 748 values = [] | 748 values = [] |
| 749 self.ninja.variable(var, ' '.join(values)) | 749 self.ninja.variable(var, ' '.join(values)) |
| 750 | 750 |
| 751 def WriteNewNinjaRule(self, name, args, description): | 751 def WriteNewNinjaRule(self, name, args, description): |
| 752 """Write out a new ninja "rule" statement for a given command. | 752 """Write out a new ninja "rule" statement for a given command. |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 995 # For bundles, the binary in the bundle is the right answer. | 995 # For bundles, the binary in the bundle is the right answer. |
| 996 target_outputs[qualified_target] = ( | 996 target_outputs[qualified_target] = ( |
| 997 output_binary, compile_depends, linkable) | 997 output_binary, compile_depends, linkable) |
| 998 | 998 |
| 999 # But for all_outputs, the bundle is the interesting bit. | 999 # But for all_outputs, the bundle is the interesting bit. |
| 1000 if qualified_target in all_targets: | 1000 if qualified_target in all_targets: |
| 1001 all_outputs.add(output) | 1001 all_outputs.add(output) |
| 1002 | 1002 |
| 1003 if all_outputs: | 1003 if all_outputs: |
| 1004 master_ninja.build('all', 'phony', list(all_outputs)) | 1004 master_ninja.build('all', 'phony', list(all_outputs)) |
| OLD | NEW |