diff --git a/Makefile b/Makefile index 7c6ad6e..4921c45 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,9 @@ macos: macos_debug: clang++ $(source) -D DEBUG -g -Wall -Os -ffunction-sections -fdata-sections -lSDL2 -lSDL2_mixer -o "$(executable)_debug" +macos_bundle: + clang++ $(source) -D MACOS_BUNDLE -Wall -Os -framework SDL2 -framework SDL2_mixer -F /Library/Frameworks -ffunction-sections -fdata-sections -o mini_bundle -rpath @executable_path/../Frameworks/ -target x86_64-apple-macos10.12 + linux: g++ $(source) -Wall -Os -ffunction-sections -fdata-sections -Wl,--gc-sections -lSDL2 -lSDL2_mixer -o "$(executable)" strip -s -R .comment -R .gnu.version --strip-unneeded "$(executable)" diff --git a/mini.cpp b/mini.cpp index d179910..641ca36 100644 --- a/mini.cpp +++ b/mini.cpp @@ -5,6 +5,10 @@ #include "gif.c" #include "SDL2/SDL_mixer.h" +#ifdef MACOS_BUNDLE +#include +#endif + #pragma pack(1) struct surface_t { @@ -213,6 +217,12 @@ int main(int argc,char*argv[]){ bi += 5; } +#ifdef MACOS_BUNDLE + char res_file[255] = ""; + strcpy(res_file, dirname(argv[0])); + strcat(res_file, "/../Resources/data.jrf"); + file_setresourcefilename(res_file); +#endif read_ini(); setdest(newsurf(screen_width, screen_height));