-
Notifications
You must be signed in to change notification settings - Fork 1.1k
XcodeBuild: pass deployment target from profile #18496
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| from conan.tools.apple import to_apple_arch | ||
| from conan.tools.apple.apple import to_apple_arch, xcodebuild_deployment_target_key | ||
|
|
||
|
|
||
| class XcodeBuild(object): | ||
|
|
@@ -8,6 +8,8 @@ def __init__(self, conanfile): | |
| self._arch = to_apple_arch(self._conanfile) | ||
| self._sdk = conanfile.settings.get_safe("os.sdk") or "" | ||
| self._sdk_version = conanfile.settings.get_safe("os.sdk_version") or "" | ||
| self._os = conanfile.settings.get_safe("os") | ||
| self._os_version = conanfile.settings.get_safe("os.version") | ||
|
|
||
| @property | ||
| def _verbosity(self): | ||
|
|
@@ -36,8 +38,13 @@ def build(self, xcodeproj, target=None): | |
| will build all the targets passing the ``-alltargets`` argument instead. | ||
| :return: the return code for the launched ``xcodebuild`` command. | ||
| """ | ||
| target = "-target {}".format(target) if target else "-alltargets" | ||
| cmd = "xcodebuild -project {} -configuration {} -arch {} " \ | ||
| target = "-target '{}'".format(target) if target else "-alltargets" | ||
| cmd = "xcodebuild -project '{}' -configuration {} -arch {} " \ | ||
| "{} {} {}".format(xcodeproj, self._build_type, self._arch, self._sdkroot, | ||
| self._verbosity, target) | ||
|
|
||
| deployment_target_key = xcodebuild_deployment_target_key(self._os) | ||
| if deployment_target_key and self._os_version: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is probably the main and necessary fix?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if it's not provided, the setting from the Xcode project will be used, which may be not what the library user desires. Since profile defines OS version, it's natural to use it. |
||
| cmd += f" {deployment_target_key}={self._os_version}" | ||
|
|
||
| self._conanfile.run(cmd) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We usually quote with double quotes, it is a bit more cross-platform, though I understand this isn't cross-platform at all, so most likely not an issue. Wdyt @czoido?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be fine to use single quotes as this should never run on windows cmd