-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.py
More file actions
41 lines (33 loc) · 1.17 KB
/
Copy pathbuild.py
File metadata and controls
41 lines (33 loc) · 1.17 KB
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
import subprocess, sys, os
release = False
gnu = False
x86 = "i686"
x64 = "x86_64";
match (len(sys.argv)):
case 2:
release = bool(sys.argv[1])
case 3:
release = bool(sys.argv[1])
gnu = bool(sys.argv[2])
profile = "release" if release else "dev"
profile_dir = "release" if release else "debug"
gnu = "gnu" if gnu else "msvc"
targets = [(f'{x86}-pc-windows-{gnu}', True), (f'{x64}-pc-windows-{gnu}', False)]
build = ['cargo', 'build', '-p', '', f'--profile={profile}', '']
assemblys = [('load_library_getter', True), ('screen_recorder', False)]
for (assembly, exe) in assemblys:
build[3] = assembly
for (target, x86) in targets:
build[5] = f'--target={target}'
result = subprocess.run(build)
if result.returncode != 0:
exit(1)
trail = 'exe' if exe else 'dll'
x86 = "32" if x86 else "64"
path = os.path.dirname(os.path.abspath(__file__))
dst = f'{path}\\{assembly}_{x86}.{trail}'
try:
os.remove(dst)
except OSError as e:
print(f'\033[0;31mError\033[0m: {e}')
os.rename(f'{path}\\target\\{target}\\{profile_dir}\\{assembly}.{trail}', dst)