[watchOS][tvOS] Add Platform.TVOS and Platform.WATCHOS
This commit is contained in:
committed by
Sergey Bogolepov
parent
5cf8438747
commit
d2a213ffca
@@ -71,7 +71,14 @@ fun run() {
|
||||
}
|
||||
|
||||
// hashCode (directly):
|
||||
if (foo.hashCode() == foo.hash().let { it.toInt() xor (it shr 32).toInt() }) {
|
||||
// hash() returns value of NSUInteger type.
|
||||
val hash = when (Platform.osFamily) {
|
||||
// `typedef unsigned int NSInteger` on watchOS.
|
||||
OsFamily.WATCHOS -> foo.hash().toInt()
|
||||
// `typedef unsigned long NSUInteger` on iOS, macOS, tvOS.
|
||||
else -> foo.hash().let { it.toInt() xor (it shr 32).toInt() }
|
||||
}
|
||||
if (foo.hashCode() == hash) {
|
||||
// toString (virtually):
|
||||
if (Platform.memoryModel == MemoryModel.STRICT)
|
||||
println(map.keys.map { it.toString() }.min() == foo.description())
|
||||
|
||||
@@ -220,6 +220,10 @@ KInt Konan_Platform_getOsFamily() {
|
||||
return 5;
|
||||
#elif KONAN_WASM
|
||||
return 6;
|
||||
#elif KONAN_TVOS
|
||||
return 7;
|
||||
#elif KONAN_WATCHOS
|
||||
return 8;
|
||||
#else
|
||||
#warning "Unknown platform"
|
||||
return 0;
|
||||
|
||||
@@ -14,7 +14,9 @@ public enum class OsFamily {
|
||||
LINUX,
|
||||
WINDOWS,
|
||||
ANDROID,
|
||||
WASM
|
||||
WASM,
|
||||
TVOS,
|
||||
WATCHOS
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -248,7 +248,7 @@ class ClangArgs(private val configurables: Configurables) : Configurables by con
|
||||
|
||||
KonanTarget.TVOS_ARM64 ->
|
||||
listOf("-DKONAN_OBJC_INTEROP=1",
|
||||
"-DKONAN_IOS=1",
|
||||
"-DKONAN_TVOS=1",
|
||||
"-DKONAN_ARM64=1",
|
||||
"-DKONAN_HAS_CXX11_EXCEPTION_FUNCTIONS=1",
|
||||
"-DKONAN_REPORT_BACKTRACE_TO_IOS_CRASH_LOG=1",
|
||||
@@ -256,14 +256,14 @@ class ClangArgs(private val configurables: Configurables) : Configurables by con
|
||||
|
||||
KonanTarget.TVOS_X64 ->
|
||||
listOf("-DKONAN_OBJC_INTEROP=1",
|
||||
"-DKONAN_IOS=1",
|
||||
"-DKONAN_TVOS=1",
|
||||
"-DKONAN_X64=1",
|
||||
"-DKONAN_CORE_SYMBOLICATION=1",
|
||||
"-DKONAN_HAS_CXX11_EXCEPTION_FUNCTIONS=1")
|
||||
|
||||
KonanTarget.WATCHOS_ARM32 ->
|
||||
listOf("-DKONAN_OBJC_INTEROP=1",
|
||||
"-DKONAN_IOS",
|
||||
"-DKONAN_WATCHOS",
|
||||
"-DKONAN_ARM32=1",
|
||||
"-DKONAN_HAS_CXX11_EXCEPTION_FUNCTIONS=1",
|
||||
"-DKONAN_REPORT_BACKTRACE_TO_IOS_CRASH_LOG=1",
|
||||
@@ -274,7 +274,7 @@ class ClangArgs(private val configurables: Configurables) : Configurables by con
|
||||
|
||||
KonanTarget.WATCHOS_X86 ->
|
||||
listOf("-DKONAN_OBJC_INTEROP=1",
|
||||
"-DKONAN_IOS=1",
|
||||
"-DKONAN_WATCHOS=1",
|
||||
"-DKONAN_X86=1",
|
||||
"-DKONAN_CORE_SYMBOLICATION=1",
|
||||
"-DKONAN_HAS_CXX11_EXCEPTION_FUNCTIONS=1")
|
||||
|
||||
Reference in New Issue
Block a user