-
Notifications
You must be signed in to change notification settings - Fork 167
Allow diligent to link a static DirectXShaderCompiler #723
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
base: master
Are you sure you want to change the base?
Conversation
TheMostDiligent
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change makes sense, there are few minor questions + formatting.
| LLVMSupport | ||
| dxcompiler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these public dependencies?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See below for reasons - if you'd prefer to make the consumer link the libraries manually that's your call of course ;)
| ) | ||
| endif() | ||
| if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") | ||
| target_link_libraries(Diligent-ShaderTools PRIVATE dl) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that dl should not be needed when linking statically - can be in the else() branch
Graphics/ShaderTools/CMakeLists.txt
Outdated
| cmake_policy(SET CMP0079 NEW) | ||
| target_link_libraries(SPIRV-Tools-opt | ||
| PUBLIC | ||
| LLVMSupport |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it public dependency?
Also, why is this dependency needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I made it public so that anything consuming this library will inherit the dependency. When static linking on some systems the builid will fail if the host executable is not itself linked against the dependencies.
Needed due to
/usr/bin/x86_64-pc-linux-gnu-ld.bfd: lib/DirectXShaderCompiler/lib/libSPIRV-Tools-opt.a(replace_desc_array_access_using_var_index.cpp.o): in function `spvtools::opt::ReplaceDescArrayAccessUsingVarIndex::ReplaceAccessChain(spvtools::opt::Instruction*, spvtools::opt::Instruction*) const':
./DirectXShaderCompiler/external/SPIRV-Tools/source/opt/replace_desc_array_access_using_var_index.cpp:83:(.text+0x385): undefined reference to `llvm_assert'
/usr/bin/x86_64-pc-linux-gnu-ld.bfd: lib/DirectXShaderCompiler/lib/libSPIRV-Tools-opt.a(replace_desc_array_access_using_var_index.cpp.o): in function `spvtools::opt::ReplaceDescArrayAccessUsingVarIndex::HasImageOrImagePtrType(spvtools::opt::Instruction const*) const':
./DirectXShaderCompiler/external/SPIRV-Tools/source/opt/replace_desc_array_access_using_var_index.cpp:157:(.text+0xf0c): undefined reference to `llvm_assert'
/usr/bin/x86_64-pc-linux-gnu-ld.bfd: lib/DirectXShaderCompiler/lib/libSPIRV-Tools-opt.a(replace_desc_array_access_using_var_index.cpp.o): in function `spvtools::opt::(anonymous namespace)::GetValueWithKeyExistenceCheck(unsigned int, std::unordered_map<unsigned int, unsigned int, std::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<std::pair<unsigned int const, unsigned int> > > const&)':
./DirectXShaderCompiler/external/SPIRV-Tools/source/opt/replace_desc_array_access_using_var_index.cpp:34:(.text+0x1c26): undefined reference to `llvm_assert'
/usr/bin/x86_64-pc-linux-gnu-ld.bfd: lib/DirectXShaderCompiler/lib/libSPIRV-Tools-opt.a(replace_desc_array_access_using_var_index.cpp.o): in function `spvtools::opt::ReplaceDescArrayAccessUsingVarIndex::CreatePhiInstruction(spvtools::opt::BasicBlock*, std::vector<unsigned int, std::allocator<unsigned int> > const&, std::vector<unsigned int, std::allocator<unsigned int> > const&, unsigned int) const':
./DirectXShaderCompiler/external/SPIRV-Tools/source/opt/replace_desc_array_access_using_var_index.cpp:424:(.text+0x1f6b): undefined reference to `llvm_assert'
/usr/bin/x86_64-pc-linux-gnu-ld.bfd: lib/DirectXShaderCompiler/lib/libSPIRV-Tools-opt.a(replace_desc_array_access_using_var_index.cpp.o): in function `spvtools::opt::ReplaceDescArrayAccessUsingVarIndex::GetConstNull(unsigned int) const':
./DirectXShaderCompiler/external/SPIRV-Tools/source/opt/replace_desc_array_access_using_var_index.cpp:400:(.text+0x2209): undefined reference to `llvm_assert'
/usr/bin/x86_64-pc-linux-gnu-ld.bfd: lib/DirectXShaderCompiler/lib/libSPIRV-Tools-opt.a(replace_desc_array_access_using_var_index.cpp.o):./DirectXShaderCompiler/external/SPIRV-Tools/source/opt/ir_builder.h:294: more undefined references to `llvm_assert' follow
Add a flag (off by default) to allow diligent to use a statically-linked DirectXShaderCompiler