mkxp-z/shader/meson.build
刘皓 f162e8a494
Replace xxd with a custom executable
This removes the need to have xxd installed and provides a portable way
to specify the name of the output array (xxd has an `-n` option for
this, but it isn't present in older versions of xxd), which helps reduce
the possibility of symbol conflicts in libretro builds and also prevents
portability issues since the name of xxd's output array depends on the
relative path to the input file, which can break if Meson changes the
structure of the build directory or if the user sets the build directory
to a different location.

Also, this custom executable declares the array as const so that it goes
into the read-only data section of the binary instead of the data
section.
2025-02-27 22:55:22 -05:00

52 lines
1.1 KiB
Meson

embedded_shaders = [
'common.h',
'transSimple.frag',
'trans.frag',
'hue.frag',
'sprite.frag',
'plane.frag',
'gray.frag',
'bitmapBlit.frag',
'flatColor.frag',
'simple.frag',
'simpleColor.frag',
'simpleAlpha.frag',
'simpleAlphaUni.frag',
'tilemap.frag',
'flashMap.frag',
'bicubic.frag',
'lanczos3.frag',
'minimal.vert',
'simple.vert',
'simpleColor.vert',
'sprite.vert',
'tilemap.vert',
'tilemapvx.vert',
'blur.frag',
'blurH.vert',
'blurV.vert',
'simpleMatrix.vert'
]
# xBRZ shader is GPLv3.
if get_option('enable-https') == true
embedded_shaders += 'xbrz.frag'
endif
embedded_shaders_f = files(embedded_shaders)
count = 0
foreach file : embedded_shaders_f
global_sources += custom_target(embedded_shaders[count],
input: file,
output: '@0@.xxd'.format(embedded_shaders[count]),
command: [
embedtool,
'@INPUT@',
'@OUTPUT@',
'mkxp_shader_@0@'.format(embedded_shaders[count].replace('.', '_')),
],
)
count += 1
endforeach