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

Add shader-compiler option and versions 1.0.6, 1.0.7 and 1.0.8 #18996

Closed
wants to merge 17 commits into from
Closed
9 changes: 9 additions & 0 deletions recipes/vsg/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,12 @@ sources:
"1.0.5":
url: "https://github.com/vsg-dev/VulkanSceneGraph/archive/refs/tags/v1.0.5.tar.gz"
sha256: "ff58260fcb88d19d92c40a70bc40ff06abb1a8805568eb76862a036d13ada75b"
"1.0.6":
psyinf marked this conversation as resolved.
Show resolved Hide resolved
url: "https://github.com/vsg-dev/VulkanSceneGraph/archive/refs/tags/v1.0.6.tar.gz"
sha256: "01c33a3699f7027590d4c7f5d44a6a472a7048d8ed0387d67e2a4a06b518b90f"
"1.0.7":
url: "https://github.com/vsg-dev/VulkanSceneGraph/archive/refs/tags/v1.0.7.tar.gz"
sha256: "c6a92495c5c267550927a0a980bb56fe6d3b584aa21a76f72461b1c003d4de08"
"1.0.8":
url: "https://github.com/vsg-dev/VulkanSceneGraph/archive/refs/tags/v1.0.8.tar.gz"
sha256: "0017cbb1c06b6c62c3ca2a222f083aecbc4ef0b6fc9b9e173cb8d3f005d13e62"
15 changes: 11 additions & 4 deletions recipes/vsg/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,26 @@

class VsgConan(ConanFile):
name = "vsg"
description = "VulkanSceneGraph"
description = "VulkanSceneGraph (VSG), is a modern, cross platform, \
high performance scene graph library \
built upon Vulkan graphics/compute API. \
The software is written in C++17, \
and follows the CppCoreGuidelines and FOSS Best Practices."
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")
psyinf marked this conversation as resolved.
Show resolved Hide resolved
package_type = "library"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"shader_compiler": [True, False],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, remove the option shader_compiler. It will execute an extra step that will run git clone to another project:

if (VSG_SUPPORTS_ShaderCompiler)
    if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src/glslang/build_vars.cmake)

        if (Git_FOUND)

            set(glslang_URL "https://github.com/vsg-dev/glslang.git" CACHE STRING "URL of the glslang git repository")
            set(glslang_branch "VSG-1.0.x" CACHE STRING "branch/tag of the glslang git repository")

            execute_process(COMMAND ${GIT_EXECUTABLE} clone --depth 1 --branch ${glslang_branch} ${glslang_URL}
                            WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src
                            RESULT_VARIABLE GIT_SUBMOD_RESULT)

            if(NOT GIT_SUBMOD_RESULT EQUAL "0")
                message(WARNING "git clone of glslang failed. ShaderCompile support disabled.")
                set(VSG_SUPPORTS_ShaderCompiler 0)
            endif()
        else()
                message(WARNING "git clone of glslang failed. ShaderCompile support disabled.")
                set(VSG_SUPPORTS_ShaderCompiler 0)
        endif()
    endif()
endif()

In case needing an external dependency, it should be converted to a Conan package first, so we can manage it in the dependency, otherwise, we will have no control over any version, settings or options change.

For this very specific case, glslang is already available in Conan Center, so you could use it, but it would require a patch to use it as external dependency. Thinking about maintenance, it would be even better adding a feature directly to VSG project, giving the option to declared glslang as configurable, as a separated project, like USE_GLSLANG_SYSTEM.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without the shader_compiler the VSG is not usable to its full extent. The original author integrates glslang here by adding directly into the source graph of VSG and uses headers that are not exposed by the glslang conan-package. I've tried really hard to integrate a custom glslang-package, but this required massive changes in the source-structure which are not maintainable on the long-run. As glslang-sources are inlined with VSG and the author likes to control which exact versions to be bundled with VSG I don't really get the argument about control over version.

I also tried to convince the author not to use git-submodules or direct checkouts but he arguments that he wants to have VSG as self-contained as possible. I can start another attempt to create a custom vsg-glslang package, but honestly I don't think I will have the time in the long run to maintain changes here by creating patches. Still, I'll try.

Sorry for inconveniences, but I thought checking it out into the own source-graph should be ok, as it is not visible from the outside, thus not interfering downstream with other packages.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I revisited the issue and found the culprit being a wrong assumption about the glslang version used. I was able to tackle the issue by adding a new version to glslang. So basically this PR has to wait for the glslang-PR completed. (link TBD)

"max_devices": [1,2,3,4],
"fPIC": [True, False],
}
default_options = {
"shared": False,
"shader_compiler": True,
"max_devices" : 1,
"fPIC": True,
}
Expand All @@ -43,6 +49,8 @@ def _compilers_minimum_version(self):
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
if self.version < "1.0.5":
self.options.shader_compiler = False

def configure(self):
if self.options.shared:
Expand Down Expand Up @@ -74,7 +82,7 @@ def generate(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_SUPPORTS_ShaderCompiler"] = 1 if self.options.shader_compiler else 0
tc.variables["VSG_MAX_DEVICES"] = self.options.max_devices
tc.generate()

Expand All @@ -96,7 +104,6 @@ def package(self):
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
rmdir(self, os.path.join(self.package_folder, "share"))

rm(self, "*.la", os.path.join(self.package_folder, "lib"))
rm(self, "*.pdb", os.path.join(self.package_folder, "lib"))
rm(self, "*.pdb", os.path.join(self.package_folder, "bin"))
rm(self, "Find*.cmake", os.path.join(self.package_folder, "lib/cmake/vsg"))
Expand Down
6 changes: 6 additions & 0 deletions recipes/vsg/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
versions:
"1.0.8":
folder: all
"1.0.7":
folder: all
"1.0.6":
folder: all
"1.0.5":
folder: all
"1.0.3":
Expand Down