Skip to content

VSG/VulkanSceneGraph v1.1.10 #27634

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions recipes/vsg/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ sources:
"1.0.9":
url: "https://github.com/vsg-dev/VulkanSceneGraph/archive/v1.0.9.tar.gz"
sha256: "9a62be7facc13c391c33dc8356b147a3b86f531ea72a28f6b2c364777e761412"
"1.1.10":
url: "https://github.com/vsg-dev/VulkanSceneGraph/archive/refs/tags/v1.1.10.tar.gz"
sha256: "B430132BA5454E0616FF5334A7CB9196C0E8F10A925C2106E80A78D6F24AE4B5"
83 changes: 63 additions & 20 deletions recipes/vsg/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,33 @@
from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake
import os

required_conan_version = ">=1.53.0"
required_conan_version = ">=2.0"

class VsgConan(ConanFile):
name = "vsg"
description = "VulkanSceneGraph"
license = "MIT"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://www.vulkanscenegraph.org"
topics = ("vulkan", "scenegraph", "graphics", "3d")
topics = ("vulkan", "scenegraph", "graphics", "3d", "vulkanscenegraph", "osg", "openscenegraph")
package_type = "library"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"max_devices": [1,2,3,4],
"fPIC": [True, False],
"max_devices": [1,2,3,4],
"windowing": [True, False],
"with_glslang": [True, False],
"max_instrumentation_level": [0,1,2,3],
}

default_options = {
"shared": False,
"max_devices" : 1,
"fPIC": True,
"max_devices" : 1,
"windowing" : True,
"with_glslang" : False,
"max_instrumentation_level": 1,
}

@property
Expand All @@ -40,19 +47,34 @@ def _compilers_minimum_version(self):
"clang": "7",
"apple-clang": "10",
}

def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC

def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")


if Version(self.version) < "1.1.1":
del self.options.max_instrumentation_level

if Version(self.version) < "1.0.5":
# windowing still provided but optional opt-out only provided by v1.0.5
del self.options.windowing

def requirements(self):
self.requires("vulkan-loader/1.3.239.0", transitive_headers=True)
self.requires("vulkan-loader/1.3.268.0", transitive_headers=True)
if self.options.with_glslang:
self.requires("glslang/1.3.268.0")
# Required to avoid missing include:
# It seems VSG relies on spirv headers that are propagated via
# glslang components, but conan glslang does not provide
# proper directory linkage to consumers. thus, its explicitly added.
self.requires("spirv-tools/1.3.268.0")

def validate(self):
if self.info.settings.compiler.cppstd:
if self.settings.compiler.get_safe("cppstd"):
check_min_cppstd(self, self._min_cppstd)
check_min_vs(self, 191)

Expand All @@ -71,15 +93,42 @@ def source(self):

def generate(self):
tc = CMakeToolchain(self)
if is_msvc(self):
tc.variables["USE_MSVC_RUNTIME_LIBRARY_DLL"] = False
tc.variables["BUILD_SHARED_LIBS"] = self.options.shared
tc.variables["VSG_SUPPORTS_ShaderCompiler"] = 0
tc.variables["VSG_MAX_DEVICES"] = self.options.max_devices

tc.cache_variables["BUILD_SHARED_LIBS"] = self.options.shared
tc.cache_variables["VSG_MAX_DEVICES"] = self.options.max_devices

if Version(self.version) >= "1.0.5":
tc.cache_variables["VSG_SUPPORTS_Windowing"] = 1 if self.options.windowing else 0

if Version(self.version) >= "1.1.1":
tc.cache_variables["VSG_MAX_INSTRUMENTATION_LEVEL"] = self.options.max_instrumentation_level

# only after v1.1.5, it provides healthy handling for find_package glslang
if Version(self.version) >= "1.1.5":
tc.cache_variables["VSG_SUPPORTS_ShaderCompiler"] = 1 if self.options.with_glslang else 0
# Override GLSLANG_MIN_VERSION to ensure compatibility with the Conan-provided glslang.
#
# VSG sets GLSLANG_MIN_VERSION to "14" by default, based on glslang's internal versioning.
# However, the glslang package in Conan Center follows Vulkan SDK versioning instead.
#
# Only glslang >= 1.3.243.0 (Vulkan SDK version) in Conan exports the
# `glslang-default-resource-limits` CMake target required by VSG.
#
# Without this override, VSG's call to:
# find_package(glslang ${GLSLANG_MIN_VERSION} CONFIG)
# will fail, because no Conan-provided glslang package matches the default version "14".
#
# Note: GLSLANG_MIN_VERSION **must** be explicitly set. Leaving it at its default will
# cause `find_package` to fail. While patching the VSG CMakeLists is an option, overriding
# the variable here is the cleanest and most maintainable solution.
if self.options.with_glslang:
tc.cache_variables["GLSLANG_MIN_VERSION"] = "1.3.243.0"
else:
tc.cache_variables["VSG_SUPPORTS_ShaderCompiler"] = 0

tc.generate()

deps = CMakeDeps(self)

deps.generate()

def build(self):
Expand Down Expand Up @@ -109,10 +158,4 @@ def package_info(self):
self.cpp_info.set_property("cmake_target_name", "vsg::vsg")

if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.system_libs.append("pthread")

# TODO: to remove in conan v2 once cmake_find_package_* generators removed
self.cpp_info.filenames["cmake_find_package"] = "vsg"
self.cpp_info.filenames["cmake_find_package_multi"] = "vsg"
self.cpp_info.names["cmake_find_package"] = "VSG"
self.cpp_info.names["cmake_find_package_multi"] = "vsg"
self.cpp_info.system_libs.append("pthread")
2 changes: 2 additions & 0 deletions recipes/vsg/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
versions:
"1.1.10":
folder: all
"1.0.9":
folder: all
"1.0.5":
Expand Down