cbt/cbt.c

45 lines
1.5 KiB
C
Raw Normal View History

2023-11-25 22:16:11 +03:00
// x-run: python3 ./add-impl.py && ~/scripts/runc.sh % -Wall -Wextra
2023-09-20 10:45:18 +03:00
#define CBT_IMPLEMENTATION
2023-09-19 11:00:57 +03:00
#include "cbt.h"
2023-11-26 16:17:27 +03:00
bool compile_file(const char *input, const char *output) {
return cbt_proc_wait(cbt_proc_new(
CBT_PROC_AUTO, cbt_cc, input, "-o", output, "libraylib.a", "-lm",
"-lpthread",
#ifdef __APPLE__
"-framework", "CoreVideo", "-framework", "IOKit", "-framework",
"Cocoa", "-framework", "GLUT", "-framework", "OpenGL",
#endif
"-I./raylib/src")) == 0;
}
2023-09-19 11:00:57 +03:00
int main(int argc, char **argv) {
2023-09-20 10:45:18 +03:00
CBT_INIT(argc, argv);
2023-11-25 22:16:11 +03:00
/*cbt_shell(CBT_PROC_AUTO, "sh", "-c", "echo 'owo'");*/
2023-11-19 13:50:44 +03:00
2023-11-25 19:21:10 +03:00
// example usage, won't actually work
struct cbt_lib raylib = cbt_lib("raylib");
2023-11-25 22:16:11 +03:00
raylib.type = CBT_LIB_STATIC;
cbt_lib_src(&raylib, "./raylib/src/*.c");
2023-11-19 13:50:44 +03:00
cbt_lib_ldflags(&raylib, "-lm");
2023-11-25 22:16:11 +03:00
cbt_lib_cflags(&raylib, "-D_GNU_SOURCE", "-DPLATFORM_DESKTOP",
"-DGRAPHICS_API_OPENGL_33", "-Wno-missing-braces",
"-Werror=pointer-arith", "-fno-strict-aliasing", "-std=c99",
2023-11-26 16:17:27 +03:00
#ifndef __APPLE__
"-fPIC",
#else
"-x", "objective-c",
#endif
"-O1", "-Werror=implicit-function-declaration",
2023-11-25 22:16:11 +03:00
"-I./raylib/src", "-I./raylib/src/external/glfw/include",
"-I./raylib/src/external/glfw/deps/mingw");
2023-11-19 13:50:44 +03:00
cbt_lib_build(raylib, NULL);
cbt_lib_free(raylib);
2023-11-15 10:24:27 +03:00
2023-11-26 16:17:27 +03:00
CBT_FAIL(compile_file("extras/clock.c", "extras/clock") == false);
2023-11-25 22:16:11 +03:00
2023-11-15 10:24:27 +03:00
cbt_cleanup();
2023-09-20 10:45:18 +03:00
return 0;
2023-09-19 11:00:57 +03:00
}