Skip to content

Commit

Permalink
meson: Convert VulkanMemoryAllocator submodule to a subproject
Browse files Browse the repository at this point in the history
  • Loading branch information
mborgerson committed Dec 31, 2024
1 parent 615748f commit 209c099
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 17 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,3 @@
[submodule "ui/thirdparty/httplib"]
path = ui/thirdparty/httplib
url = https://github.com/yhirose/cpp-httplib
[submodule "hw/xbox/nv2a/pgraph/vk/thirdparty/VulkanMemoryAllocator"]
path = thirdparty/VulkanMemoryAllocator
url = https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
2 changes: 1 addition & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ else
git_submodules_action="ignore"
fi

git_submodules="ui/keycodemapdb ui/thirdparty/imgui ui/thirdparty/implot ui/thirdparty/httplib util/xxHash tomlplusplus genconfig hw/xbox/nv2a/pgraph/thirdparty/nv2a_vsh_cpu thirdparty/VulkanMemoryAllocator"
git_submodules="ui/keycodemapdb ui/thirdparty/imgui ui/thirdparty/implot ui/thirdparty/httplib util/xxHash tomlplusplus genconfig hw/xbox/nv2a/pgraph/thirdparty/nv2a_vsh_cpu"
git="git"

# Don't accept a target_list environment variable.
Expand Down
1 change: 0 additions & 1 deletion scripts/archive-source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ submodules="$submodules tests/fp/berkeley-softfloat-3 tests/fp/berkeley-testfloa
# xemu extras
submodules="$submodules ui/thirdparty/imgui ui/thirdparty/implot ui/thirdparty/httplib util/xxHash tomlplusplus genconfig"
submodules="$submodules hw/xbox/nv2a/pgraph/thirdparty/nv2a_vsh_cpu"
submodules="$submodules thirdparty/VulkanMemoryAllocator"

sub_deinit=""

Expand Down
2 changes: 1 addition & 1 deletion scripts/gen-license.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def head(self):
Lib('VulkanMemoryAllocator', 'https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator',
mit, 'https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/master/LICENSE.txt',
ships_static=all_platforms,
submodule=Submodule('thirdparty/VulkanMemoryAllocator')
submodule=Submodule('subprojects/VulkanMemoryAllocator.wrap')
),

Lib('SPIRV-Reflect', 'https://github.com/KhronosGroup/SPIRV-Reflect',
Expand Down
4 changes: 4 additions & 0 deletions subprojects/VulkanMemoryAllocator.wrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[wrap-git]
url=https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
revision=v3.2.0
depth=1
1 change: 0 additions & 1 deletion thirdparty/VulkanMemoryAllocator
Submodule VulkanMemoryAllocator deleted from 3bab69
28 changes: 18 additions & 10 deletions thirdparty/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,27 @@ volk = declare_dependency(compile_args: ['-DVK_NO_PROTOTYPES'],
debug_vma = false

vma_defns = [
'-DVMA_STATIC_VULKAN_FUNCTIONS=0',
'-DVMA_DYNAMIC_VULKAN_FUNCTIONS=0',
]
'-DVMA_STATIC_VULKAN_FUNCTIONS=0',
'-DVMA_DYNAMIC_VULKAN_FUNCTIONS=0',
]

if debug_vma
vma_defns += [
'-DVMA_DEBUG_MARGIN=16',
'-DVMA_DEBUG_DETECT_CORRUPTION=1',
'-DVMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY=256',
]
vma_defns += [
'-DVMA_DEBUG_MARGIN=16',
'-DVMA_DEBUG_DETECT_CORRUPTION=1',
'-DVMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY=256',
]
endif
libvma = static_library('vma', sources: 'vma.cc', cpp_args: vma_defns, include_directories: 'VulkanMemoryAllocator/include', dependencies: [vulkan, volk])
vma = declare_dependency(compile_args: vma_defns, include_directories: 'VulkanMemoryAllocator/include', link_with: libvma)

vma_subproj = cmake.subproject('VulkanMemoryAllocator')
libvma = static_library('vma',
sources: 'vma.cc',
cpp_args: vma_defns,
include_directories: vma_subproj.include_directories('VulkanMemoryAllocator'),
dependencies: [vulkan, volk])
vma = declare_dependency(include_directories: vma_subproj.include_directories('VulkanMemoryAllocator'),
link_with: libvma,
dependencies: vulkan)

spirv_reflect_opts = cmake.subproject_options()
spirv_reflect_opts.add_cmake_defines({'SPIRV_REFLECT_STATIC_LIB': 'ON'})
Expand Down

0 comments on commit 209c099

Please sign in to comment.