diff --git a/assets/mkxp.manifest.in b/assets/mkxp.manifest.in new file mode 100644 index 0000000..228210a --- /dev/null +++ b/assets/mkxp.manifest.in @@ -0,0 +1,33 @@ + + + MKXP.Application + + + + + + + + + + + + + + + + + + diff --git a/assets/runtime.manifest.in b/assets/runtime.manifest.in new file mode 100644 index 0000000..336847a --- /dev/null +++ b/assets/runtime.manifest.in @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/binding-mri/meson.build b/binding-mri/meson.build new file mode 100644 index 0000000..5b6ef72 --- /dev/null +++ b/binding-mri/meson.build @@ -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') + diff --git a/binding-mruby/meson.build b/binding-mruby/meson.build new file mode 100644 index 0000000..167fd7e --- /dev/null +++ b/binding-mruby/meson.build @@ -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') diff --git a/binding-null/meson.build b/binding-null/meson.build new file mode 100644 index 0000000..2c8c2c7 --- /dev/null +++ b/binding-null/meson.build @@ -0,0 +1,5 @@ +binding = static_library('binding', + 'binding-null.cpp', + dependencies : [ sdl2, sigcxx ], + include_directories : incdirs) + diff --git a/cross/gentoo-i686-w64-mingw32.txt b/cross/gentoo-i686-w64-mingw32.txt new file mode 100644 index 0000000..426c1cd --- /dev/null +++ b/cross/gentoo-i686-w64-mingw32.txt @@ -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' diff --git a/cross/gentoo-x86_64-w64-mingw32.txt b/cross/gentoo-x86_64-w64-mingw32.txt new file mode 100644 index 0000000..8dd61fa --- /dev/null +++ b/cross/gentoo-x86_64-w64-mingw32.txt @@ -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' diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..cccf621 --- /dev/null +++ b/meson.build @@ -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 ] +) diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..7771015 --- /dev/null +++ b/meson_options.txt @@ -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) diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 0000000..bac5848 --- /dev/null +++ b/src/meson.build @@ -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' +) diff --git a/tools/xxd.sh b/tools/xxd.sh new file mode 100755 index 0000000..758851f --- /dev/null +++ b/tools/xxd.sh @@ -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 diff --git a/windows/resource.rc b/windows/resource.rc index 293e38d..cf86965 100644 --- a/windows/resource.rc +++ b/windows/resource.rc @@ -1,4 +1,4 @@ #include #include "resource.h" - +1 RT_MANIFEST mkxp.manifest IDI_APPICON ICON "icon.ico"