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: missing framework for xcode generator with no compiler setting #9896

Merged
merged 1 commit into from
Oct 29, 2021

Conversation

SSE4
Copy link
Contributor

@SSE4 SSE4 commented Oct 28, 2021

closes: #9878

Changelog: Bugfix: Missing framework for Xcode generator with no compiler setting.
Docs: omit

  • 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.

@@ -29,7 +30,10 @@ def __init__(self, conanfile):
self.cxx_compiler_flags = " ".join(deps_cpp_info.cxxflags)
self.linker_flags = " ".join(deps_cpp_info.sharedlinkflags)
self.rootpaths = " ".join('"%s"' % d.replace("\\", "/") for d in deps_cpp_info.rootpaths)
self.frameworks = " ".join(format_frameworks(deps_cpp_info.frameworks, self.conanfile.settings))

settings = Settings({"compiler": ["apple-clang"]})
Copy link
Member

Choose a reason for hiding this comment

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

This is very hacky, simply overriding this with a local compiler is very dirty.
If the format_frameworks has this implementation:

def format_frameworks(frameworks, settings):
    """
    returns an appropriate compiler flags to link with Apple Frameworks
    or an empty array, if Apple Frameworks aren't supported by the given compiler
    """
    compiler = settings.get_safe("compiler")
    compiler_base = settings.get_safe("compiler.base")
    if (str(compiler) not in GCC_LIKE) and (str(compiler_base) not in GCC_LIKE):
        return []
    return ["-framework %s" % framework for framework in frameworks]

With your hack, this means that it will be compiler independent, so it would be good to do just:

self.frameworks = " ".join(["-framework %s" % framework for framework in frameworks])

If it is safe to assume that in Xcode, the frameworks will always be there, which probably doesn't hold for cross-building (is cross-building to some platform that won't accept frameworks possible with Xcode?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so far, I didn't see such cross-building. AFAIK it allows only cross-building to apple platforms (iOS, tvOS, watchOS). I think at least for now, we can assume Xcode supports frameworks, and it only supports apple-clang compiler. or at least we can say conan supports only that use-case.

@memsharded memsharded added this to the 1.43 milestone Oct 28, 2021
@memsharded memsharded merged commit 58f4197 into conan-io:develop Oct 29, 2021
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.

[bug] conanbuildinfo.xcconfig is missing dependency frameworks
2 participants