From ebcde34c98e99abb2588cccade056e23f9037511 Mon Sep 17 00:00:00 2001 From: bkaradzic Date: Fri, 12 Jul 2013 22:22:15 -0700 Subject: [PATCH] Added iOS build config. --- include/bx/macros.h | 4 ++-- include/bx/sem.h | 4 ++-- include/bx/timer.h | 2 +- premake/toolchain.lua | 30 +++++++++++++++++++++++++++++- 4 files changed, 34 insertions(+), 6 deletions(-) diff --git a/include/bx/macros.h b/include/bx/macros.h index 3a82d7d..237b7e0 100644 --- a/include/bx/macros.h +++ b/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__ diff --git a/include/bx/sem.h b/include/bx/sem.h index 81d936c..7db91d2 100644 --- a/include/bx/sem.h +++ b/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) { diff --git a/include/bx/timer.h b/include/bx/timer.h index 15802c2..75b629c 100644 --- a/include/bx/timer.h +++ b/include/bx/timer.h @@ -10,7 +10,7 @@ #if BX_PLATFORM_ANDROID # include // 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 // gettimeofday #elif BX_PLATFORM_WINDOWS # include diff --git a/premake/toolchain.lua b/premake/toolchain.lua index 10c8d09..aa69553 100755 --- a/premake/toolchain.lua +++ b/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")