Closed remoe closed 3 years ago
On Sun, 14 Feb 2021 at 14:27, Remo E notifications@github.com wrote:
When one install glslang 11.1.0 (cmake install) and add the install path as CMAKE_PREFIX_PATH then it cannot find the glslang-sdk. And I don't understand why this:
https://github.com/vsg-dev/VulkanSceneGraph/blob/master/CMakeLists.txt#L69
is included ? And why is "CONFIG" mode is "REQUIRED" here:
https://github.com/vsg-dev/VulkanSceneGraph/blob/master/CMakeLists.txt#L70
Why not simply use find_package(glslang) ?
The versioning of glslang itself is a bit screwed up with different versions having different schemes that aren't compatible, and the official glslang find script doesn't help unravel this problem. To address this problem we had to come up with our own find glslang cmake script that is able to determine the features of the glslang being linked more coherently. It's far from an ideal situation, but it's an attempt to be one step better than the mess that glslang gives us.
if (NOT DEFINED glslang_FOUND) is do enable the definition of this var use as by passing if -Dglslang_FOUND=NO on cmake command line.
What platform are you working on? What version of Vulkan or VulkanSDK are you using?
Robert, I use Windows 10 with VStudio 2019 and CMake 3.19.
VulkanSDK 1.2.162.1 glslang: 11.1.0
I found the VulkanSDK has "glslang "as well in the code. But FindVulkan.cmake from stock CMake (https://github.com/Kitware/CMake/blob/master/Modules/FindVulkan.cmake) doesn't add this.
I don't use VCPKG, because I need fully control about the dependencies on other projects. It is a bit strange that one need to install Vulkan SDK with an installer and use an environment variable to refer the SDK :) It would be better VulkanSDK would have a "CMake Install" :)
Hi Remo,
On Sun, 14 Feb 2021 at 15:26, Remo E notifications@github.com wrote:
VulkanSDK 1.2.162.1
glslang: 11.1.0
For point of reference, I use VulkanSDK 1.2.162.0 on my Xubuntu 18.04 system. and use the glsang 11.0.0 that comes with it.
You shouldn't need the separate glslang if you have a modern version of VulkanSDK like 1.2.162.x.
I found the VulkanSDK has "glslang "as well in the code. But FindVulkan.cmake from stock CMake doesn't add this.
g;sLang and Vulkan are independent projects that are used together for applications that need them both, so it's understandable that FindVulkan.cmake.
The VSG use of glsLang is optional, but useful enough that it's something that I integrate with the VSG so the application level experience should be pretty seamless. It is optional, if all your shaders are precompiled to SPIRV you can happily use the VSG/Vulkan without glsLang. It's my expectation that embedded software would go the route of compiling the VSG without glsLang and backing sure that all the shaders and scene graphs have SPIRV built in.
My assumption is that for desktop systems the convenience of being able to use GLSL shaders directly in the application outways the extra lib/application size associated with a dependency on glsLang.
I don't use VCPKG, because I need fully control about the dependencies on
other projects. It is a bit strange that one need to install Vulkan SDK with an installer and use an environment variable to refer the SDK :) It would be better VulkanSDK would have a "CMake Install" :)
Could you try setting the env var VULKAN_SDK pointed to the location that your VulkanSDK is installed and then do a clean build of the VSG to see if it correctly finds the glslang that comes with the VulkanSDK and then sets up the associated glsLang vars in the VSG cmake options.
Without CMake Params:
...
-- Found Vulkan: C:/VulkanSDK/1.2.162.1/Lib/vulkan-1.lib
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - not found
-- Found Threads: TRUE
CMake Error at CMakeLists.txt:70 (find_package):
Could not find a package configuration file provided by "vsg_glslang" with
any of the following names:
vsg_glslangConfig.cmake
vsg_glslang-config.cmake
Add the installation prefix of "vsg_glslang" to CMAKE_PREFIX_PATH or set
"vsg_glslang_DIR" to a directory containing one of the above files. If
"vsg_glslang" provides a separate development package or SDK, be sure it
has been installed.
It compiles/install with -Dglslang_FOUND=NO
But it doesn't find any glslang library.
Is that the cmake output when your run cmake for the VulkanSceneGraph? Or an secondary project like vsgExamples?
The vsg_glslangConfig.cmake itself can be found locally in the VulkanSceneGraph directory, it should be located at VulkanSceneGraph/src/vsg/
find_package(vsg_glslang REQUIRED CONFIG PATHS ${VSG_SOURCE_DIR}/src/vsg)
Perhaps VSG_SOURCE_DIR is being set differently on your system. Are you building in source, or out of source?
It is the output of "cmake for the VulkanSceneGraph". I build all libraries/projects always "out of source". On CMakeCache.txt i found:
VSG_SOURCE_DIR:STATIC=D:/sdk/_build/win_x86_64/vsg-14-02-21/VulkanSceneGraph.git
This is correct.
oh I set the following:
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH CACHE STRING "")
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH CACHE STRING "")
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY CACHE STRING "")
set(CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY TRUE CACHE BOOL "")
set(CMAKE_POLICY_DEFAULT_CMP0074 NEW CACHE STRING "")
set(CMAKE_FIND_USE_PACKAGE_ROOT_PATH FALSE CACHE BOOL "")
set(CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH FALSE CACHE BOOL "")
I need to check this first. It could be that it doesn't allow CONFIG mode.
What is the intention for setting all of the above?
Most of it: Cmake should not find any external system libraries or sdk's that are not in the defined root of all my used sdk's.
ok, I removed most of it. But I have defined:
CMAKE_FIND_ROOT_PATH CMAKE_INSTALL_PREFIX
Then it can find the glslang and it print:
-- Found Vulkan: C:/VulkanSDK/1.2.162.1/Lib/vulkan-1.lib
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - not found
-- Found Threads: TRUE
-- Found glslang: C:/VulkanSDK/1.2.162.1/Lib/glslang.lib
-- Performing Test GLSLANG_ResourceLimits_maxDualSourceDrawBuffersEXT
-- Performing Test GLSLANG_ResourceLimits_maxDualSourceDrawBuffersEXT - Success
But then I have the following error on install:
vsg.vcxproj -> D:\sdk\_build\win_x86_64\vsg-14-02-21\VulkanSceneGraph.git\_build\lib\vsg.lib
Building Custom Rule D:/sdk/_build/win_x86_64/vsg-14-02-21/VulkanSceneGraph.git/CMakeLists.txt
-- Install configuration: "Release"
CMake Error at src/vsg/cmake_install.cmake:36 (file):
file cannot create directory: C:/Program Files
(x86)/VSG/lib/cmake/vsg_glslang. Maybe need administrative privileges.
Call Stack (most recent call first):
cmake_install.cmake:37 (include)
I've build in the past with older CMake more then 70 OSS sdk/libraries without such issue :)
We certainly want to figure out how to get the VSG compiling without issues just like the rest of the SDK. I don't have a Windows system or expertise in Window dev so have to rely on members of the VSG community with those skills to refine the Windows support side.
Curious, so is the vsg/vsgConfig.cmake etc. files being installed without error? Perhaps this might been part of the issue. Looking at the VulkanSceneGraph/src/vsg/CMakeLists.txt the lines:
install(
FILES vsg_glslangConfig.cmake
DESTINATION lib/cmake/vsg_glslang
)
Come before the:
install(EXPORT vsgTargets FILE vsgTargets.cmake NAMESPACE vsg:: DESTINATION lib/cmake/vsg )
The install of vsg_glslangConfig.cmake also comes before the if (MSVC) block and other set up code. Perhaps there is some order dependency.
Could you try moving the
install( FILES vsg_glslangConfig.cmake DESTINATION lib/cmake/vsg_glslang )
Entry down to next the the vsgTargets.cmake one?
I found that "CMAKE_INSTALL_PREFIX:PATH=C:/Program Files (x86)/VSG" is wrong. Then it is normal when I have a permission issue. I need to first solve this. thanks.
It builds without errors when I remove the following from my default cmake settings:
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY CACHE STRING)
The permission error has nothing todo with it. But when I remove this setting then it find the glslang library. I don't understand it :)
When one install glslang 11.1.0 (https://github.com/KhronosGroup/glslang/releases/tag/11.1.0) and add the install path as CMAKE_PREFIX_PATH then it cannot find the glslang-sdk. And I don't understand why this:
https://github.com/vsg-dev/VulkanSceneGraph/blob/master/CMakeLists.txt#L69
is included ? And why is "CONFIG" mode is "REQUIRED" here:
https://github.com/vsg-dev/VulkanSceneGraph/blob/master/CMakeLists.txt#L70