build system: add dependencies for Qt resource files

This commit is contained in:
Moritz Bunkus 2019-11-08 11:12:53 +01:00
parent f066e7ab9c
commit e9d65b182b
No known key found for this signature in database
GPG Key ID: 74AF00ADF2E32C85
2 changed files with 15 additions and 0 deletions

View File

@ -1163,6 +1163,8 @@ if $build_mkvtoolnix_gui
qrc = [ "src/mkvtoolnix-gui/qt_resources.qrc" ]
qrc << "lib/QDarkStyleSheet/qdarkstyle/style.qrc" if $building_for[:windows]
add_qrc_dependencies(*qrc)
file "src/mkvtoolnix-gui/qt_resources.cpp" => qrc, &qrc_compiler
Application.new("src/mkvtoolnix-gui/mkvtoolnix-gui").

View File

@ -287,6 +287,19 @@ def update_version_number_include
end
end
def add_qrc_dependencies *qrcs
qrc_content = read_files(*qrcs)
qrc_content.each do |file_name, content|
dir = file_name.gsub(%r{[^/]+$}, '')
dependencies = content.
join('').
scan(%r{<file[^>]*>([^<]+)}).
map { |matches| dir + matches[0] }
file file_name => dependencies
end
end
class Rake::Task
def mo_all_prerequisites
todo = [name]