Fixed recipe for VulkanHeaders and added recipes for SpirVHeaders and SpirVReflect.

This commit is contained in:
Patrick 2025-07-08 08:11:55 +02:00
parent d2bc446cb9
commit 9e0c022226
3 changed files with 74 additions and 1 deletions

View File

@ -0,0 +1,26 @@
import re
from SCons.Script import *
def _git_cook(env: Environment, repo: dict) -> dict:
vulkan_headers = env.Cook('VulkanHeaders')
checkout_root = repo['checkout_root']
return {
'CPPPATH': [f'{checkout_root}/include']
}
env.GitRecipe(
globals = globals(),
repo_name = 'SpirVHeaders',
repo_url = 'https://github.com/KhronosGroup/SPIRV-Headers.git',
tag_pattern = re.compile(r'^vulkan-sdk-([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)$'),
tag_fn = lambda version: f'vulkan-sdk-{version[0]}.{version[1]}.{version[2]}.{version[3]}',
cook_fn = _git_cook,
dependencies = {
'VulkanHeaders': {}
}
)

View File

@ -0,0 +1,43 @@
import re
from SCons.Script import *
def _git_cook(env: Environment, repo: dict) -> dict:
checkout_root = repo['checkout_root']
source_files = [f'{checkout_root}/spirv_reflect.cpp']
additional_cxx_flags = []
additional_cppdefines = ['SPIRV_REFLECT_USE_SYSTEM_SPIRV_H']
if env['COMPILER_FAMILY'] == 'gcc':
additional_cxx_flags.append('-Wno-overflow')
lib_spirv_reflect = env.StaticLibrary(
CCFLAGS = env['CCFLAGS'] + additional_cxx_flags,
CPPPATH = [repo['checkout_root']],
CPPDEFINES = list(env['CPPDEFINES']) + additional_cppdefines,
target = env['LIB_DIR'] + '/spirv_reflect',
source = source_files,
dependencies = {
'SpirVHeaders': {}
}
)
return {
'CPPPATH': [repo['checkout_root']],
'LIBS': [lib_spirv_reflect]
}
env.GitRecipe(
globals = globals(),
repo_name = 'SpirVReflect',
repo_url = 'https://github.com/KhronosGroup/SPIRV-Reflect.git',
tag_pattern = re.compile(r'^vulkan-sdk-([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)$'),
tag_fn = lambda version: f'vulkan-sdk-{version[0]}.{version[1]}.{version[2]}.{version[3]}',
cook_fn = _git_cook,
dependencies = {
'SpirVHeaders': {}
}
)

View File

@ -40,6 +40,10 @@ def cook(env: Environment, version) -> dict:
git_ref = f'refs/tags/v{version[0]}.{version[1]}.{version[2]}'
repo = env.GitBranch(repo_name = _get_repo_name(env), remote_url = _get_repo_url(env), git_ref = git_ref)
checkout_root = repo['checkout_root']
include_dir = os.path.join(checkout_root, 'include')
return {
'CPPPATH': [os.path.join(checkout_root, 'include')]
'CPPPATH': [include_dir],
'CMAKE_VARS': {
'Vulkan_INCLUDE_DIR': include_dir
}
}