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

sfml: Use libglvnd on FreeBSD and Linux #23448

Closed
wants to merge 1 commit 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
13 changes: 11 additions & 2 deletions recipes/sfml/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ def layout(self):
def requirements(self):
if self.options.window:
# FIXME: use cci's glad
if self.settings.os in ["Windows", "Linux", "FreeBSD", "Macos"]:
if self.settings.os in ["FreeBSD", "Linux"]:
self.requires("libglvnd/1.7.0")
elif self.settings.os in ["Macos", "Windows"]:
self.requires("opengl/system")
if self.settings.os == "Linux":
self.requires("libudev/system")
Expand All @@ -74,6 +76,8 @@ def validate(self):
raise ConanInvalidConfiguration(f"{self.ref} not supported on {self.settings.os}")
if self.options.graphics and not self.options.window:
raise ConanInvalidConfiguration("sfml:graphics=True requires sfml:window=True")
if self.options.window and self.settings.os in ["FreeBSD", "Linux"] and not self.dependencies["libglvnd"].options.glx:
raise ConanInvalidConfiguration(f"{self.ref} requires the glx option of libglvnd to be enabled when the window option is enabled")

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
Expand All @@ -85,6 +89,7 @@ def generate(self):
tc = CMakeToolchain(self)
tc.cache_variables["SFML_DEPENDENCIES_INSTALL_PREFIX"] = self.package_folder.replace("\\", "/")
tc.cache_variables["SFML_MISC_INSTALL_PREFIX"] = os.path.join(self.package_folder, "licenses").replace("\\", "/")
tc.variables["OpenGL_GL_PREFERENCE"] = "GLVND"
tc.variables["SFML_BUILD_WINDOW"] = self.options.window
tc.variables["SFML_BUILD_GRAPHICS"] = self.options.graphics
tc.variables["SFML_BUILD_NETWORK"] = self.options.network
Expand Down Expand Up @@ -199,7 +204,11 @@ def uikit():
return ["UIKit"] if self.settings.os == "iOS" else []

def opengl():
return ["opengl::opengl"] if self.settings.os in ["Windows", "Linux", "FreeBSD", "Macos"] else []
if self.settings.os in ["FreeBSD", "Linux"]:
return ["libglvnd::gl"]
elif self.settings.os in ["Macos", "Windows"]:
return ["opengl::opengl"]
return []

def opengles_android():
return ["EGL", "GLESv1_CM"] if self.settings.os == "Android" else []
Expand Down
Loading