Update to new recipe system (S++ 2.0).

This commit is contained in:
2024-08-14 23:33:04 +02:00
parent 6f83b68788
commit cd727e5a1d
26 changed files with 646 additions and 174 deletions

View File

@@ -1,10 +1,9 @@
import re
from SCons.Script import *
import os
def cook(env: Environment, backends: list = [], git_ref: str = '') -> dict:
repo = env.GitBranch(repo_name = 'imgui', remote_url = 'https://github.com/ocornut/imgui.git', git_ref = git_ref or 'master')
def _git_cook(env: Environment, repo: dict) -> dict:
imgui_source_files = [
os.path.join(repo['checkout_root'], 'imgui.cpp'),
os.path.join(repo['checkout_root'], 'imgui_draw.cpp'),
@@ -13,18 +12,27 @@ def cook(env: Environment, backends: list = [], git_ref: str = '') -> dict:
]
imgui_add_sources = []
backend_sources = {
'vulkan': os.path.join(repo['checkout_root'], 'backends/imgui_impl_vulkan.cpp'),
'sdl2': os.path.join(repo['checkout_root'], 'backends/imgui_impl_sdl2.cpp')
}
for backend in backends:
imgui_add_sources.append(backend_sources[backend])
for backend in env.get('IMGUI_BACKENDS', []):
imgui_add_sources.append(f'backends/imgui_impl_{backend}.cpp')
lib_imgui = env.StaticLibrary(
env.StaticLibrary(
CPPPATH = [repo['checkout_root']],
CPPDEFINES = ['IMGUI_IMPL_VULKAN_NO_PROTOTYPES=1'],
target = env['LIB_DIR'] + '/imgui',
source = imgui_source_files,
add_source = imgui_add_sources
)
return lib_imgui
return {
'CPPPATH': [repo['checkout_root']],
'LIBS': [os.path.join(env['LIB_DIR'], env.LibFilename('imgui'))]
}
env.GitRecipe(
globals = globals(),
repo_name = 'imgui',
repo_url = 'https://github.com/ocornut/imgui.git',
tag_pattern = re.compile(r'^v([0-9]+)\.([0-9]+)\.([0-9]+)$'),
tag_fn = lambda version: f'v{version[0]}.{version[1]}.{version[2]}',
cook_fn = _git_cook
)