From 16785c4c149d0e7188924fa5e01b153d4baeabfd Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 26 Jun 2012 14:23:38 +0200 Subject: do not unnecessarily mess with CONFIG it could/would bite us later Change-Id: I73f989e7603c6e5b7b85fc4ee4ad2557c1b02d80 Reviewed-by: Mark Brand --- .../tools/qmake/testdata/functions/functions.pro | 14 +++++++------- .../tools/qmake/testdata/operators/operators.pro | 22 +++++++++++----------- .../tools/qmake/testdata/variables/variables.pro | 16 ++++++++-------- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/tests/auto/tools/qmake/testdata/functions/functions.pro b/tests/auto/tools/qmake/testdata/functions/functions.pro index daab1fd954..6660e8d4fa 100644 --- a/tests/auto/tools/qmake/testdata/functions/functions.pro +++ b/tests/auto/tools/qmake/testdata/functions/functions.pro @@ -1,17 +1,17 @@ -CONFIG = qt thread +VAR = qt thread defineTest(testReplace) { !isEqual(1, $$2):message("FAILED: $$3: got $$1, expected $${2}.") } #count -!count( CONFIG, 2 ) { - message( "FAILED: count function: $$CONFIG" ) +!count( VAR, 2 ) { + message( "FAILED: count function: $$VAR" ) } #contains -!contains( CONFIG, thread ) { - message( "FAILED: contains function: $$CONFIG" ) +!contains( VAR, thread ) { + message( "FAILED: contains function: $$VAR" ) } #exists @@ -20,8 +20,8 @@ defineTest(testReplace) { } #isEmpty -isEmpty( CONFIG ) { - message( "FAILED: isEmpty function: $CONFIG" ) +isEmpty( VAR ) { + message( "FAILED: isEmpty function: $VAR" ) } #files diff --git a/tests/auto/tools/qmake/testdata/operators/operators.pro b/tests/auto/tools/qmake/testdata/operators/operators.pro index 5285c1a982..d6eb3d13c7 100644 --- a/tests/auto/tools/qmake/testdata/operators/operators.pro +++ b/tests/auto/tools/qmake/testdata/operators/operators.pro @@ -1,24 +1,24 @@ -CONFIG = qt thread +VAR = qt thread -CONFIG += debug -!contains( CONFIG, debug ) { +VAR += debug +!contains( VAR, debug ) { message( "FAILED: +=" ) } -CONFIG -= thread -contains( CONFIG, thread ) { +VAR -= thread +contains( VAR, thread ) { message( "FAILED: -=" ) } -CONFIG = thread -CONFIG *= thread -!count( CONFIG, 1 ) { +VAR = thread +VAR *= thread +!count( VAR, 1 ) { message( "FAILED: *=" ) } -CONFIG = thread QT_DLL debug -CONFIG ~= s/QT_+/Q_ -!contains( CONFIG, Q_DLL ) { +VAR = thread QT_DLL debug +VAR ~= s/QT_+/Q_ +!contains( VAR, Q_DLL ) { message( "FAILED: ~=" ) } diff --git a/tests/auto/tools/qmake/testdata/variables/variables.pro b/tests/auto/tools/qmake/testdata/variables/variables.pro index cefcddf0fb..d5d1e56939 100644 --- a/tests/auto/tools/qmake/testdata/variables/variables.pro +++ b/tests/auto/tools/qmake/testdata/variables/variables.pro @@ -1,14 +1,14 @@ -CONFIG = 1 2 3 4 5 -JOINEDCONFIG = $$join( CONFIG, "-GLUE-", "-BEFORE-", "-AFTER-" ) -!contains( JOINEDCONFIG, -BEFORE-1-GLUE-2-GLUE-3-GLUE-4-GLUE-5-AFTER- ) { - message( "FAILED: join [$$JOINEDCONFIG != -BEFORE-1-GLUE-2-GLUE-3-GLUE-4-GLUE-5-AFTER-]" ) +VAR = 1 2 3 4 5 +JOINEDVAR = $$join( VAR, "-GLUE-", "-BEFORE-", "-AFTER-" ) +!contains( JOINEDVAR, -BEFORE-1-GLUE-2-GLUE-3-GLUE-4-GLUE-5-AFTER- ) { + message( "FAILED: join [$$JOINEDVAR != -BEFORE-1-GLUE-2-GLUE-3-GLUE-4-GLUE-5-AFTER-]" ) } # To test member we need to use join -NEWCONFIG = $$member( CONFIG, 4 ) $$member( CONFIG, 3 ) $$member( CONFIG, 2 ) -JOINEDNEWCONFIG = $$join( NEWCONFIG, "-" ) -!contains( JOINEDNEWCONFIG, 5-4-3 ) { - message( "FAILED: member [$$JOINEDNEWCONFIG != 5-4-3]" ) +NEWVAR = $$member( VAR, 4 ) $$member( VAR, 3 ) $$member( VAR, 2 ) +JOINEDNEWVAR = $$join( NEWVAR, "-" ) +!contains( JOINEDNEWVAR, 5-4-3 ) { + message( "FAILED: member [$$JOINEDNEWVAR != 5-4-3]" ) } -- cgit v1.2.3 From fc1bca86081dc0698a7dd3f9c955edd194d5a798 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 16 Apr 2012 17:02:57 +0200 Subject: repurpose -unix/-macx/-win32 options they have been deprecated long enough, so we can mess with them now. don't make them set the target mode any more; the makespec can do that autoritatively. instead, they can be used to override the host mode for debugging purposes. Change-Id: Ife5fdcf4f1b6b926901a80896ac92b7d821278d1 Reviewed-by: Joerg Bornemann --- qmake/generators/makefile.cpp | 8 -------- qmake/option.cpp | 10 ---------- qmake/option.h | 1 - 3 files changed, 19 deletions(-) diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index f126da3280..2a21aa9880 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -2196,14 +2196,6 @@ QString MakefileGenerator::buildArgs(const QString &outdir) ret += " -spec " + fixifySpecdir(Option::mkfile::qmakespec, outdir); if (!Option::mkfile::xqmakespec_commandline.isEmpty()) ret += " -xspec " + fixifySpecdir(Option::mkfile::xqmakespec, outdir); - if (Option::target_mode_overridden) { - if (Option::target_mode == Option::TARG_MACX_MODE) - ret += " -macx"; - else if (Option::target_mode == Option::TARG_UNIX_MODE) - ret += " -unix"; - else if (Option::target_mode == Option::TARG_WIN_MODE) - ret += " -win32"; - } //arguments for(QStringList::Iterator it = Option::before_user_vars.begin(); diff --git a/qmake/option.cpp b/qmake/option.cpp index 714aebe6ef..73c2e32abc 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -94,7 +94,6 @@ QString Option::user_template_prefix; QStringList Option::shellPath; Option::HOST_MODE Option::host_mode = Option::HOST_UNKNOWN_MODE; Option::TARG_MODE Option::target_mode = Option::TARG_UNKNOWN_MODE; -bool Option::target_mode_overridden = false; //QMAKE_*_PROPERTY stuff QStringList Option::prop::properties; @@ -262,20 +261,11 @@ Option::parseCommandLine(int argc, char **argv, int skip) } else if(opt == "tp" || opt == "template_prefix") { Option::user_template_prefix = argv[++x]; } else if(opt == "macx") { - fprintf(stderr, "-macx is deprecated.\n"); Option::host_mode = HOST_MACX_MODE; - Option::target_mode = TARG_MACX_MODE; - Option::target_mode_overridden = true; } else if(opt == "unix") { - fprintf(stderr, "-unix is deprecated.\n"); Option::host_mode = HOST_UNIX_MODE; - Option::target_mode = TARG_UNIX_MODE; - Option::target_mode_overridden = true; } else if(opt == "win32") { - fprintf(stderr, "-win32 is deprecated.\n"); Option::host_mode = HOST_WIN_MODE; - Option::target_mode = TARG_WIN_MODE; - Option::target_mode_overridden = true; } else if(opt == "integrity") { Option::target_mode = TARG_INTEGRITY_MODE; } else if(opt == "d") { diff --git a/qmake/option.h b/qmake/option.h index 7b86d56e89..88ad989b82 100644 --- a/qmake/option.h +++ b/qmake/option.h @@ -177,7 +177,6 @@ struct Option enum TARG_MODE { TARG_UNKNOWN_MODE, TARG_UNIX_MODE, TARG_WIN_MODE, TARG_MACX_MODE, TARG_INTEGRITY_MODE }; static TARG_MODE target_mode; - static bool target_mode_overridden; static QString user_template, user_template_prefix; static QStringList shellPath; -- cgit v1.2.3 From 0ce1a6ba244c934b5b4504abb980806793d54515 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 16 Apr 2012 17:12:53 +0200 Subject: don't let the make spec determine the host mode any more (some of) the generators are (moderately) x-platform, so it makes no sense to nail the host platform to a generator (and thus a spec). overriding the host platform is only a debugging mesasure anyway, so one can use the (now undocumented) -unix/-macx/-win32 options for that. Change-Id: If2a059f1feeb2c726e5838625ede1c7add829985 Reviewed-by: Joerg Bornemann Reviewed-by: Mark Brand --- qmake/generators/metamakefile.cpp | 18 +--------------- qmake/generators/metamakefile.h | 3 +-- qmake/option.cpp | 31 +++++++++++++-------------- qmake/option.h | 1 - qmake/project.cpp | 44 ++++++++++++++------------------------- 5 files changed, 33 insertions(+), 64 deletions(-) diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp index a1ab4ada75..3243aebb3b 100644 --- a/qmake/generators/metamakefile.cpp +++ b/qmake/generators/metamakefile.cpp @@ -515,37 +515,21 @@ MetaMakefileGenerator::createMetaGenerator(QMakeProject *proj, const QString &na #endif // QT_QMAKE_PARSER_ONLY bool -MetaMakefileGenerator::modesForGenerator(const QString &gen, - Option::HOST_MODE *host_mode, Option::TARG_MODE *target_mode) +MetaMakefileGenerator::modeForGenerator(const QString &gen, Option::TARG_MODE *target_mode) { if (gen == "UNIX") { #ifdef Q_OS_MAC - *host_mode = Option::HOST_MACX_MODE; *target_mode = Option::TARG_MACX_MODE; -#elif defined(Q_OS_WIN) - *host_mode = Option::HOST_WIN_MODE; - *target_mode = Option::TARG_UNIX_MODE; #else - *host_mode = Option::HOST_UNIX_MODE; *target_mode = Option::TARG_UNIX_MODE; #endif } else if (gen == "MSVC.NET" || gen == "BMAKE" || gen == "MSBUILD") { - *host_mode = Option::HOST_WIN_MODE; *target_mode = Option::TARG_WIN_MODE; } else if (gen == "MINGW") { -#if defined(Q_OS_MAC) - *host_mode = Option::HOST_MACX_MODE; -#elif defined(Q_OS_UNIX) - *host_mode = Option::HOST_UNIX_MODE; -#else - *host_mode = Option::HOST_WIN_MODE; -#endif *target_mode = Option::TARG_WIN_MODE; } else if (gen == "PROJECTBUILDER" || gen == "XCODE") { - *host_mode = Option::HOST_MACX_MODE; *target_mode = Option::TARG_MACX_MODE; } else if (gen == "GBUILD") { - *host_mode = Option::HOST_UNIX_MODE; *target_mode = Option::TARG_INTEGRITY_MODE; } else { fprintf(stderr, "Unknown generator specified: %s\n", gen.toLatin1().constData()); diff --git a/qmake/generators/metamakefile.h b/qmake/generators/metamakefile.h index 4e2e7c502e..a6889fd6cd 100644 --- a/qmake/generators/metamakefile.h +++ b/qmake/generators/metamakefile.h @@ -67,8 +67,7 @@ public: static MetaMakefileGenerator *createMetaGenerator(QMakeProject *proj, const QString &name, bool op=true, bool *success = 0); static MakefileGenerator *createMakefileGenerator(QMakeProject *proj, bool noIO = false); - static bool modesForGenerator(const QString &generator, - Option::HOST_MODE *host_mode, Option::TARG_MODE *target_mode); + static bool modeForGenerator(const QString &generator, Option::TARG_MODE *target_mode); inline QMakeProject *projectFile() const { return project; } diff --git a/qmake/option.cpp b/qmake/option.cpp index 73c2e32abc..defe2bff28 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -401,6 +401,13 @@ static QStringList detectShellPath() int Option::init(int argc, char **argv) { +#if defined(Q_OS_MAC) + Option::host_mode = Option::HOST_MACX_MODE; +#elif defined(Q_OS_UNIX) + Option::host_mode = Option::HOST_UNIX_MODE; +#else + Option::host_mode = Option::HOST_WIN_MODE; +#endif Option::application_argv0 = 0; Option::cpp_moc_mod = ""; Option::h_moc_mod = "moc_"; @@ -554,32 +561,24 @@ Option::init(int argc, char **argv) } } else if (Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) { #if defined(Q_OS_MAC) - Option::host_mode = Option::HOST_MACX_MODE; Option::target_mode = Option::TARG_MACX_MODE; #elif defined(Q_OS_UNIX) - Option::host_mode = Option::HOST_UNIX_MODE; Option::target_mode = Option::TARG_UNIX_MODE; #else - Option::host_mode = Option::HOST_WIN_MODE; Option::target_mode = Option::TARG_WIN_MODE; #endif } //defaults for globals - if (Option::host_mode != Option::HOST_UNKNOWN_MODE) - applyHostMode(); - return QMAKE_CMDLINE_SUCCESS; -} + if (Option::host_mode == Option::HOST_WIN_MODE) { + Option::dir_sep = "\\"; + Option::obj_ext = ".obj"; + } else { + Option::dir_sep = "/"; + Option::obj_ext = ".o"; + } -void Option::applyHostMode() -{ - if (Option::host_mode == Option::HOST_WIN_MODE) { - Option::dir_sep = "\\"; - Option::obj_ext = ".obj"; - } else { - Option::dir_sep = "/"; - Option::obj_ext = ".o"; - } + return QMAKE_CMDLINE_SUCCESS; } void Option::prepareProject(const QString &pfile) diff --git a/qmake/option.h b/qmake/option.h index 88ad989b82..10d696ec68 100644 --- a/qmake/option.h +++ b/qmake/option.h @@ -106,7 +106,6 @@ struct Option //both of these must be called.. static int init(int argc=0, char **argv=0); //parse cmdline - static void applyHostMode(); static void prepareProject(const QString &pfile); static bool postProcessProject(QMakeProject *); diff --git a/qmake/project.cpp b/qmake/project.cpp index 360c0958f1..1eb41ecfda 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -1600,37 +1600,27 @@ QMakeProject::read(uchar cmd) void QMakeProject::validateModes() { - if (Option::host_mode == Option::HOST_UNKNOWN_MODE - || Option::target_mode == Option::TARG_UNKNOWN_MODE) { - Option::HOST_MODE host_mode; + if (Option::target_mode == Option::TARG_UNKNOWN_MODE) { Option::TARG_MODE target_mode; const QStringList &gen = base_vars.value("MAKEFILE_GENERATOR"); if (gen.isEmpty()) { fprintf(stderr, "%s:%d: Using OS scope before setting MAKEFILE_GENERATOR\n", parser.file.toLatin1().constData(), parser.line_no); - } else if (MetaMakefileGenerator::modesForGenerator(gen.first(), - &host_mode, &target_mode)) { - if (Option::host_mode == Option::HOST_UNKNOWN_MODE) { - Option::host_mode = host_mode; - Option::applyHostMode(); - } - - if (Option::target_mode == Option::TARG_UNKNOWN_MODE) { - const QStringList &tgt = base_vars.value("TARGET_PLATFORM"); - if (!tgt.isEmpty()) { - const QString &os = tgt.first(); - if (os == "unix") - Option::target_mode = Option::TARG_UNIX_MODE; - else if (os == "macx") - Option::target_mode = Option::TARG_MACX_MODE; - else if (os == "win32") - Option::target_mode = Option::TARG_WIN_MODE; - else - fprintf(stderr, "Unknown target platform specified: %s\n", - os.toLatin1().constData()); - } else { - Option::target_mode = target_mode; - } + } else if (MetaMakefileGenerator::modeForGenerator(gen.first(), &target_mode)) { + const QStringList &tgt = base_vars.value("TARGET_PLATFORM"); + if (!tgt.isEmpty()) { + const QString &os = tgt.first(); + if (os == "unix") + Option::target_mode = Option::TARG_UNIX_MODE; + else if (os == "macx") + Option::target_mode = Option::TARG_MACX_MODE; + else if (os == "win32") + Option::target_mode = Option::TARG_WIN_MODE; + else + fprintf(stderr, "Unknown target platform specified: %s\n", + os.toLatin1().constData()); + } else { + Option::target_mode = target_mode; } } } @@ -1752,7 +1742,6 @@ QMakeProject::doProjectInclude(QString file, uchar flags, QHash Date: Tue, 17 Apr 2012 11:53:04 +0200 Subject: purge the integrity target mode it wasn't really wired, so the only effect it had was disabling the unix scopes (despite an attempt to override that in the spec, which probably worked before qt 4.6, and will start working again soon). Change-Id: I95daff75b508edaf83a8a06fd327350acd62b124 Reviewed-by: Rolland Dudemaine Reviewed-by: Mark Brand --- qmake/generators/metamakefile.cpp | 2 +- qmake/option.cpp | 2 -- qmake/option.h | 3 +-- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp index 3243aebb3b..54ab4759c2 100644 --- a/qmake/generators/metamakefile.cpp +++ b/qmake/generators/metamakefile.cpp @@ -530,7 +530,7 @@ MetaMakefileGenerator::modeForGenerator(const QString &gen, Option::TARG_MODE *t } else if (gen == "PROJECTBUILDER" || gen == "XCODE") { *target_mode = Option::TARG_MACX_MODE; } else if (gen == "GBUILD") { - *target_mode = Option::TARG_INTEGRITY_MODE; + *target_mode = Option::TARG_UNIX_MODE; } else { fprintf(stderr, "Unknown generator specified: %s\n", gen.toLatin1().constData()); return false; diff --git a/qmake/option.cpp b/qmake/option.cpp index defe2bff28..4d97d4d1dd 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -266,8 +266,6 @@ Option::parseCommandLine(int argc, char **argv, int skip) Option::host_mode = HOST_UNIX_MODE; } else if(opt == "win32") { Option::host_mode = HOST_WIN_MODE; - } else if(opt == "integrity") { - Option::target_mode = TARG_INTEGRITY_MODE; } else if(opt == "d") { Option::debug_level++; } else if(opt == "version" || opt == "v" || opt == "-version") { diff --git a/qmake/option.h b/qmake/option.h index 10d696ec68..09922e9c00 100644 --- a/qmake/option.h +++ b/qmake/option.h @@ -173,8 +173,7 @@ struct Option static QStringList before_user_vars, after_user_vars; enum HOST_MODE { HOST_UNKNOWN_MODE, HOST_UNIX_MODE, HOST_WIN_MODE, HOST_MACX_MODE }; static HOST_MODE host_mode; - enum TARG_MODE { TARG_UNKNOWN_MODE, TARG_UNIX_MODE, TARG_WIN_MODE, TARG_MACX_MODE, - TARG_INTEGRITY_MODE }; + enum TARG_MODE { TARG_UNKNOWN_MODE, TARG_UNIX_MODE, TARG_WIN_MODE, TARG_MACX_MODE }; static TARG_MODE target_mode; static QString user_template, user_template_prefix; static QStringList shellPath; -- cgit v1.2.3 From 5ced28ed3f7b8fc501742500aa32ebed7272a4fc Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 12 Mar 2012 15:17:36 +0100 Subject: eliminate some use of base_vars this limits references to this variable to its setup and explicit cache manipulation. Change-Id: I88dd2418051501abea201f223da7759a15f1c249 Reviewed-by: Joerg Bornemann Reviewed-by: Mark Brand --- qmake/project.cpp | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/qmake/project.cpp b/qmake/project.cpp index 1eb41ecfda..53f8d544fb 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -1326,12 +1326,12 @@ QMakeProject::read(uchar cmd) again: if ((cmd & ReadSetup) && base_vars.isEmpty()) { // hack to get the Option stuff in there - base_vars["QMAKE_EXT_CPP"] = Option::cpp_ext; - base_vars["QMAKE_EXT_C"] = Option::c_ext; - base_vars["QMAKE_EXT_H"] = Option::h_ext; - base_vars["QMAKE_SH"] = Option::shellPath; + vars["QMAKE_EXT_CPP"] = Option::cpp_ext; + vars["QMAKE_EXT_C"] = Option::c_ext; + vars["QMAKE_EXT_H"] = Option::h_ext; + vars["QMAKE_SH"] = Option::shellPath; if(!Option::user_template_prefix.isEmpty()) - base_vars["TEMPLATE_PREFIX"] = QStringList(Option::user_template_prefix); + vars["TEMPLATE_PREFIX"] = QStringList(Option::user_template_prefix); QString superdir; QString project_root; @@ -1470,7 +1470,7 @@ QMakeProject::read(uchar cmd) // here without resorting to tricks. This is the only planned use case anyway. if (!superfile.isEmpty()) { debug_msg(1, "Project super cache file: reading %s", superfile.toLatin1().constData()); - read(superfile, base_vars); + read(superfile, vars); } // parse qmake configuration @@ -1478,7 +1478,7 @@ QMakeProject::read(uchar cmd) qmakespec.truncate(qmakespec.length()-1); QString spec = qmakespec + QLatin1String("/qmake.conf"); debug_msg(1, "QMAKESPEC conf: reading %s", spec.toLatin1().constData()); - if(!read(spec, base_vars)) { + if (!read(spec, vars)) { fprintf(stderr, "Failure to read QMAKESPEC conf file %s.\n", spec.toLatin1().constData()); return false; } @@ -1486,16 +1486,18 @@ QMakeProject::read(uchar cmd) if (!conffile.isEmpty()) { debug_msg(1, "Project config file: reading %s", conffile.toLatin1().constData()); - read(conffile, base_vars); + read(conffile, vars); } if (!cachefile.isEmpty()) { debug_msg(1, "QMAKECACHE file: reading %s", cachefile.toLatin1().constData()); - read(cachefile, base_vars); + read(cachefile, vars); } } - } - vars = base_vars; // start with the base + base_vars = vars; + } else { + vars = base_vars; // start with the base + } for (QHash::ConstIterator it = extra_vars.constBegin(); it != extra_vars.constEnd(); ++it) @@ -1602,12 +1604,12 @@ void QMakeProject::validateModes() { if (Option::target_mode == Option::TARG_UNKNOWN_MODE) { Option::TARG_MODE target_mode; - const QStringList &gen = base_vars.value("MAKEFILE_GENERATOR"); + const QStringList &gen = vars.value("MAKEFILE_GENERATOR"); if (gen.isEmpty()) { fprintf(stderr, "%s:%d: Using OS scope before setting MAKEFILE_GENERATOR\n", parser.file.toLatin1().constData(), parser.line_no); } else if (MetaMakefileGenerator::modeForGenerator(gen.first(), &target_mode)) { - const QStringList &tgt = base_vars.value("TARGET_PLATFORM"); + const QStringList &tgt = vars.value("TARGET_PLATFORM"); if (!tgt.isEmpty()) { const QString &os = tgt.first(); if (os == "unix") @@ -1641,7 +1643,7 @@ QMakeProject::resolveSpec(QString *spec, const QString &qmakespec) #else // We can't resolve symlinks as they do on Unix, so configure.exe puts the source of the // qmake.conf at the end of the default/qmake.conf in the QMAKESPEC_ORG variable. - const QStringList &spec_org = base_vars["QMAKESPEC_ORIGINAL"]; + const QStringList &spec_org = vars["QMAKESPEC_ORIGINAL"]; if (spec_org.isEmpty()) { // try again the next time around *spec = QString(); -- cgit v1.2.3 From 88b4ee22c9b3bf4bc94048df259c50b90d783e8f Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 17 Apr 2012 14:30:15 +0200 Subject: prune feature search paths which don't actually exist this should significantly cut down the time wasted looking for files in non-existing directories, in particular on windows. Change-Id: I7ab3523fe8c028e3787ebc78e4543ab04f53448e Reviewed-by: Joerg Bornemann --- qmake/project.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/qmake/project.cpp b/qmake/project.cpp index 53f8d544fb..92c07825cb 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -627,7 +627,12 @@ QStringList qmake_feature_paths(QMakeProperty *prop, bool host_build) QLibraryInfo::EffectivePaths) + mkspecs_concat + (*concat_it)); feature_roots.removeDuplicates(); - return feature_roots; + + QStringList ret; + foreach (const QString &root, feature_roots) + if (QFileInfo(root).exists()) + ret << root; + return ret; } QStringList qmake_mkspec_paths() -- cgit v1.2.3 From 777fa561ab3af83ac78dbe55a22ae28097f0dfbd Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 17 Apr 2012 12:21:11 +0200 Subject: read spec_pre and spec_post features these are read before the qmakespec and before the cache, resp. this will allow moving some hard-wired logic out of qmake. Change-Id: I6a63050d7798bc30a4add8c009bcd801a29a0deb Reviewed-by: Joerg Bornemann --- qmake/project.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qmake/project.cpp b/qmake/project.cpp index 92c07825cb..e7aee48dbe 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -1479,6 +1479,7 @@ QMakeProject::read(uchar cmd) } // parse qmake configuration + doProjectInclude("spec_pre", IncludeFlagFeature, vars); while(qmakespec.endsWith(QLatin1Char('/'))) qmakespec.truncate(qmakespec.length()-1); QString spec = qmakespec + QLatin1String("/qmake.conf"); @@ -1487,6 +1488,7 @@ QMakeProject::read(uchar cmd) fprintf(stderr, "Failure to read QMAKESPEC conf file %s.\n", spec.toLatin1().constData()); return false; } + doProjectInclude("spec_post", IncludeFlagFeature, vars); validateModes(); if (!conffile.isEmpty()) { -- cgit v1.2.3 From 4753958db707001d1e14fa8312708dc1e891bacc Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 17 Apr 2012 12:15:39 +0200 Subject: revamp handling of qmake target mode the project evaluator becomes oblivious of the target mode. the mode is set up in spec_post.prf according to the spec. $$QMAKE_TARGET contains the feature suffixes to search, and is also contained in $$CONFIG. the target_mode variable itself becomes private to the Makefile class. Change-Id: I3c06d9dab536b753343cec6c5c491d3203e50bd8 Reviewed-by: Mark Brand --- mkspecs/features/spec_post.prf | 31 ++++++++++++++++++ qmake/generators/makefile.cpp | 8 ++++- qmake/generators/makefile.h | 2 ++ qmake/generators/metamakefile.cpp | 23 ------------- qmake/generators/metamakefile.h | 4 --- qmake/generators/unix/unixmake.cpp | 19 +++++------ qmake/option.cpp | 9 ----- qmake/option.h | 2 -- qmake/project.cpp | 67 ++++---------------------------------- qmake/project.h | 2 +- 10 files changed, 57 insertions(+), 110 deletions(-) create mode 100644 mkspecs/features/spec_post.prf diff --git a/mkspecs/features/spec_post.prf b/mkspecs/features/spec_post.prf new file mode 100644 index 0000000000..fcc7314ce5 --- /dev/null +++ b/mkspecs/features/spec_post.prf @@ -0,0 +1,31 @@ +isEmpty(MAKEFILE_GENERATOR):error("Qmake spec does not set MAKEFILE_GENERATOR.") +isEmpty(QMAKE_PLATFORM) { + isEmpty(TARGET_PLATFORM) { + equals(MAKEFILE_GENERATOR, UNIX) { + equals(QMAKE_HOST.os, Darwin): \ + TARGET_PLATFORM = macx + else: \ + TARGET_PLATFORM = unix + } else:if(equals(MAKEFILE_GENERATOR, MSVC.NET) \ + |equals(MAKEFILE_GENERATOR, BMAKE) \ + |equals(MAKEFILE_GENERATOR, MSBUILD) \ + |equals(MAKEFILE_GENERATOR, MINGW)) { + TARGET_PLATFORM = win32 + } else:if(equals(MAKEFILE_GENERATOR, PROJECTBUILDER) \ + |equals(MAKEFILE_GENERATOR, XCODE)) { + } else:equals(MAKEFILE_GENERATOR, GBUILD) { + TARGET_PLATFORM = unix + } else { + error("Qmake spec sets an invalid MAKEFILE_GENERATOR.") + } + } + equals(TARGET_PLATFORM, unix): \ + QMAKE_PLATFORM = unix + else:equals(TARGET_PLATFORM, macx): \ + QMAKE_PLATFORM = mac macx unix + else:equals(TARGET_PLATFORM, win32): \ + QMAKE_PLATFORM = win32 + else: \ + error("Qmake spec sets an invalid TARGET_PLATFORM.") +} +CONFIG += $$QMAKE_PLATFORM diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 2a21aa9880..f187190ac7 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -300,6 +300,12 @@ MakefileGenerator::setProjectFile(QMakeProject *p) if(project) return; project = p; + if (project->isActiveConfig("win32")) + target_mode = TARG_WIN_MODE; + else if (project->isActiveConfig("macx")) + target_mode = TARG_MACX_MODE; + else + target_mode = TARG_UNIX_MODE; init(); findLibraries(); if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE && @@ -3253,7 +3259,7 @@ MakefileGenerator::writePkgConfigFile() t << "Libs: "; QString pkgConfiglibDir; QString pkgConfiglibName; - if (Option::target_mode == Option::TARG_MACX_MODE && project->isActiveConfig("lib_bundle")) { + if (target_mode == TARG_MACX_MODE && project->isActiveConfig("lib_bundle")) { pkgConfiglibDir = "-F${libdir}"; QString bundle; if (!project->isEmpty("QMAKE_FRAMEWORK_BUNDLE_NAME")) diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h index 2cf774e2bc..b177cc7eb0 100644 --- a/qmake/generators/makefile.h +++ b/qmake/generators/makefile.h @@ -91,6 +91,8 @@ class MakefileGenerator : protected QMakeSourceFileInfo mutable QHash extraCompilerVariablesCache; protected: + enum TARG_MODE { TARG_UNIX_MODE, TARG_MACX_MODE, TARG_WIN_MODE } target_mode; + QStringList createObjectList(const QStringList &sources); //makefile style generator functions diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp index 54ab4759c2..42030507b7 100644 --- a/qmake/generators/metamakefile.cpp +++ b/qmake/generators/metamakefile.cpp @@ -514,28 +514,5 @@ MetaMakefileGenerator::createMetaGenerator(QMakeProject *proj, const QString &na #endif // QT_QMAKE_PARSER_ONLY -bool -MetaMakefileGenerator::modeForGenerator(const QString &gen, Option::TARG_MODE *target_mode) -{ - if (gen == "UNIX") { -#ifdef Q_OS_MAC - *target_mode = Option::TARG_MACX_MODE; -#else - *target_mode = Option::TARG_UNIX_MODE; -#endif - } else if (gen == "MSVC.NET" || gen == "BMAKE" || gen == "MSBUILD") { - *target_mode = Option::TARG_WIN_MODE; - } else if (gen == "MINGW") { - *target_mode = Option::TARG_WIN_MODE; - } else if (gen == "PROJECTBUILDER" || gen == "XCODE") { - *target_mode = Option::TARG_MACX_MODE; - } else if (gen == "GBUILD") { - *target_mode = Option::TARG_UNIX_MODE; - } else { - fprintf(stderr, "Unknown generator specified: %s\n", gen.toLatin1().constData()); - return false; - } - return true; -} QT_END_NAMESPACE diff --git a/qmake/generators/metamakefile.h b/qmake/generators/metamakefile.h index a6889fd6cd..846a7989f1 100644 --- a/qmake/generators/metamakefile.h +++ b/qmake/generators/metamakefile.h @@ -42,8 +42,6 @@ #ifndef METAMAKEFILE_H #define METAMAKEFILE_H -#include - #include #include @@ -67,8 +65,6 @@ public: static MetaMakefileGenerator *createMetaGenerator(QMakeProject *proj, const QString &name, bool op=true, bool *success = 0); static MakefileGenerator *createMakefileGenerator(QMakeProject *proj, bool noIO = false); - static bool modeForGenerator(const QString &generator, Option::TARG_MODE *target_mode); - inline QMakeProject *projectFile() const { return project; } virtual bool init() = 0; diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp index b8b4f1bbc5..02f8666bbb 100644 --- a/qmake/generators/unix/unixmake.cpp +++ b/qmake/generators/unix/unixmake.cpp @@ -491,9 +491,9 @@ UnixMakefileGenerator::findLibraries() } else { stub = opt.mid(2); } - } else if(Option::target_mode == Option::TARG_MACX_MODE && opt.startsWith("-F")) { + } else if (target_mode == TARG_MACX_MODE && opt.startsWith("-F")) { frameworkdirs.append(QMakeLocalFileName(opt.right(opt.length()-2))); - } else if(Option::target_mode == Option::TARG_MACX_MODE && opt.startsWith("-framework")) { + } else if (target_mode == TARG_MACX_MODE && opt.startsWith("-framework")) { if(opt.length() > 11) { opt = opt.mid(11); } else { @@ -612,11 +612,11 @@ UnixMakefileGenerator::processPrlFiles() break; } } - } else if(Option::target_mode == Option::TARG_MACX_MODE && opt.startsWith("-F")) { + } else if (target_mode == TARG_MACX_MODE && opt.startsWith("-F")) { QMakeLocalFileName f(opt.right(opt.length()-2)); if(!frameworkdirs.contains(f)) frameworkdirs.append(f); - } else if(Option::target_mode == Option::TARG_MACX_MODE && opt.startsWith("-framework")) { + } else if (target_mode == TARG_MACX_MODE && opt.startsWith("-framework")) { if(opt.length() > 11) opt = opt.mid(11); else @@ -655,7 +655,7 @@ UnixMakefileGenerator::processPrlFiles() QString arch("default"); QString opt = l.at(lit).trimmed(); if(opt.startsWith("-")) { - if (Option::target_mode == Option::TARG_MACX_MODE && opt.startsWith("-Xarch")) { + if (target_mode == TARG_MACX_MODE && opt.startsWith("-Xarch")) { if (opt.length() > 7) { arch = opt.mid(7); opt = l.at(++lit); @@ -663,7 +663,7 @@ UnixMakefileGenerator::processPrlFiles() } if(opt.startsWith("-L") || - (Option::target_mode == Option::TARG_MACX_MODE && opt.startsWith("-F"))) { + (target_mode == TARG_MACX_MODE && opt.startsWith("-F"))) { if(!lflags[arch].contains(opt)) lflags[arch].append(opt); } else if(opt.startsWith("-l") || opt == "-pthread") { @@ -671,12 +671,12 @@ UnixMakefileGenerator::processPrlFiles() if (lflags[arch].contains(opt)) lflags[arch].removeAll(opt); lflags[arch].append(opt); - } else if(Option::target_mode == Option::TARG_MACX_MODE && opt.startsWith("-framework")) { + } else if (target_mode == TARG_MACX_MODE && opt.startsWith("-framework")) { if(opt.length() > 11) opt = opt.mid(11); else { opt = l.at(++lit); - if (Option::target_mode == Option::TARG_MACX_MODE && opt.startsWith("-Xarch")) + if (target_mode == TARG_MACX_MODE && opt.startsWith("-Xarch")) opt = l.at(++lit); // The user has done the right thing and prefixed each part } bool found = false; @@ -838,8 +838,7 @@ UnixMakefileGenerator::defaultInstall(const QString &t) uninst.append("-$(DEL_FILE) \"" + dst_targ + "\""); if(!links.isEmpty()) { for(int i = 0; i < links.size(); ++i) { - if(Option::target_mode == Option::TARG_UNIX_MODE || - Option::target_mode == Option::TARG_MACX_MODE) { + if (target_mode == TARG_UNIX_MODE || target_mode == TARG_MACX_MODE) { QString link = Option::fixPathToTargetOS(destdir + links[i], false); int lslash = link.lastIndexOf(Option::dir_sep); if(lslash != -1) diff --git a/qmake/option.cpp b/qmake/option.cpp index 4d97d4d1dd..aaf9b55363 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -93,7 +93,6 @@ QString Option::user_template; QString Option::user_template_prefix; QStringList Option::shellPath; Option::HOST_MODE Option::host_mode = Option::HOST_UNKNOWN_MODE; -Option::TARG_MODE Option::target_mode = Option::TARG_UNKNOWN_MODE; //QMAKE_*_PROPERTY stuff QStringList Option::prop::properties; @@ -557,14 +556,6 @@ Option::init(int argc, char **argv) } #endif } - } else if (Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) { -#if defined(Q_OS_MAC) - Option::target_mode = Option::TARG_MACX_MODE; -#elif defined(Q_OS_UNIX) - Option::target_mode = Option::TARG_UNIX_MODE; -#else - Option::target_mode = Option::TARG_WIN_MODE; -#endif } //defaults for globals diff --git a/qmake/option.h b/qmake/option.h index 09922e9c00..32bc06bc61 100644 --- a/qmake/option.h +++ b/qmake/option.h @@ -173,8 +173,6 @@ struct Option static QStringList before_user_vars, after_user_vars; enum HOST_MODE { HOST_UNKNOWN_MODE, HOST_UNIX_MODE, HOST_WIN_MODE, HOST_MACX_MODE }; static HOST_MODE host_mode; - enum TARG_MODE { TARG_UNKNOWN_MODE, TARG_UNIX_MODE, TARG_WIN_MODE, TARG_MACX_MODE }; - static TARG_MODE target_mode; static QString user_template, user_template_prefix; static QStringList shellPath; diff --git a/qmake/project.cpp b/qmake/project.cpp index e7aee48dbe..a9d4042908 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -565,28 +565,14 @@ static void qmake_error_msg(const QString &msg) 1) features/(unix|win32|macx)/ 2) features/ */ -QStringList qmake_feature_paths(QMakeProperty *prop, bool host_build) +QStringList QMakeProject::qmakeFeaturePaths() { const QString mkspecs_concat = QLatin1String("/mkspecs"); const QString base_concat = QLatin1String("/features"); QStringList concat; - { - switch(Option::target_mode) { - case Option::TARG_MACX_MODE: //also a unix - concat << base_concat + QLatin1String("/mac"); - concat << base_concat + QLatin1String("/macx"); - concat << base_concat + QLatin1String("/unix"); - break; - default: // Can't happen, just make the compiler shut up - case Option::TARG_UNIX_MODE: - concat << base_concat + QLatin1String("/unix"); - break; - case Option::TARG_WIN_MODE: - concat << base_concat + QLatin1String("/win32"); - break; - } - concat << base_concat; - } + foreach (const QString &sfx, values("QMAKE_PLATFORM")) + concat << base_concat + QLatin1Char('/') + sfx; + concat << base_concat; QStringList feature_roots = splitPathList(QString::fromLocal8Bit(qgetenv("QMAKEFEATURES"))); feature_roots += cached_qmakefeatures; @@ -1489,7 +1475,8 @@ QMakeProject::read(uchar cmd) return false; } doProjectInclude("spec_post", IncludeFlagFeature, vars); - validateModes(); + // The spec extends the feature search path, so invalidate the cache. + invalidateFeatureRoots(); if (!conffile.isEmpty()) { debug_msg(1, "Project config file: reading %s", conffile.toLatin1().constData()); @@ -1607,34 +1594,6 @@ QMakeProject::read(uchar cmd) return true; } -void QMakeProject::validateModes() -{ - if (Option::target_mode == Option::TARG_UNKNOWN_MODE) { - Option::TARG_MODE target_mode; - const QStringList &gen = vars.value("MAKEFILE_GENERATOR"); - if (gen.isEmpty()) { - fprintf(stderr, "%s:%d: Using OS scope before setting MAKEFILE_GENERATOR\n", - parser.file.toLatin1().constData(), parser.line_no); - } else if (MetaMakefileGenerator::modeForGenerator(gen.first(), &target_mode)) { - const QStringList &tgt = vars.value("TARGET_PLATFORM"); - if (!tgt.isEmpty()) { - const QString &os = tgt.first(); - if (os == "unix") - Option::target_mode = Option::TARG_UNIX_MODE; - else if (os == "macx") - Option::target_mode = Option::TARG_MACX_MODE; - else if (os == "win32") - Option::target_mode = Option::TARG_WIN_MODE; - else - fprintf(stderr, "Unknown target platform specified: %s\n", - os.toLatin1().constData()); - } else { - Option::target_mode = target_mode; - } - } - } -} - void QMakeProject::resolveSpec(QString *spec, const QString &qmakespec) { @@ -1677,18 +1636,6 @@ QMakeProject::isActiveConfig(const QString &x, bool regex, QHash, (void**)&feature_roots); } if (feature_roots->isEmpty()) - *feature_roots = qmake_feature_paths(prop, host_build); + *feature_roots = qmakeFeaturePaths(); debug_msg(2, "Looking for feature '%s' in (%s)", file.toLatin1().constData(), feature_roots->join("::").toLatin1().constData()); int start_root = 0; diff --git a/qmake/project.h b/qmake/project.h index e733f6097c..4ee6a02597 100644 --- a/qmake/project.h +++ b/qmake/project.h @@ -114,8 +114,8 @@ class QMakeProject void init(QMakeProperty *); void cleanup(); QStringList &values(const QString &v, QHash &place); - void validateModes(); void resolveSpec(QString *spec, const QString &qmakespec); + QStringList qmakeFeaturePaths(); public: QMakeProject(QMakeProperty *p = 0) { init(p); } -- cgit v1.2.3 From 32bc46a90b7aa2506ea2e98c84ee518d80a53769 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 18 Apr 2012 12:26:25 +0200 Subject: remove support for loading features relative to current directory it's completely counterproductive. just include() the file instead. i don't think anyone knew about this "feature", so just removing it. as a side effect this removes the repeated existence check of already found feature files, as we can use a clean else-if cascade. Change-Id: I5d38d38d0a897f2e8857ac68d5649fd4367941c4 Reviewed-by: Joerg Bornemann --- qmake/project.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/qmake/project.cpp b/qmake/project.cpp index a9d4042908..0024234bf4 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -1698,7 +1698,7 @@ QMakeProject::doProjectInclude(QString file, uchar flags, QHash Date: Fri, 1 Jun 2012 11:08:52 +0200 Subject: resolve real qmakespec name right after loading it this is cleaner than resolving it on-demand, as it avoids statics (with potential side effects on dynamic spec switching). Change-Id: I2bc15a4c3108376e1b4a01351875fe0c445ee5d5 Reviewed-by: Mark Brand --- qmake/project.cpp | 45 ++++++++++----------------------------------- qmake/project.h | 2 +- 2 files changed, 11 insertions(+), 36 deletions(-) diff --git a/qmake/project.cpp b/qmake/project.cpp index 0024234bf4..a909c04a9a 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -1474,6 +1474,15 @@ QMakeProject::read(uchar cmd) fprintf(stderr, "Failure to read QMAKESPEC conf file %s.\n", spec.toLatin1().constData()); return false; } +#ifdef Q_OS_UNIX + real_spec = QFileInfo(qmakespec).canonicalFilePath(); +#else + // We can't resolve symlinks as they do on Unix, so configure.exe puts the source of the + // qmake.conf at the end of the default/qmake.conf in the QMAKESPEC_ORG variable. + QString orig_spec = first(QLatin1String("QMAKESPEC_ORIGINAL")); + real_spec = orig_spec.isEmpty() ? qmakespec : orig_spec; +#endif + short_spec = QFileInfo(real_spec).fileName(); doProjectInclude("spec_post", IncludeFlagFeature, vars); // The spec extends the feature search path, so invalidate the cache. invalidateFeatureRoots(); @@ -1594,36 +1603,6 @@ QMakeProject::read(uchar cmd) return true; } -void -QMakeProject::resolveSpec(QString *spec, const QString &qmakespec) -{ - if (spec->isEmpty()) { - *spec = QFileInfo(qmakespec).fileName(); - if (*spec == "default" || *spec == "default-host") { -#ifdef Q_OS_UNIX - char buffer[1024]; - int l = readlink(qmakespec.toLatin1().constData(), buffer, 1023); - if (l != -1) { - buffer[l] = '\0'; - *spec = QString::fromLatin1(buffer); -#else - // We can't resolve symlinks as they do on Unix, so configure.exe puts the source of the - // qmake.conf at the end of the default/qmake.conf in the QMAKESPEC_ORG variable. - const QStringList &spec_org = vars["QMAKESPEC_ORIGINAL"]; - if (spec_org.isEmpty()) { - // try again the next time around - *spec = QString(); - } else { - *spec = spec_org.at(0); -#endif - int lastSlash = spec->lastIndexOf(QLatin1Char('/')); - if (lastSlash != -1) - spec->remove(0, lastSlash + 1); - } - } - } -} - bool QMakeProject::isActiveConfig(const QString &x, bool regex, QHash *place) { @@ -1640,12 +1619,8 @@ QMakeProject::isActiveConfig(const QString &x, bool regex, QHash &place); - void resolveSpec(QString *spec, const QString &qmakespec); QStringList qmakeFeaturePaths(); public: -- cgit v1.2.3 From caa22630510fb625f9c2ed18660cb56eb585137c Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 20 Apr 2012 17:07:52 +0200 Subject: use real qmakespec as basis for finding features doesn't make much of a difference on unix (as the default specs are just symlinks). on windows, it makes the gross hack used for finding spec-specific wince default_post.prfs unnecessary. Change-Id: Id403dce5be487e1ae22c1f54b8095a6afdd98bc8 Reviewed-by: Joerg Bornemann --- mkspecs/features/win32/default_post.prf | 11 ----------- qmake/project.cpp | 7 +++---- 2 files changed, 3 insertions(+), 15 deletions(-) delete mode 100644 mkspecs/features/win32/default_post.prf diff --git a/mkspecs/features/win32/default_post.prf b/mkspecs/features/win32/default_post.prf deleted file mode 100644 index a1d8b52da9..0000000000 --- a/mkspecs/features/win32/default_post.prf +++ /dev/null @@ -1,11 +0,0 @@ -!isEmpty(CE_ARCH) { - QMAKESPEC_DIR = $$QMAKESPEC - exists($$QMAKESPEC_DIR/default_post.prf) { - isEmpty(QMAKESPEC_DIR):QMAKESPEC_DIR = $$QMAKESPEC_ORIGINAL - !isEmpty(QMAKESPEC_DIR):load($$QMAKESPEC_DIR/default_post.prf) - } -} - -# Now load the global default_post -load(default_post) - diff --git a/qmake/project.cpp b/qmake/project.cpp index a909c04a9a..c781cd2a28 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -587,13 +587,12 @@ QStringList QMakeProject::qmakeFeaturePaths() foreach (const QString &path, qmakepath) foreach (const QString &cat, concat) feature_roots << (path + mkspecs_concat + cat); - QString *specp = host_build ? &Option::mkfile::qmakespec : &Option::mkfile::xqmakespec; - if (!specp->isEmpty()) { + if (!real_spec.isEmpty()) { // The spec is already platform-dependent, so no subdirs here. - feature_roots << *specp + base_concat; + feature_roots << real_spec + base_concat; // Also check directly under the root directory of the mkspecs collection - QFileInfo specfi(*specp); + QFileInfo specfi(real_spec); QDir specrootdir(specfi.absolutePath()); while (!specrootdir.isRoot()) { const QString specrootpath = specrootdir.path(); -- cgit v1.2.3 From 4b637bf1f0c5efe05a5f0098540f2195bc9b8c20 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 26 Jun 2012 15:36:39 +0200 Subject: fix specdir() get the actual spec path directly from the project - the specs in Option are not necessarily resolved. Change-Id: Ia2bf2199c5269aa5b5a9d4c38de36171f25d448b Reviewed-by: Joerg Bornemann --- qmake/generators/makefile.cpp | 3 +-- qmake/project.h | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index f187190ac7..ca22655171 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -3073,8 +3073,7 @@ QString MakefileGenerator::specdir() { if (spec.isEmpty()) - spec = fileFixify(project->isHostBuild() - ? Option::mkfile::qmakespec : Option::mkfile::xqmakespec); + spec = fileFixify(project->specDir()); return spec; } diff --git a/qmake/project.h b/qmake/project.h index 0e1ab7d870..8314c39321 100644 --- a/qmake/project.h +++ b/qmake/project.h @@ -136,6 +136,7 @@ public: QString projectFile(); QString confFile() const { return conffile; } QString cacheFile() const { return cachefile; } + QString specDir() const { return real_spec; } inline QMakeProperty *properties() { return prop; } bool doProjectTest(QString str, QHash &place); -- cgit v1.2.3 From dafc4a884c7ccbd7417bf190c83a2465fb829096 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 20 Apr 2012 18:19:35 +0200 Subject: don't put QMAKESPEC_ORIGINAL into INCLUDEPATH any more the spec does that itself, given that the real spec is just included nowadays, instead of copied (which never worked without side effects). Change-Id: Ibf655b9a943dadb949d3c7a58d8fe50fcd62cef7 Reviewed-by: Joerg Bornemann --- mkspecs/features/qt.prf | 5 ----- 1 file changed, 5 deletions(-) diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf index 8af10b143d..ed483c8c2e 100644 --- a/mkspecs/features/qt.prf +++ b/mkspecs/features/qt.prf @@ -11,11 +11,6 @@ win32 { } contains(DEFINES, QT_MAKEDLL)|contains(DEFINES, QT_DLL):QMAKE_QT_DLL = 1 } - # Some files include qplatformdefs.h, which lives in the individual mkspec directory - # However, if QMAKESPEC_ORIGINAL is set, the module/app is outside of the QtBase - # directory, and using the default profile. So we add the original mkspecs directory - # to the include path - !isEmpty(QMAKESPEC_ORIGINAL):INCLUDEPATH += $$QMAKESPEC_ORIGINAL } CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG contains(QT_CONFIG, force_asserts):DEFINES += QT_FORCE_ASSERTS -- cgit v1.2.3 From bc05c9aee8af5f27d297e9b525d98d18129b29da Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 20 Apr 2012 17:58:24 +0200 Subject: don't copy files to default specs any more now that the default specs really only forward to the real specs, it is not necessary to copy any auxiliary files. Change-Id: I169a61a045063b796062fe6af3a2afbe3f1c9da0 Reviewed-by: Mark Brand --- tools/configure/configureapp.cpp | 18 +++++++++---- tools/configure/environment.cpp | 55 +++------------------------------------- tools/configure/environment.h | 4 +-- 3 files changed, 18 insertions(+), 59 deletions(-) diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index f22519afdd..9086007093 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -3046,7 +3046,7 @@ QString Configure::addDefine(QString def) #if !defined(EVAL) bool Configure::copySpec(const char *name, const char *pfx, const QString &spec) { - // Copy configured mkspec to default directory, but remove the old one first, if there is any + // "Link" configured mkspec to default directory, but remove the old one first, if there is any QString defSpec = buildPath + "/mkspecs/" + name; QFileInfo defSpecInfo(defSpec); if (defSpecInfo.exists()) { @@ -3057,10 +3057,18 @@ bool Configure::copySpec(const char *name, const char *pfx, const QString &spec) } } - QString pltSpec = sourcePath + "/mkspecs/" + spec; - QString includeSpec = buildPath + "/mkspecs/" + spec; - if (!Environment::cpdir(pltSpec, defSpec, includeSpec)) { - cout << "Couldn't update default " << pfx << "mkspec! Does " << qPrintable(pltSpec) << " exist?" << endl; + QDir::current().mkpath(defSpec); + QFile qfile(defSpec + "/qmake.conf"); + if (qfile.open(QFile::WriteOnly | QFile::Text)) { + QTextStream fileStream; + fileStream.setDevice(&qfile); + QString srcSpec = buildPath + "/mkspecs/" + spec; // We copied it to the build dir + fileStream << "QMAKESPEC_ORIGINAL = " << formatPath(srcSpec) << endl; + fileStream << "include(" << formatPath(QDir(defSpec).relativeFilePath(srcSpec + "/qmake.conf")) << ")" << endl; + qfile.close(); + } + if (qfile.error() != QFile::NoError) { + cout << "Couldn't update default " << pfx << "mkspec: " << qPrintable(qfile.errorString()) << endl; dictionary["DONE"] = "error"; return false; } diff --git a/tools/configure/environment.cpp b/tools/configure/environment.cpp index 0365340833..45dc9d9417 100644 --- a/tools/configure/environment.cpp +++ b/tools/configure/environment.cpp @@ -454,21 +454,12 @@ QString Environment::execute(const QString &command, int *returnCode) /*! Copies the \a srcDir contents into \a destDir. - If \a includeSrcDir is not empty, any files with 'h', 'prf', or 'conf' suffixes - will not be copied over from \a srcDir. Instead a new file will be created - in \a destDir with the same name and that file will include a file with the - same name from the \a includeSrcDir using relative path and appropriate - syntax for the file type. - Returns true if copying was successful. */ -bool Environment::cpdir(const QString &srcDir, - const QString &destDir, - const QString &includeSrcDir) +bool Environment::cpdir(const QString &srcDir, const QString &destDir) { QString cleanSrcName = QDir::cleanPath(srcDir); QString cleanDstName = QDir::cleanPath(destDir); - QString cleanIncludeName = QDir::cleanPath(includeSrcDir); #ifdef CONFIGURE_DEBUG_CP_DIR qDebug() << "Attempt to cpdir " << cleanSrcName << "->" << cleanDstName; @@ -480,59 +471,21 @@ bool Environment::cpdir(const QString &srcDir, bool result = true; QDir dir = QDir(cleanSrcName); - QDir destinationDir = QDir(cleanDstName); QFileInfoList allEntries = dir.entryInfoList(QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot); for (int i = 0; result && (i < allEntries.count()); ++i) { QFileInfo entry = allEntries.at(i); bool intermediate = true; if (entry.isDir()) { - QString newIncSrcDir; - if (!includeSrcDir.isEmpty()) - newIncSrcDir = QString("%1/%2").arg(cleanIncludeName).arg(entry.fileName()); - intermediate = cpdir(QString("%1/%2").arg(cleanSrcName).arg(entry.fileName()), - QString("%1/%2").arg(cleanDstName).arg(entry.fileName()), - newIncSrcDir); + QString("%1/%2").arg(cleanDstName).arg(entry.fileName())); } else { QString destFile = QString("%1/%2").arg(cleanDstName).arg(entry.fileName()); #ifdef CONFIGURE_DEBUG_CP_DIR qDebug() << "About to cp (file)" << entry.absoluteFilePath() << "->" << destFile; #endif QFile::remove(destFile); - QString suffix = entry.suffix(); - if (!includeSrcDir.isEmpty() && (suffix == "prf" || suffix == "conf" || suffix == "h")) { - QString relativeIncludeFilePath = QString("%1/%2").arg(cleanIncludeName).arg(entry.fileName()); - relativeIncludeFilePath = destinationDir.relativeFilePath(relativeIncludeFilePath); -#ifdef CONFIGURE_DEBUG_CP_DIR - qDebug() << "...instead generate relative include to" << relativeIncludeFilePath; -#endif - QFile currentFile(destFile); - if (currentFile.open(QFile::WriteOnly | QFile::Text)) { - QTextStream fileStream; - fileStream.setDevice(¤tFile); - - if (suffix == "prf" || suffix == "conf") { - if (entry.fileName() == "qmake.conf") { - // While QMAKESPEC_ORIGINAL being relative or absolute doesn't matter for the - // primary use of this variable by qmake to identify the original mkspec, the - // variable is also used for few special cases where the absolute path is required. - // Conversely, the include of the original qmake.conf must be done using relative path, - // as some Qt binary deployments are done in a manner that doesn't allow for patching - // the paths at the installation time. - fileStream << "QMAKESPEC_ORIGINAL=" << cleanSrcName << endl << endl; - } - fileStream << "include(" << relativeIncludeFilePath << ")" << endl << endl; - } else if (suffix == "h") { - fileStream << "#include \"" << relativeIncludeFilePath << "\"" << endl << endl; - } - - fileStream.flush(); - currentFile.close(); - } - } else { - intermediate = QFile::copy(entry.absoluteFilePath(), destFile); - SetFileAttributes((wchar_t*)destFile.utf16(), FILE_ATTRIBUTE_NORMAL); - } + intermediate = QFile::copy(entry.absoluteFilePath(), destFile); + SetFileAttributes((wchar_t*)destFile.utf16(), FILE_ATTRIBUTE_NORMAL); } if(!intermediate) { qDebug() << "cpdir: Failure for " << entry.fileName() << entry.isDir(); diff --git a/tools/configure/environment.h b/tools/configure/environment.h index 979d538e8a..58e9c18137 100644 --- a/tools/configure/environment.h +++ b/tools/configure/environment.h @@ -67,9 +67,7 @@ public: static int execute(QStringList arguments, const QStringList &additionalEnv, const QStringList &removeEnv); static QString execute(const QString &command, int *returnCode = 0); - static bool cpdir(const QString &srcDir, - const QString &destDir, - const QString &includeSrcDir = QString()); + static bool cpdir(const QString &srcDir, const QString &destDir); static bool rmdir(const QString &name); private: -- cgit v1.2.3 From f375fa19c97d87ec3f4e1082ed433c0e2db11b80 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 20 Apr 2012 19:25:12 +0200 Subject: don't make prf_ext overridable it's entirely pointless Change-Id: I1da3c05a0b4f6ac8cea6ecc64ce3a237957440f5 Reviewed-by: Joerg Bornemann Reviewed-by: Mark Brand --- qmake/option.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/qmake/option.cpp b/qmake/option.cpp index aaf9b55363..5fd560eb46 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -613,10 +613,6 @@ bool Option::postProcessProject(QMakeProject *project) Option::libtool_ext = project->first("QMAKE_EXT_LIBTOOL"); if(!project->isEmpty("QMAKE_EXT_PRL")) Option::prl_ext = project->first("QMAKE_EXT_PRL"); - if(!project->isEmpty("QMAKE_EXT_PRF")) - Option::prf_ext = project->first("QMAKE_EXT_PRF"); - if(!project->isEmpty("QMAKE_EXT_JS")) - Option::prf_ext = project->first("QMAKE_EXT_JS"); if(!project->isEmpty("QMAKE_EXT_UI")) Option::ui_ext = project->first("QMAKE_EXT_UI"); if(!project->isEmpty("QMAKE_EXT_CPP_MOC")) -- cgit v1.2.3 From 073badf9d2aaa694a066dcbb632b79a6d05a67ad Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 20 Apr 2012 19:49:02 +0200 Subject: don't read QMAKE_DIRLIST_SEP back into Option::dirlist_sep it's really only a host setting which is not used any more past the now removed assignment. Change-Id: I62c61c893697eb9a7e7be550311bf152d5a8206e Reviewed-by: Joerg Bornemann --- qmake/option.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/qmake/option.cpp b/qmake/option.cpp index 5fd560eb46..6d57de68e5 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -635,8 +635,6 @@ bool Option::postProcessProject(QMakeProject *project) Option::yacc_mod = project->first("QMAKE_MOD_YACC"); if(!project->isEmpty("QMAKE_DIR_SEP")) Option::dir_sep = project->first("QMAKE_DIR_SEP"); - if(!project->isEmpty("QMAKE_DIRLIST_SEP")) - Option::dirlist_sep = project->first("QMAKE_DIRLIST_SEP"); if(!project->isEmpty("QMAKE_MOD_SYSTEM_ENV")) Option::sysenv_mod = project->first("QMAKE_MOD_SYSTEM_ENV"); return true; -- cgit v1.2.3 From 621b42e53db83726102f160b13e9764592c95bba Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 20 Apr 2012 19:51:04 +0200 Subject: purge QMAKE_MOD_SYSTEM_ENV from Option & co. this is entirely unused Change-Id: Ia0368b1d90f61b64178e28479a2088a19aa418e3 Reviewed-by: Joerg Bornemann --- qmake/option.cpp | 4 ---- qmake/option.h | 1 - 2 files changed, 5 deletions(-) diff --git a/qmake/option.cpp b/qmake/option.cpp index 6d57de68e5..3c5a57f56b 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -73,7 +73,6 @@ QString Option::h_moc_mod; QString Option::cpp_moc_mod; QString Option::yacc_mod; QString Option::lex_mod; -QString Option::sysenv_mod; QString Option::res_ext; char Option::field_sep; @@ -437,7 +436,6 @@ Option::init(int argc, char **argv) Option::dirlist_sep = ":"; Option::shellPath = QStringList("sh"); #endif - Option::sysenv_mod = "QMAKE_ENV_"; Option::field_sep = ' '; if(argc && argv) { @@ -635,8 +633,6 @@ bool Option::postProcessProject(QMakeProject *project) Option::yacc_mod = project->first("QMAKE_MOD_YACC"); if(!project->isEmpty("QMAKE_DIR_SEP")) Option::dir_sep = project->first("QMAKE_DIR_SEP"); - if(!project->isEmpty("QMAKE_MOD_SYSTEM_ENV")) - Option::sysenv_mod = project->first("QMAKE_MOD_SYSTEM_ENV"); return true; } diff --git a/qmake/option.h b/qmake/option.h index 32bc06bc61..de02c39b2b 100644 --- a/qmake/option.h +++ b/qmake/option.h @@ -91,7 +91,6 @@ struct Option static QString yacc_mod; static QString dir_sep; static QString dirlist_sep; - static QString sysenv_mod; static QString pro_ext; static QString res_ext; static char field_sep; -- cgit v1.2.3 From 1b1aa3b4f8413bb467409aeadb5934c442b0835a Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 20 Apr 2012 19:53:14 +0200 Subject: remove QMAKE_EXT_H_MOC and QMAKE_CPP_MOD_MOC from Option these are not actually used inside qmake since ever the code was factored into moc.prf. Change-Id: I545f4857ca3f0b4bf2439703700069ac67ad4ca2 Reviewed-by: Joerg Bornemann --- qmake/option.cpp | 8 -------- qmake/option.h | 2 -- 2 files changed, 10 deletions(-) diff --git a/qmake/option.cpp b/qmake/option.cpp index 3c5a57f56b..27f0018b74 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -60,7 +60,6 @@ QString Option::pkgcfg_ext; QString Option::ui_ext; QStringList Option::h_ext; QString Option::cpp_moc_ext; -QString Option::h_moc_ext; QStringList Option::cpp_ext; QStringList Option::c_ext; QString Option::obj_ext; @@ -70,7 +69,6 @@ QString Option::pro_ext; QString Option::dir_sep; QString Option::dirlist_sep; QString Option::h_moc_mod; -QString Option::cpp_moc_mod; QString Option::yacc_mod; QString Option::lex_mod; QString Option::res_ext; @@ -405,7 +403,6 @@ Option::init(int argc, char **argv) Option::host_mode = Option::HOST_WIN_MODE; #endif Option::application_argv0 = 0; - Option::cpp_moc_mod = ""; Option::h_moc_mod = "moc_"; Option::lex_mod = "_lex"; Option::yacc_mod = "_yacc"; @@ -420,7 +417,6 @@ Option::init(int argc, char **argv) Option::h_ext << ".H"; #endif Option::cpp_moc_ext = ".moc"; - Option::h_moc_ext = ".cpp"; Option::cpp_ext << ".cpp" << ".cc" << ".cxx"; #ifndef Q_OS_WIN Option::cpp_ext << ".C"; @@ -615,8 +611,6 @@ bool Option::postProcessProject(QMakeProject *project) Option::ui_ext = project->first("QMAKE_EXT_UI"); if(!project->isEmpty("QMAKE_EXT_CPP_MOC")) Option::cpp_moc_ext = project->first("QMAKE_EXT_CPP_MOC"); - if(!project->isEmpty("QMAKE_EXT_H_MOC")) - Option::h_moc_ext = project->first("QMAKE_EXT_H_MOC"); if(!project->isEmpty("QMAKE_EXT_LEX")) Option::lex_ext = project->first("QMAKE_EXT_LEX"); if(!project->isEmpty("QMAKE_EXT_YACC")) @@ -625,8 +619,6 @@ bool Option::postProcessProject(QMakeProject *project) Option::obj_ext = project->first("QMAKE_EXT_OBJ"); if(!project->isEmpty("QMAKE_H_MOD_MOC")) Option::h_moc_mod = project->first("QMAKE_H_MOD_MOC"); - if(!project->isEmpty("QMAKE_CPP_MOD_MOC")) - Option::cpp_moc_mod = project->first("QMAKE_CPP_MOD_MOC"); if(!project->isEmpty("QMAKE_MOD_LEX")) Option::lex_mod = project->first("QMAKE_MOD_LEX"); if(!project->isEmpty("QMAKE_MOD_YACC")) diff --git a/qmake/option.h b/qmake/option.h index de02c39b2b..bd220a8376 100644 --- a/qmake/option.h +++ b/qmake/option.h @@ -80,13 +80,11 @@ struct Option static QStringList h_ext; static QStringList cpp_ext; static QStringList c_ext; - static QString h_moc_ext; static QString cpp_moc_ext; static QString obj_ext; static QString lex_ext; static QString yacc_ext; static QString h_moc_mod; - static QString cpp_moc_mod; static QString lex_mod; static QString yacc_mod; static QString dir_sep; -- cgit v1.2.3 From b40b91cb393615f586d86f28ec5a5d6dd54c5d0a Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 20 Apr 2012 20:27:15 +0200 Subject: move initialization of numerous variables to spec_pre.prf this is cleaner by design and allows removing some hacks. Change-Id: I3270195b5d62caa476ffde7c1e1ef43cec99c565 Reviewed-by: Joerg Bornemann Reviewed-by: Mark Brand --- mkspecs/features/spec_pre.prf | 39 +++++++++++++++++++ qmake/option.cpp | 87 +++++++------------------------------------ qmake/project.cpp | 12 ------ 3 files changed, 53 insertions(+), 85 deletions(-) create mode 100644 mkspecs/features/spec_pre.prf diff --git a/mkspecs/features/spec_pre.prf b/mkspecs/features/spec_pre.prf new file mode 100644 index 0000000000..bcd4a08449 --- /dev/null +++ b/mkspecs/features/spec_pre.prf @@ -0,0 +1,39 @@ +QMAKE_DIR_SEP = $$DIR_SEPARATOR +QMAKE_DIRLIST_SEP = $$DIRLIST_SEPARATOR + +QMAKE_EXT_C = .c +QMAKE_EXT_CPP = .cpp .cc .cxx +QMAKE_EXT_CPP_MOC = .moc +QMAKE_EXT_H = .h .hpp .hh .hxx +QMAKE_EXT_H_MOC = .cpp +QMAKE_EXT_JS = .js +QMAKE_EXT_LEX = .l +QMAKE_EXT_LIBTOOL = .la +QMAKE_EXT_PKGCONFIG = .pc +QMAKE_EXT_PRL = .prl +QMAKE_EXT_UI = .ui +QMAKE_EXT_YACC = .y + +QMAKE_CPP_MOD_MOC = +QMAKE_H_MOD_MOC = moc_ +QMAKE_MOD_LEX = _lex +QMAKE_MOD_YACC = _yacc + +equals(QMAKE_HOST.os, Windows) { + QMAKE_EXT_OBJ = .obj + QMAKE_EXT_RES = .res + QMAKE_SH = + PATH = $$split($$(PATH), ;) + for(dir, PATH) { + exists($$dir/sh.exe) { + QMAKE_SH = $$dir/sh.exe + break() + } + } + unset(PATH) +} else { + QMAKE_EXT_CPP += .C + QMAKE_EXT_H += .H + QMAKE_EXT_OBJ = .o + QMAKE_SH = sh +} diff --git a/qmake/option.cpp b/qmake/option.cpp index 27f0018b74..ec4c3546bd 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -376,22 +376,6 @@ Option::parseCommandLine(int argc, char **argv, int skip) return Option::QMAKE_CMDLINE_SUCCESS; } -#ifdef Q_OS_WIN -static QStringList detectShellPath() -{ - QStringList paths; - QString path = qgetenv("PATH"); - QStringList pathlist = path.toLower().split(";"); - for (int i = 0; i < pathlist.count(); i++) { - QString maybeSh = pathlist.at(i) + "/sh.exe"; - if (QFile::exists(maybeSh)) { - paths.append(maybeSh); - } - } - return paths; -} -#endif - int Option::init(int argc, char **argv) { @@ -403,34 +387,12 @@ Option::init(int argc, char **argv) Option::host_mode = Option::HOST_WIN_MODE; #endif Option::application_argv0 = 0; - Option::h_moc_mod = "moc_"; - Option::lex_mod = "_lex"; - Option::yacc_mod = "_yacc"; - Option::prl_ext = ".prl"; - Option::libtool_ext = ".la"; - Option::pkgcfg_ext = ".pc"; Option::prf_ext = ".prf"; - Option::ui_ext = ".ui"; - Option::h_ext << ".h" << ".hpp" << ".hh" << ".hxx"; - Option::c_ext << ".c"; -#ifndef Q_OS_WIN - Option::h_ext << ".H"; -#endif - Option::cpp_moc_ext = ".moc"; - Option::cpp_ext << ".cpp" << ".cc" << ".cxx"; -#ifndef Q_OS_WIN - Option::cpp_ext << ".C"; -#endif - Option::lex_ext = ".l"; - Option::yacc_ext = ".y"; Option::pro_ext = ".pro"; #ifdef Q_OS_WIN Option::dirlist_sep = ";"; - Option::shellPath = detectShellPath(); - Option::res_ext = ".res"; #else Option::dirlist_sep = ":"; - Option::shellPath = QStringList("sh"); #endif Option::field_sep = ' '; @@ -555,10 +517,8 @@ Option::init(int argc, char **argv) //defaults for globals if (Option::host_mode == Option::HOST_WIN_MODE) { Option::dir_sep = "\\"; - Option::obj_ext = ".obj"; } else { Option::dir_sep = "/"; - Option::obj_ext = ".o"; } return QMAKE_CMDLINE_SUCCESS; @@ -590,41 +550,22 @@ void Option::prepareProject(const QString &pfile) bool Option::postProcessProject(QMakeProject *project) { Option::cpp_ext = project->variables()["QMAKE_EXT_CPP"]; - if(cpp_ext.isEmpty()) - cpp_ext << ".cpp"; //something must be there Option::h_ext = project->variables()["QMAKE_EXT_H"]; - if(h_ext.isEmpty()) - h_ext << ".h"; Option::c_ext = project->variables()["QMAKE_EXT_C"]; - if(c_ext.isEmpty()) - c_ext << ".c"; //something must be there - - if(!project->isEmpty("QMAKE_EXT_RES")) - Option::res_ext = project->first("QMAKE_EXT_RES"); - if(!project->isEmpty("QMAKE_EXT_PKGCONFIG")) - Option::pkgcfg_ext = project->first("QMAKE_EXT_PKGCONFIG"); - if(!project->isEmpty("QMAKE_EXT_LIBTOOL")) - Option::libtool_ext = project->first("QMAKE_EXT_LIBTOOL"); - if(!project->isEmpty("QMAKE_EXT_PRL")) - Option::prl_ext = project->first("QMAKE_EXT_PRL"); - if(!project->isEmpty("QMAKE_EXT_UI")) - Option::ui_ext = project->first("QMAKE_EXT_UI"); - if(!project->isEmpty("QMAKE_EXT_CPP_MOC")) - Option::cpp_moc_ext = project->first("QMAKE_EXT_CPP_MOC"); - if(!project->isEmpty("QMAKE_EXT_LEX")) - Option::lex_ext = project->first("QMAKE_EXT_LEX"); - if(!project->isEmpty("QMAKE_EXT_YACC")) - Option::yacc_ext = project->first("QMAKE_EXT_YACC"); - if(!project->isEmpty("QMAKE_EXT_OBJ")) - Option::obj_ext = project->first("QMAKE_EXT_OBJ"); - if(!project->isEmpty("QMAKE_H_MOD_MOC")) - Option::h_moc_mod = project->first("QMAKE_H_MOD_MOC"); - if(!project->isEmpty("QMAKE_MOD_LEX")) - Option::lex_mod = project->first("QMAKE_MOD_LEX"); - if(!project->isEmpty("QMAKE_MOD_YACC")) - Option::yacc_mod = project->first("QMAKE_MOD_YACC"); - if(!project->isEmpty("QMAKE_DIR_SEP")) - Option::dir_sep = project->first("QMAKE_DIR_SEP"); + Option::res_ext = project->first("QMAKE_EXT_RES"); + Option::pkgcfg_ext = project->first("QMAKE_EXT_PKGCONFIG"); + Option::libtool_ext = project->first("QMAKE_EXT_LIBTOOL"); + Option::prl_ext = project->first("QMAKE_EXT_PRL"); + Option::ui_ext = project->first("QMAKE_EXT_UI"); + Option::cpp_moc_ext = project->first("QMAKE_EXT_CPP_MOC"); + Option::lex_ext = project->first("QMAKE_EXT_LEX"); + Option::yacc_ext = project->first("QMAKE_EXT_YACC"); + Option::obj_ext = project->first("QMAKE_EXT_OBJ"); + Option::h_moc_mod = project->first("QMAKE_H_MOD_MOC"); + Option::lex_mod = project->first("QMAKE_MOD_LEX"); + Option::yacc_mod = project->first("QMAKE_MOD_YACC"); + Option::dir_sep = project->first("QMAKE_DIR_SEP"); + Option::shellPath = project->variables()["QMAKE_SH"]; return true; } diff --git a/qmake/project.cpp b/qmake/project.cpp index c781cd2a28..3f801334c2 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -1316,10 +1316,6 @@ QMakeProject::read(uchar cmd) again: if ((cmd & ReadSetup) && base_vars.isEmpty()) { // hack to get the Option stuff in there - vars["QMAKE_EXT_CPP"] = Option::cpp_ext; - vars["QMAKE_EXT_C"] = Option::c_ext; - vars["QMAKE_EXT_H"] = Option::h_ext; - vars["QMAKE_SH"] = Option::shellPath; if(!Option::user_template_prefix.isEmpty()) vars["TEMPLATE_PREFIX"] = QStringList(Option::user_template_prefix); @@ -3771,14 +3767,6 @@ QStringList &QMakeProject::values(const QString &_var, QHash Date: Mon, 23 Apr 2012 12:58:17 +0200 Subject: don't make $$TEMPLATE_PREFIX available any more this is a purely internal variable. projects are supposed to query $$TEMPLATE only. Change-Id: I32a3aa7012a4fedcf6e77e2e1302ed978baac700 Reviewed-by: Joerg Bornemann --- qmake/project.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/qmake/project.cpp b/qmake/project.cpp index 3f801334c2..fbfe84a581 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -1315,10 +1315,6 @@ QMakeProject::read(uchar cmd) { again: if ((cmd & ReadSetup) && base_vars.isEmpty()) { - // hack to get the Option stuff in there - if(!Option::user_template_prefix.isEmpty()) - vars["TEMPLATE_PREFIX"] = QStringList(Option::user_template_prefix); - QString superdir; QString project_root; QString project_build_root; -- cgit v1.2.3 From 602ef59e855ac86ea975aa40c533c51685c36bb0 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 23 Apr 2012 12:06:59 +0200 Subject: make a bunch of invariant variables non-magic instead of resolving them on-demand, just initialize the value hash with them. less magic and faster. Change-Id: I28cb6c21ae6ae60a33734f62acdef0794420ba8f Reviewed-by: Joerg Bornemann --- qmake/option.cpp | 8 ++ qmake/project.cpp | 228 ++++++++++++++++++++++++------------------------------ qmake/project.h | 3 +- 3 files changed, 112 insertions(+), 127 deletions(-) diff --git a/qmake/option.cpp b/qmake/option.cpp index ec4c3546bd..d2ab2514d6 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -432,6 +432,14 @@ Option::init(int argc, char **argv) } if(!Option::qmake_abslocation.isNull()) Option::qmake_abslocation = QDir::cleanPath(Option::qmake_abslocation); + else // This is rather unlikely to ever happen on a modern system ... + Option::qmake_abslocation = QLibraryInfo::rawLocation(QLibraryInfo::HostBinariesPath, + QLibraryInfo::EffectivePaths) + +#ifdef Q_OS_WIN + "/qmake.exe"; +#else + "/qmake"; +#endif } else { Option::qmake_mode = Option::QMAKE_GENERATE_MAKEFILE; } diff --git a/qmake/project.cpp b/qmake/project.cpp index fbfe84a581..1a5b7e7e76 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -1314,7 +1314,14 @@ bool QMakeProject::read(uchar cmd) { again: - if ((cmd & ReadSetup) && base_vars.isEmpty()) { + if (init_vars.isEmpty()) { + loadDefaults(); + init_vars = vars; + } else { + vars = init_vars; + } + if (cmd & ReadSetup) { + if (base_vars.isEmpty()) { QString superdir; QString project_root; QString project_build_root; @@ -1390,6 +1397,11 @@ QMakeProject::read(uchar cmd) if (Option::output_dir.startsWith(project_build_root)) Option::mkfile::cachefile_depth = Option::output_dir.mid(project_build_root.length()).count('/'); + + if (!superfile.isEmpty()) + vars["_QMAKE_SUPER_CACHE_"] << superfile; + if (!cachefile.isEmpty()) + vars["_QMAKE_CACHE_"] << cachefile; } no_cache: @@ -1489,8 +1501,9 @@ QMakeProject::read(uchar cmd) } base_vars = vars; - } else { + } else { vars = base_vars; // start with the base + } } for (QHash::ConstIterator it = extra_vars.constBegin(); @@ -1594,6 +1607,90 @@ QMakeProject::read(uchar cmd) return true; } +void +QMakeProject::loadDefaults() +{ + vars["LITERAL_WHITESPACE"] << QLatin1String("\t"); + vars["LITERAL_DOLLAR"] << QLatin1String("$"); + vars["LITERAL_HASH"] << QLatin1String("#"); + vars["DIR_SEPARATOR"] << Option::dir_sep; + vars["DIRLIST_SEPARATOR"] << Option::dirlist_sep; + vars["QMAKE_QMAKE"] << Option::qmake_abslocation; +#if defined(Q_OS_WIN32) + vars["QMAKE_HOST.os"] << QString::fromLatin1("Windows"); + + DWORD name_length = 1024; + wchar_t name[1024]; + if (GetComputerName(name, &name_length)) + vars["QMAKE_HOST.name"] << QString::fromWCharArray(name); + + QSysInfo::WinVersion ver = QSysInfo::WindowsVersion; + vars["QMAKE_HOST.version"] << QString::number(ver); + QString verStr; + switch (ver) { + case QSysInfo::WV_Me: verStr = QLatin1String("WinMe"); break; + case QSysInfo::WV_95: verStr = QLatin1String("Win95"); break; + case QSysInfo::WV_98: verStr = QLatin1String("Win98"); break; + case QSysInfo::WV_NT: verStr = QLatin1String("WinNT"); break; + case QSysInfo::WV_2000: verStr = QLatin1String("Win2000"); break; + case QSysInfo::WV_2003: verStr = QLatin1String("Win2003"); break; + case QSysInfo::WV_XP: verStr = QLatin1String("WinXP"); break; + case QSysInfo::WV_VISTA: verStr = QLatin1String("WinVista"); break; + default: verStr = QLatin1String("Unknown"); break; + } + vars["QMAKE_HOST.version_string"] << verStr; + + SYSTEM_INFO info; + GetSystemInfo(&info); + QString archStr; + switch (info.wProcessorArchitecture) { +# ifdef PROCESSOR_ARCHITECTURE_AMD64 + case PROCESSOR_ARCHITECTURE_AMD64: + archStr = QLatin1String("x86_64"); + break; +# endif + case PROCESSOR_ARCHITECTURE_INTEL: + archStr = QLatin1String("x86"); + break; + case PROCESSOR_ARCHITECTURE_IA64: +# ifdef PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 + case PROCESSOR_ARCHITECTURE_IA32_ON_WIN64: +# endif + archStr = QLatin1String("IA64"); + break; + default: + archStr = QLatin1String("Unknown"); + break; + } + vars["QMAKE_HOST.arch"] << archStr; + +# if defined(Q_CC_MSVC) + QString paths = QString::fromLocal8Bit(qgetenv("PATH")); + QString vcBin64 = QString::fromLocal8Bit(qgetenv("VCINSTALLDIR")); + if (!vcBin64.endsWith('\\')) + vcBin64.append('\\'); + vcBin64.append("bin\\amd64"); + QString vcBinX86_64 = QString::fromLocal8Bit(qgetenv("VCINSTALLDIR")); + if (!vcBinX86_64.endsWith('\\')) + vcBinX86_64.append('\\'); + vcBinX86_64.append("bin\\x86_amd64"); + if (paths.contains(vcBin64,Qt::CaseInsensitive) || paths.contains(vcBinX86_64,Qt::CaseInsensitive)) + vars["QMAKE_TARGET.arch"] << QString::fromLatin1("x86_64"); + else + vars["QMAKE_TARGET.arch"] << QString::fromLatin1("x86"); +# endif +#elif defined(Q_OS_UNIX) + struct utsname name; + if (!uname(&name)) { + vars["QMAKE_HOST.os"] << QString::fromLocal8Bit(name.sysname); + vars["QMAKE_HOST.name"] << QString::fromLocal8Bit(name.nodename); + vars["QMAKE_HOST.version"] << QString::fromLocal8Bit(name.release); + vars["QMAKE_HOST.version_string"] << QString::fromLocal8Bit(name.version); + vars["QMAKE_HOST.arch"] << QString::fromLocal8Bit(name.machine); + } +#endif +} + bool QMakeProject::isActiveConfig(const QString &x, bool regex, QHash *place) { @@ -3229,12 +3326,14 @@ QMakeProject::doProjectTest(QString func, QList args_list, QHash &place) { QString var = varMap(_var); - if(var == QLatin1String("LITERAL_WHITESPACE")) { //a real space in a token) - var = ".BUILTIN." + var; - place[var] = QStringList(QLatin1String("\t")); - } else if(var == QLatin1String("LITERAL_DOLLAR")) { //a real $ - var = ".BUILTIN." + var; - place[var] = QStringList(QLatin1String("$")); - } else if(var == QLatin1String("LITERAL_HASH")) { //a real # - var = ".BUILTIN." + var; - place[var] = QStringList("#"); - } else if(var == QLatin1String("OUT_PWD")) { //the out going dir + if (var == QLatin1String("OUT_PWD")) { //the out going dir var = ".BUILTIN." + var; place[var] = QStringList(Option::output_dir); } else if(var == QLatin1String("PWD") || //current working dir (of _FILE_) var == QLatin1String("IN_PWD")) { var = ".BUILTIN." + var; place[var] = QStringList(qmake_getpwd()); - } else if(var == QLatin1String("DIR_SEPARATOR")) { - var = ".BUILTIN." + var; - place[var] = QStringList(Option::dir_sep); - } else if(var == QLatin1String("DIRLIST_SEPARATOR")) { - var = ".BUILTIN." + var; - place[var] = QStringList(Option::dirlist_sep); } else if(var == QLatin1String("_LINE_")) { //parser line number var = ".BUILTIN." + var; place[var] = QStringList(QString::number(parser.line_no)); @@ -3667,14 +3751,6 @@ QStringList &QMakeProject::values(const QString &_var, QHash[%s]", qPrintable(var), qPrintable(place[var].join("::"))); return place[var]; } diff --git a/qmake/project.h b/qmake/project.h index 8314c39321..11d0eb4a27 100644 --- a/qmake/project.h +++ b/qmake/project.h @@ -91,7 +91,7 @@ class QMakeProject QMakeProperty *prop; void reset(); QStringList extra_configs; - QHash vars, base_vars, extra_vars; + QHash vars, init_vars, base_vars, extra_vars; bool parse(const QString &text, QHash &place, int line_count=1); enum IncludeStatus { @@ -114,6 +114,7 @@ class QMakeProject QStringList doVariableReplaceExpand(const QString &str, QHash &place, bool *ok=0); void init(QMakeProperty *); void cleanup(); + void loadDefaults(); QStringList &values(const QString &v, QHash &place); QStringList qmakeFeaturePaths(); -- cgit v1.2.3 From 075d4a6d5d2dffd27d8a822d78e923798984d903 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 23 Apr 2012 14:13:07 +0200 Subject: make $$TEMPLATE magic on write instead of on read Change-Id: I03a68993dd7d4488f8212132a9d492d135295b9e Reviewed-by: Joerg Bornemann --- qmake/project.cpp | 42 ++++++++++++++++++++++++++---------------- qmake/project.h | 1 + 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/qmake/project.cpp b/qmake/project.cpp index 1a5b7e7e76..80fd22841e 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -639,6 +639,23 @@ QStringList qmake_mkspec_paths() return ret; } +static void +setTemplate(QStringList &varlist) +{ + if (!Option::user_template.isEmpty()) { // Don't permit override + varlist = QStringList(Option::user_template); + } else { + if (varlist.isEmpty()) + varlist << "app"; + else + varlist.erase(varlist.begin() + 1, varlist.end()); + } + if (!Option::user_template_prefix.isEmpty() + && !varlist.first().startsWith(Option::user_template_prefix)) { + varlist.first().prepend(Option::user_template_prefix); + } +} + QMakeProject::~QMakeProject() { if(own_prop) @@ -1208,6 +1225,8 @@ QMakeProject::parse(const QString &t, QHash &place, int nu } if(var == "REQUIRES") // special case to get communicated to backends! doProjectCheckReqs(vallist, place); + else if (var == QLatin1String("TEMPLATE")) + setTemplate(varlist); } return true; } @@ -1504,6 +1523,7 @@ QMakeProject::read(uchar cmd) } else { vars = base_vars; // start with the base } + setupProject(); } for (QHash::ConstIterator it = extra_vars.constBegin(); @@ -1607,6 +1627,12 @@ QMakeProject::read(uchar cmd) return true; } +void +QMakeProject::setupProject() +{ + setTemplate(vars["TEMPLATE"]); +} + void QMakeProject::loadDefaults() { @@ -3751,22 +3777,6 @@ QStringList &QMakeProject::values(const QString &_var, QHash[%s]", qPrintable(var), qPrintable(place[var].join("::"))); return place[var]; diff --git a/qmake/project.h b/qmake/project.h index 11d0eb4a27..0fb8048935 100644 --- a/qmake/project.h +++ b/qmake/project.h @@ -115,6 +115,7 @@ class QMakeProject void init(QMakeProperty *); void cleanup(); void loadDefaults(); + void setupProject(); QStringList &values(const QString &v, QHash &place); QStringList qmakeFeaturePaths(); -- cgit v1.2.3 From b1c92a3dea51eb5b54a6ed8917ceca0b3772d7de Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 23 Apr 2012 14:14:16 +0200 Subject: move initialization of $$TARGET to setupProject() that's what we have it for Change-Id: Ib734b97d337a82c73b086dfeb2b263171f2a02b7 Reviewed-by: Joerg Bornemann --- qmake/project.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/qmake/project.cpp b/qmake/project.cpp index 80fd22841e..7f831c4cd4 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -1535,10 +1535,6 @@ QMakeProject::read(uchar cmd) doProjectInclude("default_pre", IncludeFlagFeature, vars); } - //get a default - if(pfile != "-" && vars["TARGET"].isEmpty()) - vars["TARGET"].append(QFileInfo(pfile).baseName()); - //before commandline if (cmd & ReadSetup) { parser.file = "(internal)"; @@ -1631,6 +1627,8 @@ void QMakeProject::setupProject() { setTemplate(vars["TEMPLATE"]); + if (pfile != "-") + vars["TARGET"] << QFileInfo(pfile).baseName(); } void -- cgit v1.2.3 From dfbaf479c817d35d6be160fbf8939eb798753442 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 23 Apr 2012 14:15:07 +0200 Subject: make project-related variables non-magic $$_PRO_FILE_, $$_PRO_FILE_PWD_ and $$OUT_PWD can be cleanly initialized. no need for magic. Change-Id: I2e339d17bae42ecb573c2f82c716f6be15a35b98 Reviewed-by: Joerg Bornemann --- qmake/project.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/qmake/project.cpp b/qmake/project.cpp index 7f831c4cd4..b9e5dcdb1f 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -1629,6 +1629,9 @@ QMakeProject::setupProject() setTemplate(vars["TEMPLATE"]); if (pfile != "-") vars["TARGET"] << QFileInfo(pfile).baseName(); + vars["_PRO_FILE_"] << pfile; + vars["_PRO_FILE_PWD_"] << (pfile.isEmpty() ? qmake_getpwd() : QFileInfo(pfile).absolutePath()); + vars["OUT_PWD"] << Option::output_dir; } void @@ -3753,11 +3756,8 @@ QMakeProject::doVariableReplaceExpand(const QString &str, QHash &place) { QString var = varMap(_var); - if (var == QLatin1String("OUT_PWD")) { //the out going dir - var = ".BUILTIN." + var; - place[var] = QStringList(Option::output_dir); - } else if(var == QLatin1String("PWD") || //current working dir (of _FILE_) - var == QLatin1String("IN_PWD")) { + if (var == QLatin1String("PWD") || //current working dir (of _FILE_) + var == QLatin1String("IN_PWD")) { var = ".BUILTIN." + var; place[var] = QStringList(qmake_getpwd()); } else if(var == QLatin1String("_LINE_")) { //parser line number @@ -3769,12 +3769,6 @@ QStringList &QMakeProject::values(const QString &_var, QHash[%s]", qPrintable(var), qPrintable(place[var].join("::"))); return place[var]; -- cgit v1.2.3 From b2b72eea044c90135284fb2ab2c4493d92f2502c Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 30 Apr 2012 15:02:19 +0200 Subject: deprecate $$IN_PWD it suggests a symmetry to $$OUT_PWD which simply isn't there. the shorter alias $$PWD is much more popular anyway. Change-Id: Iefbfd56f1a3e526f15c9d6cd1bf59778be6f2f8d Reviewed-by: Mark Brand --- qmake/project.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qmake/project.cpp b/qmake/project.cpp index b9e5dcdb1f..925cd613fd 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -254,6 +254,8 @@ static QString varMap(const QString &x) ret = "QMAKE_FRAMEWORKPATH"; else if(ret == "QMAKE_FRAMEWORKDIR_FLAGS") ret = "QMAKE_FRAMEWORKPATH_FLAGS"; + else if(ret == "IN_PWD") + ret = "PWD"; else return ret; warn_msg(WarnDeprecated, "%s:%d: Variable %s is deprecated; use %s instead.", @@ -3756,8 +3758,7 @@ QMakeProject::doVariableReplaceExpand(const QString &str, QHash &place) { QString var = varMap(_var); - if (var == QLatin1String("PWD") || //current working dir (of _FILE_) - var == QLatin1String("IN_PWD")) { + if (var == QLatin1String("PWD")) { var = ".BUILTIN." + var; place[var] = QStringList(qmake_getpwd()); } else if(var == QLatin1String("_LINE_")) { //parser line number -- cgit v1.2.3 From 5ef3c155db83ec6689e1cb8ec7a8e2a585903a6e Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 23 Apr 2012 14:47:34 +0200 Subject: set $$_DATE_ only on project startup this changes the semantics a bit - it will be the datetime of qmake startup rather than the time a particular file is processed. i'd argue that this is insignificant. Change-Id: I75918967bef25038ce54aa81ab03c027384c0268 Reviewed-by: Joerg Bornemann --- qmake/project.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/qmake/project.cpp b/qmake/project.cpp index 925cd613fd..00da74b003 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -1645,6 +1645,7 @@ QMakeProject::loadDefaults() vars["DIR_SEPARATOR"] << Option::dir_sep; vars["DIRLIST_SEPARATOR"] << Option::dirlist_sep; vars["QMAKE_QMAKE"] << Option::qmake_abslocation; + vars["_DATE_"] << QDateTime::currentDateTime().toString(); #if defined(Q_OS_WIN32) vars["QMAKE_HOST.os"] << QString::fromLatin1("Windows"); @@ -3767,9 +3768,6 @@ QStringList &QMakeProject::values(const QString &_var, QHash[%s]", qPrintable(var), qPrintable(place[var].join("::"))); return place[var]; -- cgit v1.2.3 From 96702729c8ac7ac99066c39693ddd38c3d7e9673 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 30 Apr 2012 15:04:01 +0200 Subject: make $$PWD non-magic on read like the other variables, we can just store it in the hash. Change-Id: I49ad39dca8d498119b27f16ea4bdc44ae698d72e Reviewed-by: Joerg Bornemann --- qmake/project.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/qmake/project.cpp b/qmake/project.cpp index 00da74b003..15349b4cdd 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -1300,6 +1300,7 @@ QMakeProject::read(const QString &file, QHash &place) qmake_setpwd(QFileInfo(filename).absolutePath()); } if(ret) { + place["PWD"] = QStringList(qmake_getpwd()); parser_info pi = parser; parser.from_file = true; parser.file = filename; @@ -1897,6 +1898,7 @@ QMakeProject::doProjectInclude(QString file, uchar flags, QHash &place) { QString var = varMap(_var); - if (var == QLatin1String("PWD")) { - var = ".BUILTIN." + var; - place[var] = QStringList(qmake_getpwd()); - } else if(var == QLatin1String("_LINE_")) { //parser line number + if (var == QLatin1String("_LINE_")) { //parser line number var = ".BUILTIN." + var; place[var] = QStringList(QString::number(parser.line_no)); } else if(var == QLatin1String("_FILE_")) { //parser file -- cgit v1.2.3 From 79d6839306632d81b44e4ab01280f5220717b965 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 23 Apr 2012 15:07:44 +0200 Subject: introduce magicValues() function the only place where the two remaining magic values need to be referencable is doVariableReplaceExpand(), so make a separate function and use it only in that place. Change-Id: I6e2fcfa3a4f16727d90ace56eb88fc99ef272ffc Reviewed-by: Joerg Bornemann --- qmake/project.cpp | 10 ++++++++-- qmake/project.h | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/qmake/project.cpp b/qmake/project.cpp index 15349b4cdd..a5ed2bebaf 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -3683,7 +3683,7 @@ QMakeProject::doVariableReplaceExpand(const QString &str, QHash &place) +QStringList &QMakeProject::magicValues(const QString &_var, QHash &place) { QString var = varMap(_var); if (var == QLatin1String("_LINE_")) { //parser line number @@ -3772,6 +3772,12 @@ QStringList &QMakeProject::values(const QString &_var, QHash &place) +{ + QString var = varMap(_var); + return place[var]; +} + bool QMakeProject::isEmpty(const QString &v) { QHash::ConstIterator it = vars.constFind(varMap(v)); diff --git a/qmake/project.h b/qmake/project.h index 0fb8048935..8dc863a2f8 100644 --- a/qmake/project.h +++ b/qmake/project.h @@ -117,6 +117,7 @@ class QMakeProject void loadDefaults(); void setupProject(); QStringList &values(const QString &v, QHash &place); + QStringList &magicValues(const QString &v, QHash &place); QStringList qmakeFeaturePaths(); public: -- cgit v1.2.3 From e0f1de0788954ff78f796a1f732800e762075cb0 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 23 Apr 2012 17:16:56 +0200 Subject: don't use backwards compat mapping for generator accesses we can rely on only user code needing variable mapping, so apply it only in the evaluator. Change-Id: I6fc58e7bcf24cf0fa8783d5341ab1e7b9f001c88 Reviewed-by: Joerg Bornemann --- qmake/project.cpp | 2 +- qmake/project.h | 21 ++++++--------------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/qmake/project.cpp b/qmake/project.cpp index a5ed2bebaf..30b2cd2b33 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -3780,7 +3780,7 @@ QStringList &QMakeProject::values(const QString &_var, QHash::ConstIterator it = vars.constFind(varMap(v)); + QHash::ConstIterator it = vars.constFind(v); return it == vars.constEnd() || it->isEmpty(); } diff --git a/qmake/project.h b/qmake/project.h index 8dc863a2f8..34ca8ec194 100644 --- a/qmake/project.h +++ b/qmake/project.h @@ -164,12 +164,12 @@ public: bool isActiveConfig(const QString &x, bool regex=false, QHash *place=NULL); - bool isSet(const QString &v); // No compat mapping, no magic variables - bool isEmpty(const QString &v); // With compat mapping, but no magic variables - QStringList &values(const QString &v); // With compat mapping and magic variables - QString first(const QString &v); // ditto - int intValue(const QString &v, int defaultValue = 0); // ditto - QHash &variables(); // No compat mapping and magic, obviously + bool isSet(const QString &v) { return vars.contains(v); } + bool isEmpty(const QString &v); + QStringList &values(const QString &v) { return vars[v]; } + QString first(const QString &v); + int intValue(const QString &v, int defaultValue = 0); + QHash &variables() { return vars; } bool isRecursive() const { return recursive; } bool isHostBuild() const { return host_build; } @@ -189,12 +189,6 @@ inline QString QMakeProject::projectFile() return pfile; } -inline QStringList &QMakeProject::values(const QString &v) -{ return values(v, vars); } - -inline bool QMakeProject::isSet(const QString &v) -{ return vars.contains(v); } - inline QString QMakeProject::first(const QString &v) { const QStringList vals = values(v); @@ -215,9 +209,6 @@ inline int QMakeProject::intValue(const QString &v, int defaultValue) return defaultValue; } -inline QHash &QMakeProject::variables() -{ return vars; } - QT_END_NAMESPACE #endif // PROJECT_H -- cgit v1.2.3 From f85292ab206adaa43a9c8e4bfb02249cc4b2ea4d Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 23 Apr 2012 16:20:30 +0200 Subject: const correctness for values() calls Change-Id: I1476ae8d3fb7364686398c5650729dee94a8e933 Reviewed-by: Mark Brand --- qmake/generators/integrity/gbuild.cpp | 36 +++++++------ qmake/generators/mac/pbuilder_pbx.cpp | 10 ++-- qmake/generators/makefile.cpp | 86 +++++++++++++++---------------- qmake/generators/unix/unixmake.cpp | 2 +- qmake/generators/unix/unixmake2.cpp | 28 +++++----- qmake/generators/win32/borland_bmake.cpp | 2 +- qmake/generators/win32/mingw_make.cpp | 10 ++-- qmake/generators/win32/msvc_nmake.cpp | 8 +-- qmake/generators/win32/msvc_objectmodel.h | 2 +- qmake/generators/win32/msvc_vcproj.cpp | 6 +-- qmake/generators/win32/winmakefile.cpp | 12 ++--- 11 files changed, 103 insertions(+), 99 deletions(-) diff --git a/qmake/generators/integrity/gbuild.cpp b/qmake/generators/integrity/gbuild.cpp index 0d9d81c549..a587cf1c8e 100644 --- a/qmake/generators/integrity/gbuild.cpp +++ b/qmake/generators/integrity/gbuild.cpp @@ -259,8 +259,8 @@ GBuildMakefileGenerator::write() t << "\t-Iwork\n"; t << "\t-Llib\n"; t << "\t"; - QStringList &l = project->values("QMAKE_CXXFLAGS"); - for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { + const QStringList &l = project->values("QMAKE_CXXFLAGS"); + for (QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { if ((*it).startsWith("-")) t << "\n" << "\t" << (*it); else @@ -285,8 +285,8 @@ GBuildMakefileGenerator::write() if (isnativebin && (i == 0)) continue; t << "\t"; - QStringList &l = project->values(src[i]); - for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { + const QStringList &l = project->values(src[i]); + for (QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { if ((*it).startsWith("-")) t << "\n" << "\t" << (*it); else @@ -298,8 +298,8 @@ GBuildMakefileGenerator::write() /* first subdirectories/subprojects */ { - QStringList &l = project->values("SUBDIRS"); - for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { + const QStringList &l = project->values("SUBDIRS"); + for (QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { QString gpjname((*it)); /* avoid native tools */ if (nativebins.contains(gpjname.section("_", -1))) @@ -319,9 +319,10 @@ GBuildMakefileGenerator::write() } { - QStringList &l = project->values("RESOURCES"); - for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { - QString tmpstr((*it).replace(pathtoremove, "")); + const QStringList &l = project->values("RESOURCES"); + for (QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { + QString tmpstr(*it); + tmpstr.remove(pathtoremove); t << tmpstr << "\t[Qt Resource]\n"; tmpstr = tmpstr.section(".", -2, -1).section(QDir::separator(), -1); tmpstr.remove(".qrc"); @@ -332,9 +333,10 @@ GBuildMakefileGenerator::write() } } { - QStringList &l = project->values("FORMS"); - for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { - QString tmpstr((*it).replace(pathtoremove, "")); + const QStringList &l = project->values("FORMS"); + for (QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { + QString tmpstr(*it); + tmpstr.remove(pathtoremove); t << tmpstr << "\t[Qt Dialog]\n"; tmpstr = tmpstr.section(".", 0, 0).section(QDir::separator(), -1); tmpstr.insert(tmpstr.lastIndexOf(QDir::separator()) + 1, "ui_"); @@ -347,22 +349,22 @@ GBuildMakefileGenerator::write() /* source files for this project */ QString src[] = { "HEADERS", "SOURCES", QString() }; for (int i = 0; !src[i].isNull(); i++) { - QStringList &l = project->values(src[i]); - for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { + const QStringList &l = project->values(src[i]); + for (QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { if ((*it).isEmpty()) continue; /* native tools aren't preprocessed */ if (!isnativebin) t << writeOne((*it), pathtoremove); else - t << (*it).remove(pathtoremove) << "\n"; + t << QString(*it).remove(pathtoremove) << "\n"; } } t << "\n"; { - QStringList &l = project->values("GENERATED_SOURCES"); - for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { + const QStringList &l = project->values("GENERATED_SOURCES"); + for (QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { t << "work/" << (*it).section(QDir::separator(), -1) << "\n"; } } diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index 80c220ed2b..b1b4c4381f 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -393,7 +393,7 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t) t << "\t\t\t" << writeSettings("buildConfigurationList", keyFor("QMAKE_SUBDIR_PBX_BUILDCONFIG_LIST")) << ";" << "\n"; t << "\t\t\t" << "projectReferences = (" << "\n"; { - QStringList &qmake_subdirs = project->values("QMAKE_PBX_SUBDIRS"); + const QStringList &qmake_subdirs = project->values("QMAKE_PBX_SUBDIRS"); for(int i = 0; i < qmake_subdirs.count(); i++) { QString subdir = qmake_subdirs[i]; t << "\t\t\t\t" << "{" << "\n" @@ -714,16 +714,16 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) mkt << "IMAGES = " << varList("QMAKE_IMAGE_COLLECTION") << endl; mkt << "PARSERS ="; if(!project->isEmpty("YACCSOURCES")) { - QStringList &yaccs = project->values("YACCSOURCES"); - for(QStringList::Iterator yit = yaccs.begin(); yit != yaccs.end(); ++yit) { + const QStringList &yaccs = project->values("YACCSOURCES"); + for (QStringList::ConstIterator yit = yaccs.begin(); yit != yaccs.end(); ++yit) { QFileInfo fi(fileInfo((*yit))); mkt << " " << fi.path() << Option::dir_sep << fi.baseName() << Option::yacc_mod << Option::cpp_ext.first(); } } if(!project->isEmpty("LEXSOURCES")) { - QStringList &lexs = project->values("LEXSOURCES"); - for(QStringList::Iterator lit = lexs.begin(); lit != lexs.end(); ++lit) { + const QStringList &lexs = project->values("LEXSOURCES"); + for (QStringList::ConstIterator lit = lexs.begin(); lit != lexs.end(); ++lit) { QFileInfo fi(fileInfo((*lit))); mkt << " " << fi.path() << Option::dir_sep << fi.baseName() << Option::lex_mod << Option::cpp_ext.first(); diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index ca22655171..89ee6a3d92 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -671,7 +671,7 @@ MakefileGenerator::init() if(tmp_out.isEmpty()) continue; if(project->values((*it) + ".CONFIG").indexOf("combine") != -1) { - QStringList &compilerInputs = project->values((*it) + ".input"); + const QStringList &compilerInputs = project->values((*it) + ".input"); // Don't generate compiler output if it doesn't have input. if (compilerInputs.isEmpty() || project->values(compilerInputs.first()).isEmpty()) continue; @@ -709,8 +709,8 @@ MakefileGenerator::init() } } } else { - QStringList &tmp = project->values((*it) + ".input"); - for(QStringList::Iterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) { + const QStringList &tmp = project->values((*it) + ".input"); + for (QStringList::ConstIterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) { const QStringList inputs = project->values((*it2)); for(QStringList::ConstIterator input = inputs.constBegin(); input != inputs.constEnd(); ++input) { if((*input).isEmpty()) @@ -1157,11 +1157,11 @@ MakefileGenerator::writePrlFile() void MakefileGenerator::writeObj(QTextStream &t, const QString &src) { - QStringList &srcl = project->values(src); - QStringList objl = createObjectList(srcl); + const QStringList &srcl = project->values(src); + const QStringList objl = createObjectList(srcl); - QStringList::Iterator oit = objl.begin(); - QStringList::Iterator sit = srcl.begin(); + QStringList::ConstIterator oit = objl.begin(); + QStringList::ConstIterator sit = srcl.begin(); QString stringSrc("$src"); QString stringObj("$obj"); for(;sit != srcl.end() && oit != objl.end(); ++oit, ++sit) { @@ -1222,8 +1222,8 @@ MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs, bool n rm_dir_contents = "-$(DEL_FILE) -r"; QString all_installs, all_uninstalls; - QStringList &l = project->values(installs); - for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { + const QStringList &l = project->values(installs); + for (QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { QString pvar = (*it) + ".path"; if(project->values((*it) + ".CONFIG").indexOf("no_path") == -1 && project->values((*it) + ".CONFIG").indexOf("dummy_install") == -1 && @@ -1689,10 +1689,10 @@ MakefileGenerator::verifyExtraCompiler(const QString &comp, const QString &file_ if(!pass) return false; } else { - QStringList &tmp = project->values(comp + ".input"); - for(QStringList::Iterator it = tmp.begin(); it != tmp.end(); ++it) { - QStringList &inputs = project->values((*it)); - for(QStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) { + const QStringList &tmp = project->values(comp + ".input"); + for (QStringList::ConstIterator it = tmp.begin(); it != tmp.end(); ++it) { + const QStringList &inputs = project->values((*it)); + for (QStringList::ConstIterator input = inputs.begin(); input != inputs.end(); ++input) { if((*input).isEmpty()) continue; QString in = fileFixify(Option::fixPathToTargetOS((*input), false)); @@ -1735,10 +1735,10 @@ MakefileGenerator::verifyExtraCompiler(const QString &comp, const QString &file_ if(system(cmd.toLatin1().constData())) return false; } else { - QStringList &tmp = project->values(comp + ".input"); - for(QStringList::Iterator it = tmp.begin(); it != tmp.end(); ++it) { - QStringList &inputs = project->values((*it)); - for(QStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) { + const QStringList &tmp = project->values(comp + ".input"); + for (QStringList::ConstIterator it = tmp.begin(); it != tmp.end(); ++it) { + const QStringList &inputs = project->values((*it)); + for (QStringList::ConstIterator input = inputs.begin(); input != inputs.end(); ++input) { if((*input).isEmpty()) continue; QString in = fileFixify(Option::fixPathToTargetOS((*input), false)); @@ -1759,14 +1759,14 @@ MakefileGenerator::verifyExtraCompiler(const QString &comp, const QString &file_ void MakefileGenerator::writeExtraTargets(QTextStream &t) { - QStringList &qut = project->values("QMAKE_EXTRA_TARGETS"); - for(QStringList::Iterator it = qut.begin(); it != qut.end(); ++it) { + const QStringList &qut = project->values("QMAKE_EXTRA_TARGETS"); + for (QStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it) { QString targ = var((*it) + ".target"), cmd = var((*it) + ".commands"), deps; if(targ.isEmpty()) targ = (*it); - QStringList &deplist = project->values((*it) + ".depends"); - for(QStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) { + const QStringList &deplist = project->values((*it) + ".depends"); + for (QStringList::ConstIterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) { QString dep = var((*dep_it) + ".target"); if(dep.isEmpty()) dep = (*dep_it); @@ -1828,7 +1828,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) + escapeFilePath(Option::fixPathToLocalOS(Option::output_dir, false)) + QLatin1String(" && "); } - QStringList &vars = project->values((*it) + ".variables"); + const QStringList &vars = project->values((*it) + ".variables"); if(tmp_out.isEmpty() || tmp_cmd.isEmpty()) continue; QStringList tmp_inputs; @@ -2120,10 +2120,10 @@ MakefileGenerator::writeExtraVariables(QTextStream &t) t << endl; QStringList outlist; - QHash &vars = project->variables(); - QStringList &exports = project->values("QMAKE_EXTRA_VARIABLES"); - for (QHash::Iterator it = vars.begin(); it != vars.end(); ++it) { - for (QStringList::Iterator exp_it = exports.begin(); exp_it != exports.end(); ++exp_it) { + const QHash &vars = project->variables(); + const QStringList &exports = project->values("QMAKE_EXTRA_VARIABLES"); + for (QHash::ConstIterator it = vars.begin(); it != vars.end(); ++it) { + for (QStringList::ConstIterator exp_it = exports.begin(); exp_it != exports.end(); ++exp_it) { QRegExp rx((*exp_it), Qt::CaseInsensitive, QRegExp::Wildcard); if (rx.exactMatch(it.key())) outlist << ("EXPORT_" + it.key() + " = " + it.value().join(" ")); @@ -2139,7 +2139,7 @@ bool MakefileGenerator::writeStubMakefile(QTextStream &t) { t << "QMAKE = " << var("QMAKE_QMAKE") << endl; - QStringList &qut = project->values("QMAKE_EXTRA_TARGETS"); + const QStringList &qut = project->values("QMAKE_EXTRA_TARGETS"); for(QStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it) t << *it << " "; //const QString ofile = Option::fixPathToTargetOS(fileFixify(Option::output.fileName())); @@ -2396,8 +2396,8 @@ void MakefileGenerator::writeSubTargets(QTextStream &t, QList targets, int flags) { // blasted includes - QStringList &qeui = project->values("QMAKE_EXTRA_INCLUDES"); - for(QStringList::Iterator qeui_it = qeui.begin(); qeui_it != qeui.end(); ++qeui_it) + const QStringList &qeui = project->values("QMAKE_EXTRA_INCLUDES"); + for (QStringList::ConstIterator qeui_it = qeui.begin(); qeui_it != qeui.end(); ++qeui_it) t << "include " << (*qeui_it) << endl; if (!(flags & SubTargetSkipDefaultVariables)) { @@ -2607,16 +2607,16 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QListvalues("QMAKE_EXTRA_TARGETS"); - for(QStringList::Iterator qut_it = qut.begin(); qut_it != qut.end(); ++qut_it) { + const QStringList &qut = project->values("QMAKE_EXTRA_TARGETS"); + for (QStringList::ConstIterator qut_it = qut.begin(); qut_it != qut.end(); ++qut_it) { QString targ = var((*qut_it) + ".target"), cmd = var((*qut_it) + ".commands"), deps; if(targ.isEmpty()) targ = (*qut_it); t << endl; - QStringList &deplist = project->values((*qut_it) + ".depends"); - for(QStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) { + const QStringList &deplist = project->values((*qut_it) + ".depends"); + for (QStringList::ConstIterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) { QString dep = var((*dep_it) + ".target"); if(dep.isEmpty()) dep = Option::fixPathToTargetOS(*dep_it, false); @@ -2931,8 +2931,8 @@ MakefileGenerator::checkMultipleDefinition(const QString &f, const QString &w) int slsh = f.lastIndexOf(Option::dir_sep); if(slsh != -1) file.remove(0, slsh + 1); - QStringList &l = project->values(w); - for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { + const QStringList &l = project->values(w); + for (QStringList::ConstIterator val_it = l.begin(); val_it != l.end(); ++val_it) { QString file2((*val_it)); slsh = file2.lastIndexOf(Option::dir_sep); if(slsh != -1) @@ -2965,8 +2965,8 @@ MakefileGenerator::findFileForDep(const QMakeLocalFileName &dep, const QMakeLoca QMakeLocalFileName ret; if(!project->isEmpty("SKIP_DEPENDS")) { bool found = false; - QStringList &nodeplist = project->values("SKIP_DEPENDS"); - for(QStringList::Iterator it = nodeplist.begin(); + const QStringList &nodeplist = project->values("SKIP_DEPENDS"); + for (QStringList::ConstIterator it = nodeplist.begin(); it != nodeplist.end(); ++it) { QRegExp regx((*it)); if(regx.indexIn(dep.local()) != -1) { @@ -3014,8 +3014,8 @@ MakefileGenerator::findFileForDep(const QMakeLocalFileName &dep, const QMakeLoca } { //is it from an EXTRA_TARGET const QString dep_basename = dep.local().section(Option::dir_sep, -1); - QStringList &qut = project->values("QMAKE_EXTRA_TARGETS"); - for(QStringList::Iterator it = qut.begin(); it != qut.end(); ++it) { + const QStringList &qut = project->values("QMAKE_EXTRA_TARGETS"); + for (QStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it) { QString targ = var((*it) + ".target"); if(targ.isEmpty()) targ = (*it); @@ -3033,10 +3033,10 @@ MakefileGenerator::findFileForDep(const QMakeLocalFileName &dep, const QMakeLoca QString tmp_out = project->values((*it) + ".output").first(); if(tmp_out.isEmpty()) continue; - QStringList &tmp = project->values((*it) + ".input"); - for(QStringList::Iterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) { - QStringList &inputs = project->values((*it2)); - for(QStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) { + const QStringList &tmp = project->values((*it) + ".input"); + for (QStringList::ConstIterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) { + const QStringList &inputs = project->values((*it2)); + for (QStringList::ConstIterator input = inputs.begin(); input != inputs.end(); ++input) { QString out = Option::fixPathToTargetOS(unescapeFilePath(replaceExtraCompilerVariables(tmp_out, (*input), QString()))); if(out == dep.real() || out.section(Option::dir_sep, -1) == dep_basename) { ret = QMakeLocalFileName(fileFixify(out, qmake_getpwd(), Option::output_dir)); diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp index 02f8666bbb..31b059decc 100644 --- a/qmake/generators/unix/unixmake.cpp +++ b/qmake/generators/unix/unixmake.cpp @@ -742,7 +742,7 @@ UnixMakefileGenerator::defaultInstall(const QString &t) QStringList links; QString target="$(TARGET)"; - QStringList &targets = project->values(t + ".targets"); + const QStringList &targets = project->values(t + ".targets"); if(!project->isEmpty("QMAKE_BUNDLE")) { target = project->first("QMAKE_BUNDLE"); bundle = true; diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 490b76e494..f13699f0f7 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -82,7 +82,7 @@ UnixMakefileGenerator::writeMakefile(QTextStream &t) writeHeader(t); if(!project->values("QMAKE_FAILED_REQUIREMENTS").isEmpty()) { t << "QMAKE = " << var("QMAKE_QMAKE") << endl; - QStringList &qut = project->values("QMAKE_EXTRA_TARGETS"); + const QStringList &qut = project->values("QMAKE_EXTRA_TARGETS"); for(QStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it) t << *it << " "; t << "first all clean install distclean uninstall qmake_all:" << "\n\t" @@ -190,11 +190,13 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "SOURCES = " << valList(escapeFilePaths(project->values("SOURCES"))) << " " << valList(escapeFilePaths(project->values("GENERATED_SOURCES"))) << endl; if(do_incremental) { - QStringList &objs = project->values("OBJECTS"), &incrs = project->values("QMAKE_INCREMENTAL"), incrs_out; + const QStringList &objs = project->values("OBJECTS"); + const QStringList &incrs = project->values("QMAKE_INCREMENTAL"); + QStringList incrs_out; t << "OBJECTS = "; - for(QStringList::Iterator objit = objs.begin(); objit != objs.end(); ++objit) { + for (QStringList::ConstIterator objit = objs.begin(); objit != objs.end(); ++objit) { bool increment = false; - for(QStringList::Iterator incrit = incrs.begin(); incrit != incrs.end(); ++incrit) { + for (QStringList::ConstIterator incrit = incrs.begin(); incrit != incrs.end(); ++incrit) { if((*objit).indexOf(QRegExp((*incrit), Qt::CaseSensitive, QRegExp::Wildcard)) != -1) { increment = true; @@ -247,8 +249,8 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << endl; // blasted includes - QStringList &qeui = project->values("QMAKE_EXTRA_INCLUDES"); - QStringList::Iterator it; + const QStringList &qeui = project->values("QMAKE_EXTRA_INCLUDES"); + QStringList::ConstIterator it; for(it = qeui.begin(); it != qeui.end(); ++it) t << "include " << (*it) << endl; @@ -301,8 +303,8 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) QString src[] = { "SOURCES", "GENERATED_SOURCES", QString() }; for(int x = 0; !src[x].isNull(); x++) { - QStringList &l = project->values(src[x]); - for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { + const QStringList &l = project->values(src[x]); + for (QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { if(!(*it).isEmpty()) { QString d_file; for(QStringList::Iterator cit = Option::c_ext.begin(); @@ -343,15 +345,15 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) if(!project->isEmpty("SUBLIBS_DIR")) libdir = project->first("SUBLIBS_DIR"); t << "SUBLIBS = "; - QStringList &l = project->values("SUBLIBS"); - for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) + const QStringList &l = project->values("SUBLIBS"); + for (QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) t << libdir << project->first("QMAKE_PREFIX_STATICLIB") << (*it) << "." << project->first("QMAKE_EXTENSION_STATICLIB") << " "; t << endl << endl; } if(project->isActiveConfig("depend_prl") && !project->isEmpty("QMAKE_PRL_INTERNAL_FILES")) { - QStringList &l = project->values("QMAKE_PRL_INTERNAL_FILES"); - QStringList::Iterator it; + const QStringList &l = project->values("QMAKE_PRL_INTERNAL_FILES"); + QStringList::ConstIterator it; for(it = l.begin(); it != l.end(); ++it) { QMakeMetaInfo libinfo; if(libinfo.readLib((*it)) && !libinfo.isEmpty("QMAKE_PRL_BUILD_DIR")) { @@ -886,7 +888,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) QString libdir = "tmp/"; if(!project->isEmpty("SUBLIBS_DIR")) libdir = project->first("SUBLIBS_DIR"); - QStringList &l = project->values("SUBLIBS"); + const QStringList &l = project->values("SUBLIBS"); for(it = l.begin(); it != l.end(); ++it) t << libdir << project->first("QMAKE_PREFIX_STATICLIB") << (*it) << "." << project->first("QMAKE_EXTENSION_STATICLIB") << ":\n\t" diff --git a/qmake/generators/win32/borland_bmake.cpp b/qmake/generators/win32/borland_bmake.cpp index 4c4ddf642e..110e2eafa6 100644 --- a/qmake/generators/win32/borland_bmake.cpp +++ b/qmake/generators/win32/borland_bmake.cpp @@ -57,7 +57,7 @@ BorlandMakefileGenerator::writeMakefile(QTextStream &t) { writeHeader(t); if(!project->values("QMAKE_FAILED_REQUIREMENTS").isEmpty()) { - QStringList &qut = project->values("QMAKE_EXTRA_TARGETS"); + const QStringList &qut = project->values("QMAKE_EXTRA_TARGETS"); for(QStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it) t << *it << " "; t << "all first clean:" << "\n\t" diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index e62221e636..568e60a068 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -91,8 +91,8 @@ bool MingwMakefileGenerator::findLibraries(const QString &where) QList dirs; { - QStringList &libpaths = project->values("QMAKE_LIBDIR"); - for(QStringList::Iterator libpathit = libpaths.begin(); + const QStringList &libpaths = project->values("QMAKE_LIBDIR"); + for (QStringList::ConstIterator libpathit = libpaths.begin(); libpathit != libpaths.end(); ++libpathit) dirs.append(QMakeLocalFileName((*libpathit))); } @@ -148,7 +148,7 @@ bool MingwMakefileGenerator::writeMakefile(QTextStream &t) if(Option::mkfile::do_stub_makefile) { t << "QMAKE = " << var("QMAKE_QMAKE") << endl; - QStringList &qut = project->values("QMAKE_EXTRA_TARGETS"); + const QStringList &qut = project->values("QMAKE_EXTRA_TARGETS"); for(QStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it) t << *it << " "; t << "first all clean install distclean uninstall: qmake" << endl @@ -344,8 +344,8 @@ void MingwMakefileGenerator::writeIncPart(QTextStream &t) { t << "INCPATH = "; - QStringList &incs = project->values("INCLUDEPATH"); - for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) { + const QStringList &incs = project->values("INCLUDEPATH"); + for (QStringList::ConstIterator incit = incs.begin(); incit != incs.end(); ++incit) { QString inc = (*incit); inc.replace(QRegExp("\\\\$"), ""); inc.replace(QRegExp("\""), ""); diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index adf8883b01..0107f025eb 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -59,8 +59,8 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t) { writeHeader(t); if(!project->values("QMAKE_FAILED_REQUIREMENTS").isEmpty()) { - QStringList &qut = project->values("QMAKE_EXTRA_TARGETS"); - for(QStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it) + const QStringList &qut = project->values("QMAKE_EXTRA_TARGETS"); + for (QStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it) t << *it << " "; t << "all first clean:" << "\n\t" << "@echo \"Some of the required modules (" @@ -332,8 +332,8 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t) } QString srcs[] = { QString("SOURCES"), QString("GENERATED_SOURCES"), QString() }; for(int x = 0; !srcs[x].isNull(); x++) { - QStringList &l = project->values(srcs[x]); - for(QStringList::Iterator sit = l.begin(); sit != l.end(); ++sit) { + const QStringList &l = project->values(srcs[x]); + for (QStringList::ConstIterator sit = l.begin(); sit != l.end(); ++sit) { QString sep = "\\"; if((*sit).indexOf(sep) == -1) sep = "/"; diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h index 37d923f9c1..0d1e11b277 100644 --- a/qmake/generators/win32/msvc_objectmodel.h +++ b/qmake/generators/win32/msvc_objectmodel.h @@ -475,7 +475,7 @@ protected: virtual ~VCToolBase(){} virtual bool parseOption(const char* option) = 0; public: - void parseOptions(QStringList& options) { + void parseOptions(const QStringList& options) { for (QStringList::ConstIterator it=options.begin(); (it!=options.end()); it++) parseOption((*it).toLatin1().constData()); } diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index b228917692..6fb73c0d50 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -1112,7 +1112,7 @@ void VcprojGenerator::initDeploymentTool() // Only deploy Qt libs for shared build if (!project->values("QMAKE_QT_DLL").isEmpty()) { - QStringList& arg = project->values("MSVCPROJ_LIBS"); + const QStringList &arg = project->values("MSVCPROJ_LIBS"); for (QStringList::ConstIterator it = arg.constBegin(); it != arg.constEnd(); ++it) { if (it->contains(project->first("QMAKE_LIBDIR"))) { QString dllName = *it; @@ -1471,8 +1471,8 @@ void VcprojGenerator::initOld() // $$QMAKE.. -> $$MSVCPROJ.. ------------------------------------- project->values("MSVCPROJ_LIBS") += project->values("QMAKE_LIBS"); project->values("MSVCPROJ_LIBS") += project->values("QMAKE_LIBS_PRIVATE"); - QStringList &incs = project->values("INCLUDEPATH"); - for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) { + const QStringList &incs = project->values("INCLUDEPATH"); + for (QStringList::ConstIterator incit = incs.begin(); incit != incs.end(); ++incit) { QString inc = (*incit); if (!inc.startsWith('"') && !inc.endsWith('"')) inc = QString("\"%1\"").arg(inc); // Quote all paths if not quoted already diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index 895c331b21..319cd68338 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -110,8 +110,8 @@ Win32MakefileGenerator::findLibraries(const QString &where) QStringList &l = project->values(where); QList dirs; { - QStringList &libpaths = project->values("QMAKE_LIBDIR"); - for(QStringList::Iterator libpathit = libpaths.begin(); + const QStringList &libpaths = project->values("QMAKE_LIBDIR"); + for (QStringList::ConstIterator libpathit = libpaths.begin(); libpathit != libpaths.end(); ++libpathit) dirs.append(QMakeLocalFileName((*libpathit))); } @@ -223,8 +223,8 @@ Win32MakefileGenerator::processPrlFiles() QHash processed; QList libdirs; { - QStringList &libpaths = project->values("QMAKE_LIBDIR"); - for(QStringList::Iterator libpathit = libpaths.begin(); libpathit != libpaths.end(); ++libpathit) + const QStringList &libpaths = project->values("QMAKE_LIBDIR"); + for (QStringList::ConstIterator libpathit = libpaths.begin(); libpathit != libpaths.end(); ++libpathit) libdirs.append(QMakeLocalFileName((*libpathit))); } for(bool ret = false; true; ret = false) { @@ -730,8 +730,8 @@ void Win32MakefileGenerator::writeStandardParts(QTextStream &t) if(!project->isEmpty("TRANSLATIONS")) dist_files << var("TRANSLATIONS"); if(!project->isEmpty("FORMS")) { - QStringList &forms = project->values("FORMS"); - for(QStringList::Iterator formit = forms.begin(); formit != forms.end(); ++formit) { + const QStringList &forms = project->values("FORMS"); + for (QStringList::ConstIterator formit = forms.begin(); formit != forms.end(); ++formit) { QString ui_h = fileFixify((*formit) + Option::h_ext.first()); if(exists(ui_h)) dist_files << ui_h; -- cgit v1.2.3 From cb4394773809100f06afed6e140411eb92851c49 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 23 Apr 2012 16:57:01 +0200 Subject: make magicValues() const the weird debugging feature is not used anyway Change-Id: I07f481a94f2b2ab2a5b61270f0e00183cefd4cd1 Reviewed-by: Joerg Bornemann --- qmake/project.cpp | 9 +++------ qmake/project.h | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/qmake/project.cpp b/qmake/project.cpp index 30b2cd2b33..45e2ee0e63 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -3758,17 +3758,14 @@ QMakeProject::doVariableReplaceExpand(const QString &str, QHash &place) +QStringList QMakeProject::magicValues(const QString &_var, const QHash &place) const { QString var = varMap(_var); if (var == QLatin1String("_LINE_")) { //parser line number - var = ".BUILTIN." + var; - place[var] = QStringList(QString::number(parser.line_no)); + return QStringList(QString::number(parser.line_no)); } else if(var == QLatin1String("_FILE_")) { //parser file - var = ".BUILTIN." + var; - place[var] = QStringList(parser.file); + return QStringList(parser.file); } - //qDebug("REPLACE [%s]->[%s]", qPrintable(var), qPrintable(place[var].join("::"))); return place[var]; } diff --git a/qmake/project.h b/qmake/project.h index 34ca8ec194..e46c7440ee 100644 --- a/qmake/project.h +++ b/qmake/project.h @@ -117,7 +117,7 @@ class QMakeProject void loadDefaults(); void setupProject(); QStringList &values(const QString &v, QHash &place); - QStringList &magicValues(const QString &v, QHash &place); + QStringList magicValues(const QString &v, const QHash &place) const; QStringList qmakeFeaturePaths(); public: -- cgit v1.2.3 From 6957cb26b3f5a89b458283f4916198bf117db2b0 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 23 Apr 2012 18:08:16 +0200 Subject: don't overuse variables() Change-Id: Ib2da88e5e29c0bfecc39a9c06e82a34a4bd0b1e6 Reviewed-by: Joerg Bornemann --- qmake/generators/makefile.cpp | 20 ++++++++++---------- qmake/generators/metamakefile.cpp | 4 ++-- qmake/generators/projectgenerator.cpp | 24 ++++++++++++------------ qmake/generators/win32/msvc_objectmodel.cpp | 14 +++++++------- qmake/generators/win32/msvc_vcproj.cpp | 28 ++++++++++++++-------------- qmake/option.cpp | 8 ++++---- 6 files changed, 49 insertions(+), 49 deletions(-) diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 89ee6a3d92..cfa84fdc0e 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -448,14 +448,14 @@ MakefileGenerator::init() continue_compiler_chain: if(jump_count > quc.size()) //just to avoid an infinite loop here break; - if(project->variables().contains(quc.at(comp_out) + ".variable_out")) { - const QStringList &outputs = project->variables().value(quc.at(comp_out) + ".variable_out"); + if (v.contains(quc.at(comp_out) + ".variable_out")) { + const QStringList &outputs = v.value(quc.at(comp_out) + ".variable_out"); for(int out = 0; out < outputs.size(); ++out) { for(int comp_in = 0; comp_in < quc.size(); ++comp_in) { if(comp_in == comp_out) continue; - if(project->variables().contains(quc.at(comp_in) + ".input")) { - const QStringList &inputs = project->variables().value(quc.at(comp_in) + ".input"); + if (v.contains(quc.at(comp_in) + ".input")) { + const QStringList &inputs = v.value(quc.at(comp_in) + ".input"); for(int in = 0; in < inputs.size(); ++in) { if(inputs.at(in) == outputs.at(out) && comp_out > comp_in) { ++jump_count; @@ -680,8 +680,8 @@ MakefileGenerator::init() continue; QString out = fileFixify(tmp_out, Option::output_dir, Option::output_dir); bool pre_dep = (project->values((*it) + ".CONFIG").indexOf("target_predeps") != -1); - if(project->variables().contains((*it) + ".variable_out")) { - const QStringList &var_out = project->variables().value((*it) + ".variable_out"); + if (v.contains((*it) + ".variable_out")) { + const QStringList &var_out = v.value((*it) + ".variable_out"); for(int i = 0; i < var_out.size(); ++i) { QString v = var_out.at(i); if(v == QLatin1String("SOURCES")) @@ -703,7 +703,7 @@ MakefileGenerator::init() list.append(out); } if(pre_dep) { - QStringList &list = project->variables()["PRE_TARGETDEPS"]; + QStringList &list = project->values("PRE_TARGETDEPS"); if(!list.contains(out)) list.append(out); } @@ -721,8 +721,8 @@ MakefileGenerator::init() QString out = replaceExtraCompilerVariables(tmp_out, (*input), QString()); out = fileFixify(out, Option::output_dir, Option::output_dir); bool pre_dep = (project->values((*it) + ".CONFIG").indexOf("target_predeps") != -1); - if(project->variables().contains((*it) + ".variable_out")) { - const QStringList &var_out = project->variables().value((*it) + ".variable_out"); + if (v.contains((*it) + ".variable_out")) { + const QStringList &var_out = project->values(*it + ".variable_out"); for(int i = 0; i < var_out.size(); ++i) { QString v = var_out.at(i); if(v == QLatin1String("SOURCES")) @@ -744,7 +744,7 @@ MakefileGenerator::init() list.append(out); } if(pre_dep) { - QStringList &list = project->variables()["PRE_TARGETDEPS"]; + QStringList &list = project->values("PRE_TARGETDEPS"); if(!list.contains(out)) list.append(out); } diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp index 42030507b7..425cc31c8a 100644 --- a/qmake/generators/metamakefile.cpp +++ b/qmake/generators/metamakefile.cpp @@ -104,7 +104,7 @@ BuildsMetaMakefileGenerator::init() return false; init_flag = true; - const QStringList &builds = project->variables()["BUILDS"]; + const QStringList &builds = project->values("BUILDS"); bool use_single_build = builds.isEmpty(); if(builds.count() > 1 && Option::output.fileName() == "-") { use_single_build = true; @@ -347,7 +347,7 @@ SubdirsMetaMakefileGenerator::init() qmake_setpwd(sub->input_dir); Option::output_dir = sub->output_dir; bool tmpError = !sub_proj->read(subdir.fileName()); - if(!sub_proj->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { + if (!sub_proj->isEmpty("QMAKE_FAILED_REQUIREMENTS")) { fprintf(stderr, "Project file(%s) not recursed because all requirements not met:\n\t%s\n", subdir.fileName().toLatin1().constData(), sub_proj->values("QMAKE_FAILED_REQUIREMENTS").join(" ").toLatin1().constData()); diff --git a/qmake/generators/projectgenerator.cpp b/qmake/generators/projectgenerator.cpp index 9a181a43f5..98f0e54258 100644 --- a/qmake/generators/projectgenerator.cpp +++ b/qmake/generators/projectgenerator.cpp @@ -77,7 +77,7 @@ ProjectGenerator::init() verifyCompilers(); project->read(QMakeProject::ReadFeatures); - project->variables()["CONFIG"].clear(); + project->values("CONFIG").clear(); QHash &v = project->variables(); QString templ = Option::user_template.isEmpty() ? QString("app") : Option::user_template; @@ -297,13 +297,13 @@ ProjectGenerator::init() } //strip out files that are actually output from internal compilers (ie temporary files) - const QStringList &quc = project->variables()["QMAKE_EXTRA_COMPILERS"]; + const QStringList &quc = project->values("QMAKE_EXTRA_COMPILERS"); for(QStringList::ConstIterator it = quc.begin(); it != quc.end(); ++it) { - QString tmp_out = project->variables()[(*it) + ".output"].first(); + QString tmp_out = project->first((*it) + ".output"); if(tmp_out.isEmpty()) continue; - QStringList var_out = project->variables()[(*it) + ".variable_out"]; + QStringList var_out = project->values((*it) + ".variable_out"); bool defaults = var_out.isEmpty(); for(int i = 0; i < var_out.size(); ++i) { QString v = var_out.at(i); @@ -317,15 +317,15 @@ ProjectGenerator::init() var_out << "HEADERS"; var_out << "FORMS"; } - const QStringList &tmp = project->variables()[(*it) + ".input"]; + const QStringList &tmp = project->values((*it) + ".input"); for(QStringList::ConstIterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) { - QStringList &inputs = project->variables()[(*it2)]; + QStringList &inputs = project->values(*it2); for(QStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) { QString path = replaceExtraCompilerVariables(tmp_out, (*input), QString()); path = fixPathToQmake(path).section('/', -1); for(int i = 0; i < var_out.size(); ++i) { QString v = var_out.at(i); - QStringList &list = project->variables()[v]; + QStringList &list = project->values(v); for(int src = 0; src < list.size(); ) { if(list[src] == path || list[src].endsWith("/" + path)) list.removeAt(src); @@ -356,7 +356,7 @@ ProjectGenerator::writeMakefile(QTextStream &t) QString ofn = QFileInfo(static_cast(t.device())->fileName()).completeBaseName(); if (ofn.isEmpty() || ofn == "-") ofn = "unknown"; - project->variables()["TARGET_ASSIGN"] = QStringList(ofn); + project->values("TARGET_ASSIGN") = QStringList(ofn); t << getWritableVar("TARGET_ASSIGN") << getWritableVar("CONFIG", false) @@ -384,8 +384,8 @@ ProjectGenerator::addConfig(const QString &cfg, bool add) QString where = "CONFIG"; if(!add) where = "CONFIG_REMOVE"; - if(!project->variables()[where].contains(cfg)) { - project->variables()[where] += cfg; + if (!project->values(where).contains(cfg)) { + project->values(where) += cfg; return true; } return false; @@ -439,7 +439,7 @@ ProjectGenerator::addFile(QString file) QString newfile = fixPathToQmake(fileFixify(file)); - QStringList &endList = project->variables()[where]; + QStringList &endList = project->values(where); if(!endList.contains(newfile, Qt::CaseInsensitive)) { endList += newfile; return true; @@ -450,7 +450,7 @@ ProjectGenerator::addFile(QString file) QString ProjectGenerator::getWritableVar(const QString &v, bool) { - QStringList &vals = project->variables()[v]; + QStringList &vals = project->values(v); if(vals.isEmpty()) return ""; diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index b474dac7a5..daaef0fbc4 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -2181,11 +2181,11 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) // All information about the extra compiler QString tmp_out = Project->project->first(extraCompilerName + ".output"); - QString tmp_cmd = Project->project->variables()[extraCompilerName + ".commands"].join(" "); - QString tmp_cmd_name = Project->project->variables()[extraCompilerName + ".name"].join(" "); - QStringList tmp_dep = Project->project->variables()[extraCompilerName + ".depends"]; - QString tmp_dep_cmd = Project->project->variables()[extraCompilerName + ".depend_command"].join(" "); - QStringList configs = Project->project->variables()[extraCompilerName + ".CONFIG"]; + QString tmp_cmd = Project->project->values(extraCompilerName + ".commands").join(" "); + QString tmp_cmd_name = Project->project->values(extraCompilerName + ".name").join(" "); + QStringList tmp_dep = Project->project->values(extraCompilerName + ".depends"); + QString tmp_dep_cmd = Project->project->values(extraCompilerName + ".depend_command").join(" "); + QStringList configs = Project->project->values(extraCompilerName + ".CONFIG"); bool combined = configs.indexOf("combine") != -1; QString cmd, cmd_name, out; @@ -2248,9 +2248,9 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) // Command for file if (combined) { // Add dependencies for each file - QStringList tmp_in = Project->project->variables()[extraCompilerName + ".input"]; + QStringList tmp_in = Project->project->values(extraCompilerName + ".input"); for (int a = 0; a < tmp_in.count(); ++a) { - const QStringList &files = Project->project->variables()[tmp_in.at(a)]; + const QStringList &files = Project->project->values(tmp_in.at(a)); for (int b = 0; b < files.count(); ++b) { deps += Project->findDependencies(files.at(b)); inputs += Option::fixPathToTargetOS(files.at(b), false); diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 6fb73c0d50..92daed0c0c 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -379,12 +379,12 @@ QUuid VcprojGenerator::increaseUUID(const QUuid &id) QStringList VcprojGenerator::collectSubDirs(QMakeProject *proj) { QStringList subdirs; - QStringList tmp_proj_subdirs = proj->variables()["SUBDIRS"]; + QStringList tmp_proj_subdirs = proj->values("SUBDIRS"); for(int x = 0; x < tmp_proj_subdirs.size(); ++x) { QString tmpdir = tmp_proj_subdirs.at(x); const QString tmpdirConfig = tmpdir + QStringLiteral(".CONFIG"); if (!proj->isEmpty(tmpdirConfig)) { - const QStringList config = proj->variables().value(tmpdirConfig); + const QStringList config = proj->values(tmpdirConfig); if (config.contains(QStringLiteral("no_default_target"))) continue; // Ignore this sub-dir } @@ -463,7 +463,7 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) } if(tmp_proj.read(fn)) { // Check if all requirements are fulfilled - if(!tmp_proj.variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { + if (!tmp_proj.isEmpty("QMAKE_FAILED_REQUIREMENTS")) { fprintf(stderr, "Project file(%s) not added to Solution because all requirements not met:\n\t%s\n", fn.toLatin1().constData(), tmp_proj.values("QMAKE_FAILED_REQUIREMENTS").join(" ").toLatin1().constData()); continue; @@ -536,17 +536,17 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) newDep->target = newDep->target.left(newDep->target.length()-3) + "lib"; // All ActiveQt Server projects are dependent on idc.exe - if(tmp_proj.variables()["CONFIG"].contains("qaxserver")) + if (tmp_proj.values("CONFIG").contains("qaxserver")) newDep->dependencies << "idc.exe"; // All extra compilers which has valid input are considered dependencies - const QStringList &quc = tmp_proj.variables()["QMAKE_EXTRA_COMPILERS"]; + const QStringList &quc = tmp_proj.values("QMAKE_EXTRA_COMPILERS"); for(QStringList::ConstIterator it = quc.constBegin(); it != quc.constEnd(); ++it) { - const QStringList &invar = tmp_proj.variables().value((*it) + ".input"); + const QStringList &invar = tmp_proj.values(*it + ".input"); for(QStringList::ConstIterator iit = invar.constBegin(); iit != invar.constEnd(); ++iit) { - const QStringList fileList = tmp_proj.variables().value(*iit); + const QStringList fileList = tmp_proj.values(*iit); if (!fileList.isEmpty()) { - const QStringList &cmdsParts = tmp_proj.variables().value((*it) + ".commands"); + const QStringList &cmdsParts = tmp_proj.values(*it + ".commands"); bool startOfLine = true; foreach(QString cmd, cmdsParts) { if (!startOfLine) { @@ -575,11 +575,11 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) // Add all unknown libs to the deps QStringList where = QStringList() << "QMAKE_LIBS" << "QMAKE_LIBS_PRIVATE"; if(!tmp_proj.isEmpty("QMAKE_INTERNAL_PRL_LIBS")) - where = tmp_proj.variables()["QMAKE_INTERNAL_PRL_LIBS"]; - for(QStringList::iterator wit = where.begin(); + where = tmp_proj.values("QMAKE_INTERNAL_PRL_LIBS"); + for (QStringList::ConstIterator wit = where.begin(); wit != where.end(); ++wit) { - QStringList &l = tmp_proj.variables()[(*wit)]; - for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { + const QStringList &l = tmp_proj.values(*wit); + for (QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { QString opt = (*it); if(!opt.startsWith("/") && // Not a switch opt != newDep->target && // Not self @@ -767,10 +767,10 @@ void VcprojGenerator::init() // unless the compiler is configure as a combined stage, then use the first one const QStringList &quc = project->values("QMAKE_EXTRA_COMPILERS"); for(QStringList::ConstIterator it = quc.constBegin(); it != quc.constEnd(); ++it) { - const QStringList &invar = project->variables().value((*it) + ".input"); + const QStringList &invar = project->values(*it + ".input"); const QString compiler_out = project->first((*it) + ".output"); for(QStringList::ConstIterator iit = invar.constBegin(); iit != invar.constEnd(); ++iit) { - QStringList fileList = project->variables().value(*iit); + QStringList fileList = project->values(*iit); if (!fileList.isEmpty()) { if (project->values((*it) + ".CONFIG").indexOf("combine") != -1) fileList = QStringList(fileList.first()); diff --git a/qmake/option.cpp b/qmake/option.cpp index d2ab2514d6..7d6148ce0a 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -557,9 +557,9 @@ void Option::prepareProject(const QString &pfile) bool Option::postProcessProject(QMakeProject *project) { - Option::cpp_ext = project->variables()["QMAKE_EXT_CPP"]; - Option::h_ext = project->variables()["QMAKE_EXT_H"]; - Option::c_ext = project->variables()["QMAKE_EXT_C"]; + Option::cpp_ext = project->values("QMAKE_EXT_CPP"); + Option::h_ext = project->values("QMAKE_EXT_H"); + Option::c_ext = project->values("QMAKE_EXT_C"); Option::res_ext = project->first("QMAKE_EXT_RES"); Option::pkgcfg_ext = project->first("QMAKE_EXT_PKGCONFIG"); Option::libtool_ext = project->first("QMAKE_EXT_LIBTOOL"); @@ -573,7 +573,7 @@ bool Option::postProcessProject(QMakeProject *project) Option::lex_mod = project->first("QMAKE_MOD_LEX"); Option::yacc_mod = project->first("QMAKE_MOD_YACC"); Option::dir_sep = project->first("QMAKE_DIR_SEP"); - Option::shellPath = project->variables()["QMAKE_SH"]; + Option::shellPath = project->values("QMAKE_SH"); return true; } -- cgit v1.2.3 From aac040b1881056f52c22c67dc7bb7f81f4c7a02f Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 23 Apr 2012 17:01:45 +0200 Subject: const correctness for variables() Change-Id: Id11453ccbae3ffa32580badadada945d342d727a Reviewed-by: Mark Brand --- qmake/generators/mac/pbuilder_pbx.cpp | 4 ++-- qmake/generators/makefile.cpp | 2 +- qmake/generators/win32/msvc_vcproj.cpp | 4 ++-- qmake/meta.cpp | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index b1b4c4381f..c967e18bfe 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -168,8 +168,8 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t) if(tmp_proj.read(fn)) { if(Option::debug_level) { debug_msg(1, "Dumping all variables:"); - QHash &vars = tmp_proj.variables(); - for(QHash::Iterator it = vars.begin(); + const QHash &vars = tmp_proj.variables(); + for (QHash::ConstIterator it = vars.begin(); it != vars.end(); ++it) { if(it.key().left(1) != "." && !it.value().isEmpty()) debug_msg(1, "%s: %s === %s", fn.toLatin1().constData(), it.key().toLatin1().constData(), diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index cfa84fdc0e..c4e0a4face 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -317,7 +317,7 @@ QStringList MakefileGenerator::findFilesInVPATH(QStringList l, uchar flags, const QString &vpath_var) { QStringList vpath; - QHash &v = project->variables(); + const QHash &v = project->variables(); for(int val_it = 0; val_it < l.count(); ) { bool remove_file = false; QString &val = l[val_it]; diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 92daed0c0c..2162841502 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -485,8 +485,8 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) Option::output_dir = old_output_dir; if(Option::debug_level) { debug_msg(1, "Dumping all variables:"); - QHash &vars = tmp_proj.variables(); - for(QHash::Iterator it = vars.begin(); + const QHash &vars = tmp_proj.variables(); + for (QHash::ConstIterator it = vars.begin(); it != vars.end(); ++it) { if(it.key().left(1) != "." && !it.value().isEmpty()) debug_msg(1, "%s: %s === %s", fn.toLatin1().constData(), it.key().toLatin1().constData(), diff --git a/qmake/meta.cpp b/qmake/meta.cpp index ecd78e3455..5577dedabe 100644 --- a/qmake/meta.cpp +++ b/qmake/meta.cpp @@ -142,8 +142,8 @@ QMakeMetaInfo::readLibtoolFile(const QString &f) dirf = ""; else if(!dirf.isEmpty() && !dirf.endsWith(Option::output_dir)) dirf += QLatin1Char('/'); - QHash &v = proj.variables(); - for(QHash::Iterator it = v.begin(); it != v.end(); ++it) { + const QHash &v = proj.variables(); + for (QHash::ConstIterator it = v.begin(); it != v.end(); ++it) { QStringList lst = it.value(); if(lst.count() == 1 && (lst.first().startsWith("'") || lst.first().startsWith("\"")) && lst.first().endsWith(QString(lst.first()[0]))) -- cgit v1.2.3 From a54875057f3292799f1d9211ded7b7eb19ef3a39 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 23 Apr 2012 17:06:58 +0200 Subject: make a bunch of functions const values() and variables() get both const and non-const overloads Change-Id: Idfabea1acc488bf78f24edb831681ee07f0074c4 Reviewed-by: Mark Brand --- qmake/project.cpp | 2 +- qmake/project.h | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/qmake/project.cpp b/qmake/project.cpp index 45e2ee0e63..80e95f392a 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -3775,7 +3775,7 @@ QStringList &QMakeProject::values(const QString &_var, QHash::ConstIterator it = vars.constFind(v); return it == vars.constEnd() || it->isEmpty(); diff --git a/qmake/project.h b/qmake/project.h index e46c7440ee..171016e264 100644 --- a/qmake/project.h +++ b/qmake/project.h @@ -164,11 +164,13 @@ public: bool isActiveConfig(const QString &x, bool regex=false, QHash *place=NULL); - bool isSet(const QString &v) { return vars.contains(v); } - bool isEmpty(const QString &v); + bool isSet(const QString &v) const { return vars.contains(v); } + bool isEmpty(const QString &v) const; + QStringList values(const QString &v) const { return vars[v]; } QStringList &values(const QString &v) { return vars[v]; } - QString first(const QString &v); - int intValue(const QString &v, int defaultValue = 0); + QString first(const QString &v) const; + int intValue(const QString &v, int defaultValue = 0) const; + const QHash &variables() const { return vars; } QHash &variables() { return vars; } bool isRecursive() const { return recursive; } @@ -189,7 +191,7 @@ inline QString QMakeProject::projectFile() return pfile; } -inline QString QMakeProject::first(const QString &v) +inline QString QMakeProject::first(const QString &v) const { const QStringList vals = values(v); if(vals.isEmpty()) @@ -197,7 +199,7 @@ inline QString QMakeProject::first(const QString &v) return vals.first(); } -inline int QMakeProject::intValue(const QString &v, int defaultValue) +inline int QMakeProject::intValue(const QString &v, int defaultValue) const { const QString str = first(v); if (!str.isEmpty()) { -- cgit v1.2.3 From 2ca26162f8348719ee04e63b4e80be8b5131521d Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 23 Apr 2012 19:27:43 +0200 Subject: repurpose deprecated -E switch instead of dumping the variables as we are going, dump everything at the end. this is potentially useful, as opposed to the previous functionality which was redundant with -d. Change-Id: Icf14703cb93e03f7079dfc0266b219ad9c902133 Reviewed-by: Mark Brand --- qmake/main.cpp | 6 ++++-- qmake/option.cpp | 1 - qmake/project.cpp | 29 +++++++++++++++++------------ qmake/project.h | 2 ++ 4 files changed, 23 insertions(+), 15 deletions(-) diff --git a/qmake/main.cpp b/qmake/main.cpp index 45672c67ee..835849c652 100644 --- a/qmake/main.cpp +++ b/qmake/main.cpp @@ -173,8 +173,10 @@ int runQMake(int argc, char **argv) exit_val = 3; continue; } - if(Option::mkfile::do_preprocess) //no need to create makefile - continue; + if (Option::mkfile::do_preprocess) { + project.dump(); + continue; //no need to create makefile + } } bool success = true; diff --git a/qmake/option.cpp b/qmake/option.cpp index 7d6148ce0a..91ff4050d1 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -306,7 +306,6 @@ Option::parseCommandLine(int argc, char **argv, int skip) } else if(opt == "nodependheuristics") { Option::mkfile::do_dep_heuristics = false; } else if(opt == "E") { - fprintf(stderr, "-E is deprecated. Use -d instead.\n"); Option::mkfile::do_preprocess = true; } else if(opt == "cache") { Option::mkfile::cachefile = argv[++x]; diff --git a/qmake/project.cpp b/qmake/project.cpp index 80e95f392a..c2558cccf6 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -1128,14 +1128,6 @@ QMakeProject::parse(const QString &t, QHash &place, int nu doVariableReplace(var, place); var = varMap(var); //backwards compatibility - if(!var.isEmpty() && Option::mkfile::do_preprocess) { - static QString last_file("*none*"); - if(parser.file != last_file) { - fprintf(stdout, "#file %s:%d\n", parser.file.toLatin1().constData(), parser.line_no); - last_file = parser.file; - } - fprintf(stdout, "%s %s %s\n", var.toLatin1().constData(), op.toLatin1().constData(), vals.toLatin1().constData()); - } if(vals.contains('=') && numLines > 1) warn_msg(WarnParser, "Possible accidental line continuation: {%s} at %s:%d", @@ -1850,10 +1842,6 @@ QMakeProject::doProjectInclude(QString file, uchar flags, QHashisEmpty(); } +void +QMakeProject::dump() const +{ + QStringList out; + for (QHash::ConstIterator it = vars.begin(); it != vars.end(); ++it) { + if (!it.key().startsWith('.')) { + QString str = it.key() + " ="; + foreach (const QString &v, it.value()) + str += ' ' + quoteValue(v); + out << str; + } + } + out.sort(); + foreach (const QString &v, out) + puts(qPrintable(v)); +} + QT_END_NAMESPACE diff --git a/qmake/project.h b/qmake/project.h index 171016e264..57ea023acd 100644 --- a/qmake/project.h +++ b/qmake/project.h @@ -173,6 +173,8 @@ public: const QHash &variables() const { return vars; } QHash &variables() { return vars; } + void dump() const; + bool isRecursive() const { return recursive; } bool isHostBuild() const { return host_build; } -- cgit v1.2.3 From 104ee6921652d168884d6ae6faece9e4efc73024 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 23 Apr 2012 19:31:02 +0200 Subject: purge "dumping all variables" debug loops the as-we-go dump is sufficient (and usually necessary to actually find the problem). if only the summary is interesting, the -E option can be used now. Change-Id: I9e34c6db9dcb99b38013c4d0cb80b8cb88ca36b5 Reviewed-by: Mark Brand --- qmake/generators/mac/pbuilder_pbx.cpp | 10 ---------- qmake/generators/metamakefile.cpp | 11 ----------- qmake/generators/win32/msvc_vcproj.cpp | 10 ---------- 3 files changed, 31 deletions(-) diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index c967e18bfe..74046a0ac4 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -166,16 +166,6 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t) fprintf(stderr, "Cannot find directory: %s\n", dir.toLatin1().constData()); } if(tmp_proj.read(fn)) { - if(Option::debug_level) { - debug_msg(1, "Dumping all variables:"); - const QHash &vars = tmp_proj.variables(); - for (QHash::ConstIterator it = vars.begin(); - it != vars.end(); ++it) { - if(it.key().left(1) != "." && !it.value().isEmpty()) - debug_msg(1, "%s: %s === %s", fn.toLatin1().constData(), it.key().toLatin1().constData(), - it.value().join(" :: ").toLatin1().constData()); - } - } if(tmp_proj.first("TEMPLATE") == "subdirs") { QMakeProject *pp = new QMakeProject(&tmp_proj); pb_subdirs += new ProjectBuilderSubDirs(pp, dir); diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp index 425cc31c8a..ef47082dce 100644 --- a/qmake/generators/metamakefile.cpp +++ b/qmake/generators/metamakefile.cpp @@ -214,17 +214,6 @@ BuildsMetaMakefileGenerator::write(const QString &oldpwd) if(!ret) Option::output.remove(); } - - // debugging - if(Option::debug_level) { - debug_msg(1, "Dumping all variables:"); - QHash &vars = project->variables(); - for(QHash::Iterator it = vars.begin(); it != vars.end(); ++it) { - if(!it.key().startsWith(".") && !it.value().isEmpty()) - debug_msg(1, "%s === %s", it.key().toLatin1().constData(), - it.value().join(" :: ").toLatin1().constData()); - } - } } return ret; } diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 2162841502..606fee6dd0 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -483,16 +483,6 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) tmp_vcproj.setProjectFile(&tmp_proj); Option::qmake_mode = old_mode; Option::output_dir = old_output_dir; - if(Option::debug_level) { - debug_msg(1, "Dumping all variables:"); - const QHash &vars = tmp_proj.variables(); - for (QHash::ConstIterator it = vars.begin(); - it != vars.end(); ++it) { - if(it.key().left(1) != "." && !it.value().isEmpty()) - debug_msg(1, "%s: %s === %s", fn.toLatin1().constData(), it.key().toLatin1().constData(), - it.value().join(" :: ").toLatin1().constData()); - } - } // We assume project filename is [QMAKE_PROJECT_NAME].vcproj QString vcproj = unescapeFilePath(tmp_vcproj.project->first("QMAKE_PROJECT_NAME") + project->first("VCPROJ_EXTENSION")); -- cgit v1.2.3 From a2382f7f15ad25169db24cfd090e68d5bcb11e08 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 27 Apr 2012 12:17:21 +0200 Subject: unset QT_MODULE_* after loading the module pris abuses have been observed in the wild, so make sure these variables are not available. Change-Id: I502c3f5db7d341cf6a8bd2ec09e87f129da2fca6 Reviewed-by: Mark Brand --- mkspecs/features/qt_config.prf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mkspecs/features/qt_config.prf b/mkspecs/features/qt_config.prf index 07fd988fb5..305ff1cb81 100644 --- a/mkspecs/features/qt_config.prf +++ b/mkspecs/features/qt_config.prf @@ -24,6 +24,11 @@ QMAKE_QT_CONFIG = $$[QT_HOST_DATA/get]/mkspecs/qconfig.pri include($$mod) } } + unset(QT_MODULE_INCLUDE_BASE) + unset(QT_MODULE_LIB_BASE) + unset(QT_MODULE_PLUGIN_BASE) + unset(QT_MODULE_BIN_BASE) + unset(QT_MODULE_IMPORT_BASE) } load(qt_functions) -- cgit v1.2.3 From c0abbd39fcb4a67fdef6b82ba1b2bcafe023f073 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 27 Apr 2012 19:16:56 +0200 Subject: reduce a bit of code dupe while assembling feature search path instead of having a bunch of nested loops, collect into a temporary list and process it at the end. Change-Id: I97e5642f7e13f7c7b69eae00833e61cdf46a02ed Reviewed-by: Mark Brand --- qmake/project.cpp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/qmake/project.cpp b/qmake/project.cpp index c2558cccf6..69abfac626 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -580,15 +580,13 @@ QStringList QMakeProject::qmakeFeaturePaths() feature_roots += cached_qmakefeatures; if(prop) feature_roots += splitPathList(prop->value("QMAKEFEATURES")); + QStringList feature_bases; if (!cached_build_root.isEmpty()) - for(QStringList::Iterator concat_it = concat.begin(); - concat_it != concat.end(); ++concat_it) - feature_roots << (cached_build_root + (*concat_it)); + feature_bases << cached_build_root; QStringList qmakepath = splitPathList(QString::fromLocal8Bit(qgetenv("QMAKEPATH"))); qmakepath += cached_qmakepath; foreach (const QString &path, qmakepath) - foreach (const QString &cat, concat) - feature_roots << (path + mkspecs_concat + cat); + feature_bases << (path + mkspecs_concat); if (!real_spec.isEmpty()) { // The spec is already platform-dependent, so no subdirs here. feature_roots << real_spec + base_concat; @@ -600,19 +598,17 @@ QStringList QMakeProject::qmakeFeaturePaths() const QString specrootpath = specrootdir.path(); if (specrootpath.endsWith(mkspecs_concat)) { if (QFile::exists(specrootpath + base_concat)) - for (QStringList::Iterator concat_it = concat.begin(); - concat_it != concat.end(); ++concat_it) - feature_roots << (specrootpath + (*concat_it)); + feature_bases << specrootpath; break; } specrootdir.cdUp(); } } - for(QStringList::Iterator concat_it = concat.begin(); - concat_it != concat.end(); ++concat_it) - feature_roots << (QLibraryInfo::rawLocation(QLibraryInfo::HostDataPath, - QLibraryInfo::EffectivePaths) + - mkspecs_concat + (*concat_it)); + feature_bases << (QLibraryInfo::rawLocation(QLibraryInfo::HostDataPath, + QLibraryInfo::EffectivePaths) + mkspecs_concat); + foreach (const QString &fb, feature_bases) + foreach (const QString &cc, concat) + feature_roots << (fb + cc); feature_roots.removeDuplicates(); QStringList ret; -- cgit v1.2.3 From e18ceca47e44ffcec35d4c2bbfdd85c0bfa04d42 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 3 May 2012 20:50:19 +0200 Subject: assume windows shell iff dir separator is backslash Change-Id: I411a4d6691e18b818ee7d1ced7f126f97af0902f Reviewed-by: Mark Brand --- qmake/generators/makefile.h | 2 +- qmake/generators/win32/mingw_make.cpp | 9 --------- qmake/generators/win32/mingw_make.h | 1 - 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h index b177cc7eb0..dc6714dd64 100644 --- a/qmake/generators/makefile.h +++ b/qmake/generators/makefile.h @@ -260,7 +260,7 @@ public: virtual bool supportsMergedBuilds() { return false; } virtual bool mergeBuildProject(MakefileGenerator * /*other*/) { return false; } virtual bool openOutput(QFile &, const QString &build) const; - virtual bool isWindowsShell() const { return Option::host_mode == Option::HOST_WIN_MODE; } + bool isWindowsShell() const { return Option::dir_sep == QLatin1String("\\"); } }; inline void MakefileGenerator::setNoIO(bool o) diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index 568e60a068..c579c88109 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -57,15 +57,6 @@ MingwMakefileGenerator::MingwMakefileGenerator() : Win32MakefileGenerator(), ini quote = "'"; } -bool MingwMakefileGenerator::isWindowsShell() const -{ -#ifdef Q_OS_WIN - return Option::shellPath.isEmpty(); -#else - return Win32MakefileGenerator::isWindowsShell(); -#endif -} - QString MingwMakefileGenerator::escapeDependencyPath(const QString &path) const { QString ret = path; diff --git a/qmake/generators/win32/mingw_make.h b/qmake/generators/win32/mingw_make.h index 08d87cb916..88832dde76 100644 --- a/qmake/generators/win32/mingw_make.h +++ b/qmake/generators/win32/mingw_make.h @@ -57,7 +57,6 @@ protected: bool writeMakefile(QTextStream &); void init(); private: - bool isWindowsShell() const; void writeMingwParts(QTextStream &); void writeIncPart(QTextStream &t); void writeLibsPart(QTextStream &t); -- cgit v1.2.3 From a47c6e5ea02e46eb08a40273ad07efa078bdfc28 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 3 May 2012 20:53:10 +0200 Subject: dispose of Option::shellPath use isWindowsShell() in the one remaining case. Change-Id: I25eab398ef50df5a7f4ec808279b83ca900e3c58 Reviewed-by: Mark Brand --- qmake/generators/win32/mingw_make.cpp | 2 +- qmake/option.cpp | 2 -- qmake/option.h | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index c579c88109..e7dbc6a274 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE MingwMakefileGenerator::MingwMakefileGenerator() : Win32MakefileGenerator(), init_flag(false) { - if (Option::shellPath.isEmpty()) + if (isWindowsShell()) quote = "\""; else quote = "'"; diff --git a/qmake/option.cpp b/qmake/option.cpp index 91ff4050d1..9be604f944 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -88,7 +88,6 @@ QStringList Option::before_user_vars; QStringList Option::after_user_vars; QString Option::user_template; QString Option::user_template_prefix; -QStringList Option::shellPath; Option::HOST_MODE Option::host_mode = Option::HOST_UNKNOWN_MODE; //QMAKE_*_PROPERTY stuff @@ -572,7 +571,6 @@ bool Option::postProcessProject(QMakeProject *project) Option::lex_mod = project->first("QMAKE_MOD_LEX"); Option::yacc_mod = project->first("QMAKE_MOD_YACC"); Option::dir_sep = project->first("QMAKE_DIR_SEP"); - Option::shellPath = project->values("QMAKE_SH"); return true; } diff --git a/qmake/option.h b/qmake/option.h index bd220a8376..683c10b5f3 100644 --- a/qmake/option.h +++ b/qmake/option.h @@ -171,7 +171,6 @@ struct Option enum HOST_MODE { HOST_UNKNOWN_MODE, HOST_UNIX_MODE, HOST_WIN_MODE, HOST_MACX_MODE }; static HOST_MODE host_mode; static QString user_template, user_template_prefix; - static QStringList shellPath; //QMAKE_*_PROPERTY options struct prop { -- cgit v1.2.3 From 031ac3c167d356e9c853f2c8f4331d5a276c6651 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 3 May 2012 20:59:14 +0200 Subject: dispose of Option::host_mode it was used only for determining the path separator, so do that directly. the -macx option went bye bye, as it is redundant with -unix now. Change-Id: Ib8344c042db56e05af75d263447311d4b43a3bf0 Reviewed-by: Mark Brand --- qmake/option.cpp | 23 ++++------------------- qmake/option.h | 2 -- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/qmake/option.cpp b/qmake/option.cpp index 9be604f944..520b89be28 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -88,7 +88,6 @@ QStringList Option::before_user_vars; QStringList Option::after_user_vars; QString Option::user_template; QString Option::user_template_prefix; -Option::HOST_MODE Option::host_mode = Option::HOST_UNKNOWN_MODE; //QMAKE_*_PROPERTY stuff QStringList Option::prop::properties; @@ -255,12 +254,10 @@ Option::parseCommandLine(int argc, char **argv, int skip) Option::user_template = argv[++x]; } else if(opt == "tp" || opt == "template_prefix") { Option::user_template_prefix = argv[++x]; - } else if(opt == "macx") { - Option::host_mode = HOST_MACX_MODE; } else if(opt == "unix") { - Option::host_mode = HOST_UNIX_MODE; + Option::dir_sep = "/"; } else if(opt == "win32") { - Option::host_mode = HOST_WIN_MODE; + Option::dir_sep = "\\"; } else if(opt == "d") { Option::debug_level++; } else if(opt == "version" || opt == "v" || opt == "-version") { @@ -377,19 +374,14 @@ Option::parseCommandLine(int argc, char **argv, int skip) int Option::init(int argc, char **argv) { -#if defined(Q_OS_MAC) - Option::host_mode = Option::HOST_MACX_MODE; -#elif defined(Q_OS_UNIX) - Option::host_mode = Option::HOST_UNIX_MODE; -#else - Option::host_mode = Option::HOST_WIN_MODE; -#endif Option::application_argv0 = 0; Option::prf_ext = ".prf"; Option::pro_ext = ".pro"; #ifdef Q_OS_WIN + Option::dir_sep = "\\"; Option::dirlist_sep = ";"; #else + Option::dir_sep = "/"; Option::dirlist_sep = ":"; #endif Option::field_sep = ' '; @@ -520,13 +512,6 @@ Option::init(int argc, char **argv) } } - //defaults for globals - if (Option::host_mode == Option::HOST_WIN_MODE) { - Option::dir_sep = "\\"; - } else { - Option::dir_sep = "/"; - } - return QMAKE_CMDLINE_SUCCESS; } diff --git a/qmake/option.h b/qmake/option.h index 683c10b5f3..32af3a8013 100644 --- a/qmake/option.h +++ b/qmake/option.h @@ -168,8 +168,6 @@ struct Option enum QMAKE_RECURSIVE { QMAKE_RECURSIVE_DEFAULT, QMAKE_RECURSIVE_YES, QMAKE_RECURSIVE_NO }; static QMAKE_RECURSIVE recursive; static QStringList before_user_vars, after_user_vars; - enum HOST_MODE { HOST_UNKNOWN_MODE, HOST_UNIX_MODE, HOST_WIN_MODE, HOST_MACX_MODE }; - static HOST_MODE host_mode; static QString user_template, user_template_prefix; //QMAKE_*_PROPERTY options -- cgit v1.2.3 From b6b6e85f6b0f75898afc341a8792626ebb9b99ee Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 4 May 2012 20:02:35 +0200 Subject: remove possibility to request project recursion from within a pro file again the feature was implemented for the abld/sbs2 generators only, and is of course undocumented. this reverts most of commit e795e61ef93f8080f9938ac49f2fca306644af85. Change-Id: Ibd1726b036ce6c45f8e678ea996218f774f8aed2 Reviewed-by: Mark Brand --- qmake/generators/metamakefile.cpp | 9 +-------- qmake/generators/projectgenerator.cpp | 9 ++++----- qmake/option.cpp | 8 ++++---- qmake/option.h | 3 +-- qmake/project.cpp | 5 +---- qmake/project.h | 2 -- 6 files changed, 11 insertions(+), 25 deletions(-) diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp index ef47082dce..d023d5e73e 100644 --- a/qmake/generators/metamakefile.cpp +++ b/qmake/generators/metamakefile.cpp @@ -281,14 +281,7 @@ SubdirsMetaMakefileGenerator::init() init_flag = true; bool hasError = false; - // It might make sense to bequeath the CONFIG option to the recursed - // projects. OTOH, one would most likely have it in all projects anyway - - // either through a qmakespec, a .qmake.cache or explicitly - as otherwise - // running qmake in a subdirectory would have a different auto-recurse - // setting than in parent directories. - bool recurse = Option::recursive == Option::QMAKE_RECURSIVE_YES - || (Option::recursive == Option::QMAKE_RECURSIVE_DEFAULT - && project->isRecursive()); + bool recurse = Option::recursive; if (recurse && project->isActiveConfig("dont_recurse")) recurse = false; if(recurse) { diff --git a/qmake/generators/projectgenerator.cpp b/qmake/generators/projectgenerator.cpp index 98f0e54258..1e5bab669c 100644 --- a/qmake/generators/projectgenerator.cpp +++ b/qmake/generators/projectgenerator.cpp @@ -105,7 +105,7 @@ ProjectGenerator::init() add_depend = true; if(dir.right(1) != Option::dir_sep) dir += Option::dir_sep; - if(Option::recursive == Option::QMAKE_RECURSIVE_YES) { + if (Option::recursive) { QStringList files = QDir(dir).entryList(QDir::Files); for(int i = 0; i < (int)files.count(); i++) { if(files[i] != "." && files[i] != "..") @@ -132,7 +132,7 @@ ProjectGenerator::init() dir = regex.left(s+1); regex = regex.right(regex.length() - (s+1)); } - if(Option::recursive == Option::QMAKE_RECURSIVE_YES) { + if (Option::recursive) { QStringList entries = QDir(dir).entryList(QDir::Dirs); for(int i = 0; i < (int)entries.count(); i++) { if(entries[i] != "." && entries[i] != "..") { @@ -187,7 +187,7 @@ ProjectGenerator::init() subdirs.append(nd); } } - if(Option::recursive == Option::QMAKE_RECURSIVE_YES) { + if (Option::recursive) { QStringList dirs = QDir(newdir).entryList(QDir::Dirs); for(int i = 0; i < (int)dirs.count(); i++) { QString nd = fileFixify(newdir + QDir::separator() + dirs[i]); @@ -224,8 +224,7 @@ ProjectGenerator::init() } } } - if(Option::recursive == Option::QMAKE_RECURSIVE_YES - && !knownDirs.contains(newdir, Qt::CaseInsensitive)) + if (Option::recursive && !knownDirs.contains(newdir, Qt::CaseInsensitive)) knownDirs.append(newdir); } } diff --git a/qmake/option.cpp b/qmake/option.cpp index 520b89be28..b2f5de50b5 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -83,7 +83,7 @@ int Option::warn_level = WarnLogic | WarnDeprecated; int Option::debug_level = 0; QFile Option::output; QString Option::output_dir; -Option::QMAKE_RECURSIVE Option::recursive = Option::QMAKE_RECURSIVE_DEFAULT; +bool Option::recursive = false; QStringList Option::before_user_vars; QStringList Option::after_user_vars; QString Option::user_template; @@ -225,7 +225,7 @@ Option::parseCommandLine(int argc, char **argv, int skip) if(x == 1) { bool specified = true; if(opt == "project") { - Option::recursive = Option::QMAKE_RECURSIVE_YES; + Option::recursive = true; Option::qmake_mode = Option::QMAKE_GENERATE_PROJECT; } else if(opt == "prl") { Option::mkfile::do_deps = false; @@ -283,9 +283,9 @@ Option::parseCommandLine(int argc, char **argv, int skip) } else if(opt == "Wnone") { Option::warn_level = WarnNone; } else if(opt == "r" || opt == "recursive") { - Option::recursive = Option::QMAKE_RECURSIVE_YES; + Option::recursive = true; } else if(opt == "nr" || opt == "norecursive") { - Option::recursive = Option::QMAKE_RECURSIVE_NO; + Option::recursive = false; } else if(opt == "config") { user_configs += argv[++x]; } else { diff --git a/qmake/option.h b/qmake/option.h index 32af3a8013..4e6098130a 100644 --- a/qmake/option.h +++ b/qmake/option.h @@ -165,8 +165,7 @@ struct Option static QString output_dir; static int debug_level; static int warn_level; - enum QMAKE_RECURSIVE { QMAKE_RECURSIVE_DEFAULT, QMAKE_RECURSIVE_YES, QMAKE_RECURSIVE_NO }; - static QMAKE_RECURSIVE recursive; + static bool recursive; static QStringList before_user_vars, after_user_vars; static QString user_template, user_template_prefix; diff --git a/qmake/project.cpp b/qmake/project.cpp index 69abfac626..928ecc9bce 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -672,7 +672,6 @@ QMakeProject::init(QMakeProperty *p) prop = p; own_prop = false; } - recursive = false; host_build = false; reset(); } @@ -3225,9 +3224,7 @@ QMakeProject::doProjectTest(QString func, QList args_list, QHash testFunctions, replaceFunctions; - bool recursive; bool host_build; bool need_restart; bool own_prop; @@ -175,7 +174,6 @@ public: void dump() const; - bool isRecursive() const { return recursive; } bool isHostBuild() const { return host_build; } protected: -- cgit v1.2.3 From 689aa4da2dd7c01ee487dc346db8fe6191c2da4a Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 12 Jun 2012 20:15:41 +0200 Subject: move cachefile_depth calculation out of project evaluator it has no business there Change-Id: I6d1a4b55b5acacc470cc109a6c69a907abbba312 Reviewed-by: Mark Brand --- qmake/option.cpp | 5 +++++ qmake/project.cpp | 6 +----- qmake/project.h | 2 ++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/qmake/option.cpp b/qmake/option.cpp index b2f5de50b5..b01b4eded5 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -556,6 +556,11 @@ bool Option::postProcessProject(QMakeProject *project) Option::lex_mod = project->first("QMAKE_MOD_LEX"); Option::yacc_mod = project->first("QMAKE_MOD_YACC"); Option::dir_sep = project->first("QMAKE_DIR_SEP"); + + if (Option::output_dir.startsWith(project->buildRoot())) + Option::mkfile::cachefile_depth = + Option::output_dir.mid(project->buildRoot().length()).count('/'); + return true; } diff --git a/qmake/project.cpp b/qmake/project.cpp index 928ecc9bce..8b151539fd 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -1333,9 +1333,9 @@ QMakeProject::read(uchar cmd) if (base_vars.isEmpty()) { QString superdir; QString project_root; - QString project_build_root; QStringList qmakepath; QStringList qmakefeatures; + project_build_root.clear(); if (Option::mkfile::do_cache) { // parse the cache QHash cache; QString rdir = Option::output_dir; @@ -1403,10 +1403,6 @@ QMakeProject::read(uchar cmd) qmakepath = cache.value(QLatin1String("QMAKEPATH")); qmakefeatures = cache.value(QLatin1String("QMAKEFEATURES")); - if (Option::output_dir.startsWith(project_build_root)) - Option::mkfile::cachefile_depth = - Option::output_dir.mid(project_build_root.length()).count('/'); - if (!superfile.isEmpty()) vars["_QMAKE_SUPER_CACHE_"] << superfile; if (!cachefile.isEmpty()) diff --git a/qmake/project.h b/qmake/project.h index cf71e5e72c..266053a972 100644 --- a/qmake/project.h +++ b/qmake/project.h @@ -82,6 +82,7 @@ class QMakeProject bool need_restart; bool own_prop; bool backslashWarned; + QString project_build_root; QString conffile; QString superfile; QString cachefile; @@ -136,6 +137,7 @@ public: QStringList userTestFunctions() { return testFunctions.keys(); } QString projectFile(); + QString buildRoot() const { return project_build_root; } QString confFile() const { return conffile; } QString cacheFile() const { return cachefile; } QString specDir() const { return real_spec; } -- cgit v1.2.3 From 2106ab2e756b8c7c190268b595aad98b630eb9c7 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 18 Jun 2012 12:06:37 +0200 Subject: use source root also for finding features Change-Id: I108914c6d2c6d06414156584aeb3a1afb0f5838d Reviewed-by: Mark Brand --- qmake/project.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qmake/project.cpp b/qmake/project.cpp index 8b151539fd..36bf6add96 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -583,6 +583,8 @@ QStringList QMakeProject::qmakeFeaturePaths() QStringList feature_bases; if (!cached_build_root.isEmpty()) feature_bases << cached_build_root; + if (!cached_source_root.isEmpty()) + feature_bases << cached_source_root; QStringList qmakepath = splitPathList(QString::fromLocal8Bit(qgetenv("QMAKEPATH"))); qmakepath += cached_qmakepath; foreach (const QString &path, qmakepath) -- cgit v1.2.3 From 533b4f1afd0c05e01a7ad3cf24ac4fde0e61e3c0 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 18 Jun 2012 13:57:39 +0200 Subject: remove support for versioning qmake properties the rationale is mostly the same as in 568e714fdf, plus the additional point that the qmake version didn't change for a decade. fallback paths for version 2.01a properties are provided. Change-Id: I3d3f16595eca9eca71c78fda9dbaf53da9f874a9 Reviewed-by: Mark Brand --- qmake/property.cpp | 74 ++++++++++++------------------------------------------ qmake/property.h | 4 +-- 2 files changed, 17 insertions(+), 61 deletions(-) diff --git a/qmake/property.cpp b/qmake/property.cpp index 8d2e14ca11..171a085796 100644 --- a/qmake/property.cpp +++ b/qmake/property.cpp @@ -104,15 +104,7 @@ void QMakeProperty::initSettings() } QString -QMakeProperty::keyBase(bool version) const -{ - if (version) - return QString(qmake_version()) + "/"; - return QString(); -} - -QString -QMakeProperty::value(QString v, bool just_check) +QMakeProperty::value(const QString &v) { QString val = m_values.value(v); if (!val.isNull()) @@ -127,56 +119,31 @@ QMakeProperty::value(QString v, bool just_check) #endif initSettings(); - int slash = v.lastIndexOf('/'); - QVariant var = settings->value(keyBase(slash == -1) + v); - bool ok = var.isValid(); - QString ret = var.toString(); - if(!ok) { - QString version = qmake_version(); - if(slash != -1) { - version = v.left(slash-1); - v = v.mid(slash+1); - } - settings->beginGroup(keyBase(false)); - QStringList subs = settings->childGroups(); - settings->endGroup(); - subs.sort(); - for (int x = subs.count() - 1; x >= 0; x--) { - QString s = subs[x]; - if(s.isEmpty() || s > version) - continue; - var = settings->value(keyBase(false) + s + "/" + v); - ok = var.isValid(); - ret = var.toString(); - if (ok) { - if(!just_check) - debug_msg(1, "Fell back from %s -> %s for '%s'.", version.toLatin1().constData(), - s.toLatin1().constData(), v.toLatin1().constData()); - return ret; - } - } - } - return ok ? ret : QString(); + if (!settings->contains(v)) + return settings->value("2.01a/" + v).toString(); // Backwards compat + return settings->value(v).toString(); } bool QMakeProperty::hasValue(QString v) { - return !value(v, true).isNull(); + return !value(v).isNull(); } void QMakeProperty::setValue(QString var, const QString &val) { initSettings(); - settings->setValue(keyBase() + var, val); + settings->setValue(var, val); + settings->remove("2.01a/" + var); // Backwards compat } void QMakeProperty::remove(const QString &var) { initSettings(); - settings->remove(keyBase() + var); + settings->remove(var); + settings->remove("2.01a/" + var); // Backwards compat } bool @@ -186,23 +153,14 @@ QMakeProperty::exec() if(Option::qmake_mode == Option::QMAKE_QUERY_PROPERTY) { if(Option::prop::properties.isEmpty()) { initSettings(); - settings->beginGroup(keyBase(false)); - QStringList subs = settings->childGroups(); + QStringList keys = settings->childKeys(); + settings->beginGroup("2.01a"); + keys += settings->childKeys(); settings->endGroup(); - subs.sort(); - for(int x = subs.count() - 1; x >= 0; x--) { - QString s = subs[x]; - if(s.isEmpty()) - continue; - settings->beginGroup(keyBase(false) + s); - QStringList keys = settings->childKeys(); - settings->endGroup(); - for(QStringList::ConstIterator it2 = keys.begin(); it2 != keys.end(); it2++) { - QString ret = settings->value(keyBase(false) + s + "/" + (*it2)).toString(); - if(s != qmake_version()) - fprintf(stdout, "%s/", s.toLatin1().constData()); - fprintf(stdout, "%s:%s\n", (*it2).toLatin1().constData(), ret.toLatin1().constData()); - } + keys.removeDuplicates(); + foreach (const QString &key, keys) { + QString val = settings->value(settings->contains(key) ? key : "2.01a/" + key).toString(); + fprintf(stdout, "%s:%s\n", qPrintable(key), qPrintable(val)); } QStringList specialProps; for (int i = 0; i < sizeof(propList)/sizeof(propList[0]); i++) diff --git a/qmake/property.h b/qmake/property.h index 6195e482fb..13767ff405 100644 --- a/qmake/property.h +++ b/qmake/property.h @@ -54,8 +54,6 @@ class QMakeProperty { QSettings *settings; void initSettings(); - QString keyBase(bool =true) const; - QString value(QString, bool just_check); QHash m_values; @@ -64,7 +62,7 @@ public: ~QMakeProperty(); bool hasValue(QString); - QString value(QString v) { return value(v, false); } + QString value(const QString &); void setValue(QString, const QString &); void remove(const QString &); -- cgit v1.2.3 From 61c775684fe38f3c1e1bc7599e21054aedba523c Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 19 Jun 2012 12:39:41 +0200 Subject: remove abuses of warn_msg() this function is not meant to be used for debug statements Change-Id: I84575e64814e2c9fd2e09c33fc680d0e6648f4ea Reviewed-by: Rolland Dudemaine Reviewed-by: Oswald Buddenhagen --- qmake/generators/integrity/gbuild.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/qmake/generators/integrity/gbuild.cpp b/qmake/generators/integrity/gbuild.cpp index a587cf1c8e..219b6a2d5d 100644 --- a/qmake/generators/integrity/gbuild.cpp +++ b/qmake/generators/integrity/gbuild.cpp @@ -213,7 +213,6 @@ GBuildMakefileGenerator::write() dllbase += DLLOFFSET; } - warn_msg(WarnParser, Option::output.fileName().toLocal8Bit().constData()); QTextStream t(&Option::output); QString primaryTarget(project->values("QMAKE_CXX").at(0)); @@ -427,7 +426,6 @@ GBuildMakefileGenerator::openOutput(QFile &file, const QString &build) const outputName += QDir::separator(); outputName += fileInfo(project->projectFile()).baseName(); outputName += projectSuffix(); - warn_msg(WarnParser, outputName.toLocal8Bit().constData()); file.setFileName(outputName); } debug_msg(1, "file is %s", file.fileName().toLatin1().constData()); -- cgit v1.2.3