Skip to content

Commit

Permalink
Add support for Apple visionOS to Conan 2.0 (#14504)
Browse files Browse the repository at this point in the history
Add full support for Apple visionOS (cherry-pick 2e0686036ecae13caf49f32db2322677d55d3d13 and resolve merge conflicts).
  • Loading branch information
stevn authored Aug 23, 2023
1 parent bc74147 commit 7e18e68
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 4 deletions.
8 changes: 6 additions & 2 deletions conan/tools/apple/apple.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@


def is_apple_os(conanfile):
"""returns True if OS is Apple one (Macos, iOS, watchOS or tvOS"""
"""returns True if OS is Apple one (Macos, iOS, watchOS, tvOS or visionOS)"""
os_ = conanfile.settings.get_safe("os")
return str(os_) in ['Macos', 'iOS', 'watchOS', 'tvOS']
return str(os_) in ['Macos', 'iOS', 'watchOS', 'tvOS', 'visionOS']


def _to_apple_arch(arch, default=None):
Expand Down Expand Up @@ -78,6 +78,10 @@ def apple_min_version_flag(os_version, os_sdk, subsystem):
flag = '-mtvos-version-min'
elif 'appletvsimulator' in os_sdk:
flag = '-mtvos-simulator-version-min'
elif 'xros' in os_sdk:
flag = '-mxros-version-min'
elif 'xrsimulator' in os_sdk:
flag = '-mxros-simulator-version-min'

if subsystem == 'catalyst':
# especial case, despite Catalyst is macOS, it requires an iOS version argument
Expand Down
4 changes: 2 additions & 2 deletions conan/tools/cmake/toolchain/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ def context(self):
if host_os_version:
# https://cmake.org/cmake/help/latest/variable/CMAKE_OSX_DEPLOYMENT_TARGET.html
# Despite the OSX part in the variable name(s) they apply also to other SDKs than
# macOS like iOS, tvOS, or watchOS.
# macOS like iOS, tvOS, watchOS or visionOS.
ctxt_toolchain["cmake_osx_deployment_target"] = host_os_version

return ctxt_toolchain
Expand Down Expand Up @@ -734,7 +734,7 @@ def _is_apple_cross_building(self):
arch_host = self._conanfile.settings.get_safe("arch")
arch_build = self._conanfile.settings_build.get_safe("arch")
os_build = self._conanfile.settings_build.get_safe("os")
return os_host in ('iOS', 'watchOS', 'tvOS') or (
return os_host in ('iOS', 'watchOS', 'tvOS', 'visionOS') or (
os_host == 'Macos' and (arch_host != arch_build or os_build != os_host))

def _get_cross_build(self):
Expand Down
1 change: 1 addition & 0 deletions conan/tools/gnu/get_gnu_triplet.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def _get_gnu_triplet(os_, arch, compiler=None):
"iOS": "apple-ios",
"watchOS": "apple-watchos",
"tvOS": "apple-tvos",
"visionOS": "apple-xros",
# NOTE: it technically must be "asmjs-unknown-emscripten" or
# "wasm32-unknown-emscripten", but it's not recognized by old config.sub versions
"Emscripten": "local-emscripten",
Expand Down
1 change: 1 addition & 0 deletions conan/tools/meson/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
'iOS': 'darwin',
'watchOS': 'darwin',
'tvOS': 'darwin',
'visionOS': 'darwin',
'FreeBSD': 'freebsd',
'Emscripten': 'emscripten',
'Linux': 'linux',
Expand Down
1 change: 1 addition & 0 deletions conan/tools/qbs/qbsprofile.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
'iOS': 'ios',
'watchOS': 'watchos',
'tvOS': 'tvos',
'visionOS': 'xros',
'FreeBSD': 'freebsd',
'SunOS': 'solaris',
'AIX': 'aix',
Expand Down
4 changes: 4 additions & 0 deletions conans/client/conf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
sdk: ["appletvos", "appletvsimulator"]
sdk_version: [null, "11.3", "11.4", "12.0", "12.1", "12.2", "12.4",
"13.0", "13.1", "13.2", "13.4", "14.0", "14.2", "14.3", "14.5", "15.0", "15.2", "15.4", "16.0", "16.1"]
visionOS:
version: ["1.0"]
sdk: ["xros", "xrsimulator"]
sdk_version: [null, "1.0"]
Macos:
version: [null, "10.6", "10.7", "10.8", "10.9", "10.10", "10.11", "10.12", "10.13", "10.14", "10.15", "11.0", "12.0", "13.0"]
sdk_version: [null, "10.13", "10.14", "10.15", "11.0", "11.1", "11.3", "12.0", "12.1", "12.3", "13.0", "13.1"]
Expand Down

0 comments on commit 7e18e68

Please sign in to comment.