Skip to content

Commit

Permalink
introduce qmake variable abstractions
Browse files Browse the repository at this point in the history
this is preparation for adapting to a new evaluator.

Change-Id: I6fc59f5525735754a00afa6629fbfe257e84db97
Reviewed-by: Daniel Teske <[email protected]>
Reviewed-by: Joerg Bornemann <[email protected]>
  • Loading branch information
ossilator authored and Qt by Nokia committed Sep 7, 2012
1 parent 9c29beb commit df175f1
Show file tree
Hide file tree
Showing 36 changed files with 1,678 additions and 1,195 deletions.
3 changes: 2 additions & 1 deletion qmake/Makefile.unix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ QMAKESPEC = @QMAKESPEC@
LFLAGS = @QMAKE_LFLAGS@

QMKSRC = $(SOURCE_PATH)/qmake
QMKLIBSRC = $(QMKSRC)/library
QMKGENSRC = $(QMKSRC)/generators

#qmake code
Expand Down Expand Up @@ -82,7 +83,7 @@ DEPEND_SRC = \
$(QTSRCS)

CPPFLAGS = -g $(OPENSOURCE_CXXFLAGS) \
-I$(QMKSRC) -I$(QMKSRC)/generators -I$(QMKSRC)/generators/unix -I$(QMKSRC)/generators/win32 \
-I$(QMKSRC) -I$(QMKLIBSRC) -I$(QMKSRC)/generators -I$(QMKSRC)/generators/unix -I$(QMKSRC)/generators/win32 \
-I$(QMKSRC)/generators/mac -I$(QMKSRC)/generators/integrity \
-I$(BUILD_PATH)/include -I$(BUILD_PATH)/include/QtCore \
-I$(BUILD_PATH)/include/QtCore/$(QT_VERSION) -I$(BUILD_PATH)/include/QtCore/$(QT_VERSION)/QtCore \
Expand Down
2 changes: 1 addition & 1 deletion qmake/Makefile.win32
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ CFLAGS_EXTRA = /MP
CFLAGS_BARE = -c -Fo./ \
-W3 -nologo -O1 \
$(CFLAGS_EXTRA) \
-I$(QMKSRC) -I$(QMKSRC)\generators -I$(QMKSRC)\generators\unix -I$(QMKSRC)\generators\win32 -I$(QMKSRC)\generators\mac -I$(QMKSRC)\generators\integrity \
-I$(QMKSRC) -I$(QMKSRC)\library -I$(QMKSRC)\generators -I$(QMKSRC)\generators\unix -I$(QMKSRC)\generators\win32 -I$(QMKSRC)\generators\mac -I$(QMKSRC)\generators\integrity \
-I$(BUILD_PATH)\include -I$(BUILD_PATH)\include\QtCore -I$(BUILD_PATH)\include\QtCore\$(QT_VERSION) -I$(BUILD_PATH)\include\QtCore\$(QT_VERSION)\QtCore \
-I$(BUILD_PATH)\src\corelib\global -DHAVE_QCONFIG_CPP \
-I$(SOURCE_PATH)\mkspecs\$(QMAKESPEC) \
Expand Down
3 changes: 2 additions & 1 deletion qmake/Makefile.win32-g++
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ endif
CORESRC = $(SOURCE_PATH)/src/corelib
TOOLSRC = $(SOURCE_PATH)/tools
QMKSRC = $(SOURCE_PATH)/qmake
QMKLIBSRC = $(QMKSRC)/library

# SHELL is the full path of sh.exe, unless
# 1) it is found in the current directory
Expand Down Expand Up @@ -43,7 +44,7 @@ endif
#
CXX = g++
CFLAGS = -c -o$@ -O \
-I$(QMKSRC) -I$(QMKSRC)/generators -I$(QMKSRC)/generators/unix -I$(QMKSRC)/generators/win32 -I$(QMKSRC)/generators/mac -I$(QMKSRC)/generators/integrity \
-I$(QMKSRC) -I$(QMKLIBSRC) -I$(QMKSRC)/generators -I$(QMKSRC)/generators/unix -I$(QMKSRC)/generators/win32 -I$(QMKSRC)/generators/mac -I$(QMKSRC)/generators/integrity \
-I$(BUILD_PATH)/include -I$(BUILD_PATH)/include/QtCore -I$(BUILD_PATH)/include/QtCore/$(QT_VERSION) -I$(BUILD_PATH)/include/QtCore/$(QT_VERSION)/QtCore \
-I$(BUILD_PATH)/src/corelib/global -DHAVE_QCONFIG_CPP \
-I$(SOURCE_PATH)/mkspecs/win32-g++ \
Expand Down
51 changes: 26 additions & 25 deletions qmake/generators/integrity/gbuild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ GBuildMakefileGenerator::write()
QString filename(Option::output.fileName());
QString pathtoremove(qmake_getpwd());
QString relpath(pathtoremove);
QString strtarget(project->first("TARGET"));
QString strtarget(project->first("TARGET").toQString());
bool isnativebin = nativebins.contains(strtarget);
relpath.replace(Option::output_dir, "");

Expand Down Expand Up @@ -214,7 +214,7 @@ GBuildMakefileGenerator::write()
}

QTextStream t(&Option::output);
QString primaryTarget(project->values("QMAKE_CXX").at(0));
QString primaryTarget(project->values("QMAKE_CXX").at(0).toQString());

pathtoremove += QDir::separator();
filename.remove(qmake_getpwd());
Expand Down Expand Up @@ -258,8 +258,8 @@ GBuildMakefileGenerator::write()
t << "\t-Iwork\n";
t << "\t-Llib\n";
t << "\t";
const QStringList &l = project->values("QMAKE_CXXFLAGS");
for (QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
const ProStringList &l = project->values("QMAKE_CXXFLAGS");
for (ProStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
if ((*it).startsWith("-"))
t << "\n" << "\t" << (*it);
else
Expand All @@ -284,8 +284,8 @@ GBuildMakefileGenerator::write()
if (isnativebin && (i == 0))
continue;
t << "\t";
const QStringList &l = project->values(src[i]);
for (QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
const ProStringList &l = project->values(src[i]);
for (ProStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
if ((*it).startsWith("-"))
t << "\n" << "\t" << (*it);
else
Expand All @@ -297,14 +297,15 @@ GBuildMakefileGenerator::write()

/* first subdirectories/subprojects */
{
const QStringList &l = project->values("SUBDIRS");
for (QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
QString gpjname((*it));
const ProStringList &l = project->values("SUBDIRS");
for (ProStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
QString gpjname((*it).toQString());
/* avoid native tools */
if (nativebins.contains(gpjname.section("_", -1)))
continue;
if (!project->first((*it) + ".subdir").isEmpty())
gpjname = project->first((*it) + ".subdir");
const ProKey skey(*it + ".subdir");
if (!project->first(skey).isEmpty())
gpjname = project->first(skey).toQString();
else
gpjname.replace("_", QDir::separator());
gpjname += QDir::separator() + gpjname.section(QDir::separator(), -1);
Expand All @@ -318,9 +319,9 @@ GBuildMakefileGenerator::write()
}

{
const QStringList &l = project->values("RESOURCES");
for (QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
QString tmpstr(*it);
const ProStringList &l = project->values("RESOURCES");
for (ProStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
QString tmpstr((*it).toQString());
tmpstr.remove(pathtoremove);
t << tmpstr << "\t[Qt Resource]\n";
tmpstr = tmpstr.section(".", -2, -1).section(QDir::separator(), -1);
Expand All @@ -332,9 +333,9 @@ GBuildMakefileGenerator::write()
}
}
{
const QStringList &l = project->values("FORMS");
for (QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
QString tmpstr(*it);
const ProStringList &l = project->values("FORMS");
for (ProStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
QString tmpstr((*it).toQString());
tmpstr.remove(pathtoremove);
t << tmpstr << "\t[Qt Dialog]\n";
tmpstr = tmpstr.section(".", 0, 0).section(QDir::separator(), -1);
Expand All @@ -348,23 +349,23 @@ GBuildMakefileGenerator::write()
/* source files for this project */
static const char * const src[] = { "HEADERS", "SOURCES", 0 };
for (int i = 0; src[i]; i++) {
const QStringList &l = project->values(src[i]);
for (QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
const ProStringList &l = project->values(src[i]);
for (ProStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
if ((*it).isEmpty())
continue;
/* native tools aren't preprocessed */
if (!isnativebin)
t << writeOne((*it), pathtoremove);
t << writeOne((*it).toQString(), pathtoremove);
else
t << QString(*it).remove(pathtoremove) << "\n";
t << (*it).toQString().remove(pathtoremove) << "\n";
}
}
t << "\n";

{
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";
const ProStringList &l = project->values("GENERATED_SOURCES");
for (ProStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
t << "work/" << (*it).toQString().section(QDir::separator(), -1) << "\n";
}
}

Expand Down Expand Up @@ -395,7 +396,7 @@ QString GBuildMakefileGenerator::writeOne(QString filename, QString pathtoremove
QString tmpstr(filename.section("/", -1));
QString filepath(pathtoremove);
if (!project->values("QT_SOURCE_TREE").isEmpty()) {
filepath.remove(project->values("QT_SOURCE_TREE").first());
filepath.remove(project->first("QT_SOURCE_TREE").toQString());
filepath.remove(0, 1);
}
s += "\n\t:preexecShellSafe='${QT_BUILD_DIR}/bin/moc ";
Expand Down
2 changes: 1 addition & 1 deletion qmake/generators/integrity/gbuild.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class GBuildMakefileGenerator : public MakefileGenerator
protected:
bool doPrecompiledHeaders() const { return false; }
virtual bool doDepends() const { return true; }
QStringList nativebins;
ProStringList nativebins;

};

Expand Down
Loading

0 comments on commit df175f1

Please sign in to comment.