| OLD | NEW |
| 1 # Copyright (c) 2013 Google Inc. All rights reserved. | 1 # Copyright (c) 2013 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 copy | 5 import copy |
| 6 import hashlib | 6 import hashlib |
| 7 import json | 7 import json |
| 8 import multiprocessing | 8 import multiprocessing |
| 9 import os.path | 9 import os.path |
| 10 import re | 10 import re |
| (...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 cflags_cc = self.xcode_settings.GetCflagsCC(config_name) | 807 cflags_cc = self.xcode_settings.GetCflagsCC(config_name) |
| 808 cflags_objc = ['$cflags_c'] + \ | 808 cflags_objc = ['$cflags_c'] + \ |
| 809 self.xcode_settings.GetCflagsObjC(config_name) | 809 self.xcode_settings.GetCflagsObjC(config_name) |
| 810 cflags_objcc = ['$cflags_cc'] + \ | 810 cflags_objcc = ['$cflags_cc'] + \ |
| 811 self.xcode_settings.GetCflagsObjCC(config_name) | 811 self.xcode_settings.GetCflagsObjCC(config_name) |
| 812 elif self.flavor == 'win': | 812 elif self.flavor == 'win': |
| 813 cflags = self.msvs_settings.GetCflags(config_name) | 813 cflags = self.msvs_settings.GetCflags(config_name) |
| 814 cflags_c = self.msvs_settings.GetCflagsC(config_name) | 814 cflags_c = self.msvs_settings.GetCflagsC(config_name) |
| 815 cflags_cc = self.msvs_settings.GetCflagsCC(config_name) | 815 cflags_cc = self.msvs_settings.GetCflagsCC(config_name) |
| 816 extra_defines = self.msvs_settings.GetComputedDefines(config_name) | 816 extra_defines = self.msvs_settings.GetComputedDefines(config_name) |
| 817 pdbpath = self.msvs_settings.GetCompilerPdbName( | 817 # See comment at cc_command for why there's two .pdb files. |
| 818 pdbpath_c = pdbpath_cc = self.msvs_settings.GetCompilerPdbName( |
| 818 config_name, self.ExpandSpecial) | 819 config_name, self.ExpandSpecial) |
| 819 if not pdbpath: | 820 if not pdbpath_c: |
| 820 obj = 'obj' | 821 obj = 'obj' |
| 821 if self.toolset != 'target': | 822 if self.toolset != 'target': |
| 822 obj += '.' + self.toolset | 823 obj += '.' + self.toolset |
| 823 pdbpath = os.path.normpath(os.path.join(obj, self.base_dir, | 824 pdbpath = os.path.normpath(os.path.join(obj, self.base_dir, self.name)) |
| 824 self.name + '.pdb')) | 825 pdbpath_c = pdbpath + '.c.pdb' |
| 825 self.WriteVariableList(ninja_file, 'pdbname', [pdbpath]) | 826 pdbpath_cc = pdbpath + '.cc.pdb' |
| 827 self.WriteVariableList(ninja_file, 'pdbname_c', [pdbpath_c]) |
| 828 self.WriteVariableList(ninja_file, 'pdbname_cc', [pdbpath_cc]) |
| 826 self.WriteVariableList(ninja_file, 'pchprefix', [self.name]) | 829 self.WriteVariableList(ninja_file, 'pchprefix', [self.name]) |
| 827 else: | 830 else: |
| 828 cflags = config.get('cflags', []) | 831 cflags = config.get('cflags', []) |
| 829 cflags_c = config.get('cflags_c', []) | 832 cflags_c = config.get('cflags_c', []) |
| 830 cflags_cc = config.get('cflags_cc', []) | 833 cflags_cc = config.get('cflags_cc', []) |
| 831 | 834 |
| 832 # Respect environment variables related to build, but target-specific | 835 # Respect environment variables related to build, but target-specific |
| 833 # flags can still override them. | 836 # flags can still override them. |
| 834 if self.toolset == 'target': | 837 if self.toolset == 'target': |
| 835 cflags_c = (os.environ.get('CPPFLAGS', '').split() + | 838 cflags_c = (os.environ.get('CPPFLAGS', '').split() + |
| (...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1790 command=('$cc $defines $includes $cflags $cflags_c ' | 1793 command=('$cc $defines $includes $cflags $cflags_c ' |
| 1791 '$cflags_pch_c -c $in -o $out')) | 1794 '$cflags_pch_c -c $in -o $out')) |
| 1792 master_ninja.rule( | 1795 master_ninja.rule( |
| 1793 'cxx', | 1796 'cxx', |
| 1794 description='CXX $out', | 1797 description='CXX $out', |
| 1795 command=('$cxx -MMD -MF $out.d $defines $includes $cflags $cflags_cc ' | 1798 command=('$cxx -MMD -MF $out.d $defines $includes $cflags $cflags_cc ' |
| 1796 '$cflags_pch_cc -c $in -o $out'), | 1799 '$cflags_pch_cc -c $in -o $out'), |
| 1797 depfile='$out.d', | 1800 depfile='$out.d', |
| 1798 deps=deps) | 1801 deps=deps) |
| 1799 else: | 1802 else: |
| 1803 # TODO(scottmg) Separate pdb names is a test to see if it works around |
| 1804 # http://crbug.com/142362. It seems there's a race between the creation of |
| 1805 # the .pdb by the precompiled header step for .cc and the compilation of |
| 1806 # .c files. This should be handled by mspdbsrv, but rarely errors out with |
| 1807 # c1xx : fatal error C1033: cannot open program database |
| 1808 # By making the rules target separate pdb files this might be avoided. |
| 1800 cc_command = ('ninja -t msvc -e $arch ' + | 1809 cc_command = ('ninja -t msvc -e $arch ' + |
| 1801 '-- ' | 1810 '-- ' |
| 1802 '$cc /nologo /showIncludes /FC ' | 1811 '$cc /nologo /showIncludes /FC ' |
| 1803 '@$out.rsp /c $in /Fo$out /Fd$pdbname ') | 1812 '@$out.rsp /c $in /Fo$out /Fd$pdbname_c ') |
| 1804 cxx_command = ('ninja -t msvc -e $arch ' + | 1813 cxx_command = ('ninja -t msvc -e $arch ' + |
| 1805 '-- ' | 1814 '-- ' |
| 1806 '$cxx /nologo /showIncludes /FC ' | 1815 '$cxx /nologo /showIncludes /FC ' |
| 1807 '@$out.rsp /c $in /Fo$out /Fd$pdbname ') | 1816 '@$out.rsp /c $in /Fo$out /Fd$pdbname_cc ') |
| 1808 master_ninja.rule( | 1817 master_ninja.rule( |
| 1809 'cc', | 1818 'cc', |
| 1810 description='CC $out', | 1819 description='CC $out', |
| 1811 command=cc_command, | 1820 command=cc_command, |
| 1812 rspfile='$out.rsp', | 1821 rspfile='$out.rsp', |
| 1813 rspfile_content='$defines $includes $cflags $cflags_c', | 1822 rspfile_content='$defines $includes $cflags $cflags_c', |
| 1814 deps=deps) | 1823 deps=deps) |
| 1815 master_ninja.rule( | 1824 master_ninja.rule( |
| 1816 'cxx', | 1825 'cxx', |
| 1817 description='CXX $out', | 1826 description='CXX $out', |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2142 arglists.append( | 2151 arglists.append( |
| 2143 (target_list, target_dicts, data, params, config_name)) | 2152 (target_list, target_dicts, data, params, config_name)) |
| 2144 pool.map(CallGenerateOutputForConfig, arglists) | 2153 pool.map(CallGenerateOutputForConfig, arglists) |
| 2145 except KeyboardInterrupt, e: | 2154 except KeyboardInterrupt, e: |
| 2146 pool.terminate() | 2155 pool.terminate() |
| 2147 raise e | 2156 raise e |
| 2148 else: | 2157 else: |
| 2149 for config_name in config_names: | 2158 for config_name in config_names: |
| 2150 GenerateOutputForConfig(target_list, target_dicts, data, params, | 2159 GenerateOutputForConfig(target_list, target_dicts, data, params, |
| 2151 config_name) | 2160 config_name) |
| OLD | NEW |