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

Added SPIRV-Tools and SPIRV-Tools-opt libraries to the CMake build system #11

Closed
wants to merge 2 commits into from

Conversation

olegded
Copy link
Contributor

@olegded olegded commented Feb 9, 2019

@tomhog On Windows, using "VS 15 2017 Community Edition" I got several linker errors for all methods defined in SPIRV-Tools and SPIRV-Tools-opt libraries. Does it compile on your system without these two libraries? If yes, I'm wondering what I'm missing then. I have tried both glslang versions - one from github and one from LunarSDK repository (which needs to be compiled as well), same results in terms of linker errors.

By applying changes in this PR, it compiles fine on my side.

@olegded
Copy link
Contributor Author

olegded commented Feb 9, 2019

For easier diff https://github.com/vsg-dev/osg2vsg/pull/11/files?w=1
I have changed the indentation for some lines in CMakeModules/Findglslang.cmake to match all other lines in that file

@tomhog
Copy link
Contributor

tomhog commented Feb 9, 2019

Hi @olegded

I’ve not had any issues, i’ll make sure the cmake is fully regerated incase sonething has changed but was working for me when i wrote the instructions. Not able to test at the moment but i’ll do that and try your changes to.

Tom

@olegded
Copy link
Contributor Author

olegded commented Feb 9, 2019

@tomhog

Hi Tom,

I think I have figure it out :-) If somebody is using a SPIR-V-enabled version of the glslang library, e.g. in the case of using glslang library bundled with LunarG SDK or simply if needed, then there will be the above mentioned linker errors.

By simple checkout of the glslang repository, SPIR-V tools will be not included and therefore glslang will not link into the SPIR-V libraries. osg2vsg will compile fine in this case.

I guess there are following options:

  1. Close this PR but document that osg2vsg requires a not SPIR-V-enabled version of the glslang library. I'm not sure whether SPIR-V tools are really required for a given use case or not (unless somebody would like to wish to invoke -Os to reduce SPIR-V size from used GLSL shaders)
  2. Add one more variable to the CMake build system and let users decide which version of the glslang library they want to use (with or without SPIR-V tools). This option would require some changes to this PR
  3. Test that this PR is working as expected with SPIR-V tools on more than one system and use SPIR-V-enabled version of the glslang library

Oleg

@vsg-dev
Copy link
Owner

vsg-dev commented Feb 10, 2019

Ideally glslang would have CMake config support so we can automatically pick up the required dependencies. Potentially we could look at adding this ourselves, though we have plenty of work just working on the VSG. The alternative is to put a CMake option into the VSG to specify whether SIRV-Tools is required, or have a cmake test to do a trial build to figure out if it works without the lib.

@vsg-dev
Copy link
Owner

vsg-dev commented Feb 13, 2019

I have had a bash at refactoring the GLSlang set up CMake scripts to make it easier to add extra dependencies:

https://github.com/vsg-dev/osg2vsg/commit/f819545775d9883c6f9d822a32f59d4aaa1a56d2

I have only tested under Linux with my own build of GLSLang. @olegded If there are errors could you base your fixes off this new commit as I think it should be easier to ensure the different built combinations work with this approach. I'll close this PR as now effectively it's a dead branch.

@vsg-dev vsg-dev closed this Feb 13, 2019
@olegded
Copy link
Contributor Author

olegded commented Feb 13, 2019

@vsg-dev

Hi Robert,

Your changes worked for me in general. vsg, osg2vsg and vsgExamples compile and work in RELEASE and DEBUG modes. However, using CMake v 3.13.3 on Windows I got the error message that append(GLSLANG glslang::SPIRV-Tools) and append(GLSLANG glslang::SPIRV-Tools-opt) are unknown commands. I replaced it locally by

list(APPEND GLSLANG glslang::SPIRV-Tools)

and

list(APPEND GLSLANG glslang::SPIRV-Tools-opt)

It worked.

The second issue is this PR Added NOMINMAX macro definition

And one more PR for README update in this repository

Oleg

@robertosfield
Copy link
Collaborator

robertosfield commented Feb 14, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants