Jelajahi Sumber

Added iOS build config.

bkaradzic 12 tahun lalu
induk
melakukan
ebcde34c98
4 mengubah file dengan 34 tambahan dan 6 penghapusan
  1. 2 2
      include/bx/macros.h
  2. 2 2
      include/bx/sem.h
  3. 1 1
      include/bx/timer.h
  4. 29 1
      premake/toolchain.lua

+ 2 - 2
include/bx/macros.h

@@ -103,11 +103,11 @@
 #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 (BX_PLATFORM_ANDROID|BX_PLATFORM_LINUX|BX_PLATFORM_OSX|BX_PLATFORM_QNX|BX_PLATFORM_WINDOWS)
 #endif // BX_CONFIG_CRT_FILE_READER_WRITER
 
 #ifndef BX_CONFIG_SEMAPHORE_PTHREAD
-#	define BX_CONFIG_SEMAPHORE_PTHREAD BX_PLATFORM_OSX|BX_PLATFORM_IOS
+#	define BX_CONFIG_SEMAPHORE_PTHREAD (BX_PLATFORM_OSX|BX_PLATFORM_IOS)
 #endif // BX_CONFIG_SEMAPHORE_PTHREAD
 
 #endif // __BX_MACROS_H__

+ 2 - 2
include/bx/sem.h

@@ -75,8 +75,8 @@ namespace bx
 			int result = pthread_mutex_lock(&m_mutex);
 			BX_CHECK(0 == result, "pthread_mutex_lock %d", result);
 
-#		if BX_PLATFORM_NACL || BX_PLATFORM_OSX
-			BX_CHECK(-1 == _msecs, "NaCl and OSX don't support pthread_cond_timedwait at this moment.");
+#		if BX_PLATFORM_NACL || BX_PLATFORM_OSX || BX_PLATFORM_IOS
+			BX_CHECK(-1 == _msecs, "NaCl, iOS and OSX don't support pthread_cond_timedwait at this moment.");
 			while (0 == result
 			&&     0 >= m_count)
 			{

+ 1 - 1
include/bx/timer.h

@@ -10,7 +10,7 @@
 
 #if BX_PLATFORM_ANDROID
 #	include <time.h> // clock, clock_gettime
-#elif BX_PLATFORM_NACL || BX_PLATFORM_LINUX || BX_PLATFORM_OSX || BX_PLATFORM_QNX
+#elif BX_PLATFORM_NACL || BX_PLATFORM_LINUX || BX_PLATFORM_OSX || BX_PLATFORM_IOS || BX_PLATFORM_QNX
 #	include <sys/time.h> // gettimeofday
 #elif BX_PLATFORM_WINDOWS
 #	include <windows.h>

+ 29 - 1
premake/toolchain.lua

@@ -19,7 +19,8 @@ function toolchain(_buildDir, _libDir)
 			{ "nacl", "Native Client" },
 			{ "nacl-arm", "Native Client - ARM" },
 			{ "pnacl", "Native Client - PNaCl" },
-			{ "osx", "OS X" },
+			{ "osx", "OSX" },
+			{ "ios", "iOS" },
 			{ "qnx-arm", "QNX/Blackberry - ARM" },
 		}
 	}
@@ -119,6 +120,13 @@ function toolchain(_buildDir, _libDir)
 			location (_buildDir .. "projects/" .. _ACTION .. "-osx")
 		end
 
+		if "ios" == _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")
+		end
+
 		if "qnx-arm" == _OPTIONS["gcc"] then
 
 			if not os.getenv("QNX_HOST") then
@@ -420,6 +428,26 @@ function toolchain(_buildDir, _libDir)
 		}
 		includedirs { bxDir .. "include/compat/osx" }
 
+	configuration { "ios" }
+		linkoptions {
+			"--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk",
+			"-march=armv7-a",
+			"-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/usr/lib/system",
+			"-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/System/Library/Frameworks",
+			"-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/System/Library/PrivateFrameworks",
+		}
+		buildoptions {
+			"--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk",
+			"-mthumb",
+			"-march=armv7-a",
+			"-mfloat-abi=softfp",
+			"-mfpu=neon",
+			"-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")