Skip to content

Commit

Permalink
Added meson build files and manifests for dlls.
Browse files Browse the repository at this point in the history
Works, builds both native linux and cross-compiles mingw-w64 variants.
Need to work out copying appropriate dlls into the mkxp runtime folder.

Signed-off-by: Marty Plummer <ntzrmtthihu777@gmail.com>
  • Loading branch information
Marty Plummer committed Jul 18, 2017
1 parent f5c30af commit 403f61e
Show file tree
Hide file tree
Showing 12 changed files with 318 additions and 1 deletion.
33 changes: 33 additions & 0 deletions assets/mkxp.manifest.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity type="win32"
name="MKXP.Application"
version="2.0.0.0"
processorArchitecture="@ARCH@" />
<description>MKXP.Application</description>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
language="*"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df" />
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32"
name="runtime"
version="1.0.0.0"
language="*"
processorArchitecture="@ARCH@" />
</dependentAssembly>
</dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
2 changes: 1 addition & 1 deletion assets/resource.rc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <windows.h>
#include "resource.h"

1 RT_MANIFEST mkxp.manifest
IDI_APPICON ICON "icon.ico"
30 changes: 30 additions & 0 deletions assets/runtime.manifest.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<noInheritable></noInheritable>
<assemblyIdentity type="win32" name="runtime" version="1.0.0.0" processorArchitecture="@ARCH@" ></assemblyIdentity>
<!-- <file name="libstdc++-6.dll"></file> -->
<!-- <file name="libgcc_s_sjlj-1.dll"></file> -->
<file name="libboost_program_options.dll"></file>
<file name="libFLAC-8.dll"></file>
<file name="libfreetype-6.dll"></file>
<file name="libgcc_s_seh-1.dll"></file>
<file name="libjpeg-62.dll"></file>
<file name="libmodplug-1.dll"></file>
<file name="libogg-0.dll"></file>
<file name="libphysfs.dll"></file>
<file name="libpixman-1-0.dll"></file>
<file name="libpng16-16.dll"></file>
<file name="libSDL2-2-0-0.dll"></file>
<file name="libSDL_sound-1-0-1.dll"></file>
<file name="libsigc-2.0-0.dll"></file>
<file name="libspeex-1.dll"></file>
<file name="libstdc++-6.dll"></file>
<file name="libvorbis-0.dll"></file>
<file name="libvorbisfile-3.dll"></file>
<file name="libwebp-6.dll"></file>
<file name="OpenAL32.dll"></file>
<file name="ruby24.dll"></file>
<file name="SDL2_image.dll"></file>
<file name="SDL2_ttf.dll"></file>
<file name="zlib1.dll"></file>
</assembly>
27 changes: 27 additions & 0 deletions binding-mri/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
binding_src = [
'audio-binding.cpp',
'binding-mri.cpp',
'binding-util.cpp',
'bitmap-binding.cpp',
'etc-binding.cpp',
'filesystem-binding.cpp',
'font-binding.cpp',
'graphics-binding.cpp',
'input-binding.cpp',
'module_rpg.cpp',
'plane-binding.cpp',
'sprite-binding.cpp',
'table-binding.cpp',
'tilemap-binding.cpp',
'tilemapvx-binding.cpp',
'viewport-binding.cpp',
'window-binding.cpp',
'windowvx-binding.cpp'
]
ruby = dependency('-'.join(['ruby', get_option('MRIVERSION')]))
binding = build_target('binding',
binding_src,
dependencies : [ ruby, sdl2, sigcxx ],
include_directories : incdirs,
target_type : 'static_library')

28 changes: 28 additions & 0 deletions binding-mruby/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
binding_src = [
'audio-binding.cpp',
'binding-mruby.cpp',
'binding-util.cpp',
'bitmap-binding.cpp',
'etc-binding.cpp',
'font-binding.cpp',
'graphics-binding.cpp',
'input-binding.cpp',
'module_rpg.c',
'mrb-ext/file.cpp',
'mrb-ext/kernel.cpp',
'mrb-ext/marshal.cpp',
'mrb-ext/rwmem.cpp',
'mrb-ext/time.cpp',
'plane-binding.cpp',
'sprite-binding.cpp',
'table-binding.cpp',
'tilemap-binding.cpp',
'viewport-binding.cpp',
'window-binding.cpp',
]

binding = static_library('binding',
binding_src,
include_directories : incdirs)

error('mruby support is not yet implemented in meson')
5 changes: 5 additions & 0 deletions binding-null/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
binding = static_library('binding',
'binding-null.cpp',
dependencies : [ sdl2, sigcxx ],
include_directories : incdirs)

16 changes: 16 additions & 0 deletions cross/gentoo-i686-w64-mingw32.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[binaries]
c = '/usr/bin/i686-w64-mingw32-gcc'
cpp = '/usr/bin/i686-w64-mingw32-g++'
ar = '/usr/bin/i686-w64-mingw32-ar'
strip = '/usr/bin/i686-w64-mingw32-strip'
pkgconfig = '/usr/bin/i686-w64-mingw32-pkg-config'
windres = '/usr/bin/i686-w64-mingw32-windres'

[host_machine]
system = 'windows'
cpu_family = 'i686'
cpu = 'x86'
endian = 'little'

[properties]
root = '/usr/i686-w64-mingw32'
16 changes: 16 additions & 0 deletions cross/gentoo-x86_64-w64-mingw32.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[binaries]
c = '/usr/bin/x86_64-w64-mingw32-gcc'
cpp = '/usr/bin/x86_64-w64-mingw32-g++'
ar = '/usr/bin/x86_64-w64-mingw32-ar'
strip = '/usr/bin/x86_64-w64-mingw32-strip'
pkgconfig = '/usr/bin/x86_64-w64-mingw32-pkg-config'
windres = '/usr/bin/x86_64-w64-mingw32-windres'

[host_machine]
system = 'windows'
cpu_family = 'x86_64'
cpu = 'amd64'
endian = 'little'

[properties]
root = '/usr/x86_64-w64-mingw32'
102 changes: 102 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
project('mkxp',
'c', 'cpp',
default_options : [ 'c_std=c11', 'cpp_std=c++14'])
incdirs = include_directories(['assets', 'src'])

# xxd embedding
xxd_sh = find_program('tools/xxd.sh')
xxd_exe = find_program('xxd')
sed_exe = find_program('sed')

#bin2h_exe = executable('bin2h', 'tools/bin2h.c', native : true)
xxd_gen = generator(xxd_sh,
output : '@PLAINNAME@.xxd',
arguments : [ xxd_exe.path(), sed_exe.path(), '@INPUT@', '@OUTPUT@']
)

embedded = xxd_gen.process(
[
'assets/icon.png',
'assets/liberation.ttf',
'shader/bitmapBlit.frag',
'shader/blur.frag',
'shader/blurH.vert',
'shader/blurV.vert',
'shader/common.h',
'shader/flashMap.frag',
'shader/flatColor.frag',
'shader/gray.frag',
'shader/hue.frag',
'shader/minimal.vert',
'shader/plane.frag',
'shader/simple.frag',
'shader/simple.vert',
'shader/simpleAlpha.frag',
'shader/simpleAlphaUni.frag',
'shader/simpleColor.frag',
'shader/simpleColor.vert',
'shader/simpleMatrix.vert',
'shader/sprite.frag',
'shader/sprite.vert',
'shader/tilemap.vert',
'shader/tilemapvx.vert',
'shader/trans.frag',
'shader/transSimple.frag'
]
)

boost = dependency('boost', modules : ['program_options'])
openal = dependency('openal')
physfs = dependency('physfs', version : '>=2.1')
pixman = dependency('pixman-1')
sdl2 = dependency('sdl2')
sdl2_image = dependency('SDL2_image')
sdl2_ttf = dependency('SDL2_ttf')
sdl_sound = dependency('SDL_sound')
sigcxx = dependency('sigc++-2.0')
vorbisfile = dependency('vorbisfile')
zlib = dependency('zlib')

fluidsynth = []
if get_option('SHARED_FLUID')
fluidsynth = dependency('fluidsynth')
add_global_arguments('-DSHARED_FLUID', language : 'cpp')
endif

if get_option('RGSS2')
add_global_arguments('-DRGSS2', language : 'cpp')
endif

res = []
manifest = []
platdeps = []
if host_machine.system() == 'windows'
conf_data = configuration_data()
conf_data.set('ARCH', host_machine.cpu())
manifest = configure_file(
input : 'assets/mkxp.manifest.in',
output : 'mkxp.manifest',
configuration : conf_data
)
configure_file(
input : 'assets/runtime.manifest.in',
output : 'runtime.manifest',
configuration : conf_data
)
win = import('windows')
res = win.compile_resources([ 'assets/resource.rc' ],
include_directories : incdirs)
endif

subdir('-'.join(['binding', get_option('BINDING').to_lower()]))

subdir('src')

executable(
'mkxp',
sources : [ embedded, main_src, res ],
link_with : binding,
dependencies : [boost, fluidsynth, openal, physfs, pixman, sdl2,
sdl2_image, sdl2_ttf, sdl_sound, sigcxx, vorbisfile, zlib ],
include_directories : [ incdirs ]
)
5 changes: 5 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
option('SHARED_FLUID', type : 'boolean', value : false, description : 'Dynamically link with fluidsynth at build time')
option('WORKDIR_CURRENT', type : 'boolean', value : false, description : 'Keep current directory on startup')
option('BINDING', type : 'combo', choices : ['MRI', 'MRUBY', 'NULL'], value : 'MRI', description : 'The Binding Type (MRI, MRUBY, NULL)')
option('MRIVERSION', type : 'string', value : '2.1', description : 'Version of MRI to link with')
option('RGSS2', type : 'boolean', value : false)
45 changes: 45 additions & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
main_src = files(
'alstream.cpp',
'audio.cpp',
'audiostream.cpp',
'autotiles.cpp',
'autotilesvx.cpp',
'bitmap.cpp',
'bundledfont.cpp',
'config.cpp',
'etc.cpp',
'eventthread.cpp',
'filesystem.cpp',
'fluid-fun.cpp',
'font.cpp',
'gl-debug.cpp',
'gl-fun.cpp',
'gl-meta.cpp',
'glstate.cpp',
'graphics.cpp',
'input.cpp',
'keybindings.cpp',
'main.cpp',
'midisource.cpp',
'plane.cpp',
'rgssad.cpp',
'scene.cpp',
'sdlsoundsource.cpp',
'settingsmenu.cpp',
'shader.cpp',
'sharedstate.cpp',
'soundemitter.cpp',
'sprite.cpp',
'table.cpp',
'texpool.cpp',
'tileatlas.cpp',
'tileatlasvx.cpp',
'tilemap.cpp',
'tilemapvx.cpp',
'tilequad.cpp',
'vertex.cpp',
'viewport.cpp',
'vorbissource.cpp',
'window.cpp',
'windowvx.cpp'
)
10 changes: 10 additions & 0 deletions tools/xxd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
# meson resolves paths such as processing assets/icon.png's command line
# ends up being `xxd -i ../assets/icon.png icon.png.xxd`, resulting in a
# prefix of `___` on all variable names. We postprocess xxd with sed for
# now in order to have proper variable names.
# ./xxd.sh /path/to/xxd /path/to/sed infile outfile

$1 -i $3 $3.tmp
$2 's:___::g' $3.tmp > $4
rm $3.tmp

0 comments on commit 403f61e

Please sign in to comment.