Debug_and_release does not work in Linux



  • I am using qmake in a 4.7.3 environment, to build a project consisting of several sub-projects.

    My project file is configured to be able to create both debug and release builds. In windows (using MinGW), that works fine - qmake creates both a .Release and .Debug-version of the makefile for each sub-projects.
    On Linux (Suse/KDE), only a single Makefile is created for each sub-project.

    My main project file is called tcl.pro:
    @
    CONFIG += ordered
    CONFIG += debug_and_release
    TEMPLATE = subdirs

    SUBDIRS =
    log
    cmn
    lib
    glib
    mls
    ps
    dps
    prk
    dlgs
    dpfs
    ls
    cs
    lgui
    cvui
    pel
    pic
    main

    cmn.file = tclcmn/frei/cmn.pro
    lib.file = tcllib/frei/lib.pro
    log.file = tcllog/frei/log.pro
    glib.file = tclglib/frei/glib.pro
    ps.file = tclps/frei/ps.pro
    mls.file = tclmls/frei/mls.pro
    dps.file = tcldps/frei/dpslib.pro
    prk.file = tcl/frei/tclprk.pro
    dlgs.file = tcldlgs/frei/dlgs.pro
    dpfs.file = tcldpfs/frei/dpfs.pro
    ls.file = tclls/frei/ls.pro
    cs.file = tclcs/frei/cs.pro
    pel.file = tclpel/frei/pel.pro
    cvui.file = tclcvui/frei/cvui.pro
    lgui.file = tcllgui/frei/lgui.pro
    pic.file = tclpic/frei/pic.pro
    main.file = tclmain/frei/main.pro@

    an example for a sub-project would be "cmn":

    cmn.pro:
    @QT += gui
    TARGET = cmn
    CONFIG += staticlib
    TEMPLATE = lib

    LIBS += -llog

    include(../../tclglobal.pri)
    include(cmn.pri)

    OTHER_FILES +=
    cmn.mak@

    cmn.pri:
    (only contains HEADERS and SOURCES, nothing more)

    tclglobal.pri:
    This is my main file to be able to distinguish different platforms, set different defines, etc. It's fairly complex, but - as far as I am aware - the question whether I am building "debug" or "release" is not manipulated there.
    @
    DEFINES += DEAR_DUMMY TCLIGHT SB_NO_LAN SAT250 _QT

    Set default

    TCLPLATFORM="win32gnu"

    win32-g++ {
    TCLPLATFORM="win32gnu"
    DEFINES += WIN32 _CONSOLE UNICODE _UNICODE _WIN32_WINNT=0x0600 MSC32 _WINDOWS _USRDLL __WINDLL _AFXDLL
    #DEFINES += NO_PKO
    LIBPREFIX = "lib"
    LIBEXTENSION = ".a"
    }
    win32-msvc {
    TCLPLATFORM="win32msvc"
    DEFINES += WIN32 _CONSOLE UNICODE _UNICODE _WIN32_WINNT=0x0600 MSC32 _WINDOWS _USRDLL __WINDLL _AFXDLL
    #DEFINES += NO_PKO
    LIBPREFIX = ""
    LIBEXTENSION = ".lib"
    }
    win32-msvc2010 {
    TCLPLATFORM="win32msvc2010"
    DEFINES += WIN32 _CONSOLE UNICODE _UNICODE _WIN32_WINNT=0x0600 MSC32 _WINDOWS _USRDLL __WINDLL _AFXDLL
    #DEFINES += NO_PKO
    LIBPREFIX = ""
    LIBEXTENSION = ".lib"
    }
    win64-msvc2010 {
    TCLPLATFORM="win32msvc2010"
    DEFINES += WIN32 _CONSOLE UNICODE _UNICODE _WIN32_WINNT=0x0600 MSC32 _WINDOWS _USRDLL __WINDLL _AFXDLL VSDOTNET
    QMAKESPEC=win32-msvc2010
    LIBPREFIX = ""
    LIBEXTENSION = ".lib"
    }
    unix {

    Also: Linux

    TCLPLATFORM="unix"
    DEFINES += SOLARIS
    LIBPREFIX = "lib"
    LIBEXTENSION = ".a"
    }

    ARCHENV=$$(ARCH)
    contains(ARCHENV, arm) {
    PROCESSOR="arm"
    QMAKE_CXX="arm-linux-g++"
    TCLPLATFORM="arm-linux"
    #DEFINES += NO_PKO
    } else {
    PROCESSOR="i386"
    }

    CONFIG(debug, debug|release) {
    TCLPLATFORM = $$join(TCLPLATFORM,,"","_debug")
    } else {
    TCLPLATFORM = $$join(TCLPLATFORM,,"","_release")
    }

    contains(TEMPLATE, lib) {
    TCLDESTEXTENSION=".sysgen"

    Dependency tracking aktivieren

    CONFIG += create_prl
    MODULETYPE = "library"
    } else {
    contains(TEMPLATE, app) {
    TCLDESTEXTENSION=".utils"
    # Library-dependencies lesen
    CONFIG += link_prl
    MODULETYPE = "application"
    } else {
    contains(TEMPLATE,vclib) {
    TCLDESTEXTENSION=".sysgen"
    CONFIG += create_prl
    MODULETYPE = "library"
    } else {
    contains(TEMPLATE, vcapp) {
    TCLDESTEXTENSION=".utils"
    CONFIG += link_prl
    MODULETYPE = "application"
    } else {
    TCLDESTEXTENSION=".unknown"
    }
    }
    }
    }

    INCLUDEPATH += "."
    INCLUDEPATH += "../../publics"
    DEPENDPATH += "../../publics"

    DESTDIR = $$join(TCLPLATFORM,,"../../",$$TCLDESTEXTENSION)
    OBJECTS_DIR = $$join(TCLPLATFORM,,"../../",".obj")
    MOC_DIR = $$join(TCLPLATFORM,,"../../",".moc")
    RCC_DIR = $$join(TCLPLATFORM,,"../../",".rcc")
    UI_HEADERS_DIR = $$join(TCLPLATFORM,,"../../",".ui")
    UI_SOURCES_DIR = $$join(TCLPLATFORM,,"../../",".ui")

    TCLLIBSDIR = $$join(TCLPLATFORM,,"../../",".sysgen")

    projectlibs = $$LIBS
    LIBS += -L$$TCLLIBSDIR

    win32 {
    LIBS += -L../../VAR/tclsysl
    }

    win64 {
    LIBS += -L../../VAR/tclsysl
    }
    @

    Any ideas why I get distinct Debug and Release makefiles on Windows, but not on Linux?



  • Not sure this helps, but I do get separate Makefile.Debug and Makefile.Release files on Linux (Ubuntu 11.10) too, for a much simpler subdirs project. I guess you could try to create a really simple subdirs project, and see if what happens (and then gradually extend it into what you have, to see what makes the separate files go away).



  • That's what I was afraid I would have to do ;-)


  • Moderators

    You're setting CONFIG+=debug_and_release in the subdirs project, not in each individual target project. Did you try to set CONFIG+=debug_and_release in e.g. cmn.pro ?



  • @kkoehne:

    If the CONFIG variable does not propagate from the main project to its subprojects, how can anything at all work? I could, e.g. provide the CONFIG variable as a command-line parameter of qmake. How would I handle that in subprojects?


  • Moderators

    If you're calling 'qmake -r "CONFIG+=release"' qmake will be executed for all .pro files with this CONFIG option. However, that's because it's a command line parameter.

    Think about it the other way round: If you're directly going to your directory cmn.pro and execute qmake there, would you expect that your project is compiled differently?

    A common pattern to share options between projects is using include() and .pri files. E.g. add a tcl_common.pri that contains just CONFIG+=debug_and_release , and include(../common.pri) in cmn.pro et al.



  • I'll try that.

    Thanks!


Log in to reply
 

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