diff options
-rw-r--r-- | dependencies.py | 8 | ||||
-rw-r--r-- | manual tests/4 standalone binaries/build_windows_package.py | 32 | ||||
-rw-r--r-- | manual tests/4 standalone binaries/meson.build | 10 | ||||
-rw-r--r-- | manual tests/4 standalone binaries/myapp.cpp | 2 | ||||
-rw-r--r-- | manual tests/4 standalone binaries/myapp.iss | 18 | ||||
-rw-r--r-- | manual tests/4 standalone binaries/readme.txt | 10 |
6 files changed, 71 insertions, 9 deletions
diff --git a/dependencies.py b/dependencies.py index 91b7285..457c2c6 100644 --- a/dependencies.py +++ b/dependencies.py @@ -73,9 +73,13 @@ class PkgConfigDependency(Dependency): if PkgConfigDependency.pkgconfig_found is None: self.check_pkgconfig() - if not PkgConfigDependency.pkgconfig_found: - raise DependencyException('Pkg-config not found.') self.is_found = False + if not PkgConfigDependency.pkgconfig_found: + if required: + raise DependencyException('Pkg-config not found.') + self.cargs = [] + self.libs = [] + return p = subprocess.Popen(['pkg-config', '--modversion', name], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out = p.communicate()[0] 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 0000000..c676113 --- /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 e5e6ee0..b524873 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 c57fd04..5acde46 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 0000000..dda1537 --- /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 6b26c49..5a3604d 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). |