.reset = true, \
__VA_ARGS__ \
})
-#define cb_processesslist_push(Dynarr, Value) cb_dyn_push(Dynarr, Value)
+#define cb_proclist_push(Dynarr, Value) cb_dyn_push(Dynarr, Value)
#define cb_dyn_free_custom(Dynarr, Values, Count) \
do { \
static char* cb_getenv(char *varname);
static bool cb_setenv(char *varname, char *value);
static void cb_process_wait(CB_Process *handle);
-static void cb_processesslist_wait(CB_ProcessList *procs);
+static void cb_proclist_wait(CB_ProcessList *procs);
static CB_Handle cb_handle_open(char *path, CB_AccessFlag permission);
static void cb_handle_close(CB_Handle fd);
static char* cb_handle_read(CB_Handle fd);
#endif
}
-static void cb_processesslist_wait(CB_ProcessList *procs) {
+static void cb_proclist_wait(CB_ProcessList *procs) {
for (size_t i = 0; i < procs->count; ++i) {
cb_process_wait(&procs->values[i]);
}
cb_rebuild_self(argc, argv);
cb_cmd cmd = {};
- cb_procs procs = {};
+ CB_ProcessList procs = {};
cb_cmd_append(&cmd, "ls", "-lah", ".");
- cb_procs_push(&procs, cb_run(&cmd, .async = true));
+ cb_proclist_push(&procs, cb_run(&cmd, .async = true));
cb_cmd_append(&cmd, "ls", "-lah", "/");
- cb_procs_push(&procs, cb_run(&cmd, .async = true));
+ cb_proclist_push(&procs, cb_run(&cmd, .async = true));
cb_cmd_append(&cmd, "pwd");
- cb_procs_push(&procs, cb_run(&cmd, .async = true));
+ cb_proclist_push(&procs, cb_run(&cmd, .async = true));
- cb_procs_wait(&procs);
+ cb_proclist_wait(&procs);
}
int main(int argc, char **argv) {
cb_rebuild_self(argc, argv);
- cb_fd file = cb_open("ls-curdir-log", CB_ACF_READ | CB_ACF_WRITE);
+ CB_Handle file = cb_handle_open("ls-curdir-log", CB_AccessFlag_Read |
+ CB_AccessFlag_Write);
cb_cmd cmd = {};
cb_cmd_append(&cmd, "ls", "-lah", ".");
cb_cmd_append(&cmd, "cat");
cb_run(&cmd, .stdin = file);
- cb_close(file);
+ cb_handle_close(file);
}
# 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-sign-conversion", \
"-Wno-unused-parameter"
# define CppAnnoyingWarnings CAnnoyingWarnings \
- "-Wno-gnu-anonymous-struct", \
"-Wno-gnu-anonymous-struct", \
"-Wno-nested-anon-types"
# define Output "-o", Outfile
cb_cmd cmd = {};
cb_cmd_append(&cmd, "git", "submodule", "update", "--recursive");
- cb_proc_handle codebase_updater = cb_run(&cmd, .async = true);
+ CB_Process codebase_updater = cb_run(&cmd, .async = true);
#if OS_WINDOWS
cb_cmd_push(&cmd, "cl.exe");
#endif
cb_cmd_append(&cmd, Output);
- cb_cmd_append(&cmd, Infile, Codebase_Path);
- cb_cmd_append(&cmd, GenericFlags, SystemSharedLibs);
+ cb_cmd_append(&cmd, Infile, Codebase_Path, GenericFlags);
if (cpp) {
cb_cmd_append(&cmd, CppFlags, CppAnnoyingWarnings);
cb_cmd_append(&cmd, ReleaseFlags);
}
+ if (sound) { cb_cmd_append(&cmd, Codebase_Module_Sound); }
if (gui) {
cb_cmd_append(&cmd, Codebase_Module_Gui);
- cb_cmd_append(&cmd, OPENGL);
#if OS_LINUX || OS_BSD
cb_cmd_append(&cmd, !strcmp(cb_getenv("XDG_SESSION_TYPE"), "x11")
? X11 : Wayland);
#endif
}
- if (sound) {
- cb_cmd_append(&cmd, Codebase_Module_Sound);
- }
+ // 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_proc_wait(codebase_updater);
+ cb_process_wait(&codebase_updater);
cb_run(&cmd);
}