Merge branch 'buildsystem' (second round)
refactoring and cleanup. fixes x-builds between different os families. Conflicts: mkspecs/features/qt.prf Change-Id: I0205e6f07f77c9b015cf055dd87a471883949a91bb10
commit
1491065506
|
|
@ -14,12 +14,6 @@ win32 {
|
|||
} else {
|
||||
DEFINES += QT_NODLL
|
||||
}
|
||||
|
||||
# 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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
}
|
||||
|
|
@ -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)
|
||||
|
||||
|
|
@ -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));
|
||||
|
||||
|
|
@ -259,8 +258,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 +284,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 +297,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 +318,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 +332,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 +348,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";
|
||||
}
|
||||
}
|
||||
|
|
@ -425,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());
|
||||
|
|
|
|||
|
|
@ -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:");
|
||||
QHash<QString, QStringList> &vars = tmp_proj.variables();
|
||||
for(QHash<QString, QStringList>::Iterator 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);
|
||||
|
|
@ -393,7 +383,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 +704,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();
|
||||
|
|
|
|||
|
|
@ -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 &&
|
||||
|
|
@ -311,7 +317,7 @@ QStringList
|
|||
MakefileGenerator::findFilesInVPATH(QStringList l, uchar flags, const QString &vpath_var)
|
||||
{
|
||||
QStringList vpath;
|
||||
QHash<QString, QStringList> &v = project->variables();
|
||||
const QHash<QString, QStringList> &v = project->variables();
|
||||
for(int val_it = 0; val_it < l.count(); ) {
|
||||
bool remove_file = false;
|
||||
QString &val = l[val_it];
|
||||
|
|
@ -442,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;
|
||||
|
|
@ -665,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;
|
||||
|
|
@ -674,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"))
|
||||
|
|
@ -697,14 +703,14 @@ 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);
|
||||
}
|
||||
}
|
||||
} 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())
|
||||
|
|
@ -715,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"))
|
||||
|
|
@ -738,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);
|
||||
}
|
||||
|
|
@ -1151,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) {
|
||||
|
|
@ -1216,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 &&
|
||||
|
|
@ -1683,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));
|
||||
|
|
@ -1729,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));
|
||||
|
|
@ -1753,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);
|
||||
|
|
@ -1822,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;
|
||||
|
|
@ -2114,10 +2120,10 @@ MakefileGenerator::writeExtraVariables(QTextStream &t)
|
|||
t << endl;
|
||||
|
||||
QStringList outlist;
|
||||
QHash<QString, QStringList> &vars = project->variables();
|
||||
QStringList &exports = project->values("QMAKE_EXTRA_VARIABLES");
|
||||
for (QHash<QString, QStringList>::Iterator it = vars.begin(); it != vars.end(); ++it) {
|
||||
for (QStringList::Iterator exp_it = exports.begin(); exp_it != exports.end(); ++exp_it) {
|
||||
const QHash<QString, QStringList> &vars = project->variables();
|
||||
const QStringList &exports = project->values("QMAKE_EXTRA_VARIABLES");
|
||||
for (QHash<QString, QStringList>::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(" "));
|
||||
|
|
@ -2133,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()));
|
||||
|
|
@ -2196,14 +2202,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();
|
||||
|
|
@ -2398,8 +2396,8 @@ void
|
|||
MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubTarget*> 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)) {
|
||||
|
|
@ -2609,16 +2607,16 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT
|
|||
}
|
||||
|
||||
// user defined targets
|
||||
QStringList &qut = project->values("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);
|
||||
|
|
@ -2933,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)
|
||||
|
|
@ -2967,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) {
|
||||
|
|
@ -3016,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);
|
||||
|
|
@ -3035,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));
|
||||
|
|
@ -3075,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;
|
||||
}
|
||||
|
||||
|
|
@ -3261,7 +3258,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"))
|
||||
|
|
|
|||
|
|
@ -91,6 +91,8 @@ class MakefileGenerator : protected QMakeSourceFileInfo
|
|||
mutable QHash<ReplaceExtraCompilerCacheKey, QString> 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
|
||||
|
|
@ -258,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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -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<QString, QStringList> &vars = project->variables();
|
||||
for(QHash<QString, QStringList>::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;
|
||||
}
|
||||
|
|
@ -292,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) {
|
||||
|
|
@ -347,7 +329,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());
|
||||
|
|
@ -514,44 +496,5 @@ 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)
|
||||
{
|
||||
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());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -42,8 +42,6 @@
|
|||
#ifndef METAMAKEFILE_H
|
||||
#define METAMAKEFILE_H
|
||||
|
||||
#include <option.h>
|
||||
|
||||
#include <qlist.h>
|
||||
#include <qstring.h>
|
||||
|
||||
|
|
@ -67,9 +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 modesForGenerator(const QString &generator,
|
||||
Option::HOST_MODE *host_mode, Option::TARG_MODE *target_mode);
|
||||
|
||||
inline QMakeProject *projectFile() const { return project; }
|
||||
|
||||
virtual bool init() = 0;
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ ProjectGenerator::init()
|
|||
verifyCompilers();
|
||||
|
||||
project->read(QMakeProject::ReadFeatures);
|
||||
project->variables()["CONFIG"].clear();
|
||||
project->values("CONFIG").clear();
|
||||
|
||||
QHash<QString, QStringList> &v = project->variables();
|
||||
QString templ = Option::user_template.isEmpty() ? QString("app") : Option::user_template;
|
||||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
@ -297,13 +296,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 +316,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 +355,7 @@ ProjectGenerator::writeMakefile(QTextStream &t)
|
|||
QString ofn = QFileInfo(static_cast<QFile *>(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 +383,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 +438,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 +449,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 "";
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -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;
|
||||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -51,21 +51,12 @@ QT_BEGIN_NAMESPACE
|
|||
|
||||
MingwMakefileGenerator::MingwMakefileGenerator() : Win32MakefileGenerator(), init_flag(false)
|
||||
{
|
||||
if (Option::shellPath.isEmpty())
|
||||
if (isWindowsShell())
|
||||
quote = "\"";
|
||||
else
|
||||
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;
|
||||
|
|
@ -91,8 +82,8 @@ bool MingwMakefileGenerator::findLibraries(const QString &where)
|
|||
|
||||
QList<QMakeLocalFileName> 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 +139,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 +335,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("\""), "");
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 = "/";
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -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:");
|
||||
QHash<QString, QStringList> &vars = tmp_proj.variables();
|
||||
for(QHash<QString, QStringList>::Iterator 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"));
|
||||
|
|
@ -536,17 +526,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 +565,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 +757,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());
|
||||
|
|
@ -1112,7 +1102,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 +1461,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
|
||||
|
|
|
|||
|
|
@ -110,8 +110,8 @@ Win32MakefileGenerator::findLibraries(const QString &where)
|
|||
QStringList &l = project->values(where);
|
||||
QList<QMakeLocalFileName> 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<QString, bool> processed;
|
||||
QList<QMakeLocalFileName> 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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -142,8 +142,8 @@ QMakeMetaInfo::readLibtoolFile(const QString &f)
|
|||
dirf = "";
|
||||
else if(!dirf.isEmpty() && !dirf.endsWith(Option::output_dir))
|
||||
dirf += QLatin1Char('/');
|
||||
QHash<QString, QStringList> &v = proj.variables();
|
||||
for(QHash<QString, QStringList>::Iterator it = v.begin(); it != v.end(); ++it) {
|
||||
const QHash<QString, QStringList> &v = proj.variables();
|
||||
for (QHash<QString, QStringList>::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])))
|
||||
|
|
|
|||
176
qmake/option.cpp
176
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,10 +69,8 @@ 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::sysenv_mod;
|
||||
QString Option::res_ext;
|
||||
char Option::field_sep;
|
||||
|
||||
|
|
@ -86,15 +83,11 @@ 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;
|
||||
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;
|
||||
|
|
@ -232,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;
|
||||
|
|
@ -261,23 +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") {
|
||||
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;
|
||||
Option::dir_sep = "/";
|
||||
} 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;
|
||||
Option::dir_sep = "\\";
|
||||
} else if(opt == "d") {
|
||||
Option::debug_level++;
|
||||
} else if(opt == "version" || opt == "v" || opt == "-version") {
|
||||
|
|
@ -303,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 {
|
||||
|
|
@ -322,7 +302,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];
|
||||
|
|
@ -392,58 +371,19 @@ 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)
|
||||
{
|
||||
Option::application_argv0 = 0;
|
||||
Option::cpp_moc_mod = "";
|
||||
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::h_moc_ext = ".cpp";
|
||||
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::dir_sep = "\\";
|
||||
Option::dirlist_sep = ";";
|
||||
Option::shellPath = detectShellPath();
|
||||
Option::res_ext = ".res";
|
||||
#else
|
||||
Option::dir_sep = "/";
|
||||
Option::dirlist_sep = ":";
|
||||
Option::shellPath = QStringList("sh");
|
||||
#endif
|
||||
Option::sysenv_mod = "QMAKE_ENV_";
|
||||
Option::field_sep = ' ';
|
||||
|
||||
if(argc && argv) {
|
||||
|
|
@ -482,6 +422,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;
|
||||
}
|
||||
|
|
@ -562,36 +510,11 @@ Option::init(int argc, char **argv)
|
|||
}
|
||||
#endif
|
||||
}
|
||||
} 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;
|
||||
}
|
||||
|
||||
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";
|
||||
}
|
||||
}
|
||||
|
||||
void Option::prepareProject(const QString &pfile)
|
||||
{
|
||||
QString srcpath = (pfile != "-")
|
||||
|
|
@ -617,54 +540,27 @@ 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
|
||||
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");
|
||||
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");
|
||||
|
||||
if (Option::output_dir.startsWith(project->buildRoot()))
|
||||
Option::mkfile::cachefile_depth =
|
||||
Option::output_dir.mid(project->buildRoot().length()).count('/');
|
||||
|
||||
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_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"))
|
||||
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"))
|
||||
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_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"))
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -80,18 +80,15 @@ 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;
|
||||
static QString dirlist_sep;
|
||||
static QString sysenv_mod;
|
||||
static QString pro_ext;
|
||||
static QString res_ext;
|
||||
static char field_sep;
|
||||
|
|
@ -106,7 +103,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 *);
|
||||
|
||||
|
|
@ -169,17 +165,9 @@ 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;
|
||||
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 };
|
||||
static TARG_MODE target_mode;
|
||||
static bool target_mode_overridden;
|
||||
static QString user_template, user_template_prefix;
|
||||
static QStringList shellPath;
|
||||
|
||||
//QMAKE_*_PROPERTY options
|
||||
struct prop {
|
||||
|
|
|
|||
|
|
@ -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.",
|
||||
|
|
@ -565,69 +567,57 @@ 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;
|
||||
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;
|
||||
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)
|
||||
foreach (const QString &cat, concat)
|
||||
feature_roots << (path + mkspecs_concat + cat);
|
||||
QString *specp = host_build ? &Option::mkfile::qmakespec : &Option::mkfile::xqmakespec;
|
||||
if (!specp->isEmpty()) {
|
||||
feature_bases << (path + mkspecs_concat);
|
||||
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();
|
||||
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();
|
||||
return feature_roots;
|
||||
|
||||
QStringList ret;
|
||||
foreach (const QString &root, feature_roots)
|
||||
if (QFileInfo(root).exists())
|
||||
ret << root;
|
||||
return ret;
|
||||
}
|
||||
|
||||
QStringList qmake_mkspec_paths()
|
||||
|
|
@ -649,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)
|
||||
|
|
@ -667,7 +674,6 @@ QMakeProject::init(QMakeProperty *p)
|
|||
prop = p;
|
||||
own_prop = false;
|
||||
}
|
||||
recursive = false;
|
||||
host_build = false;
|
||||
reset();
|
||||
}
|
||||
|
|
@ -1119,14 +1125,6 @@ QMakeProject::parse(const QString &t, QHash<QString, QStringList> &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",
|
||||
|
|
@ -1218,6 +1216,8 @@ QMakeProject::parse(const QString &t, QHash<QString, QStringList> &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;
|
||||
}
|
||||
|
|
@ -1289,6 +1289,7 @@ QMakeProject::read(const QString &file, QHash<QString, QStringList> &place)
|
|||
qmake_setpwd(QFileInfo(filename).absolutePath());
|
||||
}
|
||||
if(ret) {
|
||||
place["PWD"] = QStringList(qmake_getpwd());
|
||||
parser_info pi = parser;
|
||||
parser.from_file = true;
|
||||
parser.file = filename;
|
||||
|
|
@ -1324,20 +1325,19 @@ bool
|
|||
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;
|
||||
if(!Option::user_template_prefix.isEmpty())
|
||||
base_vars["TEMPLATE_PREFIX"] = QStringList(Option::user_template_prefix);
|
||||
|
||||
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;
|
||||
QStringList qmakepath;
|
||||
QStringList qmakefeatures;
|
||||
project_build_root.clear();
|
||||
if (Option::mkfile::do_cache) { // parse the cache
|
||||
QHash<QString, QStringList> cache;
|
||||
QString rdir = Option::output_dir;
|
||||
|
|
@ -1405,9 +1405,10 @@ 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())
|
||||
vars["_QMAKE_CACHE_"] << cachefile;
|
||||
}
|
||||
no_cache:
|
||||
|
||||
|
|
@ -1470,32 +1471,48 @@ 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
|
||||
doProjectInclude("spec_pre", IncludeFlagFeature, vars);
|
||||
while(qmakespec.endsWith(QLatin1Char('/')))
|
||||
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;
|
||||
}
|
||||
validateModes();
|
||||
#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();
|
||||
|
||||
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
|
||||
}
|
||||
setupProject();
|
||||
}
|
||||
|
||||
for (QHash<QString, QStringList>::ConstIterator it = extra_vars.constBegin();
|
||||
it != extra_vars.constEnd(); ++it)
|
||||
|
|
@ -1506,10 +1523,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)";
|
||||
|
|
@ -1598,72 +1611,100 @@ QMakeProject::read(uchar cmd)
|
|||
return true;
|
||||
}
|
||||
|
||||
void QMakeProject::validateModes()
|
||||
void
|
||||
QMakeProject::setupProject()
|
||||
{
|
||||
if (Option::host_mode == Option::HOST_UNKNOWN_MODE
|
||||
|| Option::target_mode == Option::TARG_UNKNOWN_MODE) {
|
||||
Option::HOST_MODE host_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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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
|
||||
QMakeProject::resolveSpec(QString *spec, const QString &qmakespec)
|
||||
QMakeProject::loadDefaults()
|
||||
{
|
||||
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 = base_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);
|
||||
}
|
||||
}
|
||||
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;
|
||||
vars["_DATE_"] << QDateTime::currentDateTime().toString();
|
||||
#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
|
||||
|
|
@ -1678,28 +1719,12 @@ QMakeProject::isActiveConfig(const QString &x, bool regex, QHash<QString, QStrin
|
|||
else if(x == "false")
|
||||
return false;
|
||||
|
||||
if (x == "unix") {
|
||||
validateModes();
|
||||
return Option::target_mode == Option::TARG_UNIX_MODE
|
||||
|| Option::target_mode == Option::TARG_MACX_MODE;
|
||||
} else if (x == "macx" || x == "mac") {
|
||||
validateModes();
|
||||
return Option::target_mode == Option::TARG_MACX_MODE;
|
||||
} else if (x == "win32") {
|
||||
validateModes();
|
||||
return Option::target_mode == Option::TARG_WIN_MODE;
|
||||
}
|
||||
|
||||
if (x == "host_build")
|
||||
return host_build;
|
||||
|
||||
//mkspecs
|
||||
static QString hspec, xspec;
|
||||
resolveSpec(&hspec, Option::mkfile::qmakespec);
|
||||
resolveSpec(&xspec, Option::mkfile::xqmakespec);
|
||||
const QString &spec = host_build ? hspec : xspec;
|
||||
QRegExp re(x, Qt::CaseSensitive, QRegExp::Wildcard);
|
||||
if((regex && re.exactMatch(spec)) || (!regex && spec == x))
|
||||
if ((regex && re.exactMatch(short_spec)) || (!regex && short_spec == x))
|
||||
return true;
|
||||
|
||||
//simple matching
|
||||
|
|
@ -1752,15 +1777,14 @@ QMakeProject::doProjectInclude(QString file, uchar flags, QHash<QString, QString
|
|||
if(flags & IncludeFlagFeature) {
|
||||
if(!file.endsWith(Option::prf_ext))
|
||||
file += Option::prf_ext;
|
||||
validateModes(); // init dir_sep
|
||||
if(file.indexOf(QLatin1Char('/')) == -1 || !QFile::exists(file)) {
|
||||
{
|
||||
QStringList *&feature_roots = all_feature_roots[host_build];
|
||||
if(!feature_roots) {
|
||||
feature_roots = new QStringList;
|
||||
qmakeAddCacheClear(qmakeDeleteCacheClear<QStringList>, (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;
|
||||
|
|
@ -1791,8 +1815,7 @@ QMakeProject::doProjectInclude(QString file, uchar flags, QHash<QString, QString
|
|||
if(place["QMAKE_INTERNAL_INCLUDED_FEATURES"].indexOf(file) != -1)
|
||||
return IncludeFeatureAlreadyLoaded;
|
||||
place["QMAKE_INTERNAL_INCLUDED_FEATURES"].append(file);
|
||||
}
|
||||
if(QDir::isRelativePath(file)) {
|
||||
} else if (QDir::isRelativePath(file)) {
|
||||
QStringList include_roots;
|
||||
if(Option::output_dir != qmake_getpwd())
|
||||
include_roots << qmake_getpwd();
|
||||
|
|
@ -1812,10 +1835,6 @@ QMakeProject::doProjectInclude(QString file, uchar flags, QHash<QString, QString
|
|||
} else if (!QFile::exists(file)) {
|
||||
return IncludeNoExist;
|
||||
}
|
||||
if(Option::mkfile::do_preprocess) //nice to see this first..
|
||||
fprintf(stderr, "#switching file %s(%s) - %s:%d\n", (flags & IncludeFlagFeature) ? "load" : "include",
|
||||
file.toLatin1().constData(),
|
||||
parser.file.toLatin1().constData(), parser.line_no);
|
||||
debug_msg(1, "Project Parser: %s'ing file %s.", (flags & IncludeFlagFeature) ? "load" : "include",
|
||||
file.toLatin1().constData());
|
||||
|
||||
|
|
@ -1860,6 +1879,7 @@ QMakeProject::doProjectInclude(QString file, uchar flags, QHash<QString, QString
|
|||
}
|
||||
parser = pi;
|
||||
qmake_setpwd(oldpwd);
|
||||
place["PWD"] = QStringList(qmake_getpwd());
|
||||
if(!parsed)
|
||||
return IncludeParseFailure;
|
||||
return IncludeSuccess;
|
||||
|
|
@ -3202,9 +3222,7 @@ QMakeProject::doProjectTest(QString func, QList<QStringList> args_list, QHash<QS
|
|||
parser.file.toLatin1().constData(), parser.line_no);
|
||||
return false;
|
||||
}
|
||||
if (args.first() == "recursive") {
|
||||
recursive = true;
|
||||
} else if (args.first() == "host_build") {
|
||||
if (args.first() == "host_build") {
|
||||
if (!host_build && isActiveConfig("cross_compile")) {
|
||||
host_build = true;
|
||||
need_restart = true;
|
||||
|
|
@ -3319,12 +3337,14 @@ QMakeProject::doProjectTest(QString func, QList<QStringList> args_list, QHash<QS
|
|||
if (superfile.isEmpty()) {
|
||||
superfile = Option::output_dir + QLatin1String("/.qmake.super");
|
||||
printf("Info: creating super cache file %s\n", superfile.toLatin1().constData());
|
||||
vars["_QMAKE_SUPER_CACHE_"] << superfile;
|
||||
}
|
||||
fn = superfile;
|
||||
} else {
|
||||
if (cachefile.isEmpty()) {
|
||||
cachefile = Option::output_dir + QLatin1String("/.qmake.cache");
|
||||
printf("Info: creating cache file %s\n", cachefile.toLatin1().constData());
|
||||
vars["_QMAKE_CACHE_"] << cachefile;
|
||||
if (cached_build_root.isEmpty()) {
|
||||
cached_build_root = Option::output_dir;
|
||||
cached_source_root = values("_PRO_FILE_PWD_", place).first();
|
||||
|
|
@ -3642,7 +3662,7 @@ QMakeProject::doVariableReplaceExpand(const QString &str, QHash<QString, QString
|
|||
} else if(var_type == FUNCTION) {
|
||||
replacement = doProjectExpand(var, args, place);
|
||||
} else if(var_type == VAR) {
|
||||
replacement = values(var, place);
|
||||
replacement = magicValues(var, place);
|
||||
}
|
||||
if(!(replaced++) && start_var)
|
||||
current = str.left(start_var);
|
||||
|
|
@ -3717,188 +3737,44 @@ QMakeProject::doVariableReplaceExpand(const QString &str, QHash<QString, QString
|
|||
return ret;
|
||||
}
|
||||
|
||||
QStringList &QMakeProject::values(const QString &_var, QHash<QString, QStringList> &place)
|
||||
QStringList QMakeProject::magicValues(const QString &_var, const QHash<QString, QStringList> &place) const
|
||||
{
|
||||
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
|
||||
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")) {
|
||||
validateModes();
|
||||
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));
|
||||
if (var == QLatin1String("_LINE_")) { //parser line number
|
||||
return QStringList(QString::number(parser.line_no));
|
||||
} else if(var == QLatin1String("_FILE_")) { //parser file
|
||||
var = ".BUILTIN." + var;
|
||||
place[var] = QStringList(parser.file);
|
||||
} else if(var == QLatin1String("_DATE_")) { //current date/time
|
||||
var = ".BUILTIN." + var;
|
||||
place[var] = QStringList(QDateTime::currentDateTime().toString());
|
||||
} else if(var == QLatin1String("_PRO_FILE_")) {
|
||||
var = ".BUILTIN." + var;
|
||||
place[var] = QStringList(pfile);
|
||||
} else if(var == QLatin1String("_PRO_FILE_PWD_")) {
|
||||
var = ".BUILTIN." + var;
|
||||
place[var] = QStringList(pfile.isEmpty() ? qmake_getpwd() : QFileInfo(pfile).absolutePath());
|
||||
} else if(var == QLatin1String("_QMAKE_CACHE_")) {
|
||||
var = ".BUILTIN." + var;
|
||||
if(Option::mkfile::do_cache)
|
||||
place[var] = QStringList(cachefile);
|
||||
} else if(var == QLatin1String("_QMAKE_SUPER_CACHE_")) {
|
||||
var = ".BUILTIN." + var;
|
||||
if(Option::mkfile::do_cache && !superfile.isEmpty())
|
||||
place[var] = QStringList(superfile);
|
||||
} else if(var == QLatin1String("TEMPLATE")) {
|
||||
if(!Option::user_template.isEmpty()) {
|
||||
var = ".BUILTIN.USER." + var;
|
||||
place[var] = QStringList(Option::user_template);
|
||||
} else {
|
||||
QString orig_template, real_template;
|
||||
if(!place[var].isEmpty())
|
||||
orig_template = place[var].first();
|
||||
real_template = orig_template.isEmpty() ? "app" : orig_template;
|
||||
if(!Option::user_template_prefix.isEmpty() && !orig_template.startsWith(Option::user_template_prefix))
|
||||
real_template.prepend(Option::user_template_prefix);
|
||||
if(real_template != orig_template) {
|
||||
var = ".BUILTIN." + var;
|
||||
place[var] = QStringList(real_template);
|
||||
}
|
||||
}
|
||||
} else if(var.startsWith(QLatin1String("QMAKE_HOST."))) {
|
||||
QString ret, type = var.mid(11);
|
||||
#if defined(Q_OS_WIN32)
|
||||
if(type == "os") {
|
||||
ret = "Windows";
|
||||
} else if(type == "name") {
|
||||
DWORD name_length = 1024;
|
||||
wchar_t name[1024];
|
||||
if (GetComputerName(name, &name_length))
|
||||
ret = QString::fromWCharArray(name);
|
||||
} else if(type == "version" || type == "version_string") {
|
||||
QSysInfo::WinVersion ver = QSysInfo::WindowsVersion;
|
||||
if(type == "version")
|
||||
ret = QString::number(ver);
|
||||
else if(ver == QSysInfo::WV_Me)
|
||||
ret = "WinMe";
|
||||
else if(ver == QSysInfo::WV_95)
|
||||
ret = "Win95";
|
||||
else if(ver == QSysInfo::WV_98)
|
||||
ret = "Win98";
|
||||
else if(ver == QSysInfo::WV_NT)
|
||||
ret = "WinNT";
|
||||
else if(ver == QSysInfo::WV_2000)
|
||||
ret = "Win2000";
|
||||
else if(ver == QSysInfo::WV_2000)
|
||||
ret = "Win2003";
|
||||
else if(ver == QSysInfo::WV_XP)
|
||||
ret = "WinXP";
|
||||
else if(ver == QSysInfo::WV_VISTA)
|
||||
ret = "WinVista";
|
||||
else
|
||||
ret = "Unknown";
|
||||
} else if(type == "arch") {
|
||||
SYSTEM_INFO info;
|
||||
GetSystemInfo(&info);
|
||||
switch(info.wProcessorArchitecture) {
|
||||
#ifdef PROCESSOR_ARCHITECTURE_AMD64
|
||||
case PROCESSOR_ARCHITECTURE_AMD64:
|
||||
ret = "x86_64";
|
||||
break;
|
||||
#endif
|
||||
case PROCESSOR_ARCHITECTURE_INTEL:
|
||||
ret = "x86";
|
||||
break;
|
||||
case PROCESSOR_ARCHITECTURE_IA64:
|
||||
#ifdef PROCESSOR_ARCHITECTURE_IA32_ON_WIN64
|
||||
case PROCESSOR_ARCHITECTURE_IA32_ON_WIN64:
|
||||
#endif
|
||||
ret = "IA64";
|
||||
break;
|
||||
default:
|
||||
ret = "Unknown";
|
||||
break;
|
||||
}
|
||||
}
|
||||
#elif defined(Q_OS_UNIX)
|
||||
struct utsname name;
|
||||
if(!uname(&name)) {
|
||||
if(type == "os")
|
||||
ret = name.sysname;
|
||||
else if(type == "name")
|
||||
ret = name.nodename;
|
||||
else if(type == "version")
|
||||
ret = name.release;
|
||||
else if(type == "version_string")
|
||||
ret = name.version;
|
||||
else if(type == "arch")
|
||||
ret = name.machine;
|
||||
}
|
||||
#endif
|
||||
var = ".BUILTIN.HOST." + type;
|
||||
place[var] = QStringList(ret);
|
||||
} else if (var == QLatin1String("QMAKE_DIR_SEP")) {
|
||||
if (place[var].isEmpty())
|
||||
return values("DIR_SEPARATOR", place);
|
||||
} else if (var == QLatin1String("QMAKE_EXT_OBJ")) {
|
||||
if (place[var].isEmpty()) {
|
||||
var = ".BUILTIN." + var;
|
||||
place[var] = QStringList(Option::obj_ext);
|
||||
}
|
||||
} else if (var == QLatin1String("QMAKE_QMAKE")) {
|
||||
if (place[var].isEmpty())
|
||||
place[var] = QStringList(
|
||||
!Option::qmake_abslocation.isEmpty()
|
||||
? Option::qmake_abslocation
|
||||
: QLibraryInfo::rawLocation(QLibraryInfo::HostBinariesPath,
|
||||
QLibraryInfo::EffectivePaths) + "/qmake");
|
||||
return QStringList(parser.file);
|
||||
}
|
||||
#if defined(Q_OS_WIN32) && defined(Q_CC_MSVC)
|
||||
else if(var.startsWith(QLatin1String("QMAKE_TARGET."))) {
|
||||
QString ret, type = var.mid(13);
|
||||
if(type == "arch") {
|
||||
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))
|
||||
ret = "x86_64";
|
||||
else
|
||||
ret = "x86";
|
||||
}
|
||||
place[var] = QStringList(ret);
|
||||
}
|
||||
#endif
|
||||
//qDebug("REPLACE [%s]->[%s]", qPrintable(var), qPrintable(place[var].join("::")));
|
||||
return place[var];
|
||||
}
|
||||
|
||||
bool QMakeProject::isEmpty(const QString &v)
|
||||
QStringList &QMakeProject::values(const QString &_var, QHash<QString, QStringList> &place)
|
||||
{
|
||||
QHash<QString, QStringList>::ConstIterator it = vars.constFind(varMap(v));
|
||||
QString var = varMap(_var);
|
||||
return place[var];
|
||||
}
|
||||
|
||||
bool QMakeProject::isEmpty(const QString &v) const
|
||||
{
|
||||
QHash<QString, QStringList>::ConstIterator it = vars.constFind(v);
|
||||
return it == vars.constEnd() || it->isEmpty();
|
||||
}
|
||||
|
||||
void
|
||||
QMakeProject::dump() const
|
||||
{
|
||||
QStringList out;
|
||||
for (QHash<QString, QStringList>::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
|
||||
|
|
|
|||
|
|
@ -78,19 +78,20 @@ class QMakeProject
|
|||
FunctionBlock *function;
|
||||
QHash<QString, FunctionBlock*> testFunctions, replaceFunctions;
|
||||
|
||||
bool recursive;
|
||||
bool host_build;
|
||||
bool need_restart;
|
||||
bool own_prop;
|
||||
bool backslashWarned;
|
||||
QString project_build_root;
|
||||
QString conffile;
|
||||
QString superfile;
|
||||
QString cachefile;
|
||||
QString real_spec, short_spec;
|
||||
QString pfile;
|
||||
QMakeProperty *prop;
|
||||
void reset();
|
||||
QStringList extra_configs;
|
||||
QHash<QString, QStringList> vars, base_vars, extra_vars;
|
||||
QHash<QString, QStringList> vars, init_vars, base_vars, extra_vars;
|
||||
bool parse(const QString &text, QHash<QString, QStringList> &place, int line_count=1);
|
||||
|
||||
enum IncludeStatus {
|
||||
|
|
@ -113,9 +114,11 @@ class QMakeProject
|
|||
QStringList doVariableReplaceExpand(const QString &str, QHash<QString, QStringList> &place, bool *ok=0);
|
||||
void init(QMakeProperty *);
|
||||
void cleanup();
|
||||
void loadDefaults();
|
||||
void setupProject();
|
||||
QStringList &values(const QString &v, QHash<QString, QStringList> &place);
|
||||
void validateModes();
|
||||
void resolveSpec(QString *spec, const QString &qmakespec);
|
||||
QStringList magicValues(const QString &v, const QHash<QString, QStringList> &place) const;
|
||||
QStringList qmakeFeaturePaths();
|
||||
|
||||
public:
|
||||
QMakeProject(QMakeProperty *p = 0) { init(p); }
|
||||
|
|
@ -134,8 +137,10 @@ 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; }
|
||||
inline QMakeProperty *properties() { return prop; }
|
||||
|
||||
bool doProjectTest(QString str, QHash<QString, QStringList> &place);
|
||||
|
|
@ -160,14 +165,17 @@ public:
|
|||
bool isActiveConfig(const QString &x, bool regex=false,
|
||||
QHash<QString, QStringList> *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<QString, QStringList> &variables(); // No compat mapping and magic, obviously
|
||||
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) const;
|
||||
int intValue(const QString &v, int defaultValue = 0) const;
|
||||
const QHash<QString, QStringList> &variables() const { return vars; }
|
||||
QHash<QString, QStringList> &variables() { return vars; }
|
||||
|
||||
void dump() const;
|
||||
|
||||
bool isRecursive() const { return recursive; }
|
||||
bool isHostBuild() const { return host_build; }
|
||||
|
||||
protected:
|
||||
|
|
@ -185,13 +193,7 @@ 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)
|
||||
inline QString QMakeProject::first(const QString &v) const
|
||||
{
|
||||
const QStringList vals = values(v);
|
||||
if(vals.isEmpty())
|
||||
|
|
@ -199,7 +201,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()) {
|
||||
|
|
@ -211,9 +213,6 @@ inline int QMakeProject::intValue(const QString &v, int defaultValue)
|
|||
return defaultValue;
|
||||
}
|
||||
|
||||
inline QHash<QString, QStringList> &QMakeProject::variables()
|
||||
{ return vars; }
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // PROJECT_H
|
||||
|
|
|
|||
|
|
@ -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++)
|
||||
|
|
|
|||
|
|
@ -54,8 +54,6 @@ class QMakeProperty
|
|||
{
|
||||
QSettings *settings;
|
||||
void initSettings();
|
||||
QString keyBase(bool =true) const;
|
||||
QString value(QString, bool just_check);
|
||||
|
||||
QHash<QString, QString> 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 &);
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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: ~=" )
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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]" )
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3011,7 +3011,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()) {
|
||||
|
|
@ -3022,10 +3022,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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in New Issue