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

Feature/language #16028

Merged
merged 26 commits into from
Jun 4, 2024
Merged

Feature/language #16028

merged 26 commits into from
Jun 4, 2024

Conversation

memsharded
Copy link
Member

@memsharded memsharded commented Apr 5, 2024

Changelog: Feature: New compiler.cstd setting for C standard
Changelog: Feature: Implemented compatibility.py default compatibility for different C standards
Changelog: Feature: Implement check_min_cstd, check_max_cstd, valid_max_cstd, valid_min_cstd, supported_cstd tools
Changelog: Feature: New languages = "C", "C++" class attribute to further automate settings management
Docs: conan-io/docs#3757

Close #13777

@jcar87
Copy link
Contributor

jcar87 commented Apr 9, 2024

This is great!!

I wonder if we could address the usage of the stdcpp_library() helper.
Some recipes build libraries that have a pure "C" interface but encapsulate compiled C++ code. Downstream pure C consumers linking the static library will need to tell the linker that the standard C++ library needs to be linked as well:

Usually handled like this:

    def package_info(self):
        self.cpp_info.libs = ["zimg"]
        if not self.options.shared:
            libcxx = stdcpp_library(self)
            if libcxx:
                self.cpp_info.system_libs.append(libcxx)

This is not entirely robust, the downstream consumer may choose to use the static C++ library, which is valid - but Conan would add a conflicting flag.

Perhaps we can take advantage of this feature to make this logic redundant but also robust?

Copy link
Member

@AbrilRBS AbrilRBS left a comment

Choose a reason for hiding this comment

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

We still need to decide if the profile detectino should fill a value for the cstd by default

ErniGH and others added 6 commits April 9, 2024 16:20
* feat add test to bazeldeps

* Fixed several bugs. Improved tests coverage

* Reverted

* Better name

---------

Co-authored-by: Francisco Ramirez de Anton <[email protected]>
* refactor apple_min_version_flag()

* Refactored all the apple module and where it was being used (AutotoolsToolchain and MesonToolchain for now)

* Fixed bad return

* Fixing tests

* Keeping legacy behavior in apple_min_version_flag function

* Preventing possible breaking change

---------

Co-authored-by: Francisco Ramirez de Anton <[email protected]>
* Add hide_url tests for git scm tool

* Add hide_url flag to clone and fetch_commit.

Resolves conan-io#15684

* Update conans/test/functional/tools/scm/test_git.py

* Update conans/test/functional/tools/scm/test_git.py

---------

Co-authored-by: Rubén Rincón Blanco <[email protected]>
@memsharded
Copy link
Member Author

We have a problem with current approach:

  • If we define compiler.cstd=11 in profile
  • Use a conanfile.txt (no languages = "C", ... specification)
  • The cstd is always auto-removed
  • It is never passed to the toolchain (see failing test in 2a87015)

@memsharded
Copy link
Member Author

memsharded commented Apr 10, 2024

We have a problem with current approach:

  • If we define compiler.cstd=11 in profile
  • Use a conanfile.txt (no languages = "C", ... specification)
  • The cstd is always auto-removed
  • it is never passed to the toolchain (see failing test in 2a87015)

Users wanting to support local dev must use a conanfile.py, not a conanfile.txt?

@memsharded
Copy link
Member Author

I wonder if we could address the usage of the stdcpp_library() helper.

@jcar87 I am trying to check what would be the more idiomatic CMake way of doing this, but I can't find anything easy. Is there any property of targets that could be used for this? If that is the case, we could do it in CMakeDeps. If that is not the case, we might want to do it in CMakeToolchain, but that might have limitations like not usable for cmake-conan or not possible to use it per-target, while CMakeDeps will apply only to targets linking certain dependencies.

@memsharded memsharded marked this pull request as ready for review May 21, 2024 21:43
@memsharded memsharded added this to the 2.4.0 milestone May 21, 2024
@memsharded memsharded requested a review from jcar87 May 22, 2024 13:13
conan/tools/build/cstd.py Outdated Show resolved Hide resolved
conan/tools/build/cstd.py Outdated Show resolved Hide resolved
conan/tools/build/cstd.py Outdated Show resolved Hide resolved
@czoido czoido merged commit b88c8bb into conan-io:develop2 Jun 4, 2024
2 checks passed
@memsharded memsharded deleted the feature/language branch June 4, 2024 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feature] Add cstd to compiler settings
6 participants