Kaynağa Gözat

Added BX_PLATFORM_QNX.

bkaradzic 12 yıl önce
ebeveyn
işleme
5b010b342e
3 değiştirilmiş dosya ile 34 ekleme ve 5 silme
  1. 6 1
      include/bx/platform.h
  2. 1 1
      include/bx/timer.h
  3. 27 3
      premake/toolchain.lua

+ 6 - 1
include/bx/platform.h

@@ -16,6 +16,7 @@
 #define BX_PLATFORM_LINUX 0
 #define BX_PLATFORM_NACL 0
 #define BX_PLATFORM_OSX 0
+#define BX_PLATFORM_QNX 0
 #define BX_PLATFORM_WINDOWS 0
 #define BX_PLATFORM_XBOX360 0
 
@@ -71,6 +72,9 @@
 #elif defined(EMSCRIPTEN)
 #	undef BX_PLATFORM_EMSCRIPTEN
 #	define BX_PLATFORM_EMSCRIPTEN 1
+#elif defined(__QNX__)
+#	undef BX_PLATFORM_QNX
+#	define BX_PLATFORM_QNX 1
 #else
 #	error "BX_PLATFORM_* is not defined!"
 #endif //
@@ -80,7 +84,8 @@
 						|| BX_PLATFORM_IOS \
 						|| BX_PLATFORM_LINUX \
 						|| BX_PLATFORM_NACL \
-						|| BX_PLATFORM_OSX)
+						|| BX_PLATFORM_OSX \
+						|| BX_PLATFORM_QNX)
 
 // http://sourceforge.net/apps/mediawiki/predef/index.php?title=Architectures
 #if defined(__arm__)

+ 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
+#elif BX_PLATFORM_NACL || BX_PLATFORM_LINUX || BX_PLATFORM_OSX || BX_PLATFORM_QNX
 #	include <sys/time.h> // gettimeofday
 #elif BX_PLATFORM_WINDOWS
 #	include <windows.h>

+ 27 - 3
premake/toolchain.lua

@@ -19,6 +19,7 @@ function toolchain(_buildDir, _libDir)
 			{ "nacl-arm", "Native Client - ARM" },
 			{ "pnacl", "Native Client - PNaCl" },
 			{ "osx", "OS X" },
+			{ "qnx-arm", "QNX/Blackberry - ARM" },
 		}
 	}
 
@@ -107,6 +108,18 @@ function toolchain(_buildDir, _libDir)
 		if "osx" == _OPTIONS["gcc"] then
 			location (_buildDir .. "projects/" .. _ACTION .. "-osx")
 		end
+
+		if "qnx-arm" == _OPTIONS["gcc"] then
+
+			if not os.getenv("QNX_HOST") then
+				print("Set QNX_HOST enviroment variables.")
+			end
+
+			premake.gcc.cc = "$(QNX_HOST)/usr/bin/arm-unknown-nto-qnx8.0.0eabi-gcc"
+			premake.gcc.cxx = "$(QNX_HOST)/usr/bin/arm-unknown-nto-qnx8.0.0eabi-g++"
+			premake.gcc.ar = "$(QNX_HOST)/usr/bin/arm-unknown-nto-qnx8.0.0eabi-ar"
+			location (_buildDir .. "projects/" .. _ACTION .. "-qnx-arm")
+		end
 	end
 
 	flags {
@@ -322,7 +335,7 @@ function toolchain(_buildDir, _libDir)
 			"_XBOX",
 		}
 
-	configuration { "macosx", "x32" }
+	configuration { "osx", "x32" }
 		targetdir (_buildDir .. "osx32_gcc" .. "/bin")
 		objdir (_buildDir .. "osx32_gcc" .. "/obj")
 		libdirs { _libDir .. "lib/osx32_gcc" }
@@ -330,7 +343,7 @@ function toolchain(_buildDir, _libDir)
 			"-m32",
 		}
 
-	configuration { "macosx", "x64" }
+	configuration { "osx", "x64" }
 		targetdir (_buildDir .. "osx64_gcc" .. "/bin")
 		objdir (_buildDir .. "osx64_gcc" .. "/obj")
 		libdirs { _libDir .. "lib/osx64_gcc" }
@@ -338,7 +351,7 @@ function toolchain(_buildDir, _libDir)
 			"-m64",
 		}
 
-	configuration { "macosx" }
+	configuration { "osx" }
 		buildoptions {
 			"-U__STRICT_ANSI__",
 			"-Wfatal-errors",
@@ -347,5 +360,16 @@ function toolchain(_buildDir, _libDir)
 		}
 		includedirs { bxDir .. "include/compat/osx" }
 
+	configuration { "qnx-arm" }
+--		includedirs { bxDir .. "include/compat/qnx" }
+		buildoptions {
+			"-std=c++0x",
+			"-U__STRICT_ANSI__",
+			"-Wno-psabi", -- note: the mangling of 'va_list' has changed in GCC 4.4.0
+		}
+		targetdir (_buildDir .. "qnx-arm" .. "/bin")
+		objdir (_buildDir .. "qnx-arm" .. "/obj")
+		libdirs { _libDir .. "lib/qnx-arm" }
+
 	configuration {} -- reset configuration
 end