Building qt project from command line



  • Hello,
    I am trying to set up hudson for my qt project for automatic builds.
    I am normally building my project in qt creator with qmake and msvc compiler.
    What would be the equivalent in batch command line?
    I have tried this :
    @qmake myproject.pro
    qmake
    make@

    but I have no idea where to find the make.exe and I am not even sure if this is enough.
    I make.exe part of msvc?
    What do you think?


  • Moderators

    make is part of compiler package. In case of MSVC it is called "nmake" and in case of MinGW it's "mingw32-make".

    To have it available make sure you're compiling from the VS command prompt. Either find a shortcut created for you by the VS installer or run <VS Directory>/VC/vcvarsall.bat with a platform parameter (x86 or amd64).
    When you do that add Qt bin directory to the PATH environment variable.



  • Thank you very much Chris!
    Why do I need to compile from the VS command prompt?
    If I just give the nmake path, it won't work?


  • Moderators

    No, this .bat file also sets up various environment variables for you eg. PATH, INCLUDE and LIB. Without those the compiler won't be able to find standard includes and libraries to link to.
    Of course you can peek inside that .bat to see what needs to be done and set these all by yourself but it's a lot of typing so what's the point?



  • I see so basically, it should look like this :
    add the qt dir path to %PATH%. Then :
    @qmake myproject.pro
    qmake
    pathtobatfile/vcvarsall.bat (with x86 param)
    @
    ? Or do I still need to do something with nmake?


  • Moderators

    You shoud run the bat first. It sets up paths for the compiler and nmake. qmake might need them too.



  • Ok :)
    @
    pathtobatfile/vcvarsall.bat (with x86 param)
    qmake myproject.pro
    qmake
    nmake
    @

    Is that correct?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.