2011-04-27 10:05:43 +00:00
|
|
|
/****************************************************************************
|
|
|
|
**
|
2016-01-15 12:36:27 +00:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2011-04-27 10:05:43 +00:00
|
|
|
**
|
|
|
|
** This file is part of the qmake application of the Qt Toolkit.
|
|
|
|
**
|
2016-01-15 12:36:27 +00:00
|
|
|
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
|
2012-09-19 12:28:29 +00:00
|
|
|
** Commercial License Usage
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2015-01-28 08:44:43 +00:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
2016-01-15 12:36:27 +00:00
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2012-09-19 12:28:29 +00:00
|
|
|
**
|
2016-01-15 12:36:27 +00:00
|
|
|
** GNU General Public License Usage
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2011-04-27 10:05:43 +00:00
|
|
|
**
|
|
|
|
** $QT_END_LICENSE$
|
|
|
|
**
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include "winmakefile.h"
|
|
|
|
#include "option.h"
|
|
|
|
#include "project.h"
|
|
|
|
#include "meta.h"
|
|
|
|
#include <qtextstream.h>
|
|
|
|
#include <qstring.h>
|
|
|
|
#include <qhash.h>
|
|
|
|
#include <qregexp.h>
|
|
|
|
#include <qstringlist.h>
|
|
|
|
#include <qdir.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2019-09-30 08:51:59 +00:00
|
|
|
#include <algorithm>
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
2015-02-06 14:30:02 +00:00
|
|
|
ProString Win32MakefileGenerator::fixLibFlag(const ProString &lib)
|
|
|
|
{
|
2015-09-23 12:57:05 +00:00
|
|
|
if (lib.startsWith("-l")) // Fallback for unresolved -l libs.
|
|
|
|
return escapeFilePath(lib.mid(2) + QLatin1String(".lib"));
|
|
|
|
if (lib.startsWith("-L")) // Lib search path. Needed only by -l above.
|
2015-06-23 18:12:03 +00:00
|
|
|
return QLatin1String("/LIBPATH:")
|
2015-09-23 12:57:05 +00:00
|
|
|
+ escapeFilePath(Option::fixPathToTargetOS(lib.mid(2).toQString(), false));
|
2015-05-27 18:42:56 +00:00
|
|
|
return escapeFilePath(Option::fixPathToTargetOS(lib.toQString(), false));
|
2015-02-06 14:30:02 +00:00
|
|
|
}
|
|
|
|
|
2015-09-23 12:57:05 +00:00
|
|
|
MakefileGenerator::LibFlagType
|
|
|
|
Win32MakefileGenerator::parseLibFlag(const ProString &flag, ProString *arg)
|
|
|
|
{
|
|
|
|
LibFlagType ret = MakefileGenerator::parseLibFlag(flag, arg);
|
|
|
|
if (ret != LibFlagFile)
|
|
|
|
return ret;
|
|
|
|
// MSVC compatibility. This should be deprecated.
|
|
|
|
if (flag.startsWith("/LIBPATH:")) {
|
|
|
|
*arg = flag.mid(9);
|
|
|
|
return LibFlagPath;
|
|
|
|
}
|
|
|
|
// These are pure qmake inventions. They *really* should be deprecated.
|
|
|
|
if (flag.startsWith("/L")) {
|
|
|
|
*arg = flag.mid(2);
|
|
|
|
return LibFlagPath;
|
|
|
|
}
|
|
|
|
if (flag.startsWith("/l")) {
|
|
|
|
*arg = flag.mid(2);
|
|
|
|
return LibFlagLib;
|
|
|
|
}
|
|
|
|
return LibFlagFile;
|
|
|
|
}
|
|
|
|
|
2019-09-30 08:51:59 +00:00
|
|
|
class LibrarySearchPath : public QMakeLocalFileName
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
LibrarySearchPath() = default;
|
|
|
|
|
|
|
|
LibrarySearchPath(const QString &s)
|
|
|
|
: QMakeLocalFileName(s)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
LibrarySearchPath(QString &&s, bool isDefault = false)
|
|
|
|
: QMakeLocalFileName(std::move(s)), _default(isDefault)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool isDefault() const { return _default; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool _default = false;
|
|
|
|
};
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
bool
|
2015-08-17 17:33:52 +00:00
|
|
|
Win32MakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags)
|
2011-04-27 10:05:43 +00:00
|
|
|
{
|
2015-09-23 12:57:05 +00:00
|
|
|
ProStringList impexts = project->values("QMAKE_LIB_EXTENSIONS");
|
|
|
|
if (impexts.isEmpty())
|
|
|
|
impexts = project->values("QMAKE_EXTENSION_STATICLIB");
|
2019-09-30 08:51:59 +00:00
|
|
|
QVector<LibrarySearchPath> dirs;
|
2019-02-28 09:02:21 +00:00
|
|
|
int libidx = 0;
|
2019-01-07 08:29:53 +00:00
|
|
|
for (const ProString &dlib : project->values("QMAKE_DEFAULT_LIBDIRS"))
|
2019-09-30 08:51:59 +00:00
|
|
|
dirs.append(LibrarySearchPath(dlib.toQString(), true));
|
2018-10-08 16:24:14 +00:00
|
|
|
static const char * const lflags[] = { "LIBS", "LIBS_PRIVATE",
|
|
|
|
"QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", nullptr };
|
2012-08-20 11:04:39 +00:00
|
|
|
for (int i = 0; lflags[i]; i++) {
|
2012-09-06 10:21:38 +00:00
|
|
|
ProStringList &l = project->values(lflags[i]);
|
|
|
|
for (ProStringList::Iterator it = l.begin(); it != l.end();) {
|
2015-09-23 12:57:05 +00:00
|
|
|
const ProString &opt = *it;
|
|
|
|
ProString arg;
|
|
|
|
LibFlagType type = parseLibFlag(opt, &arg);
|
|
|
|
if (type == LibFlagPath) {
|
2019-09-30 08:51:59 +00:00
|
|
|
const QString argqstr = arg.toQString();
|
|
|
|
auto dit = std::find_if(dirs.cbegin(), dirs.cend(),
|
|
|
|
[&argqstr](const LibrarySearchPath &p)
|
|
|
|
{
|
|
|
|
return p.real() == argqstr;
|
|
|
|
});
|
|
|
|
int idx = dit == dirs.cend()
|
|
|
|
? -1
|
|
|
|
: std::distance(dirs.cbegin(), dit);
|
2019-02-28 09:02:21 +00:00
|
|
|
if (idx >= 0 && idx < libidx) {
|
2015-06-02 16:28:33 +00:00
|
|
|
it = l.erase(it);
|
|
|
|
continue;
|
2015-02-06 14:30:02 +00:00
|
|
|
}
|
2019-09-30 08:51:59 +00:00
|
|
|
const LibrarySearchPath lp(argqstr);
|
2019-02-28 09:02:21 +00:00
|
|
|
dirs.insert(libidx++, lp);
|
2015-09-23 12:57:05 +00:00
|
|
|
(*it) = "-L" + lp.real();
|
|
|
|
} else if (type == LibFlagLib) {
|
|
|
|
QString lib = arg.toQString();
|
rewrite windows library handling
first, store the library's full name in the .prl file, like we do on
unix. this is not expected to have any side effects, as QMAKE_PRL_TARGET
was entirely unused under windows so far.
then, rewrite the mingw library handling: instead of letting the linker
resolve the actual libraries, do it ourselves like we do for msvc. we
could not do that before due to the partial file names in the .prl
files: if the library didn't exist at qmake execution time, we'd have to
guess the file extension (the msvc generators never had that problem, as
they know about only one possible extension for libraries anyway).
make use of processPrlFile()'s ability to replace the reference to
the .prl file with the actual library. that way we don't need to
re-assemble the file name from pieces, which was fragile and
inefficient.
QMAKE_*_VERSION_OVERRIDE does not affect libraries coming with .prl
files any more. additionally, it is now used literally (not
numerically), and values less or equal to zero lost their special
meaning as "none" - this isn't a problem, because that's the default
anyway, and there is no need to override bogus versions from .prl files
any more.
no changelog for that, as i found no public traces of that feature
outside qtbase.
[ChangeLog][qmake][Windows] Libraries coming with .prl files can now
have non-standard file extensions and a major version of zero.
[ChangeLog][qmake][Windows][Important Behavior Changes] The .prl files
written by earlier versions of Qt cannot be used any more. This will
affect you if you depend on 3rd party libraries which come with .prl
files. Patch up QMAKE_PRL_TARGET to contain the complete file name of
the library, and replace any /LIBPATH: in QMAKE_PRL_LIBS with -L.
(the part about /LIBPATH: actually refers to the next commit.)
Change-Id: I07399341bff0609cb6db9660cbc62b141fb2ad96
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-09-25 12:21:44 +00:00
|
|
|
ProString verovr =
|
|
|
|
project->first(ProKey("QMAKE_" + lib.toUpper() + "_VERSION_OVERRIDE"));
|
2019-08-06 13:01:49 +00:00
|
|
|
for (auto dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) {
|
rewrite windows library handling
first, store the library's full name in the .prl file, like we do on
unix. this is not expected to have any side effects, as QMAKE_PRL_TARGET
was entirely unused under windows so far.
then, rewrite the mingw library handling: instead of letting the linker
resolve the actual libraries, do it ourselves like we do for msvc. we
could not do that before due to the partial file names in the .prl
files: if the library didn't exist at qmake execution time, we'd have to
guess the file extension (the msvc generators never had that problem, as
they know about only one possible extension for libraries anyway).
make use of processPrlFile()'s ability to replace the reference to
the .prl file with the actual library. that way we don't need to
re-assemble the file name from pieces, which was fragile and
inefficient.
QMAKE_*_VERSION_OVERRIDE does not affect libraries coming with .prl
files any more. additionally, it is now used literally (not
numerically), and values less or equal to zero lost their special
meaning as "none" - this isn't a problem, because that's the default
anyway, and there is no need to override bogus versions from .prl files
any more.
no changelog for that, as i found no public traces of that feature
outside qtbase.
[ChangeLog][qmake][Windows] Libraries coming with .prl files can now
have non-standard file extensions and a major version of zero.
[ChangeLog][qmake][Windows][Important Behavior Changes] The .prl files
written by earlier versions of Qt cannot be used any more. This will
affect you if you depend on 3rd party libraries which come with .prl
files. Patch up QMAKE_PRL_TARGET to contain the complete file name of
the library, and replace any /LIBPATH: in QMAKE_PRL_LIBS with -L.
(the part about /LIBPATH: actually refers to the next commit.)
Change-Id: I07399341bff0609cb6db9660cbc62b141fb2ad96
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-09-25 12:21:44 +00:00
|
|
|
QString cand = (*dir_it).real() + Option::dir_sep + lib;
|
2018-07-09 18:02:27 +00:00
|
|
|
if (linkPrl && processPrlFile(cand, true)) {
|
rewrite windows library handling
first, store the library's full name in the .prl file, like we do on
unix. this is not expected to have any side effects, as QMAKE_PRL_TARGET
was entirely unused under windows so far.
then, rewrite the mingw library handling: instead of letting the linker
resolve the actual libraries, do it ourselves like we do for msvc. we
could not do that before due to the partial file names in the .prl
files: if the library didn't exist at qmake execution time, we'd have to
guess the file extension (the msvc generators never had that problem, as
they know about only one possible extension for libraries anyway).
make use of processPrlFile()'s ability to replace the reference to
the .prl file with the actual library. that way we don't need to
re-assemble the file name from pieces, which was fragile and
inefficient.
QMAKE_*_VERSION_OVERRIDE does not affect libraries coming with .prl
files any more. additionally, it is now used literally (not
numerically), and values less or equal to zero lost their special
meaning as "none" - this isn't a problem, because that's the default
anyway, and there is no need to override bogus versions from .prl files
any more.
no changelog for that, as i found no public traces of that feature
outside qtbase.
[ChangeLog][qmake][Windows] Libraries coming with .prl files can now
have non-standard file extensions and a major version of zero.
[ChangeLog][qmake][Windows][Important Behavior Changes] The .prl files
written by earlier versions of Qt cannot be used any more. This will
affect you if you depend on 3rd party libraries which come with .prl
files. Patch up QMAKE_PRL_TARGET to contain the complete file name of
the library, and replace any /LIBPATH: in QMAKE_PRL_LIBS with -L.
(the part about /LIBPATH: actually refers to the next commit.)
Change-Id: I07399341bff0609cb6db9660cbc62b141fb2ad96
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-09-25 12:21:44 +00:00
|
|
|
(*it) = cand;
|
|
|
|
goto found;
|
|
|
|
}
|
2015-09-23 12:57:05 +00:00
|
|
|
QString libBase = (*dir_it).local() + '/' + lib + verovr;
|
2018-10-18 19:43:59 +00:00
|
|
|
for (ProStringList::ConstIterator extit = impexts.cbegin();
|
|
|
|
extit != impexts.cend(); ++extit) {
|
2015-09-23 12:57:05 +00:00
|
|
|
if (exists(libBase + '.' + *extit)) {
|
2019-09-30 08:51:59 +00:00
|
|
|
*it = (dir_it->isDefault() ? lib : cand)
|
|
|
|
+ verovr + '.' + *extit;
|
2015-09-23 12:57:05 +00:00
|
|
|
goto found;
|
|
|
|
}
|
rewrite windows library handling
first, store the library's full name in the .prl file, like we do on
unix. this is not expected to have any side effects, as QMAKE_PRL_TARGET
was entirely unused under windows so far.
then, rewrite the mingw library handling: instead of letting the linker
resolve the actual libraries, do it ourselves like we do for msvc. we
could not do that before due to the partial file names in the .prl
files: if the library didn't exist at qmake execution time, we'd have to
guess the file extension (the msvc generators never had that problem, as
they know about only one possible extension for libraries anyway).
make use of processPrlFile()'s ability to replace the reference to
the .prl file with the actual library. that way we don't need to
re-assemble the file name from pieces, which was fragile and
inefficient.
QMAKE_*_VERSION_OVERRIDE does not affect libraries coming with .prl
files any more. additionally, it is now used literally (not
numerically), and values less or equal to zero lost their special
meaning as "none" - this isn't a problem, because that's the default
anyway, and there is no need to override bogus versions from .prl files
any more.
no changelog for that, as i found no public traces of that feature
outside qtbase.
[ChangeLog][qmake][Windows] Libraries coming with .prl files can now
have non-standard file extensions and a major version of zero.
[ChangeLog][qmake][Windows][Important Behavior Changes] The .prl files
written by earlier versions of Qt cannot be used any more. This will
affect you if you depend on 3rd party libraries which come with .prl
files. Patch up QMAKE_PRL_TARGET to contain the complete file name of
the library, and replace any /LIBPATH: in QMAKE_PRL_LIBS with -L.
(the part about /LIBPATH: actually refers to the next commit.)
Change-Id: I07399341bff0609cb6db9660cbc62b141fb2ad96
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-09-25 12:21:44 +00:00
|
|
|
}
|
|
|
|
}
|
2015-09-23 12:57:05 +00:00
|
|
|
// We assume if it never finds it that it's correct
|
rewrite windows library handling
first, store the library's full name in the .prl file, like we do on
unix. this is not expected to have any side effects, as QMAKE_PRL_TARGET
was entirely unused under windows so far.
then, rewrite the mingw library handling: instead of letting the linker
resolve the actual libraries, do it ourselves like we do for msvc. we
could not do that before due to the partial file names in the .prl
files: if the library didn't exist at qmake execution time, we'd have to
guess the file extension (the msvc generators never had that problem, as
they know about only one possible extension for libraries anyway).
make use of processPrlFile()'s ability to replace the reference to
the .prl file with the actual library. that way we don't need to
re-assemble the file name from pieces, which was fragile and
inefficient.
QMAKE_*_VERSION_OVERRIDE does not affect libraries coming with .prl
files any more. additionally, it is now used literally (not
numerically), and values less or equal to zero lost their special
meaning as "none" - this isn't a problem, because that's the default
anyway, and there is no need to override bogus versions from .prl files
any more.
no changelog for that, as i found no public traces of that feature
outside qtbase.
[ChangeLog][qmake][Windows] Libraries coming with .prl files can now
have non-standard file extensions and a major version of zero.
[ChangeLog][qmake][Windows][Important Behavior Changes] The .prl files
written by earlier versions of Qt cannot be used any more. This will
affect you if you depend on 3rd party libraries which come with .prl
files. Patch up QMAKE_PRL_TARGET to contain the complete file name of
the library, and replace any /LIBPATH: in QMAKE_PRL_LIBS with -L.
(the part about /LIBPATH: actually refers to the next commit.)
Change-Id: I07399341bff0609cb6db9660cbc62b141fb2ad96
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-09-25 12:21:44 +00:00
|
|
|
found: ;
|
2015-09-23 12:57:05 +00:00
|
|
|
} else if (linkPrl && type == LibFlagFile) {
|
|
|
|
QString lib = opt.toQString();
|
|
|
|
if (fileInfo(lib).isAbsolute()) {
|
2018-07-09 18:02:27 +00:00
|
|
|
if (processPrlFile(lib, false))
|
2015-09-23 12:57:05 +00:00
|
|
|
(*it) = lib;
|
rewrite windows library handling
first, store the library's full name in the .prl file, like we do on
unix. this is not expected to have any side effects, as QMAKE_PRL_TARGET
was entirely unused under windows so far.
then, rewrite the mingw library handling: instead of letting the linker
resolve the actual libraries, do it ourselves like we do for msvc. we
could not do that before due to the partial file names in the .prl
files: if the library didn't exist at qmake execution time, we'd have to
guess the file extension (the msvc generators never had that problem, as
they know about only one possible extension for libraries anyway).
make use of processPrlFile()'s ability to replace the reference to
the .prl file with the actual library. that way we don't need to
re-assemble the file name from pieces, which was fragile and
inefficient.
QMAKE_*_VERSION_OVERRIDE does not affect libraries coming with .prl
files any more. additionally, it is now used literally (not
numerically), and values less or equal to zero lost their special
meaning as "none" - this isn't a problem, because that's the default
anyway, and there is no need to override bogus versions from .prl files
any more.
no changelog for that, as i found no public traces of that feature
outside qtbase.
[ChangeLog][qmake][Windows] Libraries coming with .prl files can now
have non-standard file extensions and a major version of zero.
[ChangeLog][qmake][Windows][Important Behavior Changes] The .prl files
written by earlier versions of Qt cannot be used any more. This will
affect you if you depend on 3rd party libraries which come with .prl
files. Patch up QMAKE_PRL_TARGET to contain the complete file name of
the library, and replace any /LIBPATH: in QMAKE_PRL_LIBS with -L.
(the part about /LIBPATH: actually refers to the next commit.)
Change-Id: I07399341bff0609cb6db9660cbc62b141fb2ad96
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-09-25 12:21:44 +00:00
|
|
|
} else {
|
2019-08-06 13:01:49 +00:00
|
|
|
for (auto dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) {
|
2015-09-23 12:57:05 +00:00
|
|
|
QString cand = (*dir_it).real() + Option::dir_sep + lib;
|
2018-07-09 18:02:27 +00:00
|
|
|
if (processPrlFile(cand, false)) {
|
rewrite windows library handling
first, store the library's full name in the .prl file, like we do on
unix. this is not expected to have any side effects, as QMAKE_PRL_TARGET
was entirely unused under windows so far.
then, rewrite the mingw library handling: instead of letting the linker
resolve the actual libraries, do it ourselves like we do for msvc. we
could not do that before due to the partial file names in the .prl
files: if the library didn't exist at qmake execution time, we'd have to
guess the file extension (the msvc generators never had that problem, as
they know about only one possible extension for libraries anyway).
make use of processPrlFile()'s ability to replace the reference to
the .prl file with the actual library. that way we don't need to
re-assemble the file name from pieces, which was fragile and
inefficient.
QMAKE_*_VERSION_OVERRIDE does not affect libraries coming with .prl
files any more. additionally, it is now used literally (not
numerically), and values less or equal to zero lost their special
meaning as "none" - this isn't a problem, because that's the default
anyway, and there is no need to override bogus versions from .prl files
any more.
no changelog for that, as i found no public traces of that feature
outside qtbase.
[ChangeLog][qmake][Windows] Libraries coming with .prl files can now
have non-standard file extensions and a major version of zero.
[ChangeLog][qmake][Windows][Important Behavior Changes] The .prl files
written by earlier versions of Qt cannot be used any more. This will
affect you if you depend on 3rd party libraries which come with .prl
files. Patch up QMAKE_PRL_TARGET to contain the complete file name of
the library, and replace any /LIBPATH: in QMAKE_PRL_LIBS with -L.
(the part about /LIBPATH: actually refers to the next commit.)
Change-Id: I07399341bff0609cb6db9660cbc62b141fb2ad96
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-09-25 12:21:44 +00:00
|
|
|
(*it) = cand;
|
2011-04-27 10:05:43 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-08-17 17:33:52 +00:00
|
|
|
|
|
|
|
ProStringList &prl_libs = project->values("QMAKE_CURRENT_PRL_LIBS");
|
|
|
|
for (int prl = 0; prl < prl_libs.size(); ++prl)
|
|
|
|
it = l.insert(++it, prl_libs.at(prl));
|
|
|
|
prl_libs.clear();
|
2015-06-02 16:28:33 +00:00
|
|
|
++it;
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
2015-08-17 17:33:52 +00:00
|
|
|
if (mergeLflags) {
|
|
|
|
ProStringList lopts;
|
2012-07-20 13:23:01 +00:00
|
|
|
for (int lit = 0; lit < l.size(); ++lit) {
|
2015-08-17 17:33:52 +00:00
|
|
|
ProString opt = l.at(lit);
|
2015-09-23 12:57:05 +00:00
|
|
|
if (opt.startsWith(QLatin1String("-L"))) {
|
2015-08-17 17:33:52 +00:00
|
|
|
if (!lopts.contains(opt))
|
|
|
|
lopts.append(opt);
|
2015-06-23 18:12:03 +00:00
|
|
|
} else {
|
2015-08-17 17:33:52 +00:00
|
|
|
// Make sure we keep the dependency order of libraries
|
|
|
|
lopts.removeAll(opt);
|
|
|
|
lopts.append(opt);
|
2012-11-28 11:21:15 +00:00
|
|
|
}
|
|
|
|
}
|
2015-08-17 17:33:52 +00:00
|
|
|
l = lopts;
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
2015-08-17 17:33:52 +00:00
|
|
|
}
|
|
|
|
return true;
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
2018-06-28 15:57:53 +00:00
|
|
|
bool Win32MakefileGenerator::processPrlFileBase(QString &origFile, const QStringRef &origName,
|
|
|
|
const QStringRef &fixedBase, int slashOff)
|
|
|
|
{
|
|
|
|
if (MakefileGenerator::processPrlFileBase(origFile, origName, fixedBase, slashOff))
|
|
|
|
return true;
|
|
|
|
for (int off = fixedBase.length(); off > slashOff; off--) {
|
|
|
|
if (!fixedBase.at(off - 1).isDigit()) {
|
|
|
|
if (off != fixedBase.length()) {
|
|
|
|
return MakefileGenerator::processPrlFileBase(
|
|
|
|
origFile, origName, fixedBase.left(off), slashOff);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
void Win32MakefileGenerator::processVars()
|
|
|
|
{
|
2016-12-02 18:53:47 +00:00
|
|
|
if (project->first("TEMPLATE").endsWith("aux"))
|
|
|
|
return;
|
|
|
|
|
2018-08-23 18:21:24 +00:00
|
|
|
project->values("PRL_TARGET") =
|
|
|
|
project->values("QMAKE_ORIG_TARGET") = project->values("TARGET");
|
2011-04-27 10:05:43 +00:00
|
|
|
if (project->isEmpty("QMAKE_PROJECT_NAME"))
|
|
|
|
project->values("QMAKE_PROJECT_NAME") = project->values("QMAKE_ORIG_TARGET");
|
|
|
|
else if (project->first("TEMPLATE").startsWith("vc"))
|
|
|
|
project->values("MAKEFILE") = project->values("QMAKE_PROJECT_NAME");
|
|
|
|
|
2017-05-16 15:28:22 +00:00
|
|
|
project->values("QMAKE_INCDIR") += project->values("QMAKE_INCDIR_POST");
|
|
|
|
project->values("QMAKE_LIBDIR") += project->values("QMAKE_LIBDIR_POST");
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
if (!project->values("QMAKE_INCDIR").isEmpty())
|
|
|
|
project->values("INCLUDEPATH") += project->values("QMAKE_INCDIR");
|
|
|
|
|
|
|
|
if (!project->values("VERSION").isEmpty()) {
|
2012-09-06 10:21:38 +00:00
|
|
|
QStringList l = project->first("VERSION").toQString().split('.');
|
2011-04-27 10:05:43 +00:00
|
|
|
if (l.size() > 0)
|
|
|
|
project->values("VER_MAJ").append(l[0]);
|
|
|
|
if (l.size() > 1)
|
|
|
|
project->values("VER_MIN").append(l[1]);
|
|
|
|
}
|
|
|
|
|
|
|
|
// TARGET_VERSION_EXT will be used to add a version number onto the target name
|
2012-11-01 21:57:33 +00:00
|
|
|
if (!project->isActiveConfig("skip_target_version_ext")
|
|
|
|
&& project->values("TARGET_VERSION_EXT").isEmpty()
|
2011-11-04 12:51:20 +00:00
|
|
|
&& !project->values("VER_MAJ").isEmpty())
|
2014-11-27 13:49:16 +00:00
|
|
|
project->values("TARGET_VERSION_EXT").append(project->first("VER_MAJ"));
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
fixTargetExt();
|
|
|
|
processRcFileVar();
|
|
|
|
|
2012-09-06 10:21:38 +00:00
|
|
|
ProStringList libs;
|
|
|
|
ProStringList &libDir = project->values("QMAKE_LIBDIR");
|
|
|
|
for (ProStringList::Iterator libDir_it = libDir.begin(); libDir_it != libDir.end(); ++libDir_it) {
|
|
|
|
QString lib = (*libDir_it).toQString();
|
|
|
|
if (!lib.isEmpty()) {
|
|
|
|
if (lib.endsWith('\\'))
|
|
|
|
lib.chop(1);
|
2015-09-23 12:57:05 +00:00
|
|
|
libs << QLatin1String("-L") + lib;
|
2012-07-16 12:29:48 +00:00
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
2018-10-08 16:24:14 +00:00
|
|
|
ProStringList &qmklibs = project->values("LIBS");
|
|
|
|
qmklibs = libs + qmklibs;
|
2012-07-16 12:04:50 +00:00
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
if (project->values("TEMPLATE").contains("app")) {
|
|
|
|
project->values("QMAKE_CFLAGS") += project->values("QMAKE_CFLAGS_APP");
|
|
|
|
project->values("QMAKE_CXXFLAGS") += project->values("QMAKE_CXXFLAGS_APP");
|
|
|
|
project->values("QMAKE_LFLAGS") += project->values("QMAKE_LFLAGS_APP");
|
|
|
|
} else if (project->values("TEMPLATE").contains("lib") && project->isActiveConfig("dll")) {
|
|
|
|
if(!project->isActiveConfig("plugin") || !project->isActiveConfig("plugin_no_share_shlib_cflags")) {
|
|
|
|
project->values("QMAKE_CFLAGS") += project->values("QMAKE_CFLAGS_SHLIB");
|
|
|
|
project->values("QMAKE_CXXFLAGS") += project->values("QMAKE_CXXFLAGS_SHLIB");
|
|
|
|
}
|
|
|
|
if (project->isActiveConfig("plugin")) {
|
|
|
|
project->values("QMAKE_CFLAGS") += project->values("QMAKE_CFLAGS_PLUGIN");
|
|
|
|
project->values("QMAKE_CXXFLAGS") += project->values("QMAKE_CXXFLAGS_PLUGIN");
|
|
|
|
project->values("QMAKE_LFLAGS") += project->values("QMAKE_LFLAGS_PLUGIN");
|
|
|
|
} else {
|
|
|
|
project->values("QMAKE_LFLAGS") += project->values("QMAKE_LFLAGS_SHLIB");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Win32MakefileGenerator::fixTargetExt()
|
|
|
|
{
|
|
|
|
if (!project->values("QMAKE_APP_FLAG").isEmpty()) {
|
|
|
|
project->values("TARGET_EXT").append(".exe");
|
|
|
|
} else if (project->isActiveConfig("shared")) {
|
2015-09-29 10:44:30 +00:00
|
|
|
project->values("LIB_TARGET").prepend(project->first("QMAKE_PREFIX_STATICLIB")
|
|
|
|
+ project->first("TARGET") + project->first("TARGET_VERSION_EXT")
|
|
|
|
+ '.' + project->first("QMAKE_EXTENSION_STATICLIB"));
|
2011-04-27 10:05:43 +00:00
|
|
|
project->values("TARGET_EXT").append(project->first("TARGET_VERSION_EXT") + "."
|
|
|
|
+ project->first("QMAKE_EXTENSION_SHLIB"));
|
|
|
|
project->values("TARGET").first() = project->first("QMAKE_PREFIX_SHLIB") + project->first("TARGET");
|
|
|
|
} else {
|
|
|
|
project->values("TARGET_EXT").append("." + project->first("QMAKE_EXTENSION_STATICLIB"));
|
|
|
|
project->values("TARGET").first() = project->first("QMAKE_PREFIX_STATICLIB") + project->first("TARGET");
|
rewrite windows library handling
first, store the library's full name in the .prl file, like we do on
unix. this is not expected to have any side effects, as QMAKE_PRL_TARGET
was entirely unused under windows so far.
then, rewrite the mingw library handling: instead of letting the linker
resolve the actual libraries, do it ourselves like we do for msvc. we
could not do that before due to the partial file names in the .prl
files: if the library didn't exist at qmake execution time, we'd have to
guess the file extension (the msvc generators never had that problem, as
they know about only one possible extension for libraries anyway).
make use of processPrlFile()'s ability to replace the reference to
the .prl file with the actual library. that way we don't need to
re-assemble the file name from pieces, which was fragile and
inefficient.
QMAKE_*_VERSION_OVERRIDE does not affect libraries coming with .prl
files any more. additionally, it is now used literally (not
numerically), and values less or equal to zero lost their special
meaning as "none" - this isn't a problem, because that's the default
anyway, and there is no need to override bogus versions from .prl files
any more.
no changelog for that, as i found no public traces of that feature
outside qtbase.
[ChangeLog][qmake][Windows] Libraries coming with .prl files can now
have non-standard file extensions and a major version of zero.
[ChangeLog][qmake][Windows][Important Behavior Changes] The .prl files
written by earlier versions of Qt cannot be used any more. This will
affect you if you depend on 3rd party libraries which come with .prl
files. Patch up QMAKE_PRL_TARGET to contain the complete file name of
the library, and replace any /LIBPATH: in QMAKE_PRL_LIBS with -L.
(the part about /LIBPATH: actually refers to the next commit.)
Change-Id: I07399341bff0609cb6db9660cbc62b141fb2ad96
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-09-25 12:21:44 +00:00
|
|
|
project->values("LIB_TARGET").prepend(project->first("TARGET") + project->first("TARGET_EXT")); // for the .prl only
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Win32MakefileGenerator::processRcFileVar()
|
|
|
|
{
|
|
|
|
if (Option::qmake_mode == Option::QMAKE_GENERATE_NOTHING)
|
|
|
|
return;
|
|
|
|
|
2014-10-29 14:11:57 +00:00
|
|
|
const QString manifestFile = getManifestFileForRcFile();
|
|
|
|
if (((!project->values("VERSION").isEmpty() || !project->values("RC_ICONS").isEmpty() || !manifestFile.isEmpty())
|
2011-04-27 10:05:43 +00:00
|
|
|
&& project->values("RC_FILE").isEmpty()
|
|
|
|
&& project->values("RES_FILE").isEmpty()
|
|
|
|
&& !project->isActiveConfig("no_generated_target_info")
|
|
|
|
&& (project->isActiveConfig("shared") || !project->values("QMAKE_APP_FLAG").isEmpty()))
|
|
|
|
|| !project->values("QMAKE_WRITE_DEFAULT_RC").isEmpty()){
|
|
|
|
|
|
|
|
QByteArray rcString;
|
|
|
|
QTextStream ts(&rcString, QFile::WriteOnly);
|
|
|
|
|
2013-01-09 06:26:52 +00:00
|
|
|
QStringList vers = project->first("VERSION").toQString().split(".", QString::SkipEmptyParts);
|
2011-04-27 10:05:43 +00:00
|
|
|
for (int i = vers.size(); i < 4; i++)
|
|
|
|
vers += "0";
|
2012-05-18 18:00:23 +00:00
|
|
|
QString versionString = vers.join('.');
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2012-12-20 01:38:54 +00:00
|
|
|
QStringList rcIcons;
|
2016-02-01 08:49:22 +00:00
|
|
|
const auto icons = project->values("RC_ICONS");
|
|
|
|
rcIcons.reserve(icons.size());
|
|
|
|
for (const ProString &icon : icons)
|
2012-12-20 01:38:54 +00:00
|
|
|
rcIcons.append(fileFixify(icon.toQString(), FileFixifyAbsolute));
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
QString companyName;
|
|
|
|
if (!project->values("QMAKE_TARGET_COMPANY").isEmpty())
|
2012-05-18 18:00:23 +00:00
|
|
|
companyName = project->values("QMAKE_TARGET_COMPANY").join(' ');
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
QString description;
|
|
|
|
if (!project->values("QMAKE_TARGET_DESCRIPTION").isEmpty())
|
2012-05-18 18:00:23 +00:00
|
|
|
description = project->values("QMAKE_TARGET_DESCRIPTION").join(' ');
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
QString copyright;
|
|
|
|
if (!project->values("QMAKE_TARGET_COPYRIGHT").isEmpty())
|
2012-05-18 18:00:23 +00:00
|
|
|
copyright = project->values("QMAKE_TARGET_COPYRIGHT").join(' ');
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
QString productName;
|
|
|
|
if (!project->values("QMAKE_TARGET_PRODUCT").isEmpty())
|
2012-05-18 18:00:23 +00:00
|
|
|
productName = project->values("QMAKE_TARGET_PRODUCT").join(' ');
|
2011-04-27 10:05:43 +00:00
|
|
|
else
|
2012-09-06 10:21:38 +00:00
|
|
|
productName = project->first("TARGET").toQString();
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2014-11-27 13:49:16 +00:00
|
|
|
QString originalName = project->first("TARGET") + project->first("TARGET_EXT");
|
2012-04-16 09:11:19 +00:00
|
|
|
int rcLang = project->intValue("RC_LANG", 1033); // default: English(USA)
|
|
|
|
int rcCodePage = project->intValue("RC_CODEPAGE", 1200); // default: Unicode
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2016-06-20 11:34:16 +00:00
|
|
|
ts << "#include <windows.h>\n";
|
2019-04-30 10:51:36 +00:00
|
|
|
ts << Qt::endl;
|
2012-12-20 01:38:54 +00:00
|
|
|
if (!rcIcons.isEmpty()) {
|
|
|
|
for (int i = 0; i < rcIcons.size(); ++i)
|
2019-04-30 10:51:36 +00:00
|
|
|
ts << QString("IDI_ICON%1\tICON\tDISCARDABLE\t%2").arg(i + 1).arg(cQuoted(rcIcons[i])) << Qt::endl;
|
|
|
|
ts << Qt::endl;
|
2012-12-20 01:38:54 +00:00
|
|
|
}
|
2014-10-29 14:11:57 +00:00
|
|
|
if (!manifestFile.isEmpty()) {
|
|
|
|
QString manifestResourceId;
|
|
|
|
if (project->first("TEMPLATE") == "lib")
|
|
|
|
manifestResourceId = QStringLiteral("ISOLATIONAWARE_MANIFEST_RESOURCE_ID");
|
|
|
|
else
|
|
|
|
manifestResourceId = QStringLiteral("CREATEPROCESS_MANIFEST_RESOURCE_ID");
|
|
|
|
ts << manifestResourceId << " RT_MANIFEST \"" << manifestFile << "\"\n";
|
|
|
|
}
|
2013-07-04 09:25:16 +00:00
|
|
|
ts << "VS_VERSION_INFO VERSIONINFO\n";
|
2019-04-30 10:51:36 +00:00
|
|
|
ts << "\tFILEVERSION " << QString(versionString).replace(".", ",") << Qt::endl;
|
|
|
|
ts << "\tPRODUCTVERSION " << QString(versionString).replace(".", ",") << Qt::endl;
|
2013-07-04 09:25:16 +00:00
|
|
|
ts << "\tFILEFLAGSMASK 0x3fL\n";
|
|
|
|
ts << "#ifdef _DEBUG\n";
|
|
|
|
ts << "\tFILEFLAGS VS_FF_DEBUG\n";
|
|
|
|
ts << "#else\n";
|
|
|
|
ts << "\tFILEFLAGS 0x0L\n";
|
|
|
|
ts << "#endif\n";
|
|
|
|
ts << "\tFILEOS VOS__WINDOWS32\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
if (project->isActiveConfig("shared"))
|
2013-07-04 09:25:16 +00:00
|
|
|
ts << "\tFILETYPE VFT_DLL\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
else
|
2013-07-04 09:25:16 +00:00
|
|
|
ts << "\tFILETYPE VFT_APP\n";
|
|
|
|
ts << "\tFILESUBTYPE 0x0L\n";
|
|
|
|
ts << "\tBEGIN\n";
|
|
|
|
ts << "\t\tBLOCK \"StringFileInfo\"\n";
|
|
|
|
ts << "\t\tBEGIN\n";
|
2012-04-16 09:11:19 +00:00
|
|
|
ts << "\t\t\tBLOCK \""
|
|
|
|
<< QString("%1%2").arg(rcLang, 4, 16, QLatin1Char('0')).arg(rcCodePage, 4, 16, QLatin1Char('0'))
|
2013-07-04 09:25:16 +00:00
|
|
|
<< "\"\n";
|
|
|
|
ts << "\t\t\tBEGIN\n";
|
|
|
|
ts << "\t\t\t\tVALUE \"CompanyName\", \"" << companyName << "\\0\"\n";
|
|
|
|
ts << "\t\t\t\tVALUE \"FileDescription\", \"" << description << "\\0\"\n";
|
|
|
|
ts << "\t\t\t\tVALUE \"FileVersion\", \"" << versionString << "\\0\"\n";
|
|
|
|
ts << "\t\t\t\tVALUE \"LegalCopyright\", \"" << copyright << "\\0\"\n";
|
|
|
|
ts << "\t\t\t\tVALUE \"OriginalFilename\", \"" << originalName << "\\0\"\n";
|
|
|
|
ts << "\t\t\t\tVALUE \"ProductName\", \"" << productName << "\\0\"\n";
|
|
|
|
ts << "\t\t\t\tVALUE \"ProductVersion\", \"" << versionString << "\\0\"\n";
|
|
|
|
ts << "\t\t\tEND\n";
|
|
|
|
ts << "\t\tEND\n";
|
|
|
|
ts << "\t\tBLOCK \"VarFileInfo\"\n";
|
|
|
|
ts << "\t\tBEGIN\n";
|
2012-04-16 09:11:19 +00:00
|
|
|
ts << "\t\t\tVALUE \"Translation\", "
|
|
|
|
<< QString("0x%1").arg(rcLang, 4, 16, QLatin1Char('0'))
|
2019-04-30 10:51:36 +00:00
|
|
|
<< ", " << QString("%1").arg(rcCodePage, 4) << Qt::endl;
|
2013-07-04 09:25:16 +00:00
|
|
|
ts << "\t\tEND\n";
|
|
|
|
ts << "\tEND\n";
|
|
|
|
ts << "/* End of Version info */\n";
|
2019-04-30 10:51:36 +00:00
|
|
|
ts << Qt::endl;
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
ts.flush();
|
|
|
|
|
|
|
|
|
2014-11-27 13:49:16 +00:00
|
|
|
QString rcFilename = project->first("OUT_PWD")
|
2011-04-27 10:05:43 +00:00
|
|
|
+ "/"
|
2014-11-27 13:49:16 +00:00
|
|
|
+ project->first("TARGET")
|
2011-04-27 10:05:43 +00:00
|
|
|
+ "_resource"
|
|
|
|
+ ".rc";
|
|
|
|
QFile rcFile(QDir::cleanPath(rcFilename));
|
|
|
|
|
|
|
|
bool writeRcFile = true;
|
|
|
|
if (rcFile.exists() && rcFile.open(QFile::ReadOnly)) {
|
|
|
|
writeRcFile = rcFile.readAll() != rcString;
|
|
|
|
rcFile.close();
|
|
|
|
}
|
|
|
|
if (writeRcFile) {
|
2014-01-13 14:48:44 +00:00
|
|
|
bool ok;
|
|
|
|
ok = rcFile.open(QFile::WriteOnly);
|
|
|
|
if (!ok) {
|
|
|
|
// The file can't be opened... try creating the containing
|
|
|
|
// directory first (needed for clean shadow builds)
|
|
|
|
QDir().mkpath(QFileInfo(rcFile).path());
|
|
|
|
ok = rcFile.open(QFile::WriteOnly);
|
|
|
|
}
|
|
|
|
if (!ok) {
|
|
|
|
::fprintf(stderr, "Cannot open for writing: %s", rcFile.fileName().toLatin1().constData());
|
|
|
|
::exit(1);
|
|
|
|
}
|
|
|
|
rcFile.write(rcString);
|
|
|
|
rcFile.close();
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
if (project->values("QMAKE_WRITE_DEFAULT_RC").isEmpty())
|
|
|
|
project->values("RC_FILE").insert(0, rcFile.fileName());
|
|
|
|
}
|
|
|
|
if (!project->values("RC_FILE").isEmpty()) {
|
|
|
|
if (!project->values("RES_FILE").isEmpty()) {
|
|
|
|
fprintf(stderr, "Both rc and res file specified.\n");
|
|
|
|
fprintf(stderr, "Please specify one of them, not both.");
|
|
|
|
exit(1);
|
|
|
|
}
|
2012-09-06 10:21:38 +00:00
|
|
|
QString resFile = project->first("RC_FILE").toQString();
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
// if this is a shadow build then use the absolute path of the rc file
|
|
|
|
if (Option::output_dir != qmake_getpwd()) {
|
|
|
|
QFileInfo fi(resFile);
|
|
|
|
project->values("RC_FILE").first() = fi.absoluteFilePath();
|
|
|
|
}
|
|
|
|
|
2016-02-04 14:12:03 +00:00
|
|
|
resFile.replace(QLatin1String(".rc"), Option::res_ext);
|
2011-04-27 10:05:43 +00:00
|
|
|
project->values("RES_FILE").prepend(fileInfo(resFile).fileName());
|
2014-11-27 18:36:17 +00:00
|
|
|
QString resDestDir;
|
|
|
|
if (project->isActiveConfig("staticlib"))
|
|
|
|
resDestDir = project->first("DESTDIR").toQString();
|
|
|
|
else
|
|
|
|
resDestDir = project->first("OBJECTS_DIR").toQString();
|
|
|
|
if (!resDestDir.isEmpty()) {
|
2011-04-27 10:05:43 +00:00
|
|
|
resDestDir.append(Option::dir_sep);
|
|
|
|
project->values("RES_FILE").first().prepend(resDestDir);
|
|
|
|
}
|
2012-09-06 10:21:38 +00:00
|
|
|
project->values("RES_FILE").first() = Option::fixPathToTargetOS(
|
2015-02-02 16:46:52 +00:00
|
|
|
project->first("RES_FILE").toQString(), false);
|
2014-01-13 14:48:44 +00:00
|
|
|
project->values("POST_TARGETDEPS") += project->values("RES_FILE");
|
2011-04-27 10:05:43 +00:00
|
|
|
project->values("CLEAN_FILES") += project->values("RES_FILE");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Win32MakefileGenerator::writeCleanParts(QTextStream &t)
|
|
|
|
{
|
2015-02-06 14:30:02 +00:00
|
|
|
t << "clean: compiler_clean " << depVar("CLEAN_DEPS");
|
2011-04-27 10:05:43 +00:00
|
|
|
{
|
2018-08-02 22:22:24 +00:00
|
|
|
const char *clean_targets[] = { "OBJECTS", "QMAKE_CLEAN", "CLEAN_FILES", nullptr };
|
2011-04-27 10:05:43 +00:00
|
|
|
for(int i = 0; clean_targets[i]; ++i) {
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProStringList &list = project->values(clean_targets[i]);
|
2011-04-27 10:05:43 +00:00
|
|
|
const QString del_statement("-$(DEL_FILE)");
|
|
|
|
if(project->isActiveConfig("no_delete_multiple_files")) {
|
2012-09-06 10:21:38 +00:00
|
|
|
for (ProStringList::ConstIterator it = list.begin(); it != list.end(); ++it)
|
2014-11-27 19:20:19 +00:00
|
|
|
t << "\n\t" << del_statement
|
|
|
|
<< ' ' << escapeFilePath(Option::fixPathToTargetOS((*it).toQString()));
|
2011-04-27 10:05:43 +00:00
|
|
|
} else {
|
|
|
|
QString files, file;
|
|
|
|
const int commandlineLimit = 2047; // NT limit, expanded
|
2012-09-06 10:21:38 +00:00
|
|
|
for (ProStringList::ConstIterator it = list.begin(); it != list.end(); ++it) {
|
2014-11-27 19:20:19 +00:00
|
|
|
file = ' ' + escapeFilePath(Option::fixPathToTargetOS((*it).toQString()));
|
2011-04-27 10:05:43 +00:00
|
|
|
if(del_statement.length() + files.length() +
|
|
|
|
qMax(fixEnvVariables(file).length(), file.length()) > commandlineLimit) {
|
|
|
|
t << "\n\t" << del_statement << files;
|
|
|
|
files.clear();
|
|
|
|
}
|
|
|
|
files += file;
|
|
|
|
}
|
|
|
|
if(!files.isEmpty())
|
|
|
|
t << "\n\t" << del_statement << files;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-04-30 10:51:36 +00:00
|
|
|
t << Qt::endl << Qt::endl;
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2015-02-06 14:30:02 +00:00
|
|
|
t << "distclean: clean " << depVar("DISTCLEAN_DEPS");
|
2011-04-27 10:05:43 +00:00
|
|
|
{
|
2018-08-02 22:22:24 +00:00
|
|
|
const char *clean_targets[] = { "QMAKE_DISTCLEAN", nullptr };
|
2011-04-27 10:05:43 +00:00
|
|
|
for(int i = 0; clean_targets[i]; ++i) {
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProStringList &list = project->values(clean_targets[i]);
|
2011-04-27 10:05:43 +00:00
|
|
|
const QString del_statement("-$(DEL_FILE)");
|
|
|
|
if(project->isActiveConfig("no_delete_multiple_files")) {
|
2012-09-06 10:21:38 +00:00
|
|
|
for (ProStringList::ConstIterator it = list.begin(); it != list.end(); ++it)
|
2012-07-12 10:08:42 +00:00
|
|
|
t << "\n\t" << del_statement << " "
|
2012-09-06 10:21:38 +00:00
|
|
|
<< escapeFilePath(Option::fixPathToTargetOS((*it).toQString()));
|
2011-04-27 10:05:43 +00:00
|
|
|
} else {
|
|
|
|
QString files, file;
|
|
|
|
const int commandlineLimit = 2047; // NT limit, expanded
|
2012-09-06 10:21:38 +00:00
|
|
|
for (ProStringList::ConstIterator it = list.begin(); it != list.end(); ++it) {
|
|
|
|
file = " " + escapeFilePath(Option::fixPathToTargetOS((*it).toQString()));
|
2011-04-27 10:05:43 +00:00
|
|
|
if(del_statement.length() + files.length() +
|
|
|
|
qMax(fixEnvVariables(file).length(), file.length()) > commandlineLimit) {
|
|
|
|
t << "\n\t" << del_statement << files;
|
|
|
|
files.clear();
|
|
|
|
}
|
|
|
|
files += file;
|
|
|
|
}
|
|
|
|
if(!files.isEmpty())
|
|
|
|
t << "\n\t" << del_statement << files;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\n\t-$(DEL_FILE) $(DESTDIR_TARGET)\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
{
|
2014-11-24 18:51:32 +00:00
|
|
|
QString ofile = fileFixify(Option::output.fileName());
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!ofile.isEmpty())
|
2019-04-30 10:51:36 +00:00
|
|
|
t << "\t-$(DEL_FILE) " << escapeFilePath(ofile) << Qt::endl;
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
2019-04-30 10:51:36 +00:00
|
|
|
t << Qt::endl;
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Win32MakefileGenerator::writeIncPart(QTextStream &t)
|
|
|
|
{
|
|
|
|
t << "INCPATH = ";
|
|
|
|
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProStringList &incs = project->values("INCLUDEPATH");
|
2011-04-27 10:05:43 +00:00
|
|
|
for(int i = 0; i < incs.size(); ++i) {
|
2012-09-06 10:21:38 +00:00
|
|
|
QString inc = incs.at(i).toQString();
|
2011-04-27 10:05:43 +00:00
|
|
|
inc.replace(QRegExp("\\\\$"), "");
|
|
|
|
if(!inc.isEmpty())
|
2015-02-06 14:30:02 +00:00
|
|
|
t << "-I" << escapeFilePath(inc) << ' ';
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
2019-04-30 10:51:36 +00:00
|
|
|
t << Qt::endl;
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Win32MakefileGenerator::writeStandardParts(QTextStream &t)
|
|
|
|
{
|
2018-12-14 19:13:44 +00:00
|
|
|
writeExportedVariables(t);
|
|
|
|
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "####### Compiler, tools and options\n\n";
|
2019-04-30 10:51:36 +00:00
|
|
|
t << "CC = " << var("QMAKE_CC") << Qt::endl;
|
|
|
|
t << "CXX = " << var("QMAKE_CXX") << Qt::endl;
|
2011-04-27 10:05:43 +00:00
|
|
|
t << "DEFINES = "
|
|
|
|
<< varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ")
|
2019-04-30 10:51:36 +00:00
|
|
|
<< varGlue("DEFINES","-D"," -D","") << Qt::endl;
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "CFLAGS = " << var("QMAKE_CFLAGS") << " $(DEFINES)\n";
|
|
|
|
t << "CXXFLAGS = " << var("QMAKE_CXXFLAGS") << " $(DEFINES)\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
writeIncPart(t);
|
|
|
|
writeLibsPart(t);
|
2019-05-10 08:50:19 +00:00
|
|
|
writeDefaultVariables(t);
|
2019-04-30 10:51:36 +00:00
|
|
|
t << Qt::endl;
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "####### Output directory\n\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!project->values("OBJECTS_DIR").isEmpty())
|
2019-04-30 10:51:36 +00:00
|
|
|
t << "OBJECTS_DIR = " << escapeFilePath(var("OBJECTS_DIR").remove(QRegExp("\\\\$"))) << Qt::endl;
|
2011-04-27 10:05:43 +00:00
|
|
|
else
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "OBJECTS_DIR = . \n";
|
2019-04-30 10:51:36 +00:00
|
|
|
t << Qt::endl;
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "####### Files\n\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
t << "SOURCES = " << valList(escapeFilePaths(project->values("SOURCES")))
|
2019-04-30 10:51:36 +00:00
|
|
|
<< " " << valList(escapeFilePaths(project->values("GENERATED_SOURCES"))) << Qt::endl;
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
// do this here so we can set DEST_TARGET to be the complete path to the final target if it is needed.
|
|
|
|
QString orgDestDir = var("DESTDIR");
|
|
|
|
QString destDir = Option::fixPathToTargetOS(orgDestDir, false);
|
|
|
|
if (!destDir.isEmpty() && (orgDestDir.endsWith('/') || orgDestDir.endsWith(Option::dir_sep)))
|
|
|
|
destDir += Option::dir_sep;
|
|
|
|
QString target = QString(project->first("TARGET")+project->first("TARGET_EXT"));
|
|
|
|
project->values("DEST_TARGET").prepend(destDir + target);
|
|
|
|
|
|
|
|
writeObjectsPart(t);
|
|
|
|
|
|
|
|
writeExtraCompilerVariables(t);
|
|
|
|
writeExtraVariables(t);
|
|
|
|
|
2015-02-06 14:30:02 +00:00
|
|
|
t << "DIST = " << fileVarList("DISTFILES") << ' '
|
2019-04-30 10:51:36 +00:00
|
|
|
<< fileVarList("HEADERS") << ' ' << fileVarList("SOURCES") << Qt::endl;
|
|
|
|
t << "QMAKE_TARGET = " << fileVar("QMAKE_ORIG_TARGET") << Qt::endl; // unused
|
2011-04-27 10:05:43 +00:00
|
|
|
// The comment is important to maintain variable compatibility with Unix
|
|
|
|
// Makefiles, while not interpreting a trailing-slash as a linebreak
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "DESTDIR = " << escapeFilePath(destDir) << " #avoid trailing-slash linebreak\n";
|
2019-04-30 10:51:36 +00:00
|
|
|
t << "TARGET = " << escapeFilePath(target) << Qt::endl;
|
|
|
|
t << "DESTDIR_TARGET = " << fileVar("DEST_TARGET") << Qt::endl;
|
|
|
|
t << Qt::endl;
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
writeImplicitRulesPart(t);
|
|
|
|
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "####### Build rules\n\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
writeBuildRulesPart(t);
|
|
|
|
|
2016-11-18 18:05:54 +00:00
|
|
|
if (project->first("TEMPLATE") != "aux") {
|
|
|
|
if (project->isActiveConfig("shared") && !project->values("DLLDESTDIR").isEmpty()) {
|
|
|
|
const ProStringList &dlldirs = project->values("DLLDESTDIR");
|
|
|
|
for (ProStringList::ConstIterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir) {
|
|
|
|
t << "\t-$(COPY_FILE) $(DESTDIR_TARGET) "
|
2019-04-30 10:51:36 +00:00
|
|
|
<< escapeFilePath(Option::fixPathToTargetOS((*dlldir).toQString(), false)) << Qt::endl;
|
2016-11-18 18:05:54 +00:00
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
2019-04-30 10:51:36 +00:00
|
|
|
t << Qt::endl;
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2016-11-18 18:05:54 +00:00
|
|
|
writeRcFilePart(t);
|
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
writeMakeQmake(t);
|
|
|
|
|
|
|
|
QStringList dist_files = fileFixify(Option::mkfile::project_files);
|
|
|
|
if(!project->isEmpty("QMAKE_INTERNAL_INCLUDED_FILES"))
|
2012-09-06 10:21:38 +00:00
|
|
|
dist_files += project->values("QMAKE_INTERNAL_INCLUDED_FILES").toQStringList();
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!project->isEmpty("TRANSLATIONS"))
|
|
|
|
dist_files << var("TRANSLATIONS");
|
|
|
|
if(!project->isEmpty("FORMS")) {
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProStringList &forms = project->values("FORMS");
|
|
|
|
for (ProStringList::ConstIterator formit = forms.begin(); formit != forms.end(); ++formit) {
|
2011-04-27 10:05:43 +00:00
|
|
|
QString ui_h = fileFixify((*formit) + Option::h_ext.first());
|
|
|
|
if(exists(ui_h))
|
|
|
|
dist_files << ui_h;
|
|
|
|
}
|
|
|
|
}
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "dist:\n\t"
|
|
|
|
<< "$(ZIP) " << var("QMAKE_ORIG_TARGET") << ".zip $(SOURCES) $(DIST) "
|
2015-02-06 14:30:02 +00:00
|
|
|
<< escapeFilePaths(dist_files).join(' ') << ' ' << fileVar("TRANSLATIONS") << ' ';
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!project->isEmpty("QMAKE_EXTRA_COMPILERS")) {
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProStringList &quc = project->values("QMAKE_EXTRA_COMPILERS");
|
|
|
|
for (ProStringList::ConstIterator it = quc.begin(); it != quc.end(); ++it) {
|
|
|
|
const ProStringList &inputs = project->values(ProKey(*it + ".input"));
|
2016-11-18 18:40:33 +00:00
|
|
|
for (ProStringList::ConstIterator input = inputs.begin(); input != inputs.end(); ++input) {
|
|
|
|
const ProStringList &val = project->values((*input).toKey());
|
|
|
|
t << escapeFilePaths(val).join(' ') << ' ';
|
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
}
|
2019-04-30 10:51:36 +00:00
|
|
|
t << Qt::endl << Qt::endl;
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
writeCleanParts(t);
|
|
|
|
writeExtraTargets(t);
|
|
|
|
writeExtraCompilerTargets(t);
|
2019-04-30 10:51:36 +00:00
|
|
|
t << Qt::endl << Qt::endl;
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Win32MakefileGenerator::writeLibsPart(QTextStream &t)
|
|
|
|
{
|
|
|
|
if(project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") {
|
2019-04-30 10:51:36 +00:00
|
|
|
t << "LIBAPP = " << var("QMAKE_LIB") << Qt::endl;
|
|
|
|
t << "LIBFLAGS = " << var("QMAKE_LIBFLAGS") << Qt::endl;
|
2011-04-27 10:05:43 +00:00
|
|
|
} else {
|
2019-04-30 10:51:36 +00:00
|
|
|
t << "LINKER = " << var("QMAKE_LINK") << Qt::endl;
|
|
|
|
t << "LFLAGS = " << var("QMAKE_LFLAGS") << Qt::endl;
|
2018-10-08 16:24:14 +00:00
|
|
|
t << "LIBS = " << fixLibFlags("LIBS").join(' ') << ' '
|
|
|
|
<< fixLibFlags("LIBS_PRIVATE").join(' ') << ' '
|
|
|
|
<< fixLibFlags("QMAKE_LIBS").join(' ') << ' '
|
2019-04-30 10:51:36 +00:00
|
|
|
<< fixLibFlags("QMAKE_LIBS_PRIVATE").join(' ') << Qt::endl;
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Win32MakefileGenerator::writeObjectsPart(QTextStream &t)
|
|
|
|
{
|
2015-02-06 14:30:02 +00:00
|
|
|
// Used in both deps and commands.
|
2019-04-30 10:51:36 +00:00
|
|
|
t << "OBJECTS = " << valList(escapeDependencyPaths(project->values("OBJECTS"))) << Qt::endl;
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
2019-06-05 08:47:28 +00:00
|
|
|
void Win32MakefileGenerator::writeImplicitRulesPart(QTextStream &)
|
2011-04-27 10:05:43 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void Win32MakefileGenerator::writeBuildRulesPart(QTextStream &)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void Win32MakefileGenerator::writeRcFilePart(QTextStream &t)
|
|
|
|
{
|
|
|
|
if(!project->values("RC_FILE").isEmpty()) {
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProString res_file = project->first("RES_FILE");
|
|
|
|
const QString rc_file = fileFixify(project->first("RC_FILE").toQString());
|
2012-12-06 15:29:30 +00:00
|
|
|
|
|
|
|
const ProStringList rcIncPaths = project->values("RC_INCLUDEPATH");
|
|
|
|
QString incPathStr;
|
|
|
|
for (int i = 0; i < rcIncPaths.count(); ++i) {
|
|
|
|
const ProString &path = rcIncPaths.at(i);
|
|
|
|
if (path.isEmpty())
|
|
|
|
continue;
|
|
|
|
incPathStr += QStringLiteral(" /i ");
|
|
|
|
incPathStr += escapeFilePath(path);
|
|
|
|
}
|
|
|
|
|
2019-08-02 11:18:46 +00:00
|
|
|
addSourceFile(rc_file, QMakeSourceFileInfo::SEEK_DEPS);
|
|
|
|
const QStringList rcDeps = QStringList(rc_file) << dependencies(rc_file);
|
|
|
|
|
2015-05-27 20:31:21 +00:00
|
|
|
// The resource tool may use defines. This might be the same defines passed in as the
|
|
|
|
// compiler, since you may use these defines in the .rc file itself.
|
|
|
|
// As the escape syntax for the command line defines for RC is different from that for CL,
|
|
|
|
// we might have to set specific defines for RC.
|
|
|
|
ProString defines = varGlue("RC_DEFINES", " -D", " -D", "");
|
|
|
|
if (defines.isEmpty())
|
|
|
|
defines = ProString(" $(DEFINES)");
|
|
|
|
|
|
|
|
// Also, we need to add the _DEBUG define manually since the compiler defines this symbol
|
|
|
|
// by itself, and we use it in the automatically created rc file when VERSION is defined
|
|
|
|
// in the .pro file.
|
2019-08-02 11:18:46 +00:00
|
|
|
t << escapeDependencyPath(res_file) << ": "
|
|
|
|
<< escapeDependencyPaths(rcDeps).join(' ') << "\n\t"
|
2012-12-06 15:29:30 +00:00
|
|
|
<< var("QMAKE_RC") << (project->isActiveConfig("debug") ? " -D_DEBUG" : "")
|
2015-05-27 20:31:21 +00:00
|
|
|
<< defines << incPathStr << " -fo " << escapeFilePath(res_file)
|
2015-02-06 14:30:02 +00:00
|
|
|
<< ' ' << escapeFilePath(rc_file);
|
2019-04-30 10:51:36 +00:00
|
|
|
t << Qt::endl << Qt::endl;
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QString Win32MakefileGenerator::defaultInstall(const QString &t)
|
|
|
|
{
|
|
|
|
if((t != "target" && t != "dlltarget") ||
|
|
|
|
(t == "dlltarget" && (project->first("TEMPLATE") != "lib" || !project->isActiveConfig("shared"))) ||
|
2015-05-05 17:01:14 +00:00
|
|
|
project->first("TEMPLATE") == "subdirs" || project->first("TEMPLATE") == "aux")
|
2011-04-27 10:05:43 +00:00
|
|
|
return QString();
|
|
|
|
|
2016-01-14 12:01:39 +00:00
|
|
|
const QString root = installRoot();
|
2012-09-06 10:21:38 +00:00
|
|
|
ProStringList &uninst = project->values(ProKey(t + ".uninstall"));
|
2011-04-27 10:05:43 +00:00
|
|
|
QString ret;
|
2014-11-24 18:51:32 +00:00
|
|
|
QString targetdir = fileFixify(project->first(ProKey(t + ".path")).toQString(), FileFixifyAbsolute);
|
2011-04-27 10:05:43 +00:00
|
|
|
if(targetdir.right(1) != Option::dir_sep)
|
|
|
|
targetdir += Option::dir_sep;
|
|
|
|
|
2020-02-12 14:27:27 +00:00
|
|
|
const ProStringList &targets = project->values(ProKey(t + ".targets"));
|
|
|
|
for (int i = 0; i < targets.size(); ++i) {
|
|
|
|
QString src = targets.at(i).toQString(),
|
|
|
|
dst = escapeFilePath(filePrefixRoot(root, targetdir + src.section('/', -1)));
|
|
|
|
if (!ret.isEmpty())
|
|
|
|
ret += "\n\t";
|
|
|
|
ret += "$(QINSTALL) " + escapeFilePath(Option::fixPathToTargetOS(src, false)) + ' ' + dst;
|
|
|
|
if (!uninst.isEmpty())
|
|
|
|
uninst.append("\n\t");
|
|
|
|
uninst.append("-$(DEL_FILE) " + dst);
|
|
|
|
}
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
if(t == "target" && project->first("TEMPLATE") == "lib") {
|
|
|
|
if(project->isActiveConfig("create_prl") && !project->isActiveConfig("no_install_prl") &&
|
|
|
|
!project->isEmpty("QMAKE_INTERNAL_PRL_FILE")) {
|
2012-09-06 10:21:38 +00:00
|
|
|
QString dst_prl = Option::fixPathToTargetOS(project->first("QMAKE_INTERNAL_PRL_FILE").toQString());
|
2011-04-27 10:05:43 +00:00
|
|
|
int slsh = dst_prl.lastIndexOf(Option::dir_sep);
|
|
|
|
if(slsh != -1)
|
|
|
|
dst_prl = dst_prl.right(dst_prl.length() - slsh - 1);
|
|
|
|
dst_prl = filePrefixRoot(root, targetdir + dst_prl);
|
2020-02-12 14:27:27 +00:00
|
|
|
if (!ret.isEmpty())
|
|
|
|
ret += "\n\t";
|
2013-01-10 23:30:25 +00:00
|
|
|
ret += installMetaFile(ProKey("QMAKE_PRL_INSTALL_REPLACE"), project->first("QMAKE_INTERNAL_PRL_FILE").toQString(), dst_prl);
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!uninst.isEmpty())
|
|
|
|
uninst.append("\n\t");
|
2015-02-06 14:30:02 +00:00
|
|
|
uninst.append("-$(DEL_FILE) " + escapeFilePath(dst_prl));
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
if(project->isActiveConfig("create_pc")) {
|
|
|
|
QString dst_pc = pkgConfigFileName(false);
|
|
|
|
if (!dst_pc.isEmpty()) {
|
|
|
|
dst_pc = filePrefixRoot(root, targetdir + dst_pc);
|
2012-10-09 12:47:46 +00:00
|
|
|
const QString dst_pc_dir = Option::fixPathToTargetOS(fileInfo(dst_pc).path(), false);
|
2012-02-07 14:28:55 +00:00
|
|
|
if (!dst_pc_dir.isEmpty()) {
|
|
|
|
if (!ret.isEmpty())
|
|
|
|
ret += "\n\t";
|
|
|
|
ret += mkdir_p_asstring(dst_pc_dir, true);
|
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!ret.isEmpty())
|
|
|
|
ret += "\n\t";
|
2013-01-10 23:30:41 +00:00
|
|
|
ret += installMetaFile(ProKey("QMAKE_PKGCONFIG_INSTALL_REPLACE"), pkgConfigFileName(true), dst_pc);
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!uninst.isEmpty())
|
|
|
|
uninst.append("\n\t");
|
2015-02-06 14:30:02 +00:00
|
|
|
uninst.append("-$(DEL_FILE) " + escapeFilePath(dst_pc));
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if(project->isActiveConfig("shared") && !project->isActiveConfig("plugin")) {
|
2015-09-29 10:44:30 +00:00
|
|
|
ProString lib_target = project->first("LIB_TARGET");
|
2015-02-06 14:30:02 +00:00
|
|
|
QString src_targ = escapeFilePath(
|
|
|
|
(project->isEmpty("DESTDIR") ? QString("$(DESTDIR)") : project->first("DESTDIR"))
|
|
|
|
+ lib_target);
|
|
|
|
QString dst_targ = escapeFilePath(
|
|
|
|
filePrefixRoot(root, fileFixify(targetdir + lib_target, FileFixifyAbsolute)));
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!ret.isEmpty())
|
|
|
|
ret += "\n\t";
|
2015-02-06 14:30:02 +00:00
|
|
|
ret += QString("-$(INSTALL_FILE) ") + src_targ + ' ' + dst_targ;
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!uninst.isEmpty())
|
|
|
|
uninst.append("\n\t");
|
2015-02-06 14:30:02 +00:00
|
|
|
uninst.append("-$(DEL_FILE) " + dst_targ);
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-06 10:21:38 +00:00
|
|
|
if (t == "dlltarget" || project->values(ProKey(t + ".CONFIG")).indexOf("no_dll") == -1) {
|
2011-04-27 10:05:43 +00:00
|
|
|
QString src_targ = "$(DESTDIR_TARGET)";
|
2015-02-06 14:30:02 +00:00
|
|
|
QString dst_targ = escapeFilePath(
|
|
|
|
filePrefixRoot(root, fileFixify(targetdir + "$(TARGET)", FileFixifyAbsolute)));
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!ret.isEmpty())
|
|
|
|
ret += "\n\t";
|
2015-02-06 14:30:02 +00:00
|
|
|
ret += QString("-$(INSTALL_FILE) ") + src_targ + ' ' + dst_targ;
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!uninst.isEmpty())
|
|
|
|
uninst.append("\n\t");
|
2015-02-06 14:30:02 +00:00
|
|
|
uninst.append("-$(DEL_FILE) " + dst_targ);
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2019-05-10 08:50:19 +00:00
|
|
|
void Win32MakefileGenerator::writeDefaultVariables(QTextStream &t)
|
|
|
|
{
|
|
|
|
MakefileGenerator::writeDefaultVariables(t);
|
|
|
|
t << "IDC = " << (project->isEmpty("QMAKE_IDC") ? QString("idc") : var("QMAKE_IDC"))
|
|
|
|
<< Qt::endl;
|
|
|
|
t << "IDL = " << (project->isEmpty("QMAKE_IDL") ? QString("midl") : var("QMAKE_IDL"))
|
|
|
|
<< Qt::endl;
|
|
|
|
t << "ZIP = " << var("QMAKE_ZIP") << Qt::endl;
|
|
|
|
t << "DEF_FILE = " << fileVar("DEF_FILE") << Qt::endl;
|
|
|
|
t << "RES_FILE = " << fileVar("RES_FILE") << Qt::endl; // Not on mingw, can't see why not though...
|
|
|
|
t << "SED = " << var("QMAKE_STREAM_EDITOR") << Qt::endl;
|
|
|
|
t << "MOVE = " << var("QMAKE_MOVE") << Qt::endl;
|
|
|
|
}
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
QString Win32MakefileGenerator::escapeFilePath(const QString &path) const
|
|
|
|
{
|
|
|
|
QString ret = path;
|
|
|
|
if(!ret.isEmpty()) {
|
2014-04-04 17:02:49 +00:00
|
|
|
if (ret.contains(' ') || ret.contains('\t'))
|
2011-04-27 10:05:43 +00:00
|
|
|
ret = "\"" + ret + "\"";
|
|
|
|
debug_msg(2, "EscapeFilePath: %s -> %s", path.toLatin1().constData(), ret.toLatin1().constData());
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2018-06-08 19:18:11 +00:00
|
|
|
QString Win32MakefileGenerator::escapeDependencyPath(const QString &path) const
|
|
|
|
{
|
|
|
|
QString ret = path;
|
|
|
|
if (!ret.isEmpty()) {
|
|
|
|
static const QRegExp criticalChars(QStringLiteral("([\t #])"));
|
|
|
|
if (ret.contains(criticalChars))
|
|
|
|
ret = "\"" + ret + "\"";
|
|
|
|
debug_msg(2, "EscapeDependencyPath: %s -> %s", path.toLatin1().constData(), ret.toLatin1().constData());
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2012-12-20 01:38:54 +00:00
|
|
|
QString Win32MakefileGenerator::cQuoted(const QString &str)
|
|
|
|
{
|
|
|
|
QString ret = str;
|
2016-02-04 14:12:03 +00:00
|
|
|
ret.replace(QLatin1Char('\\'), QLatin1String("\\\\"));
|
|
|
|
ret.replace(QLatin1Char('"'), QLatin1String("\\\""));
|
2012-12-20 01:38:54 +00:00
|
|
|
ret.prepend(QLatin1Char('"'));
|
|
|
|
ret.append(QLatin1Char('"'));
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2014-10-29 14:11:57 +00:00
|
|
|
QString Win32MakefileGenerator::getManifestFileForRcFile() const
|
|
|
|
{
|
|
|
|
return QString();
|
|
|
|
}
|
|
|
|
|
2019-07-31 11:53:24 +00:00
|
|
|
ProKey Win32MakefileGenerator::fullTargetVariable() const
|
|
|
|
{
|
|
|
|
return "DEST_TARGET";
|
|
|
|
}
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
QT_END_NAMESPACE
|