From e3c514f1c279c9955cac6b1fa9d0ede6ecbc310d Mon Sep 17 00:00:00 2001 From: gramanas Date: Tue, 4 Jun 2024 15:50:06 +0300 Subject: vks work and clang-format --- b.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'b.c') diff --git a/b.c b/b.c index a8bafec..0221fff 100644 --- a/b.c +++ b/b.c @@ -24,12 +24,14 @@ void libs(B_Cmd *cmd) b_cmd_append(cmd, "-lSDL2", "-lm", "-lvulkan", "-lshaderc_shared", "-lstdc++"); } -bool build_exe(bool force, B_Cmd *cmd, const char **input_paths, size_t input_paths_len, const char *output_path) +bool build_exe(bool force, B_Cmd *cmd, const char **input_paths, size_t input_paths_len, const char **dep_paths, size_t dep_paths_len, const char *output_path) { int rebuild_is_needed = b_needs_rebuild(output_path, input_paths, input_paths_len); - if (rebuild_is_needed < 0) return false; + int dep_rebuild = b_needs_rebuild(output_path, dep_paths, dep_paths_len); + + if (rebuild_is_needed < 0 || dep_rebuild < 0) return false; - if (force || rebuild_is_needed) { + if (force || rebuild_is_needed || dep_rebuild) { cmd->count = 0; cc(cmd); b_cmd_append(cmd, "-o", output_path); @@ -61,13 +63,17 @@ main(int argc, char *argv[]) } } + const char *dep_paths[] = { + "src/state.h", + "src/vksetup.h", + }; const char *input_paths[] = { "src/render.c", "src/cplusplus.cpp" }; B_Cmd cmd = {0}; - if (!build_exe(force, &cmd, input_paths, B_ARRAY_LEN(input_paths), "render")) return 1; + if (!build_exe(force, &cmd, input_paths, B_ARRAY_LEN(input_paths), dep_paths, B_ARRAY_LEN(dep_paths),"render")) return 1; return 0; } -- cgit v1.2.3