diff options
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..4c0c163 --- /dev/null +++ b/meson.build @@ -0,0 +1,73 @@ +project('vk', 'c') + +c_files = [ + 'src/main.c', + 'src/window.c', + 'src/render/renderer.c', + 'src/render/util.c', + 'src/render/shader.c', + 'src/render/mesh.c', + 'src/render/buffer.c' +] + +shader_files = [ + 'shaders/shader.vert', + 'shaders/shader.frag' +] + +wl_protocols = dependency('wayland-protocols').get_variable('pkgdatadir') +wl_scanner = find_program(dependency('wayland-scanner').get_variable('wayland_scanner')) + +protos = { + 'xdg-shell': wl_protocols / 'stable/xdg-shell/xdg-shell.xml', + 'xdg-decoration': wl_protocols / 'unstable/xdg-decoration/xdg-decoration-unstable-v1.xml' +} + +foreach name, path : protos + c_files += custom_target( + name.underscorify() + '_c', + input: path, + output: '@BASENAME@-protocol.c', + command: [wl_scanner, 'private-code', '@INPUT@', '@OUTPUT@'] + ) + c_files += custom_target( + name.underscorify() + '_h', + input: path, + output: '@BASENAME@-protocol.h', + command: [wl_scanner, 'client-header', '@INPUT@', '@OUTPUT@'] + ) +endforeach + +libs = [ + dependency('vulkan'), + dependency('wayland-client'), + meson.get_compiler('c').find_library('m') +] + +glslc = generator( + find_program('glslc'), + output: '@PLAINNAME@', + arguments: ['@INPUT@', '-o', '@OUTPUT@.spv'] +) + +shaders = glslc.process(shader_files) + +vert_shader = custom_target( + input: 'shaders/shader.vert', + output: '@PLAINNAME@', + command: [find_program('glslc'), '@INPUT@', '-o', '@OUTPUT@'] +) + +frag_shader = custom_target( + input: 'shaders/shader.frag', + output: '@PLAINNAME@', + command: [find_program('glslc'), '@INPUT@', '-o', '@OUTPUT@'] +) + +c_files += [ vert_shader, frag_shader ] + +executable('vk', c_files, dependencies: libs, include_directories: ['include/'], + c_args: [ + '-DVERTEX_SHADER="@0@"'.format(vert_shader.full_path()), + '-DFRAGMENT_SHADER="@0@"'.format(frag_shader.full_path()) + ]) |