Results 1 to 10 of 10

Thread: qMake Question

  1. #1
    Join Date
    Dec 2007
    Location
    London
    Posts
    206
    Thanks
    40
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default qMake Question

    Hi,

    I am writing two different Qt creator plugin applications. Some of their dependencies(plugins) are common. So i am trying to switch the included plugins.

    For first application I renamed qtcreator.pro to app1.pro and th second application to app2.pro.

    In the first .pro file Ive added " CONFIG += BUILD_FOR_APP1 " , and for the second .pro file I ve added " CONFIG += BUILD_FOR_APP2 " on top of the pro file.

    To check the configuration setting; in qtcreator.pri I wrote:

    Qt Code:
    1. for(p, CONFIG) {
    2. message($${p})
    3. }
    To copy to clipboard, switch view to plain text mode 

    In debug output I can see that my BUILD_FOR_APPX configuration is active, no poblem. And also

    Qt Code:
    1. BUILD_FOR_APPX{
    2. message(APPX Plugin activated)
    3. }
    To copy to clipboard, switch view to plain text mode 

    prints correctly to output pane.

    But when i run the same qmake script in plugins.pro, i see that no such configuration exists; although plugins.pro includes qtcreator.pri . So i cannot select the right plugins according to the configuration.

    What is the problem here. How can I make "BUILD_FOR_APPX configuration" global to all project including sub projects?

    Thanks in advance,
    Yigit

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

    Default Re: qMake Question

    Quote Originally Posted by yagabey View Post
    But when i run the same qmake script in plugins.pro, i see that no such configuration exists; although plugins.pro includes qtcreator.pri
    Does it include one of the .pro files which set the variables?

    Cheers,
    _

  3. #3
    Join Date
    Dec 2007
    Location
    London
    Posts
    206
    Thanks
    40
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: qMake Question

    The variables are set in app1.pro or app2.pro. "plugins.pro" does not include these pro files but it includes "qtcreator.pri"
    . Actually I am a bit confused about the qMake structure. The above script :

    Qt Code:
    1. SCADA_EDITOR = 0
    2.  
    3. BUILD_FOR_SCADAEDITOR {
    4. SCADA_EDITOR=1
    5. message(ScadaEditor Plugin activated)
    6. }
    7.  
    8. isEqual(SCADA_EDITOR,0) {
    9. DEFINES += HELLO_WORLD_TEST
    10. }else {
    11. DEFINES += HELLO_MOON_TEST
    12. }
    13.  
    14. for(p, DEFINES) {
    15. message($${p})
    16. }
    To copy to clipboard, switch view to plain text mode 

    print s that:

    Project MESSAGE: ScadaEditor Plugin activated
    and

    Project MESSAGE: HELLO_WORLD_TEST
    Project MESSAGE: UNICODE
    Project MESSAGE: IDE_LIBRARY_BASENAME=\"lib\"
    Project MESSAGE: QT_CREATOR
    Project MESSAGE: QT_NO_CAST_TO_ASCII
    Project MESSAGE: QT_NO_CAST_FROM_ASCII
    How can both "SCADA_EDITOR=1" and "SCADA_EDITOR=0" be valid. Whats that?

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

    Default Re: qMake Question

    Quote Originally Posted by yagabey View Post
    The variables are set in app1.pro or app2.pro. "plugins.pro" does not include these pro files but it includes "qtcreator.pri"
    From what you've written earlier the variable is either set in app1.pro or app2.pro, not in qtcreator.pri
    If plugin.pro does not include either, how would it get the value?

    Lets look at the the same situation in C++
    Qt Code:
    1. // app1.h
    2. #define SOMEDEFINE 1
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. // app2.h
    2. #define SOMEDEFINE 0
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. // common.h
    2. #ifdef SOMEDEFINE
    3. #else
    4. #endif
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. // plugin.h
    2. #include "common.h"
    To copy to clipboard, switch view to plain text mode 

    plugin.h does neither include app1.h nor app2.h, so it has not way of seeing the define, right?

    Quote Originally Posted by yagabey View Post
    isEqual(SCADA_EDITOR,0) {
    DEFINES += HELLO_WORLD_TEST
    }else {
    DEFINES += HELLO_MOON_TEST
    }
    Hmm, maybe isEqual($$SCADA_EDITOR,0)

    Cheers,
    _

  5. #5
    Join Date
    Dec 2007
    Location
    London
    Posts
    206
    Thanks
    40
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: qMake Question

    Ok , I agree with you about including headers issue. But is that also valid for qmake scripts? qtcreator.pri also does not include app1.pro or app2.pro. But these pro files include qtcreator.pri. qtcreator.pri can reach CONFIG definitions of app1.pro or app2.pro in this case. How can this be possible?

    I will try "isEqual($$SCADA_EDITOR,0)" when i go back to home.
    Last edited by yagabey; 7th July 2014 at 12:24.

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

    Default Re: qMake Question

    Quote Originally Posted by yagabey View Post
    Ok , I agree with you about including headers issue. But is that also valid for qmake scripts?
    There is no indication that qmake has a different meaning of the concept of includes.

    Quote Originally Posted by yagabey View Post
    But these pro files include qtcreator.pri. qtcreator.pri can reach CONFIG definitions of app1.pro or app2.pro in this case. How can this be possible?
    The code of qtcreator.pri is included into the file that includes it. In other words it becomes part of that file.
    Just like when including a header, no?

    Cheers,
    _

  7. #7
    Join Date
    Dec 2007
    Location
    London
    Posts
    206
    Thanks
    40
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: qMake Question

    When i include "yourfile.h" into "myfile.cpp" I expect to reach "yourfile.h" 's definitions and methods from "myfile.cpp" ; but "yourfile.h" cant reach "myfile.cpp" ; isnt that the situation here? Or i am misunderstanding something...

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

    Default Re: qMake Question

    Quote Originally Posted by yagabey View Post
    When i include "yourfile.h" into "myfile.cpp" I expect to reach "yourfile.h" 's definitions and methods from "myfile.cpp" ; but "yourfile.h" cant reach "myfile.cpp" ; isnt that the situation here? Or i am misunderstanding something...
    Yes.
    Have a look at the example in comment #4 again: http://www.qtcentre.org/threads/5969...861#post264861
    The include instruction is replaced by the contents of the file.

    Cheers,
    _

  9. #9
    Join Date
    Dec 2007
    Location
    London
    Posts
    206
    Thanks
    40
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: qMake Question

    Ok Dear anda, i know it is replaced. But it looks a bit different in our case. Anyway let me not extend the thread further... Let me simplify my question then:

    That is our qtcreator source tree :
    https://qt.gitorious.org/qt-creator/...7a7634eb47f1f:

    that is the plugins.pro:
    https://qt.gitorious.org/qt-creator/...ns/plugins.pro

    And qtcreator.pro:
    https://qt.gitorious.org/qt-creator/...:qtcreator.pro

    Now i want to enable or disable some of the plugins in source tree by adding some configs or definitions to "qtcreator.pro".

    How can i do that?

  10. #10
    Join Date
    Dec 2007
    Location
    London
    Posts
    206
    Thanks
    40
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: qMake Question

    Anyway.. I solved the issue by creating two unique projects and pulling the common parts by "svn externals" from svn repo. Everything seems ok for now. Thanks...

Similar Threads

  1. Qmake question, support for conditional compilation?
    By HowardHarkness in forum Newbie
    Replies: 2
    Last Post: 25th May 2012, 21:52
  2. qmake question
    By aarpon in forum Qt Programming
    Replies: 2
    Last Post: 14th February 2009, 12:28
  3. qmake debug/release scope question
    By redoctober0 in forum Qt Programming
    Replies: 1
    Last Post: 30th September 2008, 20:41
  4. qmake and libraries question
    By bnilsson in forum Qt Programming
    Replies: 4
    Last Post: 28th June 2008, 18:30
  5. qmake question
    By lni in forum Qt Programming
    Replies: 4
    Last Post: 18th April 2007, 00:42

Tags for this Thread

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.