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"""
#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
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
# Custom builders and methods
createConvenienceLibBuilder(env)
createCodeGenerateMethod(env)
+ createInstallMethods(env)
# for debugging
#print env.Dump()