summaryrefslogtreecommitdiff
path: root/manual tests
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2015-03-27 21:29:03 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2015-03-27 21:29:03 +0200
commitd0d25085622d28b2a24d3e3597ca823d7a7223da (patch)
treeeabf665911fbf4513a40f3c6a97357219e972ee1 /manual tests
parente46c1743ce2b0dbf722acac5412d95c64888b33b (diff)
downloadmeson-d0d25085622d28b2a24d3e3597ca823d7a7223da.tar.gz
Build windows installer for SDL2 sample app.
Diffstat (limited to 'manual tests')
-rw-r--r--manual tests/4 standalone binaries/build_windows_package.py32
-rw-r--r--manual tests/4 standalone binaries/meson.build10
-rw-r--r--manual tests/4 standalone binaries/myapp.cpp2
-rw-r--r--manual tests/4 standalone binaries/myapp.iss18
-rw-r--r--manual tests/4 standalone binaries/readme.txt10
5 files changed, 65 insertions, 7 deletions
diff --git a/manual tests/4 standalone binaries/build_windows_package.py b/manual tests/4 standalone binaries/build_windows_package.py
new file mode 100644
index 000000000..c676113f3
--- /dev/null
+++ b/manual tests/4 standalone binaries/build_windows_package.py
@@ -0,0 +1,32 @@
+#!/usr/bin/env python3
+
+import os, urllib.request, shutil, subprocess
+from glob import glob
+
+sdl_url = 'http://libsdl.org/release/SDL2-devel-2.0.3-VC.zip'
+sdl_filename = 'SDL2-devel-2.0.3-VC.zip'
+sdl_dir = 'SDL2-2.0.3'
+
+shutil.rmtree('build', ignore_errors=True)
+os.mkdir('build')
+
+if not os.path.exists(sdl_filename):
+ response = urllib.request.urlopen(sdl_url)
+ data = response.read()
+ open(sdl_filename, 'wb').write(data)
+
+shutil.unpack_archive(sdl_filename, 'build')
+
+libs = glob(os.path.join('build', sdl_dir, 'lib/x86/*'))
+[shutil.copy(x, 'build') for x in libs]
+
+# Sorry for this hack but this needs to work during development
+# when Meson is not in path.
+subprocess.check_call(['python3', r'..\..\meson.py', 'build',
+ '--backend=ninja', '--buildtype=release'])
+subprocess.check_call(['ninja'], cwd='build')
+shutil.copy('myapp.iss', 'build')
+subprocess.check_call([r'\Program Files\Inno Setup 5\ISCC.exe', 'myapp.iss'],
+ cwd = 'build')
+shutil.copy('build/setup.exe', 'myapp 1.0.exe')
+shutil.rmtree('build')
diff --git a/manual tests/4 standalone binaries/meson.build b/manual tests/4 standalone binaries/meson.build
index e5e6ee06f..b52487318 100644
--- a/manual tests/4 standalone binaries/meson.build
+++ b/manual tests/4 standalone binaries/meson.build
@@ -1,6 +1,6 @@
project('myapp', 'cpp')
-sdl = dependency('sdl2')
+sdl = dependency('sdl2', required : host.name() != 'windows')
if meson.get_compiler('cpp').get_id() != 'msvc'
add_global_arguments('-std=c++11', language : 'cpp')
@@ -24,7 +24,15 @@ if host.name() == 'linux'
meson.set_install_script('linux_bundler.sh')
endif
+extra_link_args = []
+
+if host.name() == 'windows'
+ str = '-I@0@/@1@'.format(meson.current_build_dir(), 'SDL2-2.0.3/include')
+ add_global_arguments(str, language : 'cpp')
+ extra_link_args = ['/SUBSYSTEM:CONSOLE', 'SDL2main.lib', 'SDL2.lib']
+endif
prog = executable('myapp', 'myapp.cpp',
dependencies : sdl,
+link_args : extra_link_args,
install : true)
diff --git a/manual tests/4 standalone binaries/myapp.cpp b/manual tests/4 standalone binaries/myapp.cpp
index c57fd04af..5acde4639 100644
--- a/manual tests/4 standalone binaries/myapp.cpp
+++ b/manual tests/4 standalone binaries/myapp.cpp
@@ -3,7 +3,7 @@
#include<iostream>
#include<string>
-int main(int argc, char **argv) {
+int main(int argc, char *argv[]) {
SDL_Surface *screenSurface;
SDL_Event e;
int keepGoing = 1;
diff --git a/manual tests/4 standalone binaries/myapp.iss b/manual tests/4 standalone binaries/myapp.iss
new file mode 100644
index 000000000..dda1537a2
--- /dev/null
+++ b/manual tests/4 standalone binaries/myapp.iss
@@ -0,0 +1,18 @@
+; Innosetup file for My app.
+
+[Setup]
+AppName=My App
+AppVersion=1.0
+DefaultDirName={pf}\My App
+DefaultGroupName=My App
+UninstallDisplayIcon={app}\myapp.exe
+Compression=lzma2
+SolidCompression=yes
+OutputDir=.
+
+[Files]
+Source: "myapp.exe"; DestDir: "{app}"
+Source: "SDL2.dll"; DestDir: "{app}"
+
+;[Icons]
+;Name: "{group}\My App"; Filename: "{app}\myapp.exe"
diff --git a/manual tests/4 standalone binaries/readme.txt b/manual tests/4 standalone binaries/readme.txt
index 6b26c49ee..5a3604d4f 100644
--- a/manual tests/4 standalone binaries/readme.txt
+++ b/manual tests/4 standalone binaries/readme.txt
@@ -1,12 +1,12 @@
This directory shows how you can build redistributable binaries. On
OSX this menans building an app bundle and a .dmg installer. On Linux
it means building a binary that bundles its dependencies. On Windows
-it means probably building an .exe installer or something (not done
-yet).
+it means building an .exe installer.
-To build each package you run the corresponding build_ARCH.sh build script.
+To build each package you run the corresponding build_ARCH.sh build
+script.
On Linux you must build the package on the oldest distribution you
-plan to support (Debian stable/oldstable and old CentOS are usually
-the choice here).
+plan to support (Debian stable/oldstable and old CentOS are the common
+choice here).