Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Debug/Release scope issue in .pro file
Forum Updated to NodeBB v4.3 + New Features

Debug/Release scope issue in .pro file

Scheduled Pinned Locked Moved General and Desktop
10 Posts 3 Posters 3.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mbnoimi
    wrote on last edited by
    #1

    Hello Trolls,

    I want to run some commands in release build so I used the "mentioned conditions in FAQ section":https://qt-project.org/faq/answer/how_to_deal_correctly_with_project_files_that_should_generate_a_debug_and_r but unfortunately system function calls in DEBUG and RELEASE mode

    How can I fix this issue?

    @QT += core
    QT -= gui
    TARGET = dump
    TEMPLATE = app
    CONFIG += console
    CONFIG -= app_bundle
    CONFIG += release
    CONFIG -= debug
    SOURCES += main.cpp

    win32:CONFIG(debug, debug|release) {
    error( "You can't build setup under DEBUG mode" )
    } else {
    !exists( ".\compiler\App\NSIS\makensis.exe" ) {
    error( "Unable to find NSIS compiler!" )
    } else {
    system(".\compiler\App\NSIS\makensis setup.nsi")
    }
    }

    OTHER_FILES +=
    setup.nsi@

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andreyc
      wrote on last edited by
      #2

      "qmake doc":http://qt-project.org/doc/qt-5/qmake-variable-reference.html#config says that "under Windows), the project will be processed three times"

      Try this condition:

      @
      build_pass:CONFIG(debug, debug|release) {
      win32: error("You can't build setup under DEBUG mode")
      }
      else:build_pass {
      win32 {
      !exists( "test" ) {
      error( "Unable to find NSIS compiler!" )
      } else {
      system("touch test")
      }
      }
      }
      @

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        Do you have this problem when building with Qt Creator ?
        I ask this because your are setting the build mode by hand in your pro file

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mbnoimi
          wrote on last edited by
          #4

          [quote author="andreyc" date="1394140726"]"qmake doc":http://qt-project.org/doc/qt-5/qmake-variable-reference.html#config says that "under Windows), the project will be processed three times"[/quote]

          I tried it but unfortunately it didn'r fix my issue. I trid this .pro

          @#-------------------------------------------------

          Project created by QtCreator 2014-03-06T15:05:12

          #-------------------------------------------------

          QT += core
          QT -= gui
          TARGET = dump
          TEMPLATE = app
          CONFIG += console
          CONFIG -= app_bundle
          CONFIG += release
          CONFIG -= debug
          SOURCES += main.cpp

          build_pass:CONFIG(debug, debug|release) {
          win32: error("You can't build setup under DEBUG mode")
          }
          else:build_pass {
          win32 {
          !exists( "main.cpp" ) {
          error( "Unable to find NSIS compiler!" )
          } else {
          system("dir")
          }
          }
          }@

          the log was:

          @15:08:47: Running steps for project QMakeScope...
          15:08:47: Starting: "C:\Qt\Qt5.2.1\5.2.1\mingw48_32\bin\qmake.exe" E:\QMakeScope\QMakeScope.pro -r -spec win32-g++ "CONFIG+=debug" "CONFIG+=declarative_debug" "CONFIG+=qml_debug"
          Volume in drive E is VBOX_Public
          Volume Serial Number is 0000-0018

          Directory of E:\QMakeScope

          03/06/2014 03:05 PM 17,982 QMakeScope.pro.user
          03/06/2014 03:05 PM 132 main.cpp
          03/06/2014 03:07 PM 631 QMakeScope.pro
          3 File(s) 18,745 bytes
          0 Dir(s) 161,306,329,088 bytes free
          Volume in drive E is VBOX_Public
          Volume Serial Number is 0000-0018

          Directory of E:\QMakeScope

          03/06/2014 03:05 PM 17,982 QMakeScope.pro.user
          03/06/2014 03:05 PM 132 main.cpp
          03/06/2014 03:07 PM 631 QMakeScope.pro
          3 File(s) 18,745 bytes
          0 Dir(s) 161,306,324,992 bytes free
          15:08:48: The process "C:\Qt\Qt5.2.1\5.2.1\mingw48_32\bin\qmake.exe" exited normally.
          15:08:48: Starting: "C:\Qt\Qt5.2.1\Tools\mingw48_32\bin\mingw32-make.exe"
          C:/Qt/Qt5.2.1/Tools/mingw48_32/bin/mingw32-make -f Makefile.Release
          mingw32-make[1]: Entering directory 'E:/build-QMakeScope-Desktop_Qt_5_2_1_MinGW_32bit-Debug'
          g++ -c -pipe -fno-keep-inline-dllexport -O2 -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_NO_DEBUG -DQT_CORE_LIB -I..\QMakeScope -I"C:\Qt\Qt5.2.1\5.2.1\mingw48_32\include" -I"C:\Qt\Qt5.2.1\5.2.1\mingw48_32\include\QtCore" -I"release" -I"." -I"C:\Qt\Qt5.2.1\5.2.1\mingw48_32\mkspecs\win32-g++" -o release\main.o ..\QMakeScope\main.cpp
          g++ -Wl,-s -Wl,-subsystem,console -mthreads -o release\dump.exe release/main.o -LC:\Qt\Qt5.2.1\5.2.1\mingw48_32\lib -lQt5Core
          mingw32-make[1]: Leaving directory 'E:/build-QMakeScope-Desktop_Qt_5_2_1_MinGW_32bit-Debug'
          15:08:49: The process "C:\Qt\Qt5.2.1\Tools\mingw48_32\bin\mingw32-make.exe" exited normally.
          15:08:49: Elapsed time: 00:02.@

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mbnoimi
            wrote on last edited by
            #5

            [quote author="SGaist" date="1394142048"]Hi,

            Do you have this problem when building with Qt Creator ?
            I ask this because your are setting the build mode by hand in your pro file[/quote]

            Yes indeed. I face this issue with Qt Creator 3.0.1 with Qt 5.2.1.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              What if you remove
              @
              CONFIG += release
              CONFIG -= debug
              @

              from your pro file ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • M Offline
                M Offline
                mbnoimi
                wrote on last edited by
                #7

                [quote author="SGaist" date="1394145136"]What if you remove
                @
                CONFIG += release
                CONFIG -= debug
                @

                from your pro file ?[/quote]

                It shows me:

                [code]:-1: error: You can't build setup under DEBUG mode[/code]

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  andreyc
                  wrote on last edited by
                  #8

                  If you have not resolved the issue I would suggest to create a simple test.pro file with CONFIG selection logic only.

                  @
                  build_pass:CONFIG(debug, debug|release) {
                  win32: error("You can't build setup under DEBUG mode")
                  }
                  else:build_pass {
                  win32 {
                  !exists( "main.cpp" ) {
                  error( "Unable to find NSIS compiler!" )
                  } else {
                  system("dir")
                  }
                  }
                  }
                  @

                  then try to run qmake on this file with different CONFIG options and adjust the conditions above to fit your requirements.
                  @
                  qmake test.pro CONFIG+=debug
                  qmake test.pro
                  qmake test.pro CONFIG+=release
                  @

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    mbnoimi
                    wrote on last edited by
                    #9

                    [quote author="andreyc" date="1394211334"]If you have not resolved the issue I would suggest to create a simple test.pro file with CONFIG selection logic only.

                    @
                    build_pass:CONFIG(debug, debug|release) {
                    win32: error("You can't build setup under DEBUG mode")
                    }
                    else:build_pass {
                    win32 {
                    !exists( "main.cpp" ) {
                    error( "Unable to find NSIS compiler!" )
                    } else {
                    system("dir")
                    }
                    }
                    }
                    @

                    then try to run qmake on this file with different CONFIG options and adjust the conditions above to fit your requirements.
                    @
                    qmake test.pro CONFIG+=debug
                    qmake test.pro
                    qmake test.pro CONFIG+=release
                    @[/quote]

                    I did that exactly but it didn't fix the issue :(

                    I wonder does any one face this issue before.

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      mbnoimi
                      wrote on last edited by
                      #10

                      Oops this is very strange!!!

                      When I called ot from cmd using qmake it worked fine... Does it a bug in Qt Creator?

                      the output of above .pro:
                      @e:\QMakeScope>qmake QMakeScope.pro CONFIG+=debug
                      Project ERROR: You can't build setup under DEBUG mode

                      e:\QMakeScope>qmake QMakeScope.pro CONFIG+=release
                      Volume in drive E is VBOX_Public
                      Volume Serial Number is 0000-0018

                      Directory of e:\QMakeScope

                      03/07/2014 11:13 AM <DIR> release
                      03/06/2014 03:09 PM 17,982 QMakeScope.pro.user
                      03/07/2014 11:13 AM 14,286 Makefile.Debug
                      03/07/2014 11:13 AM 14,331 Makefile.Release
                      03/07/2014 11:13 AM <DIR> debug
                      03/07/2014 11:13 AM 17,567 Makefile
                      03/06/2014 03:05 PM 132 main.cpp
                      03/07/2014 11:14 AM 633 QMakeScope.pro
                      6 File(s) 73,123 bytes
                      2 Dir(s) 158,834,917,376 bytes free
                      Project ERROR: You can't build setup under DEBUG mode

                      e:\QMakeScope>@

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved