| 1 |
#!/usr/bin/env python3 |
| 2 |
|
| 3 |
import os, urllib.request, shutil, subprocess |
| 4 |
from glob import glob |
| 5 |
|
| 6 |
sdl_url = 'http://libsdl.org/release/SDL2-devel-2.0.3-VC.zip' |
| 7 |
sdl_filename = 'SDL2-devel-2.0.3-VC.zip' |
| 8 |
sdl_dir = 'SDL2-2.0.3' |
| 9 |
|
| 10 |
shutil.rmtree('build', ignore_errors=True) |
| 11 |
os.mkdir('build') |
| 12 |
|
| 13 |
if not os.path.exists(sdl_filename): |
| 14 |
response = urllib.request.urlopen(sdl_url, timeout=600.0) |
| 15 |
data = response.read() |
| 16 |
open(sdl_filename, 'wb').write(data) |
| 17 |
|
| 18 |
shutil.unpack_archive(sdl_filename, 'build') |
| 19 |
|
| 20 |
libs = glob(os.path.join('build', sdl_dir, 'lib/x86/*')) |
| 21 |
[shutil.copy(x, 'build') for x in libs] |
| 22 |
|
| 23 |
# Sorry for this hack but this needs to work during development |
| 24 |
# when Meson is not in path. |
| 25 |
subprocess.check_call(['python3', r'..\..\meson.py', 'build', |
| 26 |
'--backend=ninja', '--buildtype=release']) |
| 27 |
subprocess.check_call(['ninja'], cwd='build') |
| 28 |
shutil.copy('myapp.iss', 'build') |
| 29 |
subprocess.check_call([r'\Program Files\Inno Setup 5\ISCC.exe', 'myapp.iss'], |
| 30 |
cwd='build') |
| 31 |
shutil.copy('build/setup.exe', 'myapp 1.0.exe') |
| 32 |
shutil.rmtree('build') |