Fix unnecessary rebuilds because of shaders.

This commit is contained in:
John Preston
2026-05-25 23:54:40 +04:00
parent 9ed0b1e6ef
commit c6541e1e91
+12 -2
View File
@@ -62,8 +62,18 @@ foreach(_src ${_shader_sources})
endforeach()
list(SORT _qrc_entries)
list(JOIN _qrc_entries "\n" _qrc_body)
file(WRITE "${_qsb_out_dir}/shaders.qrc"
"<RCC>\n <qresource prefix=\"/shaders\">\n${_qrc_body}\n </qresource>\n</RCC>\n")
# Write shaders.qrc at configure time (so AUTORCC can scan its INPUTS) but
# only touch the file when content actually changes — otherwise AUTORCC sees
# a fresh mtime on every cmake re-generate and re-runs rcc unnecessarily.
set(_qrc_path "${_qsb_out_dir}/shaders.qrc")
set(_qrc_new "<RCC>\n <qresource prefix=\"/shaders\">\n${_qrc_body}\n </qresource>\n</RCC>\n")
set(_qrc_old "")
if (EXISTS "${_qrc_path}")
file(READ "${_qrc_path}" _qrc_old)
endif()
if (NOT "${_qrc_new}" STREQUAL "${_qrc_old}")
file(WRITE "${_qrc_path}" "${_qrc_new}")
endif()
add_custom_target(compile_shaders DEPENDS ${_qsb_outputs})
nice_target_sources(Telegram ${_qsb_out_dir}
PRIVATE