diff --git a/recipes/vsg/all/conandata.yml b/recipes/vsg/all/conandata.yml index 3b2abd6731e51..2f99bf81991c6 100644 --- a/recipes/vsg/all/conandata.yml +++ b/recipes/vsg/all/conandata.yml @@ -8,6 +8,11 @@ sources: "1.0.5": url: "https://github.com/vsg-dev/VulkanSceneGraph/archive/refs/tags/v1.0.5.tar.gz" sha256: "ff58260fcb88d19d92c40a70bc40ff06abb1a8805568eb76862a036d13ada75b" - "1.0.9": - url: "https://github.com/vsg-dev/VulkanSceneGraph/archive/v1.0.9.tar.gz" - sha256: "9a62be7facc13c391c33dc8356b147a3b86f531ea72a28f6b2c364777e761412" + "1.0.8": + url: "https://github.com/vsg-dev/VulkanSceneGraph/archive/refs/tags/v1.0.8.tar.gz" + sha256: "0017cbb1c06b6c62c3ca2a222f083aecbc4ef0b6fc9b9e173cb8d3f005d13e62" +patches: + "1.0.5": + - patch_file: "patches/0002-glslang-dependency.patch" + "1.0.8": + - patch_file: "patches/0001-glslang-dependency.patch" diff --git a/recipes/vsg/all/conanfile.py b/recipes/vsg/all/conanfile.py index 104e5dc3d7219..b459edf3270e3 100644 --- a/recipes/vsg/all/conanfile.py +++ b/recipes/vsg/all/conanfile.py @@ -1,7 +1,7 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.microsoft import check_min_vs, is_msvc_static_runtime, is_msvc -from conan.tools.files import get, copy, rm, rmdir, collect_libs +from conan.tools.files import apply_conandata_patches, get, copy, export_conandata_patches, rm, rmdir, collect_libs from conan.tools.build import check_min_cppstd from conan.tools.scm import Version from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake @@ -11,7 +11,11 @@ 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" @@ -20,11 +24,13 @@ class VsgConan(ConanFile): settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], + "shader_compiler": [True, False], "max_devices": [1,2,3,4], "fPIC": [True, False], } default_options = { "shared": False, + "shader_compiler": True, "max_devices" : 1, "fPIC": True, } @@ -40,9 +46,16 @@ def _compilers_minimum_version(self): "clang": "7", "apple-clang": "10", } + + def export_sources(self): + export_conandata_patches(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: @@ -50,6 +63,8 @@ def configure(self): def requirements(self): self.requires("vulkan-loader/1.3.239.0", transitive_headers=True) + if self.options.shader_compiler and self.version >= "1.0.5": + self.requires("glslang/12.3.1", transitive_headers=True) def validate(self): if self.info.settings.compiler.cppstd: @@ -74,7 +89,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() @@ -83,6 +98,7 @@ def generate(self): deps.generate() def build(self): + apply_conandata_patches(self) cmake = CMake(self) cmake.configure() cmake.build() @@ -96,7 +112,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")) @@ -110,9 +125,11 @@ def package_info(self): if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("pthread") - + self.cpp_info.set_property("cmake_build_modules", [os.path.join("lib", "cmake", "vsg", "vsgMacros.cmake")]) + # 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" + \ No newline at end of file diff --git a/recipes/vsg/all/patches/0001-glslang-dependency.patch b/recipes/vsg/all/patches/0001-glslang-dependency.patch new file mode 100644 index 0000000000000..2b97c61e83a07 --- /dev/null +++ b/recipes/vsg/all/patches/0001-glslang-dependency.patch @@ -0,0 +1,86 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d2b162c1..cf0024a5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -40,26 +40,7 @@ find_package(Threads REQUIRED) + # Enable/disable shader compilation support that pulls in glslang + set(VSG_SUPPORTS_ShaderCompiler 1 CACHE STRING "Optional shader compiler support, 0 for off, 1 for enabled." ) + 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() ++ find_package(glslang CONFIG REQUIRED) + endif() + + set(VSG_SUPPORTS_Windowing 1 CACHE STRING "Optional native windowing support providing a default implementation of vsg::Window::create(), 0 for off, 1 for enabled." ) +diff --git a/src/vsg/CMakeLists.txt b/src/vsg/CMakeLists.txt +index dbe8cf83..7bedfb74 100644 +--- a/src/vsg/CMakeLists.txt ++++ b/src/vsg/CMakeLists.txt +@@ -225,18 +225,17 @@ set(SOURCES + utils/LoadPagedLOD.cpp + ) + +-if (${VSG_SUPPORTS_ShaderCompiler}) +- +- # include glslang source code directly into the VulkanScenegraph library build. +- include(../glslang/build_vars.cmake) +-endif() +- + # set up library dependencies + set(LIBRARIES PUBLIC + Vulkan::Vulkan + Threads::Threads + ) +- ++if (${VSG_SUPPORTS_ShaderCompiler}) ++ set(LIBRARIES ${LIBRARIES} PRIVATE ++ glslang::SPIRV ++ glslang::glslang ++ ) ++endif() + # Check for std::atomic + if(NOT MSVC AND NOT ANDROID AND NOT APPLE) + include(CheckCXXSourceCompiles) +@@ -372,10 +371,7 @@ target_compile_definitions(vsg PRIVATE ${EXTRA_DEFINES}) + target_include_directories(vsg + PUBLIC + $ +- $ +- PRIVATE +- $ +- $ ++ $ + ) + + target_link_libraries(vsg ${LIBRARIES}) +diff --git a/src/vsg/utils/ShaderCompiler.cpp b/src/vsg/utils/ShaderCompiler.cpp +index 71a7f09f..803f26a1 100644 +--- a/src/vsg/utils/ShaderCompiler.cpp ++++ b/src/vsg/utils/ShaderCompiler.cpp +@@ -20,7 +20,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI + #include + + #if VSG_SUPPORTS_ShaderCompiler +-# include ++# include + # include + # include + #endif diff --git a/recipes/vsg/all/patches/0002-glslang-dependency.patch b/recipes/vsg/all/patches/0002-glslang-dependency.patch new file mode 100644 index 0000000000000..06524bc6832c3 --- /dev/null +++ b/recipes/vsg/all/patches/0002-glslang-dependency.patch @@ -0,0 +1,86 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 61da709f..046ddce8 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -40,26 +40,7 @@ find_package(Threads REQUIRED) + # Enable/disable shader compilation support that pulls in glslang + set(VSG_SUPPORTS_ShaderCompiler 1 CACHE STRING "Optional shader compiler support, 0 for off, 1 for enabled." ) + 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 repositiory") +- set(glslang_branch "VSG-1.0.x" CACHE STRING "branch/tag of the glslang git repositiory") +- +- 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() ++ find_package(glslang CONFIG REQUIRED) + endif() + + set(VSG_SUPPORTS_Windowing 1 CACHE STRING "Optional native windowing support providing a default implementation of vsg::Window::create(), 0 for off, 1 for enabled." ) +diff --git a/src/vsg/CMakeLists.txt b/src/vsg/CMakeLists.txt +index 4154312f..6c79f7b7 100644 +--- a/src/vsg/CMakeLists.txt ++++ b/src/vsg/CMakeLists.txt +@@ -226,18 +226,20 @@ set(SOURCES + utils/LoadPagedLOD.cpp + ) + +-if (${VSG_SUPPORTS_ShaderCompiler}) +- +- # include glslang source code directly into the VulkanScenegraph library build. +- include(../glslang/build_vars.cmake) +-endif() +- + # set up library dependencies + set(LIBRARIES PUBLIC + Vulkan::Vulkan + Threads::Threads + ) + ++ ++if (${VSG_SUPPORTS_ShaderCompiler}) ++ set(LIBRARIES ${LIBRARIES} PRIVATE ++ glslang::SPIRV ++ glslang::glslang ++ ) ++endif() ++ + # Check for std::atomic + if(NOT MSVC AND NOT ANDROID AND NOT APPLE) + check_cxx_source_compiles(" +@@ -364,9 +366,6 @@ target_include_directories(vsg + PUBLIC + $ + $ +- PRIVATE +- $ +- $ + ) + + target_link_libraries(vsg ${LIBRARIES}) +diff --git a/src/vsg/utils/ShaderCompiler.cpp b/src/vsg/utils/ShaderCompiler.cpp +index 71a7f09f..803f26a1 100644 +--- a/src/vsg/utils/ShaderCompiler.cpp ++++ b/src/vsg/utils/ShaderCompiler.cpp +@@ -20,7 +20,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI + #include + + #if VSG_SUPPORTS_ShaderCompiler +-# include ++# include + # include + # include + #endif diff --git a/recipes/vsg/config.yml b/recipes/vsg/config.yml index 9269a45607b90..17f7ede2ab10a 100644 --- a/recipes/vsg/config.yml +++ b/recipes/vsg/config.yml @@ -1,5 +1,5 @@ versions: - "1.0.9": + "1.0.8": folder: all "1.0.5": folder: all