mirror of
https://github.com/bkaradzic/bx.git
synced 2026-02-17 20:52:37 +01:00
Added RaspberryPi platform.
This commit is contained in:
@@ -16,7 +16,8 @@
|
||||
|| BX_PLATFORM_IOS \
|
||||
|| BX_PLATFORM_LINUX \
|
||||
|| BX_PLATFORM_NACL \
|
||||
|| BX_PLATFORM_OSX
|
||||
|| BX_PLATFORM_OSX \
|
||||
|| BX_PLATFORM_RPI
|
||||
|
||||
# include <sched.h> // sched_yield
|
||||
# if BX_PLATFORM_FREEBSD || BX_PLATFORM_IOS || BX_PLATFORM_NACL || BX_PLATFORM_OSX
|
||||
@@ -30,10 +31,10 @@
|
||||
# include <dlfcn.h> // dlopen, dlclose, dlsym
|
||||
# endif // BX_PLATFORM_NACL
|
||||
|
||||
# if BX_PLATFORM_LINUX
|
||||
# if BX_PLATFORM_LINUX || BX_PLATFORM_RPI
|
||||
# include <unistd.h> // syscall
|
||||
# include <sys/syscall.h>
|
||||
# endif // BX_PLATFORM_LINUX
|
||||
# endif // BX_PLATFORM_LINUX || BX_PLATFORM_RPI
|
||||
|
||||
# if BX_PLATFORM_ANDROID
|
||||
# include "debug.h" // getTid is not implemented...
|
||||
@@ -79,7 +80,7 @@ namespace bx
|
||||
{
|
||||
#if BX_PLATFORM_WINDOWS
|
||||
return ::GetCurrentThreadId();
|
||||
#elif BX_PLATFORM_LINUX
|
||||
#elif BX_PLATFORM_LINUX || BX_PLATFORM_RPI
|
||||
return (pid_t)::syscall(SYS_gettid);
|
||||
#elif BX_PLATFORM_IOS || BX_PLATFORM_OSX
|
||||
return (mach_port_t)::pthread_mach_thread_np(pthread_self() );
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#define BX_PLATFORM_NACL 0
|
||||
#define BX_PLATFORM_OSX 0
|
||||
#define BX_PLATFORM_QNX 0
|
||||
#define BX_PLATFORM_RPI 0
|
||||
#define BX_PLATFORM_WINDOWS 0
|
||||
#define BX_PLATFORM_WINRT 0
|
||||
#define BX_PLATFORM_XBOX360 0
|
||||
@@ -67,6 +68,10 @@
|
||||
# undef BX_PLATFORM_WINRT
|
||||
# define BX_PLATFORM_WINRT 1
|
||||
# endif
|
||||
#elif defined(BCM2708)
|
||||
// RaspberryPi compiler defines __linux__
|
||||
# undef BX_PLATFORM_RPI
|
||||
# define BX_PLATFORM_RPI 1
|
||||
#elif defined(__native_client__)
|
||||
// NaCl compiler defines __linux__
|
||||
# undef BX_PLATFORM_NACL
|
||||
@@ -106,6 +111,7 @@
|
||||
|| BX_PLATFORM_NACL \
|
||||
|| BX_PLATFORM_OSX \
|
||||
|| BX_PLATFORM_QNX \
|
||||
|| BX_PLATFORM_RPI \
|
||||
)
|
||||
|
||||
// http://sourceforge.net/apps/mediawiki/predef/index.php?title=Architectures
|
||||
@@ -175,6 +181,8 @@
|
||||
# define BX_PLATFORM_NAME "OSX"
|
||||
#elif BX_PLATFORM_QNX
|
||||
# define BX_PLATFORM_NAME "QNX"
|
||||
#elif BX_PLATFORM_RPI
|
||||
# define BX_PLATFORM_NAME "RaspberryPi"
|
||||
#elif BX_PLATFORM_WINDOWS
|
||||
# define BX_PLATFORM_NAME "Windows"
|
||||
#elif BX_PLATFORM_WINRT
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
# include <time.h> // clock, clock_gettime
|
||||
#elif BX_PLATFORM_EMSCRIPTEN
|
||||
# include <emscripten.h>
|
||||
#elif BX_PLATFORM_FREEBSD || BX_PLATFORM_LINUX || BX_PLATFORM_NACL || BX_PLATFORM_OSX || BX_PLATFORM_IOS || BX_PLATFORM_QNX
|
||||
# include <sys/time.h> // gettimeofday
|
||||
#elif BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT
|
||||
# include <windows.h>
|
||||
#else
|
||||
# include <sys/time.h> // gettimeofday
|
||||
#endif // BX_PLATFORM_
|
||||
|
||||
namespace bx
|
||||
|
||||
@@ -20,14 +20,15 @@ function toolchain(_buildDir, _libDir)
|
||||
{ "freebsd", "FreeBSD" },
|
||||
{ "linux-gcc", "Linux (GCC compiler)" },
|
||||
{ "linux-clang", "Linux (Clang compiler)" },
|
||||
{ "ios-arm", "iOS - ARM" },
|
||||
{ "ios-simulator", "iOS - Simulator" },
|
||||
{ "mingw", "MinGW" },
|
||||
{ "nacl", "Native Client" },
|
||||
{ "nacl-arm", "Native Client - ARM" },
|
||||
{ "pnacl", "Native Client - PNaCl" },
|
||||
{ "osx", "OSX" },
|
||||
{ "ios-arm", "iOS - ARM" },
|
||||
{ "ios-simulator", "iOS - Simulator" },
|
||||
{ "pnacl", "Native Client - PNaCl" },
|
||||
{ "qnx-arm", "QNX/Blackberry - ARM" },
|
||||
{ "rpi", "RaspberryPi" },
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,6 +104,20 @@ function toolchain(_buildDir, _libDir)
|
||||
location (_buildDir .. "projects/" .. _ACTION .. "-freebsd")
|
||||
end
|
||||
|
||||
if "ios-arm" == _OPTIONS["gcc"] then
|
||||
premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
|
||||
premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
|
||||
premake.gcc.ar = "ar"
|
||||
location (_buildDir .. "projects/" .. _ACTION .. "-ios-arm")
|
||||
end
|
||||
|
||||
if "ios-simulator" == _OPTIONS["gcc"] then
|
||||
premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
|
||||
premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
|
||||
premake.gcc.ar = "ar"
|
||||
location (_buildDir .. "projects/" .. _ACTION .. "-ios-simulator")
|
||||
end
|
||||
|
||||
if "linux-gcc" == _OPTIONS["gcc"] then
|
||||
location (_buildDir .. "projects/" .. _ACTION .. "-linux")
|
||||
end
|
||||
@@ -159,6 +174,10 @@ function toolchain(_buildDir, _libDir)
|
||||
location (_buildDir .. "projects/" .. _ACTION .. "-nacl-arm")
|
||||
end
|
||||
|
||||
if "osx" == _OPTIONS["gcc"] then
|
||||
location (_buildDir .. "projects/" .. _ACTION .. "-osx")
|
||||
end
|
||||
|
||||
if "pnacl" == _OPTIONS["gcc"] then
|
||||
|
||||
if not os.getenv("NACL_SDK_ROOT") then
|
||||
@@ -178,24 +197,6 @@ function toolchain(_buildDir, _libDir)
|
||||
location (_buildDir .. "projects/" .. _ACTION .. "-pnacl")
|
||||
end
|
||||
|
||||
if "osx" == _OPTIONS["gcc"] then
|
||||
location (_buildDir .. "projects/" .. _ACTION .. "-osx")
|
||||
end
|
||||
|
||||
if "ios-arm" == _OPTIONS["gcc"] then
|
||||
premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
|
||||
premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
|
||||
premake.gcc.ar = "ar"
|
||||
location (_buildDir .. "projects/" .. _ACTION .. "-ios-arm")
|
||||
end
|
||||
|
||||
if "ios-simulator" == _OPTIONS["gcc"] then
|
||||
premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
|
||||
premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
|
||||
premake.gcc.ar = "ar"
|
||||
location (_buildDir .. "projects/" .. _ACTION .. "-ios-simulator")
|
||||
end
|
||||
|
||||
if "qnx-arm" == _OPTIONS["gcc"] then
|
||||
|
||||
if not os.getenv("QNX_HOST") then
|
||||
@@ -207,6 +208,10 @@ function toolchain(_buildDir, _libDir)
|
||||
premake.gcc.ar = "$(QNX_HOST)/usr/bin/arm-unknown-nto-qnx8.0.0eabi-ar"
|
||||
location (_buildDir .. "projects/" .. _ACTION .. "-qnx-arm")
|
||||
end
|
||||
|
||||
if "rpi" == _OPTIONS["gcc"] then
|
||||
location (_buildDir .. "projects/" .. _ACTION .. "-rpi")
|
||||
end
|
||||
end
|
||||
|
||||
flags {
|
||||
@@ -695,6 +700,31 @@ function toolchain(_buildDir, _libDir)
|
||||
"-Wundef",
|
||||
}
|
||||
|
||||
configuration { "rpi" }
|
||||
defines {
|
||||
"BCM2708", -- There is no special prefedined compiler symbol to detect RaspberryPi, faking it.
|
||||
}
|
||||
buildoptions {
|
||||
"-std=c++0x",
|
||||
"-U__STRICT_ANSI__",
|
||||
"-Wunused-value",
|
||||
"-Wundef",
|
||||
}
|
||||
includedirs {
|
||||
"/opt/vc/include",
|
||||
"/opt/vc/include/interface/vcos/pthreads",
|
||||
"/opt/vc/include/interface/vmcs_host/linux",
|
||||
}
|
||||
libdirs {
|
||||
"/opt/vc/lib",
|
||||
}
|
||||
links {
|
||||
"rt",
|
||||
}
|
||||
linkoptions {
|
||||
"-Wl,--gc-sections",
|
||||
}
|
||||
|
||||
configuration {} -- reset configuration
|
||||
end
|
||||
|
||||
@@ -718,7 +748,7 @@ function strip()
|
||||
"@$(ANDROID_NDK_X86)/bin/i686-linux-android-strip -s \"$(TARGET)\""
|
||||
}
|
||||
|
||||
configuration { "linux-*", "Release" }
|
||||
configuration { "linux-* or rpi", "Release" }
|
||||
postbuildcommands {
|
||||
"@echo Stripping symbols.",
|
||||
"@strip -s \"$(TARGET)\""
|
||||
|
||||
Reference in New Issue
Block a user