project('voyage', 'c', default_options: ['buildtype=debugoptimized', 'b_sanitize=address', 'c_std=c17', 'warning_level=3']) compiler = meson.get_compiler('c') buildtype = get_option('buildtype') # Build options if compiler.get_argument_syntax() == 'gcc' add_project_arguments( ['-Wconversion', '-Wno-sign-conversion', '-Wdouble-promotion', '-Wno-unused-function', '-Wno-unused-parameter'], language : 'c' ) elif compiler.get_argument_syntax() == 'msvc' add_project_arguments( ['/wd4146', '/wd4245', '/wd4100', '/D_CRT_SECURE_NO_WARNINGS'], language: 'c' ) if buildtype == 'debug' add_project_arguments(['/RTCsu'], language : 'c') endif endif # Debug specific flags if buildtype == 'debug' or buildtype == 'debugoptimized' add_project_arguments([ '-DVY_DEBUG'], language : 'c') endif # Gather dependencies thread_dep = dependency('threads') m_dep = compiler.find_library('m', required : false) vk_dep = dependency('vulkan', required : false) windowing_dep = [] if get_option('use_xlib') windowing_dep = dependency('x11', required : true) add_project_arguments(['-DVY_USE_XLIB'], language : 'c') endif incdir = include_directories(['contrib', 'src']) runtime_lib = library('vyrt', # Project Sources 'src/runtime/runtime.h', 'src/runtime/gfx.h', 'src/runtime/renderer_api.h', 'src/runtime/fio.h', 'src/runtime/config.h', 'src/runtime/threading.h', 'src/runtime/app.h', 'src/runtime/dynamic_libs.h', 'src/runtime/error_report.c', 'src/runtime/gfx_main.c', 'src/runtime/gfx_shader_loading.c', 'src/runtime/config.c', 'src/runtime/runtime_cvars.c', 'src/runtime/threading.c', 'src/runtime/fio.c', 'src/runtime/app.c', 'src/runtime/dynamic_libs.c', # Contrib Sources 'contrib/xxhash/xxhash.c', dependencies : [thread_dep, m_dep, windowing_dep], include_directories : incdir, c_pch : 'pch/rt_pch.h') if vk_dep.found() platform_defs = [] if get_option('use_xlib') platform_defs = ['-DVK_USE_PLATFORM_XLIB_KHR'] elif host_machine.system() == 'windows' platform_defs = ['-DVK_USE_PLATFORM_WIN32_KHR'] endif vk_inc_dep = vk_dep.partial_dependency(compile_args : true, includes : true) vk_renderer_lib = library('vyvk', # Project Sources 'src/renderer/vk/gpu.h', 'src/renderer/vk/swapchain.h', 'src/renderer/vk/init.c', 'src/renderer/vk/swapchain.c', 'src/renderer/vk/gfx_pipelines.c', # Contrib Sources 'contrib/volk/volk.h', 'contrib/volk/volk.c', dependencies : [m_dep, vk_inc_dep], include_directories : incdir, link_with : [runtime_lib], c_pch : 'pch/vk_pch.h', c_args : platform_defs) endif executable('voyage', 'src/game/voyage.c', include_directories : incdir, link_with : [runtime_lib], win_subsystem : 'windows')