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

Side by Side Diff: SConstruct

Issue 788193003: Create a build_config header file. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Support scons windows as well. Created 6 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | build/untrusted.gypi » ('j') | src/include/checked_cast.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #! -*- python -*- 1 #! -*- python -*-
2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import atexit 6 import atexit
7 import json 7 import json
8 import os 8 import os
9 import platform 9 import platform
10 import re 10 import re
(...skipping 2124 matching lines...) Expand 10 before | Expand all | Expand 10 after
2135 directory name. If the argument is missing, raise a UserError saying 2135 directory name. If the argument is missing, raise a UserError saying
2136 that the given target requires that argument be given.""" 2136 that the given target requires that argument be given."""
2137 dir = ARGUMENTS.get(argument) 2137 dir = ARGUMENTS.get(argument)
2138 if not dir: 2138 if not dir:
2139 raise UserError('%s must be set when invoking %s' % (argument, target)) 2139 raise UserError('%s must be set when invoking %s' % (argument, target))
2140 return os.path.join(env.Dir('$MAIN_DIR').abspath, dir) 2140 return os.path.join(env.Dir('$MAIN_DIR').abspath, dir)
2141 2141
2142 pre_base_env.AddMethod(GetAbsDirArg) 2142 pre_base_env.AddMethod(GetAbsDirArg)
2143 2143
2144 2144
2145 pre_base_env.Append(
2146 CPPDEFINES = [
2147 ['NACL_BUILD_ARCH', '${BUILD_ARCHITECTURE}' ],
2148 ['NACL_BUILD_SUBARCH', '${BUILD_SUBARCH}' ],
2149 ],
2150 )
2151
2152 def MakeGTestEnv(env): 2145 def MakeGTestEnv(env):
2153 # Create an environment to run unit tests using Gtest. 2146 # Create an environment to run unit tests using Gtest.
2154 gtest_env = env.Clone() 2147 gtest_env = env.Clone()
2155 2148
2156 # This became necessary for the arm cross TC v4.6 2149 # This became necessary for the arm cross TC v4.6
2157 # but probable applies to all new gcc TCs 2150 # but probable applies to all new gcc TCs
2158 gtest_env.Append(LINKFLAGS=['-pthread']) 2151 gtest_env.Append(LINKFLAGS=['-pthread'])
2159 2152
2160 # Define compile-time flag that communicates that we are compiling in the test 2153 # Define compile-time flag that communicates that we are compiling in the test
2161 # environment (rather than for the TCB). 2154 # environment (rather than for the TCB).
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
2443 '$WINASM -defsym @feat.00=1 -o $TARGET'), 2436 '$WINASM -defsym @feat.00=1 -o $TARGET'),
2444 PDB = '${TARGET.base}.pdb', 2437 PDB = '${TARGET.base}.pdb',
2445 # Strict doesn't currently work for Windows since some of the system 2438 # Strict doesn't currently work for Windows since some of the system
2446 # libraries like wsock32 are magical. 2439 # libraries like wsock32 are magical.
2447 LIBS_STRICT = False, 2440 LIBS_STRICT = False,
2448 TARGET_ARCH='x86_64' if base_env.Bit('build_x86_64') else 'x86', 2441 TARGET_ARCH='x86_64' if base_env.Bit('build_x86_64') else 'x86',
2449 ) 2442 )
2450 2443
2451 windows_env.Append( 2444 windows_env.Append(
2452 CPPDEFINES = [ 2445 CPPDEFINES = [
2453 ['NACL_WINDOWS', '1'],
2454 ['NACL_OSX', '0'],
2455 ['NACL_LINUX', '0'],
2456 ['NACL_ANDROID', '0'],
2457 ['_WIN32_WINNT', '0x0501'], 2446 ['_WIN32_WINNT', '0x0501'],
2458 ['__STDC_LIMIT_MACROS', '1'], 2447 ['__STDC_LIMIT_MACROS', '1'],
2459 ['NOMINMAX', '1'], 2448 ['NOMINMAX', '1'],
2460 # WIN32 is used by ppapi 2449 # WIN32 is used by ppapi
2461 ['WIN32', '1'], 2450 ['WIN32', '1'],
2462 # WIN32_LEAN_AND_MEAN tells windows.h to omit obsolete and rarely 2451 # WIN32_LEAN_AND_MEAN tells windows.h to omit obsolete and rarely
2463 # used #include files. This allows use of Winsock 2.0 which otherwise 2452 # used #include files. This allows use of Winsock 2.0 which otherwise
2464 # would conflict with Winsock 1.x included by windows.h. 2453 # would conflict with Winsock 1.x included by windows.h.
2465 ['WIN32_LEAN_AND_MEAN', ''], 2454 ['WIN32_LEAN_AND_MEAN', ''],
2466 ], 2455 ],
2467 LIBS = ['ws2_32', 'advapi32'], 2456 LIBS = ['ws2_32', 'advapi32'],
2468 # TODO(bsy) remove 4355 once cross-repo 2457 # TODO(bsy) remove 4355 once cross-repo
2469 # NACL_ALLOW_THIS_IN_INITIALIZER_LIST changes go in. 2458 # NACL_ALLOW_THIS_IN_INITIALIZER_LIST changes go in.
2470 CCFLAGS = ['/EHsc', '/WX', '/wd4355', '/wd4800'], 2459 CCFLAGS = ['/EHsc', '/WX', '/wd4355', '/wd4800', '/FI',
2460 '$SOURCE_ROOT/native_client/src/include/build_config.h']
Mark Seaborn 2014/12/19 17:46:19 Can you put '/FI' on the same line as this, to mak
2471 ) 2461 )
2472 2462
2473 # This linker option allows us to ensure our builds are compatible with 2463 # This linker option allows us to ensure our builds are compatible with
2474 # Chromium, which uses it. 2464 # Chromium, which uses it.
2475 if windows_env.Bit('build_x86_32'): 2465 if windows_env.Bit('build_x86_32'):
2476 windows_env.Append(LINKFLAGS = "/safeseh") 2466 windows_env.Append(LINKFLAGS = "/safeseh")
2477 2467
2478 # We use the GNU assembler (gas) on Windows so that we can use the 2468 # We use the GNU assembler (gas) on Windows so that we can use the
2479 # same .S assembly files on all platforms. Microsoft's assembler uses 2469 # same .S assembly files on all platforms. Microsoft's assembler uses
2480 # a completely different syntax for x86 code. 2470 # a completely different syntax for x86 code.
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
2571 2561
2572 subarch_flag = '-m%s' % mac_env['BUILD_SUBARCH'] 2562 subarch_flag = '-m%s' % mac_env['BUILD_SUBARCH']
2573 mac_env.Append( 2563 mac_env.Append(
2574 CCFLAGS=[subarch_flag, '-fPIC'], 2564 CCFLAGS=[subarch_flag, '-fPIC'],
2575 ASFLAGS=[subarch_flag], 2565 ASFLAGS=[subarch_flag],
2576 LINKFLAGS=[subarch_flag, '-fPIC'], 2566 LINKFLAGS=[subarch_flag, '-fPIC'],
2577 CPPDEFINES = [['NACL_WINDOWS', '0'], 2567 CPPDEFINES = [['NACL_WINDOWS', '0'],
2578 ['NACL_OSX', '1'], 2568 ['NACL_OSX', '1'],
2579 ['NACL_LINUX', '0'], 2569 ['NACL_LINUX', '0'],
2580 ['NACL_ANDROID', '0'], 2570 ['NACL_ANDROID', '0'],
2571 ['NACL_BUILD_ARCH', '${BUILD_ARCHITECTURE}' ],
2572 ['NACL_BUILD_SUBARCH', '${BUILD_SUBARCH}' ],
2581 # defining _DARWIN_C_SOURCE breaks 10.4 2573 # defining _DARWIN_C_SOURCE breaks 10.4
2582 #['_DARWIN_C_SOURCE', '1'], 2574 #['_DARWIN_C_SOURCE', '1'],
2583 #['__STDC_LIMIT_MACROS', '1'] 2575 #['__STDC_LIMIT_MACROS', '1']
2584 ], 2576 ],
2585 ) 2577 )
2586 return mac_env 2578 return mac_env
2587 2579
2588 (mac_debug_env, mac_optimized_env) = GenerateOptimizationLevels(MakeMacEnv()) 2580 (mac_debug_env, mac_optimized_env) = GenerateOptimizationLevels(MakeMacEnv())
2589 2581
2590 2582
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
2793 BUILD_TYPE_DESCRIPTION = 'Linux ${OPTIMIZATION_LEVEL} build', 2785 BUILD_TYPE_DESCRIPTION = 'Linux ${OPTIMIZATION_LEVEL} build',
2794 tools = ['target_platform_linux'], 2786 tools = ['target_platform_linux'],
2795 # TODO(bradnelson): this should really be able to live in unix_like_env 2787 # TODO(bradnelson): this should really be able to live in unix_like_env
2796 # but can't due to what the target_platform_x module is 2788 # but can't due to what the target_platform_x module is
2797 # doing. 2789 # doing.
2798 LINK = '$CXX', 2790 LINK = '$CXX',
2799 ) 2791 )
2800 2792
2801 # Prepend so we can disable warnings via Append 2793 # Prepend so we can disable warnings via Append
2802 linux_env.Prepend( 2794 linux_env.Prepend(
2803 CPPDEFINES = [['NACL_WINDOWS', '0'], 2795 CPPDEFINES = [['_DEFAULT_SOURCE', '1'],
2804 ['NACL_OSX', '0'],
2805 ['NACL_LINUX', '1'],
2806 ['NACL_ANDROID', '0'],
2807 ['_DEFAULT_SOURCE', '1'],
2808 ['_BSD_SOURCE', '1'], 2796 ['_BSD_SOURCE', '1'],
2809 ['_POSIX_C_SOURCE', '199506'], 2797 ['_POSIX_C_SOURCE', '199506'],
2810 ['_XOPEN_SOURCE', '600'], 2798 ['_XOPEN_SOURCE', '600'],
2811 ['_GNU_SOURCE', '1'], 2799 ['_GNU_SOURCE', '1'],
2812 ['_LARGEFILE64_SOURCE', '1'], 2800 ['_LARGEFILE64_SOURCE', '1'],
2813 ], 2801 ],
2814 LIBS = ['rt'], 2802 LIBS = ['rt'],
2815 ) 2803 )
2816 2804
2817 if linux_env.Bit('build_x86_32'): 2805 if linux_env.Bit('build_x86_32'):
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
3111 ['_POSIX_C_SOURCE', '199506'], 3099 ['_POSIX_C_SOURCE', '199506'],
3112 ['_XOPEN_SOURCE', '600'], 3100 ['_XOPEN_SOURCE', '600'],
3113 3101
3114 ['DYNAMIC_ANNOTATIONS_ENABLED', '1' ], 3102 ['DYNAMIC_ANNOTATIONS_ENABLED', '1' ],
3115 ['DYNAMIC_ANNOTATIONS_PREFIX', 'NACL_' ], 3103 ['DYNAMIC_ANNOTATIONS_PREFIX', 'NACL_' ],
3116 3104
3117 ['NACL_WINDOWS', '0'], 3105 ['NACL_WINDOWS', '0'],
3118 ['NACL_OSX', '0'], 3106 ['NACL_OSX', '0'],
3119 ['NACL_LINUX', '0'], 3107 ['NACL_LINUX', '0'],
3120 ['NACL_ANDROID', '0'], 3108 ['NACL_ANDROID', '0'],
3109 ['NACL_BUILD_ARCH', '${BUILD_ARCHITECTURE}' ],
3110 ['NACL_BUILD_SUBARCH', '${BUILD_SUBARCH}' ],
3121 ], 3111 ],
3122 ) 3112 )
3123 3113
3124 def FixWindowsAssembler(env): 3114 def FixWindowsAssembler(env):
3125 if env.Bit('host_windows'): 3115 if env.Bit('host_windows'):
3126 # NOTE: This is needed because Windows builds are case-insensitive. 3116 # NOTE: This is needed because Windows builds are case-insensitive.
3127 # Without this we use nacl-as, which doesn't handle include directives, etc. 3117 # Without this we use nacl-as, which doesn't handle include directives, etc.
3128 env.Replace(ASCOM='${CCCOM}') 3118 env.Replace(ASCOM='${CCCOM}')
3129 3119
3130 FixWindowsAssembler(nacl_env) 3120 FixWindowsAssembler(nacl_env)
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
3474 3464
3475 nacl_env.AddMethod(NaClSdkLibrary) 3465 nacl_env.AddMethod(NaClSdkLibrary)
3476 3466
3477 3467
3478 # Special environment for untrusted test binaries that use raw syscalls 3468 # Special environment for untrusted test binaries that use raw syscalls
3479 def RawSyscallObjects(env, sources): 3469 def RawSyscallObjects(env, sources):
3480 raw_syscall_env = env.Clone() 3470 raw_syscall_env = env.Clone()
3481 raw_syscall_env.Append( 3471 raw_syscall_env.Append(
3482 CPPDEFINES = [ 3472 CPPDEFINES = [
3483 ['USE_RAW_SYSCALLS', '1'], 3473 ['USE_RAW_SYSCALLS', '1'],
3484 ['NACL_BUILD_ARCH', '${BUILD_ARCHITECTURE}' ],
3485 ['NACL_BUILD_SUBARCH', '${BUILD_SUBARCH}' ],
3486 ], 3474 ],
3487 ) 3475 )
3488 objects = [] 3476 objects = []
3489 for source_file in sources: 3477 for source_file in sources:
3490 target_name = 'raw_' + os.path.basename(source_file).rstrip('.c') 3478 target_name = 'raw_' + os.path.basename(source_file).rstrip('.c')
3491 object = raw_syscall_env.ComponentObject(target_name, 3479 object = raw_syscall_env.ComponentObject(target_name,
3492 source_file) 3480 source_file)
3493 objects.append(object) 3481 objects.append(object)
3494 return objects 3482 return objects
3495 3483
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
4044 nacl_env.ValidateSdk() 4032 nacl_env.ValidateSdk()
4045 4033
4046 if BROKEN_TEST_COUNT > 0: 4034 if BROKEN_TEST_COUNT > 0:
4047 msg = "There are %d broken tests." % BROKEN_TEST_COUNT 4035 msg = "There are %d broken tests." % BROKEN_TEST_COUNT
4048 if GetOption('brief_comstr'): 4036 if GetOption('brief_comstr'):
4049 msg += " Add --verbose to the command line for more information." 4037 msg += " Add --verbose to the command line for more information."
4050 print msg 4038 print msg
4051 4039
4052 # separate warnings from actual build output 4040 # separate warnings from actual build output
4053 Banner('B U I L D - O U T P U T:') 4041 Banner('B U I L D - O U T P U T:')
OLDNEW
« no previous file with comments | « no previous file | build/untrusted.gypi » ('j') | src/include/checked_cast.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698