X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=scons%2Fgallium.py;h=7207c6bb26cefe6a37dda5d9e6be41974e01885a;hb=da2d98fac778ed717919c89395ea7c66f2d9c1b1;hp=1c9c0ea32e46613dcc13f1e3dbc9666fdbfa774d;hpb=2864f723d111810532fab7697ad7badf161f45ab;p=mesa.git diff --git a/scons/gallium.py b/scons/gallium.py index 1c9c0ea32e4..7207c6bb26c 100755 --- a/scons/gallium.py +++ b/scons/gallium.py @@ -113,11 +113,6 @@ def generate(env): # Toolchain platform = env['platform'] - if env['toolchain'] == 'default': - if platform == 'winddk': - env['toolchain'] = 'winddk' - elif platform == 'wince': - env['toolchain'] = 'wcesdk' env.Tool(env['toolchain']) # Allow override compiler and specify additional flags from environment @@ -144,6 +139,9 @@ def generate(env): env['gcc'] = 'gcc' in os.path.basename(env['CC']).split('-') env['msvc'] = env['CC'] == 'cl' + env['suncc'] = env['platform'] == 'sunos' and os.path.basename(env['CC']) == 'cc' + env['clang'] = env['CC'] == 'clang' + env['icc'] = 'icc' == os.path.basename(env['CC']) if env['msvc'] and env['toolchain'] == 'default' and env['machine'] == 'x86_64': # MSVC x64 support is broken in earlier versions of scons @@ -156,6 +154,8 @@ def generate(env): ppc = env['machine'] == 'ppc' gcc = env['gcc'] msvc = env['msvc'] + suncc = env['suncc'] + icc = env['icc'] # Determine whether we are cross compiling; in particular, whether we need # to compile code generators with a different compiler as the target code. @@ -251,7 +251,7 @@ def generate(env): '_SVID_SOURCE', '_BSD_SOURCE', '_GNU_SOURCE', - 'PTHREADS', + 'HAVE_PTHREAD', 'HAVE_POSIX_MEMALIGN', ] if env['platform'] == 'darwin': @@ -281,7 +281,7 @@ def generate(env): ] if gcc: cppdefines += [('__MSVCRT_VERSION__', '0x0700')] - if msvc and env['toolchain'] != 'winddk': + if msvc: cppdefines += [ 'VC_EXTRALEAN', '_USE_MATH_DEFINES', @@ -292,59 +292,16 @@ def generate(env): ] if env['build'] in ('debug', 'checked'): cppdefines += ['_DEBUG'] - if env['toolchain'] == 'winddk': - # Mimic WINDDK's builtin flags. See also: - # - WINDDK's bin/makefile.new i386mk.inc for more info. - # - buildchk_wxp_x86.log files, generated by the WINDDK's build - # - http://alter.org.ua/docs/nt_kernel/vc8_proj/ - if machine == 'x86': - cppdefines += ['_X86_', 'i386'] - if machine == 'x86_64': - cppdefines += ['_AMD64_', 'AMD64'] - if platform == 'winddk': - cppdefines += [ - 'STD_CALL', - ('CONDITION_HANDLING', '1'), - ('NT_INST', '0'), - ('WIN32', '100'), - ('_NT1X_', '100'), - ('WINNT', '1'), - ('_WIN32_WINNT', '0x0501'), # minimum required OS version - ('WINVER', '0x0501'), - ('_WIN32_IE', '0x0603'), - ('WIN32_LEAN_AND_MEAN', '1'), - ('DEVL', '1'), - ('__BUILDMACHINE__', 'WinDDK'), - ('FPO', '0'), - ] - if env['build'] in ('debug', 'checked'): - cppdefines += [('DBG', 1)] - if platform == 'wince': - cppdefines += [ - '_CRT_SECURE_NO_DEPRECATE', - '_USE_32BIT_TIME_T', - 'UNICODE', - '_UNICODE', - ('UNDER_CE', '600'), - ('_WIN32_WCE', '0x600'), - 'WINCEOEM', - 'WINCEINTERNAL', - 'WIN32', - 'STRICT', - 'x86', - '_X86_', - 'INTERNATIONAL', - ('INTLMSG_CODEPAGE', '1252'), - ] if platform == 'windows': cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_USER'] - if platform == 'winddk': - cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_DISPLAY'] - if platform == 'wince': - cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_CE'] - cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_CE_OGL'] + if platform == 'haiku': + cppdefines += ['BEOS_THREADS'] if env['embedded']: cppdefines += ['PIPE_SUBSYSTEM_EMBEDDED'] + if env['texture_float']: + print 'warning: Floating-point textures enabled.' + print 'warning: Please consult docs/patents.txt with your lawyer before building Mesa.' + cppdefines += ['TEXTURE_FLOAT_ENABLED'] env.Append(CPPDEFINES = cppdefines) # C compiler options @@ -361,6 +318,9 @@ def generate(env): ccflags += ['-O0'] else: ccflags += ['-O3'] + # gcc's builtin memcmp is slower than glibc's + # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43052 + ccflags += ['-fno-builtin-memcmp'] # Work around aliasing bugs - developers should comment this out ccflags += ['-fno-strict-aliasing'] ccflags += ['-g'] @@ -376,7 +336,8 @@ 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 != '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 @@ -395,28 +356,30 @@ def generate(env): if platform in ['windows', 'darwin']: # Workaround http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37216 ccflags += ['-fno-common'] + if platform in ['haiku']: + # Make optimizations compatible with Pentium or higher on Haiku + ccflags += [ + '-mstackrealign', # ensure stack is aligned + '-march=i586', # Haiku target is Pentium + '-mtune=i686' # use i686 where we can + ] if env['machine'] == 'x86_64': ccflags += ['-m64'] if platform == 'darwin': ccflags += ['-fno-common'] - if env['platform'] != 'windows': + if env['platform'] not in ('cygwin', 'haiku', 'windows'): ccflags += ['-fvisibility=hidden'] # See also: # - http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html ccflags += [ '-Wall', '-Wno-long-long', - '-ffast-math', '-fmessage-length=0', # be nice to Eclipse ] cflags += [ '-Wmissing-prototypes', '-std=gnu99', ] - if distutils.version.LooseVersion(ccversion) >= distutils.version.LooseVersion('4.0'): - ccflags += [ - '-Wmissing-field-initializers', - ] if distutils.version.LooseVersion(ccversion) >= distutils.version.LooseVersion('4.2'): ccflags += [ '-Wpointer-arith', @@ -424,6 +387,10 @@ def generate(env): cflags += [ '-Wdeclaration-after-statement', ] + if icc: + cflags += [ + '-std=gnu99', + ] if msvc: # See also: # - http://msdn.microsoft.com/en-us/library/19z1t1wy.aspx @@ -447,9 +414,9 @@ def generate(env): '/GL-', # disable whole program optimization ] ccflags += [ - '/fp:fast', # fast floating point '/W3', # warning level #'/Wp64', # enable 64 bit porting warnings + '/wd4996', # disable deprecated POSIX name warnings ] if env['machine'] == 'x86': ccflags += [ @@ -459,39 +426,6 @@ def generate(env): ccflags += [ # TODO ] - if platform == 'winddk': - ccflags += [ - '/Zl', # omit default library name in .OBJ - '/Zp8', # 8bytes struct member alignment - '/Gy', # separate functions for linker - '/Gm-', # disable minimal rebuild - '/WX', # treat warnings as errors - '/Gz', # __stdcall Calling convention - '/GX-', # disable C++ EH - '/GR-', # disable C++ RTTI - '/GF', # enable read-only string pooling - '/G6', # optimize for PPro, P-II, P-III - '/Ze', # enable extensions - '/Gi-', # disable incremental compilation - '/QIfdiv-', # disable Pentium FDIV fix - '/hotpatch', # prepares an image for hotpatching. - #'/Z7', #enable old-style debug info - ] - if platform == 'wince': - # See also C:\WINCE600\public\common\oak\misc\makefile.def - ccflags += [ - '/Zl', # omit default library name in .OBJ - '/GF', # enable read-only string pooling - '/GR-', # disable C++ RTTI - '/GS', # enable security checks - # Allow disabling language conformance to maintain backward compat - #'/Zc:wchar_t-', # don't force wchar_t as native type, instead of typedef - #'/Zc:forScope-', # don't enforce Standard C++ for scoping rules - #'/wd4867', - #'/wd4430', - #'/MT', - #'/U_MT', - ] # Automatic pdb generation # See http://scons.tigris.org/issues/show_bug.cgi?id=1656 env.EnsureSConsVersion(0, 98, 0) @@ -537,7 +471,7 @@ def generate(env): if env['platform'] == 'windows': # Avoid depending on gcc runtime DLLs linkflags += ['-static-libgcc'] - if env['machine'] == 'x86_64': + if 'w64' in env['CC'].split('-'): linkflags += ['-static-libstdc++'] # Handle the @xx symbol munging of DLL exports shlinkflags += ['-Wl,--enable-stdcall-fixup'] @@ -554,56 +488,19 @@ def generate(env): '/fixed:no', '/incremental:no', ] - if platform == 'winddk': - linkflags += [ - '/merge:_PAGE=PAGE', - '/merge:_TEXT=.text', - '/section:INIT,d', - '/opt:ref', - '/opt:icf', - '/ignore:4198,4010,4037,4039,4065,4070,4078,4087,4089,4221', - '/incremental:no', - '/fullbuild', - '/release', - '/nodefaultlib', - '/wx', - '/debug', - '/debugtype:cv', - '/version:5.1', - '/osversion:5.1', - '/functionpadmin:5', - '/safeseh', - '/pdbcompress', - '/stack:0x40000,0x1000', - '/driver', - '/align:0x80', - '/subsystem:native,5.01', - '/base:0x10000', - - '/entry:DrvEnableDriver', - ] - if env['build'] != 'release': - linkflags += [ - '/MAP', # http://msdn.microsoft.com/en-us/library/k7xkk3e2.aspx - ] - if platform == 'wince': - linkflags += [ - '/nodefaultlib', - #'/incremental:no', - #'/fullbuild', - '/entry:_DllMainCRTStartup', - ] env.Append(LINKFLAGS = linkflags) env.Append(SHLINKFLAGS = shlinkflags) # We have C++ in several libraries, so always link with the C++ compiler - if env['gcc']: + if env['gcc'] or env['clang']: env['LINK'] = env['CXX'] # Default libs libs = [] - if env['platform'] in ('posix', 'linux', 'freebsd', 'darwin'): + if env['platform'] in ('darwin', 'freebsd', 'linux', 'posix', 'sunos'): libs += ['m', 'pthread', 'dl'] + if env['platform'] in ('linux',): + libs += ['rt'] env.Append(LIBS = libs) # OpenMP @@ -629,13 +526,14 @@ def generate(env): createInstallMethods(env) env.PkgCheckModules('X11', ['x11', 'xext', 'xdamage', 'xfixes']) + env.PkgCheckModules('XCB', ['x11-xcb', 'xcb-glx >= 1.8.1']) env.PkgCheckModules('XF86VIDMODE', ['xxf86vm']) - env.PkgCheckModules('DRM', ['libdrm']) - env.PkgCheckModules('DRM_INTEL', ['libdrm_intel']) - env.PkgCheckModules('DRM_RADEON', ['libdrm_radeon']) - env.PkgCheckModules('XORG', ['xorg-server']) - env.PkgCheckModules('KMS', ['libkms']) - env.PkgCheckModules('UDEV', ['libudev']) + env.PkgCheckModules('DRM', ['libdrm >= 2.4.24']) + env.PkgCheckModules('DRM_INTEL', ['libdrm_intel >= 2.4.30']) + env.PkgCheckModules('DRM_RADEON', ['libdrm_radeon >= 2.4.40']) + env.PkgCheckModules('XORG', ['xorg-server >= 1.6.0']) + env.PkgCheckModules('KMS', ['libkms >= 2.4.24']) + env.PkgCheckModules('UDEV', ['libudev > 150']) env['dri'] = env['x11'] and env['drm']