Skip to content

Commit

Permalink
Fix to_apple_archs method when using architectures from settings_user (
Browse files Browse the repository at this point in the history
…#16090)

* fix to_apple_archs

* Conan 2.2.3
  • Loading branch information
czoido authored Apr 16, 2024
1 parent b2ab45d commit 8e03c4b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
4 changes: 2 additions & 2 deletions conan/tools/cmake/toolchain/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,13 +398,13 @@ def context(self):
if not is_apple_os(self._conanfile):
return None

def to_apple_archs(conanfile, default=None):
def to_apple_archs(conanfile):
f"""converts conan-style architectures into Apple-style archs
to be used by CMake also supports multiple architectures
separated by '{universal_arch_separator}'"""
arch_ = conanfile.settings.get_safe("arch") if conanfile else None
if arch_ is not None:
return ";".join([_to_apple_arch(arch, default) for arch in
return ";".join([_to_apple_arch(arch, default=arch) for arch in
arch_.split(universal_arch_separator)])

# check valid combinations of architecture - os ?
Expand Down
2 changes: 1 addition & 1 deletion conans/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
REVISIONS = "revisions" # Only when enabled in config, not by default look at server_launcher.py
OAUTH_TOKEN = "oauth_token"

__version__ = '2.2.2'
__version__ = '2.2.3'
14 changes: 14 additions & 0 deletions conans/test/integration/settings/test_settings_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,17 @@ def test_settings_user_convert_list_dict():
c.run("install . -s arch=x86_64 -s arch.subarch=2 ")
assert "arch=x86_64" in c.out
assert "arch.subarch=2" in c.out


def test_settings_user_breaking_universal_binaries():
# If you had a settings_user.yml with a custom architecture wit will error
# in the Apple block of CMakeToolchain
# https://github.com/conan-io/conan/issues/16086#issuecomment-2059118224
c = TestClient()
settings_user = textwrap.dedent("""\
arch: [universal]
""")
save(os.path.join(c.cache_folder, "settings_user.yml"), settings_user)
c.save({"conanfile.py": GenConanfile().with_settings("os").with_settings("arch").with_generator("CMakeToolchain")})
c.run('install . -s="arch=universal"')
assert "CMakeToolchain generated: conan_toolchain.cmake" in c.out

0 comments on commit 8e03c4b

Please sign in to comment.