summaryrefslogtreecommitdiff
path: root/qmake/generators/win32
Side-by-side diff
Diffstat (limited to 'qmake/generators/win32') (more/less context) (ignore whitespace changes)
-rw-r--r--qmake/generators/win32/borland_bmake.cpp56
-rw-r--r--qmake/generators/win32/borland_bmake.h9
-rw-r--r--qmake/generators/win32/mingw_make.cpp524
-rw-r--r--qmake/generators/win32/mingw_make.h58
-rw-r--r--qmake/generators/win32/msvc_dsp.cpp171
-rw-r--r--qmake/generators/win32/msvc_dsp.h14
-rw-r--r--qmake/generators/win32/msvc_nmake.cpp98
-rw-r--r--qmake/generators/win32/msvc_nmake.h8
-rw-r--r--qmake/generators/win32/msvc_objectmodel.cpp243
-rw-r--r--qmake/generators/win32/msvc_objectmodel.h100
-rw-r--r--qmake/generators/win32/msvc_vcproj.cpp412
-rw-r--r--qmake/generators/win32/msvc_vcproj.h30
-rw-r--r--qmake/generators/win32/winmakefile.cpp148
13 files changed, 1413 insertions, 458 deletions
diff --git a/qmake/generators/win32/borland_bmake.cpp b/qmake/generators/win32/borland_bmake.cpp
index ae7b47b..26eea88 100644
--- a/qmake/generators/win32/borland_bmake.cpp
+++ b/qmake/generators/win32/borland_bmake.cpp
@@ -111,160 +111,171 @@ BorlandMakefileGenerator::writeBorlandParts(QTextStream &t)
t << var("QMAKE_LFLAGS") << endl;
t << "LIBS = " << var("QMAKE_LIBS") << endl;
}
else {
t << "LIB = " << var("QMAKE_LIB") << endl;
}
t << "MOC = " << (project->isEmpty("QMAKE_MOC") ? QString("moc") :
Option::fixPathToTargetOS(var("QMAKE_MOC"), FALSE)) << endl;
t << "UIC = " << (project->isEmpty("QMAKE_UIC") ? QString("uic") :
Option::fixPathToTargetOS(var("QMAKE_UIC"), FALSE)) << endl;
t << "QMAKE = " << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") :
Option::fixPathToTargetOS(var("QMAKE_QMAKE"), FALSE)) << endl;
t << "IDC = " << (project->isEmpty("QMAKE_IDC") ? QString("idc") :
Option::fixPathToTargetOS(var("QMAKE_IDC"), FALSE)) << endl;
t << "IDL = " << (project->isEmpty("QMAKE_IDL") ? QString("midl") :
Option::fixPathToTargetOS(var("QMAKE_IDL"), FALSE)) << endl;
t << "ZIP = " << var("QMAKE_ZIP") << endl;
t << "DEF_FILE = " << varList("DEF_FILE") << endl;
t << "RES_FILE = " << varList("RES_FILE") << endl;
t << "COPY_FILE = " << var("QMAKE_COPY") << endl;
t << "COPY_DIR = " << var("QMAKE_COPY") << endl;
t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl;
t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl;
t << "MOVE = " << var("QMAKE_MOVE") << endl;
+ t << "CHK_DIR_EXISTS = " << var("QMAKE_CHK_DIR_EXISTS") << endl;
+ t << "MKDIR = " << var("QMAKE_MKDIR") << endl;
t << endl;
t << "####### Files" << endl << endl;
t << "HEADERS = " << varList("HEADERS") << endl;
t << "SOURCES = " << varList("SOURCES") << endl;
t << "OBJECTS = " << varList("OBJECTS") << endl;
t << "FORMS = " << varList("FORMS") << endl;
t << "UICDECLS = " << varList("UICDECLS") << endl;
t << "UICIMPLS = " << varList("UICIMPLS") << endl;
t << "SRCMOC = " << varList("SRCMOC") << endl;
t << "OBJMOC = " << varList("OBJMOC") << endl;
t << "DIST = " << varList("DISTFILES") << endl;
t << "TARGET = "
<< varGlue("TARGET",project->first("DESTDIR"),"",project->first("TARGET_EXT"))
<< endl;
t << endl;
t << "####### Implicit rules" << endl << endl;
- t << ".SUFFIXES: .cpp .cxx .cc .c" << endl << endl;
- t << ".cpp.obj:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl;
- t << ".cxx.obj:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl;
- t << ".cc.obj:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl;
- t << ".c.obj:\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl;
+ t << ".SUFFIXES: .c";
+ QStringList::Iterator cppit;
+ for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit)
+ t << " " << (*cppit);
+ t << endl << endl;
+ for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit)
+ t << (*cppit) << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl;
+ t << ".c" << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl;
t << "####### Build rules" << endl << endl;
t << "all: " << varGlue("ALL_DEPS",""," "," ") << " $(TARGET)" << endl << endl;
- t << "$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) " << var("TARGETDEPS");
+ t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) "
+ << var("POST_TARGETDEPS");
if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) {
t << "\n\t" << "$(LINK) @&&|" << "\n\t"
<< "$(LFLAGS) $(OBJECTS) $(OBJMOC),$(TARGET),,$(LIBS),$(DEF_FILE),$(RES_FILE)";
} else {
t << "\n\t-del $(TARGET)"
<< "\n\t" << "$(LIB) $(TARGET) @&&|" << " \n+"
<< project->variables()["OBJECTS"].join(" \\\n+") << " \\\n+"
<< project->variables()["OBJMOC"].join(" \\\n+");
}
t << endl << "|" << endl;
+
+ if ( !project->variables()["QMAKE_POST_LINK"].isEmpty() )
+ t << "\t" <<var("QMAKE_POST_LINK") << endl;
+
if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty()) {
QStringList dlldirs = project->variables()["DLLDESTDIR"];
for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) {
t << "\n\t" << "-copy $(TARGET) " << *dlldir;
}
}
QString targetfilename = project->variables()["TARGET"].first();
if(project->isActiveConfig("activeqt")) {
QString version = project->variables()["VERSION"].first();
if ( version.isEmpty() )
version = "1.0";
if ( project->isActiveConfig("dll")) {
t << "\n\t" << ("-$(IDC) $(TARGET) /idl tmp\\" + targetfilename + ".idl -version " + version);
t << "\n\t" << ("-$(IDL) tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl");
t << "\n\t" << ("-$(IDC) $(TARGET) /tlb tmp\\" + targetfilename + ".tlb");
t << "\n\t" << ("-$(IDC) $(TARGET) /regserver" );
} else {
t << "\n\t" << ("-$(TARGET) -dumpidl tmp\\" + targetfilename + ".idl -version " + version);
t << "\n\t" << ("-$(IDL) tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl");
t << "\n\t" << ("-$(IDC) $(TARGET) /tlb tmp\\" + targetfilename + ".tlb");
t << "\n\t" << ("-$(TARGET) -regserver");
}
}
t << endl << endl;
if(!project->variables()["RC_FILE"].isEmpty()) {
t << var("RES_FILE") << ": " << var("RC_FILE") << "\n\t"
<< var("QMAKE_RC") << " " << var("RC_FILE") << endl << endl;
}
t << "mocables: $(SRCMOC)" << endl << endl;
writeMakeQmake(t);
t << "dist:" << "\n\t"
<< "$(ZIP) " << var("PROJECT") << ".zip " << var("PROJECT") << ".pro $(SOURCES) $(HEADERS) $(DIST) $(FORMS)"
<< endl << endl;
t << "clean:\n"
<< varGlue("OBJECTS","\t-del ","\n\t-del ","")
<< varGlue("SRCMOC" ,"\n\t-del ","\n\t-del ","")
<< varGlue("OBJMOC" ,"\n\t-del ","\n\t-del ","")
<< varGlue("UICDECLS" ,"\n\t-del ","\n\t-del ","")
<< varGlue("UICIMPLS" ,"\n\t-del ","\n\t-del ","")
- << "\n\t-del $(TARGET)"
<< varGlue("QMAKE_CLEAN","\n\t-del ","\n\t-del ","")
<< varGlue("CLEAN_FILES","\n\t-del ","\n\t-del ","");
if ( project->isActiveConfig("activeqt")) {
t << ("\n\t-del tmp\\" + targetfilename + ".*");
t << "\n\t-del tmp\\dump.*";
}
- if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty())
- t << "\n\t-del " << var("DLLDESTDIR") << "\\" << project->variables()[ "TARGET" ].first() << project->variables()[ "TARGET_EXT" ].first();
if(!project->isEmpty("IMAGES"))
t << varGlue("QMAKE_IMAGE_COLLECTION", "\n\t-del ", "\n\t-del ", "");
// blasted user defined targets
QStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"];
for(QStringList::Iterator 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->variables()[(*it) + ".depends"];
for(QStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) {
QString dep = var((*dep_it) + ".target");
if(dep.isEmpty())
dep = (*dep_it);
deps += " " + dep;
}
t << "\n\n" << targ << ":" << deps << "\n\t"
<< cmd;
}
t << endl << endl;
+
+ t << "distclean: clean"
+ << "\n\t-del $(TARGET)"
+ << endl << endl;
}
void
BorlandMakefileGenerator::init()
{
if(init_flag)
return;
init_flag = TRUE;
project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"];
/* this should probably not be here, but I'm using it to wrap the .t files */
if(project->first("TEMPLATE") == "app")
project->variables()["QMAKE_APP_FLAG"].append("1");
else if(project->first("TEMPLATE") == "lib")
project->variables()["QMAKE_LIB_FLAG"].append("1");
else if(project->first("TEMPLATE") == "subdirs") {
MakefileGenerator::init();
if(project->variables()["MAKEFILE"].isEmpty())
project->variables()["MAKEFILE"].append("Makefile");
if(project->variables()["QMAKE"].isEmpty())
project->variables()["QMAKE"].append("qmake");
return;
}
@@ -343,49 +354,49 @@ BorlandMakefileGenerator::init()
project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR"];
}
if ( project->isActiveConfig("qt") || project->isActiveConfig("opengl") ) {
project->variables()["CONFIG"].append("windows");
}
if ( project->isActiveConfig("qt") ) {
project->variables()["CONFIG"].append("moc");
project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_QT"];
project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QT"];
if ( !project->isActiveConfig("debug") )
project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_NO_DEBUG");
if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) {
if ( !project->variables()["QMAKE_QT_DLL"].isEmpty()) {
project->variables()["DEFINES"].append("QT_MAKEDLL");
project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_QT_DLL"];
}
} else {
if(project->isActiveConfig("thread"))
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"];
else
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"];
if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) {
int hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt");
if ( hver == -1 )
- hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt-mt");
+ hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qtmt");
if(hver != -1) {
QString ver;
ver.sprintf("qt%s" QTDLL_POSTFIX "%d.lib", (project->isActiveConfig("thread") ? "mt" : ""), hver);
QStringList &libs = project->variables()["QMAKE_LIBS"];
for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit)
(*libit).replace(QRegExp("qt(mt)?\\.lib"), ver);
}
}
if ( project->isActiveConfig( "activeqt" ) ) {
project->variables().remove("QMAKE_LIBS_QT_ENTRY");
project->variables()["QMAKE_LIBS_QT_ENTRY"] = "qaxserver.lib";
if ( project->isActiveConfig( "dll" ) )
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"];
}
if ( !project->isActiveConfig("dll") && !project->isActiveConfig("plugin") ) {
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"];
}
}
}
if ( project->isActiveConfig("opengl") ) {
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"];
project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_OPENGL"];
}
if ( project->isActiveConfig("dll") ) {
@@ -405,73 +416,94 @@ BorlandMakefileGenerator::init()
project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_LFLAGS_CONSOLE"];
project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"] = project->variables()["QMAKE_LFLAGS_WINDOWS"];
if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty()) {
project->variables()["TARGET_EXT"].append(".exe");
} else {
project->variables()["TARGET_EXT"].append(".lib");
}
}
if ( project->isActiveConfig("windows") ) {
if ( project->isActiveConfig("console") ) {
project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"];
project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"];
project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"];
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"];
} else {
project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"];
}
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"];
} else {
project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"];
project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"];
project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"];
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"];
}
+ if ( project->isActiveConfig("stl") ) {
+ project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_ON"];
+ project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_ON"];
+ } else {
+ project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_OFF"];
+ project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_OFF"];
+ }
+ if ( project->isActiveConfig("exceptions") ) {
+ project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_ON"];
+ project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_ON"];
+ } else {
+ project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_OFF"];
+ project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_OFF"];
+ }
+ if ( project->isActiveConfig("rtti") ) {
+ project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_ON"];
+ project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_ON"];
+ } else {
+ project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_OFF"];
+ project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_OFF"];
+ }
+
if ( project->isActiveConfig("thread") ) {
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_RTMT"];
} else {
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_RT"];
}
if ( project->isActiveConfig("moc") ) {
setMocAware(TRUE);
}
project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"];
project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ',
"HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH");
QStringList &l = project->variables()["QMAKE_FILETAGS"];
for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
QStringList &gdmf = project->variables()[(*it)];
for(QStringList::Iterator inner = gdmf.begin(); inner != gdmf.end(); ++inner)
(*inner) = Option::fixPathToTargetOS((*inner), FALSE);
}
if ( !project->variables()["RC_FILE"].isEmpty()) {
if ( !project->variables()["RES_FILE"].isEmpty()) {
fprintf(stderr, "Both .rc and .res file specified.\n");
fprintf(stderr, "Please specify one of them, not both.");
exit(666);
}
project->variables()["RES_FILE"] = project->variables()["RC_FILE"];
project->variables()["RES_FILE"].first().replace(".rc",".res");
- project->variables()["TARGETDEPS"] += project->variables()["RES_FILE"];
+ project->variables()["POST_TARGETDEPS"] += project->variables()["RES_FILE"];
}
MakefileGenerator::init();
if ( !project->variables()["VERSION"].isEmpty()) {
QStringList l = QStringList::split('.', project->first("VERSION"));
project->variables()["VER_MAJ"].append(l[0]);
project->variables()["VER_MIN"].append(l[1]);
}
if ( project->isActiveConfig("dll") || !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) {
// bcc does not generate a .tds file for static libs
QString tdsPostfix;
if ( !project->variables()["VERSION"].isEmpty() ) {
tdsPostfix = QStringList::split( '.', project->first("VERSION") ).join("")
+ ".tds";
} else {
tdsPostfix = ".tds";
}
project->variables()["QMAKE_CLEAN"].append(
project->first("DESTDIR") + project->first("TARGET") + tdsPostfix );
}
}
-
diff --git a/qmake/generators/win32/borland_bmake.h b/qmake/generators/win32/borland_bmake.h
index 90f8229..5ffed58 100644
--- a/qmake/generators/win32/borland_bmake.h
+++ b/qmake/generators/win32/borland_bmake.h
@@ -1,59 +1,58 @@
/****************************************************************************
** $Id$
**
** Definition of ________ class.
**
** Created : 970521
**
-** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
+** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
**
** This file is part of the network module of the Qt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.QPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid Qt Enterprise Edition licenses may use this
** file in accordance with the Qt Commercial License Agreement provided
** with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for QPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
-#ifndef __BORLANDMAKE_H__
-#define __BORLANDMAKE_H__
+#ifndef __BORLAND_BMAKE_H__
+#define __BORLAND_BMAKE_H__
#include "winmakefile.h"
class BorlandMakefileGenerator : public Win32MakefileGenerator
{
bool init_flag;
void writeBorlandParts(QTextStream &);
bool writeMakefile(QTextStream &);
void init();
public:
BorlandMakefileGenerator(QMakeProject *p);
~BorlandMakefileGenerator();
};
inline BorlandMakefileGenerator::~BorlandMakefileGenerator()
{ }
-
-#endif /* __BORLANDMAKE_H__ */
+#endif /* __BORLAND_BMAKE_H__ */
diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp
new file mode 100644
index 0000000..7f58a55
--- a/dev/null
+++ b/qmake/generators/win32/mingw_make.cpp
@@ -0,0 +1,524 @@
+/****************************************************************************
+** $Id$
+**
+** Definition of ________ class.
+**
+** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
+**
+** This file is part of the network module of the Qt GUI Toolkit.
+**
+** This file may be distributed under the terms of the Q Public License
+** as defined by Trolltech AS of Norway and appearing in the file
+** LICENSE.QPL included in the packaging of this file.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition licenses may use this
+** file in accordance with the Qt Commercial License Agreement provided
+** with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
+** information about Qt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include "mingw_make.h"
+#include "option.h"
+#include <qregexp.h>
+#include <qdir.h>
+#include <stdlib.h>
+#include <time.h>
+
+
+MingwMakefileGenerator::MingwMakefileGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE)
+{
+ Option::obj_ext = ".o";
+}
+
+bool
+MingwMakefileGenerator::writeMakefile(QTextStream &t)
+{
+ writeHeader(t);
+ if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) {
+ t << "all clean:" << "\n\t"
+ << "@echo \"Some of the required modules ("
+ << var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"" << "\n\t"
+ << "@echo \"Skipped.\"" << endl << endl;
+ writeMakeQmake(t);
+ return TRUE;
+ }
+
+ if(project->first("TEMPLATE") == "app" ||
+ project->first("TEMPLATE") == "lib") {
+ writeMingwParts(t);
+ return MakefileGenerator::writeMakefile(t);
+ }
+ else if(project->first("TEMPLATE") == "subdirs") {
+ writeSubDirs(t);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+void
+MingwMakefileGenerator::writeMingwParts(QTextStream &t)
+{
+ t << "####### Compiler, tools and options" << endl << endl;
+ t << "CC = " << var("QMAKE_CC") << endl;
+ t << "CXX = " << var("QMAKE_CXX") << endl;
+ t << "LEX = " << var("QMAKE_LEX") << endl;
+ t << "YACC = " << var("QMAKE_YACC") << endl;
+ t << "CFLAGS = " << var("QMAKE_CFLAGS") << " "
+ << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " "
+ << varGlue("DEFINES","-D"," -D","") << endl;
+ t << "CXXFLAGS = " << var("QMAKE_CXXFLAGS") << " "
+ << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " "
+ << varGlue("DEFINES","-D"," -D","") << endl;
+ t << "LEXFLAGS =" << var("QMAKE_LEXFLAGS") << endl;
+ t << "YACCFLAGS =" << var("QMAKE_YACCFLAGS") << endl;
+
+ t << "INCPATH = ";
+ QStringList &incs = project->variables()["INCLUDEPATH"];
+ for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) {
+ QString inc = (*incit);
+ inc.replace(QRegExp("\\\\$"), "\\\\");
+ inc.replace(QRegExp("\""), "");
+ t << " -I" << inc ;
+ }
+ t << " -I" << specdir()
+ << endl;
+ if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) {
+ t << "LINK = " << var("QMAKE_LINK") << endl;
+ t << "LFLAGS = ";
+ if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() )
+ t << varGlue("QMAKE_LIBDIR","-L",";","") << " ";
+ t << var("QMAKE_LFLAGS") << endl;
+ t << "LIBS = " << var("QMAKE_LIBS").replace(QRegExp("(\\slib|^lib)")," -l") << endl;
+ }
+ else {
+ t << "LIB = " << var("QMAKE_LIB") << endl;
+ }
+ t << "MOC = " << (project->isEmpty("QMAKE_MOC") ? QString("moc") :
+ Option::fixPathToTargetOS(var("QMAKE_MOC"), FALSE)) << endl;
+ t << "UIC = " << (project->isEmpty("QMAKE_UIC") ? QString("uic") :
+ Option::fixPathToTargetOS(var("QMAKE_UIC"), FALSE)) << endl;
+ t << "QMAKE = " << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") :
+ Option::fixPathToTargetOS(var("QMAKE_QMAKE"), FALSE)) << endl;
+ t << "IDC = " << (project->isEmpty("QMAKE_IDC") ? QString("idc") :
+ Option::fixPathToTargetOS(var("QMAKE_IDC"), FALSE)) << endl;
+ t << "IDL = " << (project->isEmpty("QMAKE_IDL") ? QString("midl") :
+ Option::fixPathToTargetOS(var("QMAKE_IDL"), FALSE)) << endl;
+ t << "ZIP = " << var("QMAKE_ZIP") << endl;
+ t << "DEF_FILE = " << varList("DEF_FILE") << endl;
+ t << "COPY_FILE = " << var("QMAKE_COPY") << endl;
+ t << "COPY_DIR = " << var("QMAKE_COPY") << endl;
+ t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl;
+ t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl;
+ t << "MOVE = " << var("QMAKE_MOVE") << endl;
+ t << "CHK_DIR_EXISTS = " << var("QMAKE_CHK_DIR_EXISTS") << endl;
+ t << "MKDIR = " << var("QMAKE_MKDIR") << endl;
+ t << endl;
+
+ t << "####### Output directory" << endl << endl;
+ if (! project->variables()["OBJECTS_DIR"].isEmpty())
+ t << "OBJECTS_DIR = " << var("OBJECTS_DIR").replace(QRegExp("\\\\$"),"") << endl;
+ else
+ t << "OBJECTS_DIR = . " << endl;
+ if (! project->variables()["MOC_DIR"].isEmpty())
+ t << "MOC_DIR = " << var("MOC_DIR").replace(QRegExp("\\\\$"),"") << endl;
+ else
+ t << "MOC_DIR = . " << endl;
+ t << endl;
+
+ t << "####### Files" << endl << endl;
+ t << "HEADERS = " << varList("HEADERS") << endl;
+ t << "SOURCES = " << varList("SOURCES") << endl;
+// t << "OBJECTS = " << varList("OBJECTS").replace(QRegExp("\\.obj"),".o") << endl;
+ t << "OBJECTS = " << varList("OBJECTS") << endl;
+ t << "FORMS = " << varList("FORMS") << endl;
+ t << "UICDECLS = " << varList("UICDECLS") << endl;
+ t << "UICIMPLS = " << varList("UICIMPLS") << endl;
+ t << "SRCMOC = " << varList("SRCMOC") << endl;
+ t << "OBJMOC = " << varList("OBJMOC") << endl;
+// t << "OBJMOC = " << varList("OBJMOC").replace(QRegExp("\\.obj"),".o") << endl;
+ t << "DIST = " << varList("DISTFILES") << endl;
+ t << "TARGET = ";
+ if( !project->variables()[ "DESTDIR" ].isEmpty() )
+ t << varGlue("TARGET",project->first("DESTDIR"),"",project->first("TARGET_EXT"));
+ else
+ t << project->variables()[ "TARGET" ].first() << project->variables()[ "TARGET_EXT" ].first();
+ t << endl;
+ t << endl;
+
+ t << "####### Implicit rules" << endl << endl;
+ t << ".SUFFIXES: .cpp .cxx .cc .C .c" << endl << endl;
+ t << ".cpp.o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl;
+ t << ".cxx.o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl;
+ t << ".cc.o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl;
+ t << ".C.o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl;
+ t << ".c.o:\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl;
+
+ t << "####### Build rules" << endl << endl;
+ t << "all: " << "$(OBJECTS_DIR) " << "$(MOC_DIR) " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" << endl << endl;
+ t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) "
+ << var("POST_TARGETDEPS");
+ if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) {
+ t << "\n\t" << "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)";
+ } else {
+ t << "\n\t" << "$(LIB) $(TARGET) $(OBJECTS) $(OBJMOC)";
+ }
+
+ if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty()) {
+ QStringList dlldirs = project->variables()["DLLDESTDIR"];
+ for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) {
+ t << "\n\t" << "copy $(TARGET) " << *dlldir;
+ }
+ }
+ QString targetfilename = project->variables()["TARGET"].first();
+ if(project->isActiveConfig("activeqt")) {
+ QString version = project->variables()["VERSION"].first();
+ if ( version.isEmpty() )
+ version = "1.0";
+
+ if ( project->isActiveConfig("dll")) {
+ t << "\n\t" << ("-$(IDC) $(TARGET) /idl tmp\\" + targetfilename + ".idl -version " + version);
+ t << "\n\t" << ("-$(IDL) tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl");
+ t << "\n\t" << ("-$(IDC) $(TARGET) /tlb tmp\\" + targetfilename + ".tlb");
+ t << "\n\t" << ("-$(IDC) $(TARGET) /regserver" );
+ } else {
+ t << "\n\t" << ("-$(TARGET) -dumpidl tmp\\" + targetfilename + ".idl -version " + version);
+ t << "\n\t" << ("-$(IDL) tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl");
+ t << "\n\t" << ("-$(IDC) $(TARGET) /tlb tmp\\" + targetfilename + ".tlb");
+ t << "\n\t" << "-$(TARGET) -regserver";
+ }
+ }
+ t << endl << endl;
+
+ if(!project->variables()["RC_FILE"].isEmpty()) {
+ t << var("RES_FILE") << ": " << var("RC_FILE") << "\n\t"
+ << var("QMAKE_RC") << " -i " << var("RC_FILE") << " -o " << var("RC_FILE").replace(QRegExp("\\.rc"),".o") << endl << endl;
+ }
+ project->variables()["RES_FILE"].first().replace(QRegExp("\\.rc"),".o");
+
+ t << "mocables: $(SRCMOC)" << endl << endl;
+
+ t << "$(OBJECTS_DIR):" << "\n\t"
+ << "@if not exist $(OBJECTS_DIR) mkdir $(OBJECTS_DIR)" << endl << endl;
+
+ t << "$(MOC_DIR):" << "\n\t"
+ << "@if not exist $(MOC_DIR) mkdir $(MOC_DIR)" << endl << endl;
+
+ writeMakeQmake(t);
+
+ t << "dist:" << "\n\t"
+ << "$(ZIP) " << var("PROJECT") << ".zip "
+ << var("PROJECT") << ".pro $(SOURCES) $(HEADERS) $(DIST) $(FORMS)" << endl << endl;
+
+ t << "clean:"
+ << varGlue("OBJECTS","\n\t-del ","\n\t-del ","").replace(QRegExp("\\.obj"),".o")
+ << varGlue("SRCMOC" ,"\n\t-del ","\n\t-del ","")
+ << varGlue("OBJMOC" ,"\n\t-del ","\n\t-del ","").replace(QRegExp("\\.obj"),".o")
+ << varGlue("UICDECLS" ,"\n\t-del ","\n\t-del ","")
+ << varGlue("UICIMPLS" ,"\n\t-del ","\n\t-del ","")
+ << "\n\t-del $(TARGET)"
+ << varGlue("QMAKE_CLEAN","\n\t-del ","\n\t-del ","")
+ << varGlue("CLEAN_FILES","\n\t-del ","\n\t-del ","");
+ if ( project->isActiveConfig("activeqt")) {
+ t << ("\n\t-del tmp\\" + targetfilename + ".*");
+ t << "\n\t-del tmp\\dump.*";
+ }
+ if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty())
+ t << "\n\t-del " << var("DLLDESTDIR") << "\\" << project->variables()[ "TARGET" ].first() << project->variables()[ "TARGET_EXT" ].first();
+ if(!project->isEmpty("IMAGES"))
+ t << varGlue("QMAKE_IMAGE_COLLECTION", "\n\t-del ", "\n\t-del ", "");
+
+ // blasted user defined targets
+ QStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"];
+ for(QStringList::Iterator 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->variables()[(*it) + ".depends"];
+ for(QStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) {
+ QString dep = var((*dep_it) + ".target");
+ if(dep.isEmpty())
+ dep = (*dep_it);
+ deps += " " + dep;
+ }
+ t << "\n\n" << targ << ":" << deps << "\n\t"
+ << cmd;
+ }
+
+ t << endl << endl;
+}
+
+
+void
+MingwMakefileGenerator::init()
+{
+ if(init_flag)
+ return;
+ init_flag = TRUE;
+
+ /* this should probably not be here, but I'm using it to wrap the .t files */
+ if(project->first("TEMPLATE") == "app")
+ project->variables()["QMAKE_APP_FLAG"].append("1");
+ else if(project->first("TEMPLATE") == "lib")
+ project->variables()["QMAKE_LIB_FLAG"].append("1");
+ else if(project->first("TEMPLATE") == "subdirs") {
+ MakefileGenerator::init();
+ if(project->variables()["MAKEFILE"].isEmpty())
+ project->variables()["MAKEFILE"].append("Makefile");
+ if(project->variables()["QMAKE"].isEmpty())
+ project->variables()["QMAKE"].append("qmake");
+ return;
+ }
+
+ bool is_qt = (project->first("TARGET") == "qt"QTDLL_POSTFIX || project->first("TARGET") == "qt-mt"QTDLL_POSTFIX);
+ project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"];
+
+ // LIBS defined in Profile comes first for gcc
+ project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"];
+
+ QString targetfilename = project->variables()["TARGET"].first();
+ QStringList &configs = project->variables()["CONFIG"];
+ if (project->isActiveConfig("qt") && project->isActiveConfig("shared"))
+ project->variables()["DEFINES"].append("QT_DLL");
+ if (project->isActiveConfig("qt_dll"))
+ if(configs.findIndex("qt") == -1) configs.append("qt");
+ if ( project->isActiveConfig("qt") ) {
+ if ( project->isActiveConfig( "plugin" ) ) {
+ project->variables()["CONFIG"].append("dll");
+ if(project->isActiveConfig("qt"))
+ project->variables()["DEFINES"].append("QT_PLUGIN");
+ }
+ if ( (project->variables()["DEFINES"].findIndex("QT_NODLL") == -1) &&
+ ((project->variables()["DEFINES"].findIndex("QT_MAKEDLL") != -1 ||
+ project->variables()["DEFINES"].findIndex("QT_DLL") != -1) ||
+ (getenv("QT_DLL") && !getenv("QT_NODLL"))) ) {
+ project->variables()["QMAKE_QT_DLL"].append("1");
+ if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() )
+ project->variables()["CONFIG"].append("dll");
+ }
+ if ( project->isActiveConfig("thread") )
+ project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT");
+ if ( project->isActiveConfig("accessibility" ) )
+ project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_ACCESSIBILITY_SUPPORT");
+ if ( project->isActiveConfig("tablet") )
+ project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT");
+ }
+ if ( project->isActiveConfig("dll") || !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) {
+ project->variables()["CONFIG"].remove("staticlib");
+ project->variables()["QMAKE_APP_OR_DLL"].append("1");
+ } else {
+ project->variables()["CONFIG"].append("staticlib");
+ }
+ if ( project->isActiveConfig("warn_off") ) {
+ project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_OFF"];
+ project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_OFF"];
+ } else if ( project->isActiveConfig("warn_on") ) {
+ project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_ON"];
+ project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_ON"];
+ }
+ if ( project->isActiveConfig("debug") ) {
+ if ( project->isActiveConfig("thread") ) {
+ // use the DLL RT even here
+ if ( project->variables()["DEFINES"].contains("QT_DLL") ) {
+ project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DLLDBG"];
+ project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"];
+ } else {
+ project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DBG"];
+ project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DBG"];
+ }
+ }
+ project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_DEBUG"];
+ project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_DEBUG"];
+ project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_DEBUG"];
+ } else {
+ if ( project->isActiveConfig("thread") ) {
+ if ( project->variables()["DEFINES"].contains("QT_DLL") ) {
+ project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DLL"];
+ project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DLL"];
+ } else {
+ project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT"];
+ project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT"];
+ }
+ }
+ project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RELEASE"];
+ project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RELEASE"];
+ project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_RELEASE"];
+ }
+
+ if ( !project->variables()["QMAKE_INCDIR"].isEmpty())
+ project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR"];
+ if ( project->isActiveConfig("qt") || project->isActiveConfig("opengl") )
+ project->variables()["CONFIG"].append("windows");
+ if ( project->isActiveConfig("qt") ) {
+ project->variables()["CONFIG"].append("moc");
+ project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_QT"];
+ project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QT"];
+ if ( !project->isActiveConfig("debug") )
+ project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_NO_DEBUG");
+ if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) {
+ if ( !project->variables()["QMAKE_QT_DLL"].isEmpty()) {
+ project->variables()["DEFINES"].append("QT_MAKEDLL");
+ project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_QT_DLL"];
+ }
+ } else {
+ if(project->isActiveConfig("thread"))
+ project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"];
+ else
+ project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"];
+ if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) {
+ int hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt");
+ if ( hver == -1 )
+ hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt-mt");
+ if(hver != -1) {
+ QString ver;
+ ver.sprintf("libqt-%s" QTDLL_POSTFIX "%d.a", (project->isActiveConfig("thread") ? "-mt" : ""), hver);
+ QStringList &libs = project->variables()["QMAKE_LIBS"];
+// @@@HGTODO maybe we must change the replace regexp if we understand what's going on
+ for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit)
+ (*libit).replace(QRegExp("qt(-mt)?\\.lib"), ver);
+ }
+ }
+ if ( project->isActiveConfig( "activeqt" ) ) {
+ project->variables().remove("QMAKE_LIBS_QT_ENTRY");
+ project->variables()["QMAKE_LIBS_QT_ENTRY"] = "qaxserver.lib";
+ if ( project->isActiveConfig( "dll" ) )
+ project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"];
+ }
+ if ( !project->isActiveConfig("dll") && !project->isActiveConfig("plugin") ) {
+ project->variables()["QMAKE_LIBS"] +=project->variables()["QMAKE_LIBS_QT_ENTRY"];
+ }
+ }
+ }
+ if ( project->isActiveConfig("opengl") ) {
+ project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"];
+ project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_OPENGL"];
+ }
+ if ( project->isActiveConfig("dll") ) {
+ project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CFLAGS_CONSOLE_DLL"];
+ project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CXXFLAGS_CONSOLE_DLL"];
+ project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_LFLAGS_CONSOLE_DLL"];
+ project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"] = project->variables()["QMAKE_LFLAGS_WINDOWS_DLL"];
+ if ( !project->variables()["QMAKE_LIB_FLAG"].isEmpty()) {
+ project->variables()["TARGET_EXT"].append(
+ QStringList::split('.',project->first("VERSION")).join("") + ".dll");
+ } else {
+ project->variables()["TARGET_EXT"].append(".dll");
+ }
+ } else {
+ project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CFLAGS_CONSOLE"];
+ project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CXXFLAGS_CONSOLE"];
+ project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_LFLAGS_CONSOLE"];
+ project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"] = project->variables()["QMAKE_LFLAGS_WINDOWS"];
+ if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty()) {
+ project->variables()["TARGET_EXT"].append(".exe");
+ } else {
+ project->variables()["TARGET_EXT"].append(".a");
+ project->variables()["QMAKE_LFLAGS"].append("-static");
+ if(project->variables()["TARGET"].first().left(3) != "lib")
+ project->variables()["TARGET"].first().prepend("lib");
+ }
+ }
+ if ( project->isActiveConfig("windows") ) {
+ if ( project->isActiveConfig("console") ) {
+ project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"];
+ project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"];
+ project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"];
+ project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"];
+ } else {
+ project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"];
+ }
+ project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"];
+ } else {
+ project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"];
+ project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"];
+ project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"];
+ project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"];
+ }
+
+ if ( project->isActiveConfig("moc") )
+ setMocAware(TRUE);
+ project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ',
+ "HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH");
+ QStringList &l = project->variables()["QMAKE_FILETAGS"];
+ for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
+ QStringList &gdmf = project->variables()[(*it)];
+ for(QStringList::Iterator inner = gdmf.begin(); inner != gdmf.end(); ++inner)
+ (*inner) = Option::fixPathToTargetOS((*inner), FALSE);
+ }
+
+ if ( project->isActiveConfig("dll") )
+ project->variables()["QMAKE_LFLAGS"].append(QString("-Wl,--out-implib,") + project->first("DESTDIR") + "\\lib"+ project->first("TARGET") + ".a");
+
+ if ( !project->variables()["DEF_FILE"].isEmpty() )
+ project->variables()["QMAKE_LFLAGS"].append(QString("-Wl,--output-def,") + project->first("DEF_FILE"));
+// if(!project->isActiveConfig("incremental"))
+// project->variables()["QMAKE_LFLAGS"].append(QString("/incremental:no"));
+
+#if 0
+ if ( !project->variables()["VERSION"].isEmpty() ) {
+ QString version = project->variables()["VERSION"][0];
+ int firstDot = version.find( "." );
+ QString major = version.left( firstDot );
+ QString minor = version.right( version.length() - firstDot - 1 );
+ minor.replace( ".", "" );
+ project->variables()["QMAKE_LFLAGS"].append( "/VERSION:" + major + "." + minor );
+ }
+#endif
+ if ( !project->variables()["RC_FILE"].isEmpty()) {
+ if ( !project->variables()["RES_FILE"].isEmpty()) {
+ fprintf(stderr, "Both .rc and .res file specified.\n");
+ fprintf(stderr, "Please specify one of them, not both.");
+ exit(666);
+ }
+ project->variables()["RES_FILE"] = project->variables()["RC_FILE"];
+ project->variables()["RES_FILE"].first().replace(".rc",".o");
+ project->variables()["POST_TARGETDEPS"] += project->variables()["RES_FILE"];
+ }
+ if ( !project->variables()["RES_FILE"].isEmpty())
+ project->variables()["QMAKE_LIBS"] += project->variables()["RES_FILE"];
+
+ MakefileGenerator::init();
+ if ( !project->variables()["VERSION"].isEmpty()) {
+ QStringList l = QStringList::split('.', project->first("VERSION"));
+ project->variables()["VER_MAJ"].append(l[0]);
+ project->variables()["VER_MIN"].append(l[1]);
+ }
+ if(project->isActiveConfig("dll")) {
+ project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") +"lib" + project->first("TARGET") + ".a");
+ }
+}
+
+void
+MingwMakefileGenerator::writeSubDirs(QTextStream &t)
+{
+ QString qs ;
+ QTextStream ts (&qs, IO_WriteOnly) ;
+ Win32MakefileGenerator::writeSubDirs( ts ) ;
+ QRegExp rx("(\\n\\tcd [^\\n\\t]+)(\\n\\t.+)\\n\\t@cd ..") ;
+ rx.setMinimal(true);
+ int pos = 0 ;
+ while ( -1 != (pos = rx.search( qs, pos)))
+ {
+ QString qsMatch = rx.cap(2);
+ qsMatch.replace("\n\t"," && \\\n\t");
+ qs.replace(pos+rx.cap(1).length(), rx.cap(2).length(), qsMatch );
+ pos += (rx.cap(1).length()+qsMatch.length());
+ }
+ t << qs ;
+}
diff --git a/qmake/generators/win32/mingw_make.h b/qmake/generators/win32/mingw_make.h
new file mode 100644
index 0000000..c00bf1b
--- a/dev/null
+++ b/qmake/generators/win32/mingw_make.h
@@ -0,0 +1,58 @@
+/****************************************************************************
+** $Id$
+**
+** Definition of ________ class.
+**
+** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
+**
+** This file is part of the network module of the Qt GUI Toolkit.
+**
+** This file may be distributed under the terms of the Q Public License
+** as defined by Trolltech AS of Norway and appearing in the file
+** LICENSE.QPL included in the packaging of this file.
+**
+** This file may be distributed and/or modified under the terms of the
+** GNU General Public License version 2 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.
+**
+** Licensees holding valid Qt Enterprise Edition licenses may use this
+** file in accordance with the Qt Commercial License Agreement provided
+** with the Software.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
+** information about Qt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#ifndef __MINGW_MAKE_H__
+#define __MINGW_MAKE_H__
+
+#include "winmakefile.h"
+
+class MingwMakefileGenerator : public Win32MakefileGenerator
+{
+ bool init_flag;
+ void writeMingwParts(QTextStream &);
+ void writeSubDirs(QTextStream &t) ;
+
+ bool writeMakefile(QTextStream &);
+ void init();
+
+public:
+ MingwMakefileGenerator(QMakeProject *p);
+ ~MingwMakefileGenerator();
+
+};
+
+inline MingwMakefileGenerator::~MingwMakefileGenerator()
+{ }
+
+#endif /* __MINGW_MAKE_H__ */
diff --git a/qmake/generators/win32/msvc_dsp.cpp b/qmake/generators/win32/msvc_dsp.cpp
index 8b08c78..3fa0496 100644
--- a/qmake/generators/win32/msvc_dsp.cpp
+++ b/qmake/generators/win32/msvc_dsp.cpp
@@ -487,48 +487,72 @@ DspMakefileGenerator::writeDspParts(QTextStream &t)
t << "# PROP Exclude_From_Build 1" << endl;
t << "# End Source File" << endl << endl;
}
}
else
t << var(variable);
}
t << line << endl;
}
t << endl;
file.close();
return TRUE;
}
void
DspMakefileGenerator::init()
{
if(init_flag)
return;
QStringList::Iterator it;
init_flag = TRUE;
+ const bool thread = project->isActiveConfig("thread");
+
+ if ( project->isActiveConfig("stl") ) {
+ project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_ON"];
+ project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_ON"];
+ } else {
+ project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_OFF"];
+ project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_OFF"];
+ }
+ if ( project->isActiveConfig("exceptions") ) {
+ project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_ON"];
+ project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_ON"];
+ } else {
+ project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_OFF"];
+ project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_OFF"];
+ }
+ if ( project->isActiveConfig("rtti") ) {
+ project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_ON"];
+ project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_ON"];
+ } else {
+ project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_OFF"];
+ project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_OFF"];
+ }
+
/* this should probably not be here, but I'm using it to wrap the .t files */
if(project->first("TEMPLATE") == "vcapp" )
project->variables()["QMAKE_APP_FLAG"].append("1");
else if(project->first("TEMPLATE") == "vclib")
project->variables()["QMAKE_LIB_FLAG"].append("1");
if ( project->variables()["QMAKESPEC"].isEmpty() )
project->variables()["QMAKESPEC"].append( getenv("QMAKESPEC") );
bool is_qt = (project->first("TARGET") == "qt"QTDLL_POSTFIX || project->first("TARGET") == "qt-mt"QTDLL_POSTFIX);
project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"];
QStringList &configs = project->variables()["CONFIG"];
if (project->isActiveConfig("shared"))
project->variables()["DEFINES"].append("QT_DLL");
if (project->isActiveConfig("qt_dll"))
if(configs.findIndex("qt") == -1) configs.append("qt");
if ( project->isActiveConfig("qt") ) {
if ( project->isActiveConfig( "plugin" ) ) {
project->variables()["CONFIG"].append("dll");
project->variables()["DEFINES"].append("QT_PLUGIN");
}
if ( (project->variables()["DEFINES"].findIndex("QT_NODLL") == -1) &&
((project->variables()["DEFINES"].findIndex("QT_MAKEDLL") != -1 ||
project->variables()["DEFINES"].findIndex("QT_DLL") != -1) ||
@@ -547,103 +571,103 @@ DspMakefileGenerator::init()
if ( project->isActiveConfig("qt") || project->isActiveConfig("opengl") ) {
project->variables()["CONFIG"].append("windows");
}
if ( !project->variables()["VERSION"].isEmpty() ) {
QString version = project->variables()["VERSION"][0];
int firstDot = version.find( "." );
QString major = version.left( firstDot );
QString minor = version.right( version.length() - firstDot - 1 );
minor.replace( ".", "" );
project->variables()["MSVCDSP_VERSION"].append( "/VERSION:" + major + "." + minor );
}
if ( project->isActiveConfig("qt") ) {
project->variables()["CONFIG"].append("moc");
project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_QT"];
project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QT"];
if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) {
if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) {
project->variables()["DEFINES"].append("QT_MAKEDLL");
project->variables()["QMAKE_LFLAGS"].append("/base:\"0x39D00000\"");
}
} else {
- if(project->isActiveConfig("thread"))
+ if( thread )
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"];
else
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"];
if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) {
int hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt");
if ( hver == -1 )
hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt-mt");
if(hver != -1) {
QString ver;
- ver.sprintf("qt%s" QTDLL_POSTFIX "%d.lib", (project->isActiveConfig("thread") ? "-mt" : ""), hver);
+ ver.sprintf("qt%s" QTDLL_POSTFIX "%d.lib", (thread ? "-mt" : ""), hver);
QStringList &libs = project->variables()["QMAKE_LIBS"];
for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit)
(*libit).replace(QRegExp("qt(-mt)?\\.lib"), ver);
}
}
if ( project->isActiveConfig( "activeqt" ) ) {
project->variables().remove("QMAKE_LIBS_QT_ENTRY");
project->variables()["QMAKE_LIBS_QT_ENTRY"] = "qaxserver.lib";
if ( project->isActiveConfig( "dll" ) )
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"];
}
if ( !project->isActiveConfig("dll") && !project->isActiveConfig("plugin") ) {
project->variables()["QMAKE_LIBS"] +=project->variables()["QMAKE_LIBS_QT_ENTRY"];
}
}
}
if ( project->isActiveConfig("debug") ) {
if ( !project->first("OBJECTS_DIR").isEmpty() )
project->variables()["MSVCDSP_OBJECTSDIRDEB"] = project->first("OBJECTS_DIR");
else
project->variables()["MSVCDSP_OBJECTSDIRDEB"] = "Debug";
project->variables()["MSVCDSP_OBJECTSDIRREL"] = "Release";
if ( !project->first("DESTDIR").isEmpty() )
project->variables()["MSVCDSP_TARGETDIRDEB"] = project->first("DESTDIR");
else
project->variables()["MSVCDSP_TARGETDIRDEB"] = "Debug";
project->variables()["MSVCDSP_TARGETDIRREL"] = "Release";
} else {
if ( !project->first("OBJECTS_DIR").isEmpty() )
project->variables()["MSVCDSP_OBJECTSDIRREL"] = project->first("OBJECTS_DIR");
project->variables()["MSVCDSP_OBJECTSDIRDEB"] = "Debug";
if ( !project->first("DESTDIR").isEmpty() )
project->variables()["MSVCDSP_TARGETDIRREL"] = project->first("DESTDIR");
else
project->variables()["MSVCDSP_TARGETDIRREL"] = "Release";
project->variables()["MSVCDSP_TARGETDIRDEB"] = "Debug";
}
if ( project->isActiveConfig("opengl") ) {
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"];
project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_OPENGL"];
}
- if ( project->isActiveConfig("thread") ) {
+ if ( thread ) {
if(project->isActiveConfig("qt"))
project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT" );
if ( project->isActiveConfig("dll") || project->first("TARGET") == "qtmain"
|| !project->variables()["QMAKE_QT_DLL"].isEmpty() ) {
project->variables()["MSVCDSP_MTDEFD"] += project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"];
project->variables()["MSVCDSP_MTDEF"] += project->variables()["QMAKE_CXXFLAGS_MT_DLL"];
} else {
// YES we want to use the DLL even in a static build
project->variables()["MSVCDSP_MTDEFD"] += project->variables()["QMAKE_CXXFLAGS_MT_DBG"];
project->variables()["MSVCDSP_MTDEF"] += project->variables()["QMAKE_CXXFLAGS_MT"];
}
if ( !project->variables()["DEFINES"].contains("QT_DLL") && is_qt
&& project->first("TARGET") != "qtmain" )
project->variables()["QMAKE_LFLAGS"].append("/NODEFAULTLIB:\"libc\"");
}
if(project->isActiveConfig("qt")) {
if ( project->isActiveConfig("accessibility" ) )
project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_ACCESSIBILITY_SUPPORT");
if ( project->isActiveConfig("tablet") )
project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT");
}
if ( project->isActiveConfig("dll") ) {
if ( !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) {
@@ -711,239 +735,258 @@ DspMakefileGenerator::init()
project->variables()["MSVCDSP_SUBSYSTEM"].append("console");
} else {
project->variables()["MSVCDSP_CONSOLE"].clear();
project->variables()["MSVCDSP_WINCONDEF"].append("_WINDOWS");
project->variables()["MSVCDSP_DSPTYPE"].append("0x0101");
project->variables()["MSVCDSP_SUBSYSTEM"].append("windows");
}
} else {
if ( project->isActiveConfig("dll") ) {
project->variables()["MSVCDSP_TEMPLATE"].append("win32dll" + project->first( "DSP_EXTENSION" ) );
} else {
project->variables()["MSVCDSP_TEMPLATE"].append("win32lib" + project->first( "DSP_EXTENSION" ) );
}
}
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"];
project->variables()["MSVCDSP_LFLAGS" ] += project->variables()["QMAKE_LFLAGS"];
if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() )
project->variables()["MSVCDSP_LFLAGS" ].append(varGlue("QMAKE_LIBDIR","/LIBPATH:\"","\" /LIBPATH:\"","\""));
project->variables()["MSVCDSP_CXXFLAGS" ] += project->variables()["QMAKE_CXXFLAGS"];
project->variables()["MSVCDSP_DEFINES"].append(varGlue("DEFINES","/D ","" " /D ",""));
project->variables()["MSVCDSP_DEFINES"].append(varGlue("PRL_EXPORT_DEFINES","/D ","" " /D ",""));
+ processPrlFiles();
QStringList &libs = project->variables()["QMAKE_LIBS"];
for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) {
QString lib = (*libit);
lib.replace(QRegExp("\""), "");
project->variables()["MSVCDSP_LIBS"].append(" \"" + lib + "\"");
}
QStringList &incs = project->variables()["INCLUDEPATH"];
for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) {
QString inc = (*incit);
inc.replace("\"", "");
project->variables()["MSVCDSP_INCPATH"].append("/I \"" + inc + "\"");
}
project->variables()["MSVCDSP_INCPATH"].append("/I \"" + specdir() + "\"");
if ( project->isActiveConfig("qt") ) {
project->variables()["MSVCDSP_RELDEFS"].append("/D \"QT_NO_DEBUG\"");
} else {
project->variables()["MSVCDSP_RELDEFS"].clear();
}
QString dest;
+ QString postLinkStep;
+ QString copyDllStep;
+ QString activeQtStepPreCopyDll;
+ QString activeQtStepPostCopyDll;
+ QString activeQtStepPreCopyDllDebug;
+ QString activeQtStepPostCopyDllDebug;
+ QString activeQtStepPreCopyDllRelease;
+ QString activeQtStepPostCopyDllRelease;
+
+ if ( !project->variables()["QMAKE_POST_LINK"].isEmpty() )
+ postLinkStep += var("QMAKE_POST_LINK");
+
if ( !project->variables()["DESTDIR"].isEmpty() ) {
project->variables()["TARGET"].first().prepend(project->first("DESTDIR"));
Option::fixPathToTargetOS(project->first("TARGET"));
dest = project->first("TARGET");
if ( project->first("TARGET").startsWith("$(QTDIR)") )
dest.replace( "$(QTDIR)", getenv("QTDIR") );
project->variables()["MSVCDSP_TARGET"].append(
QString("/out:\"") + dest + "\"");
if ( project->isActiveConfig("dll") ) {
QString imp = dest;
imp.replace(".dll", ".lib");
project->variables()["MSVCDSP_TARGET"].append(QString(" /implib:\"") + imp + "\"");
}
}
if ( project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty() ) {
QStringList dlldirs = project->variables()["DLLDESTDIR"];
- QString copydll = "# Begin Special Build Tool\n"
- "TargetPath=" + dest + "\n"
- "SOURCE=$(InputPath)\n"
- "PostBuild_Desc=Copy DLL to " + project->first("DLLDESTDIR") + "\n"
- "PostBuild_Cmds=";
-
+ if ( dlldirs.count() )
+ copyDllStep += "\t";
for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) {
- copydll += "copy \"" + dest + "\" \"" + *dlldir + "\"\t";
+ copyDllStep += "copy \"$(TargetPath)\" \"" + *dlldir + "\"\t";
}
-
- copydll += "\n# End Special Build Tool";
- project->variables()["MSVCDSP_COPY_DLL_REL"].append( copydll );
- project->variables()["MSVCDSP_COPY_DLL_DBG"].append( copydll );
}
+
if ( project->isActiveConfig("activeqt") ) {
QString idl = project->variables()["QMAKE_IDL"].first();
QString idc = project->variables()["QMAKE_IDC"].first();
QString version = project->variables()["VERSION"].first();
if ( version.isEmpty() )
version = "1.0";
project->variables()["MSVCDSP_IDLSOURCES"].append( "tmp\\" + targetfilename + ".idl" );
project->variables()["MSVCDSP_IDLSOURCES"].append( "tmp\\" + targetfilename + ".tlb" );
project->variables()["MSVCDSP_IDLSOURCES"].append( "tmp\\" + targetfilename + ".midl" );
if ( project->isActiveConfig( "dll" ) ) {
- QString regcmd = "# Begin Special Build Tool\n"
- "TargetPath=" + targetfilename + "\n"
- "SOURCE=$(InputPath)\n"
- "PostBuild_Desc=Finalizing ActiveQt server...\n"
- "PostBuild_Cmds=" +
- idc + " %1 -idl tmp\\" + targetfilename + ".idl -version " + version +
+ activeQtStepPreCopyDll +=
+ "\t" + idc + " %1 -idl tmp\\" + targetfilename + ".idl -version " + version +
"\t" + idl + " tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl"
- "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb"
- "\t" + idc + " %1 /regserver\n"
- "# End Special Build Tool";
+ "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb";
+ activeQtStepPostCopyDll +=
+ "\t" + idc + " %1 /regserver\n";
- QString executable = project->variables()["MSVCDSP_TARGETDIRREL"].first() + "\\" + project->variables()["TARGET"].first();
- project->variables()["MSVCDSP_COPY_DLL_REL"].append( regcmd.arg(executable).arg(executable).arg(executable) );
+ QString executable = project->variables()["MSVCDSP_TARGETDIRREL"].first() + "\\" + targetfilename + ".dll";
+ activeQtStepPreCopyDllRelease = activeQtStepPreCopyDll.arg(executable).arg(executable);
+ activeQtStepPostCopyDllRelease = activeQtStepPostCopyDll.arg(executable);
- executable = project->variables()["MSVCDSP_TARGETDIRDEB"].first() + "\\" + project->variables()["TARGET"].first();
- project->variables()["MSVCDSP_COPY_DLL_DBG"].append( regcmd.arg(executable).arg(executable).arg(executable) );
+ executable = project->variables()["MSVCDSP_TARGETDIRDEB"].first() + "\\" + targetfilename + ".dll";
+ activeQtStepPreCopyDllDebug = activeQtStepPreCopyDll.arg(executable).arg(executable);
+ activeQtStepPostCopyDllDebug = activeQtStepPostCopyDll.arg(executable);
} else {
- QString regcmd = "# Begin Special Build Tool\n"
- "TargetPath=" + targetfilename + "\n"
- "SOURCE=$(InputPath)\n"
- "PostBuild_Desc=Finalizing ActiveQt server...\n"
- "PostBuild_Cmds="
- "%1 -dumpidl tmp\\" + targetfilename + ".idl -version " + version +
+ activeQtStepPreCopyDll +=
+ "\t%1 -dumpidl tmp\\" + targetfilename + ".idl -version " + version +
"\t" + idl + " tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl"
- "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb"
- "\t%1 -regserver\n"
- "# End Special Build Tool";
-
- QString executable = project->variables()["MSVCDSP_TARGETDIRREL"].first() + "\\" + project->variables()["TARGET"].first();
- project->variables()["MSVCDSP_REGSVR_REL"].append( regcmd.arg(executable).arg(executable).arg(executable) );
-
- executable = project->variables()["MSVCDSP_TARGETDIRDEB"].first() + "\\" + project->variables()["TARGET"].first();
- project->variables()["MSVCDSP_REGSVR_DBG"].append( regcmd.arg(executable).arg(executable).arg(executable) );
+ "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb";
+ activeQtStepPostCopyDll +=
+ "\t%1 -regserver\n";
+ QString executable = project->variables()["MSVCDSP_TARGETDIRREL"].first() + "\\" + targetfilename + ".exe";
+ activeQtStepPreCopyDllRelease = activeQtStepPreCopyDll.arg(executable).arg(executable);
+ activeQtStepPostCopyDllRelease = activeQtStepPostCopyDll.arg(executable);
+
+ executable = project->variables()["MSVCDSP_TARGETDIRDEB"].first() + "\\" + targetfilename + ".exe";
+ activeQtStepPreCopyDllDebug = activeQtStepPreCopyDll.arg(executable).arg(executable);
+ activeQtStepPostCopyDllDebug = activeQtStepPostCopyDll.arg(executable);
}
}
+
+
+ if ( !postLinkStep.isEmpty() || !copyDllStep.isEmpty() || !activeQtStepPreCopyDllDebug.isEmpty() || !activeQtStepPreCopyDllRelease.isEmpty() ) {
+ project->variables()["MSVCDSP_POST_LINK_DBG"].append(
+ "# Begin Special Build Tool\n"
+ "SOURCE=$(InputPath)\n"
+ "PostBuild_Desc=Post Build Step\n"
+ "PostBuild_Cmds=" + postLinkStep + activeQtStepPreCopyDllDebug + copyDllStep + activeQtStepPostCopyDllDebug + "\n"
+ "# End Special Build Tool\n" );
+ project->variables()["MSVCDSP_POST_LINK_REL"].append(
+ "# Begin Special Build Tool\n"
+ "SOURCE=$(InputPath)\n"
+ "PostBuild_Desc=Post Build Step\n"
+ "PostBuild_Cmds=" + postLinkStep + activeQtStepPreCopyDllRelease + copyDllStep + activeQtStepPostCopyDllRelease + "\n"
+ "# End Special Build Tool\n" );
+ }
+
if ( !project->variables()["SOURCES"].isEmpty() || !project->variables()["RC_FILE"].isEmpty() ) {
project->variables()["SOURCES"] += project->variables()["RC_FILE"];
}
QStringList &list = project->variables()["FORMS"];
for( it = list.begin(); it != list.end(); ++it ) {
if ( QFile::exists( *it + ".h" ) )
project->variables()["SOURCES"].append( *it + ".h" );
}
project->variables()["QMAKE_INTERNAL_PRL_LIBS"] << "MSVCDSP_LIBS";
}
QString
-DspMakefileGenerator::findTemplate(QString file)
+DspMakefileGenerator::findTemplate(const QString &file)
{
QString ret;
if(!QFile::exists((ret = file)) &&
!QFile::exists((ret = QString(Option::mkfile::qmakespec + "/" + file))) &&
!QFile::exists((ret = QString(getenv("QTDIR")) + "/mkspecs/win32-msvc/" + file)) &&
!QFile::exists((ret = (QString(getenv("HOME")) + "/.tmake/" + file))))
return "";
return ret;
}
void
DspMakefileGenerator::processPrlVariable(const QString &var, const QStringList &l)
{
if(var == "QMAKE_PRL_DEFINES") {
QStringList &out = project->variables()["MSVCDSP_DEFINES"];
for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
if(out.findIndex((*it)) == -1)
out.append((" /D \"" + *it + "\""));
}
} else {
MakefileGenerator::processPrlVariable(var, l);
}
}
-int
+void
DspMakefileGenerator::beginGroupForFile(QString file, QTextStream &t,
- QString filter)
+ const QString& filter)
{
if(project->isActiveConfig("flat"))
- return 0;
+ return;
fileFixify(file, QDir::currentDirPath(), QDir::currentDirPath(), TRUE);
file = file.section(Option::dir_sep, 0, -2);
if(file.right(Option::dir_sep.length()) != Option::dir_sep)
file += Option::dir_sep;
if(file == currentGroup)
- return 0;
+ return;
if(file.isEmpty() || !QDir::isRelativePath(file)) {
endGroups(t);
- return 0;
+ return;
}
if(file.startsWith(currentGroup))
file = file.mid(currentGroup.length());
- else
- endGroups(t);
- int lvl = file.contains(Option::dir_sep), old_lvl = currentGroup.contains(Option::dir_sep);
- if(lvl > old_lvl) {
- QStringList dirs = QStringList::split(Option::dir_sep, file);
- for(QStringList::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) {
- t << "# Begin Group \"" << (*dir_it) << "\"\n"
- << "# Prop Default_Filter \"" << filter << "\"\n";
- }
- } else {
- for(int x = old_lvl - lvl; x; x--)
+ int dirSep = currentGroup.findRev( Option::dir_sep );
+ while( !file.startsWith( currentGroup ) && dirSep != -1 ) {
+ currentGroup.truncate( dirSep );
+ dirSep = currentGroup.findRev( Option::dir_sep );
+ if ( !file.startsWith( currentGroup ) && dirSep != -1 )
t << "\n# End Group\n";
}
+ if ( !file.startsWith( currentGroup ) ) {
+ t << "\n# End Group\n";
+ currentGroup = "";
+ }
+ QStringList dirs = QStringList::split(Option::dir_sep, file.right( file.length() - currentGroup.length() ) );
+ for(QStringList::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) {
+ t << "# Begin Group \"" << (*dir_it) << "\"\n"
+ << "# Prop Default_Filter \"" << filter << "\"\n";
+ }
currentGroup = file;
- return lvl - old_lvl;
}
-int
+void
DspMakefileGenerator::endGroups(QTextStream &t)
{
if(project->isActiveConfig("flat"))
- return 0;
+ return;
else if(currentGroup.isEmpty())
- return 0;
+ return;
QStringList dirs = QStringList::split(Option::dir_sep, currentGroup);
for(QStringList::Iterator dir_it = dirs.end(); dir_it != dirs.begin(); --dir_it) {
t << "\n# End Group\n";
}
currentGroup = "";
- return dirs.count();
}
bool
DspMakefileGenerator::openOutput(QFile &file) const
{
QString outdir;
if(!file.name().isEmpty()) {
QFileInfo fi(file);
if(fi.isDir())
outdir = file.name() + QDir::separator();
}
if(!outdir.isEmpty() || file.name().isEmpty())
file.setName(outdir + project->first("TARGET") + project->first("DSP_EXTENSION"));
if(QDir::isRelativePath(file.name())) {
QString ofile;
ofile = file.name();
int slashfind = ofile.findRev('\\');
if (slashfind == -1) {
ofile = ofile.replace(QRegExp("-"), "_");
} else {
int hypenfind = ofile.find('-', slashfind);
while (hypenfind != -1 && slashfind < hypenfind) {
ofile = ofile.replace(hypenfind, 1, "_");
hypenfind = ofile.find('-', hypenfind + 1);
diff --git a/qmake/generators/win32/msvc_dsp.h b/qmake/generators/win32/msvc_dsp.h
index a7fc3e7..3a7d18e 100644
--- a/qmake/generators/win32/msvc_dsp.h
+++ b/qmake/generators/win32/msvc_dsp.h
@@ -1,73 +1,73 @@
/****************************************************************************
** $Id$
**
** Definition of ________ class.
**
** Created : 970521
**
-** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
+** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
**
** This file is part of the network module of the Qt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.QPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid Qt Enterprise Edition licenses may use this
** file in accordance with the Qt Commercial License Agreement provided
** with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for QPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
-#ifndef __DSPMAKE_H__
-#define __DSPMAKE_H__
+#ifndef __MSVC_DSP_H__
+#define __MSVC_DSP_H__
#include "winmakefile.h"
#include <qvaluestack.h>
class DspMakefileGenerator : public Win32MakefileGenerator
{
QString currentGroup;
- int beginGroupForFile(QString file, QTextStream &, const QString filter="");
- int endGroups(QTextStream &);
+ void beginGroupForFile(QString file, QTextStream &, const QString& filter="");
+ void endGroups(QTextStream &);
bool init_flag;
bool writeDspParts(QTextStream &);
bool writeMakefile(QTextStream &);
- QString findTemplate(QString file);
+ QString findTemplate(const QString &file);
void init();
public:
DspMakefileGenerator(QMakeProject *p);
~DspMakefileGenerator();
bool openOutput(QFile &file) const;
protected:
virtual void processPrlVariable(const QString &, const QStringList &);
virtual bool findLibraries();
};
inline DspMakefileGenerator::~DspMakefileGenerator()
{ }
inline bool DspMakefileGenerator::findLibraries()
{ return Win32MakefileGenerator::findLibraries("MSVCDSP_LIBS"); }
-#endif /* __DSPMAKE_H__ */
+#endif /* __MSVC_DSP_H__ */
diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp
index 9cc9a69..ecef34d 100644
--- a/qmake/generators/win32/msvc_nmake.cpp
+++ b/qmake/generators/win32/msvc_nmake.cpp
@@ -1,64 +1,65 @@
/****************************************************************************
** $Id$
**
** Definition of ________ class.
**
** Created : 970521
**
-** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
+** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
**
** This file is part of the network module of the Qt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.QPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid Qt Enterprise Edition licenses may use this
** file in accordance with the Qt Commercial License Agreement provided
** with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for QPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "msvc_nmake.h"
#include "option.h"
#include <qregexp.h>
+#include <qdict.h>
#include <qdir.h>
#include <stdlib.h>
#include <time.h>
NmakeMakefileGenerator::NmakeMakefileGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE)
{
}
bool
NmakeMakefileGenerator::writeMakefile(QTextStream &t)
{
writeHeader(t);
if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) {
t << "all clean:" << "\n\t"
<< "@echo \"Some of the required modules ("
<< var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"" << "\n\t"
<< "@echo \"Skipped.\"" << endl << endl;
writeMakeQmake(t);
return TRUE;
}
if(project->first("TEMPLATE") == "app" ||
@@ -114,159 +115,209 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
lib.replace(QRegExp("\""), "");
t << " \"" << lib << "\"";
}
t << endl;
}
else {
t << "LIB = " << var("QMAKE_LIB") << endl;
}
t << "MOC = " << (project->isEmpty("QMAKE_MOC") ? QString("moc") :
Option::fixPathToTargetOS(var("QMAKE_MOC"), FALSE)) << endl;
t << "UIC = " << (project->isEmpty("QMAKE_UIC") ? QString("uic") :
Option::fixPathToTargetOS(var("QMAKE_UIC"), FALSE)) << endl;
t << "QMAKE = " << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") :
Option::fixPathToTargetOS(var("QMAKE_QMAKE"), FALSE)) << endl;
t << "IDC = " << (project->isEmpty("QMAKE_IDC") ? QString("idc") :
Option::fixPathToTargetOS(var("QMAKE_IDC"), FALSE)) << endl;
t << "IDL = " << (project->isEmpty("QMAKE_IDL") ? QString("midl") :
Option::fixPathToTargetOS(var("QMAKE_IDL"), FALSE)) << endl;
t << "ZIP = " << var("QMAKE_ZIP") << endl;
t << "COPY_FILE = " << var("QMAKE_COPY") << endl;
t << "COPY_DIR = " << var("QMAKE_COPY") << endl;
t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl;
t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl;
t << "MOVE = " << var("QMAKE_MOVE") << endl;
+ t << "CHK_DIR_EXISTS = " << var("QMAKE_CHK_DIR_EXISTS") << endl;
+ t << "MKDIR = " << var("QMAKE_MKDIR") << endl;
t << endl;
t << "####### Files" << endl << endl;
t << "HEADERS = " << varList("HEADERS") << endl;
t << "SOURCES = " << varList("SOURCES") << endl;
t << "OBJECTS = " << varList("OBJECTS") << endl;
t << "FORMS = " << varList("FORMS") << endl;
t << "UICDECLS = " << varList("UICDECLS") << endl;
t << "UICIMPLS = " << varList("UICIMPLS") << endl;
t << "SRCMOC = " << varList("SRCMOC") << endl;
t << "OBJMOC = " << varList("OBJMOC") << endl;
t << "DIST = " << varList("DISTFILES") << endl;
t << "TARGET = ";
if( !project->variables()[ "DESTDIR" ].isEmpty() )
t << varGlue("TARGET",project->first("DESTDIR"),"",project->first("TARGET_EXT"));
else
t << project->variables()[ "TARGET" ].first() << project->variables()[ "TARGET_EXT" ].first();
t << endl;
t << endl;
t << "####### Implicit rules" << endl << endl;
- t << ".SUFFIXES: .cpp .cxx .cc .c" << endl << endl;
- t << ".cpp.obj:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl;
- t << ".cxx.obj:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl;
- t << ".cc.obj:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl;
- t << ".c.obj:\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl;
+ t << ".SUFFIXES: .c";
+ QStringList::Iterator cppit;
+ for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit)
+ t << " " << (*cppit);
+ t << endl << endl;
+ if(!project->isActiveConfig("no_batch")) {
+ // Batchmode doesn't use the non implicit rules QMAKE_RUN_CXX & QMAKE_RUN_CC
+ project->variables().remove("QMAKE_RUN_CXX");
+ project->variables().remove("QMAKE_RUN_CC");
+
+ QDict<void> source_directories;
+ source_directories.insert(".", (void*)1);
+ if(!project->isEmpty("MOC_DIR"))
+ source_directories.insert(project->first("MOC_DIR"), (void*)1);
+ if(!project->isEmpty("UI_SOURCES_DIR"))
+ source_directories.insert(project->first("UI_SOURCES_DIR"), (void*)1);
+ else if(!project->isEmpty("UI_DIR"))
+ source_directories.insert(project->first("UI_DIR"), (void*)1);
+ QString srcs[] = { QString("SOURCES"), QString("UICIMPLS"), QString("SRCMOC"), QString::null };
+ for(int x = 0; !srcs[x].isNull(); x++) {
+ QStringList &l = project->variables()[srcs[x]];
+ for(QStringList::Iterator sit = l.begin(); sit != l.end(); ++sit) {
+ QString sep = "\\";
+ if((*sit).find(sep) == -1)
+ sep = "/";
+ QString dir = (*sit).section(sep, 0, -2);
+ if(!dir.isEmpty() && !source_directories[dir])
+ source_directories.insert(dir, (void*)1);
+ }
+ }
+
+ for(QDictIterator<void> it(source_directories); it.current(); ++it) {
+ if(it.currentKey().isEmpty())
+ continue;
+ for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit)
+ t << "{" << it.currentKey() << "}" << (*cppit) << "{" << var("OBJECTS_DIR") << "}" << Option::obj_ext << "::\n\t"
+ << var("QMAKE_RUN_CXX_IMP_BATCH").replace( QRegExp( "\\$@" ), var("OBJECTS_DIR") ) << endl << "\t$<" << endl << "<<" << endl << endl;
+ t << "{" << it.currentKey() << "}" << ".c{" << var("OBJECTS_DIR") << "}" << Option::obj_ext << "::\n\t"
+ << var("QMAKE_RUN_CC_IMP_BATCH").replace( QRegExp( "\\$@" ), var("OBJECTS_DIR") ) << endl << "\t$<" << endl << "<<" << endl << endl;
+ }
+ } else {
+ for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit)
+ t << (*cppit) << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl;
+ t << ".c" << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl;
+ }
t << "####### Build rules" << endl << endl;
t << "all: " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" << endl << endl;
- t << "$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) " << var("TARGETDEPS");
+ t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) "
+ << var("POST_TARGETDEPS");
if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) {
t << "\n\t" << "$(LINK) $(LFLAGS) /OUT:$(TARGET) @<< " << "\n\t "
<< "$(OBJECTS) $(OBJMOC) $(LIBS)";
} else {
t << "\n\t" << "$(LIB) /OUT:$(TARGET) @<<" << "\n\t "
<< "$(OBJECTS) $(OBJMOC)";
}
t << endl << "<<" << endl;
+ if ( !project->variables()["QMAKE_POST_LINK"].isEmpty() )
+ t << "\t" << var( "QMAKE_POST_LINK" ) << endl;
if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty()) {
QStringList dlldirs = project->variables()["DLLDESTDIR"];
for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) {
t << "\n\t" << "-copy $(TARGET) " << *dlldir;
}
}
QString targetfilename = project->variables()["TARGET"].first();
if(project->isActiveConfig("activeqt")) {
QString version = project->variables()["VERSION"].first();
if ( version.isEmpty() )
version = "1.0";
if ( project->isActiveConfig("dll")) {
t << "\n\t" << ("-$(IDC) $(TARGET) /idl tmp\\" + targetfilename + ".idl -version " + version);
t << "\n\t" << ("-$(IDL) tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl");
t << "\n\t" << ("-$(IDC) $(TARGET) /tlb tmp\\" + targetfilename + ".tlb");
t << "\n\t" << ("-$(IDC) $(TARGET) /regserver" );
} else {
t << "\n\t" << ("-$(TARGET) -dumpidl tmp\\" + targetfilename + ".idl -version " + version);
t << "\n\t" << ("-$(IDL) tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl");
t << "\n\t" << ("-$(IDC) $(TARGET) /tlb tmp\\" + targetfilename + ".tlb");
t << "\n\t" << "-$(TARGET) -regserver";
}
}
t << endl << endl;
if(!project->variables()["RC_FILE"].isEmpty()) {
t << var("RES_FILE") << ": " << var("RC_FILE") << "\n\t"
<< var("QMAKE_RC") << " " << var("RC_FILE") << endl << endl;
}
t << "mocables: $(SRCMOC)" << endl << endl;
writeMakeQmake(t);
t << "dist:" << "\n\t"
<< "$(ZIP) " << var("PROJECT") << ".zip "
<< var("PROJECT") << ".pro $(SOURCES) $(HEADERS) $(DIST) $(FORMS)" << endl << endl;
t << "clean:"
<< varGlue("OBJECTS","\n\t-del ","\n\t-del ","")
<< varGlue("SRCMOC" ,"\n\t-del ","\n\t-del ","")
<< varGlue("OBJMOC" ,"\n\t-del ","\n\t-del ","")
<< varGlue("UICDECLS" ,"\n\t-del ","\n\t-del ","")
<< varGlue("UICIMPLS" ,"\n\t-del ","\n\t-del ","")
<< varGlue("QMAKE_CLEAN","\n\t-del ","\n\t-del ","")
<< varGlue("CLEAN_FILES","\n\t-del ","\n\t-del ","");
+
if ( project->isActiveConfig("activeqt")) {
t << ("\n\t-del tmp\\" + targetfilename + ".*");
t << "\n\t-del tmp\\dump.*";
}
if(!project->isEmpty("IMAGES"))
t << varGlue("QMAKE_IMAGE_COLLECTION", "\n\t-del ", "\n\t-del ", "");
// blasted user defined targets
QStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"];
for(QStringList::Iterator 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->variables()[(*it) + ".depends"];
for(QStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) {
QString dep = var((*dep_it) + ".target");
if(dep.isEmpty())
dep = (*dep_it);
deps += " " + dep;
}
t << "\n\n" << targ << ":" << deps << "\n\t"
<< cmd;
}
t << endl << endl;
+
+ t << "distclean: clean"
+ << "\n\t-del $(TARGET)"
+ << endl << endl;
}
void
NmakeMakefileGenerator::init()
{
if(init_flag)
return;
init_flag = TRUE;
/* this should probably not be here, but I'm using it to wrap the .t files */
if(project->first("TEMPLATE") == "app")
project->variables()["QMAKE_APP_FLAG"].append("1");
else if(project->first("TEMPLATE") == "lib")
project->variables()["QMAKE_LIB_FLAG"].append("1");
else if(project->first("TEMPLATE") == "subdirs") {
MakefileGenerator::init();
if(project->variables()["MAKEFILE"].isEmpty())
project->variables()["MAKEFILE"].append("Makefile");
if(project->variables()["QMAKE"].isEmpty())
project->variables()["QMAKE"].append("qmake");
return;
}
@@ -410,79 +461,102 @@ NmakeMakefileGenerator::init()
project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_LFLAGS_CONSOLE"];
project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"] = project->variables()["QMAKE_LFLAGS_WINDOWS"];
if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty()) {
project->variables()["TARGET_EXT"].append(".exe");
} else {
project->variables()["TARGET_EXT"].append(".lib");
}
}
if ( project->isActiveConfig("windows") ) {
if ( project->isActiveConfig("console") ) {
project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"];
project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"];
project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"];
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"];
} else {
project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"];
}
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"];
} else {
project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"];
project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"];
project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"];
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"];
}
+ if ( project->isActiveConfig("stl") ) {
+ project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_ON"];
+ project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_ON"];
+ } else {
+ project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_OFF"];
+ project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_OFF"];
+ }
+ if ( project->isActiveConfig("exceptions") ) {
+ project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_ON"];
+ project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_ON"];
+ } else {
+ project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_OFF"];
+ project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_OFF"];
+ }
+ if ( project->isActiveConfig("rtti") ) {
+ project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_ON"];
+ project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_ON"];
+ } else {
+ project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_OFF"];
+ project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_OFF"];
+ }
+
if ( project->isActiveConfig("moc") )
setMocAware(TRUE);
project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"];
project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ',
"HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH");
QStringList &l = project->variables()["QMAKE_FILETAGS"];
for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
QStringList &gdmf = project->variables()[(*it)];
for(QStringList::Iterator inner = gdmf.begin(); inner != gdmf.end(); ++inner)
(*inner) = Option::fixPathToTargetOS((*inner), FALSE);
}
if ( !project->variables()["DEF_FILE"].isEmpty() )
project->variables()["QMAKE_LFLAGS"].append(QString("/DEF:") + project->first("DEF_FILE"));
if(!project->isActiveConfig("incremental"))
project->variables()["QMAKE_LFLAGS"].append(QString("/incremental:no"));
if ( !project->variables()["VERSION"].isEmpty() ) {
QString version = project->variables()["VERSION"][0];
int firstDot = version.find( "." );
QString major = version.left( firstDot );
QString minor = version.right( version.length() - firstDot - 1 );
minor.replace( ".", "" );
project->variables()["QMAKE_LFLAGS"].append( "/VERSION:" + major + "." + minor );
}
if ( !project->variables()["RC_FILE"].isEmpty()) {
if ( !project->variables()["RES_FILE"].isEmpty()) {
fprintf(stderr, "Both .rc and .res file specified.\n");
fprintf(stderr, "Please specify one of them, not both.");
exit(666);
}
project->variables()["RES_FILE"] = project->variables()["RC_FILE"];
project->variables()["RES_FILE"].first().replace(".rc",".res");
- project->variables()["TARGETDEPS"] += project->variables()["RES_FILE"];
+ project->variables()["POST_TARGETDEPS"] += project->variables()["RES_FILE"];
}
if ( !project->variables()["RES_FILE"].isEmpty())
project->variables()["QMAKE_LIBS"] += project->variables()["RES_FILE"];
MakefileGenerator::init();
if ( !project->variables()["VERSION"].isEmpty()) {
QStringList l = QStringList::split('.', project->first("VERSION"));
project->variables()["VER_MAJ"].append(l[0]);
project->variables()["VER_MIN"].append(l[1]);
}
+
+ QString version = QStringList::split('.', project->first("VERSION")).join("");
if(project->isActiveConfig("dll")) {
- project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + ".lib");
- project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + ".exp");
+ project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + version + ".exp");
}
if(project->isActiveConfig("debug")) {
- project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + ".pdb");
- project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + ".ilk");
+ project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + version + ".pdb");
+ project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + version + ".ilk");
project->variables()["QMAKE_CLEAN"].append("vc*.pdb");
}
}
diff --git a/qmake/generators/win32/msvc_nmake.h b/qmake/generators/win32/msvc_nmake.h
index d3e170f..579fc35 100644
--- a/qmake/generators/win32/msvc_nmake.h
+++ b/qmake/generators/win32/msvc_nmake.h
@@ -1,59 +1,59 @@
/****************************************************************************
** $Id$
**
** Definition of ________ class.
**
** Created : 970521
**
-** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
+** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
**
** This file is part of the network module of the Qt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.QPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid Qt Enterprise Edition licenses may use this
** file in accordance with the Qt Commercial License Agreement provided
** with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for QPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
-#ifndef __NMAKEMAKE_H__
-#define __NMAKEMAKE_H__
+#ifndef __MSVC_NMAKE_H__
+#define __MSVC_NMAKE_H__
#include "winmakefile.h"
class NmakeMakefileGenerator : public Win32MakefileGenerator
{
bool init_flag;
void writeNmakeParts(QTextStream &);
bool writeMakefile(QTextStream &);
void init();
public:
NmakeMakefileGenerator(QMakeProject *p);
~NmakeMakefileGenerator();
};
inline NmakeMakefileGenerator::~NmakeMakefileGenerator()
{ }
-#endif /* __NMAKEMAKE_H__ */
+#endif /* __MSVC_NMAKE_H__ */
diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp
index c2b9e30..7ffe4f7 100644
--- a/qmake/generators/win32/msvc_objectmodel.cpp
+++ b/qmake/generators/win32/msvc_objectmodel.cpp
@@ -233,69 +233,69 @@ const char* _TurnOffAssemblyGeneration = "\n\t\t\t\tTurnOffAssemblyGeneration=
const char* _TypeLibraryFile = "\n\t\t\t\tTypeLibraryFile=\"";
const char* _TypeLibraryName = "\n\t\t\t\tTypeLibraryName=\"";
const char* _TypeLibraryResourceID = "\n\t\t\t\tTypeLibraryResourceID=\"";
const char* _UndefineAllPreprocessorDefinitions = "\n\t\t\t\tUndefineAllPreprocessorDefinitions=\"";
const char* _UndefinePreprocessorDefinitions = "\n\t\t\t\tUndefinePreprocessorDefinitions=\"";
const char* _UseOfATL = "\n\t\t\tUseOfATL=\"";
const char* _UseOfMfc = "\n\t\t\tUseOfMfc=\"";
const char* _UsePrecompiledHeader = "\n\t\t\t\tUsePrecompiledHeader=\"";
const char* _ValidateParameters = "\n\t\t\t\tValidateParameters=\"";
const char* _VCCLCompilerToolName = "\n\t\t\t\tName=\"VCCLCompilerTool\"";
const char* _VCCustomBuildTool = "\n\t\t\t\t\t\tName=\"VCCustomBuildTool\"";
const char* _VCLinkerToolName = "\n\t\t\t\tName=\"VCLinkerTool\"";
const char* _VCResourceCompilerToolName = "\n\t\t\t\tName=\"VCResourceCompilerTool\"";
const char* _VCMIDLToolName = "\n\t\t\t\tName=\"VCMIDLTool\"";
const char* _Version1 = "\n\tVersion=\"";
const char* _Version4 = "\n\t\t\t\tVersion=\"";
const char* _WarnAsError = "\n\t\t\t\tWarnAsError=\"";
const char* _WarnLevel = "\n\t\t\t\tWarnLevel=\"";
const char* _WarningLevel = "\n\t\t\t\tWarningLevel=\"";
const char* _WholeProgramOptimization = "\n\t\t\t\tWholeProgramOptimization=\"";
// Property name and value as Pairs ---------------------------------
struct TPair {
TPair( const char* n, const triState v ) : name(n), value(v) {};
- const char* name;
- const triState value;
+ const char* name;
+ const triState value;
};
-struct EPair {
+struct EPair {
EPair( const char* n, const int v ) : name(n), value(v) {};
- const char* name;
+ const char* name;
const int value;
};
-struct LPair {
+struct LPair {
LPair( const char* n, const long v ) : name(n), value(v) {};
- const char* name;
- const long value;
+ const char* name;
+ const long value;
};
-struct SPair {
+struct SPair {
SPair( const char* n, const QString& v ) : name(n), value(v) {};
- const char* name;
- const QString& value;
+ const char* name;
+ const QString& value;
};
-struct XPair {
+struct XPair {
XPair( const char* n, const QStringList& v, const char* s = "," ) : name(n), value(v), sep(s) {};
- const char* name;
+ const char* name;
const QStringList& value;
const char* sep;
};
// void streamSPair( QTextStream &strm, const char *n, const QString &s )
// Streaming operators for property Pairs ---------------------------
QTextStream &operator<<( QTextStream &strm, const TPair &prop )
{
switch( prop.value ) {
case _False:
strm << prop.name << "FALSE\"";
break;
case _True:
strm << prop.name << "TRUE\"";
break;
case unset:
default:
break;
}
return strm;
}
@@ -362,49 +362,49 @@ VCCLCompilerTool::VCCLCompilerTool()
OptimizeForProcessor( procOptimizeBlended ),
OptimizeForWindowsApplication( unset ),
RuntimeLibrary( rtMultiThreaded ),
RuntimeTypeInfo( unset ),
ShowIncludes( unset ),
SmallerTypeCheck( unset ),
StringPooling( unset ),
StructMemberAlignment( alignNotSet ),
SuppressStartupBanner( unset ),
TreatWChar_tAsBuiltInType( unset ),
TurnOffAssemblyGeneration( unset ),
UndefineAllPreprocessorDefinitions( unset ),
UsePrecompiledHeader( pchGenerateAuto ),
WarnAsError( unset ),
WarningLevel( warningLevel_0 ),
WholeProgramOptimization( unset )
{
}
QTextStream &operator<<( QTextStream &strm, const VCCLCompilerTool &tool )
{
strm << _begTool3;
strm << _VCCLCompilerToolName;
strm << XPair( _AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories );
- strm << XPair( _AdditionalOptions, tool.AdditionalOptions );
+ strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " );
strm << XPair( _AdditionalUsingDirectories, tool.AdditionalUsingDirectories );
strm << SPair( _AssemblerListingLocation, tool.AssemblerListingLocation );
if ( tool.AssemblerOutput != asmListingNone ) strm << EPair( _AssemblerOutput, tool.AssemblerOutput );
if ( tool.BasicRuntimeChecks != runtimeBasicCheckNone ) strm << EPair( _BasicRuntimeChecks, tool.BasicRuntimeChecks );
if ( tool.BrowseInformation != brInfoNone ) strm << EPair( _BrowseInformation, tool.BrowseInformation );
strm << SPair( _BrowseInformationFile, tool.BrowseInformationFile );
strm << TPair( _BufferSecurityCheck, tool.BufferSecurityCheck );
if ( tool.CallingConvention != callConventionDefault ) strm << EPair( _CallingConvention, tool.CallingConvention );
if ( tool.CompileAs != compileAsDefault ) strm << EPair( _CompileAs, tool.CompileAs );
if ( tool.CompileAsManaged != managedDefault ) strm << EPair( _CompileAsManaged, tool.CompileAsManaged );
strm << TPair( _CompileOnly, tool.CompileOnly );
strm << EPair( _DebugInformationFormat, tool.DebugInformationFormat );
strm << TPair( _DefaultCharIsUnsigned, tool.DefaultCharIsUnsigned );
strm << TPair( _Detect64BitPortabilityProblems, tool.Detect64BitPortabilityProblems );
strm << TPair( _DisableLanguageExtensions, tool.DisableLanguageExtensions );
strm << XPair( _DisableSpecificWarnings, tool.DisableSpecificWarnings );
strm << TPair( _EnableFiberSafeOptimizations, tool.EnableFiberSafeOptimizations );
strm << TPair( _EnableFunctionLevelLinking, tool.EnableFunctionLevelLinking );
strm << TPair( _EnableIntrinsicFunctions, tool.EnableIntrinsicFunctions );
strm << TPair( _ExceptionHandling, tool.ExceptionHandling );
strm << TPair( _ExpandAttributedSource, tool.ExpandAttributedSource );
if ( tool.FavorSizeOrSpeed != favorNone ) strm << EPair( _FavorSizeOrSpeed, tool.FavorSizeOrSpeed );
strm << TPair( _ForceConformanceInForLoopScope, tool.ForceConformanceInForLoopScope );
strm << XPair( _ForcedIncludeFiles, tool.ForcedIncludeFiles );
@@ -421,94 +421,98 @@ QTextStream &operator<<( QTextStream &strm, const VCCLCompilerTool &tool )
strm << EPair( _Optimization, tool.Optimization );
if ( tool.OptimizeForProcessor != procOptimizeBlended ) strm << EPair( _OptimizeForProcessor, tool.OptimizeForProcessor );
strm << TPair( _OptimizeForWindowsApplication, tool.OptimizeForWindowsApplication );
strm << SPair( _OutputFile, tool.OutputFile );
strm << SPair( _PrecompiledHeaderFile, tool.PrecompiledHeaderFile );
strm << SPair( _PrecompiledHeaderThrough, tool.PrecompiledHeaderThrough );
strm << XPair( _PreprocessorDefinitions, tool.PreprocessorDefinitions );
strm << SPair( _ProgramDataBaseFileName, tool.ProgramDataBaseFileName );
strm << EPair( _RuntimeLibrary, tool.RuntimeLibrary );
strm << TPair( _RuntimeTypeInfo, tool.RuntimeTypeInfo );
strm << TPair( _ShowIncludes, tool.ShowIncludes );
strm << TPair( _SmallerTypeCheck, tool.SmallerTypeCheck );
strm << TPair( _StringPooling, tool.StringPooling );
if ( tool.StructMemberAlignment != alignNotSet ) strm << EPair( _StructMemberAlignment, tool.StructMemberAlignment );
strm << TPair( _SuppressStartupBanner, tool.SuppressStartupBanner );
strm << TPair( _TreatWChar_tAsBuiltInType, tool.TreatWChar_tAsBuiltInType );
strm << TPair( _TurnOffAssemblyGeneration, tool.TurnOffAssemblyGeneration );
strm << TPair( _UndefineAllPreprocessorDefinitions, tool.UndefineAllPreprocessorDefinitions );
strm << XPair( _UndefinePreprocessorDefinitions, tool.UndefinePreprocessorDefinitions );
if ( !tool.PrecompiledHeaderFile.isEmpty() ||
!tool.PrecompiledHeaderThrough.isEmpty() )
strm << EPair( _UsePrecompiledHeader, tool.UsePrecompiledHeader );
strm << TPair( _WarnAsError, tool.WarnAsError );
strm << EPair( _WarningLevel, tool.WarningLevel );
- strm << TPair( _WholeProgramOptimization, tool.WholeProgramOptimization );
+ strm << TPair( _WholeProgramOptimization, tool.WholeProgramOptimization );
strm << "/>";
return strm;
}
bool VCCLCompilerTool::parseOption( const char* option )
{
// skip index 0 ('/' or '-')
- char first = option[1];
+ char first = option[1];
char second = option[2];
char third = option[3];
char fourth = option[4];
+ bool found = TRUE;
switch ( first ) {
case '?':
case 'h':
qWarning( "Generator: Option '/?', '/help': MSVC.NET projects do not support outputting help info" );
- return FALSE;
+ found = FALSE;
+ break;
case '@':
qWarning( "Generator: Option '/@': MSVC.NET projects do not support the use of a response file" );
- return FALSE;
+ found = FALSE;
+ break;
case 'l':
qWarning( "Generator: Option '/link': qmake generator does not support passing link options through the compiler tool" );
- return FALSE;
-
+ found = FALSE;
+ break;
case 'A':
- if ( second != 'I' )
- return FALSE;
+ if ( second != 'I' ) {
+ found = FALSE; break;
+ }
AdditionalUsingDirectories += option+2;
break;
case 'C':
KeepComments = _True;
break;
case 'D':
PreprocessorDefinitions += option+1;
break;
case 'E':
if ( second == 'H' ) {
if ( third == 'a' || third == 'c' || third == 's' ) {
// ExceptionHandling must be false, or it will override
// with an /EHsc option
ExceptionHandling = _False;
AdditionalOptions += option;
break;
}
- return FALSE;
+ found = FALSE; break;
}
GeneratePreprocessedFile = preprocessYes;
break;
case 'F':
if ( second <= '9' && second >= '0' ) {
AdditionalOptions += option;
break;
} else {
switch ( second ) {
case 'A':
if ( third == 'c' ) {
AssemblerOutput = asmListingAsmMachine;
if ( fourth == 's' )
AssemblerOutput = asmListingAsmMachineSrc;
} else if ( third == 's' ) {
AssemblerOutput = asmListingAsmSrc;
} else {
AssemblerOutput = asmListingAssemblyOnly;
}
break;
case 'a':
AssemblerListingLocation = option+3;
break;
case 'I':
@@ -523,58 +527,58 @@ bool VCCLCompilerTool::parseOption( const char* option )
BrowseInformationFile = option+3;
break;
case 'U':
ForcedUsingFiles += option+3;
break;
case 'd':
ProgramDataBaseFileName = option+3;
break;
case 'e':
OutputFile = option+3;
break;
case 'm':
AdditionalOptions += option;
break;
case 'o':
ObjectFile = option+3;
break;
case 'p':
PrecompiledHeaderFile = option+3;
break;
case 'x':
ExpandAttributedSource = _True;
break;
default:
- return FALSE;
+ found = FALSE; break;
}
}
break;
case 'G':
switch ( second ) {
case '3':
case '4':
qWarning( "Option '/G3' and '/G4' were phased out in Visual C++ 5.0" );
- return FALSE;
+ found = FALSE; break;
case '5':
OptimizeForProcessor = procOptimizePentium;
break;
case '6':
case 'B':
OptimizeForProcessor = procOptimizePentiumProAndAbove;
break;
case 'A':
OptimizeForWindowsApplication = _True;
break;
case 'F':
StringPooling = _True;
break;
case 'H':
AdditionalOptions += option;
break;
case 'L':
WholeProgramOptimization = _True;
if ( third == '-' )
WholeProgramOptimization = _False;
break;
case 'R':
RuntimeTypeInfo = _True;
if ( third == '-' )
@@ -598,410 +602,413 @@ bool VCCLCompilerTool::parseOption( const char* option )
case 'f':
StringPooling = _True;
AdditionalOptions += option;
break;
case 'm':
MinimalRebuild = _True;
if ( third == '-' )
MinimalRebuild = _False;
break;
case 'r':
CallingConvention = callConventionFastCall;
break;
case 's':
// Warning: following [num] is not used,
// were should we put it?
BufferSecurityCheck = _True;
break;
case 'y':
EnableFunctionLevelLinking = _True;
break;
case 'z':
CallingConvention = callConventionStdCall;
break;
default:
- return FALSE;
+ found = FALSE; break;
}
break;
case 'H':
AdditionalOptions += option;
break;
case 'I':
AdditionalIncludeDirectories += option+2;
break;
case 'L':
if ( second == 'D' ) {
AdditionalOptions += option;
break;
}
- return FALSE;
+ found = FALSE; break;
case 'M':
if ( second == 'D' ) {
RuntimeLibrary = rtMultiThreadedDLL;
if ( third == 'd' )
RuntimeLibrary = rtMultiThreadedDebugDLL;
break;
} else if ( second == 'L' ) {
RuntimeLibrary = rtSingleThreaded;
if ( third == 'd' )
RuntimeLibrary = rtSingleThreadedDebug;
break;
} else if ( second == 'T' ) {
RuntimeLibrary = rtMultiThreaded;
if ( third == 'd' )
RuntimeLibrary = rtMultiThreadedDebug;
break;
}
- return FALSE;
+ found = FALSE; break;
case 'O':
switch ( second ) {
case '1':
Optimization = optimizeMinSpace;
break;
case '2':
Optimization = optimizeMaxSpeed;
break;
case 'a':
AdditionalOptions += option;
break;
case 'b':
if ( third == '0' )
InlineFunctionExpansion = expandDisable;
else if ( third == '1' )
InlineFunctionExpansion = expandOnlyInline;
else if ( third == '2' )
InlineFunctionExpansion = expandAnySuitable;
else
- return FALSE;
+ found = FALSE;
break;
case 'd':
Optimization = optimizeDisabled;
break;
case 'g':
GlobalOptimizations = _True;
break;
case 'i':
EnableIntrinsicFunctions = _True;
break;
case 'p':
ImproveFloatingPointConsistency = _True;
if ( third == '-' )
ImproveFloatingPointConsistency = _False;
break;
case 's':
FavorSizeOrSpeed = favorSize;
break;
case 't':
FavorSizeOrSpeed = favorSpeed;
break;
case 'w':
AdditionalOptions += option;
break;
case 'x':
Optimization = optimizeFull;
break;
case 'y':
OmitFramePointers = _True;
if ( third == '-' )
OmitFramePointers = _False;
break;
default:
- return FALSE;
+ found = FALSE; break;
}
break;
case 'P':
GeneratePreprocessedFile = preprocessYes;
break;
case 'Q':
if ( second == 'I' ) {
AdditionalOptions += option;
break;
}
- return FALSE;
+ found = FALSE; break;
case 'R':
if ( second == 'T' && third == 'C' ) {
if ( fourth == '1' )
BasicRuntimeChecks = runtimeBasicCheckAll;
else if ( fourth == 'c' )
SmallerTypeCheck = _True;
else if ( fourth == 's' )
BasicRuntimeChecks = runtimeCheckStackFrame;
else if ( fourth == 'u' )
BasicRuntimeChecks = runtimeCheckUninitVariables;
else
- return FALSE;
+ found = FALSE; break;
}
break;
case 'T':
if ( second == 'C' ) {
CompileAs = compileAsC;
} else if ( second == 'P' ) {
CompileAs = compileAsCPlusPlus;
} else {
qWarning( "Generator: Options '/Tp<filename>' and '/Tc<filename>' are not supported by qmake" );
- return FALSE;
+ found = FALSE; break;
}
break;
case 'U':
UndefinePreprocessorDefinitions += option+2;
break;
case 'V':
AdditionalOptions += option;
break;
case 'W':
switch ( second ) {
case 'a':
case '4':
WarningLevel = warningLevel_4;
break;
case '3':
WarningLevel = warningLevel_3;
break;
case '2':
WarningLevel = warningLevel_2;
break;
case '1':
WarningLevel = warningLevel_1;
break;
case '0':
WarningLevel = warningLevel_0;
break;
case 'L':
AdditionalOptions += option;
break;
case 'X':
WarnAsError = _True;
break;
case 'p':
if ( third == '6' && fourth == '4' ) {
Detect64BitPortabilityProblems = _True;
break;
}
// Fallthrough
default:
- return FALSE;
+ found = FALSE; break;
}
break;
case 'X':
IgnoreStandardIncludePath = _True;
break;
case 'Y':
switch ( second ) {
case '\0':
case '-':
AdditionalOptions += option;
break;
case 'X':
UsePrecompiledHeader = pchGenerateAuto;
PrecompiledHeaderFile = option+3;
break;
case 'c':
UsePrecompiledHeader = pchCreateUsingSpecific;
PrecompiledHeaderFile = option+3;
break;
case 'd':
case 'l':
AdditionalOptions =+ option;
break;
case 'u':
UsePrecompiledHeader = pchUseUsingSpecific;
PrecompiledHeaderFile = option+3;
break;
default:
- return FALSE;
+ found = FALSE; break;
}
break;
case 'Z':
switch ( second ) {
case '7':
DebugInformationFormat = debugOldStyleInfo;
break;
case 'I':
DebugInformationFormat = debugEditAndContinue;
break;
case 'd':
DebugInformationFormat = debugLineInfoOnly;
break;
case 'i':
DebugInformationFormat = debugEnabled;
break;
case 'l':
DebugInformationFormat = debugEditAndContinue;
break;
case 'a':
DisableLanguageExtensions = _True;
break;
case 'e':
DisableLanguageExtensions = _False;
break;
case 'c':
if ( third == ':' ) {
if ( fourth == 'f' )
ForceConformanceInForLoopScope = _True;
else if ( fourth == 'w' )
TreatWChar_tAsBuiltInType = _True;
else
- return FALSE;
+ found = FALSE;
} else {
- return FALSE;
+ found = FALSE; break;
}
break;
case 'g':
case 'm':
case 's':
AdditionalOptions += option;
break;
case 'p':
switch ( third )
{
case '\0':
case '1':
StructMemberAlignment = alignSingleByte;
if ( fourth == '6' )
StructMemberAlignment = alignSixteenBytes;
break;
case '2':
StructMemberAlignment = alignTwoBytes;
break;
case '4':
StructMemberAlignment = alignFourBytes;
break;
case '8':
StructMemberAlignment = alignEightBytes;
break;
default:
- return FALSE;
+ found = FALSE; break;
}
break;
default:
- return FALSE;
+ found = FALSE; break;
}
break;
case 'c':
if ( second == '\0' ) {
CompileOnly = _True;
} else if ( second == 'l' ) {
if ( *(option+5) == 'n' ) {
CompileAsManaged = managedAssembly;
TurnOffAssemblyGeneration = _True;
} else {
CompileAsManaged = managedAssembly;
}
} else {
- return FALSE;
+ found = FALSE; break;
}
break;
case 'd':
- if ( second != 'r' )
- return FALSE;
+ if ( second != 'r' ) {
+ found = FALSE; break;
+ }
CompileAsManaged = managedAssembly;
break;
case 'n':
if ( second == 'o' && third == 'B' && fourth == 'o' ) {
AdditionalOptions += "/noBool";
break;
}
if ( second == 'o' && third == 'l' && fourth == 'o' ) {
SuppressStartupBanner = _True;
break;
}
- return FALSE;
+ found = FALSE; break;
case 's':
if ( second == 'h' && third == 'o' && fourth == 'w' ) {
ShowIncludes = _True;
break;
}
- return FALSE;
+ found = FALSE; break;
case 'u':
UndefineAllPreprocessorDefinitions = _True;
break;
case 'v':
if ( second == 'd' || second == 'm' ) {
AdditionalOptions += option;
break;
}
- return FALSE;
+ found = FALSE; break;
case 'w':
switch ( second ) {
case '\0':
WarningLevel = warningLevel_0;
break;
case 'd':
DisableSpecificWarnings += option+3;
break;
default:
AdditionalOptions += option;
}
break;
default:
- return FALSE;
+ found = FALSE; break;
}
+ if( !found )
+ warn_msg( WarnLogic, "Could not parse Compiler option: %s", option );
return TRUE;
}
// VCLinkerTool -----------------------------------------------------
VCLinkerTool::VCLinkerTool()
: EnableCOMDATFolding( optFoldingDefault ),
GenerateDebugInformation( unset ),
GenerateMapFile( unset ),
HeapCommitSize( -1 ),
HeapReserveSize( -1 ),
IgnoreAllDefaultLibraries( unset ),
IgnoreEmbeddedIDL( unset ),
IgnoreImportLibrary( unset ),
LargeAddressAware( addrAwareDefault ),
LinkDLL( unset ),
LinkIncremental( linkIncrementalYes ),
LinkTimeCodeGeneration( unset ),
MapExports( unset ),
MapLines( unset ),
OptimizeForWindows98( optWin98Default ),
OptimizeReferences( optReferencesDefault ),
RegisterOutput( unset ),
ResourceOnlyDLL( unset ),
SetChecksum( unset ),
ShowProgress( linkProgressNotSet ),
StackCommitSize( -1 ),
StackReserveSize( -1 ),
SubSystem( subSystemNotSet ),
SupportUnloadOfDelayLoadedDLL( unset ),
SuppressStartupBanner( unset ),
SwapRunFromCD( unset ),
SwapRunFromNet( unset ),
TargetMachine( machineNotSet ),
TerminalServerAware( termSvrAwareDefault ),
TurnOffAssemblyGeneration( unset ),
TypeLibraryResourceID( 0 )
{
}
QTextStream &operator<<( QTextStream &strm, const VCLinkerTool &tool )
{
strm << _begTool3;
strm << _VCLinkerToolName;
strm << XPair( _AdditionalDependencies4, tool.AdditionalDependencies, " " );
strm << XPair( _AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories );
- strm << XPair( _AdditionalOptions, tool.AdditionalOptions );
+ strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " );
strm << XPair( _AddModuleNamesToAssembly, tool.AddModuleNamesToAssembly );
strm << SPair( _BaseAddress, tool.BaseAddress );
strm << XPair( _DelayLoadDLLs, tool.DelayLoadDLLs );
if ( tool.EnableCOMDATFolding != optFoldingDefault ) strm << EPair( _EnableCOMDATFolding, tool.EnableCOMDATFolding );
strm << SPair( _EntryPointSymbol, tool.EntryPointSymbol );
strm << XPair( _ForceSymbolReferences, tool.ForceSymbolReferences );
strm << SPair( _FunctionOrder, tool.FunctionOrder );
strm << TPair( _GenerateDebugInformation, tool.GenerateDebugInformation );
strm << TPair( _GenerateMapFile, tool.GenerateMapFile );
if ( tool.HeapCommitSize != -1 ) strm << LPair( _HeapCommitSize, tool.HeapCommitSize );
if ( tool.HeapReserveSize != -1 ) strm << LPair( _HeapReserveSize, tool.HeapReserveSize );
strm << TPair( _IgnoreAllDefaultLibraries, tool.IgnoreAllDefaultLibraries );
strm << XPair( _IgnoreDefaultLibraryNames, tool.IgnoreDefaultLibraryNames );
strm << TPair( _IgnoreEmbeddedIDL, tool.IgnoreEmbeddedIDL );
strm << TPair( _IgnoreImportLibrary, tool.IgnoreImportLibrary );
strm << SPair( _ImportLibrary, tool.ImportLibrary );
if ( tool.LargeAddressAware != addrAwareDefault ) strm << EPair( _LargeAddressAware, tool.LargeAddressAware );
strm << TPair( _LinkDLL, tool.LinkDLL );
if ( tool.LinkIncremental != linkIncrementalDefault ) strm << EPair( _LinkIncremental, tool.LinkIncremental );
strm << TPair( _LinkTimeCodeGeneration, tool.LinkTimeCodeGeneration );
strm << SPair( _LinkToManagedResourceFile, tool.LinkToManagedResourceFile );
strm << TPair( _MapExports, tool.MapExports );
strm << SPair( _MapFileName, tool.MapFileName );
strm << TPair( _MapLines, tool.MapLines );
@@ -1025,144 +1032,148 @@ QTextStream &operator<<( QTextStream &strm, const VCLinkerTool &tool )
strm << TPair( _SuppressStartupBanner, tool.SuppressStartupBanner );
strm << TPair( _SwapRunFromCD, tool.SwapRunFromCD );
strm << TPair( _SwapRunFromNet, tool.SwapRunFromNet );
if ( tool.TargetMachine != machineNotSet ) strm << EPair( _TargetMachine, tool.TargetMachine );
if ( tool.TerminalServerAware != termSvrAwareDefault ) strm << EPair( _TerminalServerAware, tool.TerminalServerAware );
strm << TPair( _TurnOffAssemblyGeneration, tool.TurnOffAssemblyGeneration );
strm << SPair( _TypeLibraryFile, tool.TypeLibraryFile );
if ( tool.TypeLibraryResourceID != rcUseDefault ) strm << LPair( _TypeLibraryResourceID, tool.TypeLibraryResourceID );
strm << SPair( _Version4, tool.Version );
strm << "/>";
return strm;
}
// Hashing routine to do fast option lookups ----
// Slightly rewritten to stop on ':' ',' and '\0'
// Original routine in qtranslator.cpp ----------
static uint elfHash( const char* name )
{
const uchar *k;
uint h = 0;
uint g;
if ( name ) {
k = (const uchar *) name;
- while ( (*k) &&
- (*k)!= ':' &&
+ while ( (*k) &&
+ (*k)!= ':' &&
(*k)!=',' &&
(*k)!=' ' ) {
h = ( h << 4 ) + *k++;
if ( (g = (h & 0xf0000000)) != 0 )
h ^= g >> 24;
h &= ~g;
}
}
if ( !h )
h = 1;
return h;
}
+
+//#define USE_DISPLAY_HASH
+#ifdef USE_DISPLAY_HASH
static void displayHash( const char* str )
{
printf( "case 0x%07x: // %s\n break;\n", elfHash(str), str );
}
+#endif
bool VCLinkerTool::parseOption( const char* option )
{
-#if 0
+#ifdef USE_DISPLAY_HASH
// Main options
- displayHash( "/ALIGN" ); displayHash( "/ALLOWBIND" ); displayHash( "/ASSEMBLYMODULE" );
- displayHash( "/ASSEMBLYRESOURCE" ); displayHash( "/BASE" ); displayHash( "/DEBUG" );
- displayHash( "/DEF" ); displayHash( "/DEFAULTLIB" ); displayHash( "/DELAY" );
- displayHash( "/DELAYLOAD" ); displayHash( "/DLL" ); displayHash( "/DRIVER" );
- displayHash( "/ENTRY" ); displayHash( "/EXETYPE" ); displayHash( "/EXPORT" );
- displayHash( "/FIXED" ); displayHash( "/FORCE" ); displayHash( "/HEAP" );
- displayHash( "/IDLOUT" ); displayHash( "/IGNOREIDL" ); displayHash( "/IMPLIB" );
- displayHash( "/INCLUDE" ); displayHash( "/INCREMENTAL" ); displayHash( "/LARGEADDRESSAWARE" );
- displayHash( "/LIBPATH" ); displayHash( "/LTCG" ); displayHash( "/MACHINE" );
- displayHash( "/MAP" ); displayHash( "/MAPINFO" ); displayHash( "/MERGE" );
- displayHash( "/MIDL" ); displayHash( "/NOASSEMBLY" ); displayHash( "/NODEFAULTLIB" );
- displayHash( "/NOENTRY" ); displayHash( "/NOLOGO" ); displayHash( "/OPT" );
- displayHash( "/ORDER" ); displayHash( "/OUT" ); displayHash( "/PDB" );
- displayHash( "/PDBSTRIPPED" ); displayHash( "/RELEASE" ); displayHash( "/SECTION" );
- displayHash( "/STACK" ); displayHash( "/STUB" ); displayHash( "/SUBSYSTEM" );
- displayHash( "/SWAPRUN" ); displayHash( "/TLBID" ); displayHash( "/TLBOUT" );
- displayHash( "/TSAWARE" ); displayHash( "/VERBOSE" ); displayHash( "/VERSION" );
+ displayHash( "/ALIGN" ); displayHash( "/ALLOWBIND" ); displayHash( "/ASSEMBLYMODULE" );
+ displayHash( "/ASSEMBLYRESOURCE" ); displayHash( "/BASE" ); displayHash( "/DEBUG" );
+ displayHash( "/DEF" ); displayHash( "/DEFAULTLIB" ); displayHash( "/DELAY" );
+ displayHash( "/DELAYLOAD" ); displayHash( "/DLL" ); displayHash( "/DRIVER" );
+ displayHash( "/ENTRY" ); displayHash( "/EXETYPE" ); displayHash( "/EXPORT" );
+ displayHash( "/FIXED" ); displayHash( "/FORCE" ); displayHash( "/HEAP" );
+ displayHash( "/IDLOUT" ); displayHash( "/IGNOREIDL" ); displayHash( "/IMPLIB" );
+ displayHash( "/INCLUDE" ); displayHash( "/INCREMENTAL" ); displayHash( "/LARGEADDRESSAWARE" );
+ displayHash( "/LIBPATH" ); displayHash( "/LTCG" ); displayHash( "/MACHINE" );
+ displayHash( "/MAP" ); displayHash( "/MAPINFO" ); displayHash( "/MERGE" );
+ displayHash( "/MIDL" ); displayHash( "/NOASSEMBLY" ); displayHash( "/NODEFAULTLIB" );
+ displayHash( "/NOENTRY" ); displayHash( "/NOLOGO" ); displayHash( "/OPT" );
+ displayHash( "/ORDER" ); displayHash( "/OUT" ); displayHash( "/PDB" );
+ displayHash( "/PDBSTRIPPED" ); displayHash( "/RELEASE" ); displayHash( "/SECTION" );
+ displayHash( "/STACK" ); displayHash( "/STUB" ); displayHash( "/SUBSYSTEM" );
+ displayHash( "/SWAPRUN" ); displayHash( "/TLBID" ); displayHash( "/TLBOUT" );
+ displayHash( "/TSAWARE" ); displayHash( "/VERBOSE" ); displayHash( "/VERSION" );
displayHash( "/VXD" ); displayHash( "/WS " );
#endif
-#if 0
+#ifdef USE_DISPLAY_HASH
// Sub options
displayHash( "UNLOAD" ); displayHash( "NOBIND" ); displayHash( "no" ); displayHash( "NOSTATUS" ); displayHash( "STATUS" );
- displayHash( "AM33" ); displayHash( "ARM" ); displayHash( "CEE" ); displayHash( "IA64" ); displayHash( "X86" ); displayHash( "M32R" );
- displayHash( "MIPS" ); displayHash( "MIPS16" ); displayHash( "MIPSFPU" ); displayHash( "MIPSFPU16" ); displayHash( "MIPSR41XX" ); displayHash( "PPC" );
- displayHash( "SH3" ); displayHash( "SH4" ); displayHash( "SH5" ); displayHash( "THUMB" ); displayHash( "TRICORE" ); displayHash( "EXPORTS" );
- displayHash( "LINES" ); displayHash( "REF" ); displayHash( "NOREF" ); displayHash( "ICF" ); displayHash( "WIN98" ); displayHash( "NOWIN98" );
- displayHash( "CONSOLE" ); displayHash( "EFI_APPLICATION" ); displayHash( "EFI_BOOT_SERVICE_DRIVER" ); displayHash( "EFI_ROM" ); displayHash( "EFI_RUNTIME_DRIVER" ); displayHash( "NATIVE" );
- displayHash( "POSIX" ); displayHash( "WINDOWS" ); displayHash( "WINDOWSCE" ); displayHash( "NET" ); displayHash( "CD" ); displayHash( "NO" );
+ displayHash( "AM33" ); displayHash( "ARM" ); displayHash( "CEE" ); displayHash( "IA64" ); displayHash( "X86" ); displayHash( "M32R" );
+ displayHash( "MIPS" ); displayHash( "MIPS16" ); displayHash( "MIPSFPU" ); displayHash( "MIPSFPU16" ); displayHash( "MIPSR41XX" ); displayHash( "PPC" );
+ displayHash( "SH3" ); displayHash( "SH4" ); displayHash( "SH5" ); displayHash( "THUMB" ); displayHash( "TRICORE" ); displayHash( "EXPORTS" );
+ displayHash( "LINES" ); displayHash( "REF" ); displayHash( "NOREF" ); displayHash( "ICF" ); displayHash( "WIN98" ); displayHash( "NOWIN98" );
+ displayHash( "CONSOLE" ); displayHash( "EFI_APPLICATION" ); displayHash( "EFI_BOOT_SERVICE_DRIVER" ); displayHash( "EFI_ROM" ); displayHash( "EFI_RUNTIME_DRIVER" ); displayHash( "NATIVE" );
+ displayHash( "POSIX" ); displayHash( "WINDOWS" ); displayHash( "WINDOWSCE" ); displayHash( "NET" ); displayHash( "CD" ); displayHash( "NO" );
#endif
-
+ bool found = TRUE;
switch ( elfHash(option) ) {
case 0x3360dbe: // /ALIGN[:number]
case 0x1485c34: // /ALLOWBIND[:NO]
case 0x6b21972: // /DEFAULTLIB:library
case 0x396ea92: // /DRIVER[:UPONLY | :WDM]
case 0xaca9d75: // /EXETYPE[:DYNAMIC | :DEV386]
case 0x3ad5444: // /EXPORT:entryname[,@ordinal[,NONAME]][,DATA]
case 0x33aec94: // /FIXED[:NO]
case 0x33b4675: // /FORCE:[MULTIPLE|UNRESOLVED]
case 0x7988f7e: // /SECTION:name,[E][R][W][S][D][K][L][P][X][,ALIGN=#]
case 0x0348992: // /STUB:filename
case 0x0034bc4: // /VXD
case 0x0034c50: // /WS
AdditionalOptions += option;
break;
case 0x679c075: // /ASSEMBLYMODULE:filename
AddModuleNamesToAssembly += option+15;
break;
case 0x062d065: // /ASSEMBLYRESOURCE:filename
LinkToManagedResourceFile = option+18;
break;
case 0x0336675: // /BASE:{address | @filename,key}
// Do we need to do a manual lookup when '@filename,key'?
// Seems BaseAddress only can contain the location...
// We don't use it in Qt, so keep it simple for now
BaseAddress = option+6;
break;
case 0x3389797: // /DEBUG
GenerateDebugInformation = _True;
break;
case 0x0033896: // /DEF:filename
ModuleDefinitionFile = option+5;
break;
case 0x338a069: // /DELAY:{UNLOAD | NOBIND}
// MS documentation does not specify what to do with
// this option, so we'll put it in AdditionalOptions
AdditionalOptions += option;
break;
case 0x06f4bf4: // /DELAYLOAD:dllname
DelayLoadDLLs += option+11;
break;
// case 0x003390c: // /DLL
- // This option is not used for vcproj files
+ // This option is not used for vcproj files
// break;
case 0x33a3979: // /ENTRY:function
EntryPointSymbol = option+7;
break;
case 0x033c960: // /HEAP:reserve[,commit]
{
QStringList both = QStringList::split( ",", option+6 );
HeapReserveSize = both[0].toLong();
if ( both.count() == 2 )
HeapCommitSize = both[1].toLong();
}
break;
case 0x3d91494: // /IDLOUT:[path\]filename
MergedIDLBaseFileName = option+8;
break;
case 0x345a04c: // /IGNOREIDL
IgnoreEmbeddedIDL = _True;
break;
case 0x3e250e2: // /IMPLIB:filename
ImportLibrary = option+8;
break;
case 0xe281ab5: // /INCLUDE:symbol
ForceSymbolReferences += option+9;
break;
@@ -1171,73 +1182,73 @@ bool VCLinkerTool::parseOption( const char* option )
*(option+13) == 'n' )
LinkIncremental = linkIncrementalNo;
else
LinkIncremental = linkIncrementalYes;
break;
case 0x26e4675: // /LARGEADDRESSAWARE[:no]
if ( *(option+18) == ':' &&
*(option+19) == 'n' )
LargeAddressAware = addrAwareNoLarge;
else
LargeAddressAware = addrAwareLarge;
break;
case 0x0d745c8: // /LIBPATH:dir
AdditionalLibraryDirectories += option+9;
break;
case 0x0341877: // /LTCG[:NOSTATUS|:STATUS]
config->WholeProgramOptimization = _True;
LinkTimeCodeGeneration = _True;
if ( *(option+5) == ':' &&
*(option+6) == 'S' )
ShowProgress = linkProgressAll;
break;
case 0x157cf65: // /MACHINE:{AM33|ARM|CEE|IA64|X86|M32R|MIPS|MIPS16|MIPSFPU|MIPSFPU16|MIPSR41XX|PPC|SH3|SH4|SH5|THUMB|TRICORE}
switch ( elfHash(option+9) ) {
- // Very limited documentation on all options but X86,
+ // Very limited documentation on all options but X86,
// so we put the others in AdditionalOptions...
case 0x0046063: // AM33
case 0x000466d: // ARM
case 0x0004795: // CEE
case 0x004d494: // IA64
case 0x0050672: // M32R
case 0x0051e53: // MIPS
case 0x51e5646: // MIPS16
case 0x1e57b05: // MIPSFPU
case 0x57b09a6: // MIPSFPU16
case 0x5852738: // MIPSR41XX
case 0x0005543: // PPC
case 0x00057b3: // SH3
case 0x00057b4: // SH4
case 0x00057b5: // SH5
case 0x058da12: // THUMB
case 0x96d8435: // TRICORE
AdditionalOptions += option;
break;
case 0x0005bb6: // X86
TargetMachine = machineX86;
break;
default:
- return FALSE;
+ found = FALSE;
}
break;
case 0x0034160: // /MAP[:filename]
GenerateMapFile = _True;
MapFileName = option+5;
break;
case 0x164e1ef: // /MAPINFO:{EXPORTS|LINES}
if ( *(option+9) == 'E' )
MapExports = _True;
else if ( *(option+9) == 'L' )
MapLines = _True;
break;
case 0x341a6b5: // /MERGE:from=to
MergeSections = option+7;
break;
case 0x0341d8c: // /MIDL:@file
MidlCommandFile = option+7;
break;
case 0x84e2679: // /NOASSEMBLY
TurnOffAssemblyGeneration = _True;
break;
case 0x2b21942: // /NODEFAULTLIB[:library]
if ( *(option+13) == '\0' )
IgnoreAllDefaultLibraries = _True;
@@ -1254,316 +1265,319 @@ bool VCLinkerTool::parseOption( const char* option )
{
char third = *(option+7);
switch ( third ) {
case 'F': // REF
if ( *(option+5) == 'R' ) {
OptimizeReferences = optReferences;
} else { // ICF[=iterations]
EnableCOMDATFolding = optFolding;
// [=iterations] case is not documented
}
break;
case 'R': // NOREF
OptimizeReferences = optNoReferences;
break;
case 'I': // NOICF
EnableCOMDATFolding = optNoFolding;
break;
case 'N': // WIN98
OptimizeForWindows98 = optWin98Yes;
break;
case 'W': // NOWIN98
OptimizeForWindows98 = optWin98No;
break;
default:
- return FALSE;
+ found = FALSE;
}
}
break;
case 0x34468a2: // /ORDER:@filename
FunctionOrder = option+8;
break;
case 0x00344a4: // /OUT:filename
OutputFile = option+5;
break;
case 0x0034482: // /PDB:filename
ProgramDatabaseFile = option+5;
break;
case 0xa2ad314: // /PDBSTRIPPED:pdb_file_name
StripPrivateSymbols = option+13;
break;
case 0x6a09535: // /RELEASE
SetChecksum = _True;
break;
case 0x348857b: // /STACK:reserve[,commit]
{
QStringList both = QStringList::split( ",", option+7 );
StackReserveSize = both[0].toLong();
if ( both.count() == 2 )
StackCommitSize = both[1].toLong();
}
break;
case 0x78dc00d: // /SUBSYSTEM:{CONSOLE|EFI_APPLICATION|EFI_BOOT_SERVICE_DRIVER|EFI_ROM|EFI_RUNTIME_DRIVER|NATIVE|POSIX|WINDOWS|WINDOWSCE}[,major[.minor]]
{
// Split up in subsystem, and version number
QStringList both = QStringList::split( ",", option+11 );
switch ( elfHash(both[0].latin1()) ) {
case 0x8438445: // CONSOLE
SubSystem = subSystemConsole;
break;
case 0xbe29493: // WINDOWS
SubSystem = subSystemWindows;
break;
// The following are undocumented, so add them to AdditionalOptions
case 0x240949e: // EFI_APPLICATION
case 0xe617652: // EFI_BOOT_SERVICE_DRIVER
case 0x9af477d: // EFI_ROM
case 0xd34df42: // EFI_RUNTIME_DRIVER
case 0x5268ea5: // NATIVE
case 0x05547e8: // POSIX
case 0x2949c95: // WINDOWSCE
AdditionalOptions += option;
break;
default:
- return FALSE;
+ found = FALSE;
}
}
break;
case 0x8b654de: // /SWAPRUN:{NET | CD}
if ( *(option+9) == 'N' )
SwapRunFromNet = _True;
else if ( *(option+9) == 'C' )
SwapRunFromCD = _True;
else
- return FALSE;
+ found = FALSE;
break;
case 0x34906d4: // /TLBID:id
TypeLibraryResourceID = QString( option+7 ).toLong();
break;
case 0x4907494: // /TLBOUT:[path\]filename
TypeLibraryFile = option+8;
break;
case 0x976b525: // /TSAWARE[:NO]
if ( *(option+8) == ':' )
TerminalServerAware = termSvrAwareNo;
else
TerminalServerAware = termSvrAwareYes;
break;
case 0xaa67735: // /VERBOSE[:lib]
if ( *(option+9) == ':' ) {
ShowProgress = linkProgressLibs;
AdditionalOptions += option;
} else {
ShowProgress = linkProgressAll;
}
break;
case 0xaa77f7e: // /VERSION:major[.minor]
Version = option+9;
break;
default:
- return FALSE;
+ found = FALSE;
}
- return TRUE;
+ if( !found )
+ warn_msg( WarnLogic, "Could not parse Linker options: %s", option );
+ return found;
}
// VCMIDLTool -------------------------------------------------------
VCMIDLTool::VCMIDLTool()
: DefaultCharType( midlCharUnsigned ),
EnableErrorChecks( midlDisableAll ),
ErrorCheckAllocations( unset ),
ErrorCheckBounds( unset ),
ErrorCheckEnumRange( unset ),
ErrorCheckRefPointers( unset ),
ErrorCheckStubData( unset ),
GenerateStublessProxies( unset ),
GenerateTypeLibrary( unset ),
IgnoreStandardIncludePath( unset ),
MkTypLibCompatible( unset ),
StructMemberAlignment( midlAlignNotSet ),
SuppressStartupBanner( unset ),
TargetEnvironment( midlTargetNotSet ),
ValidateParameters( unset ),
WarnAsError( unset ),
WarningLevel( midlWarningLevel_0 )
{
}
QTextStream &operator<<( QTextStream &strm, const VCMIDLTool &tool )
{
strm << _begTool3;
strm << _VCMIDLToolName;
strm << XPair( _AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories );
- strm << XPair( _AdditionalOptions, tool.AdditionalOptions );
+ strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " );
strm << XPair( _CPreprocessOptions, tool.CPreprocessOptions );
strm << EPair( _DefaultCharType, tool.DefaultCharType );
strm << SPair( _DLLDataFileName, tool.DLLDataFileName );
strm << EPair( _EnableErrorChecks, tool.EnableErrorChecks );
strm << TPair( _ErrorCheckAllocations, tool.ErrorCheckAllocations );
strm << TPair( _ErrorCheckBounds, tool.ErrorCheckBounds );
strm << TPair( _ErrorCheckEnumRange, tool.ErrorCheckEnumRange );
strm << TPair( _ErrorCheckRefPointers, tool.ErrorCheckRefPointers );
strm << TPair( _ErrorCheckStubData, tool.ErrorCheckStubData );
strm << XPair( _FullIncludePath, tool.FullIncludePath );
strm << TPair( _GenerateStublessProxies, tool.GenerateStublessProxies );
strm << TPair( _GenerateTypeLibrary, tool.GenerateTypeLibrary );
strm << SPair( _HeaderFileName, tool.HeaderFileName );
strm << TPair( _IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath );
strm << SPair( _InterfaceIdentifierFileName, tool.InterfaceIdentifierFileName );
strm << TPair( _MkTypLibCompatible, tool.MkTypLibCompatible );
strm << SPair( _OutputDirectory4, tool.OutputDirectory );
strm << XPair( _PreprocessorDefinitions, tool.PreprocessorDefinitions );
strm << SPair( _ProxyFileName, tool.ProxyFileName );
strm << SPair( _RedirectOutputAndErrors, tool.RedirectOutputAndErrors );
if ( tool.StructMemberAlignment != midlAlignNotSet) strm << EPair( _StructMemberAlignment, tool.StructMemberAlignment );
strm << TPair( _SuppressStartupBanner, tool.SuppressStartupBanner );
if ( tool.TargetEnvironment != midlTargetNotSet ) strm << EPair( _TargetEnvironment, tool.TargetEnvironment );
strm << SPair( _TypeLibraryName, tool.TypeLibraryName );
strm << XPair( _UndefinePreprocessorDefinitions, tool.UndefinePreprocessorDefinitions );
strm << TPair( _ValidateParameters, tool.ValidateParameters );
strm << TPair( _WarnAsError, tool.WarnAsError );
strm << EPair( _WarningLevel, tool.WarningLevel );
strm << "/>";
return strm;
}
bool VCMIDLTool::parseOption( const char* option )
{
-#if 0
+#ifdef USE_DISPLAY_HASH
displayHash( "/D name[=def]" ); displayHash( "/I directory-list" ); displayHash( "/Oi" );
displayHash( "/Oic" ); displayHash( "/Oicf" ); displayHash( "/Oif" ); displayHash( "/Os" );
displayHash( "/U name" ); displayHash( "/WX" ); displayHash( "/W{0|1|2|3|4}" );
displayHash( "/Zp {N}" ); displayHash( "/Zs" ); displayHash( "/acf filename" );
displayHash( "/align {N}" ); displayHash( "/app_config" ); displayHash( "/c_ext" );
displayHash( "/char ascii7" ); displayHash( "/char signed" ); displayHash( "/char unsigned" );
displayHash( "/client none" ); displayHash( "/client stub" ); displayHash( "/confirm" );
- displayHash( "/cpp_cmd cmd_line" ); displayHash( "/cpp_opt options" );
+ displayHash( "/cpp_cmd cmd_line" ); displayHash( "/cpp_opt options" );
displayHash( "/cstub filename" ); displayHash( "/dlldata filename" ); displayHash( "/env win32" );
displayHash( "/env win64" ); displayHash( "/error all" ); displayHash( "/error allocation" );
displayHash( "/error bounds_check" ); displayHash( "/error enum" ); displayHash( "/error none" );
displayHash( "/error ref" ); displayHash( "/error stub_data" ); displayHash( "/h filename" );
displayHash( "/header filename" ); displayHash( "/iid filename" ); displayHash( "/lcid" );
displayHash( "/mktyplib203" ); displayHash( "/ms_ext" ); displayHash( "/ms_union" );
displayHash( "/msc_ver <nnnn>" ); displayHash( "/newtlb" ); displayHash( "/no_cpp" );
displayHash( "/no_def_idir" ); displayHash( "/no_default_epv" ); displayHash( "/no_format_opt" );
displayHash( "/no_warn" ); displayHash( "/nocpp" ); displayHash( "/nologo" ); displayHash( "/notlb" );
- displayHash( "/o filename" ); displayHash( "/oldnames" ); displayHash( "/oldtlb" );
+ displayHash( "/o filename" ); displayHash( "/oldnames" ); displayHash( "/oldtlb" );
displayHash( "/osf" ); displayHash( "/out directory" ); displayHash( "/pack {N}" );
displayHash( "/prefix all" ); displayHash( "/prefix client" ); displayHash( "/prefix server" );
displayHash( "/prefix switch" ); displayHash( "/protocol all" ); displayHash( "/protocol dce" );
displayHash( "/protocol ndr64" ); displayHash( "/proxy filename" ); displayHash( "/robust" );
displayHash( "/rpcss" ); displayHash( "/savePP" ); displayHash( "/server none" );
displayHash( "/server stub" ); displayHash( "/sstub filename" ); displayHash( "/syntax_check" );
displayHash( "/target {system}" ); displayHash( "/tlb filename" ); displayHash( "/use_epv" );
displayHash( "/win32" ); displayHash( "/win64" );
#endif
+ bool found = TRUE;
int offset = 0;
switch( elfHash(option) ) {
case 0x0000334: // /D name[=def]
PreprocessorDefinitions += option+3;
break;
case 0x0000339: // /I directory-list
AdditionalIncludeDirectories += option+3;
break;
case 0x0345f96: // /Oicf
case 0x00345f6: // /Oif
GenerateStublessProxies = _True;
break;
case 0x0000345: // /U name
UndefinePreprocessorDefinitions += option+3;
break;
case 0x00034c8: // /WX
WarnAsError = _True;
break;
case 0x3582fde: // /align {N}
offset = 3; // Fallthrough
case 0x0003510: // /Zp {N}
switch ( *(option+offset+4) ) {
case '1':
StructMemberAlignment = ( *(option+offset+5) == '\0' ) ? midlAlignSingleByte : midlAlignSixteenBytes;
break;
case '2':
StructMemberAlignment = midlAlignTwoBytes;
break;
case '4':
StructMemberAlignment = midlAlignFourBytes;
break;
case '8':
StructMemberAlignment = midlAlignEightBytes;
break;
default:
- return FALSE;
+ found = FALSE;
}
break;
case 0x0359e82: // /char {ascii7|signed|unsigned}
switch( *(option+6) ) {
case 'a':
DefaultCharType = midlCharAscii7;
break;
case 's':
DefaultCharType = midlCharSigned;
break;
case 'u':
DefaultCharType = midlCharUnsigned;
break;
default:
- return FALSE;
+ found = FALSE;
}
break;
case 0xa766524: // /cpp_opt options
CPreprocessOptions += option+9;
break;
case 0xb32abf1: // /dlldata filename
DLLDataFileName = option + 9;
break;
case 0x0035c56: // /env {win32|win64}
TargetEnvironment = ( *(option+8) == '6' ) ? midlTargetWin64 : midlTargetWin32;
break;
case 0x35c9962: // /error {all|allocation|bounds_check|enum|none|ref|stub_data}
EnableErrorChecks = midlEnableCustom;
switch ( *(option+7) ) {
case 'a':
if ( *(option+10) == '\0' )
EnableErrorChecks = midlEnableAll;
else
ErrorCheckAllocations = _True;
break;
case 'b':
ErrorCheckBounds = _True;
break;
case 'e':
ErrorCheckEnumRange = _True;
break;
case 'n':
EnableErrorChecks = midlDisableAll;
break;
case 'r':
- break;
ErrorCheckRefPointers = _True;
- case 's':
break;
+ case 's':
ErrorCheckStubData = _True;
+ break;
default:
- return FALSE;
+ found = FALSE;
}
break;
case 0x5eb7af2: // /header filename
offset = 5;
case 0x0000358: // /h filename
HeaderFileName = option + offset + 3;
break;
case 0x0035ff4: // /iid filename
InterfaceIdentifierFileName = option+5;
break;
case 0x64b7933: // /mktyplib203
MkTypLibCompatible = _True;
break;
case 0x8e0b0a2: // /no_def_idir
IgnoreStandardIncludePath = _True;
break;
case 0x65635ef: // /nologo
SuppressStartupBanner = _True;
break;
case 0x3656b22: // /notlb
GenerateTypeLibrary = _True;
break;
case 0x000035f: // /o filename
RedirectOutputAndErrors = option+3;
@@ -1626,116 +1640,118 @@ bool VCMIDLTool::parseOption( const char* option )
case 0xce9b12b: // /syntax_check
case 0xc9b5f16: // /use_epv
AdditionalOptions += option;
break;
default:
// /W{0|1|2|3|4} case
if ( *(option+1) == 'W' ) {
switch ( *(option+2) ) {
case '0':
WarningLevel = midlWarningLevel_0;
break;
case '1':
WarningLevel = midlWarningLevel_1;
break;
case '2':
WarningLevel = midlWarningLevel_2;
break;
case '3':
WarningLevel = midlWarningLevel_3;
break;
case '4':
WarningLevel = midlWarningLevel_4;
break;
default:
- return FALSE;
+ found = FALSE;
}
}
break;
}
+ if( !found )
+ warn_msg( WarnLogic, "Could not parse MIDL option: %s", option );
return TRUE;
}
// VCLibrarianTool --------------------------------------------------
VCLibrarianTool::VCLibrarianTool()
: IgnoreAllDefaultLibraries( unset ),
SuppressStartupBanner( _True )
{
}
QTextStream &operator<<( QTextStream &strm, const VCLibrarianTool &tool )
{
strm << _begTool3;
strm << SPair( _ToolName, QString( "VCLibrarianTool" ) );
strm << XPair( _AdditionalDependencies4, tool.AdditionalDependencies );
strm << XPair( _AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories );
- strm << XPair( _AdditionalOptions, tool.AdditionalOptions );
+ strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " );
strm << XPair( _ExportNamedFunctions, tool.ExportNamedFunctions );
strm << XPair( _ForceSymbolReferences, tool.ForceSymbolReferences );
strm << TPair( _IgnoreAllDefaultLibraries, tool.IgnoreAllDefaultLibraries );
strm << XPair( _IgnoreDefaultLibraryNames, tool.IgnoreDefaultLibraryNames );
strm << SPair( _ModuleDefinitionFile, tool.ModuleDefinitionFile );
strm << SPair( _OutputFile, tool.OutputFile );
strm << TPair( _SuppressStartupBanner, tool.SuppressStartupBanner );
strm << "/>";
return strm;
}
// VCCustomBuildTool ------------------------------------------------
VCCustomBuildTool::VCCustomBuildTool()
{
ToolName = "VCCustomBuildTool";
}
QTextStream &operator<<( QTextStream &strm, const VCCustomBuildTool &tool )
{
strm << _begTool3;
strm << SPair( _ToolName, tool.ToolName );
strm << XPair( _AdditionalDependencies4, tool.AdditionalDependencies, ";" );
strm << SPair( _CommandLine4, tool.CommandLine );
strm << SPair( _Description4, tool.Description );
strm << SPair( _Outputs4, tool.Outputs );
strm << SPair( _ToolPath, tool.ToolPath );
strm << "/>";
return strm;
}
// VCResourceCompilerTool -------------------------------------------
VCResourceCompilerTool::VCResourceCompilerTool()
: Culture( rcUseDefault ),
IgnoreStandardIncludePath( unset ),
ShowProgress( linkProgressNotSet )
{
PreprocessorDefinitions = "NDEBUG";
}
QTextStream &operator<<( QTextStream &strm, const VCResourceCompilerTool &tool )
{
strm << _begTool3;
strm << _VCResourceCompilerToolName;
strm << SPair( _ToolPath, tool.ToolPath );
strm << XPair( _AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories );
- strm << XPair( _AdditionalOptions, tool.AdditionalOptions );
+ strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " );
if ( tool.Culture != rcUseDefault ) strm << EPair( _Culture, tool.Culture );
strm << XPair( _FullIncludePath, tool.FullIncludePath );
strm << TPair( _IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath );
strm << XPair( _PreprocessorDefinitions, tool.PreprocessorDefinitions );
strm << SPair( _ResourceOutputFileName, tool.ResourceOutputFileName );
if ( tool.ShowProgress != linkProgressNotSet ) strm << EPair( _ShowProgress, tool.ShowProgress );
strm << "/>";
return strm;
}
// VCEventTool -------------------------------------------------
QTextStream &operator<<( QTextStream &strm, const VCEventTool &tool )
{
strm << _begTool3;
strm << SPair( _ToolName, tool.ToolName );
strm << SPair( _ToolPath, tool.ToolPath );
strm << SPair( _CommandLine4, tool.CommandLine );
strm << SPair( _Description4, tool.Description );
strm << TPair( _ExcludedFromBuild, tool.ExcludedFromBuild );
strm << "/>";
return strm;
}
// VCPostBuildEventTool ---------------------------------------------
@@ -1830,106 +1846,127 @@ void VCFilter::generateMOC( QTextStream &strm, QString str ) const
strm << _Name5;
strm << Config->Name;
strm << "\">";
strm << _begTool5;
strm << _VCCustomBuildTool;
strm << _Description6;
strm << "Moc'ing " << str << "...\"";
strm << _CommandLine6;
strm << mocApp;
strm << " " << str << " -o " << mocOutput << "\"";
strm << _AdditionalDependencies6;
strm << mocApp << "\"";
strm << _Outputs6;
strm << mocOutput << "\"";
strm << "/>";
strm << _endFileConfiguration;
}
void VCFilter::generateUIC( QTextStream &strm, const QString& str ) const
{
QString uicApp = Project->var("QMAKE_UIC");
QString mocApp = Project->var( "QMAKE_MOC" );
QString fname = str.section( '\\', -1 );
QString mocDir = Project->var( "MOC_DIR" );
+ QString uiDir = Project->var( "UI_DIR" );
+ QString uiHeaders;
+ QString uiSources;
+
+ // Determining the paths for the output files.
+ int slash = str.findRev( '\\' );
+ QString pname = ( slash != -1 ) ? str.left( slash+1 ) : QString( ".\\" );
+ if( !uiDir.isEmpty() ) {
+ uiHeaders = uiDir;
+ uiSources = uiDir;
+ } else {
+ uiHeaders = Project->var( "UI_HEADERS_DIR" );
+ uiSources = Project->var( "UI_SOURCES_DIR" );
+ if( uiHeaders.isEmpty() )
+ uiHeaders = pname;
+ if( uiSources.isEmpty() )
+ uiSources = pname;
+ }
+ if( !uiHeaders.endsWith( "\\" ) )
+ uiHeaders += "\\";
+ if( !uiSources.endsWith( "\\" ) )
+ uiSources += "\\";
+
+ // Determine the file name.
int dot = fname.findRev( '.' );
- if( dot != -1 )
+ if( dot != -1 )
fname.truncate( dot );
- int slash = str.findRev( '\\' );
- QString pname = ( slash != -1 ) ? str.left( slash+1 ) : QString(".\\");
-
strm << _begFileConfiguration;
strm << _Name5;
strm << Config->Name;
strm << "\">";
strm << _begTool5;
strm << _VCCustomBuildTool;
strm << _Description6;
strm << "Uic'ing " << str << "...\"";
strm << _CommandLine6;
- strm << uicApp << " " << str << " -o " << pname << fname << ".h &amp;&amp; "; // Create .h from .ui file
- strm << uicApp << " " << str << " -i " << fname << ".h -o " << pname << fname << ".cpp &amp;&amp; "; // Create .cpp from .ui file
- strm << mocApp << " " << pname << fname << ".h -o " << mocDir << "moc_" << fname << ".cpp\"";
+ strm << uicApp << " " << str << " -o " << uiHeaders << fname << ".h &amp;&amp; "; // Create .h from .ui file
+ strm << uicApp << " " << str << " -i " << fname << ".h -o " << uiSources << fname << ".cpp &amp;&amp; "; // Create .cpp from .ui file
+ strm << mocApp << " " << uiHeaders << fname << ".h -o " << mocDir << "moc_" << fname << ".cpp\"";
strm << _AdditionalDependencies6;
strm << mocApp << ";" << uicApp << "\"";
strm << _Outputs6;
- strm << pname << fname << ".h;" << pname << fname << ".cpp;" << mocDir << "moc_" << fname << ".cpp\"";
+ strm << uiHeaders << fname << ".h;" << uiSources << fname << ".cpp;" << mocDir << "moc_" << fname << ".cpp\"";
strm << "/>";
strm << _endFileConfiguration;
}
QTextStream &operator<<( QTextStream &strm, const VCFilter &tool )
{
if ( tool.Files.count() == 0 )
return strm;
strm << _begFilter;
strm << SPair( _Name3, tool.Name );
strm << TPair( _ParseFiles, tool.ParseFiles );
strm << SPair( _Filter, tool.Filter );
strm << ">";
for ( QStringList::ConstIterator it = tool.Files.begin(); it != tool.Files.end(); ++it ) {
strm << _begFile;
strm << SPair( _RelativePath, *it );
strm << ">";
if ( tool.CustomBuild == moc )
tool.generateMOC( strm, *it );
else if ( tool.CustomBuild == uic )
tool.generateUIC( strm, *it );
strm << _endFile;
}
strm << _endFilter;
return strm;
}
// VCProject --------------------------------------------------------
VCProject::VCProject()
{
- QUuid uniqueId;
#if defined(Q_WS_WIN32)
GUID guid;
+ QUuid uniqueId;
HRESULT h = CoCreateGuid( &guid );
if ( h == S_OK )
uniqueId = QUuid( guid );
ProjectGUID = uniqueId.toString();
#else
// Qt doesn't support GUID on other platforms yet
ProjectGUID = "";
#endif
}
QTextStream &operator<<( QTextStream &strm, const VCProject &tool )
{
strm << _xmlInit;
strm << _begVisualStudioProject;
strm << _ProjectType;
strm << SPair( _Version1, tool.Version );
strm << SPair( _Name1, tool.Name );
strm << SPair( _ProjectGUID, tool.ProjectGUID );
strm << SPair( _SccProjectName, tool.SccProjectName );
strm << SPair( _SccLocalPath, tool.SccLocalPath );
strm << ">";
strm << _begPlatforms;
strm << _begPlatform;
strm << SPair( _Name3, tool.PlatformName );
diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h
index 2d09280..1dca68d 100644
--- a/qmake/generators/win32/msvc_objectmodel.h
+++ b/qmake/generators/win32/msvc_objectmodel.h
@@ -19,133 +19,133 @@
** Licensees holding valid Qt Enterprise Edition licenses may use this
** file in accordance with the Qt Commercial License Agreement provided
** with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for QPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef __MSVC_OBJECTMODEL_H__
#define __MSVC_OBJECTMODEL_H__
#include "project.h"
#include <qstring.h>
#include <qstringlist.h>
/*
- This Object model is of course VERY simplyfied,
+ This Object model is of course VERY simplyfied,
and does not actually follow the original MSVC
object model. However, it fulfilles the basic
needs for qmake
*/
/*
- If a triState value is 'unset' then the
+ If a triState value is 'unset' then the
corresponding property is not in the output,
- forcing the tool to utilize default values.
+ forcing the tool to utilize default values.
False/True values will be in the output...
*/
enum customBuildCheck {
none,
moc,
uic,
lexyacc
};
enum triState {
unset = -1,
_False = 0,
_True = 1
};
enum addressAwarenessType {
addrAwareDefault,
addrAwareNoLarge,
addrAwareLarge
};
enum asmListingOption {
asmListingNone,
asmListingAssemblyOnly,
asmListingAsmMachineSrc,
asmListingAsmMachine,
asmListingAsmSrc
};
enum basicRuntimeCheckOption {
runtimeBasicCheckNone,
runtimeCheckStackFrame,
runtimeCheckUninitVariables,
runtimeBasicCheckAll
};
enum browseInfoOption {
brInfoNone,
- brAllInfo,
+ brAllInfo,
brNoLocalSymbols
};
enum callingConventionOption {
callConventionDefault = -1,
callConventionCDecl,
callConventionFastCall,
callConventionStdCall
};
enum charSet {
charSetNotSet,
charSetUnicode,
charSetMBCS
};
enum compileAsManagedOptions {
managedDefault = -1,
managedAssembly = 2
};
enum CompileAsOptions{
compileAsDefault,
compileAsC,
compileAsCPlusPlus
};
enum ConfigurationTypes {
typeUnknown = 0,
typeApplication = 1,
typeDynamicLibrary = 2,
typeStaticLibrary = 4,
typeGeneric = 10
};
enum debugOption {
debugDisabled,
debugOldStyleInfo,
debugLineInfoOnly,
debugEnabled,
- debugEditAndContinue
+ debugEditAndContinue
};
enum eAppProtectionOption {
eAppProtectUnchanged,
eAppProtectLow,
eAppProtectMedium,
- eAppProtectHigh
+ eAppProtectHigh
};
enum enumResourceLangID {
rcUseDefault = 0,
rcAfrikaans = 1078,
rcAlbanian = 1052,
rcArabicAlgeria = 5121,
rcArabicBahrain = 15361,
rcArabicEgypt = 3073,
rcArabicIraq = 2049,
rcArabicJordan = 11265,
rcArabicKuwait = 13313,
rcArabicLebanon = 12289,
rcArabicLibya = 4097,
rcArabicMorocco = 6145,
rcArabicOman = 8193,
rcArabicQatar = 16385,
rcArabicSaudi = 1025,
rcArabicSyria = 10241,
rcArabicTunisia = 7169,
rcArabicUnitedArabEmirates = 14337,
rcArabicYemen = 9217,
rcBasque = 1069,
rcBulgarian = 1026,
rcByelorussian = 1059,
@@ -210,229 +210,227 @@ enum enumResourceLangID {
rcSpanishDominicanRepublic = 7178,
rcSpanishEcuador = 12298,
rcSpanishGuatemala = 4106,
rcSpanishMexico = 2058,
rcSpanishModern = 3082,
rcSpanishPanama = 6154,
rcSpanishParaguay = 15370,
rcSpanishPeru = 10250,
rcSpanishTraditional = 1034,
rcSpanishUruguay = 14346,
rcSpanishVenezuela = 8202,
rcSwedish = 1053,
rcThai = 1054,
rcTurkish = 1055,
rcUkrainian = 1058,
rcUrdu = 1056
};
enum enumSccEvent {
eProjectInScc,
ePreDirtyNotification
};
enum favorSizeOrSpeedOption {
favorNone,
favorSpeed,
- favorSize
+ favorSize
};
enum genProxyLanguage {
genProxyNative,
genProxyManaged
};
enum inlineExpansionOption {
expandDisable,
expandOnlyInline,
expandAnySuitable
};
enum linkIncrementalType {
linkIncrementalDefault,
linkIncrementalNo,
- linkIncrementalYes
+ linkIncrementalYes
};
enum linkProgressOption {
linkProgressNotSet,
linkProgressAll,
- linkProgressLibs
+ linkProgressLibs
};
enum machineTypeOption {
machineNotSet,
machineX86
};
enum midlCharOption {
midlCharUnsigned,
midlCharSigned,
midlCharAscii7
};
enum midlErrorCheckOption {
midlEnableCustom,
midlDisableAll,
- midlEnableAll
+ midlEnableAll
};
enum midlStructMemberAlignOption {
midlAlignNotSet,
midlAlignSingleByte,
midlAlignTwoBytes,
midlAlignFourBytes,
midlAlignEightBytes,
midlAlignSixteenBytes
};
enum midlTargetEnvironment {
midlTargetNotSet,
midlTargetWin32,
midlTargetWin64
};
enum midlWarningLevelOption {
midlWarningLevel_0,
midlWarningLevel_1,
midlWarningLevel_2,
midlWarningLevel_3,
- midlWarningLevel_4
+ midlWarningLevel_4
};
enum optFoldingType {
optFoldingDefault,
optNoFolding,
optFolding
};
enum optimizeOption {
optimizeDisabled,
optimizeMinSpace,
optimizeMaxSpeed,
optimizeFull,
- optimizeCustom
+ optimizeCustom
};
enum optRefType {
optReferencesDefault,
optNoReferences,
optReferences
};
enum optWin98Type {
optWin98Default,
optWin98No,
optWin98Yes
};
enum pchOption {
pchNone,
pchCreateUsingSpecific,
pchGenerateAuto,
- pchUseUsingSpecific
+ pchUseUsingSpecific
};
enum preprocessOption {
preprocessNo,
preprocessYes,
- preprocessNoLineNumbers
+ preprocessNoLineNumbers
};
enum ProcessorOptimizeOption {
procOptimizeBlended,
procOptimizePentium,
- procOptimizePentiumProAndAbove
+ procOptimizePentiumProAndAbove
};
enum RemoteDebuggerType {
DbgLocal,
DbgRemote,
- DbgRemoteTCPIP
+ DbgRemoteTCPIP
};
enum runtimeLibraryOption {
rtMultiThreaded,
rtMultiThreadedDebug,
rtMultiThreadedDLL,
rtMultiThreadedDebugDLL,
rtSingleThreaded,
- rtSingleThreadedDebug
+ rtSingleThreadedDebug
};
enum structMemberAlignOption {
alignNotSet,
alignSingleByte,
alignTwoBytes,
alignFourBytes,
alignEightBytes,
- alignSixteenBytes
+ alignSixteenBytes
};
enum subSystemOption {
subSystemNotSet,
subSystemConsole,
subSystemWindows
};
enum termSvrAwarenessType {
termSvrAwareDefault,
termSvrAwareNo,
termSvrAwareYes
};
enum toolSetType {
toolSetUtility,
toolSetMakefile,
toolSetLinker,
toolSetLibrarian,
toolSetAll
};
enum TypeOfDebugger {
DbgNativeOnly,
DbgManagedOnly,
DbgMixed,
- DbgAuto
+ DbgAuto
};
enum useOfATL {
useATLNotSet,
useATLStatic,
- useATLDynamic
+ useATLDynamic
};
enum useOfMfc {
useMfcStdWin,
useMfcStatic,
- useMfcDynamic
+ useMfcDynamic
};
enum warningLevelOption {
warningLevel_0,
warningLevel_1,
warningLevel_2,
warningLevel_3,
warningLevel_4
};
class VCToolBase {
protected:
// Functions
VCToolBase(){};
- ~VCToolBase(){};
+ virtual ~VCToolBase(){}
virtual bool parseOption( const char* option ) = 0;
public:
- bool parseOptions( QStringList& options ) {
- bool result = TRUE;
- for ( QStringList::ConstIterator it=options.begin(); (it!=options.end()) && result; it++ )
- result = parseOption( (*it).latin1() );
- return result;
+ void parseOptions( QStringList& options ) {
+ for ( QStringList::ConstIterator it=options.begin(); (it!=options.end()); it++ )
+ parseOption( (*it).latin1() );
}
};
class VCConfiguration;
class VCProject;
class VCCLCompilerTool : public VCToolBase
{
public:
// Functions
VCCLCompilerTool();
- ~VCCLCompilerTool(){};
- virtual bool parseOption( const char* option );
-
+ virtual ~VCCLCompilerTool(){}
+ bool parseOption( const char* option );
+
// Variables
QStringList AdditionalIncludeDirectories;
QStringList AdditionalOptions;
QStringList AdditionalUsingDirectories;
QString AssemblerListingLocation;
asmListingOption AssemblerOutput;
basicRuntimeCheckOption BasicRuntimeChecks;
browseInfoOption BrowseInformation;
QString BrowseInformationFile;
triState BufferSecurityCheck;
callingConventionOption CallingConvention;
CompileAsOptions CompileAs;
compileAsManagedOptions CompileAsManaged;
triState CompileOnly;
debugOption DebugInformationFormat;
triState DefaultCharIsUnsigned;
triState Detect64BitPortabilityProblems;
triState DisableLanguageExtensions;
QStringList DisableSpecificWarnings;
triState EnableFiberSafeOptimizations;
triState EnableFunctionLevelLinking;
triState EnableIntrinsicFunctions;
triState ExceptionHandling;
triState ExpandAttributedSource;
@@ -459,50 +457,50 @@ public:
QString ProgramDataBaseFileName;
runtimeLibraryOption RuntimeLibrary;
triState RuntimeTypeInfo;
triState ShowIncludes;
triState SmallerTypeCheck;
triState StringPooling;
structMemberAlignOption StructMemberAlignment;
triState SuppressStartupBanner;
triState TreatWChar_tAsBuiltInType;
triState TurnOffAssemblyGeneration;
triState UndefineAllPreprocessorDefinitions;
QStringList UndefinePreprocessorDefinitions;
pchOption UsePrecompiledHeader;
triState WarnAsError;
warningLevelOption WarningLevel;
triState WholeProgramOptimization;
VCConfiguration* config;
};
class VCLinkerTool : public VCToolBase
{
public:
// Functions
VCLinkerTool();
- ~VCLinkerTool(){};
- virtual bool parseOption( const char* option );
+ virtual ~VCLinkerTool(){}
+ bool parseOption( const char* option );
// Variables
QStringList AdditionalDependencies;
QStringList AdditionalLibraryDirectories;
QStringList AdditionalOptions;
QStringList AddModuleNamesToAssembly;
QString BaseAddress;
QStringList DelayLoadDLLs;
optFoldingType EnableCOMDATFolding;
QString EntryPointSymbol;
QStringList ForceSymbolReferences;
QString FunctionOrder;
triState GenerateDebugInformation;
triState GenerateMapFile;
long HeapCommitSize;
long HeapReserveSize;
triState IgnoreAllDefaultLibraries;
QStringList IgnoreDefaultLibraryNames;
triState IgnoreEmbeddedIDL;
triState IgnoreImportLibrary;
QString ImportLibrary;
addressAwarenessType LargeAddressAware;
triState LinkDLL;
linkIncrementalType LinkIncremental;
@@ -524,243 +522,243 @@ public:
triState SetChecksum;
linkProgressOption ShowProgress;
long StackCommitSize;
long StackReserveSize;
QString StripPrivateSymbols; // Should be list?
subSystemOption SubSystem;
triState SupportUnloadOfDelayLoadedDLL;
triState SuppressStartupBanner;
triState SwapRunFromCD;
triState SwapRunFromNet;
machineTypeOption TargetMachine;
termSvrAwarenessType TerminalServerAware;
triState TurnOffAssemblyGeneration;
QString TypeLibraryFile;
long TypeLibraryResourceID;
QString Version;
VCConfiguration* config;
};
class VCMIDLTool : public VCToolBase
{
public:
// Functions
VCMIDLTool();
- ~VCMIDLTool(){};
- virtual bool parseOption( const char* option );
+ virtual ~VCMIDLTool(){}
+ bool parseOption( const char* option );
// Variables
QStringList AdditionalIncludeDirectories;
QStringList AdditionalOptions;
QStringList CPreprocessOptions;
midlCharOption DefaultCharType;
QString DLLDataFileName; // Should be list?
midlErrorCheckOption EnableErrorChecks;
triState ErrorCheckAllocations;
triState ErrorCheckBounds;
triState ErrorCheckEnumRange;
triState ErrorCheckRefPointers;
triState ErrorCheckStubData;
QStringList FullIncludePath;
triState GenerateStublessProxies;
triState GenerateTypeLibrary;
QString HeaderFileName;
triState IgnoreStandardIncludePath;
QString InterfaceIdentifierFileName;
triState MkTypLibCompatible;
QString OutputDirectory;
QStringList PreprocessorDefinitions;
QString ProxyFileName;
QString RedirectOutputAndErrors;
midlStructMemberAlignOption StructMemberAlignment;
triState SuppressStartupBanner;
midlTargetEnvironment TargetEnvironment;
QString TypeLibraryName;
QStringList UndefinePreprocessorDefinitions;
triState ValidateParameters;
triState WarnAsError;
midlWarningLevelOption WarningLevel;
VCConfiguration* config;
};
class VCLibrarianTool : public VCToolBase
{
public:
// Functions
VCLibrarianTool();
- ~VCLibrarianTool(){};
- virtual bool parseOption( const char* option ){ return FALSE; };
+ virtual ~VCLibrarianTool(){}
+ bool parseOption( const char* ){ return FALSE; };
// Variables
QStringList AdditionalDependencies;
QStringList AdditionalLibraryDirectories;
QStringList AdditionalOptions;
QStringList ExportNamedFunctions;
QStringList ForceSymbolReferences;
triState IgnoreAllDefaultLibraries;
QStringList IgnoreDefaultLibraryNames;
QString ModuleDefinitionFile;
QString OutputFile;
triState SuppressStartupBanner;
};
class VCCustomBuildTool : public VCToolBase
{
public:
// Functions
VCCustomBuildTool();
- ~VCCustomBuildTool(){};
- virtual bool parseOption( const char* option ){ return FALSE; };
+ virtual ~VCCustomBuildTool(){}
+ bool parseOption( const char* ){ return FALSE; };
// Variables
QStringList AdditionalDependencies;
QString CommandLine;
QString Description;
QString Outputs;
QString ToolName;
QString ToolPath;
};
class VCResourceCompilerTool : public VCToolBase
{
public:
// Functions
VCResourceCompilerTool();
- ~VCResourceCompilerTool(){};
- virtual bool parseOption( const char* option ){ return FALSE; };
+ virtual ~VCResourceCompilerTool(){}
+ bool parseOption( const char* ){ return FALSE; };
// Variables
QStringList AdditionalIncludeDirectories;
QStringList AdditionalOptions;
enumResourceLangID Culture;
QStringList FullIncludePath;
triState IgnoreStandardIncludePath;
QStringList PreprocessorDefinitions;
QString ResourceOutputFileName;
linkProgressOption ShowProgress;
QString ToolPath;
};
class VCEventTool : public VCToolBase
{
protected:
// Functions
VCEventTool() : ExcludedFromBuild( unset ){};
- ~VCEventTool(){};
- virtual bool parseOption( const char* option ){ return FALSE; };
+ virtual ~VCEventTool(){}
+ bool parseOption( const char* ){ return FALSE; };
public:
// Variables
QString CommandLine;
QString Description;
triState ExcludedFromBuild;
QString ToolName;
QString ToolPath;
};
-class VCPostBuildEventTool : public VCEventTool
+class VCPostBuildEventTool : public VCEventTool
{
public:
VCPostBuildEventTool();
- ~VCPostBuildEventTool(){};
+ ~VCPostBuildEventTool(){}
};
-class VCPreBuildEventTool : public VCEventTool
+class VCPreBuildEventTool : public VCEventTool
{
public:
VCPreBuildEventTool();
- ~VCPreBuildEventTool(){};
+ ~VCPreBuildEventTool(){}
};
-class VCPreLinkEventTool : public VCEventTool
+class VCPreLinkEventTool : public VCEventTool
{
public:
VCPreLinkEventTool();
- ~VCPreLinkEventTool(){};
+ ~VCPreLinkEventTool(){}
};
class VCConfiguration
{
public:
// Functions
VCConfiguration();
- ~VCConfiguration(){};
+ ~VCConfiguration(){}
// Variables
triState ATLMinimizesCRunTimeLibraryUsage;
triState BuildBrowserInformation;
charSet CharacterSet;
ConfigurationTypes ConfigurationType;
QString DeleteExtensionsOnClean;
QString ImportLibrary;
QString IntermediateDirectory;
QString Name;
QString OutputDirectory;
QString PrimaryOutput;
QString ProgramDatabase;
triState RegisterOutput;
useOfATL UseOfATL;
useOfMfc UseOfMfc;
triState WholeProgramOptimization;
// XML sub-parts
VCCLCompilerTool compiler;
VCLinkerTool linker;
VCLibrarianTool librarian;
VCCustomBuildTool custom;
VCMIDLTool idl;
VCPostBuildEventTool postBuild;
VCPreBuildEventTool preBuild;
VCPreLinkEventTool preLink;
VCResourceCompilerTool resource;
};
class VcprojGenerator;
class VCFilter
{
public:
// Functions
VCFilter();
- ~VCFilter(){};
+ ~VCFilter(){}
void generateMOC( QTextStream &strm, QString str ) const;
void generateUIC( QTextStream &strm, const QString& str ) const;
// Variables
QString Name;
QString Filter;
triState ParseFiles;
QStringList Files;
VcprojGenerator* Project;
VCConfiguration* Config;
customBuildCheck CustomBuild;
};
class VCProject
{
public:
// Functions
VCProject();
- ~VCProject(){};
+ ~VCProject(){}
// Variables
QString Name;
QString Version;
QString ProjectGUID;
QString SccProjectName;
QString SccLocalPath;
QString PlatformName;
// XML sub-parts
VCConfiguration Configuration;
VCFilter SourceFiles;
VCFilter HeaderFiles;
VCFilter MOCFiles;
VCFilter UICFiles;
VCFilter FormFiles;
VCFilter TranslationFiles;
VCFilter LexYaccFiles;
VCFilter ResourceFiles;
};
QTextStream &operator<<( QTextStream &, const VCCLCompilerTool & );
QTextStream &operator<<( QTextStream &, const VCLinkerTool & );
QTextStream &operator<<( QTextStream &, const VCMIDLTool & );
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index a2bb6e9..d2cbc31 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.cpp
@@ -1,208 +1,324 @@
/****************************************************************************
** $Id$
**
** Definition of VcprojGenerator class.
**
** Created : 970521
**
-** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
+** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
**
** This file is part of the network module of the Qt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.QPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid Qt Enterprise Edition licenses may use this
** file in accordance with the Qt Commercial License Agreement provided
** with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for QPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "msvc_vcproj.h"
#include "option.h"
#include <qdir.h>
-#include <stdlib.h>
#include <qregexp.h>
+#include <qdict.h>
+#include <quuid.h>
+#include <stdlib.h>
#if defined(Q_OS_WIN32)
#include <objbase.h>
+#ifndef GUID_DEFINED
+#define GUID_DEFINED
+typedef struct _GUID
+{
+ ulong Data1;
+ ushort Data2;
+ ushort Data3;
+ uchar Data4[8];
+} GUID;
+#endif
#endif
+// Flatfile Tags ----------------------------------------------------
+const char* _snlHeader = "Microsoft Visual Studio Solution File, Format Version 7.00";
+ // The following UUID _may_ change for later servicepacks...
+ // If so we need to search through the registry at
+ // HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.0\Projects
+ // to find the subkey that contains a "PossibleProjectExtension"
+ // containing "vcproj"...
+ // Use the hardcoded value for now so projects generated on other
+ // platforms are actually usable.
+const char* _snlMSVCvcprojGUID = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}";
+const char* _snlProjectBeg = "\nProject(\"";
+const char* _snlProjectMid = "\") = ";
+const char* _snlProjectEnd = "\nEndProject";
+const char* _snlGlobalBeg = "\nGlobal";
+const char* _snlGlobalEnd = "\nEndGlobal";
+const char* _snlSolutionConf = "\n\tGlobalSection(SolutionConfiguration) = preSolution"
+ "\n\t\tConfigName.0 = Release"
+ "\n\tEndGlobalSection";
+const char* _snlProjDepBeg = "\n\tGlobalSection(ProjectDependencies) = postSolution";
+const char* _snlProjDepEnd = "\n\tEndGlobalSection";
+const char* _snlProjConfBeg = "\n\tGlobalSection(ProjectConfiguration) = postSolution";
+const char* _snlProjConfTag1 = ".Release.ActiveCfg = Release|Win32";
+const char* _snlProjConfTag2 = ".Release.Build.0 = Release|Win32";
+const char* _snlProjConfEnd = "\n\tEndGlobalSection";
+const char* _snlExtSections = "\n\tGlobalSection(ExtensibilityGlobals) = postSolution"
+ "\n\tEndGlobalSection"
+ "\n\tGlobalSection(ExtensibilityAddIns) = postSolution"
+ "\n\tEndGlobalSection";
+// ------------------------------------------------------------------
+
VcprojGenerator::VcprojGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE)
{
}
/* \internal
Generates a project file for the given profile.
Options are either a Visual Studio projectfiles, or
- recursive projectfiles.. Maybe we can make .sln files
- someday?
+ solutionfiles by parsing recursive projectdirectories.
*/
bool VcprojGenerator::writeMakefile(QTextStream &t)
{
// Check if all requirements are fullfilled
if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) {
fprintf(stderr, "Project file not generated because all requirements not met:\n\t%s\n",
var("QMAKE_FAILED_REQUIREMENTS").latin1());
return TRUE;
}
- // Generate full project file
+ // Generate project file
if(project->first("TEMPLATE") == "vcapp" ||
project->first("TEMPLATE") == "vclib") {
debug_msg(1, "Generator: MSVC.NET: Writing project file" );
t << vcProject;
return TRUE;
- } else if(project->first("TEMPLATE") == "vcsubdirs") { // Generate recursive project
+ }
+ // Generate solution file
+ else if(project->first("TEMPLATE") == "vcsubdirs") {
debug_msg(1, "Generator: MSVC.NET: Writing solution file" );
writeSubDirs(t);
return TRUE;
}
return FALSE;
}
struct VcsolutionDepend {
+ QString uuid;
QString vcprojFile, orig_target, target;
+ ::target targetType;
QStringList dependencies;
};
+QUuid VcprojGenerator::increaseUUID( const QUuid &id )
+{
+ QUuid result( id );
+ Q_LONG dataFirst = (result.data4[0] << 24) +
+ (result.data4[1] << 16) +
+ (result.data4[2] << 8) +
+ result.data4[3];
+ Q_LONG dataLast = (result.data4[4] << 24) +
+ (result.data4[5] << 16) +
+ (result.data4[6] << 8) +
+ result.data4[7];
+
+ if ( !(dataLast++) )
+ dataFirst++;
+
+ result.data4[0] = uchar((dataFirst >> 24) & 0xff);
+ result.data4[1] = uchar((dataFirst >> 16) & 0xff);
+ result.data4[2] = uchar((dataFirst >> 8) & 0xff);
+ result.data4[3] = uchar( dataFirst & 0xff);
+ result.data4[4] = uchar((dataLast >> 24) & 0xff);
+ result.data4[5] = uchar((dataLast >> 16) & 0xff);
+ result.data4[6] = uchar((dataLast >> 8) & 0xff);
+ result.data4[7] = uchar( dataLast & 0xff);
+ return result;
+}
+
void VcprojGenerator::writeSubDirs(QTextStream &t)
{
if(project->first("TEMPLATE") == "subdirs") {
writeHeader(t);
Win32MakefileGenerator::writeSubDirs(t);
return;
}
- QPtrList<VcsolutionDepend> solution_depends;
- solution_depends.setAutoDelete(TRUE);
+ t << _snlHeader;
+ QUuid solutionGUID;
+#if defined(Q_WS_WIN32)
+ GUID guid;
+ HRESULT h = CoCreateGuid( &guid );
+ if ( h == S_OK )
+ solutionGUID = QUuid( guid );
+#else
+ // Qt doesn't support GUID on other platforms yet,
+ // so we use the all-zero uuid, and increase that.
+#endif
+
+
+ QDict<VcsolutionDepend> solution_depends;
+ QPtrList<VcsolutionDepend> solution_cleanup;
+ solution_cleanup.setAutoDelete(TRUE);
QStringList subdirs = project->variables()["SUBDIRS"];
QString oldpwd = QDir::currentDirPath();
for(QStringList::Iterator it = subdirs.begin(); it != subdirs.end(); ++it) {
QFileInfo fi(Option::fixPathToLocalOS((*it), TRUE));
if(fi.exists()) {
if(fi.isDir()) {
QString profile = (*it);
if(!profile.endsWith(Option::dir_sep))
profile += Option::dir_sep;
profile += fi.baseName() + ".pro";
subdirs.append(profile);
} else {
QMakeProject tmp_proj;
QString dir = fi.dirPath(), fn = fi.fileName();
if(!dir.isEmpty()) {
if(!QDir::setCurrent(dir))
fprintf(stderr, "Cannot find directory: %s\n", dir.latin1());
}
if(tmp_proj.read(fn, oldpwd)) {
if(tmp_proj.first("TEMPLATE") == "vcsubdirs") {
QStringList tmp_subdirs = fileFixify(tmp_proj.variables()["SUBDIRS"]);
subdirs += tmp_subdirs;
- } else if(tmp_proj.first("TEMPLATE") == "vcapp" ||
- tmp_proj.first("TEMPLATE") == "vclib") {
- QString vcproj = fi.baseName() + project->first("VCPROJ_EXTENSION");
- if(QFile::exists(vcproj) || 1) {
- VcprojGenerator tmp_dsp(&tmp_proj);
- tmp_dsp.setNoIO(TRUE);
- tmp_dsp.init();
- if(Option::debug_level) {
- QMap<QString, QStringList> &vars = tmp_proj.variables();
- for(QMap<QString, QStringList>::Iterator it = vars.begin();
- it != vars.end(); ++it) {
- if(it.key().left(1) != "." && !it.data().isEmpty())
- debug_msg(1, "%s: %s === %s", fn.latin1(), it.key().latin1(),
- it.data().join(" :: ").latin1());
- }
+ } else if(tmp_proj.first("TEMPLATE") == "vcapp" || tmp_proj.first("TEMPLATE") == "vclib") {
+ // Initialize a 'fake' project to get the correct variables
+ // and to be able to extract all the dependencies
+ VcprojGenerator tmp_vcproj(&tmp_proj);
+ tmp_vcproj.setNoIO(TRUE);
+ tmp_vcproj.init();
+ if(Option::debug_level) {
+ QMap<QString, QStringList> &vars = tmp_proj.variables();
+ for(QMap<QString, QStringList>::Iterator it = vars.begin();
+ it != vars.end(); ++it) {
+ if(it.key().left(1) != "." && !it.data().isEmpty())
+ debug_msg(1, "%s: %s === %s", fn.latin1(), it.key().latin1(),
+ it.data().join(" :: ").latin1());
}
- VcsolutionDepend *newDep = new VcsolutionDepend;
- newDep->vcprojFile = fileFixify(vcproj);
- newDep->orig_target = tmp_proj.first("QMAKE_ORIG_TARGET");
- newDep->target = tmp_proj.first("TARGET").section(Option::dir_sep, -1);
- if(newDep->target.endsWith(".dll"))
- newDep->target = newDep->target.left(newDep->target.length()-3) + "lib";
- if(!tmp_proj.isEmpty("FORMS"))
- newDep->dependencies << "uic.exe";
- {
- QStringList where("QMAKE_LIBS");
- if(!tmp_proj.isEmpty("QMAKE_INTERNAL_PRL_LIBS"))
- where = tmp_proj.variables()["QMAKE_INTERNAL_PRL_LIBS"];
- for(QStringList::iterator wit = where.begin();
- wit != where.end(); ++wit) {
- QStringList &l = tmp_proj.variables()[(*wit)];
- for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
- QString opt = (*it);
- if(!opt.startsWith("/")) //Not a switch
- newDep->dependencies << opt.section(Option::dir_sep, -1);
- }
+ }
+
+ // We assume project filename is [QMAKE_ORIG_TARGET].vcproj
+ QString vcproj = fixFilename(tmp_vcproj.project->first("QMAKE_ORIG_TARGET")) + project->first("VCPROJ_EXTENSION");
+
+ // If file doesn't exsist, then maybe the users configuration
+ // doesn't allow it to be created. Skip to next...
+ if(!QFile::exists(QDir::currentDirPath() + Option::dir_sep + vcproj)) {
+ qDebug( "Ignored (not found) '%s'", QString(QDir::currentDirPath() + Option::dir_sep + vcproj).latin1() );
+ goto nextfile; // # Dirty!
+ }
+
+ VcsolutionDepend *newDep = new VcsolutionDepend;
+ newDep->vcprojFile = fileFixify(vcproj);
+ newDep->orig_target = tmp_proj.first("QMAKE_ORIG_TARGET");
+ newDep->target = tmp_proj.first("TARGET").section(Option::dir_sep, -1);
+ newDep->targetType = tmp_vcproj.projectTarget;
+ {
+ static QUuid uuid = solutionGUID;
+ uuid = increaseUUID( uuid );
+ newDep->uuid = uuid.toString().upper();
+ }
+ if(newDep->target.endsWith(".dll"))
+ newDep->target = newDep->target.left(newDep->target.length()-3) + "lib";
+ if(!tmp_proj.isEmpty("FORMS"))
+ newDep->dependencies << "uic.exe";
+ {
+ QStringList where("QMAKE_LIBS");
+ if(!tmp_proj.isEmpty("QMAKE_INTERNAL_PRL_LIBS"))
+ where = tmp_proj.variables()["QMAKE_INTERNAL_PRL_LIBS"];
+ for(QStringList::iterator wit = where.begin();
+ wit != where.end(); ++wit) {
+ QStringList &l = tmp_proj.variables()[(*wit)];
+ for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
+ QString opt = (*it);
+ if(!opt.startsWith("/")) //Not a switch
+ newDep->dependencies << opt.section(Option::dir_sep, -1);
}
}
- solution_depends.append(newDep);
}
+ solution_cleanup.append(newDep);
+ solution_depends.insert(newDep->target, newDep);
+ {
+ QRegExp libVersion("[0-9]{3,3}\\.lib$");
+ if(libVersion.search(newDep->target) != -1)
+ solution_depends.insert(newDep->target.left(newDep->target.length() -
+ libVersion.matchedLength()) + ".lib", newDep);
+ }
+ t << _snlProjectBeg << _snlMSVCvcprojGUID << _snlProjectMid
+ << "\"" << newDep->orig_target << "\", \"" << newDep->vcprojFile
+ << "\", \"" << newDep->uuid << "\"";
+ t << _snlProjectEnd;
}
}
+nextfile:
QDir::setCurrent(oldpwd);
}
}
}
-
- VcsolutionDepend *vc;
- QMap<QString, int> uuids;
- QRegExp libVersion("[0-9]{3,3}\\.lib$");
- for(vc = solution_depends.first(); vc; vc = solution_depends.next()) {
- static int uuid = 666;
- uuids.insert(vc->target, uuid);
- if(libVersion.match(vc->target) != -1)
- uuids.insert(vc->target.left(vc->target.length() - libVersion.matchedLength()) + ".lib",
- uuid);
- t << "\"" << vc->orig_target << "\" \"" << vc->vcprojFile << "\" { " << uuid << " }" << endl;
- uuid++;
- }
- for(vc = solution_depends.first(); vc; vc = solution_depends.next()) {
- int uuid = uuids[vc->target], cnt = 0;
- for(QStringList::iterator dit = vc->dependencies.begin(); dit != vc->dependencies.end(); ++dit) {
- if(uuids.contains((*dit)))
- t << uuid << "." << cnt++ << " = " << uuids[(*dit)] << endl;
+ t << _snlGlobalBeg;
+ t << _snlSolutionConf;
+ t << _snlProjDepBeg;
+ for(solution_cleanup.first(); solution_cleanup.current(); solution_cleanup.next()) {
+ int cnt = 0;
+ for(QStringList::iterator dit = solution_cleanup.current()->dependencies.begin();
+ dit != solution_cleanup.current()->dependencies.end();
+ ++dit) {
+ VcsolutionDepend *vc;
+ if((vc=solution_depends[*dit])) {
+ if(solution_cleanup.current()->targetType != StaticLib || vc->targetType == Application)
+ t << "\n\t\t" << solution_cleanup.current()->uuid << "." << cnt++ << " = " << vc->uuid;
+ }
}
}
+ t << _snlProjDepEnd;
+ t << _snlProjConfBeg;
+ for(solution_cleanup.first(); solution_cleanup.current(); solution_cleanup.next()) {
+ t << "\n\t\t" << solution_cleanup.current()->uuid << _snlProjConfTag1;
+ t << "\n\t\t" << solution_cleanup.current()->uuid << _snlProjConfTag2;
+ }
+ t << _snlProjConfEnd;
+ t << _snlExtSections;
+ t << _snlGlobalEnd;
}
// ------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------
void VcprojGenerator::init()
{
if( init_flag )
return;
if(project->first("TEMPLATE") == "vcsubdirs") { //too much work for subdirs
init_flag = TRUE;
return;
}
debug_msg(1, "Generator: MSVC.NET: Initializing variables" );
/*
// Once to be nice and clean code...
// Wouldn't life be great?
// Are we building Qt?
bool is_qt =
( project->first("TARGET") == "qt"QTDLL_POSTFIX ||
project->first("TARGET") == "qt-mt"QTDLL_POSTFIX );
@@ -285,219 +401,238 @@ void VcprojGenerator::initConfiguration()
// Initialize XML sub elements
// - Do this first since main configuration elements may need
// - to know of certain compiler/linker options
initCompilerTool();
if ( projectTarget == StaticLib )
initLibrarianTool();
else
initLinkerTool();
initIDLTool();
// Own elements -----------------------------
QString temp = project->first("BuildBrowserInformation");
switch ( projectTarget ) {
case SharedLib:
vcProject.Configuration.ConfigurationType = typeDynamicLibrary;
break;
case StaticLib:
vcProject.Configuration.ConfigurationType = typeStaticLibrary;
break;
case Application:
default:
vcProject.Configuration.ConfigurationType = typeApplication;
break;
}
- vcProject.Configuration.Name = ( project->isActiveConfig( "release" ) ? "Release|" : "Debug|" );
+ vcProject.Configuration.Name = ( project->isActiveConfig( "debug" ) ? "Debug|" : "Release|" );
vcProject.Configuration.Name += ( vcProject.Configuration.idl.TargetEnvironment == midlTargetWin64 ? "Win64" : "Win32" );
vcProject.Configuration.ATLMinimizesCRunTimeLibraryUsage = ( project->first("ATLMinimizesCRunTimeLibraryUsage").isEmpty() ? _False : _True );
- vcProject.Configuration.BuildBrowserInformation = triState( temp.isEmpty() ? unset : temp.toShort() );
+ vcProject.Configuration.BuildBrowserInformation = triState( temp.isEmpty() ? (short)unset : temp.toShort() );
temp = project->first("CharacterSet");
- vcProject.Configuration.CharacterSet = charSet( temp.isEmpty() ? charSetNotSet : temp.toShort() );
+ vcProject.Configuration.CharacterSet = charSet( temp.isEmpty() ? (short)charSetNotSet : temp.toShort() );
vcProject.Configuration.DeleteExtensionsOnClean = project->first("DeleteExtensionsOnClean");
vcProject.Configuration.ImportLibrary = vcProject.Configuration.linker.ImportLibrary;
vcProject.Configuration.IntermediateDirectory = project->first("OBJECTS_DIR");
// temp = (projectTarget == StaticLib) ? project->first("DESTDIR"):project->first("DLLDESTDIR");
vcProject.Configuration.OutputDirectory = "."; //( temp.isEmpty() ? QString(".") : temp );
vcProject.Configuration.PrimaryOutput = project->first("PrimaryOutput");
vcProject.Configuration.WholeProgramOptimization = vcProject.Configuration.compiler.WholeProgramOptimization;
temp = project->first("UseOfATL");
if ( !temp.isEmpty() )
vcProject.Configuration.UseOfATL = useOfATL( temp.toShort() );
temp = project->first("UseOfMfc");
if ( !temp.isEmpty() )
vcProject.Configuration.UseOfMfc = useOfMfc( temp.toShort() );
// Configuration does not need parameters from
// these sub XML items;
initCustomBuildTool();
initPreBuildEventTools();
initPostBuildEventTools();
initPreLinkEventTools();
}
void VcprojGenerator::initCompilerTool()
{
QString placement = project->first("OBJECTS_DIR");
if ( placement.isEmpty() )
- placement = project->isActiveConfig( "release" )? ".\\Release\\":".\\Debug\\";
+ placement = ".\\";
vcProject.Configuration.compiler.AssemblerListingLocation = placement ;
vcProject.Configuration.compiler.ProgramDataBaseFileName = placement ;
vcProject.Configuration.compiler.ObjectFile = placement ;
vcProject.Configuration.compiler.PrecompiledHeaderFile = placement + project->first("QMAKE_ORIG_TARGET") + ".pch";
if ( project->isActiveConfig("debug") ){
// Debug version
vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS"] );
vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_DEBUG"] );
if ( project->isActiveConfig("thread") ) {
if ( (projectTarget == Application) || (projectTarget == StaticLib) )
vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT_DBG"] );
else
vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"] );
} else {
vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_ST_DBG"] );
}
} else {
// Release version
vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS"] );
vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_RELEASE"] );
vcProject.Configuration.compiler.PreprocessorDefinitions += "QT_NO_DEBUG";
+ vcProject.Configuration.compiler.PreprocessorDefinitions += "NDEBUG";
if ( project->isActiveConfig("thread") ) {
if ( (projectTarget == Application) || (projectTarget == StaticLib) )
vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT"] );
else
vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT_DLL"] );
} else {
vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_ST"] );
}
}
// Common for both release and debug
if ( project->isActiveConfig("warn_off") )
vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_WARN_OFF"] );
- else
+ else if ( project->isActiveConfig("warn_on") )
vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_WARN_ON"] );
if ( project->isActiveConfig("windows") )
vcProject.Configuration.compiler.PreprocessorDefinitions += project->variables()["MSVCPROJ_WINCONDEF"];
// Can this be set for ALL configs?
// If so, use qmake.conf!
if ( projectTarget == SharedLib )
vcProject.Configuration.compiler.PreprocessorDefinitions += "_WINDOWS";
vcProject.Configuration.compiler.PreprocessorDefinitions += project->variables()["DEFINES"];
vcProject.Configuration.compiler.PreprocessorDefinitions += project->variables()["PRL_EXPORT_DEFINES"];
vcProject.Configuration.compiler.parseOptions( project->variables()["MSVCPROJ_INCPATH"] );
}
void VcprojGenerator::initLibrarianTool()
{
vcProject.Configuration.librarian.OutputFile = project->first( "DESTDIR" );
if( vcProject.Configuration.librarian.OutputFile.isEmpty() )
vcProject.Configuration.librarian.OutputFile = ".\\";
if( !vcProject.Configuration.librarian.OutputFile.endsWith("\\") )
vcProject.Configuration.librarian.OutputFile += '\\';
vcProject.Configuration.librarian.OutputFile += project->first("MSVCPROJ_TARGET");
}
void VcprojGenerator::initLinkerTool()
{
vcProject.Configuration.linker.parseOptions( project->variables()["MSVCPROJ_LFLAGS"] );
vcProject.Configuration.linker.AdditionalDependencies += project->variables()["MSVCPROJ_LIBS"];
switch ( projectTarget ) {
- case Application:
- vcProject.Configuration.linker.OutputFile = project->first( "DESTDIR" );
- break;
- case SharedLib:
- vcProject.Configuration.linker.parseOptions( project->variables()["MSVCPROJ_LIBOPTIONS"] );
- vcProject.Configuration.linker.OutputFile = project->first( "DLLDESTDIR" );
- break;
+ case Application:
+ vcProject.Configuration.linker.OutputFile = project->first( "DESTDIR" );
+ break;
+ case SharedLib:
+ vcProject.Configuration.linker.parseOptions( project->variables()["MSVCPROJ_LIBOPTIONS"] );
+ vcProject.Configuration.linker.OutputFile = project->first( "DLLDESTDIR" );
+ break;
+ case StaticLib: //unhandled - added to remove warnings..
+ break;
}
if( vcProject.Configuration.linker.OutputFile.isEmpty() )
vcProject.Configuration.linker.OutputFile = ".\\";
if( !vcProject.Configuration.linker.OutputFile.endsWith("\\") )
vcProject.Configuration.linker.OutputFile += '\\';
vcProject.Configuration.linker.OutputFile += project->first("MSVCPROJ_TARGET");
vcProject.Configuration.linker.ProgramDatabaseFile = project->first("OBJECTS_DIR") + project->first("QMAKE_ORIG_TARGET") + ".pdb";
if ( project->isActiveConfig("debug") ){
vcProject.Configuration.linker.parseOptions( project->variables()["QMAKE_LFLAGS_DEBUG"] );
} else {
vcProject.Configuration.linker.parseOptions( project->variables()["QMAKE_LFLAGS_RELEASE"] );
}
if ( project->isActiveConfig("dll") ){
vcProject.Configuration.linker.parseOptions( project->variables()["QMAKE_LFLAGS_QT_DLL"] );
}
if ( project->isActiveConfig("console") ){
vcProject.Configuration.linker.parseOptions( project->variables()["QMAKE_LFLAGS_CONSOLE"] );
} else {
vcProject.Configuration.linker.parseOptions( project->variables()["QMAKE_LFLAGS_WINDOWS"] );
}
}
void VcprojGenerator::initIDLTool()
{
}
void VcprojGenerator::initCustomBuildTool()
{
}
void VcprojGenerator::initPreBuildEventTools()
{
QString collectionName = project->first("QMAKE_IMAGE_COLLECTION");
if( !collectionName.isEmpty() ) {
QStringList& list = project->variables()["IMAGES"];
vcProject.Configuration.preBuild.Description = "Generate imagecollection";
//vcProject.Configuration.preBuild.AdditionalDependencies += list;
- vcProject.Configuration.preBuild.CommandLine = project->first("QMAKE_UIC") + " -embed " + project->first("QMAKE_ORIG_TARGET") + " " + list.join(" ") + " -o " + collectionName;
+
+ QFile imgs( ".imgcol" );
+ imgs.open( IO_WriteOnly );
+ QTextStream s( &imgs );
+ QStringList::ConstIterator it = list.begin();
+ while( it!=list.end() ) {
+ s << *it << " ";
+ it++;
+ }
+
+ vcProject.Configuration.preBuild.CommandLine = project->first("QMAKE_UIC") + " -embed " + project->first("QMAKE_ORIG_TARGET") + " -f .imgcol -o " + collectionName;
//vcProject.Configuration.preBuild.Outputs = collectionName;
}
}
void VcprojGenerator::initPostBuildEventTools()
{
+ if ( !project->variables()["QMAKE_POST_LINK"].isEmpty() ) {
+ vcProject.Configuration.postBuild.Description = var("QMAKE_POST_LINK");
+ vcProject.Configuration.postBuild.CommandLine = var("QMAKE_POST_LINK");
+ }
if( project->isActiveConfig( "activeqt" ) ) {
QString name = project->first( "QMAKE_ORIG_TARGET" );
QString nameext = project->first( "TARGET" );
QString objdir = project->first( "OBJECTS_DIR" );
QString idc = project->first( "QMAKE_IDC" );
vcProject.Configuration.postBuild.Description = "Finalizing ActiveQt server...";
+ if ( !vcProject.Configuration.postBuild.CommandLine.isEmpty() )
+ vcProject.Configuration.postBuild.CommandLine += " &amp;&amp; ";
if( project->isActiveConfig( "dll" ) ) { // In process
- vcProject.Configuration.postBuild.CommandLine =
+ vcProject.Configuration.postBuild.CommandLine +=
// call idc to generate .idl file from .dll
idc + " " + vcProject.Configuration.OutputDirectory + "\\" + nameext + " -idl " + objdir + name + ".idl -version 1.0 &amp;&amp; " +
// call midl to create implementations of the .idl file
project->first( "QMAKE_IDL" ) + " " + objdir + name + ".idl /nologo /o " + objdir + name + ".midl /tlb " + objdir + name + ".tlb /iid " + objdir +
"dump.midl /dlldata " + objdir + "dump.midl /cstub " + objdir + "dump.midl /header " + objdir + "dump.midl /proxy " + objdir + "dump.midl /sstub " +
objdir + "dump.midl &amp;&amp; " +
// call idc to replace tlb...
idc + " " + vcProject.Configuration.OutputDirectory + "\\" + nameext + " /tlb " + objdir + name + ".tlb &amp;&amp; " +
// register server
idc + " " + vcProject.Configuration.OutputDirectory + "\\" + nameext + " /regserver";
} else { // out of process
vcProject.Configuration.postBuild.CommandLine =
// call application to dump idl
vcProject.Configuration.OutputDirectory + "\\" + nameext + " -dumpidl " + objdir + name + ".idl -version 1.0 &amp;&amp; " +
// call midl to create implementations of the .idl file
project->first( "QMAKE_IDL" ) + " " + objdir + name + ".idl /nologo /o " + objdir + name + ".midl /tlb " + objdir + name + ".tlb /iid " + objdir +
"dump.midl /dlldata " + objdir + "dump.midl /cstub " + objdir + "dump.midl /header " + objdir + "dump.midl /proxy " + objdir + "dump.midl /sstub " +
objdir + "dump.midl &amp;&amp; " +
// call idc to replace tlb...
idc + " " + vcProject.Configuration.OutputDirectory + "\\" + nameext + " /tlb " + objdir + name + ".tlb &amp;&amp; " +
// call app to register
vcProject.Configuration.OutputDirectory + "\\" + nameext + " -regserver";
}
}
@@ -581,75 +716,82 @@ void VcprojGenerator::initLexYaccFiles()
vcProject.LexYaccFiles.Name = "Lex / Yacc Files";
vcProject.LexYaccFiles.ParseFiles = _False;
vcProject.LexYaccFiles.Filter = "l;y";
vcProject.LexYaccFiles.Files += project->variables()["LEXSOURCES"];
vcProject.LexYaccFiles.Files += project->variables()["YACCSOURCES"];
vcProject.LexYaccFiles.Files.sort();
vcProject.LexYaccFiles.Project = this;
vcProject.LexYaccFiles.CustomBuild = lexyacc;
}
void VcprojGenerator::initResourceFiles()
{
vcProject.ResourceFiles.Name = "Resources";
vcProject.ResourceFiles.ParseFiles = _False;
vcProject.ResourceFiles.Filter = "cpp;ico;png;jpg;jpeg;gif;xpm;bmp;rc;ts";
vcProject.ResourceFiles.Files += project->variables()["RC_FILE"];
vcProject.ResourceFiles.Files += project->variables()["QMAKE_IMAGE_COLLECTION"];
vcProject.ResourceFiles.Files += project->variables()["IMAGES"];
vcProject.ResourceFiles.Files += project->variables()["IDLSOURCES"];
vcProject.ResourceFiles.Files.sort();
vcProject.ResourceFiles.Project = this;
vcProject.ResourceFiles.CustomBuild = none;
}
-/*
-// $$MSVCPROJ_IDLSOURCES ---------------------------------------------
-void VcprojGenerator::writeIDLs( QTextStream &t )
-{
- QStringList &l = project->variables()["MSVCPROJ_IDLSOURCES"];
- for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
- t << "# Begin Source File" << endl << endl;
- t << "SOURCE=" << (*it) << endl;
- t << "# PROP Exclude_From_Build 1" << endl;
- t << "# End Source File" << endl << endl;
- }
- debug_msg(3, "Generator: MSVC.NET: Added IDLs" );
-}
-*/
-
/* \internal
Sets up all needed variables from the environment and all the different caches and .conf files
*/
void VcprojGenerator::initOld()
{
if( init_flag )
return;
init_flag = TRUE;
QStringList::Iterator it;
+ if ( project->isActiveConfig("stl") ) {
+ project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_ON"];
+ project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_ON"];
+ } else {
+ project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_OFF"];
+ project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_OFF"];
+ }
+ if ( project->isActiveConfig("exceptions") ) {
+ project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_ON"];
+ project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_ON"];
+ } else {
+ project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_OFF"];
+ project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_OFF"];
+ }
+ if ( project->isActiveConfig("rtti") ) {
+ project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_ON"];
+ project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_ON"];
+ } else {
+ project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_OFF"];
+ project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_OFF"];
+ }
+
// this should probably not be here, but I'm using it to wrap the .t files
if(project->first("TEMPLATE") == "vcapp" )
project->variables()["QMAKE_APP_FLAG"].append("1");
else if(project->first("TEMPLATE") == "vclib")
project->variables()["QMAKE_LIB_FLAG"].append("1");
if ( project->variables()["QMAKESPEC"].isEmpty() )
project->variables()["QMAKESPEC"].append( getenv("QMAKESPEC") );
bool is_qt =
( project->first("TARGET") == "qt"QTDLL_POSTFIX ||
project->first("TARGET") == "qt-mt"QTDLL_POSTFIX );
QStringList &configs = project->variables()["CONFIG"];
if ( project->isActiveConfig( "shared" ) )
project->variables()["DEFINES"].append( "QT_DLL" );
if ( project->isActiveConfig( "qt_dll" ) &&
configs.findIndex("qt") == -1 )
configs.append("qt");
if ( project->isActiveConfig( "qt" ) ) {
if ( project->isActiveConfig( "plugin" ) ) {
project->variables()["CONFIG"].append( "dll" );
@@ -767,156 +909,175 @@ void VcprojGenerator::initOld()
// DLL -----------------------------------------------------------
if ( project->isActiveConfig("dll") ) {
if ( !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) {
QString ver_xyz(project->first("VERSION"));
ver_xyz.replace(QRegExp("\\."), "");
project->variables()["TARGET_EXT"].append(ver_xyz + ".dll");
} else {
project->variables()["TARGET_EXT"].append(".dll");
}
}
// EXE / LIB -----------------------------------------------------
else {
if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() )
project->variables()["TARGET_EXT"].append(".exe");
else
project->variables()["TARGET_EXT"].append(".lib");
}
project->variables()["MSVCPROJ_VER"] = "7.00";
project->variables()["MSVCPROJ_DEBUG_OPT"] = "/GZ /ZI";
// INCREMENTAL:NO ------------------------------------------------
if(!project->isActiveConfig("incremental")) {
- project->variables()["QMAKE_LFLAGS"].append(QString("/incremental:no"));
+ project->variables()["QMAKE_LFLAGS"].append(QString("/INCREMENTAL:no"));
if ( is_qt )
project->variables()["MSVCPROJ_DEBUG_OPT"] = "/GZ /Zi";
}
// MOC -----------------------------------------------------------
if ( project->isActiveConfig("moc") )
setMocAware(TRUE);
project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"];
+ // Update -lname to name.lib, and -Ldir to
+ QStringList &libList = project->variables()["QMAKE_LIBS"];
+ for( it = libList.begin(); it != libList.end(); ) {
+ QString s = *it;
+ if( s.startsWith( "-l" ) ) {
+ it = libList.remove( it );
+ it = libList.insert( it, s.mid( 2 ) + ".lib" );
+ } else if( s.startsWith( "-L" ) ) {
+ it = libList.remove( it );
+ } else {
+ it++;
+ }
+ }
// Run through all variables containing filepaths, and -----------
// slash-slosh them correctly depending on current OS -----------
project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ', "HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH");
QStringList &l = project->variables()["QMAKE_FILETAGS"];
for(it = l.begin(); it != l.end(); ++it) {
QStringList &gdmf = project->variables()[(*it)];
for(QStringList::Iterator inner = gdmf.begin(); inner != gdmf.end(); ++inner)
(*inner) = Option::fixPathToTargetOS((*inner), FALSE);
}
// Get filename w/o extention -----------------------------------
QString msvcproj_project = "";
QString targetfilename = "";
if ( project->variables()["TARGET"].count() ) {
msvcproj_project = project->variables()["TARGET"].first();
targetfilename = msvcproj_project;
}
// Save filename w/o extention in $$QMAKE_ORIG_TARGET ------------
project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"];
- // TARGET (add extention to $$TARGET) ----------------------------
- project->variables()["TARGET"].first() += project->first("TARGET_EXT");
+ // TARGET (add extention to $$TARGET)
+ //project->variables()["MSVCPROJ_DEFINES"].append(varGlue(".first() += project->first("TARGET_EXT");
// Init base class too -------------------------------------------
MakefileGenerator::init();
if ( msvcproj_project.isEmpty() )
msvcproj_project = Option::output.name();
msvcproj_project = msvcproj_project.right( msvcproj_project.length() - msvcproj_project.findRev( "\\" ) - 1 );
msvcproj_project = msvcproj_project.left( msvcproj_project.findRev( "." ) );
msvcproj_project.replace(QRegExp("-"), "");
project->variables()["MSVCPROJ_PROJECT"].append(msvcproj_project);
QStringList &proj = project->variables()["MSVCPROJ_PROJECT"];
for(it = proj.begin(); it != proj.end(); ++it)
(*it).replace(QRegExp("\\.[a-zA-Z0-9_]*$"), "");
// SUBSYSTEM -----------------------------------------------------
if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) {
project->variables()["MSVCPROJ_TEMPLATE"].append("win32app" + project->first( "VCPROJ_EXTENSION" ) );
if ( project->isActiveConfig("console") ) {
project->variables()["MSVCPROJ_CONSOLE"].append("CONSOLE");
project->variables()["MSVCPROJ_WINCONDEF"].append("_CONSOLE");
project->variables()["MSVCPROJ_VCPROJTYPE"].append("0x0103");
project->variables()["MSVCPROJ_SUBSYSTEM"].append("CONSOLE");
} else {
project->variables()["MSVCPROJ_CONSOLE"].clear();
project->variables()["MSVCPROJ_WINCONDEF"].append("_WINDOWS");
project->variables()["MSVCPROJ_VCPROJTYPE"].append("0x0101");
project->variables()["MSVCPROJ_SUBSYSTEM"].append("WINDOWS");
}
} else {
if ( project->isActiveConfig("dll") ) {
project->variables()["MSVCPROJ_TEMPLATE"].append("win32dll" + project->first( "VCPROJ_EXTENSION" ) );
} else {
project->variables()["MSVCPROJ_TEMPLATE"].append("win32lib" + project->first( "VCPROJ_EXTENSION" ) );
}
}
// $$QMAKE.. -> $$MSVCPROJ.. -------------------------------------
project->variables()["MSVCPROJ_LIBS"] += project->variables()["QMAKE_LIBS"];
project->variables()["MSVCPROJ_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"];
project->variables()["MSVCPROJ_LFLAGS" ] += project->variables()["QMAKE_LFLAGS"];
- if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() )
- project->variables()["MSVCPROJ_LFLAGS" ].append(varGlue("QMAKE_LIBDIR","/LIBPATH:"," /LIBPATH:",""));
+ if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() ) {
+ QStringList strl = project->variables()["QMAKE_LIBDIR"];
+ QStringList::iterator stri;
+ for ( stri = strl.begin(); stri != strl.end(); ++stri ) {
+ if ( !(*stri).startsWith("/LIBPATH:") )
+ (*stri).prepend( "/LIBPATH:" );
+ }
+ project->variables()["MSVCPROJ_LFLAGS"] += strl;
+ }
project->variables()["MSVCPROJ_CXXFLAGS" ] += project->variables()["QMAKE_CXXFLAGS"];
// We don't use this... Direct manipulation of compiler object
//project->variables()["MSVCPROJ_DEFINES"].append(varGlue("DEFINES","/D ","" " /D ",""));
//project->variables()["MSVCPROJ_DEFINES"].append(varGlue("PRL_EXPORT_DEFINES","/D ","" " /D ",""));
QStringList &incs = project->variables()["INCLUDEPATH"];
for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) {
QString inc = (*incit);
inc.replace(QRegExp("\""), "");
project->variables()["MSVCPROJ_INCPATH"].append("/I" + inc );
}
project->variables()["MSVCPROJ_INCPATH"].append("/I" + specdir());
QString dest;
project->variables()["MSVCPROJ_TARGET"] = project->first("TARGET");
- if ( !project->variables()["DESTDIR"].isEmpty() ) {
- project->variables()["TARGET"].first().prepend(project->first("DESTDIR"));
- Option::fixPathToTargetOS(project->first("TARGET"));
- dest = project->first("TARGET");
- if ( project->first("TARGET").startsWith("$(QTDIR)") )
- dest.replace( QRegExp("\\$\\(QTDIR\\)"), getenv("QTDIR") );
- project->variables()["MSVCPROJ_TARGET"].append(
- QString("/OUT:") + dest );
- if ( project->isActiveConfig("dll") ) {
- QString imp = dest;
- imp.replace(QRegExp("\\.dll"), ".lib");
- project->variables()["MSVCPROJ_LIBOPTIONS"] += (QString("/IMPLIB:") + imp );
- }
+ Option::fixPathToTargetOS(project->first("TARGET"));
+ dest = project->first("TARGET") + project->first( "TARGET_EXT" );
+ if ( project->first("TARGET").startsWith("$(QTDIR)") )
+ dest.replace( QRegExp("\\$\\(QTDIR\\)"), getenv("QTDIR") );
+ project->variables()["MSVCPROJ_TARGET"] = dest;
+ if ( project->isActiveConfig("dll") ) {
+ QString imp = project->first( "DESTDIR" );
+ if( !imp.isNull() && !imp.endsWith( "\\" ) )
+ imp += "\\";
+ imp += dest;
+ imp.replace(QRegExp("\\.dll"), ".lib");
+ project->variables()["MSVCPROJ_LIBOPTIONS"] += QString("/IMPLIB:") + imp;
}
// DLL COPY ------------------------------------------------------
if ( project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty() ) {
QStringList dlldirs = project->variables()["DLLDESTDIR"];
QString copydll = "# Begin Special Build Tool\n"
"TargetPath=" + dest + "\n"
"SOURCE=$(InputPath)\n"
"PostBuild_Desc=Copy DLL to " + project->first("DLLDESTDIR") + "\n"
"PostBuild_Cmds=";
for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) {
copydll += "copy \"" + dest + "\" \"" + *dlldir + "\"\t";
}
copydll += "\n# End Special Build Tool";
project->variables()["MSVCPROJ_COPY_DLL_REL"].append( copydll );
project->variables()["MSVCPROJ_COPY_DLL_DBG"].append( copydll );
}
// ACTIVEQT ------------------------------------------------------
if ( project->isActiveConfig("activeqt") ) {
QString idl = project->variables()["QMAKE_IDL"].first();
QString idc = project->variables()["QMAKE_IDC"].first();
@@ -975,76 +1136,79 @@ void VcprojGenerator::initOld()
project->variables()["QMAKE_INTERNAL_PRL_LIBS"] << "MSVCPROJ_LFLAGS" << "MSVCPROJ_LIBS";
// Verbose output if "-d -d"...
outputVariables();
}
// ------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------
bool VcprojGenerator::openOutput(QFile &file) const
{
QString outdir;
if(!file.name().isEmpty()) {
QFileInfo fi(file);
if(fi.isDir())
outdir = file.name() + QDir::separator();
}
if(!outdir.isEmpty() || file.name().isEmpty()) {
QString ext = project->first("VCPROJ_EXTENSION");
if(project->first("TEMPLATE") == "vcsubdirs")
ext = project->first("VCSOLUTION_EXTENSION");
file.setName(outdir + project->first("TARGET") + ext);
}
if(QDir::isRelativePath(file.name())) {
- QString ofile;
- ofile = file.name();
- int slashfind = ofile.findRev('\\');
- if (slashfind == -1) {
- ofile = ofile.replace("-", "_");
- } else {
- int hypenfind = ofile.find('-', slashfind);
- while (hypenfind != -1 && slashfind < hypenfind) {
- ofile = ofile.replace(hypenfind, 1, "_");
- hypenfind = ofile.find('-', hypenfind + 1);
- }
- }
- file.setName(Option::fixPathToLocalOS(QDir::currentDirPath() + Option::dir_sep + ofile));
+ file.setName( Option::fixPathToLocalOS(QDir::currentDirPath() + Option::dir_sep + fixFilename(file.name())) );
}
return Win32MakefileGenerator::openOutput(file);
}
+QString VcprojGenerator::fixFilename(QString ofile) const
+{
+ int slashfind = ofile.findRev('\\');
+ if (slashfind == -1) {
+ ofile = ofile.replace('-', '_');
+ } else {
+ int hypenfind = ofile.find('-', slashfind);
+ while (hypenfind != -1 && slashfind < hypenfind) {
+ ofile = ofile.replace(hypenfind, 1, '_');
+ hypenfind = ofile.find('-', hypenfind + 1);
+ }
+ }
+ return ofile;
+}
+
QString VcprojGenerator::findTemplate(QString file)
{
QString ret;
if(!QFile::exists((ret = file)) &&
!QFile::exists((ret = QString(Option::mkfile::qmakespec + "/" + file))) &&
!QFile::exists((ret = QString(getenv("QTDIR")) + "/mkspecs/win32-msvc.net/" + file)) &&
!QFile::exists((ret = (QString(getenv("HOME")) + "/.tmake/" + file))))
return "";
debug_msg(1, "Generator: MSVC.NET: Found template \'%s\'", ret.latin1() );
return ret;
}
void VcprojGenerator::processPrlVariable(const QString &var, const QStringList &l)
{
if(var == "QMAKE_PRL_DEFINES") {
QStringList &out = project->variables()["MSVCPROJ_DEFINES"];
for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
if(out.findIndex((*it)) == -1)
out.append((" /D " + *it ));
}
} else {
MakefileGenerator::processPrlVariable(var, l);
}
}
void VcprojGenerator::outputVariables()
{
#if 0
- debug_msg(3, "Generator: MSVC.NET: List of current variables:" );
+ qDebug( "Generator: MSVC.NET: List of current variables:" );
for ( QMap<QString, QStringList>::ConstIterator it = project->variables().begin(); it != project->variables().end(); ++it) {
- debug_msg(3, "Generator: MSVC.NET: %s => %s", it.key().latin1(), it.data().join(" | ").latin1() );
+ qDebug( "Generator: MSVC.NET: %s => %s", it.key().latin1(), it.data().join(" | ").latin1() );
}
#endif
}
diff --git a/qmake/generators/win32/msvc_vcproj.h b/qmake/generators/win32/msvc_vcproj.h
index 583b164..69e0c02 100644
--- a/qmake/generators/win32/msvc_vcproj.h
+++ b/qmake/generators/win32/msvc_vcproj.h
@@ -1,129 +1,115 @@
/****************************************************************************
** $Id$
**
** Definition of VcprojGenerator class.
**
** Created : 970521
**
-** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
+** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
**
** This file is part of the network module of the Qt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.QPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid Qt Enterprise Edition licenses may use this
** file in accordance with the Qt Commercial License Agreement provided
** with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for QPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
-#ifndef __VCPROJMAKE_H__
-#define __VCPROJMAKE_H__
+#ifndef __MSVC_VCPROJ_H__
+#define __MSVC_VCPROJ_H__
#include "winmakefile.h"
#include "msvc_objectmodel.h"
enum target {
Application,
SharedLib,
StaticLib
};
+struct QUuid;
class VcprojGenerator : public Win32MakefileGenerator
{
bool init_flag;
bool writeVcprojParts(QTextStream &);
bool writeMakefile(QTextStream &);
virtual void writeSubDirs(QTextStream &t);
QString findTemplate(QString file);
void init();
public:
VcprojGenerator(QMakeProject *p);
~VcprojGenerator();
QString defaultMakefile() const;
virtual bool doDepends() const { return FALSE; } //never necesary
protected:
virtual bool openOutput(QFile &file) const;
virtual void processPrlVariable(const QString &, const QStringList &);
virtual bool findLibraries();
virtual void outputVariables();
+ QString fixFilename(QString ofile) const;
void initOld();
void initProject();
void initConfiguration();
void initCompilerTool();
void initLinkerTool();
void initLibrarianTool();
void initIDLTool();
void initCustomBuildTool();
void initPreBuildEventTools();
void initPostBuildEventTools();
void initPreLinkEventTools();
void initSourceFiles();
void initHeaderFiles();
void initMOCFiles();
void initUICFiles();
void initFormsFiles();
void initTranslationFiles();
void initLexYaccFiles();
void initResourceFiles();
- /*
- void writeGuid( QTextStream &t );
- void writeAdditionalOptions( QTextStream &t );
- void writeHeaders( QTextStream &t );
- void writeSources( QTextStream &t );
- void writeMocs( QTextStream &t );
- void writeLexs( QTextStream &t );
- void writeYaccs( QTextStream &t );
- void writePictures( QTextStream &t );
- void writeImages( QTextStream &t );
- void writeIDLs( QTextStream &t );
-
- void writeForms( QTextStream &t );
- void writeFormsSourceHeaders( QString &variable, QTextStream &t );
- void writeTranslations( QTextStream &t );
- void writeStrippedTranslations( QTextStream &t );
- */
-
VCProject vcProject;
target projectTarget;
+private:
+ QUuid increaseUUID(const QUuid &id);
friend class VCFilter;
};
inline VcprojGenerator::~VcprojGenerator()
{ }
inline QString VcprojGenerator::defaultMakefile() const
{
return project->first("TARGET") + project->first("VCPROJ_EXTENSION");
}
inline bool VcprojGenerator::findLibraries()
{
return Win32MakefileGenerator::findLibraries("MSVCVCPROJ_LIBS");
}
-#endif /* __VCPROJMAKE_H__ */
+#endif /* __MSVC_VCPROJ_H__ */
diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp
index a07c921..bc3fed9 100644
--- a/qmake/generators/win32/winmakefile.cpp
+++ b/qmake/generators/win32/winmakefile.cpp
@@ -80,272 +80,312 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t)
} else {
sd->directory = file;
}
while(sd->directory.right(1) == Option::dir_sep)
sd->directory = sd->directory.left(sd->directory.length() - 1);
if(!sd->profile.isEmpty()) {
QString basename = sd->directory;
int new_slsh = basename.findRev(Option::dir_sep);
if(new_slsh != -1)
basename = basename.mid(new_slsh+1);
if(sd->profile != basename + ".pro")
sd->makefile += "." + sd->profile.left(sd->profile.length() - 4); //no need for the .pro
}
sd->target = "sub-" + (*it);
sd->target.replace('/', '-');
sd->target.replace('.', '_');
}
}
QPtrListIterator<SubDir> it(subdirs);
if(!project->isEmpty("MAKEFILE"))
t << "MAKEFILE= " << var("MAKEFILE") << endl;
t << "QMAKE = " << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl;
t << "SUBTARGETS = ";
- for( it.toFirst(); it.current(); ++it)
+ for( it.toFirst(); it.current(); ++it)
t << " \\\n\t\t" << it.current()->target;
t << endl << endl;
t << "all: qmake_all $(SUBTARGETS)" << endl << endl;
for( it.toFirst(); it.current(); ++it) {
bool have_dir = !(*it)->directory.isEmpty();
//make the makefile
QString mkfile = (*it)->makefile;
if(have_dir)
mkfile.prepend((*it)->directory + Option::dir_sep);
t << mkfile << ":";
if(project->variables()["QMAKE_NOFORCE"].isEmpty())
t << " FORCE";
- if(have_dir)
+ if(have_dir)
t << "\n\t" << "cd " << (*it)->directory;
t << "\n\t" << "$(QMAKE) " << (*it)->profile << " " << buildArgs();
- if((*it)->makefile != "$(MAKEFILE)")
- t << " -o " << (*it)->makefile;
+ t << " -o " << (*it)->makefile;
if(have_dir) {
int subLevels = it.current()->directory.contains(Option::dir_sep) + 1;
t << "\n\t" << "@cd ..";
for(int i = 1; i < subLevels; i++ )
t << Option::dir_sep << "..";
}
t << endl;
//now actually build
t << (*it)->target << ": " << mkfile;
if(project->variables()["QMAKE_NOFORCE"].isEmpty())
t << " FORCE";
- if(have_dir)
+ if(have_dir)
t << "\n\t" << "cd " << (*it)->directory;
t << "\n\t" << "$(MAKE)";
- if((*it)->makefile != "$(MAKEFILE)")
- t << " -f " << (*it)->makefile;
+ t << " -f " << (*it)->makefile;
if(have_dir) {
int subLevels = it.current()->directory.contains(Option::dir_sep) + 1;
t << "\n\t" << "@cd ..";
for(int i = 1; i < subLevels; i++ )
t << Option::dir_sep << "..";
}
t << endl << endl;
}
if(project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].findIndex("qmake_all") == -1)
project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].append("qmake_all");
writeMakeQmake(t);
t << "qmake_all:";
if ( !subdirs.isEmpty() ) {
for( it.toFirst(); it.current(); ++it) {
QString subdir = (*it)->directory;
+ QString profile = (*it)->profile;
int subLevels = subdir.contains(Option::dir_sep) + 1;
t << "\n\t"
<< "cd " << subdir << "\n\t";
int lastSlash = subdir.findRev(Option::dir_sep);
if(lastSlash != -1)
subdir = subdir.mid( lastSlash + 1 );
- t << "$(QMAKE) " << subdir << ".pro"
- << (!project->isEmpty("MAKEFILE") ? QString(" -o ") + var("MAKEFILE") : QString(""))
+ t << "$(QMAKE) "
+ << ( !profile.isEmpty() ? profile : subdir + ".pro" )
+ << " -o " << (*it)->makefile
<< " " << buildArgs() << "\n\t"
<< "@cd ..";
for(int i = 1; i < subLevels; i++ )
t << Option::dir_sep << "..";
}
} else {
// Borland make does not like empty an empty command section, so insert
// a dummy command.
t << "\n\t" << "@cd .";
}
t << endl << endl;
QString targs[] = { QString("clean"), QString("install"), QString("mocclean"), QString::null };
for(int x = 0; targs[x] != QString::null; x++) {
t << targs[x] << ": qmake_all";
if(targs[x] == "clean")
t << varGlue("QMAKE_CLEAN","\n\t-del ","\n\t-del ", "");
if (!subdirs.isEmpty()) {
for( it.toFirst(); it.current(); ++it) {
int subLevels = (*it)->directory.contains(Option::dir_sep) + 1;
bool have_dir = !(*it)->directory.isEmpty();
if(have_dir)
t << "\n\t" << "cd " << (*it)->directory;
- QString in_file;
- if((*it)->makefile != "$(MAKEFILE)")
- in_file = " -f " + (*it)->makefile;
+ QString in_file = " -f " + (*it)->makefile;
t << "\n\t" << "$(MAKE) " << in_file << " " << targs[x];
if(have_dir) {
t << "\n\t" << "@cd ..";
- for(int i = 1; i < subLevels; i++ )
+ for(int i = 1; i < subLevels; i++ )
t << Option::dir_sep << "..";
}
}
} else {
// Borland make does not like empty an empty command section, so
// insert a dummy command.
t << "\n\t" << "@cd .";
}
t << endl << endl;
}
if(project->variables()["QMAKE_NOFORCE"].isEmpty())
t << "FORCE:" << endl << endl;
}
int
-Win32MakefileGenerator::findHighestVersion(const QString &d, const
- QString &stem)
+Win32MakefileGenerator::findHighestVersion(const QString &d, const QString &stem)
{
- if(!QFile::exists(Option::fixPathToLocalOS(d)))
+ QString bd = Option::fixPathToLocalOS(d, TRUE);
+ if(!QFile::exists(bd))
return -1;
- if(!project->variables()["QMAKE_" + stem.upper() +
- "_VERSION_OVERRIDE"].isEmpty())
- return project->variables()["QMAKE_" + stem.upper() +
- "_VERSION_OVERRIDE"].first().toInt();
- QString bd = d;
- fixEnvVariables(bd);
+ if(!project->variables()["QMAKE_" + stem.upper() + "_VERSION_OVERRIDE"].isEmpty())
+ return project->variables()["QMAKE_" + stem.upper() + "_VERSION_OVERRIDE"].first().toInt();
+
QDir dir(bd);
int biggest=-1;
QStringList entries = dir.entryList();
- QRegExp regx( "(" + stem + "([0-9]*)).lib", FALSE );
- for(QStringList::Iterator it = entries.begin(); it != entries.end();
- ++it) {
+ QString dllStem = stem + QTDLL_POSTFIX;
+ QRegExp regx( "(" + dllStem + "([0-9]*)).lib", FALSE );
+ for(QStringList::Iterator it = entries.begin(); it != entries.end(); ++it) {
if(regx.exactMatch((*it)))
- biggest = QMAX(biggest, (regx.cap(1) == stem ||
- regx.cap(2).isEmpty()) ? -1 : regx.cap(2).toInt());
+ biggest = QMAX(biggest, (regx.cap(1) == dllStem ||
+ regx.cap(2).isEmpty()) ? -1 : regx.cap(2).toInt());
+ }
+ if(dir.exists(dllStem + Option::prl_ext)) {
+ QMakeProject proj;
+ if(proj.read(bd + dllStem + Option::prl_ext, QDir::currentDirPath(), TRUE)) {
+ if(!proj.isEmpty("QMAKE_PRL_VERSION"))
+ biggest = QMAX(biggest, proj.first("QMAKE_PRL_VERSION").replace(".", "").toInt());
+ }
}
return biggest;
}
bool
Win32MakefileGenerator::findLibraries(const QString &where)
{
QStringList &l = project->variables()[where];
QPtrList<MakefileDependDir> dirs;
+ {
+ QStringList &libpaths = project->variables()["QMAKE_LIBDIR"];
+ for(QStringList::Iterator libpathit = libpaths.begin(); libpathit != libpaths.end(); ++libpathit) {
+ QString r = (*libpathit), l = r;
+ fixEnvVariables(l);
+ dirs.append(new MakefileDependDir(r.replace("\"",""), l.replace("\"","")));
+ }
+ }
dirs.setAutoDelete(TRUE);
for(QStringList::Iterator it = l.begin(); it != l.end(); ) {
- QString opt = (*it);
- bool remove = FALSE;
- if(opt.startsWith("-L") || opt.startsWith("/L")) {
- QString r = opt.right(opt.length() - 2), l = Option::fixPathToLocalOS(r);
+ QChar quote;
+ bool modified_opt = FALSE, remove = FALSE;
+ QString opt = (*it).stripWhiteSpace();
+ if((opt[0] == '\'' || opt[0] == '"') && opt[(int)opt.length()-1] == opt[0]) {
+ quote = opt[0];
+ opt = opt.mid(1, opt.length()-2);
+ }
+ if(opt.startsWith("/LIBPATH:")) {
+ QString r = opt.mid(9), l = Option::fixPathToLocalOS(r);
+ dirs.append(new MakefileDependDir(r.replace("\"",""),
+ l.replace("\"","")));
+ } else if(opt.startsWith("-L") || opt.startsWith("/L")) {
+ QString r = opt.mid(2), l = Option::fixPathToLocalOS(r);
dirs.append(new MakefileDependDir(r.replace("\"",""),
l.replace("\"","")));
- remove = TRUE;
+ remove = TRUE; //we eat this switch
} else if(opt.startsWith("-l") || opt.startsWith("/l")) {
QString lib = opt.right(opt.length() - 2), out;
if(!lib.isEmpty()) {
for(MakefileDependDir *mdd = dirs.first(); mdd; mdd = dirs.next() ) {
+ QString extension;
int ver = findHighestVersion(mdd->local_dir, lib);
if(ver > 0)
- lib += QString::number(ver);
- lib += ".lib";
- if(QFile::exists(mdd->local_dir + Option::dir_sep + lib)) {
- out = mdd->real_dir + Option::dir_sep + lib;
+ extension += QString::number(ver);
+ extension += ".lib";
+ if(QFile::exists(mdd->local_dir + Option::dir_sep + lib + Option::prl_ext) ||
+ QFile::exists(mdd->local_dir + Option::dir_sep + lib + extension)) {
+ out = mdd->real_dir + Option::dir_sep + lib + extension;
break;
}
}
}
- if(out.isEmpty())
- remove = TRUE;
- else
+ if(out.isEmpty()) {
+ remove = TRUE; //just eat it since we cannot find one..
+ } else {
+ modified_opt = TRUE;
(*it) = out;
+ }
} else if(!QFile::exists(Option::fixPathToLocalOS(opt))) {
- QString dir, file = opt;
+ QPtrList<MakefileDependDir> lib_dirs;
+ QString file = opt;
int slsh = file.findRev(Option::dir_sep);
if(slsh != -1) {
- dir = file.left(slsh+1);
+ QString r = file.left(slsh+1), l = r;
+ fixEnvVariables(l);
+ lib_dirs.append(new MakefileDependDir(r.replace("\"",""), l.replace("\"","")));
file = file.right(file.length() - slsh - 1);
- }
- if ( !(project->variables()["QMAKE_QT_DLL"].isEmpty() && (file == "qt.lib" || file == "qt-mt.lib")) ) {
- if(file.endsWith(".lib")) {
- file = file.left(file.length() - 4);
- if(!file.at(file.length()-1).isNumber()) {
- int ver = findHighestVersion(dir, file);
+ } else {
+ lib_dirs = dirs;
+ }
+ if(file.endsWith(".lib")) {
+ file = file.left(file.length() - 4);
+ if(!file.at(file.length()-1).isNumber()) {
+ for(MakefileDependDir *mdd = lib_dirs.first(); mdd; mdd = lib_dirs.next() ) {
+ QString lib_tmpl(file + "%1" + ".lib");
+ int ver = findHighestVersion(mdd->local_dir, file);
if(ver != -1) {
- file = QString(dir + file + "%1" + ".lib");
if(ver)
- (*it) = file.arg(ver);
+ lib_tmpl = lib_tmpl.arg(ver);
else
- (*it) = file.arg("");
+ lib_tmpl = lib_tmpl.arg("");
+ if(slsh != -1) {
+ QString dir = mdd->real_dir;
+ if(!dir.endsWith(Option::dir_sep))
+ dir += Option::dir_sep;
+ lib_tmpl.prepend(dir);
+ }
+ modified_opt = TRUE;
+ (*it) = lib_tmpl;
+ break;
}
}
}
}
}
- if(remove)
+ if(remove) {
it = l.remove(it);
- else
+ } else {
+ if(!quote.isNull() && modified_opt)
+ (*it) = quote + (*it) + quote;
++it;
+ }
}
return TRUE;
}
void
Win32MakefileGenerator::processPrlFiles()
{
QDict<void> processed;
QPtrList<MakefileDependDir> libdirs;
libdirs.setAutoDelete(TRUE);
{
QStringList &libpaths = project->variables()["QMAKE_LIBDIR"];
for(QStringList::Iterator libpathit = libpaths.begin(); libpathit != libpaths.end(); ++libpathit) {
QString r = (*libpathit), l = r;
fixEnvVariables(l);
libdirs.append(new MakefileDependDir(r.replace("\"",""),
l.replace("\"","")));
}
}
for(bool ret = FALSE; TRUE; ret = FALSE) {
//read in any prl files included..
QStringList l_out;
QString where = "QMAKE_LIBS";
if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS"))
where = project->first("QMAKE_INTERNAL_PRL_LIBS");
QStringList &l = project->variables()[where];
for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
QString opt = (*it);
- if(opt.left(1) == "/") {
- if(opt.left(9) == "/LIBPATH:") {
+ if(opt.startsWith("/")) {
+ if(opt.startsWith("/LIBPATH:")) {
QString r = opt.mid(9), l = r;
fixEnvVariables(l);
libdirs.append(new MakefileDependDir(r.replace("\"",""),
l.replace("\"","")));
}
} else {
if(!processed[opt]) {
if(processPrlFile(opt)) {
processed.insert(opt, (void*)1);
ret = TRUE;
} else {
for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) {
QString prl = mdd->local_dir + Option::dir_sep + opt;
if(processed[prl]) {
break;
} else if(processPrlFile(prl)) {
processed.insert(prl, (void*)1);
ret = TRUE;
break;
}
}
}
}
}