Skip to content

Conversation

@Lokomojo
Copy link

Add a flag (off by default) to allow diligent to use a statically-linked DirectXShaderCompiler

Copy link
Contributor

@TheMostDiligent TheMostDiligent left a 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.

Comment on lines +152 to +153
LLVMSupport
dxcompiler
Copy link
Contributor

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?

Copy link
Author

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)
Copy link
Contributor

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

cmake_policy(SET CMP0079 NEW)
target_link_libraries(SPIRV-Tools-opt
PUBLIC
LLVMSupport
Copy link
Contributor

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?

Copy link
Author

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

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.

2 participants