Results 1 to 9 of 9

Thread: qmake to build both 32-bit and 64-bit

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2006
    Posts
    426
    Thanks
    8
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: qmake to build both 32-bit and 64-bit

    I think I got it to work. You may need to treak for the QTDIR setting...

    Fortran support also included. Comments are welcome!


    For FORTRAN support (config.for)
    CONFIG += f90

    CONFIG(debug, debug|release) {
    F90_CFLAGS = -g -O0
    } else {
    F90_CFLAGS = -O2
    }

    intel {
    F90 = g77
    }

    isEmpty( F90 ) {
    F90 = g77
    }

    ff90.input = F90_SOURCES
    ff90.output = ${OBJECTS_DIR}${QMAKE_FILE_BASE}.o
    ff90.commands = $$F90 -c $$F90_CFLAGS $$QMAKE_LFLAGS ${QMAKE_FILE_NAME} \
    -o ${QMAKE_FILE_OUT} \
    ${INCPATH}
    QMAKE_EXTRA_UNIX_COMPILERS += ff90
    Support both 64-bit and 32-bit - config.h
    # turn on the compiler warning
    CONFIG += warn_on

    #global definition
    DEFINES = INT INTR3 QT3_SUPPORT

    # global include file paths
    MOC_DIR = .moc
    UI_DIR = .ui
    OBJECTS_DIR = .obj

    # just a message
    CONFIG(debug, debug|release) {
    message(Building in debug mode.)
    } else {
    message(Building in release mode. Ignoring debug if it is available.)
    }

    contains( TARGET_BIT, m64 ) {
    message(Building 64 bit )
    QTDIR = /apps/qt64-422
    BITS = 64
    QMAKE_CFLAGS = -m64
    QMAKE_CXXFLAGS = -m64
    QMAKE_LFLAGS = -m64
    }

    contains( TARGET_BIT, m32 ) {
    message(Building 32 bit )
    QTDIR = /apps/qt32-422
    BITS =
    QMAKE_CFLAGS = -m32
    QMAKE_CXXFLAGS = -m32
    QMAKE_LFLAGS = -m32
    }

    !isEmpty( TARGET_BIT ) {
    message( TARGET_BIT = $$TARGET_BIT )
    CONFIG -= qt
    CONFIG += moc
    INCLUDEPATH += \
    $$QTDIR/include/QtCore \
    $$QTDIR/include/QtGui \
    $$QTDIR/include/QtNetwork \
    $$QTDIR/include/Qt3Support \
    $$QTDIR/include

    LIBS += $$QTDIR/lib -lQtCore -lQtGui -lQtNetwork -lQt3Support
    } else {
    message( Build in default )
    INCLUDEPATH += ${QTDIR}/include/Qt3Support
    }

    # FORTRAN configuration file
    exists( $$PWD/config.for ) {
    include( $$PWD/config.for )
    } else {
    include( $(MAKE_ROOT)/bin/config.for )
    }

    LANGUAGE = C++ C
    Fortran example - fortran.f
    subroutine blah

    return
    end
    C example - cfile.c
    void foo()
    {
    }
    C++ example - c++file.cpp
    void bar()
    {
    }
    Examples.pro
    TEMPLATE = subdirs

    DIRLIST = build32 build64

    for( dir, DIRLIST ): exists( $$dir ): exists( $$dir/*.pro ): SUBDIRS += $$dir
    build32/build32.pro
    TARGET_BIT = m32
    include ( ../common.pri )
    build64/build64.pro
    TARGET_BIT = m64
    include ( ../common.pri )
    common.pri - path needs to be reset to fit your system
    ################################################## ####################
    # Automatically generated by qmake (2.01a) Thu Nov 16 15:23:45 2006
    ################################################## ####################

    TEMPLATE = app

    # Input
    SOURCES += c++file.cpp cfile.c main.cpp
    F90_SOURCES += fortran.f

    TARGET = Examples

    # if there is local config file, use it
    exists( ../bin/config.h ) {
    message(Use local config.h)
    include( ../bin/config.h )
    } else {
    message(Use baseline's config.h)
    include( $(MAKE_ROOT)/bin/config.h )
    }
    Last edited by lni; 12th December 2006 at 20:01.

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
  •  
Qt is a trademark of The Qt Company.