Results 1 to 6 of 6

Thread: QMAKE_EXTRA_COMPILERS dependencies issue

  1. #1
    Join Date
    Dec 2014
    Posts
    5
    Qt products
    Qt5
    Platforms
    Windows

    Default QMAKE_EXTRA_COMPILERS dependencies issue

    All

    I have Qt project which contains **.ts-file** and **.qrc-file** containing reference to generated **.qm-file**. We do not store .qm-files in our version control system. The issue here is that when I check out source code and run "make", I'm getting error

    Qt Code:
    1. RCC: Error in 'CoreGeneral.qrc': Cannot find file 'core.general_en.qm'
    To copy to clipboard, switch view to plain text mode 

    I created updateqm.pri files to get .qm files generated before build, this file I include to my .pro files

    Qt Code:
    1. !contains(QMAKE_EXTRA_COMPILERS, updateqm) {
    2. updateqm.input = TRANSLATIONS
    3. updateqm.output = ${QMAKE_FILE_BASE}.qm
    4. updateqm.commands = $$[QT_INSTALL_BINS]/lrelease -idbased ${QMAKE_FILE_IN} -qm ${QMAKE_FILE_BASE}.qm
    5. updateqm.CONFIG += no_link target_predeps
    6. QMAKE_EXTRA_COMPILERS += updateqm
    7. PRE_TARGETDEPS += compiler_updateqm_make_all
    8. }
    To copy to clipboard, switch view to plain text mode 

    But again, I'm getting this error, though .qm files eventually get generated.
    Compile output looks like this

    Qt Code:
    1. C:\Qt\Qt5.2.1\5.2.1\msvc2012\bin\lrelease -idbased core.general_en.ts -qm core.general_en.qm
    2. C:\Qt\Qt5.2.1\5.2.1\msvc2012\bin\uic.exe PSGHTMLDisplay.ui -o GeneratedFiles\ui_PSGHTMLDisplay.h
    3. C:\Qt\Qt5.2.1\5.2.1\msvc2012\bin\rcc.exe -name CoreGeneral CoreGeneral.qrc -o GeneratedFiles\qrc_CoreGeneral.cpp
    4. RCC: Error in 'CoreGeneral.qrc': Cannot find file 'core.general_en.qm'
    5.  
    6. Updating 'core.general_en.qm'...
    7. Generated 108 translation(s) (0 finished and 108 unfinished)
    To copy to clipboard, switch view to plain text mode 

    So, for me it looks like RCC starts processing .qrc file before lrelease finished generating .qm-files.

    Is there any approach to avoid this issue?

    **P.S.** I tried using QMAKE_EXTRA_TARGETS to create pre-build event that will be generating .qm-files before any other target will be started but it didn't work for me. I used approach described here "link":http://blog.mgsxx.com/?p=2180

    Briefly, the approach of creating pre-build event is like below

    Qt Code:
    1. # создаем файл-заглушку
    2. !exists($$OUT_PWD/.beforebuild) {
    3. system(@echo aaa > $$system_path($${OUT_PWD}/.beforebuild))
    4. }
    5.  
    6. QMAKE_EXTRA_TARGETS += before_build makefilehook
    7.  
    8. makefilehook.target = $(MAKEFILE)
    9. makefilehook.depends = .beforebuild
    10.  
    11. POST_TARGETDEPS += .beforebuild
    12.  
    13. before_build.target = .beforebuild
    14. before_build.depends = FORCE
    15. before_build.commands = @echo our command
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QMAKE_EXTRA_COMPILERS dependencies issue

    Hmm, how about this:

    1) rename the .pro file to something like program.pro
    2) create a translations.pro which contains the input for translation build
    2) create a new .pro file with the original .pro file name, use subdirs as the template and list the two others in SUBDIRS

    Qt Code:
    1. TEMPLATE = subdirs
    2. SUBDIRS = translations program
    3. program.depends = translations
    To copy to clipboard, switch view to plain text mode 

    Cheers,
    _

  3. #3
    Join Date
    Dec 2014
    Posts
    5
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QMAKE_EXTRA_COMPILERS dependencies issue

    that makes sense, but I wanted each project to handle its .ts-files by itself so that not to maintain separate list of translation files.

    Now, I'm experimenting with having separate target for running lrelease for all projects - that adds additional step to build process but meets my requirements for each project to maintain translation by itself

    I created extra target in my SUBDIRS file

    Qt Code:
    1. updateqm.target = updateqm
    2. updateqm.CONFIG = recursive
    3. updateqm.commands = @echo Finished updating translation files...
    4. QMAKE_EXTRA_TARGETS += updateqm
    To copy to clipboard, switch view to plain text mode 

    and created simple update_qm.pri file to include it to all .pro-files

    Qt Code:
    1. QMAKE_EXTRA_TARGETS += updateqm
    2. updateqm.target = updateqm
    3. !isEmpty(TRANSLATIONS){
    4. updateqm.commands = $$[QT_INSTALL_BINS]/lrelease -idbased $$TRANSLATIONS
    5. }
    6. isEmpty(TRANSLATIONS){
    7. updateqm.commands = @echo .ts translation files not found. Skip...
    8. }
    To copy to clipboard, switch view to plain text mode 

    now, I can build project in 2 steps

    Qt Code:
    1. make updateqm
    2. make debug
    To copy to clipboard, switch view to plain text mode 

    Drawback of this approach is that each .pro file must include update_qm.pri, otherwise build fails

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QMAKE_EXTRA_COMPILERS dependencies issue

    Quote Originally Posted by DPbIH View Post
    that makes sense, but I wanted each project to handle its .ts-files by itself so that not to maintain separate list of translation files.
    I don't understand how my suggestion changed anything about that.

    It is merely a way to specify an order of build steps.

    Cheers,
    _

  5. #5
    Join Date
    Dec 2014
    Posts
    5
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QMAKE_EXTRA_COMPILERS dependencies issue

    Quote Originally Posted by anda_skoa View Post
    I don't understand how my suggestion changed anything about that.

    It is merely a way to specify an order of build steps.

    Cheers,
    _
    Do I understand you correctly? - you propose to create separate project(kind of lrelease_runner.pro) which will be the very first project in projects chain and it will generate .qm files for all projects. For that I need to maintain a single list of .ts files from all projects - I would not like to do that because I do not want to update it each time I create new .ts file for some project, also some of projects are shared between different products and I would need to create this lrelease_runner project for each product along with list of translations.

    I would rather maintain the .ts files in TRANSLATIONS for each project individually and make project generate .qm files before starting the build.

    Please, correct me if I misunderstood your proposal.

    Thank you

  6. #6
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QMAKE_EXTRA_COMPILERS dependencies issue

    No, this is for a single project.

    It doesn't make sense to build all translations for all projects together unless all projects are always releases together.

    Cheers,
    _

Similar Threads

  1. around circular dependencies
    By tonnot in forum General Programming
    Replies: 6
    Last Post: 18th February 2011, 13:20
  2. Build without any dependencies
    By Dato0011 in forum Qt Tools
    Replies: 5
    Last Post: 22nd December 2009, 16:21
  3. library dependencies.....
    By surender99 in forum Qt Programming
    Replies: 1
    Last Post: 3rd April 2009, 20:06
  4. application dependencies
    By yagabey in forum Qt Programming
    Replies: 1
    Last Post: 18th March 2009, 08:33
  5. What are the dependencies that a .exe file needs??
    By srohit24 in forum Installation and Deployment
    Replies: 5
    Last Post: 5th March 2009, 18:25

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.