-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.py
96 lines (77 loc) · 2.8 KB
/
build.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import subprocess
# NOTE: You will need to compile the editor with '' to have GDExtension support in web builds
# Command for quick-building test:
# scons -j10 target=template_debug dev_build=yes platform=linux arch=x86_64 location=test_room/addons/gde_gozen/bin use_system=no recompile_ffmpeg=no
if __name__ == '__main__':
platform = 'linux'
arch = 'x86_64'
target = 'debug'
extra_args = ''
use_system = False
gpl = ''
print('GoZen GDExtension builder\n'
'Select platform:\n'
'1. Linux; (default)\n'
'2. Windows;\n'
'3. MacOS; (Not working)\n'
'4. Web; (Not working)\n'
'4. Android; (Not working)')
match input('> '):
case '2': platform = 'windows'
case '3':
platform = 'macos'
arch = 'arm64'
case '4': platform = 'web dlink_enabled=yes'
case '5': platform = 'android'
print('Select target:\n'
'1. Debug; (default):\n'
'2. Release.')
match input('> '):
case '2': target = 'release'
case _: extra_args += ' dev_build=yes'
if platform == 'linux':
print('Use system FFmpeg:\n'
'1. No; (default)\n'
'2. Yes.')
match input('> '):
case '2':
extra_args += ' use_system=yes'
use_system = True
case _: extra_args += ' use_system=no'
if not use_system:
print('(Re)compile FFmpeg:\n',
'1. Yes; (default)\n',
'2. No.')
match input('> '):
case '2': extra_args += ' recompile_ffmpeg=no'
case _:
extra_args += ' recompile_ffmpeg=yes'
print('Use GPL3:\n'
'1. No; (default)\n'
'2. Yes.')
match input('> '):
case '2': extra_args += ' enable_gpl=yes'
case _: extra_args += ' enable_gpl=no'
user_input = input('Number of threads/cores for compiling> ')
if user_input.isdigit():
jobs = int(user_input)
else:
jobs = 1
print('Select location:\n'
'1. Bin; (default)\n'
'2. Test room.')
match input('> '):
case '2': extra_args += ' location=test_room/addons/gde_gozen/bin'
case _: extra_args += ' location=bin'
print('Init/Update submodules:\n'
'1. No; (default)\n'
'2. Init;\n'
'3. Update.')
match input('> '):
case '2':
subprocess.run('git submodule update --init --recursive')
case '3':
subprocess.run('git submodule update --recursive --remote')
subprocess.run(f'scons -j{jobs} target=template_{target} '
f'platform={platform} arch={arch} {extra_args}',
shell=True, cwd='./')