Update build script for a more targeted set of stuff to build for unity

This commit is contained in:
Chris Marsh 2017-12-01 13:47:04 -08:00 committed by Chris Marsh
parent 50ea4e61c6
commit be7fda7c50
2 changed files with 43 additions and 16 deletions

View file

@ -72,6 +72,13 @@ def unity():
pass
@cli.command()
@click.pass_context
def for_unity(ctx):
""" build just dynamic libs for use in unity project """
ctx.invoke(libs, clean=False, static=False, shared=True, skip_formatter=False)
@cli.command()
def unreal():
""" todo: build unreal project """
@ -96,7 +103,9 @@ def build_lib(build_name, generator, options):
# disable formatting on CI builds
initial_cmake.append('-DCLANG_FORMAT_SUFFIX=none')
for key in options:
val = 'ON' if options[key] else 'OFF'
val = options[key]
if type(val) is bool:
val = 'ON' if val else 'OFF'
initial_cmake.append('-D%s=%s' % (key, val))
click.echo('--- Building ' + build_name)
subprocess.check_call(initial_cmake)
@ -167,31 +176,49 @@ def sign():
@cli.command()
@click.option('--clean', is_flag=True)
def libs(clean):
@click.option('--static', is_flag=True)
@click.option('--shared', is_flag=True)
@click.option('--skip_formatter', is_flag=True)
def libs(clean, static, shared, skip_formatter):
""" Do all the builds for this platform """
if clean:
shutil.rmtree('builds', ignore_errors=True)
mkdir_p('builds')
if PLATFORM == 'win':
generator32 = 'Visual Studio 14 2015'
generator64 = 'Visual Studio 14 2015 Win64'
if not (static or shared):
static = True
shared = True
static_options = {}
dynamic_options = {
'BUILD_SHARED_LIBS': True,
'USE_STATIC_CRT': True,
}
if skip_formatter:
static_options['CLANG_FORMAT_SUFFIX'] = 'nope'
dynamic_options['CLANG_FORMAT_SUFFIX'] = 'nope'
if PLATFORM == 'win':
generator32 = 'Visual Studio 14 2015'
generator64 = 'Visual Studio 14 2015 Win64'
if static:
build_lib('win32-static', generator32, static_options)
build_lib('win32-dynamic', generator32, dynamic_options)
build_lib('win64-static', generator64, static_options)
if shared:
build_lib('win32-dynamic', generator32, dynamic_options)
build_lib('win64-dynamic', generator64, dynamic_options)
elif PLATFORM == 'osx':
build_lib('osx-static', None, {})
build_lib('osx-dynamic', None, {'BUILD_SHARED_LIBS': True})
if static:
build_lib('osx-static', None, static_options)
if shared:
build_lib('osx-dynamic', None, dynamic_options)
elif PLATFORM == 'linux':
build_lib('linux-static', None, {})
build_lib('linux-dynamic', None, {'BUILD_SHARED_LIBS': True})
if static:
build_lib('linux-static', None, static_options)
if shared:
build_lib('linux-dynamic', None, dynamic_options)
if __name__ == '__main__':

View file

@ -27,7 +27,7 @@ public class ScriptBatch
proc.StartInfo.EnvironmentVariables["PATH"] = newPath;
#endif
proc.StartInfo.FileName = "python";
proc.StartInfo.Arguments = "build.py";
proc.StartInfo.Arguments = "build.py for_unity";
proc.StartInfo.WorkingDirectory = "../..";
proc.Start();
proc.WaitForExit();