Ensure shaders are built after fast_data_types.so

This commit is contained in:
Kovid Goyal
2026-06-30 08:34:44 +05:30
parent a168ec2712
commit cd43acfc28

View File

@@ -87,6 +87,7 @@ class CompilationDatabase:
self.incremental = incremental self.incremental = incremental
self.compile_commands: List[Command] = [] self.compile_commands: List[Command] = []
self.link_commands: List[Command] = [] self.link_commands: List[Command] = []
self.build_shaders: Callable[[], None] = lambda: None
self.post_link_commands: List[Command] = [] self.post_link_commands: List[Command] = []
def add_command( def add_command(
@@ -128,6 +129,8 @@ class CompilationDatabase:
items.append(compile_cmd) items.append(compile_cmd)
parallel_run(items) parallel_run(items)
self.build_shaders()
items = [] items = []
for compile_cmd in self.post_link_commands: for compile_cmd in self.post_link_commands:
if not self.incremental or compile_cmd.is_newer_func(): if not self.incremental or compile_cmd.is_newer_func():
@@ -1209,25 +1212,27 @@ def build_shaders(args: Options) -> None:
if args.skip_code_generation: if args.skip_code_generation:
print('Skipping building of shaders due to command line option', flush=True) print('Skipping building of shaders due to command line option', flush=True)
return return
ddir = 'shaders' def do_build() -> None:
os.makedirs(ddir, exist_ok=True) ddir = 'shaders'
bdir = 'build/shaders' os.makedirs(ddir, exist_ok=True)
os.makedirs(bdir, exist_ok=True) bdir = 'build/shaders'
os.makedirs(bdir, exist_ok=True)
def prun(cmds: Iterable[tuple[bool, str, list[str]]]) -> None: def prun(cmds: Iterable[tuple[bool, str, list[str]]]) -> None:
needed = [] needed = []
for (needs_build, desc, cmd) in cmds: for (needs_build, desc, cmd) in cmds:
if needs_build: if needs_build:
desc = re.sub(r'\|(.+?)\|', lambda m: emphasis(m.group(1)), desc) desc = re.sub(r'\|(.+?)\|', lambda m: emphasis(m.group(1)), desc)
needed.append(Command(desc, cmd, lambda: True)) needed.append(Command(desc, cmd, lambda: True))
parallel_run(needed) parallel_run(needed)
sys.path.insert(0, os.path.abspath('kitty')) sys.path.insert(0, os.path.abspath('kitty'))
try: try:
from kitty.shaders.slang import compile_builtin_shaders from kitty.shaders.slang import compile_builtin_shaders
compile_builtin_shaders(bdir, ddir, prun) compile_builtin_shaders(bdir, ddir, prun)
finally: finally:
del sys.path[0] del sys.path[0]
args.compilation_database.build_shaders = do_build
def build(args: Options, native_optimizations: bool = True, call_init: bool = True) -> None: def build(args: Options, native_optimizations: bool = True, call_init: bool = True) -> None: