mirror of https://github.com/odrling/Aegisub
Meson: respack.lua → respack.py; works out-of-tree
This commit is contained in:
parent
48af346e94
commit
ca3802e82a
|
@ -105,16 +105,13 @@ else
|
||||||
message('System luajit not found; using built-in luajit')
|
message('System luajit not found; using built-in luajit')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
lua_names = ['lua', 'luajit', 'lua5.3', 'lua5.2', 'lua-5.2', 'lua5.1', 'lua-5.1']
|
|
||||||
if not deps.contains(luajit)
|
if not deps.contains(luajit)
|
||||||
luajit_sp = subproject('luajit')
|
luajit_sp = subproject('luajit')
|
||||||
luajit_inc = luajit_sp.get_variable('incdir')
|
luajit_inc = luajit_sp.get_variable('incdir')
|
||||||
deps += luajit_sp.get_variable('luajit_dep')
|
deps += luajit_sp.get_variable('luajit_dep')
|
||||||
lua_names += luajit_sp.get_variable('minilua').full_path()
|
|
||||||
else
|
else
|
||||||
luajit_inc = include_directories(luajit.get_pkgconfig_variable('includedir'))
|
luajit_inc = include_directories(luajit.get_pkgconfig_variable('includedir'))
|
||||||
endif
|
endif
|
||||||
lua = find_program(lua_names, native : true)
|
|
||||||
subdir('vendor/luabins/src')
|
subdir('vendor/luabins/src')
|
||||||
|
|
||||||
deps += dependency('wxWidgets', version : '>=3.0.0',
|
deps += dependency('wxWidgets', version : '>=3.0.0',
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
respack = [lua, files('../../tools/respack.lua')]
|
respack = find_program('../../tools/respack.py')
|
||||||
|
|
||||||
resrc = [
|
resrc = [
|
||||||
custom_target('bitmap.{cpp,h}',
|
custom_target('bitmap.{cpp,h}',
|
||||||
command : respack + ['@INPUT@', '@OUTPUT@'],
|
command : [respack, '@INPUT@', '@OUTPUT@'],
|
||||||
input : files('../bitmaps/manifest.respack'),
|
input : files('../bitmaps/manifest.respack'),
|
||||||
output : ['bitmap.cpp', 'bitmap.h'])
|
output : ['bitmap.cpp', 'bitmap.h'])
|
||||||
]
|
]
|
||||||
|
@ -13,12 +13,12 @@ conf_platform_json = configure_file(input: 'default_config_platform.json.in',
|
||||||
|
|
||||||
if host_machine.system() == 'darwin'
|
if host_machine.system() == 'darwin'
|
||||||
resrc += custom_target('default_config.{cpp,h}',
|
resrc += custom_target('default_config.{cpp,h}',
|
||||||
command : respack + ['@INPUT0@', '@OUTPUT@'],
|
command : [respack, '@INPUT0@', '@OUTPUT@'],
|
||||||
input : [files('manifest_osx.respack'), conf_platform_json],
|
input : [files('manifest_osx.respack'), conf_platform_json],
|
||||||
output : ['default_config.cpp', 'default_config.h'])
|
output : ['default_config.cpp', 'default_config.h'])
|
||||||
else
|
else
|
||||||
resrc += custom_target('default_config.{cpp,h}',
|
resrc += custom_target('default_config.{cpp,h}',
|
||||||
command : respack + ['@INPUT0@', '@OUTPUT@'],
|
command : [respack, '@INPUT0@', '@OUTPUT@'],
|
||||||
input : [files('manifest.respack'), conf_platform_json],
|
input : [files('manifest.respack'), conf_platform_json],
|
||||||
output : ['default_config.cpp', 'default_config.h'])
|
output : ['default_config.cpp', 'default_config.h'])
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
|
||||||
|
manifestfile, cppfile, hfile = sys.argv[1:]
|
||||||
|
|
||||||
|
with open(manifestfile, 'r') as manifest:
|
||||||
|
files = dict((x.strip(), None) for x in manifest.readlines() if x.strip() != '')
|
||||||
|
|
||||||
|
sourcepath = os.path.split(manifestfile)[0]
|
||||||
|
buildpath = os.path.split(cppfile)[0]
|
||||||
|
|
||||||
|
for k in files:
|
||||||
|
sf = os.path.join(sourcepath, k)
|
||||||
|
bf = os.path.join(buildpath, k)
|
||||||
|
|
||||||
|
if os.path.isfile(sf):
|
||||||
|
files[k] = sf
|
||||||
|
elif os.path.isfile(bf):
|
||||||
|
files[k] = bf
|
||||||
|
else:
|
||||||
|
print("{}: Failed to open '{}'".format(manifestfile, k))
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
with open(cppfile, 'w') as cpp:
|
||||||
|
cpp.write('#include "libresrc.h"\n')
|
||||||
|
with open(hfile, 'w') as h:
|
||||||
|
|
||||||
|
for k in files:
|
||||||
|
with open(files[k], 'rb') as f:
|
||||||
|
data = [str(int(x)) for x in f.read()]
|
||||||
|
|
||||||
|
datastr = ','.join(data)
|
||||||
|
name = os.path.splitext(os.path.basename(k))[0]
|
||||||
|
cpp.write('const unsigned char {}[] = {{{}}};\n'.format(name, datastr))
|
||||||
|
h.write('extern const unsigned char {}[{}];\n'.format(name, len(data)))
|
Loading…
Reference in New Issue