X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=scons%2Fgallium.py;h=f7ac5e543e395f1cec333584d66f9fe80d101160;hb=205e0e3e38b99c2fb0298755d99a38f111f0b96f;hp=342a0879c30b9c57e1a937df08875da8827e983a;hpb=a6c725839482f3d0f2af0eb15e5b6ab80184fb6c;p=mesa.git diff --git a/scons/gallium.py b/scons/gallium.py index 342a0879c30..f7ac5e543e3 100644 --- a/scons/gallium.py +++ b/scons/gallium.py @@ -140,6 +140,29 @@ def createCodeGenerateMethod(env): env.AddMethod(code_generate, 'CodeGenerate') +def symlink(target, source, env): + target = str(target[0]) + source = str(source[0]) + if os.path.islink(target) or os.path.exists(target): + os.remove(target) + os.symlink(os.path.basename(source), target) + +def install_shared_library(env, source, version = ()): + source = str(source[0]) + version = tuple(map(str, version)) + target_dir = os.path.join(env.Dir('#.').srcnode().abspath, env['build'], 'lib') + target_name = '.'.join((str(source),) + version) + last = env.InstallAs(os.path.join(target_dir, target_name), source) + while len(version): + version = version[:-1] + target_name = '.'.join((str(source),) + version) + action = SCons.Action.Action(symlink, "$TARGET -> $SOURCE") + last = env.Command(os.path.join(target_dir, target_name), last, action) + +def createInstallMethods(env): + env.AddMethod(install_shared_library, 'InstallSharedLibrary') + + def generate(env): """Common environment generation code""" @@ -147,21 +170,24 @@ def generate(env): #if env.get('quiet', False): # quietCommandLines(env) + # Toolchain + platform = env['platform'] + if env['toolchain'] == 'default': + if platform == 'winddk': + env['toolchain'] == 'winddk' + elif platform == 'wince': + env.Tool('wcesdk') + env['toolchain'] == 'wcesdk' + env.Tool(env['toolchain']) + # shortcuts debug = env['debug'] machine = env['machine'] platform = env['platform'] x86 = env['machine'] == 'x86' - gcc = env['platform'] in ('linux', 'freebsd', 'darwin') - msvc = env['platform'] in ('windows', 'winddk', 'wince') - - # Tool - if platform == 'winddk': - env.Tool('winddk') - elif platform == 'wince': - env.Tool('wcesdk') - else: - env.Tool('default') + ppc = env['machine'] == 'ppc' + gcc = env['platform'] in ('linux', 'freebsd', 'darwin') or env['toolchain'] == 'crossmingw' + msvc = env['platform'] in ('windows', 'winddk', 'wince') and env['toolchain'] != 'crossmingw' # Put build output in a separate dir, which depends on the current # configuration. See also http://www.scons.org/wiki/AdvancedBuildExample @@ -251,6 +277,7 @@ def generate(env): cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_DISPLAY'] if platform == 'wince': cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_CE'] + cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_CE_OGL'] env.Append(CPPDEFINES = cppdefines) # C preprocessor includes @@ -426,6 +453,7 @@ def generate(env): # Custom builders and methods createConvenienceLibBuilder(env) createCodeGenerateMethod(env) + createInstallMethods(env) # for debugging #print env.Dump()