-
Notifications
You must be signed in to change notification settings - Fork 2k
libglvnd 1.4.0 #11121
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
Merged
Merged
libglvnd 1.4.0 #11121
Changes from 3 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
4043426
libglvnd 1.4.0
ericLemanissier 1d5f816
fix license
ericLemanissier f6084dd
Apply suggestions from code review
ericLemanissier b9fe186
Merge branch 'conan-io:master' into libglvnd
ericLemanissier a08ce06
Update recipes/libglvnd/all/conanfile.py
ericLemanissier 78ae4ce
conan 2 compatible imports
ericLemanissier f179a25
migrate to conan V2 Meson integration
ericLemanissier f27a344
use layout
ericLemanissier 05c7543
Update conanfile.py
ericLemanissier cd5786c
Update conanfile.py
ericLemanissier b9703d3
Update conanfile.py
ericLemanissier ecabe17
Update conanfile.py
ericLemanissier 199cf01
Update conanfile.py
ericLemanissier b35ead6
gtk 4.7.1
ericLemanissier ef4763a
require conan 1.51.0
ericLemanissier a948f68
white spaces
ericLemanissier 365ef89
Update conanfile.py
ericLemanissier 1bf5efc
Update conanfile.py
ericLemanissier c6166c7
require conan 1.50.0
ericLemanissier File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
sources: | ||
"1.4.0": | ||
url: "https://gitlab.freedesktop.org/glvnd/libglvnd/uploads/ca5bf4295beb39bb324f692c481ac8a1/libglvnd-1.4.0.tar.gz" | ||
sha256: "c4a884503d2412dc1fa209613aa8a77193aeb7065b823fe1775dc8b6f3e45211" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
from conans import Meson, ConanFile, tools | ||
from conans.errors import ConanInvalidConfiguration | ||
import functools | ||
import os | ||
import textwrap | ||
|
||
required_conan_version = ">=1.45.0" | ||
|
||
class LibGlvndConan(ConanFile): | ||
name = "libglvnd" | ||
description = "The GL Vendor-Neutral Dispatch library" | ||
license = "LicenseRef-LICENSE" | ||
ericLemanissier marked this conversation as resolved.
Show resolved
Hide resolved
|
||
url = "https://github.com/conan-io/conan-center-index" | ||
homepage = "https://gitlab.freedesktop.org/glvnd/libglvnd" | ||
topics = ("gl", "vendor-neutral", "dispatch") | ||
settings = "os", "arch", "compiler", "build_type" | ||
options = { | ||
"asm": [True, False], | ||
"x11": [True, False], | ||
"egl": [True, False], | ||
"glx": [True, False], | ||
"gles1": [True, False], | ||
"gles2": [True, False], | ||
"tls": [True, False], | ||
"dispatch_tls": [True, False], | ||
"headers": [True, False], | ||
"entrypoint_patching": [True, False], | ||
} | ||
default_options = { | ||
"asm" : True, | ||
"x11": True, | ||
"egl": True, | ||
"glx": True, | ||
"gles1": True, | ||
"gles2": True, | ||
"tls": True, | ||
"dispatch_tls": True, | ||
"headers": True, | ||
"entrypoint_patching": True, | ||
} | ||
|
||
generators = "pkg_config" | ||
|
||
|
||
@property | ||
def _source_subfolder(self): | ||
return "source_subfolder" | ||
|
||
@property | ||
def _build_subfolder(self): | ||
return "build_subfolder" | ||
|
||
# don't use self.settings_build | ||
@property | ||
def _settings_build(self): | ||
return getattr(self, "settings_build", self.settings) | ||
|
||
# don't use self.user_info_build | ||
@property | ||
def _user_info_build(self): | ||
return getattr(self, "user_info_build", self.deps_user_info) | ||
|
||
def configure(self): | ||
del self.settings.compiler.libcxx | ||
del self.settings.compiler.cppstd | ||
|
||
def requirements(self): | ||
if self.options.x11: | ||
self.requires("xorg/system") | ||
if self.options.glx: | ||
self.requires("xorg-proto/2021.4") | ||
|
||
def validate(self): | ||
if self.settings.os not in ['Linux', 'FreeBSD']: | ||
raise ConanInvalidConfiguration("libglvnd is only compatible with Linux and FreeBSD") | ||
|
||
def build_requirements(self): | ||
self.build_requires("meson/0.62.2") | ||
self.build_requires("pkgconf/1.7.4") | ||
|
||
def source(self): | ||
tools.get(**self.conan_data["sources"][self.version], | ||
destination=self._source_subfolder, strip_root=True) | ||
|
||
@functools.lru_cache(1) | ||
def _configure_meson(self): | ||
meson = Meson(self) | ||
defs = {} | ||
defs["asm"] = self.options.asm | ||
defs["x11"] = self.options.x11 | ||
defs["egl"] = self.options.egl | ||
defs["glx"] = self.options.glx | ||
defs["gles1"] = self.options.gles1 | ||
defs["gles2"] = self.options.gles2 | ||
defs["tls"] = self.options.tls | ||
defs["dispatch-tls"] = self.options.dispatch_tls | ||
defs["headers"] = self.options.headers | ||
defs["entrypoint-patching"] = self.options.entrypoint_patching | ||
meson.configure(source_folder=self._source_subfolder, build_folder=self._build_subfolder) | ||
return meson | ||
|
||
def build(self): | ||
meson = self._configure_meson() | ||
meson.build() | ||
|
||
def package(self): | ||
meson = self._configure_meson() | ||
meson.install() | ||
|
||
tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) | ||
tools.rmdir(os.path.join(self.package_folder, "share")) | ||
|
||
tools.save(os.path.join(self.package_folder, "licenses", "LICENSE"), textwrap.dedent('''\ | ||
Copyright (c) 2013, NVIDIA CORPORATION. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a | ||
copy of this software and/or associated documentation files (the | ||
"Materials"), to deal in the Materials without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Materials, and to | ||
permit persons to whom the Materials are furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included | ||
unaltered in all copies or substantial portions of the Materials. | ||
Any additions, deletions, or changes to the original source files | ||
must be clearly indicated in accompanying documentation. | ||
|
||
THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. | ||
''')) | ||
|
||
def package_info(self): | ||
self.cpp_info.components['gldispatch'].libs = ["GLdispatch"] | ||
self.cpp_info.components['gldispatch'].system_libs.extend(["pthread", "dl"]) | ||
|
||
self.cpp_info.components['opengl'].libs = ["OpenGL"] | ||
self.cpp_info.components['opengl'].requires.extend(["gldispatch"]) | ||
self.cpp_info.components['opengl'].set_property("pkg_config_name", "opengl") | ||
|
||
if self.options.egl: | ||
self.cpp_info.components['egl'].libs = ["EGL"] | ||
self.cpp_info.components['egl'].system_libs.extend(["pthread", "dl", "m"]) | ||
self.cpp_info.components['egl'].requires.extend(["xorg::x11", "gldispatch"]) | ||
self.cpp_info.components['egl'].set_property("pkg_config_name", "egl") | ||
|
||
if self.options.glx: | ||
self.cpp_info.components['glx'].libs = ["GLX"] | ||
self.cpp_info.components['glx'].system_libs.extend(["dl"]) | ||
self.cpp_info.components['glx'].requires.extend(["xorg::x11", "xorg-proto::glproto", "gldispatch"]) | ||
self.cpp_info.components['glx'].set_property("pkg_config_name", "glx") | ||
|
||
self.cpp_info.components['gl'].libs = ["GL"] | ||
self.cpp_info.components['gl'].system_libs.extend(["dl"]) | ||
self.cpp_info.components['gl'].requires.extend(["xorg::x11", "glx", "gldispatch"]) | ||
self.cpp_info.components['gl'].set_property("pkg_config_name", "gl") | ||
|
||
if self.options.gles1: | ||
self.cpp_info.components['gles1'].libs = ["GLESv1_CM"] | ||
self.cpp_info.components['gles1'].requires.extend(["gldispatch"]) | ||
self.cpp_info.components['gles1'].set_property("pkg_config_name", "glesv1_cm") | ||
|
||
if self.options.gles2: | ||
self.cpp_info.components['gles2'].libs = ["GLESv2"] | ||
self.cpp_info.components['gles2'].requires.extend(["gldispatch"]) | ||
self.cpp_info.components['gles2'].set_property("pkg_config_name", "glesv2") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(test_package) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
add_executable(${PROJECT_NAME} test_package.c) | ||
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from conans import ConanFile, CMake, tools | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake" | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self): | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run(bin_path, run_environment=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <stdio.h> | ||
|
||
#include <GL/gl.h> | ||
|
||
|
||
int main() | ||
{ | ||
const char * gl_vendor = (const char *) glGetString(GL_VENDOR); | ||
const char * gl_renderer = (const char *) glGetString(GL_RENDERER); | ||
const char * gl_version = (const char *) glGetString(GL_VERSION); | ||
const char * gl_extensions = (const char *) glGetString(GL_EXTENSIONS); | ||
printf( "GL_VENDOR: %s\n", gl_vendor ? gl_vendor : "(null)"); | ||
printf( "GL_RENDERER: %s\n", gl_renderer ? gl_renderer : "(null)"); | ||
printf( "GL_VERSION: %s\n", gl_version ? gl_version : "(null)"); | ||
printf( "GL_EXTENSIONS: %s\n", gl_extensions ? gl_extensions : "(null)"); | ||
return 0; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
versions: | ||
"1.4.0": | ||
folder: "all" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a note: My understanding is, that this might be the better replacement for all the places we currently use
opengl/system
, but this might break compatibility for older systems with older GPU drivers and in general GPU drivers that aren't supported by glvnd.We probably would need the currently
opengl/system
package in the form of an optionalmesa-opengl/system
package or something, but it wouldn't necessarily be required, as any driver would be fine.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, some of the distros install glvnd as system opengl too (https://ubuntu.pkgs.org/22.04/ubuntu-main-amd64/libgl-dev_1.4.0-1_amd64.deb.html), so mesa-opengl/system is probably not the good name either.