[Development] qt6_add_shaders and static libraries
Ranen Ghosh
ranen.ghosh at navblue.aero
Tue Sep 12 12:39:17 CEST 2023
Hi,
How does one use qt6_add_shaders in static libraries? When running an
application that uses said static library, we get this error messages like
this
Failed to find shader "://shader.vert.qsb"
We're using static linking because the target platform is iOS. On Windows
where we use dynamic linking, we have no problem.
We follow this practice for qrc resources which works fine
"When embedding resources in static libraries,... explicitly register your
resources by calling Q_INIT_RESOURCE() with the base name of the .qrc file."
https://doc.qt.io/qt-6/resources.html#explicit-loading-and-unloading-of-embedded-resources
How does this relate to shaders added with qt6_add_shaders? From the
examples we have seen demonstrating qt6_add_resources, it does not seem to
involve qrc. For example,
https://github.com/qt/qtshadertools/blob/26ffa67b0212255e29ec751bc25ebef65973ee99/tests/auto/buildtimeqsb/CMakeLists.txt
qt6_add_shaders(tst_buildtimeqsb "shaders"
PREFIX
"/test"
FILES
"color.vert"
"color.frag"
)
https://github.com/qt/qtshadertools/blob/26ffa67b0212255e29ec751bc25ebef65973ee99/tests/auto/buildtimeqsb/tst_buildtimeqsb.cpp
QShader color_vert = getShader(QLatin1String(":/test/color.vert.qsb"));
(The URI does not have the qrc scheme)
Thanks,
Ranen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20230912/8a0cb513/attachment.htm>
More information about the Development
mailing list