glslang icon indicating copy to clipboard operation
glslang copied to clipboard

Add glslangConfig.cmake or glslang-config.cmake file to facilitate cmake package interaction

Open axsaucedo opened this issue 3 years ago • 9 comments

Currently when glslang is installed, any import using find_package(glslang REQUIRED) will fail given that there is no glslangConfig.cmake or glslang-config.cmake made available as part of the install.

This can be fixed by adding an extra file under the names above, with contents along the lines of:

# inside file glslangConfig.cmake

include("${CMAKE_CURRENT_LIST_DIR}/OSDependentTargets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/OGLCompilerTargets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/glslangTargets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/SPIRVTargets.cmake")

Edit: The VCPKG project seems to have a glslangConfig.cmake file that could be used as a base

axsaucedo avatar Mar 14 '21 10:03 axsaucedo

Thank you @aliPMPAINT but thats still a workaround to a Findglslang.cmake / glslanConfig.cmake file - it would still be ideal to just add the compatibility with find_package as it's a standard workflow for cmake projects

axsaucedo avatar Mar 15 '21 11:03 axsaucedo

I am currently not funded to make this improvement but if someone is knowledgeable and wants to see this happen sooner than later, I will accept a PR. Let me know if you start work and I will assign.

greg-lunarg avatar Mar 15 '21 21:03 greg-lunarg

@greg-lunarg great to hear this is relevant. Not sure what you mean tho, what do you mean by funded? Is there a pay-to-fix structure, or is there a Forum where feature requests are upvoted? Not really familiar with what's the process for KhronosGroup repos for new features like this one, is there a README/Forum where I can find out more about this process?

axsaucedo avatar Mar 16 '21 06:03 axsaucedo

This repo is open source controlled by KhronosGroup. All the development is "donated" by individuals or companies interested in seeing this software be useful.

As such, my consulting company is funded by a well-known ISV to maintain this repo. Right now my level of funding is just enough to triage new bugs, fix bugs I can't find anyone else to fix and review and merge bug fixes and new features presented by others.

If you wish to submit a PR, you only need to submit a Contributing License Agreement (CLA).

greg-lunarg avatar Mar 18 '21 20:03 greg-lunarg

Thank you for the detail @greg-lunarg , this is quite informative! Ok great, I didn't know this structure, but makes complete sense, and I can see how fixing bugs is something that would take precedence over adding features.

I also didn't know about the CLA, I would be interested to give this a go and add this contribution - what is the process I would go through in order to set up the CLA?

axsaucedo avatar Mar 19 '21 07:03 axsaucedo

I am not sure how to set up the CLA ahead-of-time, but when you attempt to create your first PR you will be guided through the CLA process.

Good luck and thanks in advance for your contributions!

greg-lunarg avatar Mar 19 '21 18:03 greg-lunarg

Has the been progress on creation of glslangConfig.cmake? I am currently revisiting how the VulkanSceneGraph project pulls in the optional glslang dependency, the lack of glslangConfig.cmake previously led me to hack a vsg_glslangConfig.cmake in absence of any official support and for backwards compatibility. I'd much rather rely on an official glslangConfig.cmake though.

The vsg_glslangConfig.cmake I created is:

vsg_glslangConfig.cmake

I'm not proposing this particular script for the glsLang project, @axsaucedo suggestion relying upon glslangTargets.cmake etc is better for when these are available.

If there is a PR that adds glslangConfig.cmake I'd be happy to help out with testing.

robertosfield avatar May 19 '21 13:05 robertosfield

The same issue applies to shaderc, but its vcpkg port doesn't have cmake config to make it available. This issue might be related https://github.com/microsoft/vcpkg/issues/16658

hiradyazdan avatar Jul 12 '21 08:07 hiradyazdan

Mingw64 CodeBlocks Windows 7 I added "find_package(glslang)" in to my general CMakeLists.txt But the The same problem.

CMake Warning at Z:/AI_SDK/CPP_GFPGAN/Real-ESRGAN-ncnn-vulkan/vulkan/glslang-master-tot/Build/install/lib/cmake/OSDependentTargets.cmake:2 (message):
  Using `OSDependentTargets.cmake` is deprecated: use `find_package(glslang)`
  to find glslang CMake targets.
Call Stack (most recent call first):
  CMakeLists.txt:115 (include)


CMake Warning at Z:/AI_SDK/CPP_GFPGAN/Real-ESRGAN-ncnn-vulkan/vulkan/glslang-master-tot/Build/install/lib/cmake/OGLCompilerTargets.cmake:2 (message):
  Using `OGLCompilerTargets.cmake` is deprecated: use `find_package(glslang)`
  to find glslang CMake targets.
Call Stack (most recent call first):
  CMakeLists.txt:116 (include)


CMake Warning at Z:/AI_SDK/CPP_GFPGAN/Real-ESRGAN-ncnn-vulkan/vulkan/glslang-master-tot/Build/install/lib/cmake/HLSLTargets.cmake:2 (message):
  Using `HLSLTargets.cmake` is deprecated: use `find_package(glslang)` to
  find glslang CMake targets.
Call Stack (most recent call first):
  CMakeLists.txt:119 (include)


CMake Warning at Z:/AI_SDK/CPP_GFPGAN/Real-ESRGAN-ncnn-vulkan/vulkan/glslang-master-tot/Build/install/lib/cmake/glslangTargets.cmake:2 (message):
  Using `glslangTargets.cmake` is deprecated: use `find_package(glslang)` to
  find glslang CMake targets.
Call Stack (most recent call first):
  CMakeLists.txt:121 (include)

CMake Warning at Z:/AI_SDK/CPP_GFPGAN/Real-ESRGAN-ncnn-vulkan/vulkan/glslang-master-tot/Build/install/lib/cmake/SPIRVTargets.cmake:2 (message):
  Using `SPIRVTargets.cmake` is deprecated: use `find_package(glslang)` to
  find glslang CMake targets.
Call Stack (most recent call first):
  CMakeLists.txt:122 (include)

magicse avatar Aug 27 '22 20:08 magicse

The vulkan validation layers currently uses glslangConfig.cmake right now:

https://github.com/KhronosGroup/Vulkan-ValidationLayers/blob/9534456051ec513b731f22f56860368cef445a92/tests/CMakeLists.txt#L222

What support is missing exactly?

juan-lunarg avatar Nov 28 '23 23:11 juan-lunarg

I think this issue can be closed as far as I can see. Although it would be good to add additional testing to ensure it doesn't accidentally break. But that's another PR.

@arcady-lunarg your thoughts?

juan-lunarg avatar Nov 28 '23 23:11 juan-lunarg

This was fixed by https://github.com/KhronosGroup/glslang/pull/2989, which should have been linked to this issue but was inadvertently not due to a typo.

arcady-lunarg avatar Nov 28 '23 23:11 arcady-lunarg

Thabk you for following up

axsaucedo avatar Nov 29 '23 05:11 axsaucedo