Compilation

All development conversation and discussion takes place here

Moderator: Moderator

Message
Author
lenocinor
Cornac
Posts: 33
Joined: Thu Jan 26, 2012 5:23 am

Re: Compilation

#16 Post by lenocinor »

OpaqueOcculus wrote:Yep, this is a nice group. And they are happy to help!

I managed to get it to compile, problem is I haven't succeeded in getting it to link properly. Remember that you can't have an executable without a successful linking step.

Still trying.
If it'll help you any, here's the diff I sent DarkGod (it's not in source yet I don't think). Also, you'll need to add http://www.opensource.apple.com/source/ ... c/unwind.h to your luajit2/src directory. Oh, and feel free to take out the OS X 10.5 SDK changes I threw in premake4.lua and te4core.lua if you don't have that SDK in your Developer directory. They're not necessary for your build.

Good luck! And feel free to come by the channel if you have more questions.

Code: Select all

Index: build/te4core.lua
===================================================================
--- build/te4core.lua	(revision 6303)
+++ build/te4core.lua	(working copy)
@@ -35,19 +35,14 @@
 		includedirs {
   	      "/System/Library/Frameworks/OpenGL.framework/Headers",
   	      "/System/Library/Frameworks/OpenAL.framework/Headers",
-		      "/Library/Frameworks/SDL.framework/Headers",
-		      "/Library/Frameworks/SDL.framework/Headers",
-  	      "/Library/Frameworks/SDL_net.framework/Headers",
-		      "/Library/Frameworks/SDL_image.framework/Headers",
-  	      "/Library/Frameworks/SDL_ttf.framework/Headers",
-		      "/Library/Frameworks/SDL_mixer.framework/Headers",
-			"/opt/local/include",
-			"/opt/local/include/Vorbis"
+	      "/Library/Frameworks/SDL2.framework/Headers",
+  	      "/Library/Frameworks/SDL2_image.framework/Headers",
+  	      "/Library/Frameworks/SDL2_ttf.framework/Headers"
   	}
-	  defines { "USE_TENGINE_MAIN", 'SELFEXE_MACOSX'  }
+	  defines { "USE_TENGINE_MAIN", 'SELFEXE_MACOSX', [[TENGINE_HOME_PATH='"/Library/Application Support/T-Engine/"']]  }
-		linkoptions { "-framework SDL", "-framework SDL_image", "-framework SDL_ttf", "-framework SDL_mixer", "-framework Cocoa", "-framework OpenGL" , "-framework OpenAL", "-pagezero_size 10000","-image_base 100000000" }
+		linkoptions { "-framework SDL2", "-framework SDL2_image", "-framework SDL2_ttf", "-framework libpng", "-framework Cocoa", "-framework OpenGL" , "-framework OpenAL", "-pagezero_size 10000", "-image_base 100000000", "-isysroot /Developer/SDKs/MacOSX10.5.sdk", "-mmacosx-version-min=10.5" }
 		targetdir "."
-		links { "IOKit" }
+		links { "IOKit", "vorbisfile" }
 
 	configuration "windows"
 		links { "mingw32", "SDL2main", "SDL2", "SDL2_ttf", "SDL2_image", "openal32", "vorbisfile", "OPENGL32", "GLU32", "wsock32", "png" }
Index: src/mac/SDLMain.m
===================================================================
--- src/mac/SDLMain.m	(revision 6303)
+++ src/mac/SDLMain.m	(working copy)
@@ -5,7 +5,7 @@
     Feel free to customize this file to suit your needs
 */
 
-#import <SDL/SDL.h>
+#import <SDL2/SDL.h>
 #import "SDLMain.h"
 #import <sys/param.h> /* for MAXPATHLEN */
 #import <unistd.h>
Index: src/bspatch.c
===================================================================
--- src/bspatch.c	(revision 6303)
+++ src/bspatch.c	(working copy)
@@ -30,6 +30,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <fcntl.h>
+#include <sys/types.h>
 
 static off_t offtin(u_char *buf)
 {
Index: src/tSDL.h
===================================================================
--- src/tSDL.h	(revision 6303)
+++ src/tSDL.h	(working copy)
@@ -1,8 +1,8 @@
 #ifdef __APPLE__
-#include <SDL/SDL.h>
-#include <SDL_ttf/SDL_ttf.h>
-//#include <SDL_mixer/SDL_mixer.h>
-#include <SDL_image/SDL_image.h>
+#include <SDL2/SDL.h>
+#include <SDL2_ttf/SDL_ttf.h>
+//#include <SDL2_mixer/SDL_mixer.h>
+#include <SDL2_image/SDL_image.h>
 #else
 #include <SDL.h>
 #include <SDL_ttf.h>
Index: src/libtcod_import/libtcod.h
===================================================================
--- src/libtcod_import/libtcod.h	(revision 6303)
+++ src/libtcod_import/libtcod.h	(working copy)
@@ -82,7 +82,7 @@
 
 // SDL_main support for OSX
 #ifdef TCOD_MACOSX
-#include "SDL/SDL.h"
+#include "SDL2/SDL.h"
 #endif
 
 // base types
Index: src/luajit2/src/lj_err.c
===================================================================
--- src/luajit2/src/lj_err.c	(revision 6303)
+++ src/luajit2/src/lj_err.c	(working copy)
@@ -17,6 +17,10 @@
 #include "lj_trace.h"
 #include "lj_vm.h"
 
+#ifdef __APPLE__
+#include "unwind.h"
+#endif
+
 /*
 ** LuaJIT can either use internal or external frame unwinding:
 **
@@ -191,13 +195,13 @@
 #if !LJ_TARGET_ARM
 
 #define LJ_UEXCLASS		0x4c55414a49543200ULL	/* LUAJIT2\0 */
-#define LJ_UEXCLASS_MAKE(c)	(LJ_UEXCLASS | (_Unwind_Exception_Class)(c))
+#define LJ_UEXCLASS_MAKE(c)	(LJ_UEXCLASS | (uint64_t)(c))
 #define LJ_UEXCLASS_CHECK(cl)	(((cl) ^ LJ_UEXCLASS) <= 0xff)
 #define LJ_UEXCLASS_ERRCODE(cl)	((int)((cl) & 0xff))
 
 /* DWARF2 personality handler referenced from interpreter .eh_frame. */
 LJ_FUNCA int lj_err_unwind_dwarf(int version, _Unwind_Action actions,
-  _Unwind_Exception_Class uexclass, struct _Unwind_Exception *uex,
+  uint64_t uexclass, struct _Unwind_Exception *uex,
   struct _Unwind_Context *ctx)
 {
   void *cf;
@@ -232,7 +236,7 @@
       return _URC_CONTINUE_UNWIND;
     } else if (cf) {
       _Unwind_SetGR(ctx, LJ_TARGET_EHRETREG, errcode);
-      _Unwind_SetIP(ctx, (_Unwind_Ptr)(cframe_unwind_ff(cf) ?
+      _Unwind_SetIP(ctx, (uintptr_t)(cframe_unwind_ff(cf) ?
 				       lj_vm_unwind_ff_eh :
 				       lj_vm_unwind_c_eh));
       return _URC_INSTALL_CONTEXT;
@@ -243,7 +247,7 @@
       ** Real fix: http://gcc.gnu.org/viewcvs/trunk/gcc/unwind-dw2.c?r1=121165&r2=124837&pathrev=153877&diff_format=h
       */
       _Unwind_SetGR(ctx, LJ_TARGET_EHRETREG, errcode);
-      _Unwind_SetIP(ctx, (_Unwind_Ptr)lj_vm_unwind_rethrow);
+      _Unwind_SetIP(ctx, (uintptr_t)lj_vm_unwind_rethrow);
       return _URC_INSTALL_CONTEXT;
     }
 #endif
Index: src/music.h
===================================================================
--- src/music.h	(revision 6303)
+++ src/music.h	(working copy)
@@ -22,21 +22,25 @@
 #define _MUSIC_H_
 
 #ifdef __APPLE__
-#include <al.h>
-#include <alc.h>
-#include <vorbisfile.h>
+#include <OpenAL/al.h>
+#include <OpenAL/alc.h>
+#include <vorbis/vorbisfile.h>
+#include <SDL2/SDL.h>
+#include <SDL2/SDL_thread.h>
 #elif defined(WIN32)
 #include <AL/al.h>
 #include <AL/alc.h>
 #include <vorbis/vorbisfile.h>
+#include "SDL.h"
+#include "SDL_thread.h"
 #else
 #include <AL/al.h>
 #include <AL/alc.h>
 #include <vorbis/vorbisfile.h>
+#include "SDL.h"
+#include "SDL_thread.h"
 #endif
 
-#include "SDL.h"
-#include "SDL_thread.h"
 #include "lua.h"
 #include "lauxlib.h"
 #include "types.h"
Index: src/core_lua.c
===================================================================
--- src/core_lua.c	(revision 6303)
+++ src/core_lua.c	(working copy)
@@ -37,7 +37,12 @@
 #include "useshader.h"
 #include <math.h>
 #include <time.h>
+
+#ifdef __APPLE__
+#include <libpng/png.h>
+#else
 #include <png.h>
+#endif
 
 extern SDL_Window *window;
 
Index: premake4.lua
===================================================================
--- premake4.lua	(revision 6303)
+++ premake4.lua	(working copy)
@@ -37,7 +37,7 @@
 	}
 
 configuration "macosx"
-	buildoptions { "-pagezero_size 10000", "-image_base 100000000" }
+	buildoptions { "-pagezero_size 10000", "-image_base 100000000", "-Wno-return-type", "-isysroot /Developer/SDKs/MacOSX10.5.sdk", "-mmacosx-version-min=10.5" }
 
 configuration "Debug"
 	defines { }

Post Reply