Quellcode durchsuchen

Added iOS simulator configuration.

bkaradzic vor 12 Jahren
Ursprung
Commit
8076ad6df7
4 geänderte Dateien mit 56 neuen und 7 gelöschten Zeilen
  1. 13 0
      include/bx/debug.h
  2. 9 2
      include/bx/macros.h
  3. 1 1
      include/bx/readerwriter.h
  4. 33 4
      premake/toolchain.lua

+ 13 - 0
include/bx/debug.h

@@ -12,6 +12,13 @@
 #	include <android/log.h>
 #elif BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360
 extern "C" __declspec(dllimport) void __stdcall OutputDebugStringA(const char* _str);
+#elif BX_PLATFORM_IOS || BX_PLATFORM_OSX
+#	if defined(__OBJC__)
+#		import <Foundation/NSObjCRuntime.h>
+#	else
+#		include <CoreFoundation/CFString.h>
+extern "C" void NSLog(CFStringRef _format, ...);
+#	endif // defined(__OBJC__)
 #else
 #	include <stdio.h>
 #endif // BX_PLATFORM_WINDOWS
@@ -40,6 +47,12 @@ namespace bx
 		__android_log_write(ANDROID_LOG_DEBUG, "", _out);
 #elif BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360
 		OutputDebugStringA(_out);
+#elif BX_PLATFORM_IOS || BX_PLATFORM_OSX
+#	if defined(__OBJC__)
+		NSLog(@"%s", _out);
+#	else
+		NSLog(__CFStringMakeConstantString("%s"), _out);
+#	endif // defined(__OBJC__)
 #else
 		fputs(_out, stderr);
 		fflush(stderr);

+ 9 - 2
include/bx/macros.h

@@ -41,7 +41,7 @@
 #	define BX_OVERRIDE
 #	define BX_PRINTF_ARGS(_format, _args) __attribute__ ( (format(__printf__, _format, _args) ) )
 #	define BX_STATIC_ASSERT(_condition, ...) static_assert(_condition, __VA_ARGS__)
-#	if BX_COMPILER_CLANG
+#	if BX_COMPILER_CLANG || BX_PLATFORM_IOS
 #		define BX_THREAD /* not supported right now */
 #	else
 #		define BX_THREAD __thread
@@ -103,7 +103,14 @@
 #endif // BX_CONFIG_SPSCQUEUE_USE_MUTEX
 
 #ifndef BX_CONFIG_CRT_FILE_READER_WRITER
-#	define BX_CONFIG_CRT_FILE_READER_WRITER (BX_PLATFORM_ANDROID|BX_PLATFORM_LINUX|BX_PLATFORM_OSX|BX_PLATFORM_QNX|BX_PLATFORM_WINDOWS)
+#	define BX_CONFIG_CRT_FILE_READER_WRITER (0 \
+				|BX_PLATFORM_ANDROID \
+				|BX_PLATFORM_IOS \
+				|BX_PLATFORM_LINUX \
+				|BX_PLATFORM_OSX \
+				|BX_PLATFORM_QNX \
+				|BX_PLATFORM_WINDOWS \
+				)
 #endif // BX_CONFIG_CRT_FILE_READER_WRITER
 
 #ifndef BX_CONFIG_SEMAPHORE_PTHREAD

+ 1 - 1
include/bx/readerwriter.h

@@ -15,7 +15,7 @@
 #if BX_COMPILER_MSVC
 #	define fseeko64 _fseeki64
 #	define ftello64 _ftelli64
-#elif BX_PLATFORM_ANDROID|BX_PLATFORM_OSX|BX_PLATFORM_QNX
+#elif BX_PLATFORM_ANDROID|BX_PLATFORM_IOS|BX_PLATFORM_OSX|BX_PLATFORM_QNX
 #	define fseeko64 fseeko
 #	define ftello64 ftello
 #endif // BX_

+ 33 - 4
premake/toolchain.lua

@@ -20,7 +20,8 @@ function toolchain(_buildDir, _libDir)
 			{ "nacl-arm", "Native Client - ARM" },
 			{ "pnacl", "Native Client - PNaCl" },
 			{ "osx", "OSX" },
-			{ "ios", "iOS" },
+			{ "ios-arm", "iOS - ARM" },
+			{ "ios-simulator", "iOS - Simulator" },
 			{ "qnx-arm", "QNX/Blackberry - ARM" },
 		}
 	}
@@ -120,11 +121,18 @@ function toolchain(_buildDir, _libDir)
 			location (_buildDir .. "projects/" .. _ACTION .. "-osx")
 		end
 
-		if "ios" == _OPTIONS["gcc"] then
+		if "ios-arm" == _OPTIONS["gcc"] then
 			premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2"
 			premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-llvm-g++-4.2"
 			premake.gcc.ar = "ar"
-			location (_buildDir .. "projects/" .. _ACTION .. "-ios")
+			location (_buildDir .. "projects/" .. _ACTION .. "-ios-arm")
+		end
+
+		if "ios-simulator" == _OPTIONS["gcc"] then
+			premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/i686-apple-darwin11-llvm-gcc-4.2"
+			premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/i686-apple-darwin11-llvm-g++-4.2"
+			premake.gcc.ar = "ar"
+			location (_buildDir .. "projects/" .. _ACTION .. "-ios-simulator")
 		end
 
 		if "qnx-arm" == _OPTIONS["gcc"] then
@@ -428,7 +436,7 @@ function toolchain(_buildDir, _libDir)
 		}
 		includedirs { bxDir .. "include/compat/osx" }
 
-	configuration { "ios" }
+	configuration { "ios-arm" }
 		targetdir (_buildDir .. "ios-arm" .. "/bin")
 		objdir (_buildDir .. "ios-arm" .. "/obj")
 		libdirs { _libDir .. "lib/ios-arm" }
@@ -451,6 +459,27 @@ function toolchain(_buildDir, _libDir)
 		}
 		includedirs { bxDir .. "include/compat/osx" }
 
+	configuration { "ios-simulator" }
+		targetdir (_buildDir .. "ios-simulator" .. "/bin")
+		objdir (_buildDir .. "ios-simulator" .. "/obj")
+		libdirs { _libDir .. "lib/ios-simulator" }
+		linkoptions {
+			"--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk",
+			"-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk/usr/lib/system",
+			"-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk/System/Library/Frameworks",
+			"-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk/System/Library/PrivateFrameworks",
+		}
+		buildoptions {
+			"--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk",
+			"-miphoneos-version-min=3.0.0",
+			"-fobjc-abi-version=2",
+			"-fobjc-legacy-dispatch",
+			"-U__STRICT_ANSI__",
+			"-Wfatal-errors",
+			"-Wunused-value",
+		}
+		includedirs { bxDir .. "include/compat/osx" }
+
 	configuration { "qnx-arm" }
 		targetdir (_buildDir .. "qnx-arm" .. "/bin")
 		objdir (_buildDir .. "qnx-arm" .. "/obj")