Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ios_version subsetting for catalyst to generate the correct --target triple #10880

Merged
merged 2 commits into from
Mar 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion conan/tools/_compilers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def architecture_flag(settings):
arch = settings.get_safe("arch")
the_os = settings.get_safe("os")
subsystem = settings.get_safe("os.subsystem")
subsystem_ios_version = settings.get_safe("os.subsystem.ios_version")
if not compiler or not arch:
return ""

Expand All @@ -22,7 +23,7 @@ def architecture_flag(settings):
# FIXME: This might be conflicting with Autotools --target cli arg
apple_arch = to_apple_arch(arch)
if apple_arch:
return '--target=%s-apple-ios-macabi' % apple_arch
return '--target=%s-apple-ios%s-macabi' % (apple_arch, subsystem_ios_version)
elif str(arch) in ['x86_64', 'sparcv9', 's390x']:
return '-m64'
elif str(arch) in ['x86', 'sparc']:
Expand Down
3 changes: 2 additions & 1 deletion conans/client/build/compiler_flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@ def architecture_flag(settings):
arch = settings.get_safe("arch")
the_os = settings.get_safe("os")
subsystem = settings.get_safe("os.subsystem")
subsystem_ios_version = settings.get_safe("os.subsystem.ios_version")
if not compiler or not arch:
return ""

if str(compiler) in ['gcc', 'apple-clang', 'clang', 'sun-cc']:
if str(the_os) == 'Macos' and str(subsystem) == 'catalyst':
apple_arch = to_apple_arch(arch)
if apple_arch:
return '--target=%s-apple-ios-macabi' % apple_arch
return '--target=%s-apple-ios%s-macabi' % (apple_arch, subsystem_ios_version)
elif str(arch) in ['x86_64', 'sparcv9', 's390x']:
return '-m64'
elif str(arch) in ['x86', 'sparc']:
Expand Down
20 changes: 12 additions & 8 deletions conans/client/conf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,9 @@
platform: ANY
version: ["5.0", "6.0", "7.0", "8.0"]
Linux:
Macos:
version: [None, "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: [None, "macosx"]
sdk_version: [None, "10.13", "10.14", "10.15", "11.0", "11.1", "11.3", "12.0", "12.1", "12.3"]
subsystem: [None, catalyst]
Android:
api_level: ANY
iOS:
version: ["7.0", "7.1", "8.0", "8.1", "8.2", "8.3", "9.0", "9.1", "9.2", "9.3", "10.0", "10.1", "10.2", "10.3",
version: &ios_version
["7.0", "7.1", "8.0", "8.1", "8.2", "8.3", "9.0", "9.1", "9.2", "9.3", "10.0", "10.1", "10.2", "10.3",
"11.0", "11.1", "11.2", "11.3", "11.4", "12.0", "12.1", "12.2", "12.3", "12.4",
"13.0", "13.1", "13.2", "13.3", "13.4", "13.5", "13.6", "13.7",
"14.0", "14.1", "14.2", "14.3", "14.4", "14.5", "14.6", "14.7", "14.8",
Expand All @@ -64,6 +58,16 @@
sdk: [None, "appletvos", "appletvsimulator"]
sdk_version: [None, "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"]
Macos:
version: [None, "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: [None, "macosx"]
sdk_version: [None, "10.13", "10.14", "10.15", "11.0", "11.1", "11.3", "12.0", "12.1", "12.3"]
subsystem:
None:
catalyst:
ios_version: *ios_version
Android:
api_level: ANY
FreeBSD:
SunOS:
AIX:
Expand Down
20 changes: 12 additions & 8 deletions conans/client/migrations_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -3424,15 +3424,9 @@
platform: ANY
version: ["5.0", "6.0", "7.0", "8.0"]
Linux:
Macos:
version: [None, "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: [None, "macosx"]
sdk_version: [None, "10.13", "10.14", "10.15", "11.0", "11.1", "11.3", "12.0", "12.1", "12.3"]
subsystem: [None, catalyst]
Android:
api_level: ANY
iOS:
version: ["7.0", "7.1", "8.0", "8.1", "8.2", "8.3", "9.0", "9.1", "9.2", "9.3", "10.0", "10.1", "10.2", "10.3",
version: &ios_version
["7.0", "7.1", "8.0", "8.1", "8.2", "8.3", "9.0", "9.1", "9.2", "9.3", "10.0", "10.1", "10.2", "10.3",
"11.0", "11.1", "11.2", "11.3", "11.4", "12.0", "12.1", "12.2", "12.3", "12.4",
"13.0", "13.1", "13.2", "13.3", "13.4", "13.5", "13.6", "13.7",
"14.0", "14.1", "14.2", "14.3", "14.4", "14.5", "14.6", "14.7", "14.8",
Expand All @@ -3454,6 +3448,16 @@
sdk: [None, "appletvos", "appletvsimulator"]
sdk_version: [None, "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"]
Macos:
version: [None, "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: [None, "macosx"]
sdk_version: [None, "10.13", "10.14", "10.15", "11.0", "11.1", "11.3", "12.0", "12.1", "12.3"]
subsystem:
None:
catalyst:
ios_version: *ios_version
Android:
api_level: ANY
FreeBSD:
SunOS:
AIX:
Expand Down
4 changes: 2 additions & 2 deletions conans/test/functional/build_helpers/autotools_apple_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ def test_makefile_arch(self, arch, os_, os_version):
self.assertIn("architecture: %s" % expected_arch, self.t.out)

@parameterized.expand([("x86_64",), ("armv8",)])
@pytest.mark.xfail(reason="Disabled until fix apple-clang 13.1 and --target value for catalyst")
def test_catalyst(self, arch):
profile = textwrap.dedent("""
include(default)
Expand All @@ -91,6 +90,7 @@ def test_catalyst(self, arch):
os.version = 12.0
os.sdk = macosx
os.subsystem = catalyst
os.subsystem.ios_version = 13.1
arch = {arch}
""").format(arch=arch)

Expand Down Expand Up @@ -137,4 +137,4 @@ def test_catalyst(self, arch):

if arch == "x86_64":
self.t.run_command('"%s"' % app)
self.assertIn("running catalyst 130000", self.t.out)
self.assertIn("running catalyst 130100", self.t.out)
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ def test_makefile_arch(config):

@pytest.mark.skipif(platform.system() != "Darwin", reason="Only OSX")
@pytest.mark.parametrize("arch", ["x86_64", "armv8"])
@pytest.mark.xfail(reason="Disabled until fix apple-clang 13.1 and --target value for catalyst")
def test_catalyst(arch):
profile = textwrap.dedent("""
include(default)
Expand All @@ -89,6 +88,7 @@ def test_catalyst(arch):
os.version = 13.0
os.sdk = macosx
os.subsystem = catalyst
os.subsystem.ios_version = 13.1
arch = {arch}
""").format(arch=arch)

Expand Down Expand Up @@ -135,4 +135,4 @@ def test_catalyst(arch):

if arch == "x86_64":
t.run_command('"%s"' % app)
assert "running catalyst 130000" in t.out
assert "running catalyst 130100" in t.out
10 changes: 6 additions & 4 deletions conans/test/unittests/client/build/compiler_flags_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,16 @@ def test_catalyst(self):
settings = MockSettings({"compiler": "apple-clang",
"arch": "x86_64",
"os": "Macos",
"os.subsystem": "catalyst"})
self.assertEqual(architecture_flag(settings), "--target=x86_64-apple-ios-macabi")
"os.subsystem": "catalyst",
"os.subsystem.ios_version": "13.1"})
self.assertEqual(architecture_flag(settings), "--target=x86_64-apple-ios13.1-macabi")

settings = MockSettings({"compiler": "apple-clang",
"arch": "armv8",
"os": "Macos",
"os.subsystem": "catalyst"})
self.assertEqual(architecture_flag(settings), "--target=arm64-apple-ios-macabi")
"os.subsystem": "catalyst",
"os.subsystem.ios_version": "13.1"})
self.assertEqual(architecture_flag(settings), "--target=arm64-apple-ios13.1-macabi")

@parameterized.expand([("gcc", "x86", "-m32"),
("gcc", "x86_64", "-m64"),
Expand Down