]> git.leonardobizzoni.com Git - CBuild/commitdiff
`cb_run` -> `cb_cmd_run`
authorLeonardoBizzoni <leo2002714@gmail.com>
Sun, 31 Aug 2025 12:30:24 +0000 (14:30 +0200)
committerLeonardoBizzoni <leo2002714@gmail.com>
Sun, 31 Aug 2025 12:30:24 +0000 (14:30 +0200)
.gitmodules
cbuild.h
examples/01-basics/build.c
examples/02-async-commands/build.c
examples/03-stream-redirection/build.c
examples/04-multiple-build-files-and-rebuild-opt/build.c
examples/XX-generic-codebase-build/build.c [moved from examples/XX-codebase-build/build.c with 92% similarity]
examples/XX-generic-codebase-build/src/base [moved from examples/XX-codebase-build/src/base with 100% similarity]
examples/XX-generic-codebase-build/src/main.c [moved from examples/XX-codebase-build/src/main.c with 100% similarity]

index 1f7464ed3926ef3b97e5578606ea21e574e93203..ae00f0a5fb9ef7b3c906596c291710e846b0990c 100644 (file)
@@ -1,3 +1,3 @@
 [submodule "examples/XX-codebase-build/src/base"]
-        path = examples/XX-codebase-build/src/base
+        path = examples/XX-generic-codebase-build/src/base
         url = git@github.com:LeonardoBizzoni/Codebase.git
index e0b121239d2f9e12695f198e8b87a0bed38cd020..ae0ad4575c9c236681eb1d515440603e4bdace34 100755 (executable)
--- a/cbuild.h
+++ b/cbuild.h
@@ -129,7 +129,7 @@ struct CB_PathList {
 };
 typedef struct CB_PathList CB_Cmd;
 
-struct CB_RunArgs {
+struct Cb_Cmd_RunArgs {
   bool async;
   bool reset;
 
@@ -191,10 +191,10 @@ enum {
 #define cb_println(Level, Fmt, ...) cb_print((Level), Fmt "\n", ##__VA_ARGS__)
 #define cb_rebuild_self(argc, argv) _cb_rebuild(argc, argv, __FILE__, 0)
 #define cb_rebuild_self_with(argc, argv, ...) _cb_rebuild(argc, argv, __FILE__, __VA_ARGS__, 0)
-#define cb_run(Cmd, ...) _cb_run((Cmd), (struct CB_RunArgs) { \
-                                           .async = false,    \
-                                           .reset = true,     \
-                                           __VA_ARGS__        \
+#define cb_cmd_run(Cmd, ...) _cb_cmd_run((Cmd), (struct Cb_Cmd_RunArgs) { \
+                                           .async = false,                \
+                                           .reset = true,                 \
+                                           __VA_ARGS__                    \
                                         })
 #define cb_proclist_push(Dynarr, Value) cb_dyn_push(Dynarr, Value)
 
@@ -255,7 +255,7 @@ internal void _cb_handle_write(CB_Handle fd, char *buffer, size_t buffsize);
 internal char* _cb_format(const char *format, va_list args);
 internal bool _cb_need_rebuild(char *output_path, struct CB_PathList sources);
 internal void _cb_rebuild(int argc, char **argv, char *cb_src, ...);
-internal CB_Process _cb_run(CB_Cmd *cmd, struct CB_RunArgs args);
+internal CB_Process _cb_cmd_run(CB_Cmd *cmd, struct Cb_Cmd_RunArgs args);
 internal size_t _last_occurance_of(char *string, char ch);
 internal bool _is_literal_f(char *str, size_t l);
 
@@ -526,7 +526,7 @@ internal char* _cb_format(const char *format, va_list args) {
   return res;
 }
 
-internal CB_Process _cb_run(CB_Cmd *cmd, struct CB_RunArgs args) {
+internal CB_Process _cb_cmd_run(CB_Cmd *cmd, struct Cb_Cmd_RunArgs args) {
   CB_Process res = {};
 
 #if OS_WINDOWS
@@ -635,7 +635,7 @@ internal void _cb_rebuild(int argc, char **argv, char *builder_src, ...) {
     printf("%s ", cmd.values[i]);
   }
   printf("\b`\n");
-  CB_Process recompiler = cb_run(&cmd);
+  CB_Process recompiler = cb_cmd_run(&cmd);
   if (recompiler.status_code) {
 #if OS_WINDOWS
     cb_file_rename(exe_name_old, exe_name);
@@ -645,7 +645,7 @@ internal void _cb_rebuild(int argc, char **argv, char *builder_src, ...) {
 
   cb_cmd_push(&cmd, exe_name);
   cb_cmd_append_dyn(&cmd, argv, argc);
-  (void)cb_run(&cmd);
+  (void)cb_cmd_run(&cmd);
   exit(0);
 }
 
index 31be747d6224d41b857e807b77d15ae6814602c1..7e7af6ed1a031c21376345304e4678fc25c71e37 100755 (executable)
@@ -9,5 +9,5 @@ int main(int argc, char **argv) {
 #else
   cb_cmd_append(&cmd, "cc", "main.c", "-o", "main");
 #endif
-  cb_run(&cmd);
+  cb_cmd_run(&cmd);
 }
index 76824d7bbd4b41fa7fc22ee64504cba64e4f9fd8..2256e7f1ec6385342e38d9f7d34fd632d65d8943 100644 (file)
@@ -6,11 +6,11 @@ int main(int argc, char **argv) {
   CB_Cmd cmd = {};
   CB_ProcessList procs = {};
   cb_cmd_append(&cmd, "ls", "-lah", ".");
-  cb_proclist_push(&procs, cb_run(&cmd, .async = true));
+  cb_proclist_push(&procs, cb_cmd_run(&cmd, .async = true));
   cb_cmd_append(&cmd, "ls", "-lah", "/");
-  cb_proclist_push(&procs, cb_run(&cmd, .async = true));
+  cb_proclist_push(&procs, cb_cmd_run(&cmd, .async = true));
   cb_cmd_append(&cmd, "pwd");
-  cb_proclist_push(&procs, cb_run(&cmd, .async = true));
+  cb_proclist_push(&procs, cb_cmd_run(&cmd, .async = true));
 
   cb_proclist_wait(&procs);
 }
index 2ca808349a55172f72487667ce49f91aaaf3474e..eca220c531483a007a8ae2c3c3a53e641a8d0294 100644 (file)
@@ -8,10 +8,10 @@ int main(int argc, char **argv) {
 
   CB_Cmd cmd = {};
   cb_cmd_append(&cmd, "ls", "-lah", ".");
-  cb_run(&cmd, .stdout = file);
+  cb_cmd_run(&cmd, .stdout = file);
 
   cb_cmd_append(&cmd, "cat");
-  cb_run(&cmd, .stdin = file);
+  cb_cmd_run(&cmd, .stdin = file);
 
   cb_handle_close(file);
 }
index 289c10cbd0544ffe4bc1ee9ee97cf24c5fa7c596..8ba075d8f688c202e29d38d6864ea8c70d091851 100644 (file)
@@ -26,5 +26,5 @@ int main(int argc, char **argv) {
 
   CB_Cmd cmd = {};
   cb_cmd_append(&cmd, "cc", "-o", "main", "src/main.c");
-  cb_run(&cmd);
+  cb_cmd_run(&cmd);
 }
similarity index 92%
rename from examples/XX-codebase-build/build.c
rename to examples/XX-generic-codebase-build/build.c
index 26ca47318ca40b30ae01d07d1440db6dea479dca..3a1dcb231d698d7335486e5046cc23ff5623ec43 100644 (file)
@@ -18,7 +18,6 @@
 #  define CppFlags "/TP", "/std:c++latest"
 #  define CAnnoyingWarnings "/wd4477", "/wd4996"
 #  define CppAnnoyingWarnings
-#  define OPENGL "gdi32.lib", "opengl32.lib"
 #  define Output "/Fe" Outfile ".exe"
 #else
 #  define SystemSharedLibs "-lpthread", "-lm"
@@ -43,7 +42,6 @@
                               "-Wno-nested-anon-types"
 #  define Output "-o", Outfile
 
-#  define OPENGL "-lGL", "-lGLU", "-DUSING_OPENGL=1"
 #  if OS_LINUX
 #    define X11 "-DLNX_X11=1", "-lX11", "-lXext"
 #    define Wayland "-DLNX_WAYLAND=1", "-lxkbcommon"
@@ -80,7 +78,7 @@ int main(int argc, char **argv) {
 
   CB_Cmd cmd = {};
   cb_cmd_append(&cmd, "git", "submodule", "update", "--recursive");
-  CB_Process codebase_updater = cb_run(&cmd, .async = true);
+  CB_Process codebase_updater = cb_cmd_run(&cmd, .async = true);
 
 #if OS_WINDOWS
   cb_cmd_push(&cmd, "cl.exe");
@@ -116,11 +114,8 @@ int main(int argc, char **argv) {
 #endif
   }
 
-  // NOTE(lb): Windows requires dlls to be all specified
-  //           after the `/link` flag from what i understood
   cb_cmd_append(&cmd, SystemSharedLibs);
-  if (gui) {cb_cmd_append(&cmd, OPENGL); }
 
   cb_process_wait(&codebase_updater);
-  cb_run(&cmd);
+  cb_cmd_run(&cmd);
 }