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

Unified 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: mac gypi2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | build/common.gypi » ('j') | build/common.gypi » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: SConstruct
diff --git a/SConstruct b/SConstruct
index 609af9513043ec432fdf1f8fa1dd7907206b35ed..9a54ceda2f2def83471d4825d840a512d6b38cc1 100755
--- a/SConstruct
+++ b/SConstruct
@@ -2142,13 +2142,6 @@ that the given target requires that argument be given."""
pre_base_env.AddMethod(GetAbsDirArg)
-pre_base_env.Append(
- CPPDEFINES = [
- ['NACL_BUILD_ARCH', '${BUILD_ARCHITECTURE}' ],
- ['NACL_BUILD_SUBARCH', '${BUILD_SUBARCH}' ],
- ],
- )
-
def MakeGTestEnv(env):
# Create an environment to run unit tests using Gtest.
gtest_env = env.Clone()
@@ -2450,10 +2443,6 @@ def MakeWindowsEnv(platform=None):
windows_env.Append(
CPPDEFINES = [
- ['NACL_WINDOWS', '1'],
- ['NACL_OSX', '0'],
- ['NACL_LINUX', '0'],
- ['NACL_ANDROID', '0'],
['_WIN32_WINNT', '0x0501'],
['__STDC_LIMIT_MACROS', '1'],
['NOMINMAX', '1'],
@@ -2467,7 +2456,12 @@ def MakeWindowsEnv(platform=None):
LIBS = ['ws2_32', 'advapi32'],
# TODO(bsy) remove 4355 once cross-repo
# NACL_ALLOW_THIS_IN_INITIALIZER_LIST changes go in.
- CCFLAGS = ['/EHsc', '/WX', '/wd4355', '/wd4800'],
+ CCFLAGS = ['/EHsc', '/WX', '/wd4355', '/wd4800',
+ # build_config.h is injected as a header in all sources to
Mark Seaborn 2014/12/29 17:51:03 Nit: indent by 1 space less
teravest 2014/12/29 22:29:28 Done.
+ # provide macro definitions for the operating system and
+ # architecture. This is injected so it's never accidentally
+ # omitted in source files.
+ '/FI', '$SOURCE_ROOT/native_client/src/include/build_config.h']
)
# This linker option allows us to ensure our builds are compatible with
@@ -2523,6 +2517,10 @@ def MakeUnixLikeEnv(platform=None):
'-fdiagnostics-show-option',
'-fvisibility=hidden',
'-fstack-protector',
+ # build_config.h is injected as a header in all sources to provide
+ # macro definitions for the operating system and architecture. This is
+ # injected so it's never accidentally omitted in source files.
+ '-include', '$SOURCE_ROOT/native_client/src/include/build_config.h',
] + werror_flags,
# NOTE: pthread is only neeeded for libppNaClPlugin.so and on arm
LIBS = ['pthread'],
@@ -2574,15 +2572,12 @@ def MakeMacEnv(platform=None):
CCFLAGS=[subarch_flag, '-fPIC'],
ASFLAGS=[subarch_flag],
LINKFLAGS=[subarch_flag, '-fPIC'],
- CPPDEFINES = [['NACL_WINDOWS', '0'],
- ['NACL_OSX', '1'],
- ['NACL_LINUX', '0'],
- ['NACL_ANDROID', '0'],
- # defining _DARWIN_C_SOURCE breaks 10.4
+ CPPDEFINES = [# defining _DARWIN_C_SOURCE breaks 10.4
#['_DARWIN_C_SOURCE', '1'],
#['__STDC_LIMIT_MACROS', '1']
],
)
+
return mac_env
(mac_debug_env, mac_optimized_env) = GenerateOptimizationLevels(MakeMacEnv())
@@ -2800,11 +2795,7 @@ def MakeGenericLinuxEnv(platform=None):
# Prepend so we can disable warnings via Append
linux_env.Prepend(
- CPPDEFINES = [['NACL_WINDOWS', '0'],
- ['NACL_OSX', '0'],
- ['NACL_LINUX', '1'],
- ['NACL_ANDROID', '0'],
- ['_DEFAULT_SOURCE', '1'],
+ CPPDEFINES = [['_DEFAULT_SOURCE', '1'],
['_BSD_SOURCE', '1'],
['_POSIX_C_SOURCE', '199506'],
['_XOPEN_SOURCE', '600'],
@@ -3118,6 +3109,8 @@ nacl_env.Append(
['NACL_OSX', '0'],
['NACL_LINUX', '0'],
['NACL_ANDROID', '0'],
+ ['NACL_BUILD_ARCH', '${BUILD_ARCHITECTURE}' ],
Mark Seaborn 2014/12/29 17:51:03 Can you inject build_config.h for untrusted code t
teravest 2014/12/29 22:29:28 I'm getting some strange errors when doing so: /us
Mark Seaborn 2015/01/02 04:18:31 That is from the Scons build, right? Does it fail
+ ['NACL_BUILD_SUBARCH', '${BUILD_SUBARCH}' ],
],
)
@@ -3481,8 +3474,6 @@ def RawSyscallObjects(env, sources):
raw_syscall_env.Append(
CPPDEFINES = [
['USE_RAW_SYSCALLS', '1'],
- ['NACL_BUILD_ARCH', '${BUILD_ARCHITECTURE}' ],
- ['NACL_BUILD_SUBARCH', '${BUILD_SUBARCH}' ],
],
)
objects = []
« no previous file with comments | « no previous file | build/common.gypi » ('j') | build/common.gypi » ('J')

Powered by Google App Engine
This is Rietveld 408576698