Skip to content

Commit 19ed45a

Browse files
Chris Marshcrmarsh
Chris Marsh
authored andcommitted
Also only build release in for_unity build
1 parent be7fda7 commit 19ed45a

File tree

1 file changed

+26
-18
lines changed

1 file changed

+26
-18
lines changed

build.py

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,14 @@ def unity():
7676
@click.pass_context
7777
def for_unity(ctx):
7878
""" build just dynamic libs for use in unity project """
79-
ctx.invoke(libs, clean=False, static=False, shared=True, skip_formatter=False)
79+
ctx.invoke(
80+
libs,
81+
clean=False,
82+
static=False,
83+
shared=True,
84+
skip_formatter=True,
85+
just_release=True
86+
)
8087

8188

8289
@cli.command()
@@ -85,7 +92,7 @@ def unreal():
8592
pass
8693

8794

88-
def build_lib(build_name, generator, options):
95+
def build_lib(build_name, generator, options, just_release):
8996
""" Create a dir under builds, run build and install in it """
9097
build_path = os.path.join(SCRIPT_PATH, 'builds', build_name)
9198
install_path = os.path.join(INSTALL_ROOT, build_name)
@@ -99,17 +106,14 @@ def build_lib(build_name, generator, options):
99106
]
100107
if generator:
101108
initial_cmake.extend(['-G', generator])
102-
if IS_BUILD_MACHINE:
103-
# disable formatting on CI builds
104-
initial_cmake.append('-DCLANG_FORMAT_SUFFIX=none')
105109
for key in options:
106110
val = options[key]
107111
if type(val) is bool:
108112
val = 'ON' if val else 'OFF'
109113
initial_cmake.append('-D%s=%s' % (key, val))
110114
click.echo('--- Building ' + build_name)
111115
subprocess.check_call(initial_cmake)
112-
if not IS_BUILD_MACHINE:
116+
if not just_release:
113117
subprocess.check_call(['cmake', '--build', '.', '--config', 'Debug'])
114118
subprocess.check_call(['cmake', '--build', '.', '--config', 'Release', '--target', 'install'])
115119

@@ -179,7 +183,8 @@ def sign():
179183
@click.option('--static', is_flag=True)
180184
@click.option('--shared', is_flag=True)
181185
@click.option('--skip_formatter', is_flag=True)
182-
def libs(clean, static, shared, skip_formatter):
186+
@click.option('--just_release', is_flag=True)
187+
def libs(clean, static, shared, skip_formatter, just_release):
183188
""" Do all the builds for this platform """
184189
if clean:
185190
shutil.rmtree('builds', ignore_errors=True)
@@ -196,29 +201,32 @@ def libs(clean, static, shared, skip_formatter):
196201
'USE_STATIC_CRT': True,
197202
}
198203

199-
if skip_formatter:
200-
static_options['CLANG_FORMAT_SUFFIX'] = 'nope'
201-
dynamic_options['CLANG_FORMAT_SUFFIX'] = 'nope'
204+
if skip_formatter or IS_BUILD_MACHINE:
205+
static_options['CLANG_FORMAT_SUFFIX'] = 'none'
206+
dynamic_options['CLANG_FORMAT_SUFFIX'] = 'none'
207+
208+
if IS_BUILD_MACHINE:
209+
just_release = True
202210

203211
if PLATFORM == 'win':
204212
generator32 = 'Visual Studio 14 2015'
205213
generator64 = 'Visual Studio 14 2015 Win64'
206214
if static:
207-
build_lib('win32-static', generator32, static_options)
208-
build_lib('win64-static', generator64, static_options)
215+
build_lib('win32-static', generator32, static_options, just_release)
216+
build_lib('win64-static', generator64, static_options, just_release)
209217
if shared:
210-
build_lib('win32-dynamic', generator32, dynamic_options)
211-
build_lib('win64-dynamic', generator64, dynamic_options)
218+
build_lib('win32-dynamic', generator32, dynamic_options, just_release)
219+
build_lib('win64-dynamic', generator64, dynamic_options, just_release)
212220
elif PLATFORM == 'osx':
213221
if static:
214-
build_lib('osx-static', None, static_options)
222+
build_lib('osx-static', None, static_options, just_release)
215223
if shared:
216-
build_lib('osx-dynamic', None, dynamic_options)
224+
build_lib('osx-dynamic', None, dynamic_options, just_release)
217225
elif PLATFORM == 'linux':
218226
if static:
219-
build_lib('linux-static', None, static_options)
227+
build_lib('linux-static', None, static_options, just_release)
220228
if shared:
221-
build_lib('linux-dynamic', None, dynamic_options)
229+
build_lib('linux-dynamic', None, dynamic_options, just_release)
222230

223231

224232
if __name__ == '__main__':

0 commit comments

Comments
 (0)