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

set opencl pkg_config name #8623

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions recipes/opencl-headers/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,13 @@ def package_info(self):
# TODO: to remove in conan v2 once cmake_find_package_* generators removed
self.cpp_info.filenames["cmake_find_package"] = "OpenCLHeaders"
self.cpp_info.filenames["cmake_find_package_multi"] = "OpenCLHeaders"
self.cpp_info.set_property("cmake_file_name", "OpenCLHeaders")

self.cpp_info.names["cmake_find_package"] = "OpenCL"
self.cpp_info.names["cmake_find_package_multi"] = "OpenCL"
self.cpp_info.names["pkg_config"] = "OpenCL"
self.cpp_info.set_property("cmake_target_name", "OpenCL::Headers")
self.cpp_info.set_property("pkg_config_name", "OpenCL")
self.cpp_info.components["_opencl-headers"].names["cmake_find_package"] = "Headers"
self.cpp_info.components["_opencl-headers"].names["cmake_find_package_multi"] = "Headers"
self.cpp_info.components["_opencl-headers"].set_property("cmake_target_name", "OpenCL::Headers")
dvirtz marked this conversation as resolved.
Show resolved Hide resolved
self.cpp_info.components["_opencl-headers"].set_property("pkg_config_name", "OpenCL")
self.cpp_info.components["_opencl-headers"].set_property("pkg_config_name", "OpenCLHeaders")
Copy link
Contributor

@SpaceIm SpaceIm Jan 4, 2022

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.components["_opencl-headers"].set_property("pkg_config_name", "OpenCLHeaders")
self.cpp_info.components["_opencl-headers"].set_property("pkg_config_name", "OpenCLHeaders")

No, if "official" pkg-config file is OpenCL.pc, just set pkg_config_name to OpenCL.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but this causes PkgConfigDeps to generate a self including file:

Name: OpenCL
Description: Conan package: OpenCL
Version: 2021.06.30
Requires: OpenCL

with this change it generates

Name: OpenCL
Description: Conan package: OpenCL
Version: 2021.06.30
Requires: OpenCLHeaders

and

prefix=/home/conan/.conan/data/opencl-headers/2021.06.30/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9
libdir1=${prefix}/lib
includedir1=${prefix}/include

Name: OpenCLHeaders
Description: Conan component: OpenCLHeaders
Version: 2021.06.30
Libs: -L"${libdir1}" -F Frameworks 
Cflags: -I"${includedir1}" 

Copy link
Contributor

Choose a reason for hiding this comment

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

I would say it's a bug of PkgConfigDeps, it's still experimental.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

what would you expect the generator to do?

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually i would expect the component pkg-config file to override the global pkg-config file like it happens for pkg-config generator

Copy link
Contributor

Choose a reason for hiding this comment

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

@SpaceIm, I think that here maybe the best would be not to declare the pkg_config_name property in the component at all, just for the root cpp_info, so Conan will create a new name for the component (OpenCL-_opencl-headers.pc in this case) that is included in the OpenCL.pc that is the one we want.
Doing that names will not collide and also not declaring the property with other invented named we don't promote names that are not official... Also, for Conan 1.45 we have added a warning to try to avoid names overlapping when using PkgConfigDeps. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

Conan 1.45 will bring the same behavior for PkgConfigDeps. It's already tested here conan-io/conan#10344. The documentation is pending but it's ongoing.
In summary, you can put:

self.cpp_info.components["_opencl-headers"].set_property("pkg_config_name", "OpenCL")

and you're not going to create the self including file anymore.