cbt/cbt.c

45 lines
1.5 KiB
C

// x-run: python3 ./add-impl.py && ~/scripts/runc.sh % -Wall -Wextra
#define CBT_IMPLEMENTATION
#include "cbt.h"
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;
}
int main(int argc, char **argv) {
CBT_INIT(argc, argv);
/*cbt_shell(CBT_PROC_AUTO, "sh", "-c", "echo 'owo'");*/
// example usage, won't actually work
struct cbt_lib raylib = cbt_lib("raylib");
raylib.type = CBT_LIB_STATIC;
cbt_lib_src(&raylib, "./raylib/src/*.c");
cbt_lib_ldflags(&raylib, "-lm");
cbt_lib_cflags(&raylib, "-D_GNU_SOURCE", "-DPLATFORM_DESKTOP",
"-DGRAPHICS_API_OPENGL_33", "-Wno-missing-braces",
"-Werror=pointer-arith", "-fno-strict-aliasing", "-std=c99",
#ifndef __APPLE__
"-fPIC",
#else
"-x", "objective-c",
#endif
"-O1", "-Werror=implicit-function-declaration",
"-I./raylib/src", "-I./raylib/src/external/glfw/include",
"-I./raylib/src/external/glfw/deps/mingw");
cbt_lib_build(raylib, NULL);
cbt_lib_free(raylib);
CBT_FAIL(compile_file("extras/clock.c", "extras/clock") == false);
cbt_cleanup();
return 0;
}