apple: add preliminary visionOS support

This commit is contained in:
Gregor Jasny
2023-06-22 11:57:36 +02:00
parent 7ad290bf9c
commit 25977e177b
26 changed files with 100 additions and 26 deletions

View File

@@ -608,6 +608,7 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
if(CMAKE_OSX_SYSROOT)
set(id_sdkroot "SDKROOT = \"${CMAKE_OSX_SYSROOT}\";")
if(CMAKE_OSX_SYSROOT MATCHES "(^|/)[Ii][Pp][Hh][Oo][Nn][Ee]" OR
CMAKE_OSX_SYSROOT MATCHES "(^|/)[Xx][Rr]" OR
CMAKE_OSX_SYSROOT MATCHES "(^|/)[Aa][Pp][Pp][Ll][Ee][Tt][Vv]")
set(id_product_type "com.apple.product-type.bundle.unit-test")
elseif(CMAKE_OSX_SYSROOT MATCHES "(^|/)[Ww][Aa][Tt][Cc][Hh]")

View File

@@ -21,7 +21,8 @@ set(CMAKE_INCLUDE_FLAG_Swift "-I ")
# FIXME: Move compiler- and platform-specific flags to the above-included modules.
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR CMAKE_SYSTEM_NAME STREQUAL "iOS"
OR CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS")
OR CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "visionOS"
OR CMAKE_SYSTEM_NAME STREQUAL "watchOS")
set(CMAKE_SHARED_LIBRARY_SONAME_Swift_FLAG "-Xlinker -install_name -Xlinker ")
elseif(NOT CMAKE_SYSTEM_NAME STREQUAL Windows)
set(CMAKE_SHARED_LIBRARY_SONAME_Swift_FLAG "-Xlinker -soname -Xlinker ")
@@ -30,7 +31,8 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL Windows)
set(CMAKE_EXECUTABLE_RUNTIME_Swift_FLAG "-Xlinker -rpath -Xlinker ")
set(CMAKE_SHARED_LIBRARY_RUNTIME_Swift_FLAG "-Xlinker -rpath -Xlinker ")
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR CMAKE_SYSTEM_NAME STREQUAL "iOS"
OR CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS")
OR CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "visionOS"
OR CMAKE_SYSTEM_NAME STREQUAL "watchOS")
set(CMAKE_EXECUTABLE_RUNTIME_Swift_FLAG_SEP "")
set(CMAKE_SHARED_LIBRARY_RUNTIME_Swift_FLAG_SEP "")
else()

View File

@@ -25,7 +25,7 @@ unset(LINUX)
# It is useful to share the same aforementioned configuration files and
# avoids duplicating them in case of tightly related platforms.
#
# An example are the platforms supported by Xcode (macOS, iOS, tvOS,
# An example are the platforms supported by Xcode (macOS, iOS, tvOS, visionOS
# and watchOS). For all of those the CMAKE_EFFECTIVE_SYSTEM_NAME is
# set to Apple which results in using
# Platform/Apple-AppleClang-CXX.cmake for the Apple C++ compiler.

View File

@@ -22,6 +22,10 @@ macro(__apple_compiler_clang lang)
set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mtvos-version-min=")
elseif(_CMAKE_OSX_SYSROOT_PATH MATCHES "/AppleTVSimulator")
set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mtvos-simulator-version-min=")
elseif(_CMAKE_OSX_SYSROOT_PATH MATCHES "/XROS")
set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mtargetos=xros")
elseif(_CMAKE_OSX_SYSROOT_PATH MATCHES "/XRSimulator")
set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mtargetos=xros")
elseif(_CMAKE_OSX_SYSROOT_PATH MATCHES "/WatchOS")
set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mwatchos-version-min=")
elseif(_CMAKE_OSX_SYSROOT_PATH MATCHES "/WatchSimulator")

View File

@@ -43,7 +43,7 @@ if(NOT CMAKE_CROSSCOMPILING AND
unset(_sysctl_stdout)
endif()
# macOS, iOS, tvOS, and watchOS should lookup compilers from
# macOS, iOS, tvOS, visionOS, and watchOS should lookup compilers from
# Platform/Apple-${CMAKE_CXX_COMPILER_ID}-<LANG>
set(CMAKE_EFFECTIVE_SYSTEM_NAME "Apple")
@@ -76,6 +76,8 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL iOS)
set(_CMAKE_OSX_SYSROOT_DEFAULT "iphoneos")
elseif(CMAKE_SYSTEM_NAME STREQUAL tvOS)
set(_CMAKE_OSX_SYSROOT_DEFAULT "appletvos")
elseif(CMAKE_SYSTEM_NAME STREQUAL visionOS)
set(_CMAKE_OSX_SYSROOT_DEFAULT "xros")
elseif(CMAKE_SYSTEM_NAME STREQUAL watchOS)
set(_CMAKE_OSX_SYSROOT_DEFAULT "watchos")
elseif("${CMAKE_GENERATOR}" MATCHES Xcode

View File

@@ -1,4 +1,4 @@
if(CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS")
if(CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "visionOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS")
if(NOT DEFINED CMAKE_MACOSX_BUNDLE)
set(CMAKE_MACOSX_BUNDLE ON)
endif()

View File

@@ -0,0 +1 @@
include(Platform/Darwin-Determine-CXX)

View File

@@ -0,0 +1,7 @@
include(Platform/Darwin-Initialize)
if(NOT _CMAKE_OSX_SYSROOT_PATH MATCHES "/XR(OS|Simulator)")
message(FATAL_ERROR "${CMAKE_OSX_SYSROOT} is not an visionOS SDK")
endif()
set(_CMAKE_FEATURE_DETECTION_TARGET_TYPE STATIC_LIBRARY)

View File

@@ -0,0 +1 @@
include(Platform/Darwin)