Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Solved qmake automatisch zu der Build Configuration setzen

    German
    3
    11
    1065
    Loading More Posts
    • 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.
    • G
      Galilio last edited by

      Hallo zusammen,

      wisst ihr vielleicht wie kann man einen Project in Qt Creator auf das Build Configurtion beim Build settings setzen?
      danke

      K 1 Reply Last reply Reply Quote 0
      • K
        koahnig @Galilio last edited by

        @Galilio

        Ist mir unklar was du meinst.

        Vote the answer(s) that helped you to solve your issue(s)

        1 Reply Last reply Reply Quote 0
        • G
          Galilio last edited by

          @koahnig
          Ich habe einen Projekt in dem es Leider die Wörte Release und Debug hardcodiert sind.
          Mein Ziel wäre die beiden Wörte auszutauschen und zwar nach der Einstellung (Wie im Build Setting) des Qt Projekts.

          Das heisst, wenn ich in Debug bin, muss es auch das hardcodiertes Wort automatisch geändert werden.
          Meine Frage: wie kann ich diese Einstellung wie im Buildsetting automatisch einlesen?

          Danke

          J.Hilk 1 Reply Last reply Reply Quote 0
          • J.Hilk
            J.Hilk Moderators @Galilio last edited by J.Hilk

            @Galilio
            das kommt drauf an an welcher stelle du diese Abfrage machen willst.

            Qt hat zum Beispiel macros woran du innerhalb deines Codes zwischen release und debug unterscheiden kannst.

            Beispiel:

            //unterscheide zwischen debug dll und release dll
                QString pluginPath;
            #ifdef QT_DEBUG
                pluginPath = QString("/plugins/%1/%1d.dll").arg(pluginName);
            #else
                pluginPath = QString("/plugins/%1/%1.dll").arg(pluginName);
            #endif
            

            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct

            Qt Needs YOUR vote: https://bugreports.qt.io/browse/QTQAINFRA-4121


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            G 1 Reply Last reply Reply Quote 2
            • G
              Galilio @J.Hilk last edited by

              @J.Hilk
              kann mann die Build Configuration ( die Einstellung in Build Settings) einlesen?
              bei mir geht e eigentlich nur um .pro File.
              Dort möchte ich vermeiden, dass die Konfiguration des projekt hardcodiert

              Danke

              K 1 Reply Last reply Reply Quote 0
              • K
                koahnig @Galilio last edited by

                @Galilio

                Für .pro respektive qmake kannst du sowas verwenden:

                CONFIG(debug, debug|release){
                win32:LIBS += -lLib1D -lLib2D
                }
                
                CONFIG(release, debug|release){
                win32:LIBS += -lLib1 -lLib2
                }
                

                Vote the answer(s) that helped you to solve your issue(s)

                G 1 Reply Last reply Reply Quote 2
                • G
                  Galilio @koahnig last edited by

                  Kann ich so schreiben?
                  CONFIG(release, debug|release){BUILD_KONFIG=Release}
                  CONFIG(debug, debug|release){BUILD_KONFIG=Debug}

                  Danke

                  K 1 Reply Last reply Reply Quote 0
                  • K
                    koahnig @Galilio last edited by

                    @Galilio

                    Ich denke schon, aber probier es doch einfach aus und schreibe:

                    CONFIG(release, debug|release){BUILD_KONFIG=Release}
                    CONFIG(debug, debug|release){BUILD_KONFIG=Debug}
                    message("Mein BUILD_KONFIG  ist " $$BUILD_KONFIG)
                    

                    Dann kannst du im "Compile Output" bei rerun qmake das Ergebnis überprüfen. Beim einfahcen Save des .pro kommen manchmal auch schon die Meldungen in "General Messages"

                    Vote the answer(s) that helped you to solve your issue(s)

                    G 1 Reply Last reply Reply Quote 1
                    • G
                      Galilio @koahnig last edited by

                      @koahnig

                      Guten Morgen zusammen
                      Ich habe diese Codeabschnitt :

                      CONFIG(release, debug|release){BUILD_KONFIG=Release}
                      CONFIG(debug, debug|release){BUILD_KONFIG=Debug}
                      

                      in .qmke.conf eingefügt und die message:

                      message("Mein BUILD_KONFIG  ist " $$BUILD_KONFIG)
                      

                      in der .pro File eingefügt.

                      Die Message ist immer einen Release, obwohl ich in Debug Modus bin.

                      J.Hilk K 2 Replies Last reply Reply Quote 0
                      • J.Hilk
                        J.Hilk Moderators @Galilio last edited by

                        @Galilio Änderungen in der pro file erfordern einen kompletten rebuild.
                        Ich würde vorschlagen den Buildordner einfach zu löschen.

                        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct

                        Qt Needs YOUR vote: https://bugreports.qt.io/browse/QTQAINFRA-4121


                        Q: What's that?
                        A: It's blue light.
                        Q: What does it do?
                        A: It turns blue.

                        1 Reply Last reply Reply Quote 2
                        • K
                          koahnig @Galilio last edited by

                          @Galilio

                          Als Ergänzung zu
                          @J.Hilk said in qmake automatisch zu der Build Configuration setzen:

                          @Galilio Änderungen in der pro file erfordern einen kompletten rebuild.
                          Ich würde vorschlagen den Buildordner einfach zu löschen.

                          bevor Missverständnisse sind. Ein "Run qmake" ist erst noch notwendig. Den kompletten Buildordner zu löschen schliesst dann alles ein.

                          Vote the answer(s) that helped you to solve your issue(s)

                          1 Reply Last reply Reply Quote 1
                          • First post
                            Last post