-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
conanfile.py
68 lines (52 loc) · 2.53 KB
/
conanfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
from conan import ConanFile
from conan.tools.system import package_manager
from conan.tools.gnu import PkgConfig
required_conan_version = ">=1.50.0"
class SysConfigOpenGLConan(ConanFile):
name = "opengl"
version = "system"
description = "cross-platform virtual conan package for the OpenGL support"
topics = ("opengl", "gl")
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://www.opengl.org/"
license = "MIT"
package_type = "shared-library"
settings = "os", "arch", "compiler", "build_type"
def layout(self):
pass
def package_id(self):
self.info.clear()
def system_requirements(self):
if self.settings.os not in ["Linux", "FreeBSD", "SunOS"]:
return
dnf = package_manager.Dnf(self)
dnf.install_substitutes(["libglvnd-devel"], ["mesa-libGL-devel"], update=True, check=True)
yum = package_manager.Yum(self)
yum.install(["mesa-libGL-devel"], update=True, check=True)
apt = package_manager.Apt(self)
apt.install_substitutes(["libgl-dev"], ["libgl1-mesa-dev"], update=True, check=True)
pacman = package_manager.PacMan(self)
pacman.install(["libglvnd"], update=True, check=True)
zypper = package_manager.Zypper(self)
zypper.install_substitutes(["Mesa-libGL-devel", "glproto-devel"],
["Mesa-libGL-devel", "xorgproto-devel"], update=True, check=True)
pkg = package_manager.Pkg(self)
pkg.install(["libglvnd"], update=True, check=True)
pkg_util = package_manager.PkgUtil(self)
pkg_util.install(["mesalibs"], update=True, check=True)
def package_info(self):
# TODO: Workaround for #2311 until a better solution can be found
self.cpp_info.filenames["cmake_find_package"] = "opengl_system"
self.cpp_info.filenames["cmake_find_package_multi"] = "opengl_system"
self.cpp_info.set_property("cmake_file_name", "opengl_system")
self.cpp_info.bindirs = []
self.cpp_info.includedirs = []
self.cpp_info.libdirs = []
if self.settings.os == "Macos":
self.cpp_info.defines.append("GL_SILENCE_DEPRECATION=1")
self.cpp_info.frameworks.append("OpenGL")
elif self.settings.os == "Windows":
self.cpp_info.system_libs = ["opengl32"]
elif self.settings.os in ["Linux", "FreeBSD", "SunOS"]:
pkg_config = PkgConfig(self, 'gl')
pkg_config.fill_cpp_info(self.cpp_info, is_system=self.settings.os != "FreeBSD")