# clang might need _LIBCPP_ENABLE_CXX26_REMOVED_CODECVT project('hellovulk', 'cpp', version: '0.1.0', default_options: [ 'cpp_std=c++23', 'cpp_args=-D_GLIBCXX_DEBUG=1 -D_GLIBCXX_DEBUG_PEDANTIC=1', ]) cmake = import('cmake') # use this for common options only for our executables cpp_args=[ '-Wno-sign-conversion', '-Wno-unused-parameter', '-Wno-unused-function', '-Wno-unused-variable', '-Wno-conversion', '-Wno-missing-field-initializers' ] link_args=[] # these are passed as override_defaults exe_defaults = [ 'warning_level=2' ] cc = meson.get_compiler('cpp') dependencies = [] if build_machine.system() == 'windows' add_global_link_arguments( '-static-libgcc', '-static-libstdc++', '-static', '-lstdc++exp', language: 'cpp', ) winmm = cc.find_library('winmm', required: true) gdi32 = cc.find_library('gdi32', required: true) vulkan_inc = include_directories('C:/VulkanSDK/1.4.328.1/Include') vulkan = cc.find_library('vulkan-1', dirs: ['C:/VulkanSDK/1.4.328.1/Lib'], has_headers: ['vulkan/vulkan.h'], header_include_directories: [vulkan_inc], required: true) dependencies += [ winmm, gdi32, vulkan ] exe_defaults += ['werror=true'] elif build_machine.system() == 'darwin' add_global_link_arguments( language: 'cpp', ) opengl = dependency('OpenGL') corefoundation = dependency('CoreFoundation') carbon = dependency('Carbon') cocoa = dependency('Cocoa') iokit = dependency('IOKit') corevideo = dependency('CoreVideo') link_args += ['-ObjC'] exe_defaults += ['werror=false'] dependencies += [ opengl, corefoundation, carbon, cocoa, iokit, corevideo ] endif vma = subproject('vulkan-memory-allocator').get_variable('vma_allocator_dep') # vulkan_headers = subproject('vulkan-headers').get_variable('vulkan_headers_dep') imgui = subproject('imgui', default_options: { 'vulkan': 'enabled', 'sdl2_renderer': 'enabled' }, ).get_variable('imgui_dep') sdl2 = subproject('sdl2').get_variable('sdl2_dep') glm_opts = cmake.subproject_options() glm_opts.add_cmake_defines({ 'GLM_ENABLE_CXX_20': true, }) glm_proj = cmake.subproject('glm', options: glm_opts) glm = glm_proj.get_variable('glm_dep') vk_opts = cmake.subproject_options() if build_machine.system() == 'windows' vk_opts.add_cmake_defines({ 'VK_BOOTSTRAP_TEST': false, 'VK_BOOTSTRAP_INSTALL': false, 'VK_BOOTSTRAP_VULKAN_HEADER_DIR': 'C:/VulkanSDK/1.4.328.1/Include' }) else vk_opts.add_cmake_defines({ 'VK_BOOTSTRAP_TEST': false, 'VK_BOOTSTRAP_INSTALL': false, }) endif vkbootstrap_proj = cmake.subproject('vk-bootstrap', options: vk_opts) vkbootstrap = vkbootstrap_proj.get_variable('vk_bootstrap_dep') dependencies += [ vma, vkbootstrap, glm, imgui, sdl2, ] sources = [ 'vk_initializers.cpp', 'vk_engine.cpp', 'vk_images.cpp', 'vk_descriptors.cpp', 'vk_pipelines.cpp', 'main.cpp', ] tests = [ ] executable('hellovulk', sources, cpp_args: cpp_args, link_args: link_args, win_subsystem: 'windows', override_options: exe_defaults, dependencies: dependencies)