Skip to content

Commit

Permalink
(#22956) glew: Use the mesa-glu Conan package
Browse files Browse the repository at this point in the history
* glew: Use the mesa-glu Conan package

This is done the same way as for the FreeGLUT package.
Fixes #22944.

* Make dependency on GLU headers transitive

GL/glew.h includes glu.h.

---------

Co-authored-by: Francisco Ramírez <franchuti688@gmail.com>
  • Loading branch information
jwillikers and franramirez688 authored Mar 10, 2024
1 parent e4f170c commit f84ed09
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions recipes/glew/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from conan import ConanFile
from conan.tools.apple import is_apple_os
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir
import os
Expand Down Expand Up @@ -45,7 +46,11 @@ def layout(self):

def requirements(self):
self.requires("opengl/system")
self.requires("glu/system")
# GL/glew.h includes glu.h.
if is_apple_os(self) or self.settings.os == "Windows":
self.requires("glu/system", transitive_headers=True)
else:
self.requires("mesa-glu/9.0.3", transitive_headers=True)

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
Expand Down Expand Up @@ -90,7 +95,11 @@ def package_info(self):
self.cpp_info.components["glewlib"].libs = [lib_name]
if self.settings.os == "Windows" and not self.options.shared:
self.cpp_info.components["glewlib"].defines.append("GLEW_STATIC")
self.cpp_info.components["glewlib"].requires = ["opengl::opengl", "glu::glu"]
self.cpp_info.components["glewlib"].requires = ["opengl::opengl"]
if is_apple_os(self) or self.settings.os == "Windows":
self.cpp_info.components["glewlib"].requires.append("glu::glu")
else:
self.cpp_info.components["glewlib"].requires.append("mesa-glu::mesa-glu")

# TODO: to remove in conan v2 once cmake_find_package_* generators removed
self.cpp_info.filenames["cmake_find_package"] = "GLEW"
Expand Down

0 comments on commit f84ed09

Please sign in to comment.