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

glfw: limit xorg library dependencies #23272

Merged
merged 6 commits into from
Nov 26, 2024

Conversation

johningve
Copy link
Contributor

Previously the glfw package would implicitly require linking with xorg::xorg, which includes all the libraries exposed by the xorg package.

This change explicitly declares the requirements of glfw, limiting the xorg libraries to only those needed.

From version 3.4 these dependencies are no longer necessary since glew implemented runtime platform detection.

Also removes vulkan_static option in version 3.4, since it is no longer supported by glfw.

Specify library name and version: glfw/all


Previously the glfw package would implicitly require linking with
xorg::xorg, which includes all the libraries exposed by the xorg
package.

This commit explicitly declares the requirements of glfw, limiting the
xorg libraries to only those needed.
The ability to link to a static Vulkan loader was removed in glfw
version 3.4.
Copy link
Contributor

🤖 Beep Boop! This pull request is making changes to 'recipes/glfw//'.

👋 @Hopobcn you might be interested. 😉

Comment on lines 224 to 233
if Version(self.version) < "3.4":
if self.options.get_safe("vulkan_static"):
self.cpp_info.requires.extend(["vulkan-loader::vulkan-loader"])
if self.settings.os in ["Linux", "FreeBSD"]:
if self.options.get_safe("with_x11", True):
self.cpp_info.requires.extend(["xorg::x11"])
if self.options.get_safe("with_wayland"):
self.cpp_info.requires.extend(["wayland::wayland", "xkbcommon::xkbcommon"])
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if Version(self.version) < "3.4":
if self.options.get_safe("vulkan_static"):
self.cpp_info.requires.extend(["vulkan-loader::vulkan-loader"])
if self.settings.os in ["Linux", "FreeBSD"]:
if self.options.get_safe("with_x11", True):
self.cpp_info.requires.extend(["xorg::x11"])
if self.options.get_safe("with_wayland"):
self.cpp_info.requires.extend(["wayland::wayland", "xkbcommon::xkbcommon"])
if self.options.get_safe("vulkan_static"):
self.cpp_info.requires.extend(["vulkan-loader::vulkan-loader"])
if self.settings.os in ["Linux", "FreeBSD"]:
if self.options.get_safe("with_x11", True):
self.cpp_info.requires.extend(["xorg::x11"])
if self.options.get_safe("with_wayland"):
self.cpp_info.requires.extend(["wayland::wayland", "xkbcommon::xkbcommon"])

I don't think the version check is necessary as it's already handled by the deleted options in configure(), no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the version check is needed because even when you specify with_x11=True or with_wayland=True, the glfw library does not require linking with these after version 3.4, which implemented the runtime platform detection.

@conan-center-bot

This comment has been minimized.

From version 3.4, glfw loads platform libraries at runtime, and so it is
not necessary to link with these.
@johningve johningve force-pushed the fix-glfw-cpp-info-requirements branch from 18ad9b7 to c05ac9d Compare March 27, 2024 07:59
@conan-center-bot
Copy link
Collaborator

Conan v1 pipeline ✔️

All green in build 2 (c05ac9dbdb4ad9a5508a7f6c8575e8098ac60fbd):

  • glfw/3.3.8:
    All packages built successfully! (All logs)

  • glfw/3.4:
    All packages built successfully! (All logs)

  • glfw/3.3.7:
    All packages built successfully! (All logs)

  • glfw/3.3.6:
    All packages built successfully! (All logs)

  • glfw/3.3.5:
    All packages built successfully! (All logs)

  • glfw/3.3.4:
    All packages built successfully! (All logs)

  • glfw/3.3.3:
    All packages built successfully! (All logs)

  • glfw/3.3.2:
    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 2 (c05ac9dbdb4ad9a5508a7f6c8575e8098ac60fbd):

  • glfw/3.3.6:
    All packages built successfully! (All logs)

  • glfw/3.4:
    All packages built successfully! (All logs)

  • glfw/3.3.5:
    All packages built successfully! (All logs)

  • glfw/3.3.8:
    All packages built successfully! (All logs)

  • glfw/3.3.4:
    All packages built successfully! (All logs)

  • glfw/3.3.7:
    All packages built successfully! (All logs)

  • glfw/3.3.2:
    All packages built successfully! (All logs)

  • glfw/3.3.3:
    All packages built successfully! (All logs)

perseoGI
perseoGI previously approved these changes Nov 26, 2024
Copy link
Contributor

@perseoGI perseoGI left a comment

Choose a reason for hiding this comment

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

LGTM

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.

@perseoGI perseoGI merged commit d167a8d into conan-io:master Nov 26, 2024
9 checks passed
Copy link
Contributor

@valgur valgur left a comment

Choose a reason for hiding this comment

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

Need to remove some redundant/conflicting logic in package_info() that was added by #25547, which got merged first.

@valgur
Copy link
Contributor

valgur commented Nov 26, 2024

@perseoGI Needs a follow-up PR.

@perseoGI
Copy link
Contributor

@valgur Which logic are you refering?

@valgur
Copy link
Contributor

valgur commented Nov 26, 2024

The requires being added for vulkan, xorg and wayland on lines 230-251 are being duplicated by the logic added in this PR.

@perseoGI
Copy link
Contributor

Okey I see. Lines

self.cpp_info.requires = ["opengl::opengl"]
if self.options.get_safe("vulkan_static"):
self.cpp_info.requires.append("vulkan-loader::vulkan-loader")
if self.settings.os in ["Linux", "FreeBSD"]:
if self.options.get_safe("with_x11", True):
# https://github.com/glfw/glfw/blob/3.4/src/CMakeLists.txt#L181-L218
# https://github.com/glfw/glfw/blob/3.3.2/CMakeLists.txt#L196-L233
self.cpp_info.requires.extend([
"xorg::x11", # Also includes Xkb and Xshape
"xorg::xrandr",
"xorg::xinerama",
"xorg::xcursor",
"xorg::xi",
])
if self.options.get_safe("with_wayland"):
# https://github.com/glfw/glfw/blob/3.4/src/CMakeLists.txt#L163-L167
self.cpp_info.requires.extend([
"wayland::wayland-client",
"wayland::wayland-cursor",
"wayland::wayland-egl",
"xkbcommon::xkbcommon"
])
seems to be more complete.
But in this PR the version control was added. Should we keep the previous lines with the version control?
Could you @johningve or @valgur open a PR to fix this?

OMGtechy pushed a commit to OMGtechy/conan-center-index that referenced this pull request Dec 31, 2024
Co-authored-by: PerseoGI <perseog@jfrog.com>
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.

6 participants