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

up-cpp: new recipe #23733

Closed
wants to merge 7 commits into from
Closed

up-cpp: new recipe #23733

wants to merge 7 commits into from

Conversation

PLeVasseur
Copy link

Specify library name and version: up-cpp/0.1.2-dev

Hi there 👋

I contribute to the Eclipse uProtocol project for developing a Software Defined Vehicle (SDV) middleware to knit together compute within the vehicle, cloud, mobile. We'd like to be able to host the up-cpp package on CCI since it seems like the reasonable first choice.

Forgive me as I've not contributed before I'm not entirely sure I've done everything correctly 😅

I left a few questions and TODOs in the conanfile.py as guidance to where I'm unsure in case the recipe is unable to build in certain spots. Will remove those once I can confirm the recipe passes as-is.


@conan-center-bot

This comment has been minimized.

@PLeVasseur PLeVasseur force-pushed the new/up-cpp branch 2 times, most recently from b6b5a1a to 7698cf4 Compare April 23, 2024 21:15
@PLeVasseur PLeVasseur mentioned this pull request Apr 23, 2024
3 tasks
@AbrilRBS AbrilRBS self-assigned this Apr 23, 2024
@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

* Added build_requirements() method which specifies that CMake must be
3.18 or higher
* added src folder back under layout()
* Attempt to isolate the clang + libc++ case and mark it as an invalid
configuration
* Had to turn off msvc compilation since currently CMake files can only
handle / and not \ for paths
@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

* Cleaned up some of the formatting for explanations as to why a
configuration wasn't valid
* Some further clean-up
@conan-center-bot
Copy link
Collaborator

Conan v1 pipeline ✔️

All green in build 9 (2384e5f11740c1d3ee2f5ebded178e6a00402fb7):

  • up-cpp/0.1.2-dev:
    All packages built successfully! (All logs)

Conan v2 pipeline ✔️

Note: Conan v2 builds are now mandatory. Please read our discussion about it.

All green in build 9 (2384e5f11740c1d3ee2f5ebded178e6a00402fb7):

  • up-cpp/0.1.2-dev:
    All packages built successfully! (All logs)

@PLeVasseur
Copy link
Author

I noticed in a previous attempt to package up-cpp when we were using a git submodule that was seen as unacceptable.

I read that it's possible to instead use the Conan Git helper and clone in a certain tag based on our version in conandata.yml. I've implemented it that way in the current PR.

Would that suffice?

@PLeVasseur
Copy link
Author

Hey folks 👋

Is it possible to receive a review to know what I'll need to fix / update? Thanks for your support!

-Pete

Copy link
Member

@uilianries uilianries left a comment

Choose a reason for hiding this comment

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

@PLeVasseur Thank you for your first contribution, it looks an interesting project. Please, take a look in my review and please, try to clarify the proto part in this project, is not clear why is it needed and if should be added as a separated package.

Copy link
Member

Choose a reason for hiding this comment

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

@PLeVasseur Could you please explain why do you need 2 different packages here? What are they (e.g library and compiler)?

We don't use Git feature for download, only the tag directly, because the source should be immutable.

return {
"apple-clang": "13",
"clang": "13",
"gcc": "11",
Copy link
Member

Choose a reason for hiding this comment

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

GCC 6 supports C++14 already, and other compilers also can be lowered: https://en.cppreference.com/w/cpp/compiler_support/14

Or, is there a real feature required?

Comment on lines +57 to +59
def export_sources(self):
export_conandata_patches(self)

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
def export_sources(self):
export_conandata_patches(self)

No patches to be applied, so not needed :)

Comment on lines +70 to +71
self.folders.build = os.path.join("build", str(self.settings.build_type))
self.folders.install = "install"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
self.folders.build = os.path.join("build", str(self.settings.build_type))
self.folders.install = "install"

Please, keep the default layout.

Comment on lines +79 to +80
if self.options.build_testing:
self.requires("gtest/1.14.0")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if self.options.build_testing:
self.requires("gtest/1.14.0")
if self.options.build_testing:
self.requires("gtest/1.14.0")

Testing is not something really supported, because the idea is packaging the project, not acting like a build tool. Still, in case you really want to be able to run unit tests, please, use the follow approach: https://github.com/conan-io/conan-center-index/blob/master/recipes/tree-gen/all/conanfile.py#L33 It will not affect the package ID, which is really important.

f"{self.ref} need to have paths in CMake files updated to handle both \ and /."
)
if self.settings.compiler == "clang" and stdcpp_library(self) == "c++":
raise ConanInvalidConfiguration(
Copy link
Member

Choose a reason for hiding this comment

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

Do you have a build log with that error? It would be nice pointing it as a comment in the recipe. For the message, it can be simplified like:
f"{self.ref} can not be built with clang and libc++ due math.h errors"

Comment on lines +106 to +110
git = Git(self)
git_method = os.getenv("GIT_METHOD", "https")
git.clone(self.conan_data["proto"][self.version][git_method], target=self.proto_containing_folder)
git.folder=self.proto_containing_folder
git.checkout(self.conan_data["proto"][self.version]["tag"])
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
git = Git(self)
git_method = os.getenv("GIT_METHOD", "https")
git.clone(self.conan_data["proto"][self.version][git_method], target=self.proto_containing_folder)
git.folder=self.proto_containing_folder
git.checkout(self.conan_data["proto"][self.version]["tag"])
git = Git(self)
git_method = os.getenv("GIT_METHOD", "https")
git.clone(self.conan_data["proto"][self.version][git_method], target=self.proto_containing_folder)
git.folder=self.proto_containing_folder
git.checkout(self.conan_data["proto"][self.version]["tag"])

Need more detail about it, we don't use Git in ConanCenterIndex, instead, we download the tar.gz to be sure about the immutability of the package.

tc.variables["PROTO_PATH"] = os.path.join(self.proto_containing_folder, os.path.join(self.proto_subfolder, self.proto_folder))
tc.variables["BUILD_TESTING"] = self.options.build_testing
tc.variables["BUILD_UNBUNDLED"] = self.options.build_unbundled
tc.variables["BUILD_SHARED_LIBS"] = self.options.shared
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
tc.variables["BUILD_SHARED_LIBS"] = self.options.shared

Automatically handled by CMakeToolchain: https://docs.conan.io/2/reference/tools/cmake/cmaketoolchain.html#extending-and-advanced-customization

Comment on lines +150 to +159
self.cpp_info.set_property("cmake_file_name", "up-cpp")
self.cpp_info.set_property("cmake_target_name", "up-cpp::up-cpp")
self.cpp_info.set_property("pkg_config_name", "up-cpp")
self.cpp_info.libs = collect_libs(self)

self.cpp_info.set_property("cmake_target_name", "up-cpp::up-cpp")
self.cpp_info.requires = ["spdlog::spdlog", "protobuf::protobuf"]

self.cpp_info.names["cmake_find_package"] = "up-cpp"
self.cpp_info.names["cmake_find_package_multi"] = "up-cpp"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
self.cpp_info.set_property("cmake_file_name", "up-cpp")
self.cpp_info.set_property("cmake_target_name", "up-cpp::up-cpp")
self.cpp_info.set_property("pkg_config_name", "up-cpp")
self.cpp_info.libs = collect_libs(self)
self.cpp_info.set_property("cmake_target_name", "up-cpp::up-cpp")
self.cpp_info.requires = ["spdlog::spdlog", "protobuf::protobuf"]
self.cpp_info.names["cmake_find_package"] = "up-cpp"
self.cpp_info.names["cmake_find_package_multi"] = "up-cpp"

All these configuration is generated by default ;)

Comment on lines +14 to +15
self.requires("protobuf/3.21.12")
self.requires("spdlog/1.13.0")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
self.requires("protobuf/3.21.12")
self.requires("spdlog/1.13.0")

Transitive dependencies are managed by Conan already.

@uilianries uilianries self-assigned this May 23, 2024
@AbrilRBS AbrilRBS removed their assignment Jun 14, 2024
@PLeVasseur
Copy link
Author

Hey @uilianries 👋 I wanted to follow up here. My employer has decided to part ways with many staff, myself included. I was working on Eclipse uProtocol as my "day job". My ability to contribute to Eclipse uProtocol is reduced at the moment. I'd propose closing this for now and revisiting when myself or another maintainer has bandwidth.

@PLeVasseur PLeVasseur closed this Oct 14, 2024
@uilianries
Copy link
Member

Hello @PLeVasseur! I'm currently on vacation 🌴, please, ping @conan-io/barbarians for support. Have a nice day!

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.

4 participants