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

Bugfix: fix iOS CMake architecture #7157

Closed
wants to merge 2 commits into from
Closed
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
10 changes: 7 additions & 3 deletions conans/client/build/cmake_flags.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import platform
from collections import OrderedDict

from conans.client import tools
Expand Down Expand Up @@ -294,9 +295,12 @@ def get_definitions(self):
definitions.update(build_type_definition(self._forced_build_type, build_type,
self._generator, self._output))

if str(os_) == "Macos":
if arch == "x86":
definitions["CMAKE_OSX_ARCHITECTURES"] = "i386"
if tools.is_apple_os(os_):
definitions["CMAKE_OSX_ARCHITECTURES"] = tools.to_apple_arch(arch)
# xcrun is only available on macOS, otherwise it's cross-compiling and it needs to be
# set within CMake toolchain
if platform.system() == "Darwin":
definitions["CMAKE_OSX_SYSROOT"] = tools.XCRun(self._conanfile.settings).sdk_path

definitions.update(self._cmake_cross_build_defines())
definitions.update(self._get_cpp_standard_vars())
Expand Down
5 changes: 3 additions & 2 deletions conans/test/unittests/client/build/cmake_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1307,8 +1307,9 @@ def install_definitions_test(self):
("iOS", "7.0",),
("watchOS", "4.0",),
("tvOS", "11.0",)])
@mock.patch('platform.system', return_value="Macos")
def test_cmake_system_version_osx(self, the_os, os_version, _):
@mock.patch("platform.system", return_value="Darwin")
@mock.patch("conans.client.tools.apple.XCRun.sdk_path", return_value='/opt')
def test_cmake_system_version_osx(self, the_os, os_version, _, __):
settings = Settings.loads(get_default_settings_yml())
settings.os = the_os

Expand Down