OSX amalgamated build fix.

This commit is contained in:
Relintai 2024-01-19 00:04:37 +01:00
parent 8d4acb7293
commit c998970d73
4 changed files with 49 additions and 5 deletions

View File

@ -6,29 +6,42 @@
// On OSX you need to compile this file separately with an objective c compiler
#ifndef ONLY_GLAD
#ifdef __APPLE__
#ifndef _APPLE_NO_IMPL_
#ifndef SFW_3RD_IMPL
#define SFW_3RD_IMPL
#endif
#endif //SFW_3RD_IMPL
#endif //_APPLE_NO_IMPL_
#endif //__APPLE__
#ifdef SFW_3RD_IMPL
#define GLAD_GL_IMPLEMENTATION // glad
#endif
#endif //SFW_3RD_IMPL
#endif //ONLY_GLAD
{{FILE:sfw/render_core/3rd_glad.h}}
#ifndef ONLY_GLAD
#ifdef SFW_3RD_IMPL
#define STB_TRUETYPE_IMPLEMENTATION
#endif //SFW_3RD_IMPL
{{FILE:sfw/render_core/3rd_stb_truetype.h}}
#ifdef SFW_3RD_IMPL
#define STB_IMAGE_IMPLEMENTATION // stbi
#define STB_IMAGE_WRITE_IMPLEMENTATION // stbi_write
#define STB_SPRINTF_IMPLEMENTATION // stb_sprintf
#define STB_SPRINTF_NOUNALIGNED // stb_sprintf
#endif //SFW_3RD_IMPL
{{FILE:sfw/render_core/3rd_stb_image.h}}
@ -37,6 +50,8 @@
//---
#undef freelist
#ifdef SFW_3RD_IMPL
#define _GLFW_IMPLEMENTATION // glfw337
#define GLFW_INCLUDE_NONE // glfw337
#ifdef __APPLE__
@ -49,9 +64,12 @@
#undef _GNU_SOURCE
#endif //SFW_3RD_IMPL
{{FILE:sfw/render_core/3rd_glfw3.h}}
#undef timeGetTime
#undef Time
#endif

View File

@ -17,7 +17,19 @@
#include <memory.h>
#ifndef SFW_H
#ifdef __APPLE__
#ifndef _APPLE_NO_IMPL_
#define _APPLE_NO_IMPL_
#endif
#endif
#include "sfw.h"
#undef ONLY_GLAD
#include "sfw_3rd.m"
#endif
// On OSX sfw_3rd.m has to be compiled manually on Objective C Mode.

View File

@ -818,6 +818,15 @@
#endif
#ifndef GLAD_GL_H_
#ifdef __APPLE__
#ifndef _APPLE_NO_IMPL_
#define _APPLE_NO_IMPL_
#endif //_APPLE_NO_IMPL_
#endif //__APPLE__
#define ONLY_GLAD
#include "sfw_3rd.m"
#endif
#endif

View File

@ -1,12 +1,17 @@
cp -u ../out/full/sfw.h sfw.h
cp -u ../out/full/sfw.cpp sfw.cpp
cp -u ../out/full/sfw_3rd.m sfw_3rd.m
rm sfw.h
rm sfw.cpp
rm sfw_3rd.m
cp ../out/full/sfw.h sfw.h
cp ../out/full/sfw.cpp sfw.cpp
cp ../out/full/sfw_3rd.m sfw_3rd.m
export SDKROOT=$(xcrun --show-sdk-path)
export args="-std=c++14 -w -framework cocoa -framework iokit -framework CoreFoundation -framework CoreAudio -framework AudioToolbox "
clang++ $args -g -c sfw.cpp -o sfw.o
clang++ -w -framework cocoa -framework iokit -framework CoreFoundation -framework CoreAudio -framework AudioToolbox -g -c sfw_3rd.m -o sfw_3rd.o
clang++ $args -g -c game_scene.cpp -o game_scene.o