| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 if self.flavor == 'mac' and spec['type'] in ( | 719 if self.flavor == 'mac' and spec['type'] in ( |
| 721 'static_library', 'executable', 'shared_library', 'loadable_module'): | 720 'static_library', 'executable', 'shared_library', 'loadable_module'): |
| 722 filename = self.xcode_settings.GetExecutablePath() | 721 filename = self.xcode_settings.GetExecutablePath() |
| 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 # Some products go into the output root, libraries go into shared library |
| 731 # libraries go into shared library dir, and everything else | 730 # dir, and everything else goes into the normal place. |
| 732 # goes into the normal place. | 731 type_in_output_root = ['executable', 'loadable_module'] |
| 733 if spec['type'] in ('executable', 'loadable_module'): | 732 if self.flavor == 'mac' and self.toolset == 'target': |
| 733 type_in_output_root += ['shared_library', 'static_library'] |
| 734 |
| 735 if spec['type'] in type_in_output_root: |
| 734 return filename | 736 return filename |
| 735 elif spec['type'] == 'shared_library': | 737 elif spec['type'] == 'shared_library': |
| 736 libdir = 'lib' | 738 libdir = 'lib' |
| 737 if self.toolset != 'target': | 739 if self.toolset != 'target': |
| 738 libdir = 'lib/%s' % self.toolset | 740 libdir = 'lib/%s' % self.toolset |
| 739 return os.path.join(libdir, filename) | 741 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: | 742 else: |
| 744 return self.GypPathToUniqueOutput(filename, qualified=False) | 743 return self.GypPathToUniqueOutput(filename, qualified=False) |
| 745 | 744 |
| 746 def WriteVariableList(self, var, values): | 745 def WriteVariableList(self, var, values): |
| 747 if values is None: | 746 if values is None: |
| 748 values = [] | 747 values = [] |
| 749 self.ninja.variable(var, ' '.join(values)) | 748 self.ninja.variable(var, ' '.join(values)) |
| 750 | 749 |
| 751 def WriteNewNinjaRule(self, name, args, description): | 750 def WriteNewNinjaRule(self, name, args, description): |
| 752 """Write out a new ninja "rule" statement for a given command. | 751 """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. | 994 # For bundles, the binary in the bundle is the right answer. |
| 996 target_outputs[qualified_target] = ( | 995 target_outputs[qualified_target] = ( |
| 997 output_binary, compile_depends, linkable) | 996 output_binary, compile_depends, linkable) |
| 998 | 997 |
| 999 # But for all_outputs, the bundle is the interesting bit. | 998 # But for all_outputs, the bundle is the interesting bit. |
| 1000 if qualified_target in all_targets: | 999 if qualified_target in all_targets: |
| 1001 all_outputs.add(output) | 1000 all_outputs.add(output) |
| 1002 | 1001 |
| 1003 if all_outputs: | 1002 if all_outputs: |
| 1004 master_ninja.build('all', 'phony', list(all_outputs)) | 1003 master_ninja.build('all', 'phony', list(all_outputs)) |
| OLD | NEW |