Discussion:
[Interest] qmake with release config is called for debug build
Alexander Dyagilev
2018-11-10 08:27:56 UTC
Permalink
Hello,

I'm using the following .pri file:

include(macros.pri)
win32:CONFIG(release, debug|release) {
  VC_RUNTIME_FOLDER="c:/Program Files (x86)/Microsoft Visual Studio
14.0/VC/redist/x64/Microsoft.VC140.CRT"
  copyFilesToDestdir($$VC_RUNTIME_FOLDER, "msvcp140.dll")
}

It's supposed to copy msvcp140.dll to build folder for Release
configuration (so it will be included into the installer then).

I do not need this msvcp140.dll to be copied to my Debug folder when I'm
working on the project. But it does copy it.

Steps:
1) Remove file
2) Run qmake on project (active configuration is Debug).

Result: file is copied.

Can anything be done here except the using of QMAKE_POST_LINK here
instead? Why is CONFIG(release, debug|release) "not working" here?

Some details below:

copyFilesToDestdir is defined in macros.pri:

defineTest(copyFilesToDestdir) {
    pathSrc = $$1
    files = $$2
    folderDst = $$DESTDIR
    subfolder = $$3
    !isEmpty(subfolder) {
        folderDst=$$folderDst/$$subfolder
    }

    DEST = $$shell_path($$OUT_PWD/$$folderDst)

    for(filename, files) {
        FILE = $$shell_path($$pathSrc/$$filename)
        system($$QMAKE_COPY $$shell_quote($$FILE) $$shell_quote($$DEST))
    }
}
Jérôme Godbout
2018-11-12 14:13:32 UTC
Permalink
The way you wrote it, it will only copy the file when parsing the .pro/.pri files, you need to make a target and add it to the build sequence.

Here's the doc example:
mytarget.target = .buildfile
mytarget.commands = touch $$mytarget.target
mytarget.depends = mytarget2

mytarget2.commands = @echo Building $$mytarget.target
QMAKE_EXTRA_TARGETS += mytarget mytarget2

http://doc.qt.io/qt-5/qmake-advanced-usage.html

I still wonder why it's not as simple as the MSBuild target system (I not a lover of MSBuild, but that part was clear and simple) where QMake make it super unfriendly.


-----Original Message-----
From: Interest <interest-bounces+godboutj=***@qt-project.org> On Behalf Of Alexander Dyagilev
Sent: November 10, 2018 3:28 AM
To: ***@qt-project.org
Subject: [Interest] qmake with release config is called for debug build

Hello,

I'm using the following .pri file:

include(macros.pri)
win32:CONFIG(release, debug|release) {
  VC_RUNTIME_FOLDER="c:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/redist/x64/Microsoft.VC140.CRT"
  copyFilesToDestdir($$VC_RUNTIME_FOLDER, "msvcp140.dll") }

It's supposed to copy msvcp140.dll to build folder for Release configuration (so it will be included into the installer then).

I do not need this msvcp140.dll to be copied to my Debug folder when I'm working on the project. But it does copy it.

Steps:
1) Remove file
2) Run qmake on project (active configuration is Debug).

Result: file is copied.

Can anything be done here except the using of QMAKE_POST_LINK here instead? Why is CONFIG(release, debug|release) "not working" here?

Some details below:

copyFilesToDestdir is defined in macros.pri:

defineTest(copyFilesToDestdir) {
    pathSrc = $$1
    files = $$2
    folderDst = $$DESTDIR
    subfolder = $$3
    !isEmpty(subfolder) {
        folderDst=$$folderDst/$$subfolder
    }

    DEST = $$shell_path($$OUT_PWD/$$folderDst)

    for(filename, files) {
        FILE = $$shell_path($$pathSrc/$$filename)
        system($$QMAKE_COPY $$shell_quote($$FILE) $$shell_quote($$DEST))
    }
}

_______________________________________________
Interest mailing list
***@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest
Olivier B.
2018-11-12 16:35:27 UTC
Permalink
You can also use the COPIES qmake variable. It's used in a similar way
as INSTALLS, but instead of being run when you 'make install', it will
be run when you run 'make' of build the generated project in your IDE.
It's usefull when your exe has deps that need to be beside it in the
temp build dir for debugging
Post by Jérôme Godbout
The way you wrote it, it will only copy the file when parsing the .pro/.pri files, you need to make a target and add it to the build sequence.
mytarget.target = .buildfile
mytarget.commands = touch $$mytarget.target
mytarget.depends = mytarget2
QMAKE_EXTRA_TARGETS += mytarget mytarget2
http://doc.qt.io/qt-5/qmake-advanced-usage.html
I still wonder why it's not as simple as the MSBuild target system (I not a lover of MSBuild, but that part was clear and simple) where QMake make it super unfriendly.
-----Original Message-----
Sent: November 10, 2018 3:28 AM
Subject: [Interest] qmake with release config is called for debug build
Hello,
include(macros.pri)
win32:CONFIG(release, debug|release) {
VC_RUNTIME_FOLDER="c:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/redist/x64/Microsoft.VC140.CRT"
copyFilesToDestdir($$VC_RUNTIME_FOLDER, "msvcp140.dll") }
It's supposed to copy msvcp140.dll to build folder for Release configuration (so it will be included into the installer then).
I do not need this msvcp140.dll to be copied to my Debug folder when I'm working on the project. But it does copy it.
1) Remove file
2) Run qmake on project (active configuration is Debug).
Result: file is copied.
Can anything be done here except the using of QMAKE_POST_LINK here instead? Why is CONFIG(release, debug|release) "not working" here?
defineTest(copyFilesToDestdir) {
pathSrc = $$1
files = $$2
folderDst = $$DESTDIR
subfolder = $$3
!isEmpty(subfolder) {
folderDst=$$folderDst/$$subfolder
}
DEST = $$shell_path($$OUT_PWD/$$folderDst)
for(filename, files) {
FILE = $$shell_path($$pathSrc/$$filename)
system($$QMAKE_COPY $$shell_quote($$FILE) $$shell_quote($$DEST))
}
}
_______________________________________________
Interest mailing list
http://lists.qt-project.org/mailman/listinfo/interest
_______________________________________________
Interest mailing list
http://lists.qt-project.org/mailman/listinfo/interest
Loading...