Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: SConstruct

Issue 6539006: Autodetect no-strict-aliasing, propagate toolchain option to SCons (Closed)
Patch Set: Updated patch Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/SConscript » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2010 the V8 project authors. All rights reserved. 1 # Copyright 2010 the V8 project authors. All rights reserved.
2 # Redistribution and use in source and binary forms, with or without 2 # Redistribution and use in source and binary forms, with or without
3 # modification, are permitted provided that the following conditions are 3 # modification, are permitted provided that the following conditions are
4 # met: 4 # met:
5 # 5 #
6 # * Redistributions of source code must retain the above copyright 6 # * Redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer. 7 # notice, this list of conditions and the following disclaimer.
8 # * Redistributions in binary form must reproduce the above 8 # * Redistributions in binary form must reproduce the above
9 # copyright notice, this list of conditions and the following 9 # copyright notice, this list of conditions and the following
10 # disclaimer in the documentation and/or other materials provided 10 # disclaimer in the documentation and/or other materials provided
11 # with the distribution. 11 # with the distribution.
12 # * Neither the name of Google Inc. nor the names of its 12 # * Neither the name of Google Inc. nor the names of its
13 # contributors may be used to endorse or promote products derived 13 # contributors may be used to endorse or promote products derived
14 # from this software without specific prior written permission. 14 # from this software without specific prior written permission.
15 # 15 #
16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 import platform 28 import platform
29 import re 29 import re
30 import subprocess
30 import sys 31 import sys
31 import os 32 import os
32 from os.path import join, dirname, abspath 33 from os.path import join, dirname, abspath
33 from types import DictType, StringTypes 34 from types import DictType, StringTypes
34 root_dir = dirname(File('SConstruct').rfile().abspath) 35 root_dir = dirname(File('SConstruct').rfile().abspath)
35 sys.path.insert(0, join(root_dir, 'tools')) 36 sys.path.insert(0, join(root_dir, 'tools'))
36 import js2c, utils 37 import js2c, utils
37 38
38 # ANDROID_TOP is the top of the Android checkout, fetched from the environment 39 # ANDROID_TOP is the top of the Android checkout, fetched from the environment
39 # variable 'TOP'. You will also need to set the CXX, CC, AR and RANLIB 40 # variable 'TOP'. You will also need to set the CXX, CC, AR and RANLIB
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 }, 136 },
136 'gcc': { 137 'gcc': {
137 'all': { 138 'all': {
138 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], 139 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'],
139 'CXXFLAGS': ['$CCFLAGS', '-fno-rtti', '-fno-exceptions'], 140 'CXXFLAGS': ['$CCFLAGS', '-fno-rtti', '-fno-exceptions'],
140 }, 141 },
141 'visibility:hidden': { 142 'visibility:hidden': {
142 # Use visibility=default to disable this. 143 # Use visibility=default to disable this.
143 'CXXFLAGS': ['-fvisibility=hidden'] 144 'CXXFLAGS': ['-fvisibility=hidden']
144 }, 145 },
146 'strictaliasing:off': {
147 'CCFLAGS': ['-fno-strict-aliasing']
148 },
145 'mode:debug': { 149 'mode:debug': {
146 'CCFLAGS': ['-g', '-O0'], 150 'CCFLAGS': ['-g', '-O0'],
147 'CPPDEFINES': ['ENABLE_DISASSEMBLER', 'DEBUG'], 151 'CPPDEFINES': ['ENABLE_DISASSEMBLER', 'DEBUG'],
148 'os:android': { 152 'os:android': {
149 'CCFLAGS': ['-mthumb'] 153 'CCFLAGS': ['-mthumb']
150 } 154 }
151 }, 155 },
152 'mode:release': { 156 'mode:release': {
153 'CCFLAGS': ['-O3', '-fomit-frame-pointer', '-fdata-sections', 157 'CCFLAGS': ['-O3', '-fomit-frame-pointer', '-fdata-sections',
154 '-ffunction-sections'], 158 '-ffunction-sections'],
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 'release': '', 649 'release': '',
646 'debug': '_g' 650 'debug': '_g'
647 } 651 }
648 652
649 653
650 def Abort(message): 654 def Abort(message):
651 print message 655 print message
652 sys.exit(1) 656 sys.exit(1)
653 657
654 658
655 def GuessToolchain(os): 659 def GuessOS(env):
656 tools = Environment()['TOOLS'] 660 return utils.GuessOS()
661
662
663 def GuessArch(env):
664 return utils.GuessArchitecture()
665
666
667 def GuessToolchain(env):
668 tools = env['TOOLS']
657 if 'gcc' in tools: 669 if 'gcc' in tools:
658 return 'gcc' 670 return 'gcc'
659 elif 'msvc' in tools: 671 elif 'msvc' in tools:
660 return 'msvc' 672 return 'msvc'
661 else: 673 else:
662 return None 674 return None
663 675
664 676
665 def GuessVisibility(os, toolchain): 677 def GuessVisibility(env):
678 os = env['os']
679 toolchain = env['toolchain'];
666 if (os == 'win32' or os == 'cygwin') and toolchain == 'gcc': 680 if (os == 'win32' or os == 'cygwin') and toolchain == 'gcc':
667 # MinGW / Cygwin can't do it. 681 # MinGW / Cygwin can't do it.
668 return 'default' 682 return 'default'
669 elif os == 'solaris': 683 elif os == 'solaris':
670 return 'default' 684 return 'default'
671 else: 685 else:
672 return 'hidden' 686 return 'hidden'
673 687
674 688
675 OS_GUESS = utils.GuessOS() 689 def GuessStrictAliasing(env):
676 TOOLCHAIN_GUESS = GuessToolchain(OS_GUESS) 690 # There seems to be a problem with gcc 4.5.x.
677 ARCH_GUESS = utils.GuessArchitecture() 691 # See http://code.google.com/p/v8/issues/detail?id=884
678 VISIBILITY_GUESS = GuessVisibility(OS_GUESS, TOOLCHAIN_GUESS) 692 # It can be worked around by disabling strict aliasing.
693 toolchain = env['toolchain'];
694 if toolchain == 'gcc':
695 env = Environment(tools=['gcc'])
696 # The gcc version should be available in env['CCVERSION'],
697 # but when scons detects msvc this value is not set.
698 version = subprocess.Popen([env['CC'], '-dumpversion'],
699 stdout=subprocess.PIPE).communicate()[0]
700 if version.find('4.5') == 0:
701 return 'off'
702 return 'default'
679 703
680 704
681 SIMPLE_OPTIONS = { 705 PLATFORM_OPTIONS = {
682 'toolchain': { 706 'arch': {
683 'values': ['gcc', 'msvc'], 707 'values': ['arm', 'ia32', 'x64', 'mips'],
684 'default': TOOLCHAIN_GUESS, 708 'guess': GuessArch,
685 'help': 'the toolchain to use (%s)' % TOOLCHAIN_GUESS 709 'help': 'the architecture to build for'
686 }, 710 },
687 'os': { 711 'os': {
688 'values': ['freebsd', 'linux', 'macos', 'win32', 'android', 'openbsd', 'sola ris', 'cygwin'], 712 'values': ['freebsd', 'linux', 'macos', 'win32', 'android', 'openbsd', 'sola ris', 'cygwin'],
689 'default': OS_GUESS, 713 'guess': GuessOS,
690 'help': 'the os to build for (%s)' % OS_GUESS 714 'help': 'the os to build for'
691 }, 715 },
692 'arch': { 716 'toolchain': {
693 'values':['arm', 'ia32', 'x64', 'mips'], 717 'values': ['gcc', 'msvc'],
694 'default': ARCH_GUESS, 718 'guess': GuessToolchain,
695 'help': 'the architecture to build for (%s)' % ARCH_GUESS 719 'help': 'the toolchain to use'
696 }, 720 }
721 }
722
723 SIMPLE_OPTIONS = {
697 'regexp': { 724 'regexp': {
698 'values': ['native', 'interpreted'], 725 'values': ['native', 'interpreted'],
699 'default': 'native', 726 'default': 'native',
700 'help': 'Whether to use native or interpreted regexp implementation' 727 'help': 'Whether to use native or interpreted regexp implementation'
701 }, 728 },
702 'snapshot': { 729 'snapshot': {
703 'values': ['on', 'off', 'nobuild'], 730 'values': ['on', 'off', 'nobuild'],
704 'default': 'off', 731 'default': 'off',
705 'help': 'build using snapshots for faster start-up' 732 'help': 'build using snapshots for faster start-up'
706 }, 733 },
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 'default': 'dumb', 821 'default': 'dumb',
795 'help': 'the console to use for the d8 shell' 822 'help': 'the console to use for the d8 shell'
796 }, 823 },
797 'verbose': { 824 'verbose': {
798 'values': ['on', 'off'], 825 'values': ['on', 'off'],
799 'default': 'off', 826 'default': 'off',
800 'help': 'more output from compiler and linker' 827 'help': 'more output from compiler and linker'
801 }, 828 },
802 'visibility': { 829 'visibility': {
803 'values': ['default', 'hidden'], 830 'values': ['default', 'hidden'],
804 'default': VISIBILITY_GUESS, 831 'guess': GuessVisibility,
805 'help': 'shared library symbol visibility (%s)' % VISIBILITY_GUESS 832 'help': 'shared library symbol visibility'
833 },
834 'strictaliasing': {
835 'values': ['default', 'off'],
836 'guess': GuessStrictAliasing,
837 'help': 'assume strict aliasing while optimizing'
806 }, 838 },
807 'pgo': { 839 'pgo': {
808 'values': ['off', 'instrument', 'optimize'], 840 'values': ['off', 'instrument', 'optimize'],
809 'default': 'off', 841 'default': 'off',
810 'help': 'select profile guided optimization variant', 842 'help': 'select profile guided optimization variant',
811 } 843 }
812 } 844 }
813 845
846 ALL_OPTIONS = dict(PLATFORM_OPTIONS, **SIMPLE_OPTIONS)
847
848
849 def AddOptions(options, result):
850 guess_env = Environment(options=result)
851 for (name, option) in options.iteritems():
852 if 'guess' in option:
853 # Option has a guess function
854 guess = option.get('guess')
855 default = guess(guess_env)
856 else:
857 # Option has a fixed default
858 default = option.get('default')
859 help = '%s (%s)' % (option.get('help'), ", ".join(option['values']))
860 result.Add(name, help, default)
861
814 862
815 def GetOptions(): 863 def GetOptions():
816 result = Options() 864 result = Options()
817 result.Add('mode', 'compilation mode (debug, release)', 'release') 865 result.Add('mode', 'compilation mode (debug, release)', 'release')
818 result.Add('sample', 'build sample (shell, process, lineprocessor)', '') 866 result.Add('sample', 'build sample (shell, process, lineprocessor)', '')
819 result.Add('cache', 'directory to use for scons build cache', '') 867 result.Add('cache', 'directory to use for scons build cache', '')
820 result.Add('env', 'override environment settings (NAME0:value0,NAME1:value1,.. .)', '') 868 result.Add('env', 'override environment settings (NAME0:value0,NAME1:value1,.. .)', '')
821 result.Add('importenv', 'import environment settings (NAME0,NAME1,...)', '') 869 result.Add('importenv', 'import environment settings (NAME0,NAME1,...)', '')
822 for (name, option) in SIMPLE_OPTIONS.iteritems(): 870 AddOptions(PLATFORM_OPTIONS, result)
823 help = '%s (%s)' % (name, ", ".join(option['values'])) 871 AddOptions(SIMPLE_OPTIONS, result)
824 result.Add(name, help, option.get('default'))
825 return result 872 return result
826 873
827 874
875 def GetTools(opts):
876 env = Environment(options=opts)
877 os = env['os']
878 toolchain = env['toolchain']
879 if os == 'win32' and toolchain == 'gcc':
880 return ['mingw']
881 elif os == 'win32' and toolchain == 'msvc':
882 return ['msvc', 'mslink', 'mslib', 'msvs']
883 else:
884 return ['default']
885
886
828 def GetVersionComponents(): 887 def GetVersionComponents():
829 MAJOR_VERSION_PATTERN = re.compile(r"#define\s+MAJOR_VERSION\s+(.*)") 888 MAJOR_VERSION_PATTERN = re.compile(r"#define\s+MAJOR_VERSION\s+(.*)")
830 MINOR_VERSION_PATTERN = re.compile(r"#define\s+MINOR_VERSION\s+(.*)") 889 MINOR_VERSION_PATTERN = re.compile(r"#define\s+MINOR_VERSION\s+(.*)")
831 BUILD_NUMBER_PATTERN = re.compile(r"#define\s+BUILD_NUMBER\s+(.*)") 890 BUILD_NUMBER_PATTERN = re.compile(r"#define\s+BUILD_NUMBER\s+(.*)")
832 PATCH_LEVEL_PATTERN = re.compile(r"#define\s+PATCH_LEVEL\s+(.*)") 891 PATCH_LEVEL_PATTERN = re.compile(r"#define\s+PATCH_LEVEL\s+(.*)")
833 892
834 patterns = [MAJOR_VERSION_PATTERN, 893 patterns = [MAJOR_VERSION_PATTERN,
835 MINOR_VERSION_PATTERN, 894 MINOR_VERSION_PATTERN,
836 BUILD_NUMBER_PATTERN, 895 BUILD_NUMBER_PATTERN,
837 PATCH_LEVEL_PATTERN] 896 PATCH_LEVEL_PATTERN]
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 if env['soname'] == 'on' and env['library'] == 'static': 956 if env['soname'] == 'on' and env['library'] == 'static':
898 Abort("Shared Object soname not applicable for static library.") 957 Abort("Shared Object soname not applicable for static library.")
899 if env['os'] != 'win32' and env['pgo'] != 'off': 958 if env['os'] != 'win32' and env['pgo'] != 'off':
900 Abort("Profile guided optimization only supported on Windows.") 959 Abort("Profile guided optimization only supported on Windows.")
901 if env['cache'] and not os.path.isdir(env['cache']): 960 if env['cache'] and not os.path.isdir(env['cache']):
902 Abort("The specified cache directory does not exist.") 961 Abort("The specified cache directory does not exist.")
903 if not (env['arch'] == 'arm' or env['simulator'] == 'arm') and ('unalignedacce sses' in ARGUMENTS): 962 if not (env['arch'] == 'arm' or env['simulator'] == 'arm') and ('unalignedacce sses' in ARGUMENTS):
904 print env['arch'] 963 print env['arch']
905 print env['simulator'] 964 print env['simulator']
906 Abort("Option unalignedaccesses only supported for the ARM architecture.") 965 Abort("Option unalignedaccesses only supported for the ARM architecture.")
907 for (name, option) in SIMPLE_OPTIONS.iteritems(): 966 for (name, option) in ALL_OPTIONS.iteritems():
908 if (not option.get('default')) and (name not in ARGUMENTS): 967 if (not name in env):
909 message = ("A value for option %s must be specified (%s)." % 968 message = ("A value for option %s must be specified (%s)." %
910 (name, ", ".join(option['values']))) 969 (name, ", ".join(option['values'])))
911 Abort(message) 970 Abort(message)
912 if not env[name] in option['values']: 971 if not env[name] in option['values']:
913 message = ("Unknown %s value '%s'. Possible values are (%s)." % 972 message = ("Unknown %s value '%s'. Possible values are (%s)." %
914 (name, env[name], ", ".join(option['values']))) 973 (name, env[name], ", ".join(option['values'])))
915 Abort(message) 974 Abort(message)
916 975
917 976
918 class BuildContext(object): 977 class BuildContext(object):
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 if var in os.environ: 1085 if var in os.environ:
1027 overrides[var] = os.environ[var] 1086 overrides[var] = os.environ[var]
1028 for override in arg.split(','): 1087 for override in arg.split(','):
1029 pos = override.find(':') 1088 pos = override.find(':')
1030 if pos == -1: 1089 if pos == -1:
1031 continue 1090 continue
1032 overrides[override[:pos].strip()] = override[pos+1:].strip() 1091 overrides[override[:pos].strip()] = override[pos+1:].strip()
1033 return overrides 1092 return overrides
1034 1093
1035 1094
1036 def BuildSpecific(env, mode, env_overrides): 1095 def BuildSpecific(env, mode, env_overrides, tools):
1037 options = {'mode': mode} 1096 options = {'mode': mode}
1038 for option in SIMPLE_OPTIONS: 1097 for option in ALL_OPTIONS:
1039 options[option] = env[option] 1098 options[option] = env[option]
1040 PostprocessOptions(options, env['os']) 1099 PostprocessOptions(options, env['os'])
1041 1100
1042 context = BuildContext(options, env_overrides, samples=SplitList(env['sample'] )) 1101 context = BuildContext(options, env_overrides, samples=SplitList(env['sample'] ))
1043 1102
1044 # Remove variables which can't be imported from the user's external 1103 # Remove variables which can't be imported from the user's external
1045 # environment into a construction environment. 1104 # environment into a construction environment.
1046 user_environ = os.environ.copy() 1105 user_environ = os.environ.copy()
1047 try: 1106 try:
1048 del user_environ['ENV'] 1107 del user_environ['ENV']
(...skipping 30 matching lines...) Expand all
1079 if context.options['soname'] == 'on': 1138 if context.options['soname'] == 'on':
1080 soname = GetSpecificSONAME() 1139 soname = GetSpecificSONAME()
1081 if soname == '': 1140 if soname == '':
1082 soname = 'lib' + library_name + '.so' 1141 soname = 'lib' + library_name + '.so'
1083 env['SONAME'] = soname 1142 env['SONAME'] = soname
1084 1143
1085 # Build the object files by invoking SCons recursively. 1144 # Build the object files by invoking SCons recursively.
1086 (object_files, shell_files, mksnapshot) = env.SConscript( 1145 (object_files, shell_files, mksnapshot) = env.SConscript(
1087 join('src', 'SConscript'), 1146 join('src', 'SConscript'),
1088 build_dir=join('obj', target_id), 1147 build_dir=join('obj', target_id),
1089 exports='context', 1148 exports='context tools',
1090 duplicate=False 1149 duplicate=False
1091 ) 1150 )
1092 1151
1093 context.mksnapshot_targets.append(mksnapshot) 1152 context.mksnapshot_targets.append(mksnapshot)
1094 1153
1095 # Link the object files into a library. 1154 # Link the object files into a library.
1096 env.Replace(**context.flags['v8']) 1155 env.Replace(**context.flags['v8'])
1097 1156
1098 context.ApplyEnvOverrides(env) 1157 context.ApplyEnvOverrides(env)
1099 if context.options['library'] == 'static': 1158 if context.options['library'] == 'static':
1100 library = env.StaticLibrary(library_name, object_files) 1159 library = env.StaticLibrary(library_name, object_files)
1101 else: 1160 else:
1102 # There seems to be a glitch in the way scons decides where to put 1161 # There seems to be a glitch in the way scons decides where to put
1103 # PDB files when compiling using MSVC so we specify it manually. 1162 # PDB files when compiling using MSVC so we specify it manually.
1104 # This should not affect any other platforms. 1163 # This should not affect any other platforms.
1105 pdb_name = library_name + '.dll.pdb' 1164 pdb_name = library_name + '.dll.pdb'
1106 library = env.SharedLibrary(library_name, object_files, PDB=pdb_name) 1165 library = env.SharedLibrary(library_name, object_files, PDB=pdb_name)
1107 context.library_targets.append(library) 1166 context.library_targets.append(library)
1108 1167
1109 d8_env = Environment() 1168 d8_env = Environment(tools=tools)
1110 d8_env.Replace(**context.flags['d8']) 1169 d8_env.Replace(**context.flags['d8'])
1111 context.ApplyEnvOverrides(d8_env) 1170 context.ApplyEnvOverrides(d8_env)
1112 shell = d8_env.Program('d8' + suffix, object_files + shell_files) 1171 shell = d8_env.Program('d8' + suffix, object_files + shell_files)
1113 context.d8_targets.append(shell) 1172 context.d8_targets.append(shell)
1114 1173
1115 for sample in context.samples: 1174 for sample in context.samples:
1116 sample_env = Environment() 1175 sample_env = Environment(tools=tools)
1117 sample_env.Replace(**context.flags['sample']) 1176 sample_env.Replace(**context.flags['sample'])
1118 sample_env.Prepend(LIBS=[library_name]) 1177 sample_env.Prepend(LIBS=[library_name])
1119 context.ApplyEnvOverrides(sample_env) 1178 context.ApplyEnvOverrides(sample_env)
1120 sample_object = sample_env.SConscript( 1179 sample_object = sample_env.SConscript(
1121 join('samples', 'SConscript'), 1180 join('samples', 'SConscript'),
1122 build_dir=join('obj', 'sample', sample, target_id), 1181 build_dir=join('obj', 'sample', sample, target_id),
1123 exports='sample context', 1182 exports='sample context tools',
1124 duplicate=False 1183 duplicate=False
1125 ) 1184 )
1126 sample_name = sample + suffix 1185 sample_name = sample + suffix
1127 sample_program = sample_env.Program(sample_name, sample_object) 1186 sample_program = sample_env.Program(sample_name, sample_object)
1128 sample_env.Depends(sample_program, library) 1187 sample_env.Depends(sample_program, library)
1129 context.sample_targets.append(sample_program) 1188 context.sample_targets.append(sample_program)
1130 1189
1131 cctest_env = env.Copy() 1190 cctest_env = env.Copy()
1132 cctest_env.Prepend(LIBS=[library_name]) 1191 cctest_env.Prepend(LIBS=[library_name])
1133 cctest_program = cctest_env.SConscript( 1192 cctest_program = cctest_env.SConscript(
1134 join('test', 'cctest', 'SConscript'), 1193 join('test', 'cctest', 'SConscript'),
1135 build_dir=join('obj', 'test', target_id), 1194 build_dir=join('obj', 'test', target_id),
1136 exports='context object_files', 1195 exports='context object_files tools',
1137 duplicate=False 1196 duplicate=False
1138 ) 1197 )
1139 context.cctest_targets.append(cctest_program) 1198 context.cctest_targets.append(cctest_program)
1140 1199
1141 return context 1200 return context
1142 1201
1143 1202
1144 def Build(): 1203 def Build():
1145 opts = GetOptions() 1204 opts = GetOptions()
1146 env = Environment(options=opts) 1205 tools = GetTools(opts)
1206 env = Environment(options=opts, tools=tools)
1207
1147 Help(opts.GenerateHelpText(env)) 1208 Help(opts.GenerateHelpText(env))
1148 VerifyOptions(env) 1209 VerifyOptions(env)
1149 env_overrides = ParseEnvOverrides(env['env'], env['importenv']) 1210 env_overrides = ParseEnvOverrides(env['env'], env['importenv'])
1150 1211
1151 SourceSignatures(env['sourcesignatures']) 1212 SourceSignatures(env['sourcesignatures'])
1152 1213
1153 libraries = [] 1214 libraries = []
1154 mksnapshots = [] 1215 mksnapshots = []
1155 cctests = [] 1216 cctests = []
1156 samples = [] 1217 samples = []
1157 d8s = [] 1218 d8s = []
1158 modes = SplitList(env['mode']) 1219 modes = SplitList(env['mode'])
1159 for mode in modes: 1220 for mode in modes:
1160 context = BuildSpecific(env.Copy(), mode, env_overrides) 1221 context = BuildSpecific(env.Copy(), mode, env_overrides, tools)
1161 libraries += context.library_targets 1222 libraries += context.library_targets
1162 mksnapshots += context.mksnapshot_targets 1223 mksnapshots += context.mksnapshot_targets
1163 cctests += context.cctest_targets 1224 cctests += context.cctest_targets
1164 samples += context.sample_targets 1225 samples += context.sample_targets
1165 d8s += context.d8_targets 1226 d8s += context.d8_targets
1166 1227
1167 env.Alias('library', libraries) 1228 env.Alias('library', libraries)
1168 env.Alias('mksnapshot', mksnapshots) 1229 env.Alias('mksnapshot', mksnapshots)
1169 env.Alias('cctests', cctests) 1230 env.Alias('cctests', cctests)
1170 env.Alias('sample', samples) 1231 env.Alias('sample', samples)
(...skipping 12 matching lines...) Expand all
1183 # version of scons. Also, there's a bug in some revisions that 1244 # version of scons. Also, there's a bug in some revisions that
1184 # doesn't allow this flag to be set, so we swallow any exceptions. 1245 # doesn't allow this flag to be set, so we swallow any exceptions.
1185 # Lovely. 1246 # Lovely.
1186 try: 1247 try:
1187 SetOption('warn', 'no-deprecated') 1248 SetOption('warn', 'no-deprecated')
1188 except: 1249 except:
1189 pass 1250 pass
1190 1251
1191 1252
1192 Build() 1253 Build()
OLDNEW
« no previous file with comments | « no previous file | src/SConscript » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698