nir: use nir_foreach_ssa_def for indexing ssa defs
[mesa.git] / scons / gallium.py
index 5109ebffee0f10888972b8cdef91a2435fb48aba..51955087125929bcfbd4dfd978129553e22e03db 100755 (executable)
@@ -301,6 +301,10 @@ def generate(env):
             cppdefines += ['HAVE_ALIAS']
         else:
             cppdefines += ['GLX_ALIAS_UNSUPPORTED']
+
+        if env['platform'] in ('linux', 'darwin'):
+            cppdefines += ['HAVE_XLOCALE_H']
+
     if env['platform'] == 'haiku':
         cppdefines += [
             'HAVE_PTHREAD',
@@ -374,22 +378,19 @@ def generate(env):
                 #'-march=pentium4',
             ]
             if distutils.version.LooseVersion(ccversion) >= distutils.version.LooseVersion('4.2') \
-               and (platform != 'windows' or env['build'] == 'debug' or True) \
                and platform != 'haiku':
                 # NOTE: We need to ensure stack is realigned given that we
                 # produce shared objects, and have no control over the stack
                 # alignment policy of the application. Therefore we need
                 # -mstackrealign ore -mincoming-stack-boundary=2.
                 #
-                # XXX: -O and -mstackrealign causes stack corruption on MinGW
-                #
                 # XXX: We could have SSE without -mstackrealign if we always used
                 # __attribute__((force_align_arg_pointer)), but that's not
                 # always the case.
                 ccflags += [
                     '-mstackrealign', # ensure stack is aligned
-                    '-mmmx', '-msse', '-msse2', # enable SIMD intrinsics
-                    #'-mfpmath=sse',
+                    '-msse', '-msse2', # enable SIMD intrinsics
+                    '-mfpmath=sse', # generate SSE floating-point arithmetic
                 ]
             if platform in ['windows', 'darwin']:
                 # Workaround http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37216
@@ -468,7 +469,7 @@ def generate(env):
         ]
         if env['machine'] == 'x86':
             ccflags += [
-                #'/arch:SSE2', # use the SSE2 instructions
+                '/arch:SSE2', # use the SSE2 instructions (default since MSVC 2012)
             ]
         if platform == 'windows':
             ccflags += [
@@ -529,6 +530,10 @@ def generate(env):
         else:
             env['_LIBFLAGS'] = '-Wl,--start-group ' + env['_LIBFLAGS'] + ' -Wl,--end-group'
         if env['platform'] == 'windows':
+            linkflags += [
+                '-Wl,--nxcompat', # DEP
+                '-Wl,--dynamicbase', # ASLR
+            ]
             # Avoid depending on gcc runtime DLLs
             linkflags += ['-static-libgcc']
             if 'w64' in env['CC'].split('-'):
@@ -547,6 +552,8 @@ def generate(env):
         linkflags += [
             '/fixed:no',
             '/incremental:no',
+            '/dynamicbase', # ASLR
+            '/nxcompat', # DEP
         ]
     env.Append(LINKFLAGS = linkflags)
     env.Append(SHLINKFLAGS = shlinkflags)
@@ -577,6 +584,30 @@ def generate(env):
             env.Append(CCFLAGS = ['-fopenmp'])
             env.Append(LIBS = ['gomp'])
 
+    if gcc_compat:
+        ccversion = env['CCVERSION']
+        cppdefines += [
+            'HAVE___BUILTIN_EXPECT',
+            'HAVE___BUILTIN_FFS',
+            'HAVE___BUILTIN_FFSLL',
+            'HAVE_FUNC_ATTRIBUTE_FLATTEN',
+        ]
+        if distutils.version.LooseVersion(ccversion) >= distutils.version.LooseVersion('3'):
+            cppdefines += [
+                'HAVE_FUNC_ATTRIBUTE_FORMAT',
+                'HAVE_FUNC_ATTRIBUTE_PACKED',
+            ]
+        if distutils.version.LooseVersion(ccversion) >= distutils.version.LooseVersion('3.4'):
+            cppdefines += [
+                'HAVE___BUILTIN_CTZ',
+                'HAVE___BUILTIN_POPCOUNT',
+                'HAVE___BUILTIN_POPCOUNTLL',
+                'HAVE___BUILTIN_CLZ',
+                'HAVE___BUILTIN_CLZLL',
+            ]
+        if distutils.version.LooseVersion(ccversion) >= distutils.version.LooseVersion('4.5'):
+            cppdefines += ['HAVE___BUILTIN_UNREACHABLE']
+
     # Load tools
     env.Tool('lex')
     env.Tool('yacc')
@@ -587,13 +618,15 @@ def generate(env):
     env.Tool('custom')
     createInstallMethods(env)
 
-    env.PkgCheckModules('X11', ['x11', 'xext', 'xdamage', 'xfixes'])
-    env.PkgCheckModules('XCB', ['x11-xcb', 'xcb-glx >= 1.8.1'])
+    env.PkgCheckModules('X11', ['x11', 'xext', 'xdamage', 'xfixes', 'glproto >= 1.4.13'])
+    env.PkgCheckModules('XCB', ['x11-xcb', 'xcb-glx >= 1.8.1', 'xcb-dri2 >= 1.8'])
     env.PkgCheckModules('XF86VIDMODE', ['xxf86vm'])
     env.PkgCheckModules('DRM', ['libdrm >= 2.4.38'])
-    env.PkgCheckModules('DRM_INTEL', ['libdrm_intel >= 2.4.52'])
     env.PkgCheckModules('UDEV', ['libudev >= 151'])
 
+    if env['x11']:
+        env.Append(CPPPATH = env['X11_CPPPATH'])
+
     env['dri'] = env['x11'] and env['drm']
 
     # for debugging