[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
};
typedef struct CB_PathList CB_Cmd;
-struct CB_RunArgs {
+struct Cb_Cmd_RunArgs {
bool async;
bool reset;
#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)
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);
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
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);
cb_cmd_push(&cmd, exe_name);
cb_cmd_append_dyn(&cmd, argv, argc);
- (void)cb_run(&cmd);
+ (void)cb_cmd_run(&cmd);
exit(0);
}
#else
cb_cmd_append(&cmd, "cc", "main.c", "-o", "main");
#endif
- cb_run(&cmd);
+ cb_cmd_run(&cmd);
}
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);
}
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);
}
CB_Cmd cmd = {};
cb_cmd_append(&cmd, "cc", "-o", "main", "src/main.c");
- cb_run(&cmd);
+ cb_cmd_run(&cmd);
}
# 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"
"-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"
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");
#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);
}