Hi
The title already says what my question is about: I want to add a custom compiler which produces output another target depends on.
This is my code:
!equals(ffmpegpath, "") {
WINDOWS_ICONS = resources/icons/hicolor/128x128/apps/$${projectname}.png
windowsicon.name = windowsicon
windowsicon.input = WINDOWS_ICONS
windowsicon.output = "$${OUT_PWD}/res/windowsicon_${QMAKE_FILE_BASE}.ico"
windowsicon.commands = $${ffmpegpath} -y -i ${QMAKE_FILE_IN} -vf crop=iw-20:ih-20:10:10,scale=64:64 "$${OUT_PWD}/res/windowsicon_${QMAKE_FILE_BASE}.ico"
windowsicon.CONFIG = no_link target_predeps
QMAKE_EXTRA_COMPILERS += windowsicon
PRE_TARGETDEPS += compiler_windowsicon_make_all # I added this line because the configuration "target_predeps" somehow doesn't work
RC_ICONS = $${OUT_PWD}/res/windowsicon_$${projectname}.ico
}
!equals(ffmpegpath, "") {
WINDOWS_ICONS = resources/icons/hicolor/128x128/apps/$${projectname}.png
windowsicon.name = windowsicon
windowsicon.input = WINDOWS_ICONS
windowsicon.output = "$${OUT_PWD}/res/windowsicon_${QMAKE_FILE_BASE}.ico"
windowsicon.commands = $${ffmpegpath} -y -i ${QMAKE_FILE_IN} -vf crop=iw-20:ih-20:10:10,scale=64:64 "$${OUT_PWD}/res/windowsicon_${QMAKE_FILE_BASE}.ico"
windowsicon.CONFIG = no_link target_predeps
QMAKE_EXTRA_COMPILERS += windowsicon
PRE_TARGETDEPS += compiler_windowsicon_make_all # I added this line because the configuration "target_predeps" somehow doesn't work
RC_ICONS = $${OUT_PWD}/res/windowsicon_$${projectname}.ico
}
To copy to clipboard, switch view to plain text mode
As you can see, this code generates the Windows icon with ffmpeg. This actually works.
The problem comes when trying to compile with the -j option for parallel execution of jobs.
The compilation fails here
Makefile.Release:135: recipe for target 'obj/passwordmanager_resource_res.o' failed
make[1]: *** [obj/passwordmanager_resource_res.o] Error 1
Makefile.Release:135: recipe for target 'obj/passwordmanager_resource_res.o' failed
make[1]: *** [obj/passwordmanager_resource_res.o] Error 1
To copy to clipboard, switch view to plain text mode
because
i686-w64-mingw32-windres: can't open icon file `/build/mingw-w64-passwordmanager/src/passwordmanager/build-i686-w64-mingw32/res/windowsic
co': No such file or directory
i686-w64-mingw32-windres: can't open icon file `/build/mingw-w64-passwordmanager/src/passwordmanager/build-i686-w64-mingw32/res/windowsic
co': No such file or directory
To copy to clipboard, switch view to plain text mode
Obviously the build order is important and make tries to do the target 'obj/passwordmanager_resource_res.o' before the target of the additional compiler is done (which seems to be called 'compiler_windowsicon_make_all').
How can I add 'compiler_windowsicon_make_all' as a dependency of 'obj/passwordmanager_resource_res.o' so make knows the right order?
I've already fiddled some time with qmake but had no success.
Thanks for your help.
Bookmarks