Problems with .pro file some help?



  • Hello,
    so here is the problem:
    i have an application in which i am creating a dll with .cpp and .h files and a dllmain.cpp file i have a .pro file and
    a .pri file. in the pri file i include the mentioned above two .cpp and .h files. also i am workin with QT 5.4 and qt Creator.
    In the dll iam using a third party library that needs to be included in the dll so it can work. the question is how to do it in the pro file also i need to somehow determen wheter or not to use the 64 bit or 32 bit version of the dll so i need some kind of macros in the pro file to check it in run time or compile time if its 32 or 64 bit. so this is the second problem. I would appreciate if you give me an examples how to do it and dont give me links to the documantation i have searched a lot.
    thanks in advance.


  • Qt Champions 2016

    hi and welcome
    You mean something like ?

    CONFIG += 32bit

    CONFIG(32bit) {
    TARGET = 32bit_binary
    LIBS += -L<path to 32bit libraries>
    }
    CONFIG(64bit) {
    TARGET = 64bit_binary
    LIBS += -L<path to 64bit libraries>
    }



  • I think the correct way is

    contains(QMAKE_TARGET.arch, x86_64){
       # it's 64 bit
    }
    else{
       # it's 32 bit
    }
    

    This goes in the .pro file



  • @VRonin said in Problems with .pro file some help?:

    I think the correct way is ... QMAKE_TARGET ...

    The qmake manual show's something very similar, but using QMAKE_HOST instead:

    win32-g++:contains(QMAKE_HOST.arch, x86_64):{
        message("Host is 64bit")
        ...
    }
    

    In this case, @stamp would probably want to drop the win32-g++ condition (if he's using msvc).

    Cheers.



  • Thanks a lot for the response ill try them and fill you in how i did it and how it worked.



  • @Paul-Colby said in Problems with .pro file some help?:

    The qmake manual show's something very similar, but using QMAKE_HOST instead:

    win32-g++:contains(QMAKE_HOST.arch, x86_64):{
        message("Host is 64bit")
        ...
    }
    

    That won't work if you are cross compiling, see https://bugreports.qt.io/browse/QTBUG-9160 I still think QMAKE_TARGET is better


Log in to reply
 

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