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

Openscenegraph/3.6.5 opengl profile #15366

Merged
Merged
Changes from 10 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
42 changes: 26 additions & 16 deletions recipes/openscenegraph/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
from conans import CMake, ConanFile, tools
from conans.errors import ConanInvalidConfiguration
from conan import ConanFile
from conan.tools.files import get, rmdir, rm, patch
prince-chrismc marked this conversation as resolved.
Show resolved Hide resolved
from conan.tools.build import cross_building
from conan.tools.scm import Version
from conan.tools.apple import is_apple_os
from conan.errors import ConanInvalidConfiguration
from conans import CMake
import os
import functools

required_conan_version = ">=1.29.1"

required_conan_version = ">=1.50.0"


class OpenSceneGraphConanFile(ConanFile):
Expand Down Expand Up @@ -41,6 +47,7 @@ class OpenSceneGraphConanFile(ConanFile):
"with_png": [True, False],
"with_tiff": [True, False],
"with_zlib": [True, False],
"opengl_profile": ["gl1", "gl2", "gl3", "glCore", "gles1", "gles2", "gles3", "gles2+gles3"],
}
default_options = {
"shared": False,
Expand Down Expand Up @@ -68,6 +75,7 @@ class OpenSceneGraphConanFile(ConanFile):
"with_png": True,
"with_tiff": True,
"with_zlib": True,
"opengl_profile": "gl2",
}

short_paths = True
Expand All @@ -86,7 +94,7 @@ def config_options(self):
# Default to false with fontconfig until it is supported on Windows
self.options.use_fontconfig = False

if tools.is_apple_os(self.settings.os):
if is_apple_os(self):
# osg uses imageio on Apple platforms
del self.options.with_gif
del self.options.with_jpeg
Expand All @@ -108,7 +116,7 @@ def configure(self):
def validate(self):
if self.options.get_safe("with_asio", False):
raise ConanInvalidConfiguration("ASIO support in OSG is broken, see https://github.com/openscenegraph/OpenSceneGraph/issues/921")
if hasattr(self, "settings_build") and tools.cross_building(self):
if hasattr(self, "settings_build") and cross_building(self):
raise ConanInvalidConfiguration("openscenegraph recipe cannot be cross-built yet. Contributions are welcome.")

def requirements(self):
Expand Down Expand Up @@ -138,7 +146,7 @@ def requirements(self):
if self.options.with_jasper:
self.requires("jasper/2.0.33")
if self.options.get_safe("with_jpeg"):
self.requires("libjpeg/9d")
self.requires("libjpeg/9e")
if self.options.get_safe("with_openexr"):
self.requires("openexr/3.1.5")
if self.options.get_safe("with_png"):
Expand All @@ -149,12 +157,12 @@ def requirements(self):
self.requires("zlib/1.2.12")
prince-chrismc marked this conversation as resolved.
Show resolved Hide resolved

def source(self):
tools.get(**self.conan_data["sources"][self.version],
get(self, **self.conan_data["sources"][self.version],
strip_root=True, destination=self._source_subfolder)
prince-chrismc marked this conversation as resolved.
Show resolved Hide resolved

def _patch_sources(self):
for patch in self.conan_data["patches"].get(self.version, []):
tools.patch(**patch)
for p in self.conan_data["patches"].get(self.version, []):
patch(self, **p)
prince-chrismc marked this conversation as resolved.
Show resolved Hide resolved

for package in ("Fontconfig", "Freetype", "GDAL", "GIFLIB", "GTA", "Jasper", "OpenEXR"):
# Prefer conan's find package scripts over osg's
Expand Down Expand Up @@ -186,6 +194,8 @@ def _configured_cmake(self):

cmake.definitions["OSG_TEXT_USE_FONTCONFIG"] = self.options.use_fontconfig

cmake.definitions["OPENGL_PROFILE"] = str(self.options.get_safe("opengl_profile", "gl2")).upper()
prince-chrismc marked this conversation as resolved.
Show resolved Hide resolved

# Disable option dependencies unless we have a package for them
cmake.definitions["OSG_WITH_FREETYPE"] = self.options.with_freetype
cmake.definitions["OSG_WITH_OPENEXR"] = self.options.get_safe("with_openexr", False)
Expand Down Expand Up @@ -233,8 +243,8 @@ def package(self):

self.copy(pattern="LICENSE.txt", dst="licenses", src=self._source_subfolder)

tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))
tools.remove_files_by_mask(self.package_folder, "*.pdb")
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
rm(self, "*.pdb", self.package_folder, True)

def package_info(self):
# FindOpenSceneGraph.cmake is shipped with cmake and is a traditional cmake script
Expand Down Expand Up @@ -327,7 +337,7 @@ def setup_library(lib):
if self.options.enable_windowing_system:
if self.settings.os == "Linux":
library.requires.append("xorg::xorg")
elif tools.is_apple_os(self.settings.os):
elif is_apple_os(self):
library.frameworks = ["Cocoa"]
if self.settings.os == "Windows":
library.system_libs = ["gdi32"]
Expand Down Expand Up @@ -473,16 +483,16 @@ def setup_library(lib):
# with_directshow
# setup_plugin("directshow")

if tools.is_apple_os(self.settings.os):
if is_apple_os(self):
setup_plugin("imageio").frameworks = ["Accelerate"]

if ((self.settings.os == "Macos" and self.settings.os.version and tools.Version(self.settings.os.version) >= "10.8")
or (self.settings.os == "iOS" and tools.Version(self.settings.os.version) >= "6.0")):
if ((self.settings.os == "Macos" and self.settings.os.version and Version(self.settings.os.version) >= "10.8")
or (self.settings.os == "iOS" and Version(self.settings.os.version) >= "6.0")):
plugin = setup_plugin("avfoundation")
plugin.requires.append("osgViewer")
plugin.frameworks = ["AVFoundation", "Cocoa", "CoreVideo", "CoreMedia", "QuartzCore"]

if self.settings.os == "Macos" and self.settings.os.version and tools.Version(self.settings.os.version) <= "10.6" and self.settings.arch == "x86":
if self.settings.os == "Macos" and self.settings.os.version and Version(self.settings.os.version) <= "10.6" and self.settings.arch == "x86":
setup_plugin("qt").frameworks = ["QuickTime"]

if self.settings.os == "Macos" and self.settings.arch == "x86":
Expand Down