Index: SConstruct |
=================================================================== |
--- SConstruct (revision 1572) |
+++ SConstruct (working copy) |
@@ -35,7 +35,38 @@ |
sys.path.append(join(root_dir, 'tools')) |
import js2c, utils |
Søren Thygesen Gjesse
2009/03/23 10:50:36
Please add a comment on where this TOP environment
|
+TOP = os.environ.get('TOP') |
+if TOP is None: |
+ TOP="" |
+ANDROID_FLAGS = ['-march=armv5te', |
+ '-mtune=xscale', |
+ '-msoft-float', |
+ '-fpic', |
+ '-mthumb-interwork', |
+ '-funwind-tables', |
+ '-fstack-protector', |
+ '-fno-short-enums', |
+ '-fmessage-length=0', |
+ '-finline-functions', |
+ '-fno-inline-functions-called-once', |
+ '-fgcse-after-reload', |
+ '-frerun-cse-after-loop', |
+ '-frename-registers', |
+ '-fomit-frame-pointer', |
+ '-fno-strict-aliasing', |
+ '-finline-limit=64', |
+ '-MD'] |
+ |
+ANDROID_INCLUDES = [TOP + '/bionic/libc/arch-arm/include', |
+ TOP + '/bionic/libc/include', |
+ TOP + '/bionic/libstdc++/include', |
+ TOP + '/bionic/libc/kernel/common', |
+ TOP + '/bionic/libc/kernel/arch-arm', |
+ TOP + '/bionic/libm/include', |
+ TOP + '/bionic/libm/include/arch/arm', |
+ TOP + '/bionic/libthread_db/include'] |
+ |
LIBRARY_FLAGS = { |
'all': { |
'CPPDEFINES': ['ENABLE_LOGGING_AND_PROFILING'] |
@@ -50,7 +81,10 @@ |
'CPPDEFINES': ['ENABLE_DISASSEMBLER', 'DEBUG'] |
}, |
'mode:release': { |
- 'CCFLAGS': ['-O3', '-fomit-frame-pointer', '-fdata-sections', '-ffunction-sections'] |
+ 'CCFLAGS': ['-O3', '-fomit-frame-pointer', '-fdata-sections', '-ffunction-sections'], |
+ 'os:android': { |
+ 'CPPDEFINES': ['SK_RELEASE', 'NDEBUG'] |
+ } |
}, |
'os:linux': { |
'CCFLAGS': ['-ansi'], |
@@ -65,6 +99,12 @@ |
'CCFLAGS': ['-DWIN32'], |
'CXXFLAGS': ['-DWIN32'], |
}, |
+ 'os:android': { |
+ 'CPPDEFINES': ['ANDROID', '__ARM_ARCH_5__', '__ARM_ARCH_5T__', '__ARM_ARCH_5E__', '__ARM_ARCH_5TE__'], |
+ 'CCFLAGS': ANDROID_FLAGS, |
+ 'WARNINGFLAGS': ['-Wall', '-Wno-unused', '-Werror=return-type', '-Wstrict-aliasing=2'], |
+ 'CPPPATH': ANDROID_INCLUDES, |
+ }, |
'wordsize:64': { |
'CCFLAGS': ['-m32'], |
'LINKFLAGS': ['-m32'] |
@@ -114,15 +154,24 @@ |
'gcc': { |
'all': { |
'CXXFLAGS': [], #['-fvisibility=hidden'], |
- 'WARNINGFLAGS': ['-pedantic', '-Wall', '-Werror', '-W', |
+ 'WARNINGFLAGS': ['-Wall', '-Werror', '-W', |
'-Wno-unused-parameter'] |
}, |
'arch:arm': { |
'CPPDEFINES': ['ARM'] |
}, |
+ 'arch:android': { |
+ 'CPPDEFINES': ['ARM'] |
+ }, |
'os:win32': { |
- 'WARNINGFLAGS': ['-Wno-long-long'] |
+ 'WARNINGFLAGS': ['-pedantic', '-Wno-long-long'] |
}, |
+ 'os:linux': { |
+ 'WARNINGFLAGS': ['-pedantic'] |
+ }, |
+ 'os:macos': { |
+ 'WARNINGFLAGS': ['-pedantic'] |
+ }, |
'disassembler:on': { |
'CPPDEFINES': ['ENABLE_DISASSEMBLER'] |
} |
@@ -174,7 +223,7 @@ |
DTOA_EXTRA_FLAGS = { |
'gcc': { |
'all': { |
- 'WARNINGFLAGS': ['-Werror'] |
+ 'WARNINGFLAGS': ['-Werror', '-Wno-uninitialized'] |
} |
}, |
'msvc': { |
@@ -230,7 +279,8 @@ |
}, |
'gcc': { |
'all': { |
- 'LIBPATH': ['.'] |
+ 'LIBPATH': ['.'], |
+ 'CCFLAGS': ['-fno-rtti', '-fno-exceptions'] |
}, |
'os:linux': { |
'LIBS': ['pthread', 'rt'], |
@@ -244,6 +294,17 @@ |
'os:win32': { |
'LIBS': ['winmm', 'ws2_32'] |
}, |
Søren Thygesen Gjesse
2009/03/23 10:50:36
Isn't all this stuff required for building mksnaps
|
+ 'os:android': { |
+ 'CPPDEFINES': ['ANDROID', '__ARM_ARCH_5__', '__ARM_ARCH_5T__', '__ARM_ARCH_5E__', '__ARM_ARCH_5TE__'], |
+ 'CCFLAGS': ANDROID_FLAGS, |
+ 'CPPPATH': ANDROID_INCLUDES, |
+ 'LIBPATH': [TOP + '/out/target/product/generic/obj/lib'], |
+ 'LINKFLAGS': ['-nostdlib', '-Bdynamic', '-Wl,-T,' + TOP + '/build/core/armelf.x', '-Wl,-dynamic-linker,/system/bin/linker', '-Wl,--gc-sections', '-Wl,-z,nocopyreloc', '-Wl,-rpath-link=' + TOP + '/out/target/product/generic/obj/lib', TOP + '/out/target/product/generic/obj/lib/crtbegin_dynamic.o', TOP + '/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/lib/gcc/arm-eabi/4.2.1/interwork/libgcc.a', TOP + '/out/target/product/generic/obj/lib/crtend_android.o'], |
+ 'LIBS': ['c', 'stdc++', 'm'], |
+ 'mode:release': { |
+ 'CPPDEFINES': ['SK_RELEASE', 'NDEBUG'] |
+ } |
+ }, |
'wordsize:64': { |
'CCFLAGS': ['-m32'], |
'LINKFLAGS': ['-m32'] |
@@ -355,7 +416,7 @@ |
'help': 'the toolchain to use' |
}, |
'os': { |
- 'values': ['freebsd', 'linux', 'macos', 'win32'], |
+ 'values': ['freebsd', 'linux', 'macos', 'win32', 'android'], |
'default': OS_GUESS, |
'help': 'the os to build for' |
}, |
@@ -510,6 +571,8 @@ |
options[key] = prefix + value |
def ConfigureObject(self, env, input, **kw): |
+ if (kw.has_key('CPPPATH') and env.has_key('CPPPATH')): |
+ kw['CPPPATH'] += env['CPPPATH'] |
if self.options['library'] == 'static': |
return env.StaticObject(input, **kw) |
else: |