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 pdbpath_c = pdbpath_cc = self.msvs_settings.GetCompilerPdbName( |
Nico
2013/11/27 00:13:19
Comment why there are two pdbs (link to review com
| |
818 config_name, self.ExpandSpecial) | 818 config_name, self.ExpandSpecial) |
819 if not pdbpath: | 819 if not pdbpath_c: |
820 obj = 'obj' | 820 obj = 'obj' |
821 if self.toolset != 'target': | 821 if self.toolset != 'target': |
822 obj += '.' + self.toolset | 822 obj += '.' + self.toolset |
823 pdbpath = os.path.normpath(os.path.join(obj, self.base_dir, | 823 pdbpath = os.path.normpath(os.path.join(obj, self.base_dir, self.name)) |
824 self.name + '.pdb')) | 824 pdbpath_c = pdbpath + '.c.pdb' |
825 self.WriteVariableList(ninja_file, 'pdbname', [pdbpath]) | 825 pdbpath_cc = pdbpath + '.cc.pdb' |
826 self.WriteVariableList(ninja_file, 'pdbname_c', [pdbpath_c]) | |
827 self.WriteVariableList(ninja_file, 'pdbname_cc', [pdbpath_cc]) | |
826 self.WriteVariableList(ninja_file, 'pchprefix', [self.name]) | 828 self.WriteVariableList(ninja_file, 'pchprefix', [self.name]) |
827 else: | 829 else: |
828 cflags = config.get('cflags', []) | 830 cflags = config.get('cflags', []) |
829 cflags_c = config.get('cflags_c', []) | 831 cflags_c = config.get('cflags_c', []) |
830 cflags_cc = config.get('cflags_cc', []) | 832 cflags_cc = config.get('cflags_cc', []) |
831 | 833 |
832 # Respect environment variables related to build, but target-specific | 834 # Respect environment variables related to build, but target-specific |
833 # flags can still override them. | 835 # flags can still override them. |
834 if self.toolset == 'target': | 836 if self.toolset == 'target': |
835 cflags_c = (os.environ.get('CPPFLAGS', '').split() + | 837 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 ' | 1792 command=('$cc $defines $includes $cflags $cflags_c ' |
1791 '$cflags_pch_c -c $in -o $out')) | 1793 '$cflags_pch_c -c $in -o $out')) |
1792 master_ninja.rule( | 1794 master_ninja.rule( |
1793 'cxx', | 1795 'cxx', |
1794 description='CXX $out', | 1796 description='CXX $out', |
1795 command=('$cxx -MMD -MF $out.d $defines $includes $cflags $cflags_cc ' | 1797 command=('$cxx -MMD -MF $out.d $defines $includes $cflags $cflags_cc ' |
1796 '$cflags_pch_cc -c $in -o $out'), | 1798 '$cflags_pch_cc -c $in -o $out'), |
1797 depfile='$out.d', | 1799 depfile='$out.d', |
1798 deps=deps) | 1800 deps=deps) |
1799 else: | 1801 else: |
1802 # TODO(scottmg) Separate pdb names is a test to see if it works around | |
1803 # http://crbug.com/142362. It seems there's a race between the creation of | |
1804 # the .pdb by the precompiled header step for .cc and the compilation of | |
1805 # .c files. This should be handled by mspdbsrv, but rarely errors out with | |
1806 # c1xx : fatal error C1033: cannot open program database | |
1807 # By making the rules target separate pdb files this might be avoided. | |
Nico
2013/11/27 00:13:19
Oh, here it is. The just a comment saying "# See c
scottmg
2013/11/27 00:32:31
Done.
| |
1800 cc_command = ('ninja -t msvc -e $arch ' + | 1808 cc_command = ('ninja -t msvc -e $arch ' + |
1801 '-- ' | 1809 '-- ' |
1802 '$cc /nologo /showIncludes /FC ' | 1810 '$cc /nologo /showIncludes /FC ' |
1803 '@$out.rsp /c $in /Fo$out /Fd$pdbname ') | 1811 '@$out.rsp /c $in /Fo$out /Fd$pdbname_c ') |
1804 cxx_command = ('ninja -t msvc -e $arch ' + | 1812 cxx_command = ('ninja -t msvc -e $arch ' + |
1805 '-- ' | 1813 '-- ' |
1806 '$cxx /nologo /showIncludes /FC ' | 1814 '$cxx /nologo /showIncludes /FC ' |
1807 '@$out.rsp /c $in /Fo$out /Fd$pdbname ') | 1815 '@$out.rsp /c $in /Fo$out /Fd$pdbname_cc ') |
1808 master_ninja.rule( | 1816 master_ninja.rule( |
1809 'cc', | 1817 'cc', |
1810 description='CC $out', | 1818 description='CC $out', |
1811 command=cc_command, | 1819 command=cc_command, |
1812 rspfile='$out.rsp', | 1820 rspfile='$out.rsp', |
1813 rspfile_content='$defines $includes $cflags $cflags_c', | 1821 rspfile_content='$defines $includes $cflags $cflags_c', |
1814 deps=deps) | 1822 deps=deps) |
1815 master_ninja.rule( | 1823 master_ninja.rule( |
1816 'cxx', | 1824 'cxx', |
1817 description='CXX $out', | 1825 description='CXX $out', |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2142 arglists.append( | 2150 arglists.append( |
2143 (target_list, target_dicts, data, params, config_name)) | 2151 (target_list, target_dicts, data, params, config_name)) |
2144 pool.map(CallGenerateOutputForConfig, arglists) | 2152 pool.map(CallGenerateOutputForConfig, arglists) |
2145 except KeyboardInterrupt, e: | 2153 except KeyboardInterrupt, e: |
2146 pool.terminate() | 2154 pool.terminate() |
2147 raise e | 2155 raise e |
2148 else: | 2156 else: |
2149 for config_name in config_names: | 2157 for config_name in config_names: |
2150 GenerateOutputForConfig(target_list, target_dicts, data, params, | 2158 GenerateOutputForConfig(target_list, target_dicts, data, params, |
2151 config_name) | 2159 config_name) |
OLD | NEW |