Fix .gyp file and avoid adding -m32 on 32 bit systems.
authorlrn@chromium.org <lrn@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 29 Apr 2009 15:20:37 +0000 (15:20 +0000)
committerlrn@chromium.org <lrn@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 29 Apr 2009 15:20:37 +0000 (15:20 +0000)
Fix SConstruct to only add -m32 if the compiler needs it.

Review URL: http://codereview.chromium.org/100160

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1820 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

SConstruct
tools/gyp/v8.gyp
tools/visual_studio/ia32.vsprops

index d8ef914ca6dcafe663bae5ef7a7e90f9f56164b1..4365aa8a169d0676e253fc6d6090bfec2e1c653a 100644 (file)
@@ -35,6 +35,7 @@ root_dir = dirname(File('SConstruct').rfile().abspath)
 sys.path.append(join(root_dir, 'tools'))
 import js2c, utils
 
+
 # ANDROID_TOP is the top of the Android checkout, fetched from the environment
 # variable 'TOP'.   You will also need to set the CXX, CC, AR and RANLIB
 # environment variables to the cross-compiling tools.
@@ -132,23 +133,29 @@ LIBRARY_FLAGS = {
       'CPPPATH':      ANDROID_INCLUDES,
     },
     'wordsize:32': {
-      'CCFLAGS':      ['-m32'],
-      'CPPDEFINES':   ['ILP32'],
-      'LINKFLAGS':    ['-m32']
+      'arch:x64': {
+        'CCFLAGS':      ['-m64'],
+        'LINKFLAGS':    ['-m64']
+      }
     },
     'wordsize:64': {
-      'CCFLAGS':      ['-m64'],
-      'CPPDEFINES':   ['LP64'],
-      'LINKFLAGS':    ['-m64']
+      'arch:ia32': {
+        'CCFLAGS':      ['-m32'],
+        'LINKFLAGS':    ['-m32']
+      },
+      'arch:arm': {
+        'CCFLAGS':      ['-m32'],
+        'LINKFLAGS':    ['-m32']
+      }
     },
     'arch:ia32': {
-      'CPPDEFINES':   ['V8_ARCH_IA32']
+      'CPPDEFINES':   ['V8_ARCH_IA32', 'ILP32']
     },
     'arch:arm': {
-      'CPPDEFINES':   ['V8_ARCH_ARM']
+      'CPPDEFINES':   ['V8_ARCH_ARM', 'ILP32']
     },
     'arch:x64': {
-      'CPPDEFINES':   ['V8_ARCH_X64']
+      'CPPDEFINES':   ['V8_ARCH_X64', 'LP64']
     },
     'prof:oprofile': {
       'CPPDEFINES':   ['ENABLE_OPROFILE_AGENT']
@@ -311,15 +318,21 @@ CCTEST_EXTRA_FLAGS = {
       }
     },
     'wordsize:32': {
-      'CCFLAGS':      ['-m32'],
-      'CPPDEFINES':   ['ILP32'],
-      'LINKFLAGS':    ['-m32']
+      'arch:x64': {
+        'CCFLAGS':      ['-m64'],
+        'LINKFLAGS':    ['-m64']
+      }
     },
     'wordsize:64': {
-      'CCFLAGS':      ['-m64'],
-      'CPPDEFINES':   ['LP64'],
-      'LINKFLAGS':    ['-m64']
-    },
+      'arch:ia32': {
+        'CCFLAGS':      ['-m32'],
+        'LINKFLAGS':    ['-m32']
+      },
+      'arch:arm': {
+        'CCFLAGS':      ['-m32'],
+        'LINKFLAGS':    ['-m32']
+      }
+    }
   },
   'msvc': {
     'all': {
@@ -368,14 +381,20 @@ SAMPLE_FLAGS = {
       }
     },
     'wordsize:32': {
-      'CCFLAGS':      ['-m32'],
-      'CPPDEFINES':   ['ILP32'],
-      'LINKFLAGS':    ['-m32']
+      'arch:x64': {
+        'CCFLAGS':      ['-m64'],
+        'LINKFLAGS':    ['-m64']
+      }
     },
     'wordsize:64': {
-      'CCFLAGS':      ['-m64'],
-      'CPPDEFINES':   ['LP64'],
-      'LINKFLAGS':    ['-m64']
+      'arch:ia32': {
+        'CCFLAGS':      ['-m32'],
+        'LINKFLAGS':    ['-m32']
+      },
+      'arch:arm': {
+        'CCFLAGS':      ['-m32'],
+        'LINKFLAGS':    ['-m32']
+      }
     },
     'mode:release': {
       'CCFLAGS':      ['-O2']
@@ -529,7 +548,7 @@ SIMPLE_OPTIONS = {
   },
   'wordsize': {
     'values': ['64', '32'],
-    'default': '32',   # WORDSIZE_GUESS,
+    'default': WORDSIZE_GUESS,
     'help': 'the word size'
   },
   'simulator': {
@@ -589,8 +608,8 @@ def VerifyOptions(env):
     Abort("Profiling on windows only supported for static library.")
   if env['prof'] == 'oprofile' and env['os'] != 'linux':
     Abort("OProfile is only supported on Linux.")
-  if env['wordsize'] == '64' and (env['os'] != 'linux' or env['arch'] != 'x64'):
-    Abort("64 bit compilation only allowed on Linux OS and x64 architecture.")
+  if env['arch'] == 'x64' and env['os'] != 'linux':
+    Abort("X64 compilation only allowed on Linux OS.")
   for (name, option) in SIMPLE_OPTIONS.iteritems():
     if (not option.get('default')) and (name not in ARGUMENTS):
       message = ("A value for option %s must be specified (%s)." %
index aa45e0b3912d7ed3f723368165554908628843a6..6d7c805fe8349e083da9fa8dea128bdaa1c68f52 100644 (file)
     {
       'target_name': 'v8_base',
       'type': '<(library)',
+      'defines': [
+        'V8_ARCH_IA32'
+      ],
       'include_dirs+': [
         '../../src',
         '../../src/ia32',
     {
       'target_name': 'v8_nosnapshot',
       'type': '<(library)',
+      'defines': [
+        'V8_ARCH_IA32'
+      ],
       'dependencies': [
         'js2c',
         'v8_base',
     {
       'target_name': 'v8',
       'type': '<(library)',
+      'defines': [
+        'V8_ARCH_IA32'
+      ],
       'dependencies': [
         'js2c',
         'mksnapshot',
     {
       'target_name': 'v8_shell',
       'type': 'executable',
+      'defines': [
+        'V8_ARCH_IA32'
+      ],
       'dependencies': [
         'v8',
       ],
         'd8_js2c',
         'v8',
       ],
+      'defines': [
+        'V8_ARCH_IA32'
+      ],
       'include_dirs': [
         '../../src',
       ],
         'js2c',
       ],
       'defines': [
-        'ARM',
+        'V8_ARCH_ARM',
       ],
       'include_dirs+': [
         '../../src',
         'v8_arm',
       ],
       'defines': [
-        'ARM',
+        'V8_ARCH_ARM',
       ],
       'sources': [
         '../../samples/shell.cc',
         'v8_arm',
       ],
       'defines': [
-        'ARM',
+        'V8_ARCH_ARM',
       ],
       'include_dirs': [
         '../../src',
index c77d3b9833beb2652db69a8da9076b38e5415683..8e02c9445b1334b59544c9b25058c7cb3d2781c0 100644 (file)
@@ -2,7 +2,7 @@
 <VisualStudioPropertySheet
        ProjectType="Visual C++"
        Version="8.00"
-       Name="arm"
+       Name="ia32"
        >
        <Tool
                Name="VCCLCompilerTool"