Merge remote-tracking branch 'base/master'
This commit is contained in:
commit
30823ca314
4 changed files with 44 additions and 7 deletions
|
@ -1,10 +1,11 @@
|
||||||
# vim: set ft=python:
|
# vim: set ft=python:
|
||||||
#
|
|
||||||
# Toplevel Scons build script. This should be mostly complete and generic enough
|
|
||||||
# for most builds.
|
|
||||||
#
|
|
||||||
# Eryn Wells <eryn@erynwells.me>
|
# Eryn Wells <eryn@erynwells.me>
|
||||||
|
|
||||||
|
'''
|
||||||
|
Toplevel Scons build script. This should be mostly complete and generic enough
|
||||||
|
for most builds.
|
||||||
|
'''
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
setup_logging()
|
setup_logging()
|
||||||
|
|
|
@ -184,7 +184,7 @@ class Environment(SCons.Environment.Environment):
|
||||||
def _append_custom_tools(self, kwargs):
|
def _append_custom_tools(self, kwargs):
|
||||||
'''Add custom tools to the `kwargs`.'''
|
'''Add custom tools to the `kwargs`.'''
|
||||||
tools = kwargs.setdefault('tools', ['default'])
|
tools = kwargs.setdefault('tools', ['default'])
|
||||||
for tool in ['lib', 'test', 'program', 'sconscript']:
|
for tool in ['lib', 'test', 'program', 'sconscript', 'swiftc']:
|
||||||
if tool in tools:
|
if tool in tools:
|
||||||
continue
|
continue
|
||||||
tools.append(tool)
|
tools.append(tool)
|
||||||
|
|
|
@ -9,12 +9,15 @@ import SCons.Script
|
||||||
|
|
||||||
def _do_sconscript(env):
|
def _do_sconscript(env):
|
||||||
original_sconscript = env.SConscript
|
original_sconscript = env.SConscript
|
||||||
|
|
||||||
def sconscript(env, sconscript, clone=False, *args, **kwargs):
|
def sconscript(env, sconscript, clone=False, *args, **kwargs):
|
||||||
exports = {'Library': env.Library,
|
exports = {'Library': env.Library,
|
||||||
'StaticLibrary': env.StaticLibrary,
|
'StaticLibrary': env.StaticLibrary,
|
||||||
'SharedLibrary': env.SharedLibrary,
|
'SharedLibrary': env.SharedLibrary,
|
||||||
'Program': env.Program}
|
'Program': env.Program,
|
||||||
|
|
||||||
|
'Append': env.Append,
|
||||||
|
'Replace': env.Replace}
|
||||||
SCons.Script._SConscript.GlobalDict.update(exports)
|
SCons.Script._SConscript.GlobalDict.update(exports)
|
||||||
env.log('Reading {}'.format(sconscript))
|
env.log('Reading {}'.format(sconscript))
|
||||||
return original_sconscript(sconscript,
|
return original_sconscript(sconscript,
|
||||||
|
|
33
site_scons/site_tools/swiftc.py
Normal file
33
site_scons/site_tools/swiftc.py
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
# swiftc.py
|
||||||
|
# vim: set ft=python:
|
||||||
|
# Eryn Wells <eryn@erynwells.me>
|
||||||
|
|
||||||
|
'''
|
||||||
|
SCons plugin for building Swift files with swiftc.
|
||||||
|
'''
|
||||||
|
|
||||||
|
import SCons.Action
|
||||||
|
import SCons.Tool
|
||||||
|
import SCons.Util
|
||||||
|
|
||||||
|
SwiftSuffix = '.swift'
|
||||||
|
SwiftAction = SCons.Action.Action("$SWIFTCCOM", "$SWIFTCCOMSTR")
|
||||||
|
|
||||||
|
compilers = ['swiftc']
|
||||||
|
|
||||||
|
def generate(env):
|
||||||
|
static_obj, shared_obj = SCons.Tool.createObjBuilders(env)
|
||||||
|
static_obj.add_action(SwiftSuffix, SwiftAction)
|
||||||
|
static_obj.add_emitter(SwiftSuffix, SCons.Defaults.SharedObjectEmitter)
|
||||||
|
shared_obj.add_action(SwiftSuffix, SwiftAction)
|
||||||
|
shared_obj.add_emitter(SwiftSuffix, SCons.Defaults.SharedObjectEmitter)
|
||||||
|
|
||||||
|
if 'SWIFTC' not in env:
|
||||||
|
compiler = env.Detect(compilers)
|
||||||
|
env['SWIFTC'] = compiler if compiler else compilers[0]
|
||||||
|
env['SWIFTFLAGS'] = SCons.Util.CLVar('')
|
||||||
|
env['SWIFTCCOM'] = '$SWIFTC -o $TARGET -c $SWIFTFLAGS $SOURCES'
|
||||||
|
env['SWIFTFILESUFFIX'] = SwiftSuffix
|
||||||
|
|
||||||
|
def exists(env):
|
||||||
|
return env.Detect(compilers)
|
Loading…
Add table
Add a link
Reference in a new issue