Skip to content

Commit

Permalink
(#3878) opengl: support FreeBSD
Browse files Browse the repository at this point in the history
  • Loading branch information
ericLemanissier authored Dec 15, 2020
1 parent c759bf6 commit 0801139
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions recipes/opengl/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from conans import ConanFile, tools
from conans.errors import ConanException
import os


class SysConfigOpenGLConan(ConanFile):
Expand All @@ -11,7 +10,7 @@ class SysConfigOpenGLConan(ConanFile):
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://www.opengl.org/"
license = "MIT"
settings = ("os",)
settings = "os"

def package_id(self):
self.info.header_only()
Expand All @@ -37,8 +36,8 @@ def _fill_cppinfo_from_pkgconfig(self, name):
self.cpp_info.cxxflags.extend(cflags)

def system_requirements(self):
packages = []
if tools.os_info.is_linux and self.settings.os == "Linux":
package_tool = tools.SystemPackageTool(conanfile=self, default_mode='verify')
if tools.os_info.with_yum:
if tools.os_info.linux_distro == "fedora" and tools.os_info.os_version >= "32":
packages = ["libglvnd-devel"]
Expand All @@ -57,8 +56,11 @@ def system_requirements(self):
elif tools.os_info.with_zypper:
packages = ["Mesa-libGL-devel"]
else:
packages = []
self.output.warn("Don't know how to install OpenGL for your distro.")
elif tools.os_info.is_freebsd and self.settings.os == "FreeBSD":
packages = ["mesa-libs"]
if packages:
package_tool = tools.SystemPackageTool(conanfile=self, default_mode='verify')
for p in packages:
package_tool.install(update=True, packages=p)

Expand All @@ -74,5 +76,5 @@ def package_info(self):
self.cpp_info.frameworks.append("OpenGL")
elif self.settings.os == "Windows":
self.cpp_info.system_libs = ["opengl32"]
elif self.settings.os == "Linux":
elif self.settings.os in ["Linux", "FreeBSD"]:
self._fill_cppinfo_from_pkgconfig('gl')
2 changes: 1 addition & 1 deletion recipes/opengl/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <Windows.h>
#endif

#if defined(__linux__)
#if defined(__linux__) or defined(__FreeBSD__)

bool init_context() { return true; }

Expand Down

0 comments on commit 0801139

Please sign in to comment.