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 #7164

Merged
merged 2 commits into from Jun 9, 2020

Conversation

SSE4
Copy link
Contributor

@SSE4 SSE4 commented Jun 9, 2020

backport of #7157 to release/1.26

closes: #7156

Changelog: Bugfix: Fix iOS CMake architecture.
Docs: omit

need to set CMAKE_OSX_ARCHITECTURES and CMAKE_OSX_SYSROOT

  • Refer to the issue that supports this Pull Request.
  • If the issue has missing info, explain the purpose/use case/pain/need that covers this Pull Request.
  • I've read the Contributing guide.
  • I've followed the PEP8 style guides for Python code.
  • I've opened another PR in the Conan docs repo to the develop branch, documenting this one.

Note: By default this PR will skip the slower tests and will use a limited set of python versions. Check here how to increase the testing level by writing some tags in the current PR body text.

Signed-off-by: SSE4 <tomskside@gmail.com>
@czoido czoido added this to the 1.26 milestone Jun 9, 2020
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":
Copy link
Member

@memsharded memsharded Jun 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this missing a ()?

platform.system() == "Darwin"

Maybe the test patch is hiding this.

# 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
Copy link
Member

@memsharded memsharded Jun 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default CMake behavior is:

If not set explicitly the value is initialized by the SDKROOT environment variable, if set, and otherwise computed based on the CMAKE_OSX_DEPLOYMENT_TARGET or the host platform.

Is it expected that conan overrides the SDKROOT env variable if defined? Is the xcrun using the SDKROOT env var?

Copy link
Contributor Author

@SSE4 SSE4 Jun 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it does (https://www.manpagez.com/man/1/xcrun/):

     SDKROOT         Specifies the SDK to use; overriden by the command line
                     -sdk option.

@memsharded memsharded merged commit e6bfe58 into conan-io:release/1.26 Jun 9, 2020
2 checks passed
@anuraaga
Copy link

anuraaga commented Jun 21, 2020

I found this broke a build workflow I was using with conan. With careful setting of environment variables like SDKROOT, I've found it's possible to build packages on Mac without even installing X-Code or the command line tools, only using Anaconda and its toolchain. However, now conan is always calling the command line tools even when SDKROOT is set, which is different from the cmake behavior. Can we tweak this so xcrun is only executed if sdkroot is not available?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants