More MacOS fixes and stuff

This commit is contained in:
Casey 2023-11-26 16:17:27 +03:00
parent 59fd8c4328
commit 617c296fe4
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
3 changed files with 20 additions and 4 deletions

2
.gitignore vendored
View File

@ -3,3 +3,5 @@ cbt_impl.c
state state
add-impl.py add-impl.py
raylib raylib
libraylib.*
extras

21
cbt.c
View File

@ -2,6 +2,17 @@
#define CBT_IMPLEMENTATION #define CBT_IMPLEMENTATION
#include "cbt.h" #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) { int main(int argc, char **argv) {
CBT_INIT(argc, argv); CBT_INIT(argc, argv);
@ -15,14 +26,18 @@ int main(int argc, char **argv) {
cbt_lib_cflags(&raylib, "-D_GNU_SOURCE", "-DPLATFORM_DESKTOP", cbt_lib_cflags(&raylib, "-D_GNU_SOURCE", "-DPLATFORM_DESKTOP",
"-DGRAPHICS_API_OPENGL_33", "-Wno-missing-braces", "-DGRAPHICS_API_OPENGL_33", "-Wno-missing-braces",
"-Werror=pointer-arith", "-fno-strict-aliasing", "-std=c99", "-Werror=pointer-arith", "-fno-strict-aliasing", "-std=c99",
"-fPIC", "-O1", "-Werror=implicit-function-declaration", #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", "-I./raylib/src/external/glfw/include",
"-I./raylib/src/external/glfw/deps/mingw"); "-I./raylib/src/external/glfw/deps/mingw");
cbt_lib_build(raylib, NULL); cbt_lib_build(raylib, NULL);
cbt_lib_free(raylib); cbt_lib_free(raylib);
cbt_proc_wait(cbt_proc_new(CBT_PROC_AUTO, cbt_cc, "clock.c", "-o", "clock", CBT_FAIL(compile_file("extras/clock.c", "extras/clock") == false);
"libraylib.a", "-lm", "-lpthread"));
cbt_cleanup(); cbt_cleanup();
return 0; return 0;

1
cbt.h
View File

@ -767,7 +767,6 @@ bool _cbt_binary_build(struct cbt_binary bin, const char *compiler, ...);
void cbt_binary_free(struct cbt_binary bin); void cbt_binary_free(struct cbt_binary bin);
#undef CBT_TODO #undef CBT_TODO
#undef CBT_FAIL
//-*- end //-*- end
#endif #endif