mirror of
https://github.com/bkaradzic/bx.git
synced 2026-02-17 20:52:37 +01:00
feat: add visionOS support (#323)
* feat: define BX_PLATFORM_VISIONOS * chore: add xros, xrsimulator toolchain support
This commit is contained in:
committed by
GitHub
parent
0b8bb71897
commit
f8dc7147b6
@@ -59,6 +59,7 @@
|
|||||||
#define BX_PLATFORM_PS4 0
|
#define BX_PLATFORM_PS4 0
|
||||||
#define BX_PLATFORM_PS5 0
|
#define BX_PLATFORM_PS5 0
|
||||||
#define BX_PLATFORM_RPI 0
|
#define BX_PLATFORM_RPI 0
|
||||||
|
#define BX_PLATFORM_VISIONOS 0
|
||||||
#define BX_PLATFORM_WINDOWS 0
|
#define BX_PLATFORM_WINDOWS 0
|
||||||
#define BX_PLATFORM_WINRT 0
|
#define BX_PLATFORM_WINRT 0
|
||||||
#define BX_PLATFORM_XBOXONE 0
|
#define BX_PLATFORM_XBOXONE 0
|
||||||
@@ -196,6 +197,9 @@
|
|||||||
|| defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__)
|
|| defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__)
|
||||||
# undef BX_PLATFORM_IOS
|
# undef BX_PLATFORM_IOS
|
||||||
# define BX_PLATFORM_IOS 1
|
# define BX_PLATFORM_IOS 1
|
||||||
|
#elif defined(__has_builtin) && __has_builtin(__is_target_os) && __is_target_os(xros)
|
||||||
|
# undef BX_PLATFORM_VISIONOS
|
||||||
|
# define BX_PLATFORM_VISIONOS 1
|
||||||
#elif defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
|
#elif defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
|
||||||
# undef BX_PLATFORM_OSX
|
# undef BX_PLATFORM_OSX
|
||||||
# define BX_PLATFORM_OSX __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
|
# define BX_PLATFORM_OSX __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
|
||||||
@@ -275,6 +279,7 @@
|
|||||||
|| BX_PLATFORM_PS4 \
|
|| BX_PLATFORM_PS4 \
|
||||||
|| BX_PLATFORM_PS5 \
|
|| BX_PLATFORM_PS5 \
|
||||||
|| BX_PLATFORM_RPI \
|
|| BX_PLATFORM_RPI \
|
||||||
|
|| BX_PLATFORM_VISIONOS \
|
||||||
)
|
)
|
||||||
|
|
||||||
///
|
///
|
||||||
@@ -291,6 +296,7 @@
|
|||||||
|| BX_PLATFORM_PS4 \
|
|| BX_PLATFORM_PS4 \
|
||||||
|| BX_PLATFORM_PS5 \
|
|| BX_PLATFORM_PS5 \
|
||||||
|| BX_PLATFORM_RPI \
|
|| BX_PLATFORM_RPI \
|
||||||
|
|| BX_PLATFORM_VISIONOS \
|
||||||
|| BX_PLATFORM_WINDOWS \
|
|| BX_PLATFORM_WINDOWS \
|
||||||
|| BX_PLATFORM_WINRT \
|
|| BX_PLATFORM_WINRT \
|
||||||
|| BX_PLATFORM_XBOXONE \
|
|| BX_PLATFORM_XBOXONE \
|
||||||
@@ -380,6 +386,8 @@
|
|||||||
# define BX_PLATFORM_NAME "Hurd"
|
# define BX_PLATFORM_NAME "Hurd"
|
||||||
#elif BX_PLATFORM_IOS
|
#elif BX_PLATFORM_IOS
|
||||||
# define BX_PLATFORM_NAME "iOS"
|
# define BX_PLATFORM_NAME "iOS"
|
||||||
|
#elif BX_PLATFORM_VISIONOS
|
||||||
|
# define BX_PLATFORM_NAME "visionOS"
|
||||||
#elif BX_PLATFORM_LINUX
|
#elif BX_PLATFORM_LINUX
|
||||||
# define BX_PLATFORM_NAME "Linux"
|
# define BX_PLATFORM_NAME "Linux"
|
||||||
#elif BX_PLATFORM_NONE
|
#elif BX_PLATFORM_NONE
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
#elif BX_COMPILER_CLANG \
|
#elif BX_COMPILER_CLANG \
|
||||||
&& !BX_PLATFORM_EMSCRIPTEN \
|
&& !BX_PLATFORM_EMSCRIPTEN \
|
||||||
&& !BX_PLATFORM_IOS \
|
&& !BX_PLATFORM_IOS \
|
||||||
|
&& !BX_PLATFORM_VISIONOS \
|
||||||
&& BX_CLANG_HAS_EXTENSION(attribute_ext_vector_type)
|
&& BX_CLANG_HAS_EXTENSION(attribute_ext_vector_type)
|
||||||
# undef BX_SIMD_LANGEXT
|
# undef BX_SIMD_LANGEXT
|
||||||
# define BX_SIMD_LANGEXT 1
|
# define BX_SIMD_LANGEXT 1
|
||||||
|
|||||||
@@ -82,6 +82,8 @@ function toolchain(_buildDir, _libDir)
|
|||||||
{ "ios-arm", "iOS - ARM" },
|
{ "ios-arm", "iOS - ARM" },
|
||||||
{ "ios-arm64", "iOS - ARM64" },
|
{ "ios-arm64", "iOS - ARM64" },
|
||||||
{ "tvos-arm64", "tvOS - ARM64" },
|
{ "tvos-arm64", "tvOS - ARM64" },
|
||||||
|
{ "xros-arm64", "visionOS ARM64" },
|
||||||
|
{ "xros-simulator", "visionOS - Simulator" },
|
||||||
{ "mingw-gcc", "MinGW" },
|
{ "mingw-gcc", "MinGW" },
|
||||||
{ "mingw-clang", "MinGW (clang compiler)" },
|
{ "mingw-clang", "MinGW (clang compiler)" },
|
||||||
{ "netbsd", "NetBSD" },
|
{ "netbsd", "NetBSD" },
|
||||||
@@ -114,6 +116,7 @@ function toolchain(_buildDir, _libDir)
|
|||||||
{ "osx", "OSX" },
|
{ "osx", "OSX" },
|
||||||
{ "ios", "iOS" },
|
{ "ios", "iOS" },
|
||||||
{ "tvos", "tvOS" },
|
{ "tvos", "tvOS" },
|
||||||
|
{ "xros", "visionOS" },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,6 +144,12 @@ function toolchain(_buildDir, _libDir)
|
|||||||
description = "Set tvOS target version (default: 9.0).",
|
description = "Set tvOS target version (default: 9.0).",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
newoption {
|
||||||
|
trigger = "with-visionos",
|
||||||
|
value = "#",
|
||||||
|
description = "Set visionOS target version (default: 1.0).",
|
||||||
|
}
|
||||||
|
|
||||||
newoption {
|
newoption {
|
||||||
trigger = "with-windows",
|
trigger = "with-windows",
|
||||||
value = "#",
|
value = "#",
|
||||||
@@ -193,6 +202,11 @@ function toolchain(_buildDir, _libDir)
|
|||||||
tvosPlatform = _OPTIONS["with-tvos"]
|
tvosPlatform = _OPTIONS["with-tvos"]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local xrosPlatform = ""
|
||||||
|
if _OPTIONS["with-xros"] then
|
||||||
|
xrosPlatform = _OPTIONS["with-xros"]
|
||||||
|
end
|
||||||
|
|
||||||
local windowsPlatform = nil
|
local windowsPlatform = nil
|
||||||
if _OPTIONS["with-windows"] then
|
if _OPTIONS["with-windows"] then
|
||||||
windowsPlatform = _OPTIONS["with-windows"]
|
windowsPlatform = _OPTIONS["with-windows"]
|
||||||
@@ -253,6 +267,13 @@ function toolchain(_buildDir, _libDir)
|
|||||||
premake.gcc.ar = "ar"
|
premake.gcc.ar = "ar"
|
||||||
location (path.join(_buildDir, "projects", _ACTION .. "-" .. _OPTIONS["gcc"]))
|
location (path.join(_buildDir, "projects", _ACTION .. "-" .. _OPTIONS["gcc"]))
|
||||||
|
|
||||||
|
elseif "xros-arm64" == _OPTIONS["gcc"]
|
||||||
|
or "xros-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 (path.join(_buildDir, "projects", _ACTION .. "-" .. _OPTIONS["gcc"]))
|
||||||
|
|
||||||
elseif "tvos-arm64" == _OPTIONS["gcc"] then
|
elseif "tvos-arm64" == _OPTIONS["gcc"] then
|
||||||
premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
|
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.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
|
||||||
@@ -432,6 +453,11 @@ function toolchain(_buildDir, _libDir)
|
|||||||
action.xcode.tvOSTargetPlatformVersion = str_or(tvosPlatform, "9.0")
|
action.xcode.tvOSTargetPlatformVersion = str_or(tvosPlatform, "9.0")
|
||||||
premake.xcode.toolset = "appletvos"
|
premake.xcode.toolset = "appletvos"
|
||||||
location (path.join(_buildDir, "projects", _ACTION .. "-tvos"))
|
location (path.join(_buildDir, "projects", _ACTION .. "-tvos"))
|
||||||
|
|
||||||
|
elseif "xros" == _OPTIONS["xcode"] then
|
||||||
|
action.xcode.visionOSTargetPlatformVersion = str_or(xrosPlatform, "1.0")
|
||||||
|
premake.xcode.toolset = "xros"
|
||||||
|
location (path.join(_buildDir, "projects", _ACTION .. "-xros"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -997,6 +1023,45 @@ function toolchain(_buildDir, _libDir)
|
|||||||
"-fembed-bitcode",
|
"-fembed-bitcode",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configuration { "xros*" }
|
||||||
|
linkoptions {
|
||||||
|
"-lc++",
|
||||||
|
}
|
||||||
|
buildoptions {
|
||||||
|
"-Wfatal-errors",
|
||||||
|
"-Wunused-value",
|
||||||
|
"-Wundef",
|
||||||
|
}
|
||||||
|
includedirs { path.join(bxDir, "include/compat/ios") }
|
||||||
|
|
||||||
|
configuration { "xros-arm64" }
|
||||||
|
targetdir (path.join(_buildDir, "xros-arm64/bin"))
|
||||||
|
objdir (path.join(_buildDir, "xros-arm64/obj"))
|
||||||
|
libdirs { path.join(_libDir, "lib/xros-arm64") }
|
||||||
|
linkoptions {
|
||||||
|
"--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS" ..xrosPlatform.. ".sdk",
|
||||||
|
"-L/Applications/Xcode.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS" ..xrosPlatform .. ".sdk/usr/lib/system",
|
||||||
|
"-F/Applications/Xcode.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS" ..xrosPlatform .. ".sdk/System/Library/Frameworks",
|
||||||
|
"-F/Applications/Xcode.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS" ..xrosPlatform .. ".sdk/System/Library/PrivateFrameworks",
|
||||||
|
}
|
||||||
|
buildoptions {
|
||||||
|
"--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/XROS.platform/Developer/SDKs/XROS" ..tvosPlatform .. ".sdk",
|
||||||
|
}
|
||||||
|
|
||||||
|
configuration { "xros-simulator" }
|
||||||
|
targetdir (path.join(_buildDir, "xros-simulator/bin"))
|
||||||
|
objdir (path.join(_buildDir, "xros-simulator/obj"))
|
||||||
|
libdirs { path.join(_libDir, "lib/xros-simulator") }
|
||||||
|
|
||||||
|
linkoptions {
|
||||||
|
"--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/XRSimulator.platform/Developer/SDKs/XRSimulator" ..xrosPlatform.. ".sdk",
|
||||||
|
"-L/Applications/Xcode.app/Contents/Developer/Platforms/XRSimulator.platform/Developer/SDKs/XRSimulator" ..xrosPlatform .. ".sdk/usr/lib/system",
|
||||||
|
"-F/Applications/Xcode.app/Contents/Developer/Platforms/XRSimulator.platform/Developer/SDKs/XRSimulator" ..xrosPlatform .. ".sdk/System/Library/Frameworks",
|
||||||
|
}
|
||||||
|
buildoptions {
|
||||||
|
"--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/XRSimulator.platform/Developer/SDKs/XRSimulator" ..xrosPlatform .. ".sdk",
|
||||||
|
}
|
||||||
|
|
||||||
configuration { "tvos*" }
|
configuration { "tvos*" }
|
||||||
linkoptions {
|
linkoptions {
|
||||||
"-lc++",
|
"-lc++",
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|| BX_PLATFORM_WINRT \
|
|| BX_PLATFORM_WINRT \
|
||||||
|| BX_PLATFORM_XBOXONE
|
|| BX_PLATFORM_XBOXONE
|
||||||
extern "C" __declspec(dllimport) void __stdcall OutputDebugStringA(const char* _str);
|
extern "C" __declspec(dllimport) void __stdcall OutputDebugStringA(const char* _str);
|
||||||
#elif BX_PLATFORM_IOS || BX_PLATFORM_OSX
|
#elif BX_PLATFORM_IOS || BX_PLATFORM_OSX || BX_PLATFORM_VISIONOS
|
||||||
# if defined(__OBJC__)
|
# if defined(__OBJC__)
|
||||||
# import <Foundation/NSObjCRuntime.h>
|
# import <Foundation/NSObjCRuntime.h>
|
||||||
# else
|
# else
|
||||||
@@ -73,7 +73,8 @@ namespace bx
|
|||||||
|| BX_PLATFORM_XBOXONE
|
|| BX_PLATFORM_XBOXONE
|
||||||
OutputDebugStringA(_out);
|
OutputDebugStringA(_out);
|
||||||
#elif BX_PLATFORM_IOS \
|
#elif BX_PLATFORM_IOS \
|
||||||
|| BX_PLATFORM_OSX
|
|| BX_PLATFORM_OSX \
|
||||||
|
|| BX_PLATFORM_VISIONOS
|
||||||
# if defined(__OBJC__)
|
# if defined(__OBJC__)
|
||||||
NSLog(@"%s", _out);
|
NSLog(@"%s", _out);
|
||||||
# else
|
# else
|
||||||
|
|||||||
@@ -74,7 +74,8 @@ namespace bx
|
|||||||
|| BX_PLATFORM_ANDROID \
|
|| BX_PLATFORM_ANDROID \
|
||||||
|| BX_PLATFORM_EMSCRIPTEN \
|
|| BX_PLATFORM_EMSCRIPTEN \
|
||||||
|| BX_PLATFORM_IOS \
|
|| BX_PLATFORM_IOS \
|
||||||
|| BX_PLATFORM_OSX
|
|| BX_PLATFORM_OSX \
|
||||||
|
|| BX_PLATFORM_VISIONOS
|
||||||
# define fseeko64 fseeko
|
# define fseeko64 fseeko
|
||||||
# define ftello64 ftello
|
# define ftello64 ftello
|
||||||
# elif BX_PLATFORM_PS4
|
# elif BX_PLATFORM_PS4
|
||||||
|
|||||||
@@ -16,7 +16,8 @@
|
|||||||
|| BX_PLATFORM_OSX \
|
|| BX_PLATFORM_OSX \
|
||||||
|| BX_PLATFORM_PS4 \
|
|| BX_PLATFORM_PS4 \
|
||||||
|| BX_PLATFORM_RPI \
|
|| BX_PLATFORM_RPI \
|
||||||
|| BX_PLATFORM_NX
|
|| BX_PLATFORM_NX \
|
||||||
|
|| BX_PLATFORM_VISIONOS
|
||||||
# include <pthread.h>
|
# include <pthread.h>
|
||||||
#elif BX_PLATFORM_WINDOWS \
|
#elif BX_PLATFORM_WINDOWS \
|
||||||
|| BX_PLATFORM_WINRT \
|
|| BX_PLATFORM_WINRT \
|
||||||
|
|||||||
@@ -26,11 +26,13 @@
|
|||||||
|| BX_PLATFORM_NX \
|
|| BX_PLATFORM_NX \
|
||||||
|| BX_PLATFORM_OSX \
|
|| BX_PLATFORM_OSX \
|
||||||
|| BX_PLATFORM_PS4 \
|
|| BX_PLATFORM_PS4 \
|
||||||
|| BX_PLATFORM_RPI
|
|| BX_PLATFORM_RPI \
|
||||||
|
|| BX_PLATFORM_VISIONOS
|
||||||
# include <sched.h> // sched_yield
|
# include <sched.h> // sched_yield
|
||||||
# if BX_PLATFORM_IOS \
|
# if BX_PLATFORM_IOS \
|
||||||
|| BX_PLATFORM_OSX \
|
|| BX_PLATFORM_OSX \
|
||||||
|| BX_PLATFORM_PS4
|
|| BX_PLATFORM_PS4 \
|
||||||
|
|| BX_PLATFORM_VISIONOS
|
||||||
# include <pthread.h> // mach_port_t
|
# include <pthread.h> // mach_port_t
|
||||||
# endif // BX_PLATFORM_*
|
# endif // BX_PLATFORM_*
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,8 @@
|
|||||||
|
|
||||||
#if BX_CRT_NONE
|
#if BX_CRT_NONE
|
||||||
#elif BX_PLATFORM_OSX \
|
#elif BX_PLATFORM_OSX \
|
||||||
|| BX_PLATFORM_IOS
|
|| BX_PLATFORM_IOS \
|
||||||
|
|| BX_PLATFORM_VISIONOS
|
||||||
# include <dispatch/dispatch.h>
|
# include <dispatch/dispatch.h>
|
||||||
#elif BX_PLATFORM_POSIX
|
#elif BX_PLATFORM_POSIX
|
||||||
# include <errno.h>
|
# include <errno.h>
|
||||||
@@ -36,7 +37,8 @@ namespace bx
|
|||||||
#if BX_CRT_NONE
|
#if BX_CRT_NONE
|
||||||
|
|
||||||
#elif BX_PLATFORM_OSX \
|
#elif BX_PLATFORM_OSX \
|
||||||
|| BX_PLATFORM_IOS
|
|| BX_PLATFORM_IOS \
|
||||||
|
|| BX_PLATFORM_VISIONOS
|
||||||
dispatch_semaphore_t m_handle;
|
dispatch_semaphore_t m_handle;
|
||||||
#elif BX_PLATFORM_POSIX
|
#elif BX_PLATFORM_POSIX
|
||||||
pthread_mutex_t m_mutex;
|
pthread_mutex_t m_mutex;
|
||||||
@@ -70,7 +72,8 @@ namespace bx
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#elif BX_PLATFORM_OSX \
|
#elif BX_PLATFORM_OSX \
|
||||||
|| BX_PLATFORM_IOS
|
|| BX_PLATFORM_IOS \
|
||||||
|
|| BX_PLATFORM_VISIONOS
|
||||||
|
|
||||||
Semaphore::Semaphore()
|
Semaphore::Semaphore()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,7 +20,8 @@
|
|||||||
|| BX_PLATFORM_OSX \
|
|| BX_PLATFORM_OSX \
|
||||||
|| BX_PLATFORM_PS4 \
|
|| BX_PLATFORM_PS4 \
|
||||||
|| BX_PLATFORM_RPI \
|
|| BX_PLATFORM_RPI \
|
||||||
|| BX_PLATFORM_NX
|
|| BX_PLATFORM_NX \
|
||||||
|
|| BX_PLATFORM_VISIONOS
|
||||||
# include <pthread.h>
|
# include <pthread.h>
|
||||||
# if BX_PLATFORM_LINUX && (BX_CRT_GLIBC < 21200)
|
# if BX_PLATFORM_LINUX && (BX_CRT_GLIBC < 21200)
|
||||||
# include <sys/prctl.h>
|
# include <sys/prctl.h>
|
||||||
@@ -243,7 +244,8 @@ namespace bx
|
|||||||
#if BX_CRT_NONE
|
#if BX_CRT_NONE
|
||||||
BX_UNUSED(_name);
|
BX_UNUSED(_name);
|
||||||
#elif BX_PLATFORM_OSX \
|
#elif BX_PLATFORM_OSX \
|
||||||
|| BX_PLATFORM_IOS
|
|| BX_PLATFORM_IOS \
|
||||||
|
|| BX_PLATFORM_VISIONOS
|
||||||
pthread_setname_np(_name);
|
pthread_setname_np(_name);
|
||||||
#elif (BX_CRT_GLIBC >= 21200)
|
#elif (BX_CRT_GLIBC >= 21200)
|
||||||
pthread_setname_np(ti->m_handle, _name);
|
pthread_setname_np(ti->m_handle, _name);
|
||||||
|
|||||||
Reference in New Issue
Block a user