summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
Diffstat (limited to 'qmake')
-rw-r--r--qmake/Makefile.unix43
-rw-r--r--qmake/Makefile.win3214
-rw-r--r--qmake/Makefile.win32-g++31
-rw-r--r--qmake/Makefile.win32-g++-sh32
-rw-r--r--qmake/cachekeys.h9
-rw-r--r--qmake/generators/integrity/gbuild.cpp442
-rw-r--r--qmake/generators/integrity/gbuild.h74
-rw-r--r--qmake/generators/mac/pbuilder_pbx.cpp3
-rw-r--r--qmake/generators/makefile.cpp182
-rw-r--r--qmake/generators/makefile.h5
-rw-r--r--qmake/generators/metamakefile.cpp29
-rw-r--r--qmake/generators/symbian/initprojectdeploy_symbian.cpp12
-rw-r--r--qmake/generators/symbian/symbian_makefile.h4
-rw-r--r--qmake/generators/symbian/symbiancommon.cpp4
-rw-r--r--qmake/generators/symbian/symmake.cpp24
-rw-r--r--qmake/generators/symbian/symmake_sbsv2.cpp6
-rw-r--r--qmake/generators/unix/unixmake.cpp49
-rw-r--r--qmake/generators/unix/unixmake.h4
-rw-r--r--qmake/generators/unix/unixmake2.cpp221
-rw-r--r--qmake/generators/win32/mingw_make.cpp9
-rw-r--r--qmake/generators/win32/msbuild_objectmodel.cpp3910
-rw-r--r--qmake/generators/win32/msbuild_objectmodel.h574
-rw-r--r--qmake/generators/win32/msvc_nmake.cpp47
-rw-r--r--qmake/generators/win32/msvc_nmake.h2
-rw-r--r--qmake/generators/win32/msvc_objectmodel.cpp1327
-rw-r--r--qmake/generators/win32/msvc_objectmodel.h136
-rw-r--r--qmake/generators/win32/msvc_vcproj.cpp275
-rw-r--r--qmake/generators/win32/msvc_vcproj.h6
-rw-r--r--qmake/generators/win32/msvc_vcxproj.cpp764
-rw-r--r--qmake/generators/win32/msvc_vcxproj.h34
-rw-r--r--qmake/generators/win32/winmakefile.cpp48
-rw-r--r--qmake/generators/win32/winmakefile.h1
-rw-r--r--qmake/option.cpp4
-rw-r--r--qmake/option.h11
-rw-r--r--qmake/project.cpp85
-rw-r--r--qmake/qmake.pri10
36 files changed, 3329 insertions, 5102 deletions
diff --git a/qmake/Makefile.unix b/qmake/Makefile.unix
index d941dc4..fd502e0 100644
--- a/qmake/Makefile.unix
+++ b/qmake/Makefile.unix
@@ -11,15 +11,16 @@ OBJS=project.o property.o main.o makefile.o unixmake2.o unixmake.o \
meta.o makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o \
borland_bmake.o msvc_vcproj.o msvc_vcxproj.o msvc_nmake.o msvc_objectmodel.o msbuild_objectmodel.o \
symmake.o initprojectdeploy_symbian.o symmake_abld.o symmake_sbsv2.o \
- symbiancommon.o registry.o epocroot.o
+ symbiancommon.o registry.o epocroot.o gbuild.o
#qt code
QOBJS=qtextcodec.o qutfcodec.o qstring.o qtextstream.o qiodevice.o qmalloc.o qglobal.o \
qbytearray.o qbytearraymatcher.o qdatastream.o qbuffer.o qlist.o qfile.o \
- qfsfileengine_unix.o qfsfileengine_iterator_unix.o qfsfileengine.o \
+ qfilesystementry.o qfilesystemengine_unix.o qfilesystemengine.o qfilesystemiterator_unix.o \
+ qfsfileengine_unix.o qfsfileengine.o \
qfsfileengine_iterator.o qregexp.o qvector.o qbitarray.o qdir.o qdiriterator.o quuid.o qhash.o \
qfileinfo.o qdatetime.o qstringlist.o qabstractfileengine.o qtemporaryfile.o \
- qmap.o qmetatype.o qsettings.o qlibraryinfo.o qvariant.o qvsnprintf.o \
+ qmap.o qmetatype.o qsettings.o qsystemerror.o qlibraryinfo.o qvariant.o qvsnprintf.o \
qlocale.o qlinkedlist.o qurl.o qnumeric.o qcryptographichash.o qxmlstream.o qxmlutils.o \
$(QTOBJS)
@@ -37,6 +38,7 @@ DEPEND_SRC=project.cpp property.cpp meta.cpp main.cpp generators/makefile.cpp ge
$(SOURCE_PATH)/tools/shared/symbian/epocroot.cpp \
generators/symbian/symmake_abld.cpp generators/symbian/symmake_sbsv2.cpp \
generaters/symbian/symbiancommon.cpp \
+ generators/integrity/gbuild.cpp \
$(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp \
$(SOURCE_PATH)/src/corelib/tools/qstring.cpp $(SOURCE_PATH)/src/corelib/io/qfile.cpp \
$(SOURCE_PATH)/src/corelib/io/qtextstream.cpp $(SOURCE_PATH)/src/corelib/io/qiodevice.cpp \
@@ -44,8 +46,11 @@ DEPEND_SRC=project.cpp property.cpp meta.cpp main.cpp generators/makefile.cpp ge
$(SOURCE_PATH)/src/corelib/global/qglobal.cpp $(SOURCE_PATH)/src/corelib/tools/qregexp.cpp \
$(SOURCE_PATH)/src/corelib/tools/qbytearray.cpp $(SOURCE_PATH)/src/corelib/tools/qbytearraymatcher.cpp \
$(SOURCE_PATH)/src/corelib/io/qdatastream.cpp $(SOURCE_PATH)/src/corelib/io/qbuffer.cpp \
+ $(SOURCE_PATH)/src/corelib/io/qfilesystementry.cpp $(SOURCE_PATH)/src/corelib/io/qfilesystemengine_unix.cpp \
+ $(SOURCE_PATH)/src/corelib/io/qfilesystemengine_mac.cpp \
+ $(SOURCE_PATH)/src/corelib/io/qfilesystemengine.cpp $(SOURCE_PATH)/src/corelib/io/qfilesystemiterator_unix.cpp \
$(SOURCE_PATH)/src/corelib/io/qfsfileengine_unix.cpp $(SOURCE_PATH)/src/corelib/io/qabstractfileengine.cpp \
- $(SOURCE_PATH)/src/corelib/io/qfsfileengine_iterator_unix.cpp $(SOURCE_PATH)/src/corelib/io/qfsfileengine_iterator.cpp \
+ $(SOURCE_PATH)/src/corelib/io/qfsfileengine_iterator.cpp \
$(SOURCE_PATH)/src/corelib/io/qfsfileengine.cpp $(SOURCE_PATH)/src/corelib/tools/qlist.cpp \
$(SOURCE_PATH)/src/corelib/tools/qvector.cpp $(SOURCE_PATH)/src/corelib/tools/qbitarray.cpp \
$(SOURCE_PATH)/src/corelib/io/qdiriterator.cpp \
@@ -61,9 +66,11 @@ DEPEND_SRC=project.cpp property.cpp meta.cpp main.cpp generators/makefile.cpp ge
$(SOURCE_PATH)/src/corelib/tools/qvsnprintf.cpp $(SOURCE_PATH)/src/corelib/global/qnumeric.cpp \
$(SOURCE_PATH)/src/corelib/xml/qxmlstream.cpp \
$(SOURCE_PATH)/src/corelib/xml/qxmlutils.cpp \
+ $(SOURCE_PATH)/src/corelib/kernel/qsystemerror.cpp \
$(QTSRCS)
-CPPFLAGS = -I. -Igenerators -Igenerators/unix -Igenerators/win32 -Igenerators/mac -Igenerators/symbian \
+CPPFLAGS = -g -I. -Igenerators -Igenerators/unix -Igenerators/win32 \
+ -Igenerators/mac -Igenerators/symbian -Igenerators/integrity \
-I$(BUILD_PATH)/include -I$(BUILD_PATH)/include/QtCore \
-I$(BUILD_PATH)/src/corelib/global -I$(BUILD_PATH)/src/corelib/xml \
-I$(SOURCE_PATH)/tools/shared \
@@ -71,7 +78,7 @@ CPPFLAGS = -I. -Igenerators -Igenerators/unix -Igenerators/win32 -Igenerators/ma
-DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DQLIBRARYINFO_EPOCROOT \
-DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_STL \
-DQT_NO_COMPRESS -I$(QMAKESPEC) -DHAVE_QCONFIG_CPP -DQT_NO_THREAD -DQT_NO_QOBJECT \
- -DQT_NO_GEOM_VARIANT $(OPENSOURCE_CXXFLAGS)
+ -DQT_NO_GEOM_VARIANT -DQT_NO_DEPRECATED $(OPENSOURCE_CXXFLAGS)
CXXFLAGS = @QMAKE_CXXFLAGS@ $(CPPFLAGS)
@@ -100,6 +107,9 @@ qvariant.o: $(SOURCE_PATH)/src/corelib/kernel/qvariant.cpp
qsettings.o: $(SOURCE_PATH)/src/corelib/io/qsettings.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qsettings.cpp
+qsystemerror.o: $(SOURCE_PATH)/src/corelib/kernel/qsystemerror.cpp
+ $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/kernel/qsystemerror.cpp
+
qlibraryinfo.o: $(SOURCE_PATH)/src/corelib/global/qlibraryinfo.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/global/qlibraryinfo.cpp
@@ -160,6 +170,21 @@ qlist.o: $(SOURCE_PATH)/src/corelib/tools/qlist.cpp
qfile.o: $(SOURCE_PATH)/src/corelib/io/qfile.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfile.cpp
+qfilesystementry.o: $(SOURCE_PATH)/src/corelib/io/qfilesystementry.cpp
+ $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfilesystementry.cpp
+
+qfilesystemengine.o: $(SOURCE_PATH)/src/corelib/io/qfilesystemengine.cpp
+ $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfilesystemengine.cpp
+
+qfilesystemengine_unix.o: $(SOURCE_PATH)/src/corelib/io/qfilesystemengine_unix.cpp
+ $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfilesystemengine_unix.cpp
+
+qfilesystemengine_mac.o: $(SOURCE_PATH)/src/corelib/io/qfilesystemengine_mac.cpp
+ $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfilesystemengine_mac.cpp
+
+qfilesystemiterator_unix.o: $(SOURCE_PATH)/src/corelib/io/qfilesystemiterator_unix.cpp
+ $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfilesystemiterator_unix.cpp
+
qfsfileengine.o: $(SOURCE_PATH)/src/corelib/io/qfsfileengine.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfsfileengine.cpp
@@ -169,9 +194,6 @@ qfsfileengine_iterator.o: $(SOURCE_PATH)/src/corelib/io/qfsfileengine_iterator.c
qfsfileengine_unix.o: $(SOURCE_PATH)/src/corelib/io/qfsfileengine_unix.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfsfileengine_unix.cpp
-qfsfileengine_iterator_unix.o: $(SOURCE_PATH)/src/corelib/io/qfsfileengine_iterator_unix.cpp
- $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfsfileengine_iterator_unix.cpp
-
qabstractfileengine.o: $(SOURCE_PATH)/src/corelib/io/qabstractfileengine.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qabstractfileengine.cpp
@@ -298,6 +320,9 @@ registry.o: $(SOURCE_PATH)/tools/shared/windows/registry.cpp
epocroot.o: $(SOURCE_PATH)/tools/shared/symbian/epocroot.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/tools/shared/symbian/epocroot.cpp
+gbuild.o: generators/integrity/gbuild.cpp
+ $(CXX) -c -o $@ $(CXXFLAGS) generators/integrity/gbuild.cpp
+
projectgenerator.o: generators/projectgenerator.cpp
$(CXX) -c -o $@ $(CXXFLAGS) generators/projectgenerator.cpp
diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32
index c04bcb2..0ab2932 100644
--- a/qmake/Makefile.win32
+++ b/qmake/Makefile.win32
@@ -31,7 +31,7 @@ CFLAGS_EXTRA = /MP
CFLAGS_BARE = -c -Fo./ \
-W3 -nologo -O2 \
$(CFLAGS_EXTRA) \
- -I. -Igenerators -Igenerators\unix -Igenerators\win32 -Igenerators\mac -Igenerators\symbian \
+ -I. -Igenerators -Igenerators\unix -Igenerators\win32 -Igenerators\mac -Igenerators\symbian -Igenerators\integrity \
-I$(BUILD_PATH)\include -I$(BUILD_PATH)\include\QtCore \
-I$(SOURCE_PATH)\include -I$(SOURCE_PATH)\include\QtCore \
-I$(BUILD_PATH)\src\corelib\global \
@@ -62,7 +62,8 @@ OBJS = project.obj main.obj makefile.obj unixmake.obj unixmake2.obj mingw
makefiledeps.obj metamakefile.obj xmloutput.obj pbuilder_pbx.obj \
borland_bmake.obj msvc_nmake.obj msvc_vcproj.obj msvc_vcxproj.obj \
msvc_objectmodel.obj msbuild_objectmodel.obj symmake.obj initprojectdeploy_symbian.obj \
- symmake_abld.obj symmake_sbsv2.obj symbiancommon.obj registry.obj epocroot.obj
+ symmake_abld.obj symmake_sbsv2.obj symbiancommon.obj registry.obj epocroot.obj \
+ gbuild.obj
!IFDEF QMAKE_OPENSOURCE_EDITION
CFLAGS = $(CFLAGS) -DQMAKE_OPENSOURCE_EDITION
@@ -73,6 +74,10 @@ QTOBJS= \
qbitarray.obj \
qbuffer.obj \
qcryptographichash.obj \
+ qfilesystementry.obj \
+ qfilesystemengine.obj \
+ qfilesystemengine_win.obj \
+ qfilesystemiterator_win.obj \
qfsfileengine.obj \
qfsfileengine_iterator.obj \
qbytearray.obj \
@@ -86,7 +91,6 @@ QTOBJS= \
qabstractfileengine.obj \
qfsfileengine_win.obj \
qsystemlibrary.obj \
- qfsfileengine_iterator_win.obj \
qfileinfo.obj \
qglobal.obj \
qhash.obj \
@@ -101,6 +105,7 @@ QTOBJS= \
qutfcodec.obj \
qstring.obj \
qstringlist.obj \
+ qsystemerror.obj \
qtextstream.obj \
qdatastream.obj \
quuid.obj \
@@ -165,6 +170,9 @@ qmake_pch.obj:
{$(SOURCE_PATH)\qmake\generators\symbian}.cpp{}.obj::
$(CXX) $(CXXFLAGS) $<
+{$(SOURCE_PATH)\qmake\generators\integrity}.cpp{}.obj::
+ $(CXX) $(CXXFLAGS) $<
+
{$(SOURCE_PATH)\qmake\generators\unix}.cpp{}.obj::
$(CXX) $(CXXFLAGS) $<
diff --git a/qmake/Makefile.win32-g++ b/qmake/Makefile.win32-g++
index 5a46e41..cba4257 100644
--- a/qmake/Makefile.win32-g++
+++ b/qmake/Makefile.win32-g++
@@ -15,7 +15,7 @@ CXX = g++
CFLAGS = -c -o$@ -O \
-I. -Igenerators -Igenerators/unix \
-Igenerators/win32 -Igenerators/mac \
- -Igenerators/symbian \
+ -Igenerators/symbian -Igenerators/integrity \
-I$(BUILD_PATH)/include -I$(BUILD_PATH)/include/QtCore \
-I$(SOURCE_PATH)/include -I$(SOURCE_PATH)/include/QtCore \
-I$(BUILD_PATH)/src/corelib/global \
@@ -39,7 +39,7 @@ OBJS = project.o main.o makefile.o unixmake.o unixmake2.o mingw_make.o \
makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o \
borland_bmake.o msvc_nmake.o msvc_vcproj.o msvc_vcxproj.o \
msvc_objectmodel.o msbuild_objectmodel.o symmake.o initprojectdeploy_symbian.o \
- symmake_abld.o symmake_sbsv2.o symbiancommon.o registry.o epocroot.o
+ symmake_abld.o symmake_sbsv2.o symbiancommon.o registry.o epocroot.o gbuild.o
ifdef QMAKE_OPENSOURCE_EDITION
CFLAGS += -DQMAKE_OPENSOURCE_EDITION
@@ -61,10 +61,13 @@ QTOBJS= \
qtemporaryfile.o \
qfileinfo.o \
qabstractfileengine.o \
+ qfilesystementry.o \
+ qfilesystemengine.o \
+ qfilesystemengine_win.o \
+ qfilesystemiterator_win.o \
qfsfileengine.o \
qfsfileengine_iterator.o \
qfsfileengine_win.o \
- qfsfileengine_iterator_win.o \
qglobal.o \
qhash.o \
qiodevice.o \
@@ -79,6 +82,7 @@ QTOBJS= \
qutfcodec.o \
qstring.o \
qstringlist.o \
+ qsystemerror.o \
qsystemlibrary.o \
qtextstream.o \
quuid.o \
@@ -193,12 +197,21 @@ qtemporaryfile.o: $(SOURCE_PATH)/src/corelib/io/qtemporaryfile.cpp
qabstractfileengine.o: $(SOURCE_PATH)/src/corelib/io/qabstractfileengine.cpp
$(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qabstractfileengine.cpp
+qfilesystementry.o: $(SOURCE_PATH)/src/corelib/io/qfilesystementry.cpp
+ $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfilesystementry.cpp
+
+qfilesystemengine.o: $(SOURCE_PATH)/src/corelib/io/qfilesystemengine.cpp
+ $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfilesystemengine.cpp
+
+qfilesystemengine_win.o: $(SOURCE_PATH)/src/corelib/io/qfilesystemengine_win.cpp
+ $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfilesystemengine_win.cpp
+
+qfilesystemiterator_win.o: $(SOURCE_PATH)/src/corelib/io/qfilesystemiterator_win.cpp
+ $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfilesystemiterator_win.cpp
+
qfsfileengine_win.o: $(SOURCE_PATH)/src/corelib/io/qfsfileengine_win.cpp
$(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfsfileengine_win.cpp
-qfsfileengine_iterator_win.o: $(SOURCE_PATH)/src/corelib/io/qfsfileengine_iterator_win.cpp
- $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfsfileengine_iterator_win.cpp
-
qfsfileengine.o: $(SOURCE_PATH)/src/corelib/io/qfsfileengine.cpp
$(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfsfileengine.cpp
@@ -235,6 +248,9 @@ qdatetime.o: $(SOURCE_PATH)/src/corelib/tools/qdatetime.cpp
qstringlist.o: $(SOURCE_PATH)/src/corelib/tools/qstringlist.cpp
$(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qstringlist.cpp
+qsystemerror.o: $(SOURCE_PATH)/src/corelib/kernel/qsystemerror.cpp
+ $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/kernel/qsystemerror.cpp
+
qsystemlibrary.o: $(SOURCE_PATH)/src/corelib/plugin/qsystemlibrary.cpp
$(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/plugin/qsystemlibrary.cpp
@@ -295,6 +311,9 @@ registry.o: $(SOURCE_PATH)/tools/shared/windows/registry.cpp
epocroot.o: $(SOURCE_PATH)/tools/shared/symbian/epocroot.cpp
$(CXX) $(CXXFLAGS) $(SOURCE_PATH)/tools/shared/symbian/epocroot.cpp
+gbuild.o: $(SOURCE_PATH)/qmake/generators/integrity/gbuild.cpp
+ $(CXX) $(CXXFLAGS) generators/integrity/gbuild.cpp
+
project.o: $(SOURCE_PATH)/qmake/project.cpp $(SOURCE_PATH)/qmake/project.h $(SOURCE_PATH)/qmake/option.h
$(CXX) $(CXXFLAGS) project.cpp
diff --git a/qmake/Makefile.win32-g++-sh b/qmake/Makefile.win32-g++-sh
index 6ca7514..0d3bb68 100644
--- a/qmake/Makefile.win32-g++-sh
+++ b/qmake/Makefile.win32-g++-sh
@@ -15,7 +15,7 @@ CXX = g++
CFLAGS = -c -o$@ -O \
-I. -Igenerators -Igenerators/unix \
-Igenerators/win32 -Igenerators/mac \
- -Igenerators/symbian \
+ -Igenerators/symbian -Igenerators/integrity \
-I$(BUILD_PATH)/include -I$(BUILD_PATH)/include/QtCore \
-I$(SOURCE_PATH)/include -I$(SOURCE_PATH)/include/QtCore \
-I$(BUILD_PATH)/src/corelib/global \
@@ -39,7 +39,7 @@ OBJS = project.o main.o makefile.o unixmake.o unixmake2.o mingw_make.o \
makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o \
borland_bmake.o msvc_nmake.o msvc_vcproj.o msvc_vcxproj.o \
msvc_objectmodel.o msbuild_objectmodel.o symmake.o initprojectdeploy_symbian.o \
- symmake_abld.o symmake_sbsv2.o symbiancommon.o registry.o epocroot.o
+ symmake_abld.o symmake_sbsv2.o symbiancommon.o registry.o epocroot.o gbuild.o
ifdef QMAKE_OPENSOURCE_EDITION
CFLAGS += -DQMAKE_OPENSOURCE_EDITION
@@ -61,10 +61,13 @@ QTOBJS= \
qtemporaryfile.o \
qfileinfo.o \
qabstractfileengine.o \
+ qfilesystementry.o \
+ qfilesystemengine.o \
+ qfilesystemengine_win.o \
+ qfilesystemiterator_win.o \
qfsfileengine.o \
qfsfileengine_iterator.o \
qfsfileengine_win.o \
- qfsfileengine_iterator_win.o \
qglobal.o \
qhash.o \
qiodevice.o \
@@ -80,6 +83,7 @@ QTOBJS= \
qstring.o \
qstringlist.o \
qsystemlibrary.o \
+ qsystemerror.o \
qtextstream.o \
quuid.o \
qvector.o \
@@ -192,12 +196,21 @@ qtemporaryfile.o: $(SOURCE_PATH)/src/corelib/io/qtemporaryfile.cpp
qabstractfileengine.o: $(SOURCE_PATH)/src/corelib/io/qabstractfileengine.cpp
$(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qabstractfileengine.cpp
+qfilesystementry.o: $(SOURCE_PATH)/src/corelib/io/qfilesystementry.cpp
+ $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfilesystementry.cpp
+
+qfilesystemengine.o: $(SOURCE_PATH)/src/corelib/io/qfilesystemengine.cpp
+ $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfilesystemengine.cpp
+
+qfilesystemengine_win.o: $(SOURCE_PATH)/src/corelib/io/qfilesystemengine_win.cpp
+ $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfilesystemengine_win.cpp
+
+qfilesystemiterator_win.o: $(SOURCE_PATH)/src/corelib/io/qfilesystemiterator_win.cpp
+ $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfilesystemiterator_win.cpp
+
qfsfileengine_win.o: $(SOURCE_PATH)/src/corelib/io/qfsfileengine_win.cpp
$(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfsfileengine_win.cpp
-qfsfileengine_iterator_win.o: $(SOURCE_PATH)/src/corelib/io/qfsfileengine_iterator_win.cpp
- $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfsfileengine_iterator_win.cpp
-
qfsfileengine.o: $(SOURCE_PATH)/src/corelib/io/qfsfileengine.cpp
$(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfsfileengine.cpp
@@ -234,6 +247,9 @@ qdatetime.o: $(SOURCE_PATH)/src/corelib/tools/qdatetime.cpp
qstringlist.o: $(SOURCE_PATH)/src/corelib/tools/qstringlist.cpp
$(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qstringlist.cpp
+qsystemerror.o: $(SOURCE_PATH)/src/corelib/kernel/qsystemerror.cpp
+ $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/kernel/qsystemerror.cpp
+
qsystemlibrary.o: $(SOURCE_PATH)/src/corelib/plugin/qsystemlibrary.cpp
$(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/plugin/qsystemlibrary.cpp
@@ -294,6 +310,10 @@ registry.o: $(SOURCE_PATH)/tools/shared/windows/registry.cpp
epocroot.o: $(SOURCE_PATH)/tools/shared/symbian/epocroot.cpp
$(CXX) $(CXXFLAGS) $(SOURCE_PATH)/tools/shared/symbian/epocroot.cpp
+gbuild.o: $(SOURCE_PATH)/qmake/generators/integrity/gbuild.cpp
+ $(CXX) $(CXXFLAGS) generators/integrity/gbuild.cpp
+
+
project.o: $(SOURCE_PATH)/qmake/project.cpp $(SOURCE_PATH)/qmake/project.h $(SOURCE_PATH)/qmake/option.h
$(CXX) $(CXXFLAGS) project.cpp
diff --git a/qmake/cachekeys.h b/qmake/cachekeys.h
index 23bb7dc..2957d61 100644
--- a/qmake/cachekeys.h
+++ b/qmake/cachekeys.h
@@ -166,12 +166,9 @@ struct FileFixifyCacheKey
inline uint qHash(const FileFixifyCacheKey &f) { return f.hashCode(); }
// -------------------------------------------------------------------------------------------------
-// As MSVC 6.0 can't handle template functions that well, we need a separate function for each type
-inline void qmakeDeleteCacheClear_QMapStringInt(void *i) { delete reinterpret_cast<QMap<QString,int> *>(i); }
-inline void qmakeDeleteCacheClear_QStringList(void *i) { delete reinterpret_cast<QStringList *>(i); }
-inline void qmakeDeleteCacheClear_QHashFixStringCacheKeyQString(void *i) { delete reinterpret_cast<QHash<FixStringCacheKey, QString> *>(i); }
-inline void qmakeDeleteCacheClear_QHashFileInfoCacheKeyQFileInfo(void *i) { delete reinterpret_cast<QHash<FileInfoCacheKey, QFileInfo> *>(i); }
-inline void qmakeDeleteCacheClear_QHashFileFixifyCacheKeyQString(void *i) { delete reinterpret_cast<QHash<FileFixifyCacheKey, QString> *>(i); }
+template <typename T>
+inline void qmakeDeleteCacheClear(void *i) { delete reinterpret_cast<T*>(i); }
+
inline void qmakeFreeCacheClear(void *i) { free(i); }
typedef void (*qmakeCacheClearFunc)(void *);
diff --git a/qmake/generators/integrity/gbuild.cpp b/qmake/generators/integrity/gbuild.cpp
new file mode 100644
index 0000000..17bd8f0
--- /dev/null
+++ b/qmake/generators/integrity/gbuild.cpp
@@ -0,0 +1,442 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "gbuild.h"
+#include "option.h"
+#include "meta.h"
+#include <qdir.h>
+#include <qregexp.h>
+#include <qcryptographichash.h>
+#include <qdebug.h>
+#include <stdlib.h>
+#include <time.h>
+#ifdef Q_OS_UNIX
+# include <sys/types.h>
+# include <sys/stat.h>
+#endif
+
+QT_BEGIN_NAMESPACE
+
+unsigned int dllbase = 0x01000000;
+#define DLLOFFSET 0x600000
+
+GBuildMakefileGenerator::GBuildMakefileGenerator() : MakefileGenerator()
+{
+ nativebins << "moc" << "rcc" << "uic" << "bootstrap";
+}
+
+bool
+GBuildMakefileGenerator::write()
+{
+ QStringList tmp;
+ QString filename(Option::output.fileName());
+ QString pathtoremove(qmake_getpwd());
+ QString relpath(pathtoremove);
+ QString strtarget(project->first("TARGET"));
+ bool isnativebin = nativebins.contains(strtarget);
+ relpath.replace(Option::output_dir, "");
+
+ /* correct output for non-prl, non-recursive case */
+ QString outname(qmake_getpwd());
+ outname += QDir::separator();
+ outname += fileInfo(Option::output.fileName()).baseName();
+ outname += projectSuffix();
+ Option::output.close();
+ Option::output.setFileName(outname);
+ MakefileGenerator::openOutput(Option::output, QString());
+
+ if (strtarget != fileInfo(project->projectFile()).baseName()) {
+ QString gpjname(strtarget);
+ QString outputName(qmake_getpwd());
+ outputName += QDir::separator();
+ outputName += fileInfo(project->projectFile()).baseName();
+ outputName += projectSuffix();
+ QFile f(outputName);
+ f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate);
+ QTextStream t(&f);
+ t << "#!gbuild\n";
+ t << "[Project]\n";
+ t << gpjname << projectSuffix() << "\n";
+ if ((project->first("TEMPLATE") == "lib")
+ && project->isActiveConfig("shared"))
+ t << gpjname << "_shared" << projectSuffix() << "\n";
+ t.flush();
+ gpjname += projectSuffix();
+ Option::output.close();
+ Option::output.setFileName(gpjname);
+ MakefileGenerator::openOutput(Option::output, QString());
+ }
+
+ if ((project->first("TEMPLATE") == "app")
+ && (!isnativebin)) {
+ QTextStream t(&Option::output);
+ QString intname(strtarget);
+ intname += ".int";
+ /* this is for bulding an INTEGRITY application.
+ * generate the .int integrate file and the .gpj INTEGRITY Application
+ * project file, then go on with regular files */
+ t << "#!gbuild" << "\n";
+ t << "[INTEGRITY Application]" << "\n";
+ t << "\t:binDirRelative=.\n";
+ t << "\t-o " << strtarget << "\n";
+ t << intname << "\n";
+ t << strtarget << "_app" << projectSuffix() << "\n";
+ t.flush();
+
+ /* generate integrate file */
+ QFile f(intname);
+ f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate);
+ QTextStream ti(&f);
+ ti << "# This is a file automatically generated by qmake" << "\n";
+ ti << "# Modifications will be lost next time you run qmake" << "\n";
+ ti << "Kernel" << "\n";
+ ti << "\tFilename\tDynamicDownload" << "\n";
+ ti << "EndKernel" << "\n" << "\n";
+ ti << "AddressSpace" << "\n";
+ ti << "\tName\t" << strtarget << "\n";
+ ti << "\tFilename\t" << strtarget << "_app" << "\n";
+ ti << "\tMemoryPoolSize\t0x100000" << "\n";
+ ti << "\tLanguage\tC++" << "\n";
+ /* FIXME : heap size is huge to be big enough for every example
+ * it should probably be tailored for each example, btu there is no
+ * good way to guess that */
+ ti << "\tHeapSize\t0x00D00000" << "\n";
+ ti << "\tTask\tInitial" << "\n";
+ ti << "\t\tStackSize\t0x30000" << "\n";
+ ti << "\tEndTask" << "\n";
+ ti << "EndAddressSpace" << "\n";
+ ti.flush();
+
+ /* change current project file to <projectname>_app.gpj and continue
+ * generation */
+ filename.insert(filename.lastIndexOf("."), "_app");
+ Option::output.close();
+ Option::output.setFileName(filename);
+ MakefileGenerator::openOutput(Option::output, QString());
+ } else if ((project->first("TEMPLATE") == "lib")
+ && project->isActiveConfig("shared")) {
+ QString gpjname(strtarget);
+ gpjname += "_shared";
+ gpjname += projectSuffix();
+ QFile f(gpjname);
+ f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate);
+ QTextStream t(&f);
+ t << "#!gbuild\n"
+ "[Program]\n"
+ "\t-A libINTEGRITY.so\n"
+ "\t-A libc.so\n"
+ "\t-A libscxx.so\n"
+ "\t-A libQtCore.so\n"
+ "\t-e __ghsbegin_text\n"
+ "\t-startfile=-\n"
+ "\t:syslibraries=-\n"
+ "\t-Onolink\n";
+ t << "\t-o lib" << strtarget << ".so\n";
+ t << "\t-l" << strtarget << "\n";
+ t << "\t-extractall=-l" << strtarget << "\n";
+ t << "\t:outputDir=work/" << filename.section(QDir::separator(), 0, -1).remove(".gpj") << "\n";
+ t << strtarget << "_shared.ld\n";
+ t << "$(__OS_DIR)/intlib/sharedobjbssinit.c\n";
+ t.flush();
+
+ QFile fl(strtarget + "_shared.ld");
+ fl.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate);
+ QTextStream tl(&fl);
+ tl << "CONSTANTS {\n"
+ " __INTEGRITY_MinPageAlign = 16K\n"
+ " __INTEGRITY_MaxPageAlign = 16K\n"
+ " __INTEGRITY_LibCBaseAddress = \n";
+ tl << dllbase << "\n";
+ tl << "}\n"
+ "-sec\n"
+ "{\n"
+ " .picbase __INTEGRITY_LibCBaseAddress :\n"
+ " .text :\n"
+ " .syscall :\n"
+ " .intercall :\n"
+ " .interfunc :\n"
+ " .secinfo :\n"
+ " .rodata align(16) :\n"
+ " .fixaddr :\n"
+ " .fixtype :\n"
+ " .rombeg :\n"
+ " .textchecksum :\n"
+ " // The above sections may be large. Leave a bigger gap for large pages.\n"
+ " .pidbase align(__INTEGRITY_MaxPageAlign) :\n"
+ " .sdabase :\n"
+ " .data :\n"
+ " .toc :\n"
+ " .opd :\n"
+ " .datachecksum :\n"
+ " .bss align(__INTEGRITY_MinPageAlign) :\n"
+ " .heap :\n"
+ "}\n";
+ tl.flush();
+ dllbase += DLLOFFSET;
+ }
+
+ warn_msg(WarnParser, Option::output.fileName().toAscii());
+ QTextStream t(&Option::output);
+ QString primaryTarget(project->values("QMAKE_CXX").at(0));
+
+ pathtoremove += QDir::separator();
+ filename.remove(qmake_getpwd());
+
+ //HEADER
+ t << "#!gbuild" << "\n";
+
+ /* find the architecture out of the compiler name */
+ if (filename.endsWith("projects.gpj")) {
+ primaryTarget.remove(0, 5);
+ t << "macro QT_BUILD_DIR=%expand_path(.)\n";
+ t << "macro __OS_DIR=" << project->values("INTEGRITY_DIR").first() << "\n";
+ t << "primaryTarget=" << primaryTarget << "_integrity.tgt" << "\n";
+ t << "customization=util/integrity/qt.bod\n";
+ }
+ /* project type */
+ if (project->first("TEMPLATE") == "app") {
+ t << "[Program]" << "\n";
+ if (isnativebin) {
+ t << "\t:binDir=bin\n";
+ t << "\t-o " << strtarget << "\n";
+ } else {
+ t << "\t:binDirRelative=.\n";
+ t << "\t-o " << strtarget << "_app\n";
+ }
+ } else if (project->first("TEMPLATE") == "lib") {
+ t << "[Library]" << "\n";
+ t << "\t:binDir=lib" << "\n";
+ t << "\t-o lib" << strtarget << ".a" << "\n";
+ } else if (project->first("TEMPLATE") == "subdirs")
+ t << "[Project]" << "\n";
+ else
+ t << project->first("TEMPLATE") << "\n";
+
+ /* compilations options */
+ t << "\t:sourceDir=." << "\n";
+
+ t << "\t:outputDir=work" << relpath << "\n";
+ if (filename.endsWith("projects.gpj")) {
+ t << "\t:sourceDir=work\n";
+ t << "\t-Iwork\n";
+ t << "\t-Llib\n";
+ t << "\t";
+ QStringList &l = project->values("QMAKE_CXXFLAGS");
+ for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
+ if ((*it).startsWith("-"))
+ t << "\n" << "\t" << (*it);
+ else
+ t << " " << (*it);
+ }
+ t << "\n";
+ }
+ t << "\n";
+
+ t << varGlue("DEFINES", "\t-D", "\n\t-D", "\n");
+
+ t << "\t-I.\n\t-I" << specdir() << "\n";
+ t << varGlue("INCLUDEPATH", "\t-I", "\n\t-I", "\n");
+ t << "\t--cxx_include_directory .\n\t--cxx_include_directory " << specdir() << "\n";
+ t << varGlue("INCLUDEPATH", "\t--cxx_include_directory ", "\n\t--cxx_include_directory ", "\n");
+
+ if (project->first("TEMPLATE") == "app") {
+ /* include linker flags if it's an application */
+ QString src[] = { "QMAKE_LFLAGS", "QMAKE_FRAMEWORKPATH_FLAGS", "QMAKE_LIBDIR_FLAGS", "QMAKE_LIBS", "LIBS", QString() };
+ for (int i = 0; !src[i].isNull(); i++) {
+ /* skip target libraries for native tools */
+ if (isnativebin && (i == 0))
+ continue;
+ t << "\t";
+ QStringList &l = project->values(src[i]);
+ for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
+ if ((*it).startsWith("-"))
+ t << "\n" << "\t" << (*it);
+ else
+ t << " " << (*it);
+ }
+ t << "\n";
+ }
+ }
+
+ /* first subdirectories/subprojects */
+ {
+ QStringList &l = project->values("SUBDIRS");
+ for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
+ QString gpjname((*it));
+ /* avoid native tools */
+ if (nativebins.contains(gpjname.section("_", -1)))
+ continue;
+ if (!project->first((*it) + ".subdir").isEmpty())
+ gpjname = project->first((*it) + ".subdir");
+ else
+ gpjname.replace("_", QDir::separator());
+ gpjname += QDir::separator() + gpjname.section(QDir::separator(), -1);
+ gpjname += projectSuffix();
+ /* make relative */
+ if (!project->values("QT_SOURCE_TREE").isEmpty()) {
+ gpjname.replace(project->values("QT_SOURCE_TREE").first() + QDir::separator(), "");
+ }
+ t << gpjname << "\n";
+ }
+ }
+
+ {
+ QStringList &l = project->values("RESOURCES");
+ for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
+ QString tmpstr((*it).replace(pathtoremove, ""));
+ t << tmpstr << "\t[Qt Resource]\n";
+ tmpstr = tmpstr.section(".", -2, -1).section(QDir::separator(), -1);
+ tmpstr.remove(".qrc");
+ t << "\t-name " << tmpstr << "\n";
+ tmpstr.insert(tmpstr.lastIndexOf(QDir::separator()) + 1, "qrc_");
+ tmpstr.append(".cpp");
+ t << "\t-o work/" << tmpstr << "\n";
+ }
+ }
+ {
+ QStringList &l = project->values("FORMS");
+ for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
+ QString tmpstr((*it).replace(pathtoremove, ""));
+ t << tmpstr << "\t[Qt Dialog]\n";
+ tmpstr = tmpstr.section(".", 0, 0).section(QDir::separator(), -1);
+ tmpstr.insert(tmpstr.lastIndexOf(QDir::separator()) + 1, "ui_");
+ tmpstr.remove(".ui");
+ tmpstr.append(".h");
+ t << "\t-o work/" << tmpstr << "\n";
+ }
+ }
+
+ /* source files for this project */
+ QString src[] = { "HEADERS", "SOURCES", QString() };
+ for (int i = 0; !src[i].isNull(); i++) {
+ QStringList &l = project->values(src[i]);
+ for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
+ if ((*it).isEmpty())
+ continue;
+ /* native tools aren't preprocessed */
+ if (!isnativebin)
+ t << writeOne((*it), pathtoremove);
+ else
+ t << (*it).remove(pathtoremove) << "\n";
+ }
+ }
+ t << "\n";
+
+ {
+ QStringList &l = project->values("GENERATED_SOURCES");
+ for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
+ t << "work/" << (*it).section(QDir::separator(), -1) << "\n";
+ }
+ }
+
+ return true;
+}
+
+QString GBuildMakefileGenerator::writeOne(QString filename, QString pathtoremove)
+{
+ QString s("");
+ s += filename.remove(pathtoremove);
+ if (filename.endsWith(Option::h_ext.first())) {
+ QString corename(filename.section(QDir::separator(), -1));
+ corename.remove(Option::h_ext.first());
+ corename.append(Option::cpp_ext.first());
+ corename.prepend(Option::h_moc_mod);
+ s += "\t[MOC/Qt Header]\n";
+ s += "\t-o ";
+ s += "work/";
+ s += corename;
+ s += "\n";
+ } else if (filename.section(QDir::separator(), -1).startsWith("qrc_")) {
+ QString tmpstr(filename.section("/", -1).section(".", 0, -1).remove("qrc_").remove(".cpp"));
+ s += "\n\t:depends=";
+ s += tmpstr;
+ s += ".qrc";
+ s += "\n";
+ } else if (filename.endsWith(Option::cpp_ext.first())) {
+ QString tmpstr(filename.section("/", -1));
+// QString moctool(project->values("QMAKE_MOC").first());
+ QString filepath(pathtoremove);
+ if (!project->values("QT_SOURCE_TREE").isEmpty()) {
+ filepath.remove(project->values("QT_SOURCE_TREE").first());
+ filepath.remove(0, 1);
+ }
+// if (!project->values("QT_BUILD_TREE").isEmpty()) {
+// moctool.remove(project->values("QT_BUILD_TREE").first());
+// moctool.remove(0, 1);
+// }
+ s += "\n\t:preexecShellSafe='${QT_BUILD_DIR}/bin/moc ";
+// s += moctool;
+// s += " ";
+ s += varGlue("DEFINES", "-D", " -D", " ");
+ s += varGlue("INCLUDEPATH", "-I", " -I", " ");
+ s += filepath;
+ s += filename;
+ s += " -o ";
+ tmpstr.replace(Option::cpp_ext.first(), Option::cpp_moc_ext);
+ s += "work/";
+ s += tmpstr;
+ s += "\n";
+ } else
+ s += "\n";
+ return s;
+}
+
+bool
+GBuildMakefileGenerator::openOutput(QFile &file, const QString &build) const
+{
+ debug_msg(1, "file is %s", file.fileName().toLatin1().constData());
+ QFileInfo fi(file);
+ if (fi.filePath().isEmpty())
+ file.setFileName(qmake_getpwd() + QDir::separator() + file.fileName());
+ if (!file.fileName().endsWith(projectSuffix())) {
+ QString outputName(file.fileName());
+ outputName += QDir::separator();
+ outputName += fileInfo(project->projectFile()).baseName();
+ outputName += projectSuffix();
+ warn_msg(WarnParser, outputName.toAscii());
+ file.setFileName(outputName);
+ }
+ debug_msg(1, "file is %s", file.fileName().toLatin1().constData());
+ bool ret = MakefileGenerator::openOutput(file, QString());
+ return ret;
+}
+
+QT_END_NAMESPACE
diff --git a/qmake/generators/integrity/gbuild.h b/qmake/generators/integrity/gbuild.h
new file mode 100644
index 0000000..6b5b1a0
--- /dev/null
+++ b/qmake/generators/integrity/gbuild.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef GBUILD_H
+#define GBUILD_H
+
+#include "makefile.h"
+
+QT_BEGIN_NAMESPACE
+
+class GBuildMakefileGenerator : public MakefileGenerator
+{
+ virtual bool write();
+
+ QString projectSuffix() const { return QString(".gpj"); };
+ QString writeOne(QString filename, QString pathtoremove = "");
+
+public:
+ GBuildMakefileGenerator();
+ ~GBuildMakefileGenerator();
+
+ virtual bool supportsMetaBuild() { return false; }
+ virtual bool openOutput(QFile &, const QString &) const;
+protected:
+ bool doPrecompiledHeaders() const { return false; }
+ virtual bool doDepends() const { return true; }
+ QStringList nativebins;
+
+};
+
+inline GBuildMakefileGenerator::~GBuildMakefileGenerator()
+{ }
+
+QT_END_NAMESPACE
+
+#endif // GBUILD_H
diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp
index e623636..19667cd 100644
--- a/qmake/generators/mac/pbuilder_pbx.cpp
+++ b/qmake/generators/mac/pbuilder_pbx.cpp
@@ -167,6 +167,7 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t)
}
if(tmp_proj.read(fn)) {
if(Option::debug_level) {
+ debug_msg(1, "Dumping all variables:");
QMap<QString, QStringList> &vars = tmp_proj.variables();
for(QMap<QString, QStringList>::Iterator it = vars.begin();
it != vars.end(); ++it) {
@@ -1271,6 +1272,8 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
plist_in_text = plist_in_text.replace("@EXECUTABLE@", project->first("QMAKE_ORIG_TARGET"));
} else {
plist_in_text = plist_in_text.replace("@LIBRARY@", project->first("QMAKE_ORIG_TARGET"));
+ }
+ if (!project->values("VERSION").isEmpty()) {
plist_in_text = plist_in_text.replace("@SHORT_VERSION@", project->first("VER_MAJ") + "." +
project->first("VER_MIN"));
}
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index c13f38e..595768f 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -2738,7 +2738,7 @@ MakefileGenerator::fileInfo(QString file) const
static QFileInfo noInfo = QFileInfo();
if(!cache) {
cache = new QHash<FileInfoCacheKey, QFileInfo>;
- qmakeAddCacheClear(qmakeDeleteCacheClear_QHashFileInfoCacheKeyQFileInfo, (void**)&cache);
+ qmakeAddCacheClear(qmakeDeleteCacheClear<QHash<FileInfoCacheKey, QFileInfo> >, (void**)&cache);
}
FileInfoCacheKey cacheKey(file);
QFileInfo value = cache->value(cacheKey, noInfo);
@@ -2817,7 +2817,7 @@ MakefileGenerator::fileFixify(const QString& file, const QString &out_d, const Q
static QHash<FileFixifyCacheKey, QString> *cache = 0;
if(!cache) {
cache = new QHash<FileFixifyCacheKey, QString>;
- qmakeAddCacheClear(qmakeDeleteCacheClear_QHashFileFixifyCacheKeyQString, (void**)&cache);
+ qmakeAddCacheClear(qmakeDeleteCacheClear<QHash<FileFixifyCacheKey, QString> >, (void**)&cache);
}
FileFixifyCacheKey cacheKey(ret, out_d, in_d, fix, canon);
QString cacheVal = cache->value(cacheKey);
@@ -3123,4 +3123,182 @@ MakefileGenerator::openOutput(QFile &file, const QString &build) const
return false;
}
+QString
+MakefileGenerator::pkgConfigFileName(bool fixify)
+{
+ QString ret = var("TARGET");
+ int slsh = ret.lastIndexOf(Option::dir_sep);
+ if(slsh != -1)
+ ret = ret.right(ret.length() - slsh - 1);
+ if(ret.startsWith("lib"))
+ ret = ret.mid(3);
+ int dot = ret.indexOf('.');
+ if(dot != -1)
+ ret = ret.left(dot);
+ ret += Option::pkgcfg_ext;
+ QString subdir = project->first("QMAKE_PKGCONFIG_DESTDIR");
+ if(!subdir.isEmpty()) {
+ // initOutPaths() appends dir_sep, but just to be safe..
+ if (!subdir.endsWith(Option::dir_sep))
+ ret.prepend(Option::dir_sep);
+ ret.prepend(subdir);
+ }
+ if(fixify) {
+ if(QDir::isRelativePath(ret) && !project->isEmpty("DESTDIR"))
+ ret.prepend(project->first("DESTDIR"));
+ ret = Option::fixPathToLocalOS(fileFixify(ret, qmake_getpwd(), Option::output_dir));
+ }
+ return ret;
+}
+
+QString
+MakefileGenerator::pkgConfigPrefix() const
+{
+ if(!project->isEmpty("QMAKE_PKGCONFIG_PREFIX"))
+ return project->first("QMAKE_PKGCONFIG_PREFIX");
+ return QLibraryInfo::location(QLibraryInfo::PrefixPath);
+}
+
+QString
+MakefileGenerator::pkgConfigFixPath(QString path) const
+{
+ QString prefix = pkgConfigPrefix();
+ if(path.startsWith(prefix))
+ path = path.replace(prefix, "${prefix}");
+ return path;
+}
+
+void
+MakefileGenerator::writePkgConfigFile()
+{
+ QString fname = pkgConfigFileName(), lname = fname;
+ mkdir(fileInfo(fname).path());
+ int slsh = lname.lastIndexOf(Option::dir_sep);
+ if(slsh != -1)
+ lname = lname.right(lname.length() - slsh - 1);
+ QFile ft(fname);
+ if(!ft.open(QIODevice::WriteOnly))
+ return;
+ project->values("ALL_DEPS").append(fileFixify(fname));
+ QTextStream t(&ft);
+
+ QString prefix = pkgConfigPrefix();
+ QString libDir = project->first("QMAKE_PKGCONFIG_LIBDIR");
+ if(libDir.isEmpty())
+ libDir = prefix + Option::dir_sep + "lib" + Option::dir_sep;
+ QString includeDir = project->first("QMAKE_PKGCONFIG_INCDIR");
+ if(includeDir.isEmpty())
+ includeDir = prefix + "/include";
+
+ t << "prefix=" << prefix << endl;
+ t << "exec_prefix=${prefix}\n"
+ << "libdir=" << pkgConfigFixPath(libDir) << "\n"
+ << "includedir=" << pkgConfigFixPath(includeDir) << endl;
+ // non-standard entry. Provides useful info normally only
+ // contained in the internal .qmake.cache file
+ t << varGlue("CONFIG", "qt_config=", " ", "") << endl;
+
+ //extra PKGCONFIG variables
+ const QStringList &pkgconfig_vars = project->values("QMAKE_PKGCONFIG_VARIABLES");
+ for(int i = 0; i < pkgconfig_vars.size(); ++i) {
+ QString var = project->first(pkgconfig_vars.at(i) + ".name"),
+ val = project->values(pkgconfig_vars.at(i) + ".value").join(" ");
+ if(var.isEmpty())
+ continue;
+ if(val.isEmpty()) {
+ const QStringList &var_vars = project->values(pkgconfig_vars.at(i) + ".variable");
+ for(int v = 0; v < var_vars.size(); ++v) {
+ const QStringList &vars = project->values(var_vars.at(v));
+ for(int var = 0; var < vars.size(); ++var) {
+ if(!val.isEmpty())
+ val += " ";
+ val += pkgConfigFixPath(vars.at(var));
+ }
+ }
+ }
+ t << var << "=" << val << endl;
+ }
+
+ t << endl;
+
+ QString name = project->first("QMAKE_PKGCONFIG_NAME");
+ if(name.isEmpty()) {
+ name = project->first("QMAKE_ORIG_TARGET").toLower();
+ name.replace(0, 1, name[0].toUpper());
+ }
+ t << "Name: " << name << endl;
+ QString desc = project->values("QMAKE_PKGCONFIG_DESCRIPTION").join(" ");
+ if(desc.isEmpty()) {
+ if(name.isEmpty()) {
+ desc = project->first("QMAKE_ORIG_TARGET").toLower();
+ desc.replace(0, 1, desc[0].toUpper());
+ } else {
+ desc = name;
+ }
+ if(project->first("TEMPLATE") == "lib") {
+ if(project->isActiveConfig("plugin"))
+ desc += " Plugin";
+ else
+ desc += " Library";
+ } else if(project->first("TEMPLATE") == "app") {
+ desc += " Application";
+ }
+ }
+ t << "Description: " << desc << endl;
+ t << "Version: " << project->first("VERSION") << endl;
+
+ // libs
+ t << "Libs: ";
+ QString pkgConfiglibDir;
+ QString pkgConfiglibName;
+ if (Option::target_mode == Option::TARG_MACX_MODE && project->isActiveConfig("lib_bundle")) {
+ pkgConfiglibDir = "-F${libdir}";
+ QString bundle;
+ if (!project->isEmpty("QMAKE_FRAMEWORK_BUNDLE_NAME"))
+ bundle = unescapeFilePath(project->first("QMAKE_FRAMEWORK_BUNDLE_NAME"));
+ else
+ bundle = unescapeFilePath(project->first("TARGET"));
+ int suffix = bundle.lastIndexOf(".framework");
+ if (suffix != -1)
+ bundle = bundle.left(suffix);
+ pkgConfiglibName = "-framework " + bundle + " ";
+ } else {
+ pkgConfiglibDir = "-L${libdir}";
+ pkgConfiglibName = "-l" + lname.left(lname.length()-Option::libtool_ext.length());
+ }
+ t << pkgConfiglibDir << " " << pkgConfiglibName << " " << endl;
+
+ QStringList libs;
+ if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS")) {
+ libs = project->values("QMAKE_INTERNAL_PRL_LIBS");
+ } else {
+ libs << "QMAKE_LIBS"; //obvious one
+ }
+ libs << "QMAKE_LIBS_PRIVATE";
+ libs << "QMAKE_LFLAGS_THREAD"; //not sure about this one, but what about things like -pthread?
+ t << "Libs.private: ";
+ for(QStringList::ConstIterator it = libs.begin(); it != libs.end(); ++it) {
+ t << project->values((*it)).join(" ") << " ";
+ }
+ t << endl;
+
+ // flags
+ // ### too many
+ t << "Cflags: "
+ // << var("QMAKE_CXXFLAGS") << " "
+ << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ")
+ << project->values("PRL_EXPORT_CXXFLAGS").join(" ")
+ << project->values("QMAKE_PKGCONFIG_CFLAGS").join(" ")
+ // << varGlue("DEFINES","-D"," -D"," ")
+ << " -I${includedir}" << endl;
+
+ // requires
+ const QString requires = project->values("QMAKE_PKGCONFIG_REQUIRES").join(" ");
+ if (!requires.isEmpty()) {
+ t << "Requires: " << requires << endl;
+ }
+
+ t << endl;
+}
+
QT_END_NAMESPACE
diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h
index afc034b..e0ef52d 100644
--- a/qmake/generators/makefile.h
+++ b/qmake/generators/makefile.h
@@ -105,6 +105,11 @@ protected:
virtual bool writeStubMakefile(QTextStream &t);
virtual bool writeMakefile(QTextStream &t);
+ QString pkgConfigPrefix() const;
+ QString pkgConfigFileName(bool fixify=true);
+ QString pkgConfigFixPath(QString) const;
+ void writePkgConfigFile(); // for pkg-config
+
//generating subtarget makefiles
struct SubTarget
{
diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp
index 26d587d..a3fba6a 100644
--- a/qmake/generators/metamakefile.cpp
+++ b/qmake/generators/metamakefile.cpp
@@ -138,12 +138,12 @@ BuildsMetaMakefileGenerator::init()
Build *build = new Build;
build->name = name;
build->makefile = createMakefileGenerator(project, false);
- if (build->makefile){
+ if (build->makefile){
makefiles += build;
- }else {
- delete build;
- return false;
- }
+ }else {
+ delete build;
+ return false;
+ }
}
return true;
}
@@ -179,7 +179,7 @@ BuildsMetaMakefileGenerator::write(const QString &oldpwd)
using_stdout = true;
} else {
if(Option::output.fileName().isEmpty() &&
- Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE)
+ Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE)
Option::output.setFileName(project->first("QMAKE_MAKEFILE"));
Option::output_dir = oldpwd;
QString build_name = build->name;
@@ -217,6 +217,7 @@ BuildsMetaMakefileGenerator::write(const QString &oldpwd)
// debugging
if(Option::debug_level) {
+ debug_msg(1, "Dumping all variables:");
QMap<QString, QStringList> &vars = project->variables();
for(QMap<QString, QStringList>::Iterator it = vars.begin(); it != vars.end(); ++it) {
if(!it.key().startsWith(".") && !it.value().isEmpty())
@@ -305,7 +306,7 @@ SubdirsMetaMakefileGenerator::init()
&& project->isRecursive());
if(recurse) {
QString old_output_dir = Option::output_dir;
- QString old_output = Option::output.fileName();
+ QString old_output = Option::output.fileName();
QString oldpwd = qmake_getpwd();
QString thispwd = oldpwd;
if(!thispwd.endsWith('/'))
@@ -386,7 +387,7 @@ SubdirsMetaMakefileGenerator::init()
self->input_dir = qmake_getpwd();
self->output_dir = Option::output_dir;
if(!recurse || (!Option::output.fileName().endsWith(Option::dir_sep) && !QFileInfo(Option::output).isDir()))
- self->output_file = Option::output.fileName();
+ self->output_file = Option::output.fileName();
self->makefile = new BuildsMetaMakefileGenerator(project, name, false);
self->makefile->init();
subs.append(self);
@@ -419,10 +420,10 @@ SubdirsMetaMakefileGenerator::write(const QString &oldpwd)
writepwd = oldpwd;
if(!(ret = subs.at(i)->makefile->write(writepwd)))
break;
- //restore because I'm paranoid
+ //restore because I'm paranoid
qmake_setpwd(pwd);
- Option::output.setFileName(output_name);
- Option::output_dir = output_dir;
+ Option::output.setFileName(output_name);
+ Option::output_dir = output_dir;
}
return ret;
}
@@ -447,6 +448,7 @@ QT_BEGIN_INCLUDE_NAMESPACE
#include "symmake_abld.h"
#include "symmake_sbsv2.h"
#include "symbian_makefile.h"
+#include "gbuild.h"
QT_END_INCLUDE_NAMESPACE
MakefileGenerator *
@@ -490,6 +492,8 @@ MetaMakefileGenerator::createMakefileGenerator(QMakeProject *proj, bool noIO)
mkfile = new SymbianMakefileTemplate<UnixMakefileGenerator>;
} else if(gen == "SYMBIAN_MINGW") {
mkfile = new SymbianMakefileTemplate<MingwMakefileGenerator>;
+ } else if(gen == "GBUILD") {
+ mkfile = new GBuildMakefileGenerator;
} else {
fprintf(stderr, "Unknown generator specified: %s\n", gen.toLatin1().constData());
}
@@ -555,6 +559,9 @@ MetaMakefileGenerator::modesForGenerator(const QString &gen,
*host_mode = Option::HOST_WIN_MODE;
#endif
*target_mode = Option::TARG_SYMBIAN_MODE;
+ } else if (gen == "GBUILD") {
+ *host_mode = Option::HOST_UNIX_MODE;
+ *target_mode = Option::TARG_INTEGRITY_MODE;
} else {
fprintf(stderr, "Unknown generator specified: %s\n", gen.toLatin1().constData());
return false;
diff --git a/qmake/generators/symbian/initprojectdeploy_symbian.cpp b/qmake/generators/symbian/initprojectdeploy_symbian.cpp
index 6a05cc1..8d04a42 100644
--- a/qmake/generators/symbian/initprojectdeploy_symbian.cpp
+++ b/qmake/generators/symbian/initprojectdeploy_symbian.cpp
@@ -169,9 +169,7 @@ void initProjectDeploySymbian(QMakeProject* project,
QStringList& generatedDirs,
QStringList& generatedFiles)
{
- QString targetPath = project->values("deploy.path").join(" ");
- if (targetPath.isEmpty())
- targetPath = testPath;
+ QString targetPath = testPath;
if (targetPath.endsWith("/") || targetPath.endsWith("\\"))
targetPath = targetPath.mid(0, targetPath.size() - 1);
@@ -225,7 +223,10 @@ void initProjectDeploySymbian(QMakeProject* project,
} else {
if (0 == platform.compare(QLatin1String(EMULATOR_DEPLOYMENT_PLATFORM))) {
if (devicePathHasDriveLetter) {
- devicePath = qt_epocRoot() + "epoc32/winscw/" + devicePath.remove(1, 1);
+ if (devicePath.startsWith("!"))
+ devicePath = qt_epocRoot() + "epoc32/winscw/c" + devicePath.remove(0, 2);
+ else
+ devicePath = qt_epocRoot() + "epoc32/winscw/" + devicePath.remove(1, 1);
} else {
devicePath = qt_epocRoot() + "epoc32/winscw/c" + devicePath;
}
@@ -255,7 +256,8 @@ void initProjectDeploySymbian(QMakeProject* project,
QStringList flags = project->values(item + ".flags");
- foreach(QString source, project->values(item + ".sources")) {
+ // ### Qt 5: remove .sources, inconsistent with INSTALLS
+ foreach(QString source, project->values(item + ".sources") + project->values(item + ".files")) {
source = Option::fixPathToLocalOS(source);
QString nameFilter;
QFileInfo info(source);
diff --git a/qmake/generators/symbian/symbian_makefile.h b/qmake/generators/symbian/symbian_makefile.h
index baf0d01..c49845a 100644
--- a/qmake/generators/symbian/symbian_makefile.h
+++ b/qmake/generators/symbian/symbian_makefile.h
@@ -72,7 +72,9 @@ public:
} else {
const QStringList deployments = this->project->values("DEPLOYMENT");
for (int i = 0; i < deployments.count(); ++i) {
- if (!this->project->values(deployments.at(i) + ".sources").isEmpty()) {
+ // ### Qt 5: remove .sources, inconsistent with INSTALLS
+ if (!this->project->values(deployments.at(i) + ".sources").isEmpty() ||
+ !this->project->values(deployments.at(i) + ".files").isEmpty()) {
generatePkg = true;
break;
}
diff --git a/qmake/generators/symbian/symbiancommon.cpp b/qmake/generators/symbian/symbiancommon.cpp
index c0afaaf..32b465b 100644
--- a/qmake/generators/symbian/symbiancommon.cpp
+++ b/qmake/generators/symbian/symbiancommon.cpp
@@ -396,8 +396,8 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile,
if (symbianLocalizationList.size()) {
// Add localized resources to DEPLOYMENT if default resource deployment is done
- addLocalizedResourcesToDeployment("default_resource_deployment.sources", symbianLocalizationList);
- addLocalizedResourcesToDeployment("default_reg_deployment.sources", symbianLocalizationList);
+ addLocalizedResourcesToDeployment("default_resource_deployment.files", symbianLocalizationList);
+ addLocalizedResourcesToDeployment("default_reg_deployment.files", symbianLocalizationList);
}
// deploy files specified by DEPLOYMENT variable
diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp
index 4f9f22d..08d3370 100644
--- a/qmake/generators/symbian/symmake.cpp
+++ b/qmake/generators/symbian/symmake.cpp
@@ -203,7 +203,9 @@ bool SymbianMakefileGenerator::writeMakefile(QTextStream &t)
generatePkg = true;
} else {
foreach(QString item, project->values("DEPLOYMENT")) {
- if (!project->values(item + ".sources").isEmpty()) {
+ // ### Qt 5: remove .sources, inconsistent with INSTALLS
+ if (!project->values(item + ".sources").isEmpty() ||
+ !project->values(item + ".files").isEmpty()) {
generatePkg = true;
break;
}
@@ -715,25 +717,13 @@ void SymbianMakefileGenerator::writeMmpFileLibraryPart(QTextStream& t)
if (lib.startsWith("-l")) {
lib.remove(0, 2);
QString mmpStatement;
- if (lib.endsWith(".dll")) {
- lib.chop(4);
- mmpStatement = "LIBRARY\t\t";
- } else if (lib.endsWith(".lib")) {
+ if (lib.endsWith(".lib")) {
lib.chop(4);
mmpStatement = "STATICLIBRARY\t";
} else {
- // Hacky way to find out what kind of library it is. Check the
- // ARMV5 build directory for library type. We default to shared
- // library, since that is more common.
- QString udebStaticLibLocation(qt_epocRoot());
- QString urelStaticLibLocation(udebStaticLibLocation);
- udebStaticLibLocation += QString("epoc32/release/armv5/udeb/%1.lib").arg(lib);
- urelStaticLibLocation += QString("epoc32/release/armv5/urel/%1.lib").arg(lib);
- if (QFile::exists(udebStaticLibLocation) || QFile::exists(urelStaticLibLocation)) {
- mmpStatement = "STATICLIBRARY\t";
- } else {
- mmpStatement = "LIBRARY\t\t";
- }
+ if (lib.endsWith(".dll"))
+ lib.chop(4);
+ mmpStatement = "LIBRARY\t\t";
}
t << mmpStatement << lib << ".lib" << endl;
}
diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp
index 0fdef86..767645a 100644
--- a/qmake/generators/symbian/symmake_sbsv2.cpp
+++ b/qmake/generators/symbian/symmake_sbsv2.cpp
@@ -84,6 +84,12 @@ static void fixFlmCmd(QString *cmdLine, const QMap<QString, QString> &commandsTo
// separator, so replace it with "&&" command concatenator.
cmdLine->replace("\n\t", "&&");
+ // Strip output suppression, as sbsv2 can't handle it in FLMs. Cannot be done by simply
+ // adding "@" to commandsToReplace, as it'd get handled last due to alphabetical ordering,
+ // potentially masking other commands that need replacing.
+ if (cmdLine->contains("@"))
+ cmdLine->replace(QRegExp(cmdFind.arg("@")), cmdReplace.arg(""));
+
// Iterate command replacements in reverse alphabetical order of keys so
// that keys which are starts of other longer keys are iterated after longer keys.
QMapIterator<QString, QString> cmdIter(commandsToReplace);
diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp
index 2f73134..e659e62 100644
--- a/qmake/generators/unix/unixmake.cpp
+++ b/qmake/generators/unix/unixmake.cpp
@@ -148,6 +148,8 @@ UnixMakefileGenerator::init()
project->values("QMAKE_LFLAGS") += var("QMAKE_LFLAGS_RPATH") + libdirs[i];
if (project->isActiveConfig("rvct_linker")) {
project->values("QMAKE_LIBDIR_FLAGS") += "--userlibpath " + escapeFilePath(libdirs[i]);
+ } else if (project->isActiveConfig("armcc_linker")) {
+ project->values("QMAKE_LIBDIR_FLAGS") += "-L--userlibpath=" + escapeFilePath(libdirs[i]);
} else {
project->values("QMAKE_LIBDIR_FLAGS") += "-L" + escapeFilePath(libdirs[i]);
}
@@ -206,6 +208,33 @@ UnixMakefileGenerator::init()
// icc style
pchFlags = pchFlags.replace("${QMAKE_PCH_OUTPUT}",
pchBaseName + project->first("QMAKE_PCH_OUTPUT_EXT"));
+ } else {
+ // gcc style (including clang_pch_style)
+ QString headerPrefix = project->first("QMAKE_PRECOMP_PREFIX");
+ QString headerSuffix;
+ if (project->isActiveConfig("clang_pch_style"))
+ headerSuffix = project->first("QMAKE_PCH_OUTPUT_EXT");
+ else
+ pchBaseName += project->first("QMAKE_PCH_OUTPUT_EXT");
+
+ pchBaseName += Option::dir_sep;
+ QString pchOutputFile;
+
+ if(comps[i] == "C") {
+ pchOutputFile = "c";
+ } else if(comps[i] == "CXX") {
+ pchOutputFile = "c++";
+ } else if(project->isActiveConfig("objective_c")) {
+ if(comps[i] == "OBJC")
+ pchOutputFile = "objective-c";
+ else if(comps[i] == "OBJCXX")
+ pchOutputFile = "objective-c++";
+ }
+
+ if(!pchOutputFile.isEmpty()) {
+ pchFlags = pchFlags.replace("${QMAKE_PCH_OUTPUT}",
+ pchBaseName + pchOutputFile + headerSuffix);
+ }
}
if (!pchFlags.isEmpty())
@@ -379,7 +408,9 @@ QStringList
QString header_prefix;
if(!project->isEmpty("PRECOMPILED_DIR"))
header_prefix = project->first("PRECOMPILED_DIR");
- header_prefix += project->first("QMAKE_ORIG_TARGET") + project->first("QMAKE_PCH_OUTPUT_EXT");
+ header_prefix += project->first("QMAKE_ORIG_TARGET");
+ if (!project->isActiveConfig("clang_pch_style"))
+ header_prefix += project->first("QMAKE_PCH_OUTPUT_EXT");
if (project->isActiveConfig("icc_pch_style")) {
// icc style
for(QStringList::Iterator it = Option::cpp_ext.begin(); it != Option::cpp_ext.end(); ++it) {
@@ -389,23 +420,25 @@ QStringList
}
}
} else {
- // gcc style
+ // gcc style (including clang_pch_style)
+ QString header_suffix = project->isActiveConfig("clang_pch_style")
+ ? project->first("QMAKE_PCH_OUTPUT_EXT") : "";
header_prefix += Option::dir_sep + project->first("QMAKE_PRECOMP_PREFIX");
for(QStringList::Iterator it = Option::c_ext.begin(); it != Option::c_ext.end(); ++it) {
if(file.endsWith(*it)) {
if(!project->isEmpty("QMAKE_CFLAGS_PRECOMPILE")) {
- QString precomp_c_h = header_prefix + "c";
+ QString precomp_c_h = header_prefix + "c" + header_suffix;
if(!ret.contains(precomp_c_h))
ret += precomp_c_h;
}
if(project->isActiveConfig("objective_c")) {
if(!project->isEmpty("QMAKE_OBJCFLAGS_PRECOMPILE")) {
- QString precomp_objc_h = header_prefix + "objective-c";
+ QString precomp_objc_h = header_prefix + "objective-c" + header_suffix;
if(!ret.contains(precomp_objc_h))
ret += precomp_objc_h;
}
if(!project->isEmpty("QMAKE_OBJCXXFLAGS_PRECOMPILE")) {
- QString precomp_objcpp_h = header_prefix + "objective-c++";
+ QString precomp_objcpp_h = header_prefix + "objective-c++" + header_suffix;
if(!ret.contains(precomp_objcpp_h))
ret += precomp_objcpp_h;
}
@@ -416,13 +449,13 @@ QStringList
for(QStringList::Iterator it = Option::cpp_ext.begin(); it != Option::cpp_ext.end(); ++it) {
if(file.endsWith(*it)) {
if(!project->isEmpty("QMAKE_CXXFLAGS_PRECOMPILE")) {
- QString precomp_cpp_h = header_prefix + "c++";
+ QString precomp_cpp_h = header_prefix + "c++" + header_suffix;
if(!ret.contains(precomp_cpp_h))
ret += precomp_cpp_h;
}
if(project->isActiveConfig("objective_c")) {
if(!project->isEmpty("QMAKE_OBJCXXFLAGS_PRECOMPILE")) {
- QString precomp_objcpp_h = header_prefix + "objective-c++";
+ QString precomp_objcpp_h = header_prefix + "objective-c++" + header_suffix;
if(!ret.contains(precomp_objcpp_h))
ret += precomp_objcpp_h;
}
@@ -455,7 +488,7 @@ UnixMakefileGenerator::findLibraries()
} else if(opt.startsWith("-l")) {
if (!project->isEmpty("QMAKE_RVCT_LINKSTYLE")) {
(*it) = opt.mid(2);
- } else if (project->isActiveConfig("rvct_linker")) {
+ } else if (project->isActiveConfig("rvct_linker") || project->isActiveConfig("armcc_linker")) {
(*it) = "lib" + opt.mid(2) + ".so";
} else {
stub = opt.mid(2);
diff --git a/qmake/generators/unix/unixmake.h b/qmake/generators/unix/unixmake.h
index 34d2d3f..acbe8c4 100644
--- a/qmake/generators/unix/unixmake.h
+++ b/qmake/generators/unix/unixmake.h
@@ -51,10 +51,6 @@ class UnixMakefileGenerator : public MakefileGenerator
bool init_flag, include_deps;
QString libtoolFileName(bool fixify=true);
void writeLibtoolFile(); // for libtool
- QString pkgConfigPrefix() const;
- QString pkgConfigFileName(bool fixify=true);
- QString pkgConfigFixPath(QString) const;
- void writePkgConfigFile(); // for pkg-config
void writePrlFile(QTextStream &);
public:
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp
index c660855..212f8bd 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -536,7 +536,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
t << "\n\t"
<< "-$(MOVE) $(TARGET) " << destdir;
if(!project->isEmpty("QMAKE_POST_LINK"))
- t << "\n\t" << var("QMAKE_POST_LINK") << "\n\t";
+ t << "\n\t" << var("QMAKE_POST_LINK");
t << endl << endl;
} else if(!project->isEmpty("QMAKE_BUNDLE")) {
t << "\n\t"
@@ -712,11 +712,18 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
t << info_plist_out << ": " << "\n\t";
if(!destdir.isEmpty())
t << mkdir_p_asstring(destdir) << "\n\t";
+ QStringList commonSedArgs;
+ if (!project->values("VERSION").isEmpty())
+ commonSedArgs << "-e \"s,@SHORT_VERSION@," << project->first("VER_MAJ") << "." << project->first("VER_MIN") << ",g\" ";
+ commonSedArgs << "-e \"s,@TYPEINFO@,"<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ?
+ QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" ";
if(project->first("TEMPLATE") == "app") {
QString icon = fileFixify(var("ICON"));
t << "@$(DEL_FILE) " << info_plist_out << "\n\t"
- << "@sed "
- << "-e \"s,@ICON@," << icon.section(Option::dir_sep, -1) << ",g\" "
+ << "@sed ";
+ foreach (const QString &arg, commonSedArgs)
+ t << arg;
+ t << "-e \"s,@ICON@," << icon.section(Option::dir_sep, -1) << ",g\" "
<< "-e \"s,@EXECUTABLE@," << var("QMAKE_ORIG_TARGET") << ",g\" "
<< "-e \"s,@TYPEINFO@,"<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ?
QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" "
@@ -732,9 +739,10 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
}
} else {
t << "@$(DEL_FILE) " << info_plist_out << "\n\t"
- << "@sed "
- << "-e \"s,@LIBRARY@," << var("QMAKE_ORIG_TARGET") << ",g\" "
- << "-e \"s,@SHORT_VERSION@," << project->first("VER_MAJ") << "." << project->first("VER_MIN") << ",g\" "
+ << "@sed ";
+ foreach (const QString &arg, commonSedArgs)
+ t << arg;
+ t << "-e \"s,@LIBRARY@," << var("QMAKE_ORIG_TARGET") << ",g\" "
<< "-e \"s,@TYPEINFO@,"
<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ?
QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" "
@@ -835,7 +843,9 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
if(!project->isEmpty("PRECOMPILED_DIR"))
precomph_out_dir = project->first("PRECOMPILED_DIR");
- precomph_out_dir += project->first("QMAKE_ORIG_TARGET") + project->first("QMAKE_PCH_OUTPUT_EXT");
+ precomph_out_dir += project->first("QMAKE_ORIG_TARGET");
+ if (!project->isActiveConfig("clang_pch_style"))
+ precomph_out_dir += project->first("QMAKE_PCH_OUTPUT_EXT");
if (project->isActiveConfig("icc_pch_style")) {
// icc style
@@ -849,19 +859,22 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
precomp_files << precomph_out_dir << sourceFile << objectFile;
} else {
- // gcc style
+ // gcc style (including clang_pch_style)
precomph_out_dir += Option::dir_sep;
QString header_prefix = project->first("QMAKE_PRECOMP_PREFIX");
+ QString header_suffix = project->isActiveConfig("clang_pch_style")
+ ? project->first("QMAKE_PCH_OUTPUT_EXT") : "";
+
if(!project->isEmpty("QMAKE_CFLAGS_PRECOMPILE"))
- precomp_files += precomph_out_dir + header_prefix + "c";
+ precomp_files += precomph_out_dir + header_prefix + "c" + header_suffix;
if(!project->isEmpty("QMAKE_CXXFLAGS_PRECOMPILE"))
- precomp_files += precomph_out_dir + header_prefix + "c++";
+ precomp_files += precomph_out_dir + header_prefix + "c++" + header_suffix;
if(project->isActiveConfig("objective_c")) {
if(!project->isEmpty("QMAKE_OBJCFLAGS_PRECOMPILE"))
- precomp_files += precomph_out_dir + header_prefix + "objective-c";
+ precomp_files += precomph_out_dir + header_prefix + "objective-c" + header_suffix;
if(!project->isEmpty("QMAKE_OBJCXXFLAGS_PRECOMPILE"))
- precomp_files += precomph_out_dir + header_prefix + "objective-c++";
+ precomp_files += precomph_out_dir + header_prefix + "objective-c++" + header_suffix;
}
}
t << "-$(DEL_FILE) " << precomp_files.join(" ") << "\n\t";
@@ -930,7 +943,9 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
QString pchOutput;
if(!project->isEmpty("PRECOMPILED_DIR"))
pchOutput = project->first("PRECOMPILED_DIR");
- pchOutput += pchBaseName + project->first("QMAKE_PCH_OUTPUT_EXT");
+ pchOutput += pchBaseName;
+ if (!project->isActiveConfig("clang_pch_style"))
+ pchOutput += project->first("QMAKE_PCH_OUTPUT_EXT");
if (project->isActiveConfig("icc_pch_style")) {
// icc style
@@ -943,9 +958,10 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
pchFlags = pchFlags.replace("${QMAKE_PCH_TEMP_SOURCE}", sourceFile)
.replace("${QMAKE_PCH_TEMP_OBJECT}", objectFile);
} else {
- // gcc style
+ // gcc style (including clang_pch_style)
QString header_prefix = project->first("QMAKE_PRECOMP_PREFIX");
-
+ QString header_suffix = project->isActiveConfig("clang_pch_style")
+ ? project->first("QMAKE_PCH_OUTPUT_EXT") : "";
pchOutput += Option::dir_sep;
QString pchOutputDir = pchOutput, pchOutputFile;
@@ -961,7 +977,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
}
if(pchOutputFile.isEmpty())
continue;
- pchOutput += header_prefix + pchOutputFile;
+ pchOutput += header_prefix + pchOutputFile + header_suffix;
t << pchOutput << ": " << pchInput << " " << findDependencies(pchInput).join(" \\\n\t\t")
<< "\n\t" << mkdir_p_asstring(pchOutputDir);
@@ -1332,177 +1348,4 @@ UnixMakefileGenerator::writeLibtoolFile()
"libdir='" << Option::fixPathToTargetOS(install_dir, false) << "'\n";
}
-QString
-UnixMakefileGenerator::pkgConfigFileName(bool fixify)
-{
- QString ret = var("TARGET");
- int slsh = ret.lastIndexOf(Option::dir_sep);
- if(slsh != -1)
- ret = ret.right(ret.length() - slsh - 1);
- if(ret.startsWith("lib"))
- ret = ret.mid(3);
- int dot = ret.indexOf('.');
- if(dot != -1)
- ret = ret.left(dot);
- ret += Option::pkgcfg_ext;
- if(!project->isEmpty("QMAKE_PKGCONFIG_DESTDIR"))
- ret.prepend(project->first("QMAKE_PKGCONFIG_DESTDIR") + Option::dir_sep);
- if(fixify) {
- if(QDir::isRelativePath(ret) && !project->isEmpty("DESTDIR"))
- ret.prepend(project->first("DESTDIR"));
- ret = Option::fixPathToLocalOS(fileFixify(ret, qmake_getpwd(), Option::output_dir));
- }
- return ret;
-}
-
-QString
-UnixMakefileGenerator::pkgConfigPrefix() const
-{
- if(!project->isEmpty("QMAKE_PKGCONFIG_PREFIX"))
- return project->first("QMAKE_PKGCONFIG_PREFIX");
- return QLibraryInfo::location(QLibraryInfo::PrefixPath);
-}
-
-QString
-UnixMakefileGenerator::pkgConfigFixPath(QString path) const
-{
- QString prefix = pkgConfigPrefix();
- if(path.startsWith(prefix))
- path = path.replace(prefix, "${prefix}");
- return path;
-}
-
-void
-UnixMakefileGenerator::writePkgConfigFile()
-{
- QString fname = pkgConfigFileName(), lname = fname;
- mkdir(fileInfo(fname).path());
- int slsh = lname.lastIndexOf(Option::dir_sep);
- if(slsh != -1)
- lname = lname.right(lname.length() - slsh - 1);
- QFile ft(fname);
- if(!ft.open(QIODevice::WriteOnly))
- return;
- project->values("ALL_DEPS").append(fileFixify(fname));
- QTextStream t(&ft);
-
- QString prefix = pkgConfigPrefix();
- QString libDir = project->first("QMAKE_PKGCONFIG_LIBDIR");
- if(libDir.isEmpty())
- libDir = prefix + Option::dir_sep + "lib" + Option::dir_sep;
- QString includeDir = project->first("QMAKE_PKGCONFIG_INCDIR");
- if(includeDir.isEmpty())
- includeDir = prefix + "/include";
-
- t << "prefix=" << prefix << endl;
- t << "exec_prefix=${prefix}\n"
- << "libdir=" << pkgConfigFixPath(libDir) << "\n"
- << "includedir=" << pkgConfigFixPath(includeDir) << endl;
- // non-standard entry. Provides useful info normally only
- // contained in the internal .qmake.cache file
- t << varGlue("CONFIG", "qt_config=", " ", "") << endl;
-
- //extra PKGCONFIG variables
- const QStringList &pkgconfig_vars = project->values("QMAKE_PKGCONFIG_VARIABLES");
- for(int i = 0; i < pkgconfig_vars.size(); ++i) {
- QString var = project->first(pkgconfig_vars.at(i) + ".name"),
- val = project->values(pkgconfig_vars.at(i) + ".value").join(" ");
- if(var.isEmpty())
- continue;
- if(val.isEmpty()) {
- const QStringList &var_vars = project->values(pkgconfig_vars.at(i) + ".variable");
- for(int v = 0; v < var_vars.size(); ++v) {
- const QStringList &vars = project->values(var_vars.at(v));
- for(int var = 0; var < vars.size(); ++var) {
- if(!val.isEmpty())
- val += " ";
- val += pkgConfigFixPath(vars.at(var));
- }
- }
- }
- t << var << "=" << val << endl;
- }
-
- t << endl;
-
- QString name = project->first("QMAKE_PKGCONFIG_NAME");
- if(name.isEmpty()) {
- name = project->first("QMAKE_ORIG_TARGET").toLower();
- name.replace(0, 1, name[0].toUpper());
- }
- t << "Name: " << name << endl;
- QString desc = project->values("QMAKE_PKGCONFIG_DESCRIPTION").join(" ");
- if(desc.isEmpty()) {
- if(name.isEmpty()) {
- desc = project->first("QMAKE_ORIG_TARGET").toLower();
- desc.replace(0, 1, desc[0].toUpper());
- } else {
- desc = name;
- }
- if(project->first("TEMPLATE") == "lib") {
- if(project->isActiveConfig("plugin"))
- desc += " Plugin";
- else
- desc += " Library";
- } else if(project->first("TEMPLATE") == "app") {
- desc += " Application";
- }
- }
- t << "Description: " << desc << endl;
- t << "Version: " << project->first("VERSION") << endl;
-
- // libs
- t << "Libs: ";
- QString pkgConfiglibDir;
- QString pkgConfiglibName;
- if (Option::target_mode == Option::TARG_MACX_MODE && project->isActiveConfig("lib_bundle")) {
- pkgConfiglibDir = "-F${libdir}";
- QString bundle;
- if (!project->isEmpty("QMAKE_FRAMEWORK_BUNDLE_NAME"))
- bundle = unescapeFilePath(project->first("QMAKE_FRAMEWORK_BUNDLE_NAME"));
- else
- bundle = unescapeFilePath(project->first("TARGET"));
- int suffix = bundle.lastIndexOf(".framework");
- if (suffix != -1)
- bundle = bundle.left(suffix);
- pkgConfiglibName = "-framework " + bundle + " ";
- } else {
- pkgConfiglibDir = "-L${libdir}";
- pkgConfiglibName = "-l" + lname.left(lname.length()-Option::libtool_ext.length());
- }
- t << pkgConfiglibDir << " " << pkgConfiglibName << " " << endl;
-
- QStringList libs;
- if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS")) {
- libs = project->values("QMAKE_INTERNAL_PRL_LIBS");
- } else {
- libs << "QMAKE_LIBS"; //obvious one
- }
- libs << "QMAKE_LIBS_PRIVATE";
- libs << "QMAKE_LFLAGS_THREAD"; //not sure about this one, but what about things like -pthread?
- t << "Libs.private: ";
- for(QStringList::ConstIterator it = libs.begin(); it != libs.end(); ++it) {
- t << project->values((*it)).join(" ") << " ";
- }
- t << endl;
-
- // flags
- // ### too many
- t << "Cflags: "
- // << var("QMAKE_CXXFLAGS") << " "
- << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ")
- << project->values("PRL_EXPORT_CXXFLAGS").join(" ")
- << project->values("QMAKE_PKGCONFIG_CFLAGS").join(" ")
- // << varGlue("DEFINES","-D"," -D"," ")
- << " -I${includedir}" << endl;
-
- // requires
- const QString requires = project->values("QMAKE_PKGCONFIG_REQUIRES").join(" ");
- if (!requires.isEmpty()) {
- t << "Requires: " << requires << endl;
- }
-
- t << endl;
-}
-
QT_END_NAMESPACE
diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp
index 6064080..462920e 100644
--- a/qmake/generators/win32/mingw_make.cpp
+++ b/qmake/generators/win32/mingw_make.cpp
@@ -142,6 +142,9 @@ bool MingwMakefileGenerator::writeMakefile(QTextStream &t)
if(project->first("TEMPLATE") == "app" ||
project->first("TEMPLATE") == "lib") {
+ if(project->isActiveConfig("create_pc") && project->first("TEMPLATE") == "lib")
+ writePkgConfigFile();
+
if(Option::mkfile::do_stub_makefile) {
t << "QMAKE = " << var("QMAKE_QMAKE") << endl;
QStringList &qut = project->values("QMAKE_EXTRA_TARGETS");
@@ -299,8 +302,10 @@ void MingwMakefileGenerator::init()
project->values("QMAKE_LFLAGS").append(QString("-Wl,--out-implib,") + project->first("MINGW_IMPORT_LIB"));
}
- if(!project->values("DEF_FILE").isEmpty() && project->values("QMAKE_SYMBIAN_SHLIB").isEmpty())
- project->values("QMAKE_LFLAGS").append(QString("-Wl,") + project->first("DEF_FILE"));
+ if(!project->values("DEF_FILE").isEmpty() && project->values("QMAKE_SYMBIAN_SHLIB").isEmpty()) {
+ QString defFileName = fileFixify(project->values("DEF_FILE")).first();
+ project->values("QMAKE_LFLAGS").append(QString("-Wl,") + escapeFilePath(defFileName));
+ }
MakefileGenerator::init();
diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp
index bd94178..9fd5fa9 100644
--- a/qmake/generators/win32/msbuild_objectmodel.cpp
+++ b/qmake/generators/win32/msbuild_objectmodel.cpp
@@ -50,26 +50,14 @@ QT_BEGIN_NAMESPACE
// XML Tags ---------------------------------------------------------
const char _CLCompile[] = "ClCompile";
-const char _Configuration[] = "Configuration";
-const char _Configurations[] = "Configurations";
-const char q_File[] = "File";
-const char _FileConfiguration[] = "FileConfiguration";
-const char q_Files[] = "Files";
-const char _Filter[] = "Filter";
-const char _Globals[] = "Globals";
const char _ItemGroup[] = "ItemGroup";
const char _Link[] = "Link";
const char _Midl[] = "Midl";
-const char _Platform[] = "Platform";
-const char _Platforms[] = "Platforms";
const char _ResourceCompile[] = "ResourceCompile";
-const char _Tool[] = "Tool";
-const char _VisualStudioProject[] = "VisualStudioProject";
// XML Properties ---------------------------------------------------
const char _AddModuleNamesToAssembly[] = "AddModuleNamesToAssembly";
const char _AdditionalDependencies[] = "AdditionalDependencies";
-const char _AdditionalFiles[] = "AdditionalFiles";
const char _AdditionalIncludeDirectories[] = "AdditionalIncludeDirectories";
const char _AdditionalLibraryDirectories[] = "AdditionalLibraryDirectories";
const char _AdditionalManifestDependencies[] = "AdditionalManifestDependencies";
@@ -97,11 +85,8 @@ const char _CLRSupportLastError[] = "CLRSupportLastError";
const char _CLRThreadAttribute[] = "CLRThreadAttribute";
const char _CLRUnmanagedCodeCheck[] = "CLRUnmanagedCodeCheck";
const char _Command[] = "Command";
-const char _CommandLine[] = "CommandLine";
const char _CompileAs[] = "CompileAs";
const char _CompileAsManaged[] = "CompileAsManaged";
-const char _CompileForArchitecture[] = "CompileForArchitecture";
-const char _CompileOnly[] = "CompileOnly";
const char _ConfigurationType[] = "ConfigurationType";
const char _CPreprocessOptions[] = "CPreprocessOptions";
const char _CreateHotpatchableImage[] = "CreateHotpatchableImage";
@@ -109,26 +94,20 @@ const char _CreateHotPatchableImage[] = "CreateHotPatchableImage";
const char _Culture[] = "Culture";
const char _DataExecutionPrevention[] = "DataExecutionPrevention";
const char _DebugInformationFormat[] = "DebugInformationFormat";
-const char _DefaultCharIsUnsigned[] = "DefaultCharIsUnsigned";
const char _DefaultCharType[] = "DefaultCharType";
const char _DelayLoadDLLs[] = "DelayLoadDLLs";
const char _DelaySign[] = "DelaySign";
const char _DeleteExtensionsOnClean[] = "DeleteExtensionsOnClean";
-const char _Description[] = "Description";
-const char _Detect64BitPortabilityProblems[] = "Detect64BitPortabilityProblems";
const char _DisableLanguageExtensions[] = "DisableLanguageExtensions";
const char _DisableSpecificWarnings[] = "DisableSpecificWarnings";
const char _DisplayLibrary[] = "DisplayLibrary";
const char _DLLDataFileName[] = "DLLDataFileName";
-const char _Driver[] = "Driver";
const char _EmbedManagedResourceFile[] = "EmbedManagedResourceFile";
const char _EnableCOMDATFolding[] = "EnableCOMDATFolding";
const char _EnableUAC[] = "EnableUAC";
const char _EnableErrorChecks[] = "EnableErrorChecks";
const char _EnableEnhancedInstructionSet[] = "EnableEnhancedInstructionSet";
const char _EnableFiberSafeOptimizations[] = "EnableFiberSafeOptimizations";
-const char _EnableFunctionLevelLinking[] = "EnableFunctionLevelLinking";
-const char _EnableIntrinsicFunctions[] = "EnableIntrinsicFunctions";
const char _EnablePREfast[] = "EnablePREfast";
const char _EntryPointSymbol[] = "EntryPointSymbol";
const char _ErrorCheckAllocations[] = "ErrorCheckAllocations";
@@ -138,64 +117,50 @@ const char _ErrorCheckRefPointers[] = "ErrorCheckRefPointers";
const char _ErrorCheckStubData[] = "ErrorCheckStubData";
const char _ErrorReporting[] = "ErrorReporting";
const char _ExceptionHandling[] = "ExceptionHandling";
-const char _ExcludedFromBuild[] = "ExcludedFromBuild";
const char _ExpandAttributedSource[] = "ExpandAttributedSource";
const char _ExportNamedFunctions[] = "ExportNamedFunctions";
const char _FavorSizeOrSpeed[] = "FavorSizeOrSpeed";
-const char _FixedBaseAddress[] = "FixedBaseAddress";
const char _FloatingPointModel[] = "FloatingPointModel";
const char _FloatingPointExceptions[] = "FloatingPointExceptions";
const char _ForceConformanceInForLoopScope[] = "ForceConformanceInForLoopScope";
-const char _ForceFileOutput[] = "ForceFileOutput";
const char _ForceSymbolReferences[] = "ForceSymbolReferences";
const char _ForcedIncludeFiles[] = "ForcedIncludeFiles";
const char _ForcedUsingFiles[] = "ForcedUsingFiles";
-const char _FullIncludePath[] = "FullIncludePath";
const char _FunctionLevelLinking[] = "FunctionLevelLinking";
const char _FunctionOrder[] = "FunctionOrder";
const char _GenerateClientFiles[] = "GenerateClientFiles";
const char _GenerateDebugInformation[] = "GenerateDebugInformation";
const char _GenerateManifest[] = "GenerateManifest";
const char _GenerateMapFile[] = "GenerateMapFile";
-const char _GeneratePreprocessedFile[] = "GeneratePreprocessedFile";
const char _GenerateServerFiles[] = "GenerateServerFiles";
const char _GenerateStublessProxies[] = "GenerateStublessProxies";
const char _GenerateTypeLibrary[] = "GenerateTypeLibrary";
const char _GenerateXMLDocumentationFiles[] = "GenerateXMLDocumentationFiles";
-const char _GlobalOptimizations[] = "GlobalOptimizations";
const char _HeaderFileName[] = "HeaderFileName";
const char _HeapCommitSize[] = "HeapCommitSize";
const char _HeapReserveSize[] = "HeapReserveSize";
const char _IgnoreAllDefaultLibraries[] = "IgnoreAllDefaultLibraries";
-const char _IgnoreDefaultLibraryNames[] = "IgnoreDefaultLibraryNames";
const char _IgnoreEmbeddedIDL[] = "IgnoreEmbeddedIDL";
const char _IgnoreImportLibrary[] = "IgnoreImportLibrary";
const char _IgnoreSpecificDefaultLibraries[] = "IgnoreSpecificDefaultLibraries";
const char _IgnoreStandardIncludePath[] = "IgnoreStandardIncludePath";
-const char _ImageHasSafeExceptionHandlers[] = "ImageHasSafeExceptionHandlers";
const char _ImportLibrary[] = "ImportLibrary";
-const char _ImproveFloatingPointConsistency[] = "ImproveFloatingPointConsistency";
const char _InlineFunctionExpansion[] = "InlineFunctionExpansion";
const char _IntrinsicFunctions[] = "IntrinsicFunctions";
const char _InterfaceIdentifierFileName[] = "InterfaceIdentifierFileName";
const char _IntermediateDirectory[] = "IntermediateDirectory";
-const char _InterworkCalls[] = "InterworkCalls";
const char _KeyContainer[] = "KeyContainer";
const char _KeyFile[] = "KeyFile";
-const char _Keyword[] = "Keyword";
-const char _KeepComments[] = "KeepComments";
const char _LargeAddressAware[] = "LargeAddressAware";
const char _LinkDLL[] = "LinkDLL";
const char _LinkErrorReporting[] = "LinkErrorReporting";
const char _LinkIncremental[] = "LinkIncremental";
const char _LinkStatus[] = "LinkStatus";
const char _LinkTimeCodeGeneration[] = "LinkTimeCodeGeneration";
-const char _LinkToManagedResourceFile[] = "LinkToManagedResourceFile";
const char _LocaleID[] = "LocaleID";
const char _ManifestFile[] = "ManifestFile";
const char _MapExports[] = "MapExports";
const char _MapFileName[] = "MapFileName";
-const char _MapLines[] = "MapLines ";
const char _MergedIDLBaseFileName[] = "MergedIDLBaseFileName";
const char _MergeSections[] = "MergeSections";
const char _Message[] = "Message";
@@ -203,32 +168,22 @@ const char _MidlCommandFile[] = "MidlCommandFile";
const char _MinimalRebuild[] = "MinimalRebuild";
const char _MkTypLibCompatible[] = "MkTypLibCompatible";
const char _ModuleDefinitionFile[] = "ModuleDefinitionFile";
-const char _MSDOSStubFileName[] = "MSDOSStubFileName";
const char _MultiProcessorCompilation[] = "MultiProcessorCompilation";
const char _Name[] = "Name";
const char _NoEntryPoint[] = "NoEntryPoint";
const char _NullTerminateStrings[] = "NullTerminateStrings";
-const char _ObjectFile[] = "ObjectFile";
const char _ObjectFiles[] = "ObjectFiles";
const char _ObjectFileName[] = "ObjectFileName";
const char _OmitDefaultLibName[] = "OmitDefaultLibName";
const char _OmitFramePointers[] = "OmitFramePointers";
-const char _OpenMP[] = "OpenMP";
const char _OpenMPSupport[] = "OpenMPSupport";
const char _Optimization[] = "Optimization";
-const char _OptimizeForProcessor[] = "OptimizeForProcessor";
-const char _OptimizeForWindows98[] = "OptimizeForWindows98";
-const char _OptimizeForWindowsApplication[] = "OptimizeForWindowsApplication";
const char _OptimizeReferences[] = "OptimizeReferences";
const char _OutputDirectory[] = "OutputDirectory";
const char _OutputFile[] = "OutputFile";
-const char _Outputs[] = "Outputs";
-const char _ParseFiles[] = "ParseFiles";
-const char _Path[] = "Path";
const char _PrecompiledHeader[] = "PrecompiledHeader";
const char _PrecompiledHeaderFile[] = "PrecompiledHeaderFile";
const char _PrecompiledHeaderOutputFile[] = "PrecompiledHeaderOutputFile";
-const char _PrecompiledHeaderThrough[] = "PrecompiledHeaderThrough";
const char _PreprocessorDefinitions[] = "PreprocessorDefinitions";
const char _PreprocessKeepComments[] = "PreprocessKeepComments";
const char _PreprocessOutputPath[] = "PreprocessOutputPath";
@@ -236,11 +191,7 @@ const char _PreprocessSuppressLineNumbers[] = "PreprocessSuppressLineNumbers
const char _PreprocessToFile[] = "PreprocessToFile";
const char _PreventDllBinding[] = "PreventDllBinding";
const char _PrimaryOutput[] = "PrimaryOutput";
-const char _Profile[] = "Profile";
-const char _ProfileGuidedDatabase[] = "ProfileGuidedDatabase";
-const char _ProjectGUID[] = "ProjectGUID";
const char _ProcessorNumber[] = "ProcessorNumber";
-const char _ProjectType[] = "ProjectType";
const char _ProgramDatabase[] = "ProgramDatabase";
const char _ProgramDataBaseFileName[] = "ProgramDataBaseFileName";
const char _ProgramDatabaseFile[] = "ProgramDatabaseFile";
@@ -248,22 +199,16 @@ const char _ProxyFileName[] = "ProxyFileName";
const char _RandomizedBaseAddress[] = "RandomizedBaseAddress";
const char _RedirectOutputAndErrors[] = "RedirectOutputAndErrors";
const char _RegisterOutput[] = "RegisterOutput";
-const char _RelativePath[] = "RelativePath";
-const char _RemoteDirectory[] = "RemoteDirectory";
const char _RemoveObjects[] = "RemoveObjects";
-const char _ResourceOnlyDLL[] = "ResourceOnlyDLL";
const char _ResourceOutputFileName[] = "ResourceOutputFileName";
const char _RuntimeLibrary[] = "RuntimeLibrary";
const char _RuntimeTypeInfo[] = "RuntimeTypeInfo";
-const char _SccProjectName[] = "SccProjectName";
-const char _SccLocalPath[] = "SccLocalPath";
const char _SectionAlignment[] = "SectionAlignment";
const char _ServerStubFile[] = "ServerStubFile";
const char _SetChecksum[] = "SetChecksum";
const char _ShowIncludes[] = "ShowIncludes";
const char _ShowProgress[] = "ShowProgress";
const char _SmallerTypeCheck[] = "SmallerTypeCheck";
-const char _SpecifySectionAttributes[] = "SpecifySectionAttributes";
const char _StackCommitSize[] = "StackCommitSize";
const char _StackReserveSize[] = "StackReserveSize";
const char _StringPooling[] = "StringPooling";
@@ -294,19 +239,12 @@ const char _UACExecutionLevel[] = "UACExecutionLevel";
const char _UACUIAccess[] = "UACUIAccess";
const char _UndefineAllPreprocessorDefinitions[]= "UndefineAllPreprocessorDefinitions";
const char _UndefinePreprocessorDefinitions[] = "UndefinePreprocessorDefinitions";
-const char _UniqueIdentifier[] = "UniqueIdentifier";
const char _UseFullPaths[] = "UseFullPaths";
const char _UseOfATL[] = "UseOfATL";
const char _UseOfMfc[] = "UseOfMfc";
-const char _UsePrecompiledHeader[] = "UsePrecompiledHeader";
const char _UseUnicodeForAssemblerListing[] = "UseUnicodeForAssemblerListing";
const char _ValidateAllParameters[] = "ValidateAllParameters";
-const char _VCCLCompilerTool[] = "VCCLCompilerTool";
-const char _VCLibrarianTool[] = "VCLibrarianTool";
-const char _VCLinkerTool[] = "VCLinkerTool";
const char _VCCustomBuildTool[] = "VCCustomBuildTool";
-const char _VCResourceCompilerTool[] = "VCResourceCompilerTool";
-const char _VCMIDLTool[] = "VCMIDLTool";
const char _Verbose[] = "Verbose";
const char _Version[] = "Version";
const char _WarnAsError[] = "WarnAsError";
@@ -343,7 +281,6 @@ inline XmlOutput::xml_output attrTagS(const char *name, const QString &v)
return tagValue(name, v);
}
-
inline XmlOutput::xml_output attrTagX(const char *name, const QStringList &v, const char *s = ",")
{
if(v.isEmpty())
@@ -376,743 +313,1013 @@ inline XmlOutput::xml_output valueTagT( const triState v)
return valueTag(v == _True ? "true" : "false");
}
-
static QString vcxCommandSeparator()
{
// MSBuild puts the contents of the custom commands into a batch file and calls it.
// As we want every sub-command to be error-checked (as is done by makefile-based
// backends), we insert the checks ourselves, using the undocumented jump target.
static QString cmdSep =
- QLatin1String("&#x000D;&#x000A;if errorlevel 1 goto VCEnd&#x000D;&#x000A;");
+ QLatin1String("&#x000D;&#x000A;if errorlevel 1 goto VCEnd&#x000D;&#x000A;");
return cmdSep;
}
-// VCXCLCompilerTool -------------------------------------------------
-VCXCLCompilerTool::VCXCLCompilerTool()
- : BrowseInformation(_False),
- BufferSecurityCheck(_False),
- CreateHotpatchableImage(unset),
- DisableLanguageExtensions(unset),
- EnableFiberSafeOptimizations(unset),
- EnablePREfast(unset),
- ExpandAttributedSource(unset),
- FloatingPointExceptions(unset),
- ForceConformanceInForLoopScope(unset),
- FunctionLevelLinking(unset),
- GenerateXMLDocumentationFiles(unset),
- IgnoreStandardIncludePath(unset),
- IntrinsicFunctions(unset),
- MinimalRebuild(unset),
- MultiProcessorCompilation(unset),
- OmitDefaultLibName(unset),
- OmitFramePointers(unset),
- Optimization("Disabled"),
- OpenMPSupport(unset),
- PreprocessKeepComments(unset),
- PreprocessSuppressLineNumbers(unset),
- RuntimeTypeInfo(unset),
- ShowIncludes(unset),
- SmallerTypeCheck(unset),
- StringPooling(unset),
- SuppressStartupBanner(unset),
- TreatWarningAsError(unset),
- TreatWChar_tAsBuiltInType(unset),
- UndefineAllPreprocessorDefinitions(unset),
- UseFullPaths(unset),
- UseUnicodeForAssemblerListing(unset),
- WholeProgramOptimization(unset)
+// Tree file generation ---------------------------------------------
+void XTreeNode::generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &tagName, VCProject &tool, const QString &filter) {
+
+ if (children.size()) {
+ // Filter
+ QString tempFilterName;
+ ChildrenMap::ConstIterator it, end = children.constEnd();
+ if (!tagName.isEmpty()) {
+ tempFilterName.append(filter);
+ tempFilterName.append("\\");
+ tempFilterName.append(tagName);
+ xmlFilter << tag(_ItemGroup);
+ xmlFilter << tag("Filter")
+ << attrTag("Include", tempFilterName)
+ << closetag();
+ xmlFilter << closetag();
+ }
+ // First round, do nested filters
+ for (it = children.constBegin(); it != end; ++it)
+ if ((*it)->children.size())
+ {
+ if ( !tempFilterName.isEmpty() )
+ (*it)->generateXML(xml, xmlFilter, it.key(), tool, tempFilterName);
+ else
+ (*it)->generateXML(xml, xmlFilter, it.key(), tool, filter);
+ }
+ // Second round, do leafs
+ for (it = children.constBegin(); it != end; ++it)
+ if (!(*it)->children.size())
+ {
+ if ( !tempFilterName.isEmpty() )
+ (*it)->generateXML(xml, xmlFilter, it.key(), tool, tempFilterName);
+ else
+ (*it)->generateXML(xml, xmlFilter, it.key(), tool, filter);
+ }
+ } else {
+ // Leaf
+ xml << tag(_ItemGroup);
+ xmlFilter << tag(_ItemGroup);
+ VCXProjectWriter::outputFileConfigs(tool, xml, xmlFilter, info, filter);
+ xmlFilter << closetag();
+ xml << closetag();
+ }
+}
+
+// Flat file generation ---------------------------------------------
+void XFlatNode::generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &/*tagName*/, VCProject &tool, const QString &filter) {
+ if (children.size()) {
+ ChildrenMapFlat::ConstIterator it = children.constBegin();
+ ChildrenMapFlat::ConstIterator end = children.constEnd();
+ xml << tag(_ItemGroup);
+ xmlFilter << tag(_ItemGroup);
+ for (; it != end; ++it) {
+ VCXProjectWriter::outputFileConfigs(tool, xml, xmlFilter, (*it), filter);
+ }
+ xml << closetag();
+ xmlFilter << closetag();
+ }
+}
+
+void VCXProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool)
+{
+ xml.setIndentString(" ");
+
+ xml << decl("1.0", "utf-8")
+ << tag("Project")
+ << attrTag("DefaultTargets","Build")
+ << attrTag("ToolsVersion", "4.0")
+ << attrTag("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003")
+ << tag("ItemGroup")
+ << attrTag("Label", "ProjectConfigurations");
+
+ xml << tag("ProjectConfiguration")
+ << attrTag("Include" , tool.Configuration.Name)
+ << tagValue("Configuration", tool.Configuration.ConfigurationName)
+ << tagValue("Platform", tool.PlatformName)
+ << closetag();
+
+ xml << closetag()
+ << tag("PropertyGroup")
+ << attrTag("Label", "Globals")
+ << tagValue("ProjectGuid", tool.ProjectGUID)
+ << tagValue("RootNamespace", tool.Name)
+ << tagValue("Keyword", tool.Keyword)
+ << closetag();
+
+ // config part.
+ xml << import("Project", "$(VCTargetsPath)\\Microsoft.Cpp.Default.props");
+
+ write(xml, tool.Configuration);
+
+ xml << import("Project", "$(VCTargetsPath)\\Microsoft.Cpp.props");
+
+ // Extension settings
+ xml << tag("ImportGroup")
+ << attrTag("Label", "ExtensionSettings")
+ << closetag();
+
+ // PropertySheets
+ xml << tag("ImportGroup")
+ << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.Configuration.Name))
+ << attrTag("Label", "PropertySheets");
+
+ xml << tag("Import")
+ << attrTag("Project", "$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props")
+ << attrTag("Condition", "exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')")
+ << closetag()
+ << closetag();
+
+
+ // UserMacros
+ xml << tag("PropertyGroup")
+ << attrTag("Label", "UserMacros")
+ << closetag();
+
+ xml << tag("PropertyGroup");
+
+ if ( !tool.Configuration.OutputDirectory.isEmpty() ) {
+ xml<< tag("OutDir")
+ << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.Configuration.Name))
+ << valueTag(tool.Configuration.OutputDirectory);
+ }
+ if ( !tool.Configuration.IntermediateDirectory.isEmpty() ) {
+ xml<< tag("IntDir")
+ << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.Configuration.Name))
+ << valueTag(tool.Configuration.IntermediateDirectory);
+ }
+ if ( !tool.Configuration.PrimaryOutput.isEmpty() ) {
+ xml<< tag("TargetName")
+ << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.Configuration.Name))
+ << valueTag(tool.Configuration.PrimaryOutput);
+ }
+
+ if ( tool.Configuration.linker.IgnoreImportLibrary != unset) {
+ xml<< tag("IgnoreImportLibrary")
+ << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.Configuration.Name))
+ << valueTagT(tool.Configuration.linker.IgnoreImportLibrary);
+ }
+
+ if ( tool.Configuration.linker.LinkIncremental != linkIncrementalDefault) {
+ const triState ts = (tool.Configuration.linker.LinkIncremental == linkIncrementalYes ? _True : _False);
+ xml<< tag("LinkIncremental")
+ << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.Configuration.Name))
+ << valueTagT(ts);
+ }
+
+ if ( tool.Configuration.preBuild.ExcludedFromBuild != unset )
+ {
+ xml<< tag("PreBuildEventUseInBuild")
+ << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.Configuration.Name))
+ << valueTagT(!tool.Configuration.preBuild.ExcludedFromBuild);
+ }
+
+ if ( tool.Configuration.preLink.ExcludedFromBuild != unset )
+ {
+ xml<< tag("PreLinkEventUseInBuild")
+ << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.Configuration.Name))
+ << valueTagT(!tool.Configuration.preLink.ExcludedFromBuild);
+ }
+
+ if ( tool.Configuration.postBuild.ExcludedFromBuild != unset )
+ {
+ xml<< tag("PostBuildEventUseInBuild")
+ << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.Configuration.Name))
+ << valueTagT(!tool.Configuration.postBuild.ExcludedFromBuild);
+ }
+ xml << closetag();
+
+ xml << tag("ItemDefinitionGroup")
+ << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.Configuration.Name));
+
+ // ClCompile
+ write(xml, tool.Configuration.compiler);
+
+ // Link
+ write(xml, tool.Configuration.linker);
+
+ // Midl
+ write(xml, tool.Configuration.idl);
+
+ // ResourceCompiler
+ write(xml, tool.Configuration.resource);
+
+ // Post build event
+ if ( tool.Configuration.postBuild.ExcludedFromBuild != unset )
+ write(xml, tool.Configuration.postBuild);
+
+ // Pre build event
+ if ( tool.Configuration.preBuild.ExcludedFromBuild != unset )
+ write(xml, tool.Configuration.preBuild);
+
+ // Pre link event
+ if ( tool.Configuration.preLink.ExcludedFromBuild != unset )
+ write(xml, tool.Configuration.preLink);
+
+ xml << closetag();
+
+ QFile filterFile;
+ filterFile.setFileName(Option::output.fileName().append(".filters"));
+ filterFile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate);
+ QTextStream ts(&filterFile);
+ XmlOutput xmlFilter(ts, XmlOutput::NoConversion);
+
+ xmlFilter.setIndentString(" ");
+
+ xmlFilter << decl("1.0", "utf-8")
+ << tag("Project")
+ << attrTag("ToolsVersion", "4.0")
+ << attrTag("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003");
+
+ xmlFilter << tag("ItemGroup");
+
+ VCProject tempProj;
+ tempProj.SingleProjects += tool;
+
+ addFilters(tempProj, xmlFilter, "Form Files");
+ addFilters(tempProj, xmlFilter, "Generated Files");
+ addFilters(tempProj, xmlFilter, "Header Files");
+ addFilters(tempProj, xmlFilter, "LexYacc Files");
+ addFilters(tempProj, xmlFilter, "Resource Files");
+ addFilters(tempProj, xmlFilter, "Source Files");
+ addFilters(tempProj, xmlFilter, "Translation Files");
+ xmlFilter << closetag();
+
+ outputFilter(tempProj, xml, xmlFilter, "Source Files");
+ outputFilter(tempProj, xml, xmlFilter, "Header Files");
+ outputFilter(tempProj, xml, xmlFilter, "Generated Files");
+ outputFilter(tempProj, xml, xmlFilter, "LexYacc Files");
+ outputFilter(tempProj, xml, xmlFilter, "Translation Files");
+ outputFilter(tempProj, xml, xmlFilter, "Form Files");
+ outputFilter(tempProj, xml, xmlFilter, "Resource Files");
+
+ for (int x = 0; x < tempProj.ExtraCompilers.count(); ++x) {
+ outputFilter(tempProj, xml, xmlFilter, tempProj.ExtraCompilers.at(x));
+ }
+
+ xml << import("Project", "$(VCTargetsPath)\\Microsoft.Cpp.targets");
+
+ xml << tag("ImportGroup")
+ << attrTag("Label", "ExtensionTargets")
+ << closetag();
+}
+
+void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool)
+{
+ if (tool.SingleProjects.count() == 0) {
+ warn_msg(WarnLogic, "Generator: .NET: no single project in merge project, no output");
+ return;
+ }
+
+ xml.setIndentString(" ");
+
+ xml << decl("1.0", "utf-8")
+ << tag("Project")
+ << attrTag("DefaultTargets","Build")
+ << attrTag("ToolsVersion", "4.0")
+ << attrTag("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003")
+ << tag("ItemGroup")
+ << attrTag("Label", "ProjectConfigurations");
+
+ for (int i = 0; i < tool.SingleProjects.count(); ++i) {
+ xml << tag("ProjectConfiguration")
+ << attrTag("Include" , tool.SingleProjects.at(i).Configuration.Name)
+ << tagValue("Configuration", tool.SingleProjects.at(i).Configuration.ConfigurationName)
+ << tagValue("Platform", tool.SingleProjects.at(i).PlatformName)
+ << closetag();
+ }
+
+ xml << closetag()
+ << tag("PropertyGroup")
+ << attrTag("Label", "Globals")
+ << tagValue("ProjectGuid", tool.ProjectGUID)
+ << tagValue("RootNamespace", tool.Name)
+ << tagValue("Keyword", tool.Keyword)
+ << closetag();
+
+ // config part.
+ xml << import("Project", "$(VCTargetsPath)\\Microsoft.Cpp.Default.props");
+ for (int i = 0; i < tool.SingleProjects.count(); ++i)
+ write(xml, tool.SingleProjects.at(i).Configuration);
+ xml << import("Project", "$(VCTargetsPath)\\Microsoft.Cpp.props");
+
+ // Extension settings
+ xml << tag("ImportGroup")
+ << attrTag("Label", "ExtensionSettings")
+ << closetag();
+
+ // PropertySheets
+ for (int i = 0; i < tool.SingleProjects.count(); ++i) {
+ xml << tag("ImportGroup")
+ << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.SingleProjects.at(i).Configuration.Name))
+ << attrTag("Label", "PropertySheets");
+
+ xml << tag("Import")
+ << attrTag("Project", "$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props")
+ << attrTag("Condition", "exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')")
+ << closetag()
+ << closetag();
+ }
+
+ // UserMacros
+ xml << tag("PropertyGroup")
+ << attrTag("Label", "UserMacros")
+ << closetag();
+
+ xml << tag("PropertyGroup");
+ for (int i = 0; i < tool.SingleProjects.count(); ++i) {
+
+ if ( !tool.SingleProjects.at(i).Configuration.OutputDirectory.isEmpty() ) {
+ xml << tag("OutDir")
+ << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.SingleProjects.at(i).Configuration.Name))
+ << valueTag(tool.SingleProjects.at(i).Configuration.OutputDirectory);
+ }
+ if ( !tool.SingleProjects.at(i).Configuration.IntermediateDirectory.isEmpty() ) {
+ xml << tag("IntDir")
+ << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.SingleProjects.at(i).Configuration.Name))
+ << valueTag(tool.SingleProjects.at(i).Configuration.IntermediateDirectory);
+ }
+ if ( !tool.SingleProjects.at(i).Configuration.PrimaryOutput.isEmpty() ) {
+ xml << tag("TargetName")
+ << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.SingleProjects.at(i).Configuration.Name))
+ << valueTag(tool.SingleProjects.at(i).Configuration.PrimaryOutput);
+ }
+
+ if ( tool.SingleProjects.at(i).Configuration.linker.IgnoreImportLibrary != unset) {
+ xml << tag("IgnoreImportLibrary")
+ << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.SingleProjects.at(i).Configuration.Name))
+ << valueTagT(tool.SingleProjects.at(i).Configuration.linker.IgnoreImportLibrary);
+ }
+
+ if ( tool.SingleProjects.at(i).Configuration.linker.LinkIncremental != unset) {
+ const triState ts = (tool.SingleProjects.at(i).Configuration.linker.LinkIncremental == linkIncrementalYes ? _True : _False);
+ xml << tag("LinkIncremental")
+ << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.SingleProjects.at(i).Configuration.Name))
+ << valueTagT(ts);
+ }
+
+ if ( tool.SingleProjects.at(i).Configuration.preBuild.ExcludedFromBuild != unset )
+ {
+ xml << tag("PreBuildEventUseInBuild")
+ << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.SingleProjects.at(i).Configuration.Name))
+ << valueTagT(!tool.SingleProjects.at(i).Configuration.preBuild.ExcludedFromBuild);
+ }
+
+ if ( tool.SingleProjects.at(i).Configuration.preLink.ExcludedFromBuild != unset )
+ {
+ xml << tag("PreLinkEventUseInBuild")
+ << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.SingleProjects.at(i).Configuration.Name))
+ << valueTagT(!tool.SingleProjects.at(i).Configuration.preLink.ExcludedFromBuild);
+ }
+
+ if ( tool.SingleProjects.at(i).Configuration.postBuild.ExcludedFromBuild != unset )
+ {
+ xml << tag("PostBuildEventUseInBuild")
+ << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.SingleProjects.at(i).Configuration.Name))
+ << valueTagT(!tool.SingleProjects.at(i).Configuration.postBuild.ExcludedFromBuild);
+ }
+ }
+ xml << closetag();
+
+ for (int i = 0; i < tool.SingleProjects.count(); ++i) {
+ xml << tag("ItemDefinitionGroup")
+ << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.SingleProjects.at(i).Configuration.Name));
+
+ // ClCompile
+ write(xml, tool.SingleProjects.at(i).Configuration.compiler);
+
+ // Link
+ write(xml, tool.SingleProjects.at(i).Configuration.linker);
+
+ // Midl
+ write(xml, tool.SingleProjects.at(i).Configuration.idl);
+
+ // ResourceCompiler
+ write(xml, tool.SingleProjects.at(i).Configuration.resource);
+
+ // Post build event
+ if ( tool.SingleProjects.at(i).Configuration.postBuild.ExcludedFromBuild != unset )
+ write(xml, tool.SingleProjects.at(i).Configuration.postBuild);
+
+ // Pre build event
+ if ( tool.SingleProjects.at(i).Configuration.preBuild.ExcludedFromBuild != unset )
+ write(xml, tool.SingleProjects.at(i).Configuration.preBuild);
+
+ // Pre link event
+ if ( tool.SingleProjects.at(i).Configuration.preLink.ExcludedFromBuild != unset )
+ write(xml, tool.SingleProjects.at(i).Configuration.preLink);
+
+ xml << closetag();
+ }
+
+ // The file filters are added in a separate file for MSBUILD.
+ QFile filterFile;
+ filterFile.setFileName(Option::output.fileName().append(".filters"));
+ filterFile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate);
+ QTextStream ts(&filterFile);
+ XmlOutput xmlFilter(ts, XmlOutput::NoConversion);
+
+ xmlFilter.setIndentString(" ");
+
+ xmlFilter << decl("1.0", "utf-8")
+ << tag("Project")
+ << attrTag("ToolsVersion", "4.0")
+ << attrTag("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003");
+
+ xmlFilter << tag("ItemGroup");
+
+ addFilters(tool, xmlFilter, "Form Files");
+ addFilters(tool, xmlFilter, "Generated Files");
+ addFilters(tool, xmlFilter, "Header Files");
+ addFilters(tool, xmlFilter, "LexYacc Files");
+ addFilters(tool, xmlFilter, "Resource Files");
+ addFilters(tool, xmlFilter, "Source Files");
+ addFilters(tool, xmlFilter, "Translation Files");
+ xmlFilter << closetag();
+
+ outputFilter(tool, xml, xmlFilter, "Source Files");
+ outputFilter(tool, xml, xmlFilter, "Header Files");
+ outputFilter(tool, xml, xmlFilter, "Generated Files");
+ outputFilter(tool, xml, xmlFilter, "LexYacc Files");
+ outputFilter(tool, xml, xmlFilter, "Translation Files");
+ outputFilter(tool, xml, xmlFilter, "Form Files");
+ outputFilter(tool, xml, xmlFilter, "Resource Files");
+ for (int x = 0; x < tool.ExtraCompilers.count(); ++x) {
+ outputFilter(tool, xml, xmlFilter, tool.ExtraCompilers.at(x));
+ }
+ outputFilter(tool, xml, xmlFilter, "Root Files");
+
+ xml << import("Project", "$(VCTargetsPath)\\Microsoft.Cpp.targets");
+
+ xml << tag("ImportGroup")
+ << attrTag("Label", "ExtensionTargets")
+ << closetag();
+}
+
+static inline QString toString(asmListingOption option)
+{
+ switch (option) {
+ case asmListingAsmMachine:
+ return "AssemblyAndMachineCode";
+ case asmListingAsmMachineSrc:
+ return "All";
+ case asmListingAsmSrc:
+ return "AssemblyAndSourceCode";
+ case asmListingAssemblyOnly:
+ return "AssemblyCode";
+ }
+ return QString();
+}
+
+static inline QString toString(basicRuntimeCheckOption option)
+{
+ switch (option) {
+ case runtimeBasicCheckNone:
+ return "";
+ case runtimeCheckStackFrame:
+ return "StackFrameRuntimeCheck";
+ case runtimeCheckUninitVariables:
+ return "UninitializedLocalUsageCheck";
+ case runtimeBasicCheckAll:
+ return "EnableFastChecks";
+ }
+ return QString();
+}
+
+static inline QString toString(callingConventionOption option)
+{
+ switch (option) {
+ case callConventionCDecl:
+ return "Cdecl";
+ case callConventionFastCall:
+ return "FastCall";
+ case callConventionStdCall:
+ return "StdCall";
+ }
+ return QString();
+}
+
+static inline QString toString(CompileAsOptions option)
+{
+ switch (option) {
+ case compileAsC:
+ return "CompileAsC";
+ case compileAsCPlusPlus:
+ return "CompileAsCpp";
+ }
+ return QString();
+}
+
+static inline QString toString(compileAsManagedOptions option)
+{
+ switch (option) {
+ case managedAssembly:
+ return "true";
+ case managedAssemblyPure:
+ return "Safe";
+ case managedAssemblyOldSyntax:
+ return "OldSyntax";
+ }
+ return QString();
+}
+
+static inline QString toString(debugOption option)
+{
+ switch (option) {
+ case debugOldStyleInfo:
+ return "OldStyle";
+ case debugEditAndContinue:
+ return "EditAndContinue";
+ case debugEnabled:
+ return "ProgramDatabase";
+ }
+ return QString();
+}
+
+static inline QString toString(enhancedInstructionSetOption option)
+{
+ switch (option) {
+ case archSSE:
+ return "StreamingSIMDExtensions";
+ case archSSE2:
+ return "StreamingSIMDExtensions2";
+ }
+ return QString();
+}
+
+static inline QString toString(exceptionHandling option)
+{
+ switch (option) {
+ case ehNone:
+ return "false";
+ case ehNoSEH:
+ return "Sync";
+ case ehSEH:
+ return "Async";
+ }
+ return QString();
+}
+
+static inline QString toString(favorSizeOrSpeedOption option)
+{
+ switch (option) {
+ case favorSize:
+ return "Size";
+ case favorSpeed:
+ return "Speed";
+ }
+ return QString();
+}
+
+static inline QString toString(floatingPointModel option)
+{
+ switch (option) {
+ case floatingPointFast:
+ return "Fast";
+ case floatingPointPrecise:
+ return "Precise";
+ case floatingPointStrict:
+ return "Strict";
+ }
+ return QString();
+}
+
+static inline QString toString(inlineExpansionOption option)
+{
+ switch (option) {
+ case expandDisable:
+ return "Disabled";
+ case expandOnlyInline:
+ return "OnlyExplicitInline";
+ case expandAnySuitable:
+ return "AnySuitable";
+ }
+ return QString();
+}
+
+static inline QString toString(optimizeOption option)
+{
+ switch (option) {
+ case optimizeMinSpace:
+ return "MinSpace";
+ case optimizeMaxSpeed:
+ return "MaxSpeed";
+ }
+ return QString();
+}
+
+static inline QString toString(pchOption option)
+{
+ switch (option) {
+ case pchNone:
+ return "NotUsing";
+ case pchCreateUsingSpecific:
+ return "Create";
+ case pchUseUsingSpecific:
+ return "Use";
+ }
+ return QString();
+}
+
+static inline QString toString(runtimeLibraryOption option)
+{
+ switch (option) {
+ case rtMultiThreaded:
+ return "MultiThreaded";
+ case rtMultiThreadedDLL:
+ return "MultiThreadedDLL";
+ case rtMultiThreadedDebug:
+ return "MultiThreadedDebug";
+ case rtMultiThreadedDebugDLL:
+ return "MultiThreadedDebugDLL";
+ }
+ return QString();
+}
+
+static inline QString toString(structMemberAlignOption option)
{
+ switch (option) {
+ case alignSingleByte:
+ return "1Byte";
+ case alignTwoBytes:
+ return "2Bytes";
+ case alignFourBytes:
+ return "4Bytes";
+ case alignEightBytes:
+ return "8Bytes";
+ case alignSixteenBytes:
+ return "16Bytes";
+ }
+ return QString();
+}
+
+static inline QString toString(warningLevelOption option)
+{
+ switch (option) {
+ case warningLevel_0:
+ return "TurnOffAllWarnings";
+ case warningLevel_1:
+ return "Level1";
+ case warningLevel_2:
+ return "Level2";
+ case warningLevel_3:
+ return "Level3";
+ case warningLevel_4:
+ return "Level4";
+ }
+ return QString();
+}
+
+static inline QString toString(optLinkTimeCodeGenType option)
+{
+ switch (option) {
+ case optLTCGEnabled:
+ return "UseLinkTimeCodeGeneration";
+ case optLTCGInstrument:
+ return "PGInstrument";
+ case optLTCGOptimize:
+ return "PGOptimization";
+ case optLTCGUpdate:
+ return "PGUpdate";
+ }
+ return QString();
+}
+
+static inline QString toString(subSystemOption option)
+{
+ switch (option) {
+ case subSystemConsole:
+ return "Console";
+ case subSystemWindows:
+ return "Windows";
+ }
+ return QString();
+}
+
+static inline QString toString(machineTypeOption option)
+{
+ switch (option) {
+ case machineX86:
+ return "MachineX86";
+ case machineX64:
+ return "MachineX64";
+ }
+ return QString();
+}
+
+static inline QString toString(midlCharOption option)
+{
+ switch (option) {
+ case midlCharUnsigned:
+ return "Unsigned";
+ case midlCharSigned:
+ return "Signed";
+ case midlCharAscii7:
+ return "Ascii";
+ }
+ return QString();
+}
+
+static inline QString toString(midlErrorCheckOption option)
+{
+ switch (option) {
+ case midlDisableAll:
+ return "None";
+ case midlEnableAll:
+ return "All";
+ }
+ return QString();
+}
+
+static inline QString toString(midlStructMemberAlignOption option)
+{
+ switch (option) {
+ case midlAlignSingleByte:
+ return "1";
+ case midlAlignTwoBytes:
+ return "2";
+ case midlAlignFourBytes:
+ return "4";
+ case midlAlignEightBytes:
+ return "8";
+ case midlAlignSixteenBytes:
+ return "16";
+ }
+ return QString();
+}
+
+static inline QString toString(midlTargetEnvironment option)
+{
+ switch (option) {
+ case midlTargetWin32:
+ return "Win32";
+ case midlTargetWin64:
+ return "X64";
+ }
+ return QString();
+}
+
+static inline QString toString(midlWarningLevelOption option)
+{
+ switch (option) {
+ case midlWarningLevel_0:
+ return "0";
+ case midlWarningLevel_1:
+ return "1";
+ case midlWarningLevel_2:
+ return "2";
+ case midlWarningLevel_3:
+ return "3";
+ case midlWarningLevel_4:
+ return "4";
+ }
+ return QString();
+}
+
+static inline QString toString(enumResourceLangID option)
+{
+ if (option == 0)
+ return QString();
+ else
+ return QString::number(qlonglong(option));
+}
+
+static inline QString toString(charSet option)
+{
+ switch (option) {
+ case charSetNotSet:
+ return "NotSet";
+ case charSetUnicode:
+ return "Unicode";
+ case charSetMBCS:
+ return "MultiByte";
+ }
+ return QString();
+}
+
+static inline QString toString(ConfigurationTypes option)
+{
+ switch (option) {
+ case typeApplication:
+ return "Application";
+ case typeDynamicLibrary:
+ return "DynamicLibrary";
+ case typeStaticLibrary:
+ return "StaticLibrary";
+ }
+ return QString();
+}
+
+static inline QString toString(useOfATL option)
+{
+ switch (option) {
+ case useATLStatic:
+ return "Static";
+ case useATLDynamic:
+ return "Dynamic";
+ }
+ return QString();
+}
+
+static inline QString toString(useOfMfc option)
+{
+ switch (option) {
+ case useMfcStatic:
+ return "Static";
+ case useMfcDynamic:
+ return "Dynamic";
+ }
+ return QString();
+}
+
+static inline triState toTriState(browseInfoOption option)
+{
+ switch (option)
+ {
+ case brInfoNone:
+ return _False;
+ case brAllInfo:
+ case brNoLocalSymbols:
+ return _True;
+ }
+ return unset;
+}
+
+static inline triState toTriState(preprocessOption option)
+{
+ switch (option)
+ {
+ case preprocessNo:
+ return _False;
+ case preprocessNoLineNumbers:
+ case preprocessYes:
+ return _True;
+ }
+ return unset;
+}
+
+static inline triState toTriState(optFoldingType option)
+{
+ switch (option)
+ {
+ case optNoFolding:
+ return _False;
+ case optFolding:
+ return _True;
+ }
+ return unset;
+}
+
+static inline triState toTriState(addressAwarenessType option)
+{
+ switch (option)
+ {
+ case addrAwareDefault:
+ return unset;
+ case addrAwareNoLarge:
+ return _False;
+ case addrAwareLarge:
+ return _True;
+ }
+ return unset;
+}
+
+static inline triState toTriState(linkIncrementalType option)
+{
+ switch (option)
+ {
+ case linkIncrementalDefault:
+ return unset;
+ case linkIncrementalNo:
+ return _False;
+ case linkIncrementalYes:
+ return _True;
+ }
+ return unset;
}
-XmlOutput &operator<<(XmlOutput &xml, const VCXCLCompilerTool &tool)
+static inline triState toTriState(linkProgressOption option)
{
- return xml
+ switch (option)
+ {
+ case linkProgressNotSet:
+ return unset;
+ case linkProgressAll:
+ case linkProgressLibs:
+ return _True;
+ }
+ return unset;
+}
+
+static inline triState toTriState(optRefType option)
+{
+ switch (option)
+ {
+ case optReferencesDefault:
+ return unset;
+ case optNoReferences:
+ return _False;
+ case optReferences:
+ return _True;
+ }
+ return unset;
+}
+
+static inline triState toTriState(termSvrAwarenessType option)
+{
+ switch (option)
+ {
+ case termSvrAwareDefault:
+ return unset;
+ case termSvrAwareNo:
+ return _False;
+ case termSvrAwareYes:
+ return _True;
+ }
+ return unset;
+}
+
+void VCXProjectWriter::write(XmlOutput &xml, const VCCLCompilerTool &tool)
+{
+ xml
<< tag(_CLCompile)
<< attrTagX(_AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories, ";")
<< attrTagX(_AdditionalOptions, tool.AdditionalOptions, " ")
<< attrTagX(_AdditionalUsingDirectories, tool.AdditionalUsingDirectories, ";")
- << attrTagS(_AlwaysAppend, tool.AlwaysAppend)
+//unused << attrTagS(_AlwaysAppend, tool.AlwaysAppend)
<< attrTagS(_AssemblerListingLocation, tool.AssemblerListingLocation)
- << attrTagS(_AssemblerOutput, tool.AssemblerOutput)
- << attrTagS(_BasicRuntimeChecks, tool.BasicRuntimeChecks)
- << attrTagT(_BrowseInformation, tool.BrowseInformation)
+ << attrTagS(_AssemblerOutput, toString(tool.AssemblerOutput))
+ << attrTagS(_BasicRuntimeChecks, toString(tool.BasicRuntimeChecks))
+ << attrTagT(_BrowseInformation, toTriState(tool.BrowseInformation))
<< attrTagS(_BrowseInformationFile, tool.BrowseInformationFile)
<< attrTagT(_BufferSecurityCheck, tool.BufferSecurityCheck)
- << attrTagS(_CallingConvention, tool.CallingConvention)
- << attrTagS(_CompileAs, tool.CompileAs)
- << attrTagS(_CompileAsManaged, tool.CompileAsManaged)
+ << attrTagS(_CallingConvention, toString(tool.CallingConvention))
+ << attrTagS(_CompileAs, toString(tool.CompileAs))
+ << attrTagS(_CompileAsManaged, toString(tool.CompileAsManaged))
<< attrTagT(_CreateHotpatchableImage, tool.CreateHotpatchableImage)
- << attrTagS(_DebugInformationFormat, tool.DebugInformationFormat)
+ << attrTagS(_DebugInformationFormat, toString(tool.DebugInformationFormat))
<< attrTagT(_DisableLanguageExtensions, tool.DisableLanguageExtensions)
<< attrTagX(_DisableSpecificWarnings, tool.DisableSpecificWarnings, ";")
- << attrTagS(_EnableEnhancedInstructionSet, tool.EnableEnhancedInstructionSet)
+ << attrTagS(_EnableEnhancedInstructionSet, toString(tool.EnableEnhancedInstructionSet))
<< attrTagT(_EnableFiberSafeOptimizations, tool.EnableFiberSafeOptimizations)
<< attrTagT(_EnablePREfast, tool.EnablePREfast)
<< attrTagS(_ErrorReporting, tool.ErrorReporting)
- << attrTagS(_ExceptionHandling, tool.ExceptionHandling)
+ << attrTagS(_ExceptionHandling, toString(tool.ExceptionHandling))
<< attrTagT(_ExpandAttributedSource, tool.ExpandAttributedSource)
- << attrTagS(_FavorSizeOrSpeed, tool.FavorSizeOrSpeed)
+ << attrTagS(_FavorSizeOrSpeed, toString(tool.FavorSizeOrSpeed))
<< attrTagT(_FloatingPointExceptions, tool.FloatingPointExceptions)
- << attrTagS(_FloatingPointModel, tool.FloatingPointModel)
+ << attrTagS(_FloatingPointModel, toString(tool.FloatingPointModel))
<< attrTagT(_ForceConformanceInForLoopScope, tool.ForceConformanceInForLoopScope)
<< attrTagX(_ForcedIncludeFiles, tool.ForcedIncludeFiles, ";")
<< attrTagX(_ForcedUsingFiles, tool.ForcedUsingFiles, ";")
- << attrTagT(_FunctionLevelLinking, tool.FunctionLevelLinking)
+ << attrTagT(_FunctionLevelLinking, tool.EnableFunctionLevelLinking)
<< attrTagT(_GenerateXMLDocumentationFiles, tool.GenerateXMLDocumentationFiles)
<< attrTagT(_IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath)
- << attrTagS(_InlineFunctionExpansion, tool.InlineFunctionExpansion)
- << attrTagT(_IntrinsicFunctions, tool.IntrinsicFunctions)
+ << attrTagS(_InlineFunctionExpansion, toString(tool.InlineFunctionExpansion))
+ << attrTagT(_IntrinsicFunctions, tool.EnableIntrinsicFunctions)
<< attrTagT(_MinimalRebuild, tool.MinimalRebuild)
<< attrTagT(_MultiProcessorCompilation, tool.MultiProcessorCompilation)
- << attrTagS(_ObjectFileName, tool.ObjectFileName)
- << attrTagX(_ObjectFiles, tool.ObjectFiles, ";")
+ << attrTagS(_ObjectFileName, tool.ObjectFile)
+//unused << attrTagX(_ObjectFiles, tool.ObjectFiles, ";")
<< attrTagT(_OmitDefaultLibName, tool.OmitDefaultLibName)
<< attrTagT(_OmitFramePointers, tool.OmitFramePointers)
- << attrTagT(_OpenMPSupport, tool.OpenMPSupport)
- << attrTagS(_Optimization, tool.Optimization)
- << attrTagS(_PrecompiledHeader, tool.PrecompiledHeader)
- << attrTagS(_PrecompiledHeaderFile, tool.PrecompiledHeaderFile)
- << attrTagS(_PrecompiledHeaderOutputFile, tool.PrecompiledHeaderOutputFile)
- << attrTagT(_PreprocessKeepComments, tool.PreprocessKeepComments)
+ << attrTagT(_OpenMPSupport, tool.OpenMP)
+ << attrTagS(_Optimization, toString(tool.Optimization))
+ << attrTagS(_PrecompiledHeader, toString(tool.UsePrecompiledHeader))
+ << attrTagS(_PrecompiledHeaderFile, tool.PrecompiledHeaderThrough)
+ << attrTagS(_PrecompiledHeaderOutputFile, tool.PrecompiledHeaderFile)
+ << attrTagT(_PreprocessKeepComments, tool.KeepComments)
<< attrTagX(_PreprocessorDefinitions, tool.PreprocessorDefinitions, ";")
<< attrTagS(_PreprocessOutputPath, tool.PreprocessOutputPath)
<< attrTagT(_PreprocessSuppressLineNumbers, tool.PreprocessSuppressLineNumbers)
- << attrTagT(_PreprocessToFile, tool.PreprocessToFile)
+ << attrTagT(_PreprocessToFile, toTriState(tool.GeneratePreprocessedFile))
<< attrTagS(_ProgramDataBaseFileName, tool.ProgramDataBaseFileName)
- << attrTagS(_ProcessorNumber, tool.ProcessorNumber)
- << attrTagS(_RuntimeLibrary, tool.RuntimeLibrary)
+ << attrTagS(_ProcessorNumber, tool.MultiProcessorCompilationProcessorCount)
+ << attrTagS(_RuntimeLibrary, toString(tool.RuntimeLibrary))
<< attrTagT(_RuntimeTypeInfo, tool.RuntimeTypeInfo)
<< attrTagT(_ShowIncludes, tool.ShowIncludes)
<< attrTagT(_SmallerTypeCheck, tool.SmallerTypeCheck)
<< attrTagT(_StringPooling, tool.StringPooling)
- << attrTagS(_StructMemberAlignment, tool.StructMemberAlignment)
+ << attrTagS(_StructMemberAlignment, toString(tool.StructMemberAlignment))
<< attrTagT(_SuppressStartupBanner, tool.SuppressStartupBanner)
- << attrTagS(_TreatSpecificWarningsAsErrors, tool.TreatSpecificWarningsAsErrors)
- << attrTagT(_TreatWarningAsError, tool.TreatWarningAsError)
+//unused << attrTagS(_TreatSpecificWarningsAsErrors, tool.TreatSpecificWarningsAsErrors)
+ << attrTagT(_TreatWarningAsError, tool.WarnAsError)
<< attrTagT(_TreatWChar_tAsBuiltInType, tool.TreatWChar_tAsBuiltInType)
<< attrTagT(_UndefineAllPreprocessorDefinitions, tool.UndefineAllPreprocessorDefinitions)
<< attrTagX(_UndefinePreprocessorDefinitions, tool.UndefinePreprocessorDefinitions, ";")
- << attrTagT(_UseFullPaths, tool.UseFullPaths)
+ << attrTagT(_UseFullPaths, tool.DisplayFullPaths)
<< attrTagT(_UseUnicodeForAssemblerListing, tool.UseUnicodeForAssemblerListing)
- << attrTagS(_WarningLevel, tool.WarningLevel)
+ << attrTagS(_WarningLevel, toString(tool.WarningLevel))
<< attrTagT(_WholeProgramOptimization, tool.WholeProgramOptimization)
<< attrTagS(_XMLDocumentationFileName, tool.XMLDocumentationFileName)
<< closetag(_CLCompile);
}
-bool VCXCLCompilerTool::parseOption(const char* option)
-{
- // skip index 0 ('/' or '-')
- char first = option[1];
- char second = option[2];
- char third = option[3];
- char fourth = option[4];
- bool found = true;
-
- switch (first) {
- case '?':
- qWarning("Generator: Option '/?' : MSVC.NET projects do not support outputting help info");
- found = false;
- break;
- case '@':
- qWarning("Generator: Option '/@': MSVC.NET projects do not support the use of a response file");
- found = false;
- break;
- case 'l':
- qWarning("Generator: Option '/link': qmake generator does not support passing link options through the compiler tool");
- found = false;
- break;
- case 'A':
- if(second != 'I') {
- found = false;
- break;
- }
- AdditionalUsingDirectories += option+3;
- break;
- case 'C':
- PreprocessKeepComments = _True;
- break;
- case 'D':
- PreprocessorDefinitions += option+2;
- break;
- case 'E':
- if(second == 'H') {
- QString opt(option);
- if (opt.endsWith("EHa"))
- ExceptionHandling = "Async";
- else if (opt.endsWith("EHsc"))
- ExceptionHandling = "Sync";
- else if (opt.endsWith("EHs"))
- ExceptionHandling = "SyncCThrow";
- else {
- ExceptionHandling = "false";
- }
- break;
- }else if(second == 'P') {
- PreprocessSuppressLineNumbers = _True;
- }
- found = false;
- break;
- case 'F':
- if(second <= '9' && second >= '0') {
- AdditionalOptions += option;
- break;
- } else {
- switch (second) {
- case 'A':
- if(third == 'c') {
- AssemblerOutput = "AssemblyAndMachineCode";
- if(fourth == 's')
- AssemblerOutput = "All";
- } else if(third == 's') {
- AssemblerOutput = "AssemblyAndSourceCode";
- } else if(third == 'u') {
- UseUnicodeForAssemblerListing = _True;
- } else {
- AssemblerOutput = "AssemblyCode";
- }
- break;
- case 'a':
- AssemblerListingLocation = option+3;
- break;
- case 'C':
- UseFullPaths = _True;
- break;
- case 'd':
- ProgramDataBaseFileName = option+3;
- break;
- case 'I':
- ForcedIncludeFiles += option+3;
- break;
- case 'i':
- PreprocessOutputPath += option+3;
- break;
- case 'm':
- AdditionalOptions += option;
- break;
- case 'R':
- BrowseInformation = _True;
- BrowseInformationFile = option+3;
- break;
- case 'r':
- BrowseInformation = _True;
- BrowseInformationFile = option+3;
- break;
- case 'U':
- ForcedUsingFiles += option+3;
- break;
- case 'o':
- ObjectFileName = option+3;
- break;
- case 'p':
- PrecompiledHeaderOutputFile = option+3;
- break;
- case 'x':
- ExpandAttributedSource = _True;
- break;
- default:
- found = false;
- break;
- }
- }
- break;
- case 'G':
- switch (second) {
- case 'F':
- StringPooling = _True;
- break;
- case 'L':
- WholeProgramOptimization = _True;
- if(third == '-')
- WholeProgramOptimization = _False;
- break;
- case 'R':
- RuntimeTypeInfo = _True;
- if(third == '-')
- RuntimeTypeInfo = _False;
- break;
- case 'S':
- BufferSecurityCheck = _True;
- if(third == '-')
- BufferSecurityCheck = _False;
- break;
- case 'T':
- EnableFiberSafeOptimizations = _True;
- break;
- case 'd':
- CallingConvention = "Cdecl";
- break;
- case 'm':
- MinimalRebuild = _True;
- if(third == '-')
- MinimalRebuild = _False;
- break;
- case 'r':
- CallingConvention = "FastCall";
- break;
- case 'y':
- FunctionLevelLinking = _True;
- break;
- case 'z':
- CallingConvention = "StdCall";
- break;
- default:
- found = false;
- break;
- }
- break;
- case 'H':
- AdditionalOptions += option;
- break;
- case 'I':
- AdditionalIncludeDirectories += option+2;
- break;
- case 'L':
- if(second == 'D') {
- AdditionalOptions += option;
- break;
- }
- found = false;
- break;
- case 'M':
- if(second == 'D') {
- RuntimeLibrary = "MultiThreadedDLL";
- if(third == 'd')
- RuntimeLibrary = "MultiThreadedDebugDLL";
- break;
- } else if(second == 'P') {
- MultiProcessorCompilation = _True;
- ProcessorNumber = option+3;
- break;
- } else if(second == 'T') {
- RuntimeLibrary = "MultiThreaded";
- if(third == 'd')
- RuntimeLibrary = "MultiThreadedDebug";
- break;
- }
- found = false;
- break;
- case 'O':
- switch (second) {
- case '1':
- Optimization = "MinSpace";
- break;
- case '2':
- Optimization = "MaxSpeed";
- break;
- case 'b':
- if(third == '0')
- InlineFunctionExpansion = "Disabled";
- else if(third == '1')
- InlineFunctionExpansion = "OnlyExplicitInline";
- else if(third == '2')
- InlineFunctionExpansion = "AnySuitable";
- else
- found = false;
- break;
- case 'd':
- Optimization = "Disabled";
- break;
- case 'i':
- IntrinsicFunctions = _True;
- break;
- case 'p':
- if(third == 'e')
- OpenMPSupport = _True;
- else
- found = false;
- break;
- case 's':
- FavorSizeOrSpeed = "Size";
- break;
- case 't':
- FavorSizeOrSpeed = "Speed";
- break;
- case 'x':
- Optimization = "Full";
- break;
- case 'y':
- OmitFramePointers = _True;
- if(third == '-')
- OmitFramePointers = _False;
- break;
- default:
- found = false;
- break;
- }
- break;
- case 'P':
- PreprocessToFile = _True;
- break;
- case 'Q':
- if(second == 'I') {
- AdditionalOptions += option;
- break;
- }
- found = false;
- break;
- case 'R':
- if(second == 'T' && third == 'C') {
- if(fourth == '1')
- BasicRuntimeChecks = "EnableFastChecks";
- else if(fourth == 'c')
- SmallerTypeCheck = _True;
- else if(fourth == 's')
- BasicRuntimeChecks = "StackFrameRuntimeCheck";
- else if(fourth == 'u')
- BasicRuntimeChecks = "UninitializedLocalUsageCheck";
- else
- found = false; break;
- }
- break;
- case 'T':
- if(second == 'C') {
- CompileAs = "CompileAsC";
- } else if(second == 'P') {
- CompileAs = "CompileAsCpp";
- } else {
- qWarning("Generator: Options '/Tp<filename>' and '/Tc<filename>' are not supported by qmake");
- found = false; break;
- }
- break;
- case 'U':
- UndefinePreprocessorDefinitions += option+2;
- break;
- case 'V':
- AdditionalOptions += option;
- break;
- case 'W':
- switch (second) {
- case 'a':
- WarningLevel = "EnableAllWarnings";
- break;
- case '4':
- WarningLevel = "Level4";
- break;
- case '3':
- WarningLevel = "Level3";
- break;
- case '2':
- WarningLevel = "Level2";
- break;
- case '1':
- WarningLevel = "Level1";
- break;
- case '0':
- WarningLevel = "TurnOffAllWarnings";
- break;
- case 'L':
- AdditionalOptions += option;
- break;
- case 'X':
- TreatWarningAsError = _True;
- break;
- case 'p':
- if(third == '6' && fourth == '4') {
- // Deprecated for VS2010 but can be used under Additional Options.
- AdditionalOptions += option;
- break;
- }
- // Fallthrough
- default:
- found = false; break;
- }
- break;
- case 'X':
- IgnoreStandardIncludePath = _True;
- break;
- case 'Y':
- switch (second) {
- case '\0':
- case '-':
- AdditionalOptions += option;
- break;
- case 'c':
- PrecompiledHeader = "Create";
- PrecompiledHeaderFile = option+3;
- break;
- case 'd':
- case 'l':
- AdditionalOptions += option;
- break;
- case 'u':
- PrecompiledHeader = "Use";
- PrecompiledHeaderFile = option+3;
- break;
- default:
- found = false; break;
- }
- break;
- case 'Z':
- switch (second) {
- case '7':
- DebugInformationFormat = "OldStyle";
- break;
- case 'I':
- DebugInformationFormat = "EditAndContinue";
- break;
- case 'i':
- DebugInformationFormat = "ProgramDatabase";
- break;
- case 'l':
- OmitDefaultLibName = _True;
- break;
- case 'a':
- DisableLanguageExtensions = _True;
- break;
- case 'e':
- DisableLanguageExtensions = _False;
- break;
- case 'c':
- if(third == ':') {
- const char *c = option + 4;
- // Go to the end of the option
- while ( *c != '\0' && *c != ' ' && *c != '-')
- ++c;
- if(fourth == 'f')
- ForceConformanceInForLoopScope = ((*c) == '-' ? _False : _True);
- else if(fourth == 'w')
- TreatWChar_tAsBuiltInType = ((*c) == '-' ? _False : _True);
- else
- found = false;
- } else {
- found = false; break;
- }
- break;
- case 'g':
- case 'm':
- case 's':
- AdditionalOptions += option;
- break;
- case 'p':
- switch (third)
- {
- case '\0':
- case '1':
- StructMemberAlignment = "1Byte";
- if(fourth == '6')
- StructMemberAlignment = "16Bytes";
- break;
- case '2':
- StructMemberAlignment = "2Bytes";
- break;
- case '4':
- StructMemberAlignment = "4Bytes";
- break;
- case '8':
- StructMemberAlignment = "8Bytes";
- break;
- default:
- found = false; break;
- }
- break;
- default:
- found = false; break;
- }
- break;
- case 'a':
- if (second == 'r' && third == 'c' && fourth == 'h') {
- if (option[5] == ':') {
- const char *o = option;
- if (o[6] == 'S' && o[7] == 'S' && o[8] == 'E') {
- EnableEnhancedInstructionSet = o[9] == '2' ? "StreamingSIMDExtensions2" : "StreamingSIMDExtensions";
- break;
- }
- }
- } else if (second == 'n' && third == 'a' && fourth == 'l') {
- EnablePREfast = _True;
- break;
- }
- found = false;
- break;
- case 'b': // see http://msdn.microsoft.com/en-us/library/fwkeyyhe%28VS.100%29.aspx
- if (second == 'i' && third == 'g' && fourth == 'o') {
- const char *o = option;
- if (o[5] == 'b' && o[6] == 'j') {
- AdditionalOptions += option;
- break;
- }
- }
- found = false;
- break;
- case 'c':
- if(second == 'l') {
- if(*(option+5) == 'p') {
- CompileAsManaged = "Pure";
- } else if(*(option+5) == 's') {
- CompileAsManaged = "Safe";
- } else if(*(option+5) == 'o') {
- CompileAsManaged = "OldSyntax";
- } else {
- CompileAsManaged = "true";
- }
- } else {
- found = false;
- break;
- }
- break;
- case 'd':
- if(second != 'o' && third == 'c') {
- GenerateXMLDocumentationFiles = _True;
- XMLDocumentationFileName += option+4;
- break;
- }
- found = false;
- break;
- case 'e':
- if (second == 'r' && third == 'r' && fourth == 'o') {
- if (option[12] == ':') {
- if ( option[13] == 'n') {
- ErrorReporting = "None";
- } else if (option[13] == 'p') {
- ErrorReporting = "Prompt";
- } else if (option[13] == 'q') {
- ErrorReporting = "Queue";
- } else if (option[13] == 's') {
- ErrorReporting = "Send";
- } else {
- found = false;
- }
- break;
- }
- }
- found = false;
- break;
- case 'f':
- if(second == 'p' && third == ':') {
- // Go to the end of the option
- const char *c = option + 4;
- while (*c != '\0' && *c != ' ' && *c != '-')
- ++c;
- switch (fourth) {
- case 'e':
- FloatingPointExceptions = ((*c) == '-' ? _False : _True);
- break;
- case 'f':
- FloatingPointModel = "Fast";
- break;
- case 'p':
- FloatingPointModel = "Precise";
- break;
- case 's':
- FloatingPointModel = "Strict";
- break;
- default:
- found = false;
- break;
- }
- }
- break;
- case 'h':
- if(second == 'o' && third == 't' && fourth == 'p') {
- CreateHotpatchableImage = _True;
- break;
- }
- qWarning("Generator: Option '/help': MSVC.NET projects do not support outputting help info");
- found = false;
- break;
- case 'n':
- if(second == 'o' && third == 'l' && fourth == 'o') {
- SuppressStartupBanner = _True;
- break;
- }
- found = false;
- break;
- case 'o':
- if (second == 'p' && third == 'e' && fourth == 'n') {
- OpenMPSupport = _True;
- break;
- }
- found = false;
- break;
- case 's':
- if(second == 'h' && third == 'o' && fourth == 'w') {
- ShowIncludes = _True;
- break;
- }
- found = false;
- break;
- case 'u':
- UndefineAllPreprocessorDefinitions = _True;
- break;
- case 'v':
- if(second == 'd' || second == 'm') {
- AdditionalOptions += option;
- break;
- }
- found = false;
- break;
- case 'w':
- switch (second) {
- case 'd':
- DisableSpecificWarnings += option+3;
- break;
- case 'e':
- TreatSpecificWarningsAsErrors = option+3;
- break;
- default:
- AdditionalOptions += option;
- }
- break;
- default:
- AdditionalOptions += option;
- break;
- }
- if(!found) {
- warn_msg(WarnLogic, "Could not parse Compiler option: %s, added as AdditionalOption", option);
- AdditionalOptions += option;
- }
- return true;
-}
-
-// VCLinkerTool -----------------------------------------------------
-VCXLinkerTool::VCXLinkerTool()
- : AllowIsolation(unset),
- AssemblyDebug(unset),
- DataExecutionPrevention(unset),
- DelaySign(unset),
- EnableCOMDATFolding(unset),
- EnableUAC(unset),
- FixedBaseAddress(unset),
- GenerateDebugInformation(unset),
- GenerateManifest(unset),
- GenerateMapFile(unset),
- HeapCommitSize(-1),
- HeapReserveSize(-1),
- IgnoreAllDefaultLibraries(unset),
- IgnoreEmbeddedIDL(unset),
- IgnoreImportLibrary(_True),
- ImageHasSafeExceptionHandlers(unset),
- LargeAddressAware(unset),
- LinkDLL(unset),
- LinkIncremental(unset),
- LinkStatus(unset),
- MapExports(unset),
- NoEntryPoint(unset),
- OptimizeReferences(unset),
- PreventDllBinding(unset),
- RandomizedBaseAddress(unset),
- RegisterOutput(unset),
- SectionAlignment(-1),
- SetChecksum(unset),
- //StackCommitSize(-1),
- //StackReserveSize(-1),
- SupportNobindOfDelayLoadedDLL(unset),
- SupportUnloadOfDelayLoadedDLL(unset),
- SuppressStartupBanner(unset),
- SwapRunFromCD(unset),
- SwapRunFromNet(unset),
- TerminalServerAware(unset),
- TreatLinkerWarningAsErrors(unset),
- TurnOffAssemblyGeneration(unset),
- TypeLibraryResourceID(0),
- UACUIAccess(unset)
-{
-}
-
-XmlOutput &operator<<(XmlOutput &xml, const VCXLinkerTool &tool)
+void VCXProjectWriter::write(XmlOutput &xml, const VCLinkerTool &tool)
{
- return xml
+ xml
<< tag(_Link)
<< attrTagX(_AdditionalDependencies, tool.AdditionalDependencies, ";")
<< attrTagX(_AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories, ";")
@@ -1126,18 +1333,15 @@ XmlOutput &operator<<(XmlOutput &xml, const VCXLinkerTool &tool)
<< attrTagS(_CLRImageType, tool.CLRImageType)
<< attrTagS(_CLRSupportLastError, tool.CLRSupportLastError)
<< attrTagS(_CLRThreadAttribute, tool.CLRThreadAttribute)
- << attrTagS(_CLRUnmanagedCodeCheck, tool.CLRUnmanagedCodeCheck)
- << attrTagS(_CreateHotPatchableImage, tool.CreateHotPatchableImage)
+ << attrTagT(_CLRUnmanagedCodeCheck, tool.CLRUnmanagedCodeCheck)
+//unused << attrTagS(_CreateHotPatchableImage, tool.CreateHotPatchableImage)
<< attrTagT(_DataExecutionPrevention, tool.DataExecutionPrevention)
<< attrTagX(_DelayLoadDLLs, tool.DelayLoadDLLs, ";")
<< attrTagT(_DelaySign, tool.DelaySign)
- << attrTagS(_Driver, tool.Driver)
- << attrTagX(_EmbedManagedResourceFile, tool.EmbedManagedResourceFile, ";")
- << attrTagT(_EnableCOMDATFolding, tool.EnableCOMDATFolding)
+ << attrTagS(_EmbedManagedResourceFile, tool.LinkToManagedResourceFile)
+ << attrTagT(_EnableCOMDATFolding, toTriState(tool.EnableCOMDATFolding))
<< attrTagT(_EnableUAC, tool.EnableUAC)
<< attrTagS(_EntryPointSymbol, tool.EntryPointSymbol)
- << attrTagT(_FixedBaseAddress, tool.FixedBaseAddress)
- << attrTagS(_ForceFileOutput, tool.ForceFileOutput)
<< attrTagX(_ForceSymbolReferences, tool.ForceSymbolReferences, ";")
<< attrTagS(_FunctionOrder, tool.FunctionOrder)
<< attrTagT(_GenerateDebugInformation, tool.GenerateDebugInformation)
@@ -1148,17 +1352,16 @@ XmlOutput &operator<<(XmlOutput &xml, const VCXLinkerTool &tool)
<< attrTagT(_IgnoreAllDefaultLibraries, tool.IgnoreAllDefaultLibraries)
<< attrTagT(_IgnoreEmbeddedIDL, tool.IgnoreEmbeddedIDL)
<< attrTagT(_IgnoreImportLibrary, tool.IgnoreImportLibrary)
- << attrTagX(_IgnoreSpecificDefaultLibraries, tool.IgnoreSpecificDefaultLibraries, ";")
- << attrTagT(_ImageHasSafeExceptionHandlers, tool.ImageHasSafeExceptionHandlers)
+ << attrTagX(_IgnoreSpecificDefaultLibraries, tool.IgnoreDefaultLibraryNames, ";")
<< attrTagS(_ImportLibrary, tool.ImportLibrary)
<< attrTagS(_KeyContainer, tool.KeyContainer)
<< attrTagS(_KeyFile, tool.KeyFile)
- << attrTagT(_LargeAddressAware, tool.LargeAddressAware)
- << attrTagT(_LinkDLL, tool.LinkDLL)
+ << attrTagT(_LargeAddressAware, toTriState(tool.LargeAddressAware))
+ << attrTagT(_LinkDLL, (tool.config->ConfigurationType == typeDynamicLibrary ? _True : unset))
<< attrTagS(_LinkErrorReporting, tool.LinkErrorReporting)
- << attrTagT(_LinkIncremental, tool.LinkIncremental)
- << attrTagT(_LinkStatus, tool.LinkStatus)
- << attrTagS(_LinkTimeCodeGeneration, tool.LinkTimeCodeGeneration)
+ << attrTagT(_LinkIncremental, toTriState(tool.LinkIncremental))
+ << attrTagT(_LinkStatus, toTriState(tool.ShowProgress))
+ << attrTagS(_LinkTimeCodeGeneration, toString(tool.LinkTimeCodeGeneration))
<< attrTagS(_ManifestFile, tool.ManifestFile)
<< attrTagT(_MapExports, tool.MapExports)
<< attrTagS(_MapFileName, tool.MapFileName)
@@ -1166,32 +1369,27 @@ XmlOutput &operator<<(XmlOutput &xml, const VCXLinkerTool &tool)
<< attrTagS(_MergeSections, tool.MergeSections)
<< attrTagS(_MidlCommandFile, tool.MidlCommandFile)
<< attrTagS(_ModuleDefinitionFile, tool.ModuleDefinitionFile)
- << attrTagS(_MSDOSStubFileName, tool.MSDOSStubFileName)
- << attrTagT(_NoEntryPoint, tool.NoEntryPoint)
- << attrTagT(_OptimizeReferences, tool.OptimizeReferences)
+ << attrTagT(_NoEntryPoint, tool.ResourceOnlyDLL)
+ << attrTagT(_OptimizeReferences, toTriState(tool.OptimizeReferences))
<< attrTagS(_OutputFile, tool.OutputFile)
<< attrTagT(_PreventDllBinding, tool.PreventDllBinding)
- << attrTagS(_Profile, tool.Profile)
- << attrTagS(_ProfileGuidedDatabase, tool.ProfileGuidedDatabase)
<< attrTagS(_ProgramDatabaseFile, tool.ProgramDatabaseFile)
<< attrTagT(_RandomizedBaseAddress, tool.RandomizedBaseAddress)
<< attrTagT(_RegisterOutput, tool.RegisterOutput)
<< attrTagL(_SectionAlignment, tool.SectionAlignment, /*ifNot*/ -1)
<< attrTagT(_SetChecksum, tool.SetChecksum)
- << attrTagS(_ShowProgress, tool.ShowProgress)
- << attrTagS(_SpecifySectionAttributes, tool.SpecifySectionAttributes)
- << attrTagS(_StackCommitSize, tool.StackCommitSize)
- << attrTagS(_StackReserveSize, tool.StackReserveSize)
+ << attrTagL(_StackCommitSize, tool.StackCommitSize, /*ifNot*/ -1)
+ << attrTagL(_StackReserveSize, tool.StackReserveSize, /*ifNot*/ -1)
<< attrTagS(_StripPrivateSymbols, tool.StripPrivateSymbols)
- << attrTagS(_SubSystem, tool.SubSystem)
- << attrTagT(_SupportNobindOfDelayLoadedDLL, tool.SupportNobindOfDelayLoadedDLL)
+ << attrTagS(_SubSystem, toString(tool.SubSystem))
+// << attrTagT(_SupportNobindOfDelayLoadedDLL, tool.SupportNobindOfDelayLoadedDLL)
<< attrTagT(_SupportUnloadOfDelayLoadedDLL, tool.SupportUnloadOfDelayLoadedDLL)
<< attrTagT(_SuppressStartupBanner, tool.SuppressStartupBanner)
<< attrTagT(_SwapRunFromCD, tool.SwapRunFromCD)
<< attrTagT(_SwapRunFromNet, tool.SwapRunFromNet)
- << attrTagS(_TargetMachine, tool.TargetMachine)
- << attrTagT(_TerminalServerAware, tool.TerminalServerAware)
- << attrTagT(_TreatLinkerWarningAsErrors, tool.TreatLinkerWarningAsErrors)
+ << attrTagS(_TargetMachine, toString(tool.TargetMachine))
+ << attrTagT(_TerminalServerAware, toTriState(tool.TerminalServerAware))
+ << attrTagT(_TreatLinkerWarningAsErrors, tool.TreatWarningsAsErrors)
<< attrTagT(_TurnOffAssemblyGeneration, tool.TurnOffAssemblyGeneration)
<< attrTagS(_TypeLibraryFile, tool.TypeLibraryFile)
<< attrTagL(_TypeLibraryResourceID, tool.TypeLibraryResourceID, /*ifNot*/ 0)
@@ -1201,619 +1399,18 @@ XmlOutput &operator<<(XmlOutput &xml, const VCXLinkerTool &tool)
<< closetag(_Link);
}
-// 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)!= ':' &&
- (*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 VCXLinkerTool::parseOption(const char* option)
-{
-#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("/IGNORE"); 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 "); displayHash("/libpath");
-
-#endif
-#ifdef USE_DISPLAY_HASH
- // Sub options
- displayHash("UNLOAD"); displayHash("NOBIND"); displayHash("no"); displayHash("NOSTATUS"); displayHash("STATUS");
- displayHash("AM33"); displayHash("ARM"); displayHash("CEE"); displayHash("EBC"); displayHash("IA64"); displayHash("X86"); displayHash("X64"); displayHash("M32R");
- displayHash("MIPS"); displayHash("MIPS16"); displayHash("MIPSFPU"); displayHash("MIPSFPU16"); displayHash("MIPSR41XX"); displayHash("PPC");
- displayHash("SH3"); displayHash("SH3DSP"); 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 0x6b21972: // /DEFAULTLIB:library
- case 0xaca9d75: // /EXETYPE[:DYNAMIC | :DEV386]
- case 0x3ad5444: // /EXPORT:entryname[,@ordinal[,NONAME]][,DATA]
- case 0x3dc3455: // /IGNORE:number,number,number,number ### NOTE: This one is undocumented, but it is even used by Microsoft.
- // In recent versions of the Microsoft linker they have disabled this undocumented feature.
- case 0x0034bc4: // /VXD
- AdditionalOptions += option;
- break;
- case 0x3360dbe: // /ALIGN[:number]
- SectionAlignment = QString(option+7).toLongLong();
- break;
- case 0x1485c34: // /ALLOWBIND[:NO]
- if(*(option+10) == ':' && (*(option+11) == 'n' || *(option+11) == 'N'))
- PreventDllBinding = _False;
- else
- PreventDllBinding = _True;
- break;
- case 0x312011e: // /ALLOWISOLATION[:NO]
- if(*(option+15) == ':' && (*(option+16) == 'n' || *(option+16) == 'N'))
- AllowIsolation = _False;
- else
- AllowIsolation = _True;
- break;
- case 0x679c075: // /ASSEMBLYMODULE:filename
- AddModuleNamesToAssembly += option+15;
- break;
- case 0x75f35f7: // /ASSEMBLYDEBUG[:DISABLE]
- if(*(option+14) == ':' && (*(option+15) == 'D'))
- AssemblyDebug = _False;
- else
- AssemblyDebug = _True;
- break;
- case 0x43294a5: // /ASSEMBLYLINKRESOURCE:filename
- AssemblyLinkResource += option+22;
- break;
- case 0x062d065: // /ASSEMBLYRESOURCE:filename
- EmbedManagedResourceFile += 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 0x63bf065: // /CLRIMAGETYPE:{IJW|PURE|SAFE}
- if(*(option+14) == 'I')
- CLRImageType = "ForceIJWImage";
- else if(*(option+14) == 'P')
- CLRImageType = "ForcePureILImage";
- else if(*(option+14) == 'S')
- CLRImageType = "ForceSafeILImage";
- break;
- case 0x5f2a6a2: // /CLRSUPPORTLASTERROR{:NO | SYSTEMDLL}
- if(*(option+20) == ':') {
- if(*(option+21) == 'N') {
- CLRSupportLastError = "Disabled";
- } else if(*(option+21) == 'S') {
- CLRSupportLastError = "SystemDlls";
- }
- } else {
- CLRSupportLastError = "Enabled";
- }
- break;
- case 0xc7984f5: // /CLRTHREADATTRIBUTE:{STA|MTA|NONE}
- if(*(option+20) == 'N')
- CLRThreadAttribute = "DefaultThreadingAttribute";
- else if(*(option+20) == 'M')
- CLRThreadAttribute = "MTAThreadingAttribute";
- else if(*(option+20) == 'S')
- CLRThreadAttribute = "STAThreadingAttribute";
- break;
- case 0xa8c637b: // /CLRUNMANAGEDCODECHECK[:NO]
- if(*(option+23) == 'N')
- CLRUnmanagedCodeCheck = _False;
- else
- CLRUnmanagedCodeCheck = _True;
- break;
- case 0x3389797: // /DEBUG
- GenerateDebugInformation = _True;
- break;
- case 0x0033896: // /DEF:filename
- ModuleDefinitionFile = option+5;
- break;
- case 0x338a069: // /DELAY:{UNLOAD | NOBIND}
- if(*(option+7) == 'U')
- SupportNobindOfDelayLoadedDLL = _True;
- else if(*(option+7) == 'N')
- SupportUnloadOfDelayLoadedDLL = _True;
- break;
- case 0x06f4bf4: // /DELAYLOAD:dllname
- DelayLoadDLLs += option+11;
- break;
- case 0x06d451e: // /DELAYSIGN[:NO]
- if(*(option+10) == ':' && (*(option+11) == 'n' || *(option+11) == 'N'))
- DelaySign = _False;
- else
- DelaySign = _True;
- break;
- case 0x003390c: // /DLL
- LinkDLL = _True;
- break;
- case 0x396ea92: // /DRIVER[:UPONLY | :WDM]
- if((*(option+7) == ':') && (*(option+8) == 'U'))
- Driver = "UpOnly";
- else if((*(option+7) == ':') && (*(option+8) == 'W'))
- Driver = "WDM";
- else
- Driver = "Driver";
- break;
- case 0x2ee8415: // /DYNAMICBASE[:NO]
- if(*(option+12) == ':' && (*(option+13) == 'n' || *(option+13) == 'N'))
- RandomizedBaseAddress = _False;
- else
- RandomizedBaseAddress = _True;
- break;
- case 0x33a3979: // /ENTRY:function
- EntryPointSymbol = option+7;
- break;
- case 0x4504334: // /ERRORREPORT:[ NONE | PROMPT | QUEUE | SEND ]
- if(*(option+12) == ':' ) {
- if(*(option+13) == 'N')
- LinkErrorReporting = "NoErrorReport";
- else if(*(option+13) == 'P')
- LinkErrorReporting = "PromptImmediately";
- else if(*(option+13) == 'Q')
- LinkErrorReporting = "QueueForNextLogin";
- else if(*(option+13) == 'S')
- LinkErrorReporting = "SendErrorReport";
- }
- break;
- case 0x33aec94: // /FIXED[:NO]
- if(*(option+6) == ':' && (*(option+7) == 'n' || *(option+7) == 'N'))
- FixedBaseAddress = _False;
- else
- FixedBaseAddress = _True;
- break;
- case 0x33b4675: // /FORCE:[MULTIPLE|UNRESOLVED]
- if(*(option+6) == ':' && *(option+7) == 'M' )
- ForceFileOutput = "MultiplyDefinedSymbolOnly";
- else if(*(option+6) == ':' && *(option+7) == 'U' )
- ForceFileOutput = "UndefinedSymbolOnly";
- else
- ForceFileOutput = "Enabled";
- break;
- case 0x96d4e4e: // /FUNCTIONPADMIN[:space]
- if(*(option+15) == ':') {
- if(*(option+16) == '5')
- CreateHotPatchableImage = "X86Image";
- else if(*(option+16) == '6')
- CreateHotPatchableImage = "X64Image";
- else if((*(option+16) == '1') && (*(option+17) == '6'))
- CreateHotPatchableImage = "ItaniumImage";
- } else {
- CreateHotPatchableImage = "Enabled";
- }
- break;
- case 0x033c960: // /HEAP:reserve[,commit]
- {
- QStringList both = QString(option+6).split(",");
- HeapReserveSize = both[0].toLongLong();
- if(both.count() == 2)
- HeapCommitSize = both[1].toLongLong();
- }
- 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;
- case 0xb28103c: // /INCREMENTAL[:no]
- if(*(option+12) == ':' &&
- (*(option+13) == 'n' || *(option+13) == 'N'))
- LinkIncremental = _False;
- else
- LinkIncremental = _True;
- break;
- case 0x07f1ab2: // /KEYCONTAINER:name
- KeyContainer = option+14;
- break;
- case 0xfadaf35: // /KEYFILE:filename
- KeyFile = option+9;
- break;
- case 0x26e4675: // /LARGEADDRESSAWARE[:no]
- if(*(option+18) == ':' &&
- *(option+19) == 'n')
- LargeAddressAware = _False;
- else
- LargeAddressAware = _True;
- break;
- case 0x2f96bc8: // /libpath:dir
- case 0x0d745c8: // /LIBPATH:dir
- AdditionalLibraryDirectories += option+9;
- break;
- case 0x0341877: // /LTCG[:NOSTATUS|:STATUS]
- config->WholeProgramOptimization = _True;
- LinkTimeCodeGeneration = "UseLinkTimeCodeGeneration";
- if(*(option+5) == ':') {
- const char* str = option+6;
- if (*str == 'S')
- LinkStatus = _True;
- else if (*str == 'N')
- LinkStatus = _False;
-#ifndef Q_OS_WIN
- else if (strncasecmp(str, "pginstrument", 12))
- LinkTimeCodeGeneration = "PGInstrument";
- else if (strncasecmp(str, "pgoptimize", 10))
- LinkTimeCodeGeneration = "PGOptimization";
- else if (strncasecmp(str, "pgupdate", 8 ))
- LinkTimeCodeGeneration = "PGUpdate";
-#else
-
- else if (_stricmp(str, "pginstrument"))
- LinkTimeCodeGeneration = "PGInstrument";
- else if (_stricmp(str, "pgoptimize"))
- LinkTimeCodeGeneration = "PGOptimization";
- else if (_stricmp(str, "pgupdate"))
- LinkTimeCodeGeneration = "PGUpdate";
-#endif
- }
- break;
- case 0x379ED25:
- case 0x157cf65: // /MACHINE:{AM33|ARM|CEE|IA64|X86|M32R|MIPS|MIPS16|MIPSFPU|MIPSFPU16|MIPSR41XX|PPC|SH3|SH4|SH5|THUMB|TRICORE}
- switch (elfHash(option+9)) {
- case 0x0005bb6: // X86
- TargetMachine = "MachineX86";
- break;
- case 0x0005b94: // X64
- TargetMachine = "MachineX64";
- break;
- case 0x000466d: // ARM
- TargetMachine = "MachineARM";
- break;
- case 0x0004963: // EBC
- TargetMachine = "MachineEBC";
- break;
- case 0x004d494: // IA64
- TargetMachine = "MachineIA64";
- break;
- case 0x0051e53: // MIPS
- TargetMachine = "MachineMIPS";
- break;
- case 0x51e5646: // MIPS16
- TargetMachine = "MachineMIPS16";
- break;
- case 0x1e57b05: // MIPSFPU
- TargetMachine = "MachineMIPSFPU";
- break;
- case 0x57b09a6: // MIPSFPU16
- TargetMachine = "MachineMIPSFPU16";
- break;
- case 0x00057b4: // SH4
- TargetMachine = "MachineSH4";
- break;
- case 0x058da12: // THUMB
- TargetMachine = "MachineTHUMB";
- break;
- // put the others in AdditionalOptions...
- case 0x0046063: // AM33
- case 0x0004795: // CEE
- case 0x0050672: // M32R
- case 0x5852738: // MIPSR41XX
- case 0x0005543: // PPC
- case 0x00057b3: // SH3
- case 0x57b7980: // SH3DSP
- case 0x00057b5: // SH5
- case 0x96d8435: // TRICORE
- default:
- AdditionalOptions += option;
- break;
- }
- break;
- case 0x62d9e94: // /MANIFEST[:NO]
- if ((*(option+9) == ':' && (*(option+10) == 'N' || *(option+10) == 'n')))
- GenerateManifest = _False;
- else
- GenerateManifest = _True;
- break;
- case 0x8b64559: // /MANIFESTDEPENDENCY:manifest_dependency
- AdditionalManifestDependencies += option+20;
- break;
- case 0xe9e8195: // /MANIFESTFILE:filename
- ManifestFile = option+14;
- break;
- case 0x9e9fb83: // /MANIFESTUAC http://msdn.microsoft.com/en-us/library/bb384691%28VS.100%29.aspx
- if ((*(option+12) == ':' && (*(option+13) == 'N' || *(option+13) == 'n')))
- EnableUAC = _False;
- else if((*(option+12) == ':' && (*(option+13) == 'l' || *(option+14) == 'e'))) { // level
- if(*(option+20) == 'a')
- UACExecutionLevel = "AsInvoker";
- else if(*(option+20) == 'h')
- UACExecutionLevel = "HighestAvailable";
- else if(*(option+20) == 'r')
- UACExecutionLevel = "RequireAdministrator";
- } else if((*(option+12) == ':' && (*(option+13) == 'u' || *(option+14) == 'i'))) { // uiAccess
- if(*(option+22) == 't')
- UACUIAccess = _True;
- else
- UACUIAccess = _False;
- } else if((*(option+12) == ':' && (*(option+13) == 'f' || *(option+14) == 'r'))) { // fragment
- AdditionalOptions += option;
- }else
- EnableUAC = _True;
- break;
- case 0x0034160: // /MAP[:filename]
- GenerateMapFile = _True;
- if (option[4] == ':')
- MapFileName = option+5;
- break;
- case 0x164e1ef: // /MAPINFO:{EXPORTS}
- if(*(option+9) == 'E')
- MapExports = _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;
- else
- IgnoreSpecificDefaultLibraries += option+14;
- break;
- case 0x33a3a39: // /NOENTRY
- NoEntryPoint = _True;
- break;
- case 0x434138f: // /NOLOGO
- SuppressStartupBanner = _True;
- break;
- case 0xc841054: // /NXCOMPAT[:NO]
- if ((*(option+9) == ':' && (*(option+10) == 'N' || *(option+10) == 'n')))
- DataExecutionPrevention = _False;
- else
- DataExecutionPrevention = _True;
- break;
- case 0x0034454: // /OPT:{REF | NOREF | ICF[=iterations] | NOICF | WIN98 | NOWIN98}
- {
- char third = *(option+7);
- switch (third) {
- case 'F': // REF
- if(*(option+5) == 'R') {
- OptimizeReferences = _True;
- } else { // ICF[=iterations]
- EnableCOMDATFolding = _True;
- // [=iterations] case is not documented
- }
- break;
- case 'R': // NOREF
- OptimizeReferences = _False;
- break;
- case 'I': // NOICF
- EnableCOMDATFolding = _False;
- break;
- default:
- 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 0x00344b4: // /PGD:filename
- ProfileGuidedDatabase = option+5;
- break;
- case 0x573af45: // /PROFILE
- Profile = _True;
- break;
- case 0x6a09535: // /RELEASE
- SetChecksum = _True;
- break;
- case 0x75AA4D8: // /SAFESEH:{NO}
- {
- if(*(option+8) == ':' && *(option+9) == 'N')
- ImageHasSafeExceptionHandlers = _False;
- else
- ImageHasSafeExceptionHandlers = _True;
- }
- break;
- case 0x7988f7e: // /SECTION:name,[E][R][W][S][D][K][L][P][X][,ALIGN=#]
- SpecifySectionAttributes = option+9;
- break;
- case 0x348857b: // /STACK:reserve[,commit]
- {
- QStringList both = QString(option+7).split(",");
- StackReserveSize = both[0].toLongLong();
- if(both.count() == 2)
- StackCommitSize = both[1].toLongLong();
- }
- break;
- case 0x0348992: // /STUB:filename
- MSDOSStubFileName = option+6;
- break;
- case 0x9B3C00D:
- 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 = QString(option+11).split(",");
- switch (elfHash(both[0].toLatin1())) {
- case 0x8438445: // CONSOLE
- SubSystem = "Console";
- break;
- case 0xbe29493: // WINDOWS
- SubSystem = "Windows";
- break;
- case 0x5268ea5: // NATIVE
- SubSystem = "Native";
- break;
- case 0x240949e: // EFI_APPLICATION
- SubSystem = "EFI Application";
- break;
- case 0xe617652: // EFI_BOOT_SERVICE_DRIVER
- SubSystem = "EFI Boot Service Driver";
- break;
- case 0x9af477d: // EFI_ROM
- SubSystem = "EFI ROM";
- break;
- case 0xd34df42: // EFI_RUNTIME_DRIVER
- SubSystem = "EFI Runtime";
- break;
- case 0x2949c95: // WINDOWSCE
- SubSystem = "WindowsCE";
- break;
- case 0x05547e8: // POSIX
- SubSystem = "POSIX";
- break;
- // The following are undocumented, so add them to AdditionalOptions
- case 0x4B69795: // windowsce
- AdditionalOptions += option;
- break;
- default:
- found = false;
- }
- }
- break;
- case 0x8b654de: // /SWAPRUN:{NET | CD}
- if(*(option+9) == 'N')
- SwapRunFromNet = _True;
- else if(*(option+9) == 'C')
- SwapRunFromCD = _True;
- else
- found = false;
- break;
- case 0x34906d4: // /TLBID:id
- TypeLibraryResourceID = QString(option+7).toLongLong();
- break;
- case 0x4907494: // /TLBOUT:[path\]filename
- TypeLibraryFile = option+8;
- break;
- case 0x976b525: // /TSAWARE[:NO]
- if(*(option+8) == ':')
- TerminalServerAware = _False;
- else
- TerminalServerAware = _True;
- break;
- case 0xaa67735: // /VERBOSE[:ICF |:LIB |:REF |:SAFESEH]
- if(*(option+9) == ':') {
- if (*(option+10) == 'I') {
- ShowProgress = "LinkVerboseICF";
- } else if ( *(option+10) == 'L') {
- ShowProgress = "LinkVerboseLib";
- } else if ( *(option+10) == 'R') {
- ShowProgress = "LinkVerboseREF";
- } else if ( *(option+10) == 'S') {
- ShowProgress = "LinkVerboseSAFESEH";
- } else if ( *(option+10) == 'C') {
- ShowProgress = "LinkVerboseCLR";
- }
- } else {
- ShowProgress = "LinkVerbose";
- }
- break;
- case 0xaa77f7e: // /VERSION:major[.minor]
- Version = option+9;
- break;
- case 0x0034c50: // /WS[:NO]
- if(*(option+3) == ':')
- TreatLinkerWarningAsErrors = _False;
- else
- TreatLinkerWarningAsErrors = _True;
- break;
- default:
- AdditionalOptions += option;
- break;
- }
- if(!found) {
- warn_msg(WarnLogic, "Could not parse Linker options: %s, added as AdditionalOption", option);
- AdditionalOptions += option;
- }
- return found;
-}
-
-// VCMIDLTool -------------------------------------------------------
-VCXMIDLTool::VCXMIDLTool()
- : ApplicationConfigurationMode(unset),
- ErrorCheckAllocations(unset),
- ErrorCheckBounds(unset),
- ErrorCheckEnumRange(unset),
- ErrorCheckRefPointers(unset),
- ErrorCheckStubData(unset),
- GenerateStublessProxies(unset),
- GenerateTypeLibrary(unset),
- IgnoreStandardIncludePath(unset),
- LocaleID(-1),
- MkTypLibCompatible(unset),
- SuppressCompilerWarnings(unset),
- SuppressStartupBanner(unset),
- ValidateAllParameters(unset),
- WarnAsError(unset)
-{
-}
-
-XmlOutput &operator<<(XmlOutput &xml, const VCXMIDLTool &tool)
+void VCXProjectWriter::write(XmlOutput &xml, const VCMIDLTool &tool)
{
- return xml
+ xml
<< tag(_Midl)
<< attrTagX(_AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories, ";")
<< attrTagX(_AdditionalOptions, tool.AdditionalOptions, " ")
<< attrTagT(_ApplicationConfigurationMode, tool.ApplicationConfigurationMode)
<< attrTagS(_ClientStubFile, tool.ClientStubFile)
- << attrTagS(_CPreprocessOptions, tool.CPreprocessOptions)
- << attrTagS(_DefaultCharType, tool.DefaultCharType)
+ << attrTagX(_CPreprocessOptions, tool.CPreprocessOptions, " ")
+ << attrTagS(_DefaultCharType, toString(tool.DefaultCharType))
<< attrTagS(_DLLDataFileName, tool.DLLDataFileName)
- << attrTagS(_EnableErrorChecks, tool.EnableErrorChecks)
+ << attrTagS(_EnableErrorChecks, toString(tool.EnableErrorChecks))
<< attrTagT(_ErrorCheckAllocations, tool.ErrorCheckAllocations)
<< attrTagT(_ErrorCheckBounds, tool.ErrorCheckBounds)
<< attrTagT(_ErrorCheckEnumRange, tool.ErrorCheckEnumRange)
@@ -1833,443 +1430,113 @@ XmlOutput &operator<<(XmlOutput &xml, const VCXMIDLTool &tool)
<< attrTagS(_ProxyFileName, tool.ProxyFileName)
<< attrTagS(_RedirectOutputAndErrors, tool.RedirectOutputAndErrors)
<< attrTagS(_ServerStubFile, tool.ServerStubFile)
- << attrTagS(_StructMemberAlignment, tool.StructMemberAlignment)
+ << attrTagS(_StructMemberAlignment, toString(tool.StructMemberAlignment))
<< attrTagT(_SuppressCompilerWarnings, tool.SuppressCompilerWarnings)
<< attrTagT(_SuppressStartupBanner, tool.SuppressStartupBanner)
- << attrTagS(_TargetEnvironment, tool.TargetEnvironment)
+ << attrTagS(_TargetEnvironment, toString(tool.TargetEnvironment))
<< attrTagS(_TypeLibFormat, tool.TypeLibFormat)
<< attrTagS(_TypeLibraryName, tool.TypeLibraryName)
<< attrTagX(_UndefinePreprocessorDefinitions, tool.UndefinePreprocessorDefinitions, ";")
<< attrTagT(_ValidateAllParameters, tool.ValidateAllParameters)
<< attrTagT(_WarnAsError, tool.WarnAsError)
- << attrTagS(_WarningLevel, tool.WarningLevel)
+ << attrTagS(_WarningLevel, toString(tool.WarningLevel))
<< closetag(_Midl);
}
-bool VCXMIDLTool::parseOption(const char* option)
-{
-#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("/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("/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') ? "1" : "16";
- break;
- case '2':
- StructMemberAlignment = "2";
- break;
- case '4':
- StructMemberAlignment = "4";
- break;
- case '8':
- StructMemberAlignment = "8";
- break;
- default:
- found = false;
- }
- break;
- case 0x5b1cb97: // /app_config
- ApplicationConfigurationMode = _True;
- break;
- case 0x0359e82: // /char {ascii7|signed|unsigned}
- switch(*(option+6)) {
- case 'a':
- DefaultCharType = "Ascii";
- break;
- case 's':
- DefaultCharType = "Signed";
- break;
- case 'u':
- DefaultCharType = "Unsigned";
- break;
- default:
- found = false;
- }
- break;
- case 0x5a2fc64: // /client {none|stub}
- if(*(option+8) == 's')
- GenerateClientFiles = "Stub";
- else
- GenerateClientFiles = "None";
- break;
- case 0xa766524: // /cpp_opt options
- CPreprocessOptions += option+9;
- break;
- case 0x35aabb2: // /cstub filename
- ClientStubFile = option+7;
- break;
- case 0xb32abf1: // /dlldata filename
- DLLDataFileName = option + 9;
- break;
- case 0x0035c56: // /env {win32|ia64|x64}
- if(*(option+7) == 'w' && *(option+10) == '3')
- TargetEnvironment = "Win32";
- else if(*(option+7) == 'i')
- TargetEnvironment = "Itanium";
- else if(*(option+7) == 'x')
- TargetEnvironment = "X64";
- else
- AdditionalOptions += option;
- break;
- case 0x35c9962: // /error {all|allocation|bounds_check|enum|none|ref|stub_data}
- EnableErrorChecks = midlEnableCustom;
- switch (*(option+7)) {
- case '\0':
- EnableErrorChecks = "EnableCustom";
- break;
- case 'a':
- if(*(option+10) == '\0')
- EnableErrorChecks = "All";
- else
- ErrorCheckAllocations = _True;
- break;
- case 'b':
- ErrorCheckBounds = _True;
- break;
- case 'e':
- ErrorCheckEnumRange = _True;
- break;
- case 'n':
- EnableErrorChecks = "None";
- break;
- case 'r':
- ErrorCheckRefPointers = _True;
- break;
- case 's':
- ErrorCheckStubData = _True;
- break;
- default:
- 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 0x64ceb12: // /newtlb
- TypeLibFormat = "NewFormat";
- break;
- case 0x8e0b0a2: // /no_def_idir
- IgnoreStandardIncludePath = _True;
- break;
- case 0x65635ef: // /nologo
- SuppressStartupBanner = _True;
- break;
- case 0x695e9f4: // /no_robust
- ValidateAllParameters = _False;
- break;
- case 0x3656b22: // /notlb
- GenerateTypeLibrary = _True;
- break;
- case 0x556dbee: // /no_warn
- SuppressCompilerWarnings = _True;
- break;
- case 0x000035f: // /o filename
- RedirectOutputAndErrors = option+3;
- break;
- case 0x662bb12: // /oldtlb
- TypeLibFormat = "OldFormat";
- break;
- case 0x00366c4: // /out directory
- OutputDirectory = option+5;
- break;
- case 0x36796f9: // /proxy filename
- ProxyFileName = option+7;
- break;
- case 0x6959c94: // /robust
- ValidateAllParameters = _True;
- break;
- case 0x69c9cf2: // /server {none|stub}
- if(*(option+8) == 's')
- GenerateServerFiles = "Stub";
- else
- GenerateServerFiles = "None";
- break;
- case 0x36aabb2: // /sstub filename
- ServerStubFile = option+7;
- break;
- case 0x0036b22: // /tlb filename
- TypeLibraryName = option+5;
- break;
- case 0x36e0162: // /win32
- TargetEnvironment = "Win32";
- break;
- case 0x36e0194: // /win64
- TargetEnvironment = "Itanium";
- break;
- case 0x0003459: // /Oi
- case 0x00345f3: // /Oic
- case 0x0003463: // /Os
- case 0x0003513: // /Zs
- case 0x0035796: // /acf filename
- case 0x3595cf4: // /c_ext
- case 0xa64d3dd: // /confirm
- case 0xa765b64: // /cpp_cmd cmd_line
- case 0x03629f4: // /lcid
- case 0x6495cc4: // /ms_ext
- case 0x96c7a1e: // /ms_union
- case 0x4996fa2: // /msc_ver <nnnn>
- case 0x6555a40: // /no_cpp
- case 0xf64d6a6: // /no_default_epv
- case 0x6dd9384: // /no_format_opt
- case 0x3655a70: // /nocpp
- case 0x2b455a3: // /oldnames
- case 0x0036696: // /osf
- case 0x036679b: // /pack {N}
- case 0x678bd38: // /prefix {all|client|server|switch}
- case 0x96b702c: // /protocol {all|dce|ndr64}
- case 0x3696aa3: // /rpcss
- case 0x698ca60: // /savePP
- 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 = "0";
- break;
- case '1':
- WarningLevel = "1";
- break;
- case '2':
- WarningLevel = "2";
- break;
- case '3':
- WarningLevel = "3";
- break;
- case '4':
- WarningLevel = "4";
- break;
- default:
- found = false;
- }
- }
- break;
- }
- if(!found)
- warn_msg(WarnLogic, "Could not parse MIDL option: %s", option);
- return true;
-}
-
-// VCLibrarianTool --------------------------------------------------
-VCXLibrarianTool::VCXLibrarianTool()
- : IgnoreAllDefaultLibraries(unset),
- LinkTimeCodeGeneration(unset),
- SuppressStartupBanner(_True),
- TreatLibWarningAsErrors(unset),
- Verbose(unset)
-{
-}
-
-XmlOutput &operator<<(XmlOutput &xml, const VCXLibrarianTool &tool)
-{
- return xml
- << tag(_Link)
- << attrTagX(_AdditionalDependencies, tool.AdditionalDependencies, ";")
- << attrTagX(_AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories, ";")
- << attrTagX(_AdditionalOptions, tool.AdditionalOptions, " ")
- << attrTagS(_DisplayLibrary, tool.DisplayLibrary)
- << attrTagS(_ErrorReporting, tool.ErrorReporting)
- << attrTagX(_ExportNamedFunctions, tool.ExportNamedFunctions, ";")
- << attrTagX(_ForceSymbolReferences, tool.ForceSymbolReferences, ";")
- << attrTagT(_IgnoreAllDefaultLibraries, tool.IgnoreAllDefaultLibraries)
- << attrTagX(_IgnoreSpecificDefaultLibraries, tool.IgnoreSpecificDefaultLibraries, ";")
- << attrTagT(_LinkTimeCodeGeneration, tool.LinkTimeCodeGeneration)
- << attrTagS(_ModuleDefinitionFile, tool.ModuleDefinitionFile)
- << attrTagS(_Name, tool.Name)
- << attrTagS(_OutputFile, tool.OutputFile)
- << attrTagX(_RemoveObjects, tool.RemoveObjects, ";")
- << attrTagS(_SubSystem, tool.SubSystem)
- << attrTagT(_SuppressStartupBanner, tool.SuppressStartupBanner)
- << attrTagS(_TargetMachine, tool.TargetMachine)
- << attrTagT(_TreatLibWarningAsErrors, tool.TreatLibWarningAsErrors)
- << attrTagT(_Verbose, tool.Verbose)
- << closetag(_Link);
-}
-
-// VCCustomBuildTool ------------------------------------------------
-VCXCustomBuildTool::VCXCustomBuildTool()
+void VCXProjectWriter::write(XmlOutput &xml, const VCCustomBuildTool &tool)
{
- ToolName = "VCXCustomBuildTool";
-}
+ const QString &configName = tool.config->Name;
-XmlOutput &operator<<(XmlOutput &xml, const VCXCustomBuildTool &tool)
-{
if ( !tool.AdditionalDependencies.isEmpty() )
{
xml << tag("AdditionalInputs")
- << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.ConfigName))
+ << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(configName))
<< valueTagDefX(tool.AdditionalDependencies, "AdditionalInputs", ";");
}
if( !tool.CommandLine.isEmpty() )
{
xml << tag("Command")
- << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.ConfigName))
+ << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(configName))
<< valueTag(tool.CommandLine.join(vcxCommandSeparator()));
}
if ( !tool.Description.isEmpty() )
{
xml << tag("Message")
- << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.ConfigName))
+ << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(configName))
<< valueTag(tool.Description);
}
if ( !tool.Outputs.isEmpty() )
{
xml << tag("Outputs")
- << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.ConfigName))
+ << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(configName))
<< valueTagDefX(tool.Outputs, "Outputs", ";");
}
-
- return xml;
}
-// VCResourceCompilerTool -------------------------------------------
-VCXResourceCompilerTool::VCXResourceCompilerTool()
- : IgnoreStandardIncludePath(unset),
- NullTerminateStrings(unset),
- ShowProgress(unset),
- SuppressStartupBanner(unset)
+void VCXProjectWriter::write(XmlOutput &xml, const VCLibrarianTool &tool)
{
- PreprocessorDefinitions = QStringList("NDEBUG");
+ xml
+ << tag(_Link)
+ << attrTagX(_AdditionalDependencies, tool.AdditionalDependencies, ";")
+ << attrTagX(_AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories, ";")
+ << attrTagX(_AdditionalOptions, tool.AdditionalOptions, " ")
+//unused << attrTagS(_DisplayLibrary, tool.DisplayLibrary)
+//unused << attrTagS(_ErrorReporting, tool.ErrorReporting)
+ << attrTagX(_ExportNamedFunctions, tool.ExportNamedFunctions, ";")
+ << attrTagX(_ForceSymbolReferences, tool.ForceSymbolReferences, ";")
+ << attrTagT(_IgnoreAllDefaultLibraries, tool.IgnoreAllDefaultLibraries)
+ << attrTagX(_IgnoreSpecificDefaultLibraries, tool.IgnoreDefaultLibraryNames, ";")
+//unused << attrTagT(_LinkTimeCodeGeneration, tool.LinkTimeCodeGeneration)
+ << attrTagS(_ModuleDefinitionFile, tool.ModuleDefinitionFile)
+//unused << attrTagS(_Name, tool.Name)
+ << attrTagS(_OutputFile, tool.OutputFile)
+//unused << attrTagX(_RemoveObjects, tool.RemoveObjects, ";")
+//unused << attrTagS(_SubSystem, tool.SubSystem)
+ << attrTagT(_SuppressStartupBanner, tool.SuppressStartupBanner)
+//unused << attrTagS(_TargetMachine, tool.TargetMachine)
+//unused << attrTagT(_TreatLibWarningAsErrors, tool.TreatLibWarningAsErrors)
+//unused << attrTagT(_Verbose, tool.Verbose)
+ << closetag(_Link);
}
-XmlOutput &operator<<(XmlOutput &xml, const VCXResourceCompilerTool &tool)
+void VCXProjectWriter::write(XmlOutput &xml, const VCResourceCompilerTool &tool)
{
- return xml
+ xml
<< tag(_ResourceCompile)
<< attrTagX(_AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories, ";")
- << attrTagS(_AdditionalOptions, tool.AdditionalOptions)
- << attrTagS(_Culture, tool.Culture)
+ << attrTagX(_AdditionalOptions, tool.AdditionalOptions, " ")
+ << attrTagS(_Culture, toString(tool.Culture))
<< attrTagT(_IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath)
- << attrTagT(_NullTerminateStrings, tool.NullTerminateStrings)
+//unused << attrTagT(_NullTerminateStrings, tool.NullTerminateStrings)
<< attrTagX(_PreprocessorDefinitions, tool.PreprocessorDefinitions, ";")
<< attrTagS(_ResourceOutputFileName, tool.ResourceOutputFileName)
- << attrTagT(_ShowProgress, tool.ShowProgress)
+ << attrTagT(_ShowProgress, toTriState(tool.ShowProgress))
<< attrTagT(_SuppressStartupBanner, tool.SuppressStartupBanner)
- << attrTagS(_TrackerLogDirectory, tool.TrackerLogDirectory)
- << attrTagS(_UndefinePreprocessorDefinitions, tool.UndefinePreprocessorDefinitions)
+//unused << attrTagS(_TrackerLogDirectory, tool.TrackerLogDirectory)
+//unused << attrTagS(_UndefinePreprocessorDefinitions, tool.UndefinePreprocessorDefinitions)
<< closetag(_ResourceCompile);
}
-// VCXDeploymentTool --------------------------------------------
-VCXDeploymentTool::VCXDeploymentTool()
+void VCXProjectWriter::write(XmlOutput &xml, const VCEventTool &tool)
{
- DeploymentTag = "DeploymentTool";
- RemoteDirectory = "";
-}
-
-// http://msdn.microsoft.com/en-us/library/sa69he4t.aspx
-XmlOutput &operator<<(XmlOutput &xml, const VCXDeploymentTool &tool)
-{
- if (tool.AdditionalFiles.isEmpty())
- return xml;
- return xml
- << tag(tool.DeploymentTag)
- << closetag(tool.DeploymentTag);
-}
-
-// VCEventTool -------------------------------------------------
-XmlOutput &operator<<(XmlOutput &xml, const VCXEventTool &tool)
-{
- return xml
+ xml
<< tag(tool.EventName)
<< attrTagS(_Command, tool.CommandLine.join(vcxCommandSeparator()))
<< attrTagS(_Message, tool.Description)
<< closetag(tool.EventName);
}
-// VCXPostBuildEventTool ---------------------------------------------
-VCXPostBuildEventTool::VCXPostBuildEventTool()
-{
- EventName = "PostBuildEvent";
-}
-
-// VCXPreBuildEventTool ----------------------------------------------
-VCXPreBuildEventTool::VCXPreBuildEventTool()
-{
- EventName = "PreBuildEvent";
-}
-
-// VCXPreLinkEventTool -----------------------------------------------
-VCXPreLinkEventTool::VCXPreLinkEventTool()
-{
- EventName = "PreLinkEvent";
-}
-
-// VCConfiguration --------------------------------------------------
-
-VCXConfiguration::VCXConfiguration()
- : ATLMinimizesCRunTimeLibraryUsage(unset),
- BuildBrowserInformation(unset),
- RegisterOutput(unset),
- WholeProgramOptimization(unset)
+void VCXProjectWriter::write(XmlOutput &xml, const VCDeploymentTool &tool)
{
- compiler.config = this;
- linker.config = this;
- idl.config = this;
+ Q_UNUSED(xml);
+ Q_UNUSED(tool);
+ // SmartDevice deployment not supported in VS 2010
}
-XmlOutput &operator<<(XmlOutput &xml, const VCXConfiguration &tool)
+void VCXProjectWriter::write(XmlOutput &xml, const VCConfiguration &tool)
{
xml << tag("PropertyGroup")
<< attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.Name))
@@ -2277,731 +1544,155 @@ XmlOutput &operator<<(XmlOutput &xml, const VCXConfiguration &tool)
<< attrTagS(_OutputDirectory, tool.OutputDirectory)
<< attrTagT(_ATLMinimizesCRunTimeLibraryUsage, tool.ATLMinimizesCRunTimeLibraryUsage)
<< attrTagT(_BuildBrowserInformation, tool.BuildBrowserInformation)
- << attrTagS(_CharacterSet, tool.CharacterSet)
- << attrTagS(_ConfigurationType, tool.ConfigurationType)
+ << attrTagS(_CharacterSet, toString(tool.CharacterSet))
+ << attrTagS(_ConfigurationType, toString(tool.ConfigurationType))
<< attrTagS(_DeleteExtensionsOnClean, tool.DeleteExtensionsOnClean)
<< attrTagS(_ImportLibrary, tool.ImportLibrary)
<< attrTagS(_IntermediateDirectory, tool.IntermediateDirectory)
<< attrTagS(_PrimaryOutput, tool.PrimaryOutput)
<< attrTagS(_ProgramDatabase, tool.ProgramDatabase)
<< attrTagT(_RegisterOutput, tool.RegisterOutput)
- << attrTagS(_UseOfATL, tool.UseOfATL)
- << attrTagS(_UseOfMfc, tool.UseOfMfc)
+ << attrTagS(_UseOfATL, toString(tool.UseOfATL))
+ << attrTagS(_UseOfMfc, toString(tool.UseOfMfc))
<< attrTagT(_WholeProgramOptimization, tool.WholeProgramOptimization)
<< closetag();
- return xml;
-}
-// VCXFilter ---------------------------------------------------------
-VCXFilter::VCXFilter()
- : ParseFiles(unset),
- Config(0)
-{
- useCustomBuildTool = false;
- useCompilerTool = false;
}
-void VCXFilter::addFile(const QString& filename)
+void VCXProjectWriter::write(XmlOutput &xml, VCFilter &tool)
{
- Files += VCXFilterFile(filename);
+ Q_UNUSED(xml);
+ Q_UNUSED(tool);
+ // unused in this generator
}
-void VCXFilter::addFile(const VCXFilterFile& fileInfo)
+void VCXProjectWriter::addFilters(VCProject &project, XmlOutput &xmlFilter, const QString &filtername)
{
- Files += VCXFilterFile(fileInfo);
-}
-
-void VCXFilter::addFiles(const QStringList& fileList)
-{
- for (int i = 0; i < fileList.count(); ++i)
- addFile(fileList.at(i));
-}
+ bool added = false;
-void VCXFilter::modifyPCHstage(QString str)
-{
- bool autogenSourceFile = Project->autogenPrecompCPP;
- bool pchThroughSourceFile = !Project->precompCPP.isEmpty();
- bool isCFile = false;
- for (QStringList::Iterator it = Option::c_ext.begin(); it != Option::c_ext.end(); ++it) {
- if (str.endsWith(*it)) {
- isCFile = true;
- break;
+ for (int i = 0; i < project.SingleProjects.count(); ++i) {
+ VCFilter filter;
+ const VCProjectSingleConfig &singleCfg = project.SingleProjects.at(i);
+ if (filtername == "Root Files") {
+ filter = singleCfg.RootFiles;
+ } else if (filtername == "Source Files") {
+ filter = singleCfg.SourceFiles;
+ } else if (filtername == "Header Files") {
+ filter = singleCfg.HeaderFiles;
+ } else if (filtername == "Generated Files") {
+ filter = singleCfg.GeneratedFiles;
+ } else if (filtername == "LexYacc Files") {
+ filter = singleCfg.LexYaccFiles;
+ } else if (filtername == "Translation Files") {
+ filter = singleCfg.TranslationFiles;
+ } else if (filtername == "Form Files") {
+ filter = singleCfg.FormFiles;
+ } else if (filtername == "Resource Files") {
+ filter = singleCfg.ResourceFiles;
+ } else {
+ // ExtraCompilers
+ filter = project.SingleProjects[i].filterForExtraCompiler(filtername);
}
- }
- bool isHFile = str.endsWith(".h") && (str == Project->precompH);
- bool isCPPFile = pchThroughSourceFile && (str == Project->precompCPP);
-
- if(!isCFile && !isHFile && !isCPPFile)
- return;
- if(isHFile && pchThroughSourceFile) {
- if (autogenSourceFile) {
- useCustomBuildTool = true;
- QString toFile(Project->precompCPP);
- CustomBuildTool.Description = "Generating precompiled header source file '" + toFile + "' ...";
- CustomBuildTool.Outputs += toFile;
-
- QStringList lines;
- CustomBuildTool.CommandLine +=
- "echo /*-------------------------------------------------------------------- >" + toFile;
- lines << "* Precompiled header source file used by Visual Studio.NET to generate";
- lines << "* the .pch file.";
- lines << "*";
- lines << "* Due to issues with the dependencies checker within the IDE, it";
- lines << "* sometimes fails to recompile the PCH file, if we force the IDE to";
- lines << "* create the PCH file directly from the header file.";
- lines << "*";
- lines << "* This file is auto-generated by qmake since no PRECOMPILED_SOURCE was";
- lines << "* specified, and is used as the common stdafx.cpp. The file is only";
- lines << "* generated when creating .vcxproj project files, and is not used for";
- lines << "* command line compilations by nmake.";
- lines << "*";
- lines << "* WARNING: All changes made in this file will be lost.";
- lines << "--------------------------------------------------------------------*/";
- lines << "#include \"" + Project->precompHFilename + "\"";
- foreach(QString line, lines)
- CustomBuildTool.CommandLine += "echo " + line + ">>" + toFile;
+ if(!filter.Files.isEmpty() && !added) {
+ xmlFilter << tag("Filter")
+ << attrTag("Include", filtername)
+ << attrTagS("UniqueIdentifier", filter.Guid)
+ << attrTagS("Extensions", filter.Filter)
+ << attrTagT("ParseFiles", filter.ParseFiles)
+ << closetag();
}
- return;
}
-
- useCompilerTool = true;
- // Setup PCH options
- CompilerTool.PrecompiledHeader = (isCFile ? "NotUsing" : "Create" );
- CompilerTool.PrecompiledHeaderFile = (isCPPFile ? QString("$(INHERIT)") : QString("$(NOINHERIT)"));
- CompilerTool.ForcedIncludeFiles = QStringList("$(NOINHERIT)");
}
-bool VCXFilter::addExtraCompiler(const VCXFilterFile &info)
+// outputs a given filter for all existing configurations of a project
+void VCXProjectWriter::outputFilter(VCProject &project, XmlOutput &xml, XmlOutput &xmlFilter, const QString &filtername)
{
- const QStringList &extraCompilers = Project->extraCompilerSources.value(info.file);
- if (extraCompilers.isEmpty())
- return false;
-
- QString inFile = info.file;
-
- // is the extracompiler rule on a file with a built in compiler?
- const QStringList &objectMappedFile = Project->extraCompilerOutputs[inFile];
- bool hasBuiltIn = false;
- if (!objectMappedFile.isEmpty()) {
- hasBuiltIn = Project->hasBuiltinCompiler(objectMappedFile.at(0));
-// qDebug("*** Extra compiler file has object mapped file '%s' => '%s'", qPrintable(inFile), qPrintable(objectMappedFile.join(" ")));
- }
-
- CustomBuildTool.AdditionalDependencies.clear();
- CustomBuildTool.CommandLine.clear();
- CustomBuildTool.Description.clear();
- CustomBuildTool.Outputs.clear();
- CustomBuildTool.ToolPath.clear();
- CustomBuildTool.ToolName = QLatin1String(_VCCustomBuildTool);
-
- for (int x = 0; x < extraCompilers.count(); ++x) {
- const QString &extraCompilerName = extraCompilers.at(x);
-
- if (!Project->verifyExtraCompiler(extraCompilerName, inFile) && !hasBuiltIn)
- continue;
-
- // All information about the extra compiler
- QString tmp_out = Project->project->first(extraCompilerName + ".output");
- QString tmp_cmd = Project->project->variables()[extraCompilerName + ".commands"].join(" ");
- QString tmp_cmd_name = Project->project->variables()[extraCompilerName + ".name"].join(" ");
- QStringList tmp_dep = Project->project->variables()[extraCompilerName + ".depends"];
- QString tmp_dep_cmd = Project->project->variables()[extraCompilerName + ".depend_command"].join(" ");
- QStringList vars = Project->project->variables()[extraCompilerName + ".variables"];
- QStringList configs = Project->project->variables()[extraCompilerName + ".CONFIG"];
- bool combined = configs.indexOf("combine") != -1;
-
- QString cmd, cmd_name, out;
- QStringList deps, inputs;
- // Variabel replacement of output name
- out = Option::fixPathToTargetOS(
- Project->replaceExtraCompilerVariables(tmp_out, inFile, QString()),
- false);
-
- // If file has built-in compiler, we've swapped the input and output of
- // the command, as we in Visual Studio cannot have a Custom Buildstep on
- // a file which uses a built-in compiler. We would in this case only get
- // the result from the extra compiler. If 'hasBuiltIn' is true, we know
- // that we're actually on the _output_file_ of the result, and we
- // therefore swap inFile and out below, since the extra-compiler still
- // must see it as the original way. If the result also has a built-in
- // compiler, too bad..
- if (hasBuiltIn) {
- out = inFile;
- inFile = objectMappedFile.at(0);
- }
+ XNode *root;
+ if (project.SingleProjects.at(0).flat_files)
+ root = new XFlatNode;
+ else
+ root = new XTreeNode;
- // Dependency for the output
- if(!tmp_dep.isEmpty())
- deps = tmp_dep;
- if(!tmp_dep_cmd.isEmpty()) {
- // Execute dependency command, and add every line as a dep
- char buff[256];
- QString dep_cmd = Project->replaceExtraCompilerVariables(tmp_dep_cmd, Option::fixPathToLocalOS(inFile, true, false), out);
- if(Project->canExecute(dep_cmd)) {
- if(FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), "r")) {
- QString indeps;
- while(!feof(proc)) {
- int read_in = (int)fread(buff, 1, 255, proc);
- if(!read_in)
- break;
- indeps += QByteArray(buff, read_in);
- }
- QT_PCLOSE(proc);
- if(!indeps.isEmpty()) {
- QStringList extradeps = indeps.split(QLatin1Char('\n'));
- for (int i = 0; i < extradeps.count(); ++i) {
- QString dd = extradeps.at(i).simplified();
- if (!dd.isEmpty())
- deps += Project->fileFixify(dd);
- }
- }
- }
- }
- }
- for (int i = 0; i < deps.count(); ++i)
- deps[i] = Option::fixPathToTargetOS(
- Project->replaceExtraCompilerVariables(deps.at(i), inFile, out),
- false).trimmed();
- // Command for file
- if (combined) {
- // Add dependencies for each file
- QStringList tmp_in = Project->project->variables()[extraCompilerName + ".input"];
- for (int a = 0; a < tmp_in.count(); ++a) {
- const QStringList &files = Project->project->variables()[tmp_in.at(a)];
- for (int b = 0; b < files.count(); ++b) {
- deps += Project->findDependencies(files.at(b));
- inputs += Option::fixPathToTargetOS(files.at(b), false);
- }
- }
- deps += inputs; // input files themselves too..
+ QString name, extfilter;
+ triState parse;
- // Replace variables for command w/all input files
- // ### join gives path issues with directories containing spaces!
- cmd = Project->replaceExtraCompilerVariables(tmp_cmd,
- inputs.join(" "),
- out);
+ for (int i = 0; i < project.SingleProjects.count(); ++i) {
+ VCFilter filter;
+ const VCProjectSingleConfig &singleCfg = project.SingleProjects.at(i);
+ if (filtername == "Root Files") {
+ filter = singleCfg.RootFiles;
+ } else if (filtername == "Source Files") {
+ filter = singleCfg.SourceFiles;
+ } else if (filtername == "Header Files") {
+ filter = singleCfg.HeaderFiles;
+ } else if (filtername == "Generated Files") {
+ filter = singleCfg.GeneratedFiles;
+ } else if (filtername == "LexYacc Files") {
+ filter = singleCfg.LexYaccFiles;
+ } else if (filtername == "Translation Files") {
+ filter = singleCfg.TranslationFiles;
+ } else if (filtername == "Form Files") {
+ filter = singleCfg.FormFiles;
+ } else if (filtername == "Resource Files") {
+ filter = singleCfg.ResourceFiles;
} else {
- deps += inFile; // input file itself too..
- cmd = Project->replaceExtraCompilerVariables(tmp_cmd,
- inFile,
- out);
- }
- // Name for command
- if(!tmp_cmd_name.isEmpty()) {
- cmd_name = Project->replaceExtraCompilerVariables(tmp_cmd_name, inFile, out);
- } else {
- int space = cmd.indexOf(' ');
- if(space != -1)
- cmd_name = cmd.left(space);
- else
- cmd_name = cmd;
- if((cmd_name[0] == '\'' || cmd_name[0] == '"') &&
- cmd_name[0] == cmd_name[cmd_name.length()-1])
- cmd_name = cmd_name.mid(1,cmd_name.length()-2);
- }
-
- // Fixify paths
- for (int i = 0; i < deps.count(); ++i)
- deps[i] = Option::fixPathToTargetOS(deps[i], false);
-
-
- // Output in info.additionalFile -----------
- if (!CustomBuildTool.Description.isEmpty())
- CustomBuildTool.Description += ", ";
- CustomBuildTool.Description += cmd_name;
- CustomBuildTool.CommandLine += VCToolBase::fixCommandLine(cmd.trimmed());
- int space = cmd.indexOf(' ');
- QFileInfo finf(cmd.left(space));
- if (CustomBuildTool.ToolPath.isEmpty())
- CustomBuildTool.ToolPath += Option::fixPathToTargetOS(finf.path());
- CustomBuildTool.Outputs += out;
-
- deps += CustomBuildTool.AdditionalDependencies;
- deps += cmd.left(cmd.indexOf(' '));
- // Make sure that all deps are only once
- QMap<QString, bool> uniqDeps;
- for (int c = 0; c < deps.count(); ++c) {
- QString aDep = deps.at(c).trimmed();
- if (!aDep.isEmpty())
- uniqDeps[aDep] = false;
- }
- CustomBuildTool.AdditionalDependencies = uniqDeps.keys();
- }
-
- // Ensure that none of the output files are also dependencies. Or else, the custom buildstep
- // will be rebuild every time, even if nothing has changed.
- foreach(QString output, CustomBuildTool.Outputs) {
- CustomBuildTool.AdditionalDependencies.removeAll(output);
- }
-
- useCustomBuildTool = !CustomBuildTool.CommandLine.isEmpty();
- return useCustomBuildTool;
-}
-
-bool VCXFilter::outputFileConfig(XmlOutput &xml, XmlOutput &xmlFilter, const QString &filename, const QString &filtername, bool fileAllreadyAdded)
-{
- bool fileAdded = false;
-
- // Clearing each filter tool
- useCustomBuildTool = false;
- useCompilerTool = false;
- CustomBuildTool = VCXCustomBuildTool();
- CompilerTool = VCXCLCompilerTool();
-
- // Unset some default options
- CompilerTool.BufferSecurityCheck = unset;
- CompilerTool.DebugInformationFormat = "";
- CompilerTool.ExceptionHandling = "";
- //CompilerTool.Optimization = optimizeDefault;
- CompilerTool.ProgramDataBaseFileName.clear();
- CompilerTool.RuntimeLibrary = "";
- //CompilerTool.WarningLevel = warningLevelUnknown;
- CompilerTool.config = Config;
-
- bool inBuild = false;
- VCXFilterFile info;
- for (int i = 0; i < Files.count(); ++i) {
- if (Files.at(i).file == filename) {
- info = Files.at(i);
- inBuild = true;
- }
- }
- inBuild &= !info.excludeFromBuild;
-
- if (inBuild) {
- addExtraCompiler(info);
- if(Project->usePCH)
- modifyPCHstage(info.file);
- } else {
- // Excluded files uses an empty compiler stage
- if(info.excludeFromBuild)
- useCompilerTool = true;
- }
-
- // Actual XML output ----------------------------------
- if(useCustomBuildTool || useCompilerTool || !inBuild) {
-
- if (useCustomBuildTool)
- {
- CustomBuildTool.ConfigName = (*Config).Name;
-
- if ( !fileAllreadyAdded ) {
-
- fileAdded = true;
-
- xmlFilter << tag("CustomBuild")
- << attrTag("Include",Option::fixPathToLocalOS(filename))
- << attrTagS("Filter", filtername);
-
- xml << tag("CustomBuild")
- << attrTag("Include",Option::fixPathToLocalOS(filename));
-
- if ( filtername == "Form Files" || filtername == "Generated Files" || filtername == "Resource Files" )
- xml << attrTagS("FileType", "Document");
- }
-
- xml << CustomBuildTool;
- }
-
- if ( !fileAdded && !fileAllreadyAdded )
- {
- fileAdded = true;
-
- if (filtername == "Source Files") {
-
- xmlFilter << tag("ClCompile")
- << attrTag("Include",Option::fixPathToLocalOS(filename))
- << attrTagS("Filter", filtername);
-
- xml << tag("ClCompile")
- << attrTag("Include",Option::fixPathToLocalOS(filename));
-
- } else if(filtername == "Header Files") {
-
- xmlFilter << tag("ClInclude")
- << attrTag("Include",Option::fixPathToLocalOS(filename))
- << attrTagS("Filter", filtername);
-
- xml << tag("ClInclude")
- << attrTag("Include",Option::fixPathToLocalOS(filename));
- } else if(filtername == "Generated Files" || filtername == "Form Files") {
-
- if (filename.endsWith(".h")) {
-
- xmlFilter << tag("ClInclude")
- << attrTag("Include",Option::fixPathToLocalOS(filename))
- << attrTagS("Filter", filtername);
-
- xml << tag("ClInclude")
- << attrTag("Include",Option::fixPathToLocalOS(filename));
- } else if(filename.endsWith(".cpp")) {
-
- xmlFilter << tag("ClCompile")
- << attrTag("Include",Option::fixPathToLocalOS(filename))
- << attrTagS("Filter", filtername);
-
- xml << tag("ClCompile")
- << attrTag("Include",Option::fixPathToLocalOS(filename));
- } else if(filename.endsWith(".res")) {
-
- xmlFilter << tag("CustomBuild")
- << attrTag("Include",Option::fixPathToLocalOS(filename))
- << attrTagS("Filter", filtername);
-
- xml << tag("CustomBuild")
- << attrTag("Include",Option::fixPathToLocalOS(filename));
- } else {
-
- xmlFilter << tag("CustomBuild")
- << attrTag("Include",Option::fixPathToLocalOS(filename))
- << attrTagS("Filter", filtername);
-
- xml << tag("CustomBuild")
- << attrTag("Include",Option::fixPathToLocalOS(filename));
- }
- } else if(filtername == "Root Files") {
-
- if (filename.endsWith(".rc")) {
-
- xmlFilter << tag("ResourceCompile")
- << attrTag("Include",Option::fixPathToLocalOS(filename));
-
- xml << tag("ResourceCompile")
- << attrTag("Include",Option::fixPathToLocalOS(filename));
- }
- }
- }
-
- if(!inBuild) {
-
- xml << tag("ExcludedFromBuild")
- << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg((*Config).Name))
- << valueTag("true");
- }
-
- if (useCompilerTool) {
-
- if ( !CompilerTool.ForcedIncludeFiles.isEmpty() ) {
- xml << tag("ForcedIncludeFiles")
- << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg((*Config).Name))
- << valueTagX(CompilerTool.ForcedIncludeFiles);
- }
-
- if ( !CompilerTool.PrecompiledHeaderFile.isEmpty() ) {
-
- xml << tag("PrecompiledHeaderFile")
- << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg((*Config).Name))
- << valueTag(CompilerTool.PrecompiledHeaderFile);
- }
-
- if ( !CompilerTool.PrecompiledHeader.isEmpty() ) {
-
- xml << tag("PrecompiledHeader")
- << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg((*Config).Name))
- << valueTag(CompilerTool.PrecompiledHeader);
- }
+ // ExtraCompilers
+ filter = project.SingleProjects[i].filterForExtraCompiler(filtername);
}
- }
-
- return fileAdded;
-}
-
-
-// VCXProjectSingleConfig --------------------------------------------
-VCXFilter nullVCXFilter;
-VCXFilter& VCXProjectSingleConfig::filterForExtraCompiler(const QString &compilerName)
-{
- for (int i = 0; i < ExtraCompilersFiles.count(); ++i)
- if (ExtraCompilersFiles.at(i).Name == compilerName)
- return ExtraCompilersFiles[i];
- return nullVCXFilter;
-}
-
-
-XmlOutput &operator<<(XmlOutput &xml, const VCXProjectSingleConfig &tool)
-{
- xml.setIndentString(" ");
-
- xml << decl("1.0", "utf-8")
- << tag("Project")
- << attrTag("DefaultTargets","Build")
- << attrTag("ToolsVersion", "4.0")
- << attrTag("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003")
- << tag("ItemGroup")
- << attrTag("Label", "ProjectConfigurations");
-
- xml << tag("ProjectConfiguration")
- << attrTag("Include" , tool.Configuration.Name)
- << tagValue("Configuration", tool.Configuration.ConfigurationName)
- << tagValue("Platform", tool.PlatformName)
- << closetag();
-
- xml << closetag()
- << tag("PropertyGroup")
- << attrTag("Label", "Globals")
- << tagValue("ProjectGuid", tool.ProjectGUID)
- << tagValue("RootNamespace", tool.Name)
- << tagValue("Keyword", tool.Keyword)
- << closetag();
-
- // config part.
- xml << import("Project", "$(VCTargetsPath)\\Microsoft.Cpp.Default.props");
-
- xml << tool.Configuration;
-
- xml << import("Project", "$(VCTargetsPath)\\Microsoft.Cpp.props");
-
- // Extension settings
- xml << tag("ImportGroup")
- << attrTag("Label", "ExtensionSettings")
- << closetag();
-
- // PropertySheets
- xml << tag("ImportGroup")
- << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.Configuration.Name))
- << attrTag("Label", "PropertySheets");
-
- xml << tag("Import")
- << attrTag("Project", "$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props")
- << attrTag("Condition", "exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')")
- << closetag()
- << closetag();
-
-
- // UserMacros
- xml << tag("PropertyGroup")
- << attrTag("Label", "UserMacros")
- << closetag();
-
- xml << tag("PropertyGroup");
-
- if ( !tool.Configuration.OutputDirectory.isEmpty() ) {
- xml<< tag("OutDir")
- << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.Configuration.Name))
- << valueTag(tool.Configuration.OutputDirectory);
- }
- if ( !tool.Configuration.IntermediateDirectory.isEmpty() ) {
- xml<< tag("IntDir")
- << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.Configuration.Name))
- << valueTag(tool.Configuration.IntermediateDirectory);
- }
- if ( !tool.Configuration.TargetName.isEmpty() ) {
- xml<< tag("TargetName")
- << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.Configuration.Name))
- << valueTag(tool.Configuration.TargetName);
- }
-
- if ( tool.Configuration.linker.IgnoreImportLibrary != unset) {
- xml<< tag("IgnoreImportLibrary")
- << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.Configuration.Name))
- << valueTagT(tool.Configuration.linker.IgnoreImportLibrary);
- }
-
- if ( tool.Configuration.linker.LinkIncremental != unset) {
- xml<< tag("LinkIncremental")
- << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.Configuration.Name))
- << valueTagT(tool.Configuration.linker.LinkIncremental);
- }
-
- if ( tool.Configuration.preBuild.UseInBuild != unset )
- {
- xml<< tag("PreBuildEventUseInBuild")
- << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.Configuration.Name))
- << valueTagT(tool.Configuration.preBuild.UseInBuild);
- }
-
- if ( tool.Configuration.preLink.UseInBuild != unset )
- {
- xml<< tag("PreLinkEventUseInBuild")
- << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.Configuration.Name))
- << valueTagT(tool.Configuration.preLink.UseInBuild);
- }
-
- if ( tool.Configuration.postBuild.UseInBuild != unset )
- {
- xml<< tag("PostBuildEventUseInBuild")
- << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.Configuration.Name))
- << valueTagT(tool.Configuration.postBuild.UseInBuild);
- }
- xml << closetag();
-
- xml << tag("ItemDefinitionGroup")
- << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.Configuration.Name));
- // ClCompile
- xml << tool.Configuration.compiler;
-
- // Link
- xml << tool.Configuration.linker;
-
- // Midl
- xml << tool.Configuration.idl;
-
- // ResourceCompiler
- xml << tool.Configuration.resource;
-
- // Post build event
- if ( tool.Configuration.postBuild.UseInBuild != unset )
- xml << tool.Configuration.postBuild;
-
- // Pre build event
- if ( tool.Configuration.preBuild.UseInBuild != unset )
- xml << tool.Configuration.preBuild;
-
- // Pre link event
- if ( tool.Configuration.preLink.UseInBuild != unset )
- xml << tool.Configuration.preLink;
-
- xml << closetag();
-
- QFile filterFile;
- filterFile.setFileName(Option::output.fileName().append(".filters"));
- filterFile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate);
- QTextStream ts(&filterFile);
- XmlOutput xmlFilter(ts, XmlOutput::NoConversion);
-
- xmlFilter.setIndentString(" ");
-
- xmlFilter << decl("1.0", "utf-8")
- << tag("Project")
- << attrTag("ToolsVersion", "4.0")
- << attrTag("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003");
-
- xmlFilter << tag("ItemGroup");
-
- VCXProject tempProj;
- tempProj.SingleProjects += tool;
-
- tempProj.addFilters(xmlFilter, "Form Files");
- tempProj.addFilters(xmlFilter, "Generated Files");
- tempProj.addFilters(xmlFilter, "Header Files");
- tempProj.addFilters(xmlFilter, "LexYacc Files");
- tempProj.addFilters(xmlFilter, "Resource Files");
- tempProj.addFilters(xmlFilter, "Source Files");
- tempProj.addFilters(xmlFilter, "Translation Files");
- xmlFilter << closetag();
-
- tempProj.outputFilter(xml, xmlFilter, "Source Files");
- tempProj.outputFilter(xml, xmlFilter, "Header Files");
- tempProj.outputFilter(xml, xmlFilter, "Generated Files");
- tempProj.outputFilter(xml, xmlFilter, "LexYacc Files");
- tempProj.outputFilter(xml, xmlFilter, "Translation Files");
- tempProj.outputFilter(xml, xmlFilter, "Form Files");
- tempProj.outputFilter(xml, xmlFilter, "Resource Files");
-
- for (int x = 0; x < tempProj.ExtraCompilers.count(); ++x) {
- tempProj.outputFilter(xml, xmlFilter, tempProj.ExtraCompilers.at(x));
- }
-
- xml << import("Project", "$(VCTargetsPath)\\Microsoft.Cpp.targets");
-
- xml << tag("ImportGroup")
- << attrTag("Label", "ExtensionTargets")
- << closetag();
-
- return xml;
-}
-
-
-// Tree file generation ---------------------------------------------
-void XTreeNode::generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &tagName, VCXProject &tool, const QString &filter) {
+ // Merge all files in this filter to root tree
+ for (int x = 0; x < filter.Files.count(); ++x)
+ root->addElement(filter.Files.at(x));
- if (children.size()) {
- // Filter
- QString tempFilterName;
- ChildrenMap::ConstIterator it, end = children.constEnd();
- if (!tagName.isEmpty()) {
- tempFilterName.append(filter);
- tempFilterName.append("\\");
- tempFilterName.append(tagName);
- xmlFilter << tag(_ItemGroup);
- xmlFilter << tag("Filter")
- << attrTag("Include", tempFilterName)
- << closetag();
- xmlFilter << closetag();
+ // Save filter setting from first filter. Next filters
+ // may differ but we cannot handle that. (ex. extfilter)
+ if (name.isEmpty()) {
+ name = filter.Name;
+ extfilter = filter.Filter;
+ parse = filter.ParseFiles;
}
- // First round, do nested filters
- for (it = children.constBegin(); it != end; ++it)
- if ((*it)->children.size())
- {
- if ( !tempFilterName.isEmpty() )
- (*it)->generateXML(xml, xmlFilter, it.key(), tool, tempFilterName);
- else
- (*it)->generateXML(xml, xmlFilter, it.key(), tool, filter);
- }
- // Second round, do leafs
- for (it = children.constBegin(); it != end; ++it)
- if (!(*it)->children.size())
- {
- if ( !tempFilterName.isEmpty() )
- (*it)->generateXML(xml, xmlFilter, it.key(), tool, tempFilterName);
- else
- (*it)->generateXML(xml, xmlFilter, it.key(), tool, filter);
- }
- } else {
- // Leaf
- xml << tag(_ItemGroup);
- xmlFilter << tag(_ItemGroup);
- tool.outputFileConfigs(xml, xmlFilter, info, filter);
- xmlFilter << closetag();
- xml << closetag();
}
-}
+ if (!root->hasElements())
+ return;
-// Flat file generation ---------------------------------------------
-void XFlatNode::generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &/*tagName*/, VCXProject &tool, const QString &filter) {
- if (children.size()) {
- ChildrenMapFlat::ConstIterator it = children.constBegin();
- ChildrenMapFlat::ConstIterator end = children.constEnd();
- xml << tag(_ItemGroup);
- xmlFilter << tag(_ItemGroup);
- for (; it != end; ++it) {
- tool.outputFileConfigs(xml, xmlFilter, (*it), filter);
- }
- xml << closetag();
- xmlFilter << closetag();
- }
+ root->generateXML(xml, xmlFilter, "", project, filtername); // output root tree
}
-
-// VCXProject --------------------------------------------------------
// Output all configurations (by filtername) for a file (by info)
-// A filters config output is in VCXFilter.outputFileConfig()
-void VCXProject::outputFileConfigs(XmlOutput &xml,
- XmlOutput &xmlFilter,
- const VCXFilterFile &info,
- const QString &filtername)
+// A filters config output is in VCFilter.outputFileConfig()
+void VCXProjectWriter::outputFileConfigs(VCProject &project, XmlOutput &xml, XmlOutput &xmlFilter, const VCFilterFile &info, const QString &filtername)
{
// We need to check if the file has any custom build step.
// If there is one then it has to be included with "CustomBuild Include"
bool fileAdded = false;
- for (int i = 0; i < SingleProjects.count(); ++i) {
- VCXFilter filter;
+ for (int i = 0; i < project.SingleProjects.count(); ++i) {
+ VCFilter filter;
+ const VCProjectSingleConfig &singleCfg = project.SingleProjects.at(i);
if (filtername == "Root Files") {
- filter = SingleProjects.at(i).RootFiles;
+ filter = singleCfg.RootFiles;
} else if (filtername == "Source Files") {
- filter = SingleProjects.at(i).SourceFiles;
+ filter = singleCfg.SourceFiles;
} else if (filtername == "Header Files") {
- filter = SingleProjects.at(i).HeaderFiles;
+ filter = singleCfg.HeaderFiles;
} else if (filtername == "Generated Files") {
- filter = SingleProjects.at(i).GeneratedFiles;
+ filter = singleCfg.GeneratedFiles;
} else if (filtername == "LexYacc Files") {
- filter = SingleProjects.at(i).LexYaccFiles;
+ filter = singleCfg.LexYaccFiles;
} else if (filtername == "Translation Files") {
- filter = SingleProjects.at(i).TranslationFiles;
+ filter = singleCfg.TranslationFiles;
} else if (filtername == "Form Files") {
- filter = SingleProjects.at(i).FormFiles;
+ filter = singleCfg.FormFiles;
} else if (filtername == "Resource Files") {
- filter = SingleProjects.at(i).ResourceFiles;
+ filter = singleCfg.ResourceFiles;
} else {
// ExtraCompilers
- filter = SingleProjects[i].filterForExtraCompiler(filtername);
+ filter = project.SingleProjects[i].filterForExtraCompiler(filtername);
}
if (filter.Config) // only if the filter is not empty
- if (filter.outputFileConfig(xml, xmlFilter, info.file, filtername, fileAdded)) // only add it once.
+ if (outputFileConfig(filter, xml, xmlFilter, info.file, filtername, fileAdded)) // only add it once.
fileAdded = true;
}
@@ -3085,296 +1776,165 @@ void VCXProject::outputFileConfigs(XmlOutput &xml,
xmlFilter << closetag();
}
-// outputs a given filter for all existing configurations of a project
-void VCXProject::outputFilter(XmlOutput &xml,
- XmlOutput &xmlFilter,
- const QString &filtername)
+bool VCXProjectWriter::outputFileConfig(VCFilter &filter, XmlOutput &xml, XmlOutput &xmlFilter, const QString &filename, const QString &filtername, bool fileAllreadyAdded)
{
- XNode *root;
- if (SingleProjects.at(0).flat_files)
- root = new XFlatNode;
- else
- root = new XTreeNode;
-
- QString name, extfilter;
- triState parse;
+ bool fileAdded = false;
- for (int i = 0; i < SingleProjects.count(); ++i) {
- VCXFilter filter;
- if (filtername == "Root Files") {
- filter = SingleProjects.at(i).RootFiles;
- } else if (filtername == "Source Files") {
- filter = SingleProjects.at(i).SourceFiles;
- } else if (filtername == "Header Files") {
- filter = SingleProjects.at(i).HeaderFiles;
- } else if (filtername == "Generated Files") {
- filter = SingleProjects.at(i).GeneratedFiles;
- } else if (filtername == "LexYacc Files") {
- filter = SingleProjects.at(i).LexYaccFiles;
- } else if (filtername == "Translation Files") {
- filter = SingleProjects.at(i).TranslationFiles;
- } else if (filtername == "Form Files") {
- filter = SingleProjects.at(i).FormFiles;
- } else if (filtername == "Resource Files") {
- filter = SingleProjects.at(i).ResourceFiles;
- } else {
- // ExtraCompilers
- filter = SingleProjects[i].filterForExtraCompiler(filtername);
- }
+ // Clearing each filter tool
+ filter.useCustomBuildTool = false;
+ filter.useCompilerTool = false;
+ filter.CustomBuildTool = VCCustomBuildTool();
+ filter.CompilerTool = VCCLCompilerTool();
- // Merge all files in this filter to root tree
- for (int x = 0; x < filter.Files.count(); ++x)
- root->addElement(filter.Files.at(x));
+ // Unset some default options
+ filter.CustomBuildTool.config = filter.Config;
+ filter.CompilerTool.BufferSecurityCheck = unset;
+ filter.CompilerTool.DebugInformationFormat = debugUnknown;
+ filter.CompilerTool.ExceptionHandling = ehDefault;
+ filter.CompilerTool.ProgramDataBaseFileName.clear();
+ filter.CompilerTool.RuntimeLibrary = rtUnknown;
+ filter.CompilerTool.config = filter.Config;
- // Save filter setting from first filter. Next filters
- // may differ but we cannot handle that. (ex. extfilter)
- if (name.isEmpty()) {
- name = filter.Name;
- extfilter = filter.Filter;
- parse = filter.ParseFiles;
+ bool inBuild = false;
+ VCFilterFile info;
+ for (int i = 0; i < filter.Files.count(); ++i) {
+ if (filter.Files.at(i).file == filename) {
+ info = filter.Files.at(i);
+ inBuild = true;
}
}
+ inBuild &= !info.excludeFromBuild;
- if (!root->hasElements())
- return;
-
- root->generateXML(xml, xmlFilter, "", *this, filtername); // output root tree
-}
-
-
-void VCXProject::addFilters(XmlOutput &xmlFilter,
- const QString &filtername)
-{
- bool added = false;
-
- for (int i = 0; i < SingleProjects.count(); ++i) {
- VCXFilter filter;
- if (filtername == "Root Files") {
- filter = SingleProjects.at(i).RootFiles;
- } else if (filtername == "Source Files") {
- filter = SingleProjects.at(i).SourceFiles;
- } else if (filtername == "Header Files") {
- filter = SingleProjects.at(i).HeaderFiles;
- } else if (filtername == "Generated Files") {
- filter = SingleProjects.at(i).GeneratedFiles;
- } else if (filtername == "LexYacc Files") {
- filter = SingleProjects.at(i).LexYaccFiles;
- } else if (filtername == "Translation Files") {
- filter = SingleProjects.at(i).TranslationFiles;
- } else if (filtername == "Form Files") {
- filter = SingleProjects.at(i).FormFiles;
- } else if (filtername == "Resource Files") {
- filter = SingleProjects.at(i).ResourceFiles;
- } else {
- // ExtraCompilers
- filter = SingleProjects[i].filterForExtraCompiler(filtername);
- }
-
- if(!filter.Files.isEmpty() && !added) {
- added = true;
- xmlFilter << tag("Filter")
- << attrTag("Include", filtername)
- << attrTagS("UniqueIdentifier", filter.Guid)
- << attrTagS("Extensions", filter.Filter)
- << attrTagT("ParseFiles", filter.ParseFiles)
- << closetag();
- }
+ if (inBuild) {
+ filter.addExtraCompiler(info);
+ if (filter.Project->usePCH)
+ filter.modifyPCHstage(info.file);
+ } else {
+ // Excluded files uses an empty compiler stage
+ if(info.excludeFromBuild)
+ filter.useCompilerTool = true;
}
-}
-
-XmlOutput &operator<<(XmlOutput &xml, VCXProject &tool)
-{
+ // Actual XML output ----------------------------------
+ if (filter.useCustomBuildTool || filter.useCompilerTool || !inBuild) {
- if (tool.SingleProjects.count() == 0) {
- warn_msg(WarnLogic, "Generator: .NET: no single project in merge project, no output");
- return xml;
- }
+ if (filter.useCustomBuildTool)
+ {
+ if ( !fileAllreadyAdded ) {
- xml.setIndentString(" ");
+ fileAdded = true;
- xml << decl("1.0", "utf-8")
- << tag("Project")
- << attrTag("DefaultTargets","Build")
- << attrTag("ToolsVersion", "4.0")
- << attrTag("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003")
- << tag("ItemGroup")
- << attrTag("Label", "ProjectConfigurations");
+ xmlFilter << tag("CustomBuild")
+ << attrTag("Include",Option::fixPathToLocalOS(filename))
+ << attrTagS("Filter", filtername);
- for (int i = 0; i < tool.SingleProjects.count(); ++i) {
- xml << tag("ProjectConfiguration")
- << attrTag("Include" , tool.SingleProjects.at(i).Configuration.Name)
- << tagValue("Configuration", tool.SingleProjects.at(i).Configuration.ConfigurationName)
- << tagValue("Platform", tool.SingleProjects.at(i).PlatformName)
- << closetag();
- }
+ xml << tag("CustomBuild")
+ << attrTag("Include",Option::fixPathToLocalOS(filename));
- xml << closetag()
- << tag("PropertyGroup")
- << attrTag("Label", "Globals")
- << tagValue("ProjectGuid", tool.ProjectGUID)
- << tagValue("RootNamespace", tool.Name)
- << tagValue("Keyword", tool.Keyword)
- << closetag();
+ if ( filtername == "Form Files" || filtername == "Generated Files" || filtername == "Resource Files" )
+ xml << attrTagS("FileType", "Document");
+ }
- // config part.
- xml << import("Project", "$(VCTargetsPath)\\Microsoft.Cpp.Default.props");
- for (int i = 0; i < tool.SingleProjects.count(); ++i)
- xml << tool.SingleProjects.at(i).Configuration;
- xml << import("Project", "$(VCTargetsPath)\\Microsoft.Cpp.props");
+ filter.Project->projectWriter->write(xml, filter.CustomBuildTool);
+ }
- // Extension settings
- xml << tag("ImportGroup")
- << attrTag("Label", "ExtensionSettings")
- << closetag();
+ if ( !fileAdded && !fileAllreadyAdded )
+ {
+ fileAdded = true;
- // PropertySheets
- for (int i = 0; i < tool.SingleProjects.count(); ++i) {
- xml << tag("ImportGroup")
- << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.SingleProjects.at(i).Configuration.Name))
- << attrTag("Label", "PropertySheets");
+ if (filtername == "Source Files") {
- xml << tag("Import")
- << attrTag("Project", "$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props")
- << attrTag("Condition", "exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')")
- << closetag()
- << closetag();
- }
+ xmlFilter << tag("ClCompile")
+ << attrTag("Include",Option::fixPathToLocalOS(filename))
+ << attrTagS("Filter", filtername);
- // UserMacros
- xml << tag("PropertyGroup")
- << attrTag("Label", "UserMacros")
- << closetag();
+ xml << tag("ClCompile")
+ << attrTag("Include",Option::fixPathToLocalOS(filename));
- xml << tag("PropertyGroup");
- for (int i = 0; i < tool.SingleProjects.count(); ++i) {
+ } else if(filtername == "Header Files") {
- if ( !tool.SingleProjects.at(i).Configuration.OutputDirectory.isEmpty() ) {
- xml << tag("OutDir")
- << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.SingleProjects.at(i).Configuration.Name))
- << valueTag(tool.SingleProjects.at(i).Configuration.OutputDirectory);
- }
- if ( !tool.SingleProjects.at(i).Configuration.IntermediateDirectory.isEmpty() ) {
- xml << tag("IntDir")
- << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.SingleProjects.at(i).Configuration.Name))
- << valueTag(tool.SingleProjects.at(i).Configuration.IntermediateDirectory);
- }
- if ( !tool.SingleProjects.at(i).Configuration.TargetName.isEmpty() ) {
- xml << tag("TargetName")
- << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.SingleProjects.at(i).Configuration.Name))
- << valueTag(tool.SingleProjects.at(i).Configuration.TargetName);
- }
+ xmlFilter << tag("ClInclude")
+ << attrTag("Include",Option::fixPathToLocalOS(filename))
+ << attrTagS("Filter", filtername);
- if ( tool.SingleProjects.at(i).Configuration.linker.IgnoreImportLibrary != unset) {
- xml << tag("IgnoreImportLibrary")
- << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.SingleProjects.at(i).Configuration.Name))
- << valueTagT(tool.SingleProjects.at(i).Configuration.linker.IgnoreImportLibrary);
- }
+ xml << tag("ClInclude")
+ << attrTag("Include",Option::fixPathToLocalOS(filename));
+ } else if(filtername == "Generated Files" || filtername == "Form Files") {
- if ( tool.SingleProjects.at(i).Configuration.linker.LinkIncremental != unset) {
- xml << tag("LinkIncremental")
- << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.SingleProjects.at(i).Configuration.Name))
- << valueTagT(tool.SingleProjects.at(i).Configuration.linker.LinkIncremental);
- }
+ if (filename.endsWith(".h")) {
- if ( tool.SingleProjects.at(i).Configuration.preBuild.UseInBuild != unset )
- {
- xml << tag("PreBuildEventUseInBuild")
- << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.SingleProjects.at(i).Configuration.Name))
- << valueTagT(tool.SingleProjects.at(i).Configuration.preBuild.UseInBuild);
- }
+ xmlFilter << tag("ClInclude")
+ << attrTag("Include",Option::fixPathToLocalOS(filename))
+ << attrTagS("Filter", filtername);
- if ( tool.SingleProjects.at(i).Configuration.preLink.UseInBuild != unset )
- {
- xml << tag("PreLinkEventUseInBuild")
- << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.SingleProjects.at(i).Configuration.Name))
- << valueTagT(tool.SingleProjects.at(i).Configuration.preLink.UseInBuild);
- }
+ xml << tag("ClInclude")
+ << attrTag("Include",Option::fixPathToLocalOS(filename));
+ } else if(filename.endsWith(".cpp")) {
- if ( tool.SingleProjects.at(i).Configuration.postBuild.UseInBuild != unset )
- {
- xml << tag("PostBuildEventUseInBuild")
- << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.SingleProjects.at(i).Configuration.Name))
- << valueTagT(tool.SingleProjects.at(i).Configuration.postBuild.UseInBuild);
- }
- }
- xml << closetag();
+ xmlFilter << tag("ClCompile")
+ << attrTag("Include",Option::fixPathToLocalOS(filename))
+ << attrTagS("Filter", filtername);
- for (int i = 0; i < tool.SingleProjects.count(); ++i) {
- xml << tag("ItemDefinitionGroup")
- << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(tool.SingleProjects.at(i).Configuration.Name));
+ xml << tag("ClCompile")
+ << attrTag("Include",Option::fixPathToLocalOS(filename));
+ } else if(filename.endsWith(".res")) {
- // ClCompile
- xml << tool.SingleProjects.at(i).Configuration.compiler;
+ xmlFilter << tag("CustomBuild")
+ << attrTag("Include",Option::fixPathToLocalOS(filename))
+ << attrTagS("Filter", filtername);
- // Link
- xml << tool.SingleProjects.at(i).Configuration.linker;
+ xml << tag("CustomBuild")
+ << attrTag("Include",Option::fixPathToLocalOS(filename));
+ } else {
- // Midl
- xml << tool.SingleProjects.at(i).Configuration.idl;
+ xmlFilter << tag("CustomBuild")
+ << attrTag("Include",Option::fixPathToLocalOS(filename))
+ << attrTagS("Filter", filtername);
- // ResourceCompiler
- xml << tool.SingleProjects.at(i).Configuration.resource;
+ xml << tag("CustomBuild")
+ << attrTag("Include",Option::fixPathToLocalOS(filename));
+ }
+ } else if(filtername == "Root Files") {
- // Post build event
- if ( tool.SingleProjects.at(i).Configuration.postBuild.UseInBuild != unset )
- xml << tool.SingleProjects.at(i).Configuration.postBuild;
-
- // Pre build event
- if ( tool.SingleProjects.at(i).Configuration.preBuild.UseInBuild != unset )
- xml << tool.SingleProjects.at(i).Configuration.preBuild;
+ if (filename.endsWith(".rc")) {
- // Pre link event
- if ( tool.SingleProjects.at(i).Configuration.preLink.UseInBuild != unset )
- xml << tool.SingleProjects.at(i).Configuration.preLink;
+ xmlFilter << tag("ResourceCompile")
+ << attrTag("Include",Option::fixPathToLocalOS(filename));
- xml << closetag();
- }
+ xml << tag("ResourceCompile")
+ << attrTag("Include",Option::fixPathToLocalOS(filename));
+ }
+ }
+ }
- // The file filters are added in a separate file for MSBUILD.
- QFile filterFile;
- filterFile.setFileName(Option::output.fileName().append(".filters"));
- filterFile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate);
- QTextStream ts(&filterFile);
- XmlOutput xmlFilter(ts, XmlOutput::NoConversion);
+ if(!inBuild) {
- xmlFilter.setIndentString(" ");
+ xml << tag("ExcludedFromBuild")
+ << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(filter.Config->Name))
+ << valueTag("true");
+ }
- xmlFilter << decl("1.0", "utf-8")
- << tag("Project")
- << attrTag("ToolsVersion", "4.0")
- << attrTag("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003");
+ if (filter.useCompilerTool) {
- xmlFilter << tag("ItemGroup");
+ if ( !filter.CompilerTool.ForcedIncludeFiles.isEmpty() ) {
+ xml << tag("ForcedIncludeFiles")
+ << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(filter.Config->Name))
+ << valueTagX(filter.CompilerTool.ForcedIncludeFiles);
+ }
- tool.addFilters(xmlFilter, "Form Files");
- tool.addFilters(xmlFilter, "Generated Files");
- tool.addFilters(xmlFilter, "Header Files");
- tool.addFilters(xmlFilter, "LexYacc Files");
- tool.addFilters(xmlFilter, "Resource Files");
- tool.addFilters(xmlFilter, "Source Files");
- tool.addFilters(xmlFilter, "Translation Files");
- xmlFilter << closetag();
+ if ( !filter.CompilerTool.PrecompiledHeaderThrough.isEmpty() ) {
- tool.outputFilter(xml, xmlFilter, "Source Files");
- tool.outputFilter(xml, xmlFilter, "Header Files");
- tool.outputFilter(xml, xmlFilter, "Generated Files");
- tool.outputFilter(xml, xmlFilter, "LexYacc Files");
- tool.outputFilter(xml, xmlFilter, "Translation Files");
- tool.outputFilter(xml, xmlFilter, "Form Files");
- tool.outputFilter(xml, xmlFilter, "Resource Files");
- for (int x = 0; x < tool.ExtraCompilers.count(); ++x) {
- tool.outputFilter(xml, xmlFilter, tool.ExtraCompilers.at(x));
+ xml << tag("PrecompiledHeaderFile")
+ << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(filter.Config->Name))
+ << valueTag(filter.CompilerTool.PrecompiledHeaderThrough)
+ << tag("PrecompiledHeader")
+ << attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(filter.Config->Name))
+ << valueTag(toString(filter.CompilerTool.UsePrecompiledHeader));
+ }
+ }
}
- tool.outputFilter(xml, xmlFilter, "Root Files");
-
- xml << import("Project", "$(VCTargetsPath)\\Microsoft.Cpp.targets");
- xml << tag("ImportGroup")
- << attrTag("Label", "ExtensionTargets")
- << closetag();
-
- return xml;
+ return fileAdded;
}
QT_END_NAMESPACE
diff --git a/qmake/generators/win32/msbuild_objectmodel.h b/qmake/generators/win32/msbuild_objectmodel.h
index ab4de91..c80a270 100644
--- a/qmake/generators/win32/msbuild_objectmodel.h
+++ b/qmake/generators/win32/msbuild_objectmodel.h
@@ -54,519 +54,24 @@
QT_BEGIN_NAMESPACE
-
-class VCXConfiguration;
-class VCXProject;
-
-class VCXCLCompilerTool : public VCToolBase
-{
-public:
- // Functions
- VCXCLCompilerTool();
- virtual ~VCXCLCompilerTool(){}
- bool parseOption(const char* option);
-
- // Variables
- QStringList AdditionalIncludeDirectories;
- QStringList AdditionalOptions;
- QStringList AdditionalUsingDirectories;
- QString AlwaysAppend;
- QString AssemblerListingLocation;
- QString AssemblerOutput;
- QString BasicRuntimeChecks;
- triState BrowseInformation;
- QString BrowseInformationFile;
- triState BufferSecurityCheck;
- QString CallingConvention;
- QString CompileAs;
- QString CompileAsManaged;
- triState CreateHotpatchableImage;
- QString DebugInformationFormat;
- triState DisableLanguageExtensions;
- QStringList DisableSpecificWarnings;
- QString EnableEnhancedInstructionSet;
- triState EnableFiberSafeOptimizations;
- triState EnablePREfast;
- QString ErrorReporting;
- QString ExceptionHandling;
- triState ExpandAttributedSource;
- QString FavorSizeOrSpeed;
- triState FloatingPointExceptions;
- QString FloatingPointModel;
- triState ForceConformanceInForLoopScope;
- QStringList ForcedIncludeFiles;
- QStringList ForcedUsingFiles;
- triState FunctionLevelLinking;
- triState GenerateXMLDocumentationFiles;
- triState IgnoreStandardIncludePath;
- QString InlineFunctionExpansion;
- triState IntrinsicFunctions;
- triState MinimalRebuild;
- triState MultiProcessorCompilation;
- QString ObjectFileName;
- QStringList ObjectFiles;
- triState OmitDefaultLibName;
- triState OmitFramePointers;
- triState OpenMPSupport;
- QString Optimization;
- QString PrecompiledHeader;
- QString PrecompiledHeaderFile;
- QString PrecompiledHeaderOutputFile;
- triState PreprocessKeepComments;
- QStringList PreprocessorDefinitions;
- QString PreprocessOutputPath;
- triState PreprocessSuppressLineNumbers;
- triState PreprocessToFile;
- QString ProgramDataBaseFileName;
- QString ProcessorNumber;
- QString RuntimeLibrary;
- triState RuntimeTypeInfo;
- triState ShowIncludes;
- triState SmallerTypeCheck;
- triState StringPooling;
- QString StructMemberAlignment;
- triState SuppressStartupBanner;
- QString TreatSpecificWarningsAsErrors;
- triState TreatWarningAsError;
- triState TreatWChar_tAsBuiltInType;
- triState UndefineAllPreprocessorDefinitions;
- QStringList UndefinePreprocessorDefinitions;
- triState UseFullPaths;
- triState UseUnicodeForAssemblerListing;
- QString WarningLevel;
- triState WholeProgramOptimization;
- QString XMLDocumentationFileName;
-
- VCXConfiguration* config;
-};
-
-class VCXLinkerTool : public VCToolBase
-{
-public:
- // Functions
- VCXLinkerTool();
- virtual ~VCXLinkerTool(){}
- bool parseOption(const char* option);
-
- // Variables
- QStringList AdditionalDependencies;
- QStringList AdditionalLibraryDirectories;
- QStringList AdditionalManifestDependencies;
- QStringList AdditionalOptions;
- QStringList AddModuleNamesToAssembly;
- triState AllowIsolation;
- triState AssemblyDebug;
- QStringList AssemblyLinkResource;
- QString BaseAddress;
- QString CLRImageType;
- QString CLRSupportLastError;
- QString CLRThreadAttribute;
- QString CLRUnmanagedCodeCheck;
- QString CreateHotPatchableImage;
- triState DataExecutionPrevention;
- QStringList DelayLoadDLLs;
- triState DelaySign;
- QString Driver;
- QStringList EmbedManagedResourceFile;
- triState EnableCOMDATFolding;
- triState EnableUAC;
- QString EntryPointSymbol;
- triState FixedBaseAddress;
- QString ForceFileOutput;
- QStringList ForceSymbolReferences;
- QString FunctionOrder;
- triState GenerateDebugInformation;
- triState GenerateManifest;
- triState GenerateMapFile;
- qlonglong HeapCommitSize;
- qlonglong HeapReserveSize;
- triState IgnoreAllDefaultLibraries;
- triState IgnoreEmbeddedIDL;
- triState IgnoreImportLibrary;
- QStringList IgnoreSpecificDefaultLibraries;
- triState ImageHasSafeExceptionHandlers;
- QString ImportLibrary;
- QString KeyContainer;
- QString KeyFile;
- triState LargeAddressAware;
- triState LinkDLL;
- QString LinkErrorReporting;
- triState LinkIncremental;
- triState LinkStatus;
- QString LinkTimeCodeGeneration;
- QString ManifestFile;
- triState MapExports;
- QString MapFileName;
- QString MergedIDLBaseFileName;
- QString MergeSections;
- QString MidlCommandFile;
- QString ModuleDefinitionFile;
- QString MSDOSStubFileName;
- triState NoEntryPoint;
- triState OptimizeReferences;
- QString OutputFile;
- triState PreventDllBinding;
- QString Profile;
- QString ProfileGuidedDatabase;
- QString ProgramDatabaseFile;
- triState RandomizedBaseAddress;
- triState RegisterOutput;
- qlonglong SectionAlignment;
- triState SetChecksum;
- QString ShowProgress;
- QString SpecifySectionAttributes;
- QString StackCommitSize;
- QString StackReserveSize;
- QString StripPrivateSymbols;
- QString SubSystem;
- triState SupportNobindOfDelayLoadedDLL;
- triState SupportUnloadOfDelayLoadedDLL;
- triState SuppressStartupBanner;
- triState SwapRunFromCD;
- triState SwapRunFromNet;
- QString TargetMachine;
- triState TerminalServerAware;
- triState TreatLinkerWarningAsErrors;
- triState TurnOffAssemblyGeneration;
- QString TypeLibraryFile;
- qlonglong TypeLibraryResourceID;
- QString UACExecutionLevel;
- triState UACUIAccess;
- QString Version;
-
-
- VCXConfiguration* config;
-};
-
-class VCXMIDLTool : public VCToolBase
-{
-public:
- // Functions
- VCXMIDLTool();
- virtual ~VCXMIDLTool(){}
- bool parseOption(const char* option);
-
- // Variables
- QStringList AdditionalIncludeDirectories;
- QStringList AdditionalOptions;
- triState ApplicationConfigurationMode;
- QString ClientStubFile;
- QString CPreprocessOptions;
- QString DefaultCharType;
- QString DLLDataFileName;
- QString EnableErrorChecks;
- triState ErrorCheckAllocations;
- triState ErrorCheckBounds;
- triState ErrorCheckEnumRange;
- triState ErrorCheckRefPointers;
- triState ErrorCheckStubData;
- QString GenerateClientFiles;
- QString GenerateServerFiles;
- triState GenerateStublessProxies;
- triState GenerateTypeLibrary;
- QString HeaderFileName;
- triState IgnoreStandardIncludePath;
- QString InterfaceIdentifierFileName;
- qlonglong LocaleID;
- triState MkTypLibCompatible;
- QString OutputDirectory;
- QStringList PreprocessorDefinitions;
- QString ProxyFileName;
- QString RedirectOutputAndErrors;
- QString ServerStubFile;
- QString StructMemberAlignment;
- triState SuppressCompilerWarnings;
- triState SuppressStartupBanner;
- QString TargetEnvironment;
- QString TypeLibFormat;
- QString TypeLibraryName;
- QStringList UndefinePreprocessorDefinitions;
- triState ValidateAllParameters;
- triState WarnAsError;
- QString WarningLevel;
-
- VCXConfiguration* config;
-};
-
-class VCXLibrarianTool : public VCToolBase
-{
-public:
- // Functions
- VCXLibrarianTool();
- virtual ~VCXLibrarianTool(){}
- bool parseOption(const char*){ return false; };
-
- // Variables
- QStringList AdditionalDependencies;
- QStringList AdditionalLibraryDirectories;
- QStringList AdditionalOptions;
- QString DisplayLibrary;
- QString ErrorReporting;
- QStringList ExportNamedFunctions;
- QStringList ForceSymbolReferences;
- triState IgnoreAllDefaultLibraries;
- QStringList IgnoreSpecificDefaultLibraries;
- triState LinkTimeCodeGeneration;
- QString ModuleDefinitionFile;
- QString Name;
- QString OutputFile;
- QStringList RemoveObjects;
- QString SubSystem;
- triState SuppressStartupBanner;
- QString TargetMachine;
- triState TreatLibWarningAsErrors;
- triState Verbose;
-
-};
-
-class VCXCustomBuildTool : public VCToolBase
-{
-public:
- // Functions
- VCXCustomBuildTool();
- virtual ~VCXCustomBuildTool(){}
- bool parseOption(const char*){ return false; };
-
- // Variables
- QStringList AdditionalDependencies;
- QStringList CommandLine;
- QString Description;
- QStringList Outputs;
- QString ToolName;
- QString ToolPath;
- QString ConfigName;
-};
-
-class VCXResourceCompilerTool : public VCToolBase
-{
-public:
- // Functions
- VCXResourceCompilerTool();
- virtual ~VCXResourceCompilerTool(){}
- bool parseOption(const char*){ return false; };
-
- // Variables
- QStringList AdditionalIncludeDirectories;
- QString AdditionalOptions;
- QString Culture;
- triState IgnoreStandardIncludePath;
- triState NullTerminateStrings;
- QStringList PreprocessorDefinitions;
- QString ResourceOutputFileName;
- triState ShowProgress;
- triState SuppressStartupBanner;
- QString TrackerLogDirectory;
- QString UndefinePreprocessorDefinitions;
-};
-
-class VCXDeploymentTool
-{
-public:
- // Functions
- VCXDeploymentTool();
- virtual ~VCXDeploymentTool() {}
-
- // Variables
- QString DeploymentTag;
- QString RemoteDirectory;
- QString AdditionalFiles;
-};
-
-class VCXEventTool : public VCToolBase
-{
-protected:
- // Functions
- VCXEventTool() : UseInBuild(unset){};
- virtual ~VCXEventTool(){}
- bool parseOption(const char*){ return false; };
-
-public:
- // Variables
- QStringList CommandLine;
- QString Description;
- triState UseInBuild;
- QString EventName;
- QString ToolPath;
-};
-
-class VCXPostBuildEventTool : public VCXEventTool
-{
-public:
- VCXPostBuildEventTool();
- ~VCXPostBuildEventTool(){}
-};
-
-class VCXPreBuildEventTool : public VCXEventTool
-{
-public:
- VCXPreBuildEventTool();
- ~VCXPreBuildEventTool(){}
-};
-
-class VCXPreLinkEventTool : public VCXEventTool
-{
-public:
- VCXPreLinkEventTool();
- ~VCXPreLinkEventTool(){}
-};
-
-class VCXConfiguration
-{
-public:
- // Functions
- VCXConfiguration();
- ~VCXConfiguration(){}
-
- // Variables
- triState ATLMinimizesCRunTimeLibraryUsage;
- triState BuildBrowserInformation;
- QString CharacterSet;
- QString ConfigurationType;
- QString DeleteExtensionsOnClean;
- QString ImportLibrary;
- QString IntermediateDirectory;
- QString Name;
- QString ConfigurationName;
- QString OutputDirectory;
- QString PrimaryOutput;
- QString ProgramDatabase;
- triState RegisterOutput;
- QString TargetName;
- QString UseOfATL;
- QString UseOfMfc;
- triState WholeProgramOptimization;
-
- // XML sub-parts
- VCXCLCompilerTool compiler;
- VCXLibrarianTool librarian;
- VCXLinkerTool linker;
- VCXMIDLTool idl;
- VCXResourceCompilerTool resource;
- VCXCustomBuildTool custom;
- VCXDeploymentTool deployment; // Not likely to be supported: http://msdn.microsoft.com/en-us/library/sa69he4t.aspx
- VCXPostBuildEventTool postBuild;
- VCXPreBuildEventTool preBuild;
- VCXPreLinkEventTool preLink;
-};
-
-struct VCXFilterFile
-{
- VCXFilterFile()
- { excludeFromBuild = false; }
- VCXFilterFile(const QString &filename, bool exclude = false )
- { file = filename; excludeFromBuild = exclude; }
- VCXFilterFile(const QString &filename, const QString &additional, bool exclude = false )
- { file = filename; excludeFromBuild = exclude; additionalFile = additional; }
- bool operator==(const VCXFilterFile &other){
- return file == other.file
- && additionalFile == other.additionalFile
- && excludeFromBuild == other.excludeFromBuild;
- }
-
- bool excludeFromBuild;
- QString file;
- QString additionalFile; // For tools like MOC
-};
-
-class VcxprojGenerator;
-class VCXFilter
-{
-public:
- // Functions
- VCXFilter();
- ~VCXFilter(){};
-
- void addFile(const QString& filename);
- void addFile(const VCXFilterFile& fileInfo);
- void addFiles(const QStringList& fileList);
- bool addExtraCompiler(const VCXFilterFile &info);
- void modifyPCHstage(QString str);
- bool outputFileConfig(XmlOutput &xml, XmlOutput &xmlFilter, const QString &filename, const QString &filtername, bool fileAllreadyAdded);
-
- // Variables
- QString Name;
- QString Filter;
- QString Guid;
- triState ParseFiles;
- VcxprojGenerator* Project;
- VCXConfiguration* Config;
- QList<VCXFilterFile> Files;
-
- customBuildCheck CustomBuild;
-
- bool useCustomBuildTool;
- VCXCustomBuildTool CustomBuildTool;
-
- bool useCompilerTool;
- VCXCLCompilerTool CompilerTool;
-};
-
-typedef QList<VCXFilter> VCXFilterList;
-class VCXProjectSingleConfig
-{
-public:
- enum FilterTypes {
- None,
- Source,
- Header,
- Generated,
- LexYacc,
- Translation,
- Resources,
- Extras
- };
- // Functions
- VCXProjectSingleConfig(){};
- ~VCXProjectSingleConfig(){}
-
- // Variables
- QString Name;
- QString Version;
- QString ProjectGUID;
- QString Keyword;
- QString SccProjectName;
- QString SccLocalPath;
- QString PlatformName;
-
- // XML sub-parts
- VCXConfiguration Configuration;
- VCXFilter RootFiles;
- VCXFilter SourceFiles;
- VCXFilter HeaderFiles;
- VCXFilter GeneratedFiles;
- VCXFilter LexYaccFiles;
- VCXFilter TranslationFiles;
- VCXFilter FormFiles;
- VCXFilter ResourceFiles;
- VCXFilterList ExtraCompilersFiles;
-
- bool flat_files;
-
- // Accessor for extracompilers
- VCXFilter &filterForExtraCompiler(const QString &compilerName);
-};
-
-
-
// Tree & Flat view of files --------------------------------------------------
-class VCXFilter;
class XNode
{
public:
virtual ~XNode() { }
- void addElement(const VCXFilterFile &file) {
+ void addElement(const VCFilterFile &file) {
addElement(file.file, file);
}
- virtual void addElement(const QString &filepath, const VCXFilterFile &allInfo) = 0;
+ virtual void addElement(const QString &filepath, const VCFilterFile &allInfo) = 0;
virtual void removeElements()= 0;
- virtual void generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &tagName, VCXProject &tool, const QString &filter) = 0;
+ virtual void generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &tagName, VCProject &tool, const QString &filter) = 0;
virtual bool hasElements() = 0;
};
class XTreeNode : public XNode
{
typedef QMap<QString, XTreeNode*> ChildrenMap;
- VCXFilterFile info;
+ VCFilterFile info;
ChildrenMap children;
public:
@@ -582,7 +87,7 @@ public:
return Uindex;
}
- void addElement(const QString &filepath, const VCXFilterFile &allInfo){
+ void addElement(const QString &filepath, const VCFilterFile &allInfo){
QString newNodeName(filepath);
int index = pathIndex(filepath);
@@ -609,7 +114,7 @@ public:
children.clear();
}
- void generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &tagName, VCXProject &tool, const QString &filter);
+ void generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &tagName, VCProject &tool, const QString &filter);
bool hasElements() {
return children.size() != 0;
}
@@ -617,7 +122,7 @@ public:
class XFlatNode : public XNode
{
- typedef QMap<QString, VCXFilterFile> ChildrenMapFlat;
+ typedef QMap<QString, VCFilterFile> ChildrenMapFlat;
ChildrenMapFlat children;
public:
@@ -633,7 +138,7 @@ public:
return Uindex;
}
- void addElement(const QString &filepath, const VCXFilterFile &allInfo){
+ void addElement(const QString &filepath, const VCFilterFile &allInfo){
QString newKey(filepath);
int index = pathIndex(filepath);
@@ -649,60 +154,39 @@ public:
children.clear();
}
- void generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &tagName, VCXProject &proj, const QString &filter);
+ void generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &tagName, VCProject &proj, const QString &filter);
bool hasElements() {
return children.size() != 0;
}
};
-// ----------------------------------------------------------------------------
-class VCXProject
+class VCXProjectWriter : public VCProjectWriter
{
public:
- // Variables
- QString Name;
- QString Version;
- QString ProjectGUID;
- QString Keyword;
- QString SccProjectName;
- QString SccLocalPath;
- QString PlatformName;
-
- // Single projects
- QList<VCXProjectSingleConfig> SingleProjects;
+ void write(XmlOutput &, VCProjectSingleConfig &);
+ void write(XmlOutput &, VCProject &);
- // List of all extracompilers
- QStringList ExtraCompilers;
+ void write(XmlOutput &, const VCCLCompilerTool &);
+ void write(XmlOutput &, const VCLinkerTool &);
+ void write(XmlOutput &, const VCMIDLTool &);
+ void write(XmlOutput &, const VCCustomBuildTool &);
+ void write(XmlOutput &, const VCLibrarianTool &);
+ void write(XmlOutput &, const VCResourceCompilerTool &);
+ void write(XmlOutput &, const VCEventTool &);
+ void write(XmlOutput &, const VCDeploymentTool &);
+ void write(XmlOutput &, const VCConfiguration &);
+ void write(XmlOutput &, VCFilter &);
- // Functions
- void outputFilter(XmlOutput &xml,
- XmlOutput &xmlFilter,
- const QString &filtername);
-
- void outputFileConfigs(XmlOutput &xml,
- XmlOutput &xmlFilter,
- const VCXFilterFile &info,
- const QString &filtername);
-
- void addFilters(XmlOutput &xmlFilter,
- const QString &filtername);
+private:
+ static void addFilters(VCProject &project, XmlOutput &xmlFilter, const QString &filterName);
+ static void outputFilter(VCProject &project, XmlOutput &xml, XmlOutput &xmlFilter, const QString &filtername);
+ static void outputFileConfigs(VCProject &project, XmlOutput &xml, XmlOutput &xmlFilter, const VCFilterFile &info, const QString &filtername);
+ static bool outputFileConfig(VCFilter &filter, XmlOutput &xml, XmlOutput &xmlFilter, const QString &filename, const QString &filtername, bool fileAllreadyAdded);
+ friend class XTreeNode;
+ friend class XFlatNode;
};
-
-XmlOutput &operator<<(XmlOutput &, const VCXCLCompilerTool &);
-XmlOutput &operator<<(XmlOutput &, const VCXLinkerTool &);
-XmlOutput &operator<<(XmlOutput &, const VCXMIDLTool &);
-XmlOutput &operator<<(XmlOutput &, const VCXCustomBuildTool &);
-XmlOutput &operator<<(XmlOutput &, const VCXLibrarianTool &);
-XmlOutput &operator<<(XmlOutput &, const VCXResourceCompilerTool &);
-XmlOutput &operator<<(XmlOutput &, const VCXEventTool &);
-XmlOutput &operator<<(XmlOutput &, const VCXDeploymentTool &);
-XmlOutput &operator<<(XmlOutput &, const VCXConfiguration &);
-XmlOutput &operator<<(XmlOutput &, const VCXProjectSingleConfig &);
-XmlOutput &operator<<(XmlOutput &, VCXProject &);
-
-
QT_END_NAMESPACE
#endif // MSVC_OBJECTMODEL_H
diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp
index bf86769..c55806d 100644
--- a/qmake/generators/win32/msvc_nmake.cpp
+++ b/qmake/generators/win32/msvc_nmake.cpp
@@ -85,6 +85,45 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t)
return false;
}
+QString NmakeMakefileGenerator::getPdbTarget()
+{
+ return QString(project->first("TARGET") + project->first("TARGET_VERSION_EXT") + ".pdb");
+}
+
+QString NmakeMakefileGenerator::defaultInstall(const QString &t)
+{
+ if((t != "target" && t != "dlltarget") ||
+ (t == "dlltarget" && (project->first("TEMPLATE") != "lib" || !project->isActiveConfig("shared"))) ||
+ project->first("TEMPLATE") == "subdirs")
+ return QString();
+
+ QString ret = Win32MakefileGenerator::defaultInstall(t);
+
+ const QString root = "$(INSTALL_ROOT)";
+ QStringList &uninst = project->values(t + ".uninstall");
+ QString targetdir = Option::fixPathToTargetOS(project->first(t + ".path"), false);
+ targetdir = fileFixify(targetdir, FileFixifyAbsolute);
+ if(targetdir.right(1) != Option::dir_sep)
+ targetdir += Option::dir_sep;
+
+ if(t == "target" && project->first("TEMPLATE") == "lib") {
+ if(project->isActiveConfig("shared") && project->isActiveConfig("debug")) {
+ QString pdb_target = getPdbTarget();
+ pdb_target.remove('"');
+ QString src_targ = (project->isEmpty("DESTDIR") ? QString("$(DESTDIR)") : project->first("DESTDIR")) + pdb_target;
+ QString dst_targ = filePrefixRoot(root, fileFixify(targetdir + pdb_target, FileFixifyAbsolute));
+ if(!ret.isEmpty())
+ ret += "\n\t";
+ ret += QString("-$(INSTALL_FILE)") + " \"" + src_targ + "\" \"" + dst_targ + "\"";
+ if(!uninst.isEmpty())
+ uninst.append("\n\t");
+ uninst.append("-$(DEL_FILE) \"" + dst_targ + "\"");
+ }
+ }
+
+ return ret;
+}
+
QStringList &NmakeMakefileGenerator::findDependencies(const QString &file)
{
QStringList &aList = MakefileGenerator::findDependencies(file);
@@ -129,10 +168,12 @@ QString NmakeMakefileGenerator::var(const QString &value)
p.replace("-c", precompRule);
// Cannot use -Gm with -FI & -Yu, as this gives an
// internal compiler error, on the newer compilers
+ // ### work-around for a VS 2003 bug. Move to some prf file or remove completely.
p.remove("-Gm");
return p;
} else if (value == "QMAKE_CXXFLAGS") {
// Remove internal compiler error option
+ // ### work-around for a VS 2003 bug. Move to some prf file or remove completely.
return MakefileGenerator::var(value).remove("-Gm");
}
}
@@ -177,8 +218,10 @@ void NmakeMakefileGenerator::init()
project->values("QMAKE_LIBS") += escapeFilePaths(project->values("RES_FILE"));
}
- if(!project->values("DEF_FILE").isEmpty())
- project->values("QMAKE_LFLAGS").append(QString("/DEF:") + escapeFilePath(project->first("DEF_FILE")));
+ if (!project->values("DEF_FILE").isEmpty()) {
+ QString defFileName = fileFixify(project->values("DEF_FILE")).first();
+ project->values("QMAKE_LFLAGS").append(QString("/DEF:") + escapeFilePath(defFileName));
+ }
if(!project->values("VERSION").isEmpty()) {
QString version = project->values("VERSION")[0];
diff --git a/qmake/generators/win32/msvc_nmake.h b/qmake/generators/win32/msvc_nmake.h
index 1b74447..8954655 100644
--- a/qmake/generators/win32/msvc_nmake.h
+++ b/qmake/generators/win32/msvc_nmake.h
@@ -57,6 +57,8 @@ class NmakeMakefileGenerator : public Win32MakefileGenerator
void init();
protected:
+ virtual QString getPdbTarget();
+ virtual QString defaultInstall(const QString &t);
virtual QStringList &findDependencies(const QString &file);
QString var(const QString &value);
QString precompH, precompObj, precompPch;
diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp
index 87c8943..815a476 100644
--- a/qmake/generators/win32/msvc_objectmodel.cpp
+++ b/qmake/generators/win32/msvc_objectmodel.cpp
@@ -280,6 +280,14 @@ inline XmlOutput::xml_output attrX(const char *name, const QStringList &v, const
return attr(name, v.join(s));
}
+triState operator!(const triState &rhs)
+{
+ if (rhs == unset)
+ return rhs;
+ triState lhs = (rhs == _True ? _False : _True);
+ return lhs;
+}
+
// VCToolBase -------------------------------------------------
QStringList VCToolBase::fixCommandLine(const QString &input)
{
@@ -294,7 +302,7 @@ static QString vcCommandSeparator()
// As we want every sub-command to be error-checked (as is done by makefile-based
// backends), we insert the checks ourselves, using the undocumented jump target.
static QString cmdSep =
- QLatin1String("&#x000D;&#x000A;if errorlevel 1 goto VCReportError&#x000D;&#x000A;");
+ QLatin1String("&#x000D;&#x000A;if errorlevel 1 goto VCReportError&#x000D;&#x000A;");
return cmdSep;
}
@@ -323,12 +331,14 @@ VCCLCompilerTool::VCCLCompilerTool()
FloatingPointExceptions(unset),
ForceConformanceInForLoopScope(unset),
GeneratePreprocessedFile(preprocessNo),
+ PreprocessSuppressLineNumbers(unset),
GlobalOptimizations(unset),
IgnoreStandardIncludePath(unset),
ImproveFloatingPointConsistency(unset),
InlineFunctionExpansion(expandDefault),
KeepComments(unset),
MinimalRebuild(unset),
+ OmitDefaultLibName(unset),
OmitFramePointers(unset),
OpenMP(unset),
Optimization(optimizeCustom),
@@ -345,12 +355,18 @@ VCCLCompilerTool::VCCLCompilerTool()
TreatWChar_tAsBuiltInType(unset),
TurnOffAssemblyGeneration(unset),
UndefineAllPreprocessorDefinitions(unset),
- UsePrecompiledHeader(pchNone),
+ UsePrecompiledHeader(pchUnset),
+ UseUnicodeForAssemblerListing(unset),
WarnAsError(unset),
WarningLevel(warningLevel_0),
WholeProgramOptimization(unset),
CompileForArchitecture(archUnknown),
- InterworkCalls(unset)
+ InterworkCalls(unset),
+ EnablePREfast(unset),
+ DisplayFullPaths(unset),
+ MultiProcessorCompilation(unset),
+ GenerateXMLDocumentationFiles(unset),
+ CreateHotpatchableImage(unset)
{
}
@@ -373,7 +389,7 @@ inline XmlOutput::xml_output xformUsePrecompiledHeaderForNET2005(pchOption whatP
if (whatPch == pchGenerateAuto) whatPch = (pchOption)0;
if (whatPch == pchUseUsingSpecific) whatPch = (pchOption)2;
}
- return attrE(_UsePrecompiledHeader, whatPch);
+ return attrE(_UsePrecompiledHeader, whatPch, /*ifNot*/ pchUnset);
}
inline XmlOutput::xml_output xformExceptionHandlingNET2005(exceptionHandling eh, DotNET compilerVersion)
@@ -387,82 +403,6 @@ inline XmlOutput::xml_output xformExceptionHandlingNET2005(exceptionHandling eh,
return attrS(_ExceptionHandling, (eh == ehNoSEH ? "true" : "false"));
}
-XmlOutput &operator<<(XmlOutput &xml, const VCCLCompilerTool &tool)
-{
- return xml
- << tag(_Tool)
- << attrS(_Name, _VCCLCompilerTool)
- << attrX(_AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories)
- << attrX(_AdditionalOptions, tool.AdditionalOptions, " ")
- << attrX(_AdditionalUsingDirectories, tool.AdditionalUsingDirectories)
- << attrS(_AssemblerListingLocation, tool.AssemblerListingLocation)
- << attrE(_AssemblerOutput, tool.AssemblerOutput, /*ifNot*/ asmListingNone)
- << attrE(_BasicRuntimeChecks, tool.BasicRuntimeChecks, /*ifNot*/ runtimeBasicCheckNone)
- << attrE(_BrowseInformation, tool.BrowseInformation, /*ifNot*/ brInfoNone)
- << attrS(_BrowseInformationFile, tool.BrowseInformationFile)
- << attrT(_BufferSecurityCheck, tool.BufferSecurityCheck)
- << attrE(_CallingConvention, tool.CallingConvention, /*ifNot*/ callConventionDefault)
- << attrE(_CompileAs, tool.CompileAs, compileAsDefault)
- << attrE(_CompileAsManaged, tool.CompileAsManaged, /*ifNot*/ managedDefault)
- << attrT(_CompileOnly, tool.CompileOnly)
- << attrE(_DebugInformationFormat, tool.DebugInformationFormat, /*ifNot*/ debugUnknown)
- << attrT(_DefaultCharIsUnsigned, tool.DefaultCharIsUnsigned)
- << attrT(_Detect64BitPortabilityProblems, tool.Detect64BitPortabilityProblems)
- << attrT(_DisableLanguageExtensions, tool.DisableLanguageExtensions)
- << attrX(_DisableSpecificWarnings, tool.DisableSpecificWarnings)
- << attrE(_EnableEnhancedInstructionSet, tool.EnableEnhancedInstructionSet, /*ifnot*/ archNotSet)
- << attrT(_EnableFiberSafeOptimizations, tool.EnableFiberSafeOptimizations)
- << attrT(_EnableFunctionLevelLinking, tool.EnableFunctionLevelLinking)
- << attrT(_EnableIntrinsicFunctions, tool.EnableIntrinsicFunctions)
- << xformExceptionHandlingNET2005(tool.ExceptionHandling, tool.config->CompilerVersion)
- << attrT(_ExpandAttributedSource, tool.ExpandAttributedSource)
- << attrE(_FavorSizeOrSpeed, tool.FavorSizeOrSpeed, /*ifNot*/ favorNone)
-
- << attrE(_FloatingPointModel, tool.FloatingPointModel, /*ifNot*/ floatingPointNotSet)
- << attrT(_FloatingPointExceptions, tool.FloatingPointExceptions)
-
- << attrT(_ForceConformanceInForLoopScope, tool.ForceConformanceInForLoopScope)
- << attrX(_ForcedIncludeFiles, tool.ForcedIncludeFiles)
- << attrX(_ForcedUsingFiles, tool.ForcedUsingFiles)
- << attrE(_GeneratePreprocessedFile, tool.GeneratePreprocessedFile, /*ifNot*/ preprocessUnknown)
- << attrT(_GlobalOptimizations, tool.GlobalOptimizations)
- << attrT(_IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath)
- << attrT(_ImproveFloatingPointConsistency, tool.ImproveFloatingPointConsistency)
- << attrE(_InlineFunctionExpansion, tool.InlineFunctionExpansion, /*ifNot*/ expandDefault)
- << attrT(_KeepComments, tool.KeepComments)
- << attrT(_MinimalRebuild, tool.MinimalRebuild)
- << attrS(_ObjectFile, tool.ObjectFile)
- << attrT(_OmitFramePointers, tool.OmitFramePointers)
- << attrT(_OpenMP, tool.OpenMP)
- << attrE(_Optimization, tool.Optimization, /*ifNot*/ optimizeDefault)
- << attrE(_OptimizeForProcessor, tool.OptimizeForProcessor, /*ifNot*/ procOptimizeBlended)
- << attrT(_OptimizeForWindowsApplication, tool.OptimizeForWindowsApplication)
- << attrS(_OutputFile, tool.OutputFile)
- << attrS(_PrecompiledHeaderFile, tool.PrecompiledHeaderFile)
- << attrS(_PrecompiledHeaderThrough, tool.PrecompiledHeaderThrough)
- << attrX(_PreprocessorDefinitions, tool.PreprocessorDefinitions)
- << (tool.ProgramDataBaseFileName.isNull() ? noxml() : attr(_ProgramDataBaseFileName, tool.ProgramDataBaseFileName))
- << attrE(_RuntimeLibrary, tool.RuntimeLibrary, /*ifNot*/ rtUnknown)
- << attrT(_RuntimeTypeInfo, tool.RuntimeTypeInfo)
- << attrT(_ShowIncludes, tool.ShowIncludes)
- << attrT(_SmallerTypeCheck, tool.SmallerTypeCheck)
- << attrT(_StringPooling, tool.StringPooling)
- << attrE(_StructMemberAlignment, tool.StructMemberAlignment, /*ifNot*/ alignNotSet)
- << attrT(_SuppressStartupBanner, tool.SuppressStartupBanner)
- << attrT(_TreatWChar_tAsBuiltInType, tool.TreatWChar_tAsBuiltInType)
- << attrT(_TurnOffAssemblyGeneration, tool.TurnOffAssemblyGeneration)
- << attrT(_UndefineAllPreprocessorDefinitions, tool.UndefineAllPreprocessorDefinitions)
- << attrX(_UndefinePreprocessorDefinitions, tool.UndefinePreprocessorDefinitions)
- << (!tool.PrecompiledHeaderFile.isEmpty() || !tool.PrecompiledHeaderThrough.isEmpty() ? xformUsePrecompiledHeaderForNET2005(tool.UsePrecompiledHeader, tool.config->CompilerVersion) : noxml())
- << attrT(_WarnAsError, tool.WarnAsError)
- << attrE(_WarningLevel, tool.WarningLevel, /*ifNot*/ warningLevelUnknown)
- << attrT(_WholeProgramOptimization, tool.WholeProgramOptimization)
- << attrE(_CompileForArchitecture, tool.CompileForArchitecture, /*ifNot*/ archUnknown)
- << attrT(_InterworkCalls, tool.InterworkCalls)
-
- << closetag(_Tool);
-}
-
bool VCCLCompilerTool::parseOption(const char* option)
{
// skip index 0 ('/' or '-')
@@ -475,6 +415,10 @@ bool VCCLCompilerTool::parseOption(const char* option)
switch (first) {
case '?':
case 'h':
+ if(second == 'o' && third == 't' && fourth == 'p') {
+ CreateHotpatchableImage = _True;
+ break;
+ }
qWarning("Generator: Option '/?', '/help': MSVC.NET projects do not support outputting help info");
found = false;
break;
@@ -500,7 +444,7 @@ bool VCCLCompilerTool::parseOption(const char* option)
break;
case 'E':
if(second == 'H') {
- QString opt(option);
+ QByteArray opt(option + 2);
if (opt.contains('a') && !opt.contains('s') && !opt.contains('c'))
ExceptionHandling = ehSEH;
else if (!opt.contains('a') && opt.contains("s-") && opt.contains("c-"))
@@ -519,6 +463,8 @@ bool VCCLCompilerTool::parseOption(const char* option)
AdditionalOptions += option;
}
break;
+ } else if (second == 'P') {
+ PreprocessSuppressLineNumbers = _True;
}
GeneratePreprocessedFile = preprocessYes;
break;
@@ -535,16 +481,24 @@ bool VCCLCompilerTool::parseOption(const char* option)
AssemblerOutput = asmListingAsmMachineSrc;
} else if(third == 's') {
AssemblerOutput = asmListingAsmSrc;
+ } else if (third == 'u') {
+ UseUnicodeForAssemblerListing = _True;
} else {
AssemblerOutput = asmListingAssemblyOnly;
}
break;
+ case 'C':
+ DisplayFullPaths = _True;
+ break;
case 'a':
AssemblerListingLocation = option+3;
break;
case 'I':
ForcedIncludeFiles += option+3;
break;
+ case 'i':
+ PreprocessOutputPath += option+3;
+ break;
case 'R':
BrowseInformation = brAllInfo;
BrowseInformationFile = option+3;
@@ -616,6 +570,8 @@ bool VCCLCompilerTool::parseOption(const char* option)
break;
case 'S':
BufferSecurityCheck = _True;
+ if(third == '-')
+ BufferSecurityCheck = _False;
break;
case 'T':
EnableFiberSafeOptimizations = _True;
@@ -693,10 +649,14 @@ bool VCCLCompilerTool::parseOption(const char* option)
RuntimeLibrary = rtMultiThreadedDebug;
break;
} else if (second == 'P') {
- if (config->CompilerVersion >= NET2005)
+ if (config->CompilerVersion >= NET2005) {
AdditionalOptions += option;
- else
+ } else if (config->CompilerVersion >= NET2010) {
+ MultiProcessorCompilation = _True;
+ MultiProcessorCompilationProcessorCount = option+3;
+ } else {
warn_msg(WarnLogic, "/MP option is not supported in Visual C++ < 2005, ignoring.");
+ }
break;
}
found = false; break;
@@ -873,7 +833,12 @@ bool VCCLCompilerTool::parseOption(const char* option)
break;
case 'p':
if(third == '6' && fourth == '4') {
- Detect64BitPortabilityProblems = _True;
+ if (config->CompilerVersion >= NET2010) {
+ // Deprecated for VS2010 but can be used under Additional Options.
+ AdditionalOptions += option;
+ } else {
+ Detect64BitPortabilityProblems = _True;
+ }
break;
}
// Fallthrough
@@ -892,11 +857,11 @@ bool VCCLCompilerTool::parseOption(const char* option)
break;
case 'X':
UsePrecompiledHeader = pchGenerateAuto;
- PrecompiledHeaderFile = option+3;
+ PrecompiledHeaderThrough = option+3;
break;
case 'c':
UsePrecompiledHeader = pchCreateUsingSpecific;
- PrecompiledHeaderFile = option+3;
+ PrecompiledHeaderThrough = option+3;
break;
case 'd':
case 'l':
@@ -904,7 +869,7 @@ bool VCCLCompilerTool::parseOption(const char* option)
break;
case 'u':
UsePrecompiledHeader = pchUseUsingSpecific;
- PrecompiledHeaderFile = option+3;
+ PrecompiledHeaderThrough = option+3;
break;
default:
found = false; break;
@@ -925,7 +890,7 @@ bool VCCLCompilerTool::parseOption(const char* option)
DebugInformationFormat = debugEnabled;
break;
case 'l':
- DebugInformationFormat = debugEditAndContinue;
+ OmitDefaultLibName = _True;
break;
case 'a':
DisableLanguageExtensions = _True;
@@ -989,6 +954,9 @@ bool VCCLCompilerTool::parseOption(const char* option)
break;
}
}
+ } else if (second == 'n' && third == 'a' && fourth == 'l') {
+ EnablePREfast = _True;
+ break;
}
found = false;
break;
@@ -1047,10 +1015,34 @@ bool VCCLCompilerTool::parseOption(const char* option)
}
break;
case 'd':
- if(second != 'r') {
- found = false; break;
+ if (second == 'r') {
+ CompileAsManaged = managedAssembly;
+ break;
+ } else if (second != 'o' && third == 'c') {
+ GenerateXMLDocumentationFiles = _True;
+ XMLDocumentationFileName += option+4;
+ break;
}
- CompileAsManaged = managedAssembly;
+ found = false;
+ break;
+ case 'e':
+ if (second == 'r' && third == 'r' && fourth == 'o') {
+ if (option[12] == ':') {
+ if ( option[13] == 'n') {
+ ErrorReporting = "None";
+ } else if (option[13] == 'p') {
+ ErrorReporting = "Prompt";
+ } else if (option[13] == 'q') {
+ ErrorReporting = "Queue";
+ } else if (option[13] == 's') {
+ ErrorReporting = "Send";
+ } else {
+ found = false;
+ }
+ break;
+ }
+ }
+ found = false;
break;
case 'f':
if(second == 'p' && third == ':') {
@@ -1133,7 +1125,8 @@ bool VCCLCompilerTool::parseOption(const char* option)
// VCLinkerTool -----------------------------------------------------
VCLinkerTool::VCLinkerTool()
- : EnableCOMDATFolding(optFoldingDefault),
+ : DataExecutionPrevention(unset),
+ EnableCOMDATFolding(optFoldingDefault),
GenerateDebugInformation(unset),
GenerateMapFile(unset),
HeapCommitSize(-1),
@@ -1149,6 +1142,7 @@ VCLinkerTool::VCLinkerTool()
MapLines(unset),
OptimizeForWindows98(optWin98Default),
OptimizeReferences(optReferencesDefault),
+ RandomizedBaseAddress(unset),
RegisterOutput(unset),
ResourceOnlyDLL(unset),
SetChecksum(unset),
@@ -1162,72 +1156,21 @@ VCLinkerTool::VCLinkerTool()
SwapRunFromNet(unset),
TargetMachine(machineNotSet),
TerminalServerAware(termSvrAwareDefault),
+ TreatWarningsAsErrors(unset),
TurnOffAssemblyGeneration(unset),
- TypeLibraryResourceID(0)
+ TypeLibraryResourceID(0),
+ GenerateManifest(unset),
+ EnableUAC(unset),
+ UACUIAccess(unset),
+ SectionAlignment(-1),
+ PreventDllBinding(unset),
+ AllowIsolation(unset),
+ AssemblyDebug(unset),
+ CLRUnmanagedCodeCheck(unset),
+ DelaySign(unset)
{
}
-XmlOutput &operator<<(XmlOutput &xml, const VCLinkerTool &tool)
-{
- return xml
- << tag(_Tool)
- << attrS(_Name, _VCLinkerTool)
- << attrX(_AdditionalDependencies, tool.AdditionalDependencies, " ")
- << attrX(_AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories)
- << attrX(_AdditionalOptions, tool.AdditionalOptions, " ")
- << attrX(_AddModuleNamesToAssembly, tool.AddModuleNamesToAssembly)
- << attrS(_BaseAddress, tool.BaseAddress)
- << attrX(_DelayLoadDLLs, tool.DelayLoadDLLs)
- << attrE(_EnableCOMDATFolding, tool.EnableCOMDATFolding, /*ifNot*/ optFoldingDefault)
- << attrS(_EntryPointSymbol, tool.EntryPointSymbol)
- << attrX(_ForceSymbolReferences, tool.ForceSymbolReferences)
- << attrS(_FunctionOrder, tool.FunctionOrder)
- << attrT(_GenerateDebugInformation, tool.GenerateDebugInformation)
- << attrT(_GenerateMapFile, tool.GenerateMapFile)
- << attrL(_HeapCommitSize, tool.HeapCommitSize, /*ifNot*/ -1)
- << attrL(_HeapReserveSize, tool.HeapReserveSize, /*ifNot*/ -1)
- << attrT(_IgnoreAllDefaultLibraries, tool.IgnoreAllDefaultLibraries)
- << attrX(_IgnoreDefaultLibraryNames, tool.IgnoreDefaultLibraryNames)
- << attrT(_IgnoreEmbeddedIDL, tool.IgnoreEmbeddedIDL)
- << attrT(_IgnoreImportLibrary, tool.IgnoreImportLibrary)
- << attrS(_ImportLibrary, tool.ImportLibrary)
- << attrE(_LargeAddressAware, tool.LargeAddressAware, /*ifNot*/ addrAwareDefault)
- << attrT(_LinkDLL, tool.LinkDLL)
- << attrE(_LinkIncremental, tool.LinkIncremental, /*ifNot*/ linkIncrementalDefault)
- << attrE(_LinkTimeCodeGeneration, tool.LinkTimeCodeGeneration)
- << attrS(_LinkToManagedResourceFile, tool.LinkToManagedResourceFile)
- << attrT(_MapExports, tool.MapExports)
- << attrS(_MapFileName, tool.MapFileName)
- << attrT(_MapLines, tool.MapLines)
- << attrS(_MergedIDLBaseFileName, tool.MergedIDLBaseFileName)
- << attrS(_MergeSections, tool.MergeSections)
- << attrS(_MidlCommandFile, tool.MidlCommandFile)
- << attrS(_ModuleDefinitionFile, tool.ModuleDefinitionFile)
- << attrE(_OptimizeForWindows98, tool.OptimizeForWindows98, /*ifNot*/ optWin98Default)
- << attrE(_OptimizeReferences, tool.OptimizeReferences, /*ifNot*/ optReferencesDefault)
- << attrS(_OutputFile, tool.OutputFile)
- << attr(_ProgramDatabaseFile, tool.ProgramDatabaseFile)
- << attrT(_RegisterOutput, tool.RegisterOutput)
- << attrT(_ResourceOnlyDLL, tool.ResourceOnlyDLL)
- << attrT(_SetChecksum, tool.SetChecksum)
- << attrE(_ShowProgress, tool.ShowProgress, /*ifNot*/ linkProgressNotSet)
- << attrL(_StackCommitSize, tool.StackCommitSize, /*ifNot*/ -1)
- << attrL(_StackReserveSize, tool.StackReserveSize, /*ifNot*/ -1)
- << attrS(_StripPrivateSymbols, tool.StripPrivateSymbols)
- << attrE(_SubSystem, tool.SubSystem)
- << attrT(_SupportUnloadOfDelayLoadedDLL, tool.SupportUnloadOfDelayLoadedDLL)
- << attrT(_SuppressStartupBanner, tool.SuppressStartupBanner)
- << attrT(_SwapRunFromCD, tool.SwapRunFromCD)
- << attrT(_SwapRunFromNet, tool.SwapRunFromNet)
- << attrE(_TargetMachine, tool.TargetMachine, /*ifNot*/ machineNotSet)
- << attrE(_TerminalServerAware, tool.TerminalServerAware, /*ifNot*/ termSvrAwareDefault)
- << attrT(_TurnOffAssemblyGeneration, tool.TurnOffAssemblyGeneration)
- << attrS(_TypeLibraryFile, tool.TypeLibraryFile)
- << attrL(_TypeLibraryResourceID, tool.TypeLibraryResourceID, /*ifNot*/ rcUseDefault)
- << attrS(_Version, tool.Version)
- << closetag(_Tool);
-}
-
// Hashing routine to do fast option lookups ----
// Slightly rewritten to stop on ':' ',' and '\0'
// Original routine in qtranslator.cpp ----------
@@ -1297,26 +1240,57 @@ bool VCLinkerTool::parseOption(const char* option)
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]
+ const uint optionHash = elfHash(option);
+ if (config->CompilerVersion < NET2010) {
+ switch (optionHash) {
+ case 0x3360dbe: // /ALIGN[:number]
+ case 0x1485c34: // /ALLOWBIND[:NO]
+ case 0x33aec94: // /FIXED[:NO]
+ case 0x7988f7e: // /SECTION:name,[E][R][W][S][D][K][L][P][X][,ALIGN=#]
+ case 0x0348992: // /STUB:filename
+ AdditionalOptions += option;
+ return true;
+ }
+ }
+
+ switch (optionHash) {
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 0x3dc3455: // /IGNORE:number,number,number,number ### NOTE: This one is undocumented, but it is even used by Microsoft.
// In recent versions of the Microsoft linker they have disabled this undocumented feature.
- 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 0x3360dbe: // /ALIGN[:number]
+ SectionAlignment = QString(option+7).toLongLong();
+ break;
+ case 0x1485c34: // /ALLOWBIND[:NO]
+ if(*(option+10) == ':' && (*(option+11) == 'n' || *(option+11) == 'N'))
+ PreventDllBinding = _False;
+ else
+ PreventDllBinding = _True;
+ break;
+ case 0x312011e: // /ALLOWISOLATION[:NO]
+ if(*(option+15) == ':' && (*(option+16) == 'n' || *(option+16) == 'N'))
+ AllowIsolation = _False;
+ else
+ AllowIsolation = _True;
+ break;
case 0x679c075: // /ASSEMBLYMODULE:filename
AddModuleNamesToAssembly += option+15;
break;
+ case 0x75f35f7: // /ASSEMBLYDEBUG[:DISABLE]
+ if(*(option+14) == ':' && (*(option+15) == 'D'))
+ AssemblyDebug = _False;
+ else
+ AssemblyDebug = _True;
+ break;
+ case 0x43294a5: // /ASSEMBLYLINKRESOURCE:filename
+ AssemblyLinkResource += option+22;
+ break;
case 0x062d065: // /ASSEMBLYRESOURCE:filename
LinkToManagedResourceFile = option+18;
break;
@@ -1326,6 +1300,71 @@ bool VCLinkerTool::parseOption(const char* option)
// We don't use it in Qt, so keep it simple for now
BaseAddress = option+6;
break;
+ case 0x63bf065: // /CLRIMAGETYPE:{IJW|PURE|SAFE}
+ if(*(option+14) == 'I')
+ CLRImageType = "ForceIJWImage";
+ else if(*(option+14) == 'P')
+ CLRImageType = "ForcePureILImage";
+ else if(*(option+14) == 'S')
+ CLRImageType = "ForceSafeILImage";
+ break;
+ case 0x5f2a6a2: // /CLRSUPPORTLASTERROR{:NO | SYSTEMDLL}
+ if(*(option+20) == ':') {
+ if(*(option+21) == 'N') {
+ CLRSupportLastError = "Disabled";
+ } else if(*(option+21) == 'S') {
+ CLRSupportLastError = "SystemDlls";
+ }
+ } else {
+ CLRSupportLastError = "Enabled";
+ }
+ break;
+ case 0xc7984f5: // /CLRTHREADATTRIBUTE:{STA|MTA|NONE}
+ if(*(option+20) == 'N')
+ CLRThreadAttribute = "DefaultThreadingAttribute";
+ else if(*(option+20) == 'M')
+ CLRThreadAttribute = "MTAThreadingAttribute";
+ else if(*(option+20) == 'S')
+ CLRThreadAttribute = "STAThreadingAttribute";
+ break;
+ case 0xa8c637b: // /CLRUNMANAGEDCODECHECK[:NO]
+ if(*(option+23) == 'N')
+ CLRUnmanagedCodeCheck = _False;
+ else
+ CLRUnmanagedCodeCheck = _True;
+ break;
+ case 0x62d9e94: // /MANIFEST[:NO]
+ if ((*(option+9) == ':' && (*(option+10) == 'N' || *(option+10) == 'n')))
+ GenerateManifest = _False;
+ else
+ GenerateManifest = _True;
+ break;
+ case 0x8b64559: // /MANIFESTDEPENDENCY:manifest_dependency
+ AdditionalManifestDependencies += option+20;
+ break;
+ case 0xe9e8195: // /MANIFESTFILE:filename
+ ManifestFile = option+14;
+ break;
+ case 0x9e9fb83: // /MANIFESTUAC http://msdn.microsoft.com/en-us/library/bb384691%28VS.100%29.aspx
+ if ((*(option+12) == ':' && (*(option+13) == 'N' || *(option+13) == 'n')))
+ EnableUAC = _False;
+ else if((*(option+12) == ':' && (*(option+13) == 'l' || *(option+14) == 'e'))) { // level
+ if(*(option+20) == 'a')
+ UACExecutionLevel = "AsInvoker";
+ else if(*(option+20) == 'h')
+ UACExecutionLevel = "HighestAvailable";
+ else if(*(option+20) == 'r')
+ UACExecutionLevel = "RequireAdministrator";
+ } else if((*(option+12) == ':' && (*(option+13) == 'u' || *(option+14) == 'i'))) { // uiAccess
+ if(*(option+22) == 't')
+ UACUIAccess = _True;
+ else
+ UACUIAccess = _False;
+ } else if((*(option+12) == ':' && (*(option+13) == 'f' || *(option+14) == 'r'))) { // fragment
+ AdditionalOptions += option;
+ }else
+ EnableUAC = _True;
+ break;
case 0x3389797: // /DEBUG
GenerateDebugInformation = _True;
break;
@@ -1340,12 +1379,36 @@ bool VCLinkerTool::parseOption(const char* option)
case 0x06f4bf4: // /DELAYLOAD:dllname
DelayLoadDLLs += option+11;
break;
+ case 0x06d451e: // /DELAYSIGN[:NO]
+ if(*(option+10) == ':' && (*(option+11) == 'n' || *(option+11) == 'N'))
+ DelaySign = _False;
+ else
+ DelaySign = _True;
+ break;
case 0x003390c: // /DLL
// This option is not used for vcproj files
break;
+ case 0x2ee8415: // /DYNAMICBASE[:NO]
+ if(*(option+12) == ':' && (*(option+13) == 'n' || *(option+13) == 'N'))
+ RandomizedBaseAddress = _False;
+ else
+ RandomizedBaseAddress = _True;
+ break;
case 0x33a3979: // /ENTRY:function
EntryPointSymbol = option+7;
break;
+ case 0x4504334: // /ERRORREPORT:[ NONE | PROMPT | QUEUE | SEND ]
+ if(*(option+12) == ':' ) {
+ if(*(option+13) == 'N')
+ LinkErrorReporting = "NoErrorReport";
+ else if(*(option+13) == 'P')
+ LinkErrorReporting = "PromptImmediately";
+ else if(*(option+13) == 'Q')
+ LinkErrorReporting = "QueueForNextLogin";
+ else if(*(option+13) == 'S')
+ LinkErrorReporting = "SendErrorReport";
+ }
+ break;
case 0x033c960: // /HEAP:reserve[,commit]
{
QStringList both = QString(option+6).split(",");
@@ -1373,6 +1436,12 @@ bool VCLinkerTool::parseOption(const char* option)
else
LinkIncremental = linkIncrementalYes;
break;
+ case 0x07f1ab2: // /KEYCONTAINER:name
+ KeyContainer = option+14;
+ break;
+ case 0xfadaf35: // /KEYFILE:filename
+ KeyFile = option+9;
+ break;
case 0x26e4675: // /LARGEADDRESSAWARE[:no]
if(*(option+18) == ':' &&
*(option+19) == 'n')
@@ -1478,6 +1547,12 @@ bool VCLinkerTool::parseOption(const char* option)
case 0x434138f: // /NOLOGO
SuppressStartupBanner = _True;
break;
+ case 0xc841054: // /NXCOMPAT[:NO]
+ if ((*(option+9) == ':' && (*(option+10) == 'N' || *(option+10) == 'n')))
+ DataExecutionPrevention = _False;
+ else
+ DataExecutionPrevention = _True;
+ break;
case 0x0034454: // /OPT:{REF | NOREF | ICF[=iterations] | NOICF | WIN98 | NOWIN98}
{
char third = *(option+7);
@@ -1555,7 +1630,7 @@ bool VCLinkerTool::parseOption(const char* option)
case 0x5268ea5: // NATIVE
case 0x05547e8: // POSIX
case 0x2949c95: // WINDOWSCE
- case 0x4B69795: // windowsce
+ case 0x4B69795: // windowsce
AdditionalOptions += option;
break;
default:
@@ -1594,6 +1669,16 @@ bool VCLinkerTool::parseOption(const char* option)
case 0xaa77f7e: // /VERSION:major[.minor]
Version = option+9;
break;
+ case 0x0034c50: // /WS[:NO]
+ if (config->CompilerVersion >= NET2010) {
+ if(*(option+3) == ':')
+ TreatWarningsAsErrors = _False;
+ else
+ TreatWarningsAsErrors = _True;
+ } else {
+ AdditionalOptions += option;
+ }
+ break;
default:
AdditionalOptions += option;
break;
@@ -1623,48 +1708,14 @@ VCMIDLTool::VCMIDLTool()
TargetEnvironment(midlTargetNotSet),
ValidateParameters(unset),
WarnAsError(unset),
- WarningLevel(midlWarningLevel_0)
+ WarningLevel(midlWarningLevel_0),
+ ApplicationConfigurationMode(unset),
+ ValidateAllParameters(unset),
+ SuppressCompilerWarnings(unset),
+ LocaleID(-1)
{
}
-XmlOutput &operator<<(XmlOutput &xml, const VCMIDLTool &tool)
-{
- return xml
- << tag(_Tool)
- << attrS(_Name, _VCMIDLTool)
- << attrX(_AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories)
- << attrX(_AdditionalOptions, tool.AdditionalOptions, " ")
- << attrX(_CPreprocessOptions, tool.CPreprocessOptions)
- << attrE(_DefaultCharType, tool.DefaultCharType)
- << attrS(_DLLDataFileName, tool.DLLDataFileName)
- << attrE(_EnableErrorChecks, tool.EnableErrorChecks)
- << attrT(_ErrorCheckAllocations, tool.ErrorCheckAllocations)
- << attrT(_ErrorCheckBounds, tool.ErrorCheckBounds)
- << attrT(_ErrorCheckEnumRange, tool.ErrorCheckEnumRange)
- << attrT(_ErrorCheckRefPointers, tool.ErrorCheckRefPointers)
- << attrT(_ErrorCheckStubData, tool.ErrorCheckStubData)
- << attrX(_FullIncludePath, tool.FullIncludePath)
- << attrT(_GenerateStublessProxies, tool.GenerateStublessProxies)
- << attrT(_GenerateTypeLibrary, tool.GenerateTypeLibrary)
- << attrS(_HeaderFileName, tool.HeaderFileName)
- << attrT(_IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath)
- << attrS(_InterfaceIdentifierFileName, tool.InterfaceIdentifierFileName)
- << attrT(_MkTypLibCompatible, tool.MkTypLibCompatible)
- << attrS(_OutputDirectory, tool.OutputDirectory)
- << attrX(_PreprocessorDefinitions, tool.PreprocessorDefinitions)
- << attrS(_ProxyFileName, tool.ProxyFileName)
- << attrS(_RedirectOutputAndErrors, tool.RedirectOutputAndErrors)
- << attrE(_StructMemberAlignment, tool.StructMemberAlignment, /*ifNot*/ midlAlignNotSet)
- << attrT(_SuppressStartupBanner, tool.SuppressStartupBanner)
- << attrE(_TargetEnvironment, tool.TargetEnvironment, /*ifNot*/ midlTargetNotSet)
- << attrS(_TypeLibraryName, tool.TypeLibraryName)
- << attrX(_UndefinePreprocessorDefinitions, tool.UndefinePreprocessorDefinitions)
- << attrT(_ValidateParameters, tool.ValidateParameters)
- << attrT(_WarnAsError, tool.WarnAsError)
- << attrE(_WarningLevel, tool.WarningLevel)
- << closetag(_Tool);
-}
-
bool VCMIDLTool::parseOption(const char* option)
{
#ifdef USE_DISPLAY_HASH
@@ -1697,7 +1748,25 @@ bool VCMIDLTool::parseOption(const char* option)
#endif
bool found = true;
int offset = 0;
- switch(elfHash(option)) {
+
+ const uint optionHash = elfHash(option);
+
+ if (config->CompilerVersion < NET2010) {
+ switch (optionHash) {
+ case 0x5b1cb97: // /app_config
+ case 0x5a2fc64: // /client {none|stub}
+ case 0x35aabb2: // /cstub filename
+ case 0x64ceb12: // /newtlb
+ case 0x556dbee: // /no_warn
+ case 0x662bb12: // /oldtlb
+ case 0x69c9cf2: // /server {none|stub}
+ case 0x36aabb2: // /sstub filename
+ AdditionalOptions += option;
+ return true;
+ }
+ }
+
+ switch(optionHash) {
case 0x0000334: // /D name[=def]
PreprocessorDefinitions += option+3;
break;
@@ -1734,6 +1803,9 @@ bool VCMIDLTool::parseOption(const char* option)
found = false;
}
break;
+ case 0x5b1cb97: // /app_config
+ ApplicationConfigurationMode = _True;
+ break;
case 0x0359e82: // /char {ascii7|signed|unsigned}
switch(*(option+6)) {
case 'a':
@@ -1749,9 +1821,18 @@ bool VCMIDLTool::parseOption(const char* option)
found = false;
}
break;
+ case 0x5a2fc64: // /client {none|stub}
+ if(*(option+8) == 's')
+ GenerateClientFiles = "Stub";
+ else
+ GenerateClientFiles = "None";
+ break;
case 0xa766524: // /cpp_opt options
CPreprocessOptions += option+9;
break;
+ case 0x35aabb2: // /cstub filename
+ ClientStubFile = option+7;
+ break;
case 0xb32abf1: // /dlldata filename
DLLDataFileName = option + 9;
break;
@@ -1797,18 +1878,30 @@ bool VCMIDLTool::parseOption(const char* option)
case 0x64b7933: // /mktyplib203
MkTypLibCompatible = _True;
break;
+ case 0x64ceb12: // /newtlb
+ TypeLibFormat = "NewFormat";
+ break;
case 0x8e0b0a2: // /no_def_idir
IgnoreStandardIncludePath = _True;
break;
case 0x65635ef: // /nologo
SuppressStartupBanner = _True;
break;
+ case 0x695e9f4: // /no_robust
+ ValidateAllParameters = _False;
+ break;
case 0x3656b22: // /notlb
GenerateTypeLibrary = _True;
break;
+ case 0x556dbee: // /no_warn
+ SuppressCompilerWarnings = _True;
+ break;
case 0x000035f: // /o filename
RedirectOutputAndErrors = option+3;
break;
+ case 0x662bb12: // /oldtlb
+ TypeLibFormat = "OldFormat";
+ break;
case 0x00366c4: // /out directory
OutputDirectory = option+5;
break;
@@ -1824,6 +1917,15 @@ bool VCMIDLTool::parseOption(const char* option)
else
TargetEnvironment = midlTargetWin32;
break;
+ case 0x69c9cf2: // /server {none|stub}
+ if(*(option+8) == 's')
+ GenerateServerFiles = "Stub";
+ else
+ GenerateServerFiles = "None";
+ break;
+ case 0x36aabb2: // /sstub filename
+ ServerStubFile = option+7;
+ break;
case 0x0036b22: // /tlb filename
TypeLibraryName = option+5;
break;
@@ -1838,32 +1940,24 @@ bool VCMIDLTool::parseOption(const char* option)
case 0x0003463: // /Os
case 0x0003513: // /Zs
case 0x0035796: // /acf filename
- case 0x5b1cb97: // /app_config
case 0x3595cf4: // /c_ext
- case 0x5a2fc64: // /client {none|stub}
case 0xa64d3dd: // /confirm
case 0xa765b64: // /cpp_cmd cmd_line
- case 0x35aabb2: // /cstub filename
case 0x03629f4: // /lcid
case 0x6495cc4: // /ms_ext
case 0x96c7a1e: // /ms_union
case 0x4996fa2: // /msc_ver <nnnn>
- case 0x64ceb12: // /newtlb
case 0x6555a40: // /no_cpp
case 0xf64d6a6: // /no_default_epv
case 0x6dd9384: // /no_format_opt
- case 0x556dbee: // /no_warn
case 0x3655a70: // /nocpp
case 0x2b455a3: // /oldnames
- case 0x662bb12: // /oldtlb
case 0x0036696: // /osf
case 0x036679b: // /pack {N}
case 0x678bd38: // /prefix {all|client|server|switch}
case 0x96b702c: // /protocol {all|dce|ndr64}
case 0x3696aa3: // /rpcss
case 0x698ca60: // /savePP
- case 0x69c9cf2: // /server {none|stub}
- case 0x36aabb2: // /sstub filename
case 0xce9b12b: // /syntax_check
case 0xc9b5f16: // /use_epv
AdditionalOptions += option;
@@ -1905,69 +1999,22 @@ VCLibrarianTool::VCLibrarianTool()
{
}
-XmlOutput &operator<<(XmlOutput &xml, const VCLibrarianTool &tool)
-{
- return xml
- << tag(_Tool)
- << attrS(_Name, _VCLibrarianTool)
- << attrX(_AdditionalDependencies, tool.AdditionalDependencies)
- << attrX(_AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories)
- << attrX(_AdditionalOptions, tool.AdditionalOptions, " ")
- << attrX(_ExportNamedFunctions, tool.ExportNamedFunctions)
- << attrX(_ForceSymbolReferences, tool.ForceSymbolReferences)
- << attrT(_IgnoreAllDefaultLibraries, tool.IgnoreAllDefaultLibraries)
- << attrX(_IgnoreDefaultLibraryNames, tool.IgnoreDefaultLibraryNames)
- << attrS(_ModuleDefinitionFile, tool.ModuleDefinitionFile)
- << attrS(_OutputFile, tool.OutputFile)
- << attrT(_SuppressStartupBanner, tool.SuppressStartupBanner)
- << closetag(_Tool);
-}
-
// VCCustomBuildTool ------------------------------------------------
VCCustomBuildTool::VCCustomBuildTool()
{
ToolName = "VCCustomBuildTool";
}
-XmlOutput &operator<<(XmlOutput &xml, const VCCustomBuildTool &tool)
-{
- return xml
- << tag(_Tool)
- << attrS(_Name, tool.ToolName)
- << attrX(_AdditionalDependencies, tool.AdditionalDependencies, ";")
- << attrS(_CommandLine, tool.CommandLine.join(vcCommandSeparator()))
- << attrS(_Description, tool.Description)
- << attrX(_Outputs, tool.Outputs, ";")
- << attrS(_Path, tool.ToolPath)
- << closetag(_Tool);
-}
-
// VCResourceCompilerTool -------------------------------------------
VCResourceCompilerTool::VCResourceCompilerTool()
: Culture(rcUseDefault),
IgnoreStandardIncludePath(unset),
- ShowProgress(linkProgressNotSet)
+ ShowProgress(linkProgressNotSet),
+ SuppressStartupBanner(unset)
{
PreprocessorDefinitions = QStringList("NDEBUG");
}
-XmlOutput &operator<<(XmlOutput &xml, const VCResourceCompilerTool &tool)
-{
- return xml
- << tag(_Tool)
- << attrS(_Name, _VCResourceCompilerTool)
- << attrS(_Path, tool.ToolPath)
- << attrX(_AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories)
- << attrX(_AdditionalOptions, tool.AdditionalOptions, " ")
- << attrE(_Culture, tool.Culture, /*ifNot*/ rcUseDefault)
- << attrX(_FullIncludePath, tool.FullIncludePath)
- << attrT(_IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath)
- << attrX(_PreprocessorDefinitions, tool.PreprocessorDefinitions)
- << attrS(_ResourceOutputFileName, tool.ResourceOutputFileName)
- << attrE(_ShowProgress, tool.ShowProgress, /*ifNot*/ linkProgressNotSet)
- << closetag(_Tool);
-}
-
// VCDeploymentTool --------------------------------------------
VCDeploymentTool::VCDeploymentTool()
: RegisterOutput(registerNo)
@@ -1976,47 +2023,31 @@ VCDeploymentTool::VCDeploymentTool()
RemoteDirectory = "";
}
-XmlOutput &operator<<(XmlOutput &xml, const VCDeploymentTool &tool)
+VCEventTool::VCEventTool(const QString &eventName)
+ : ExcludedFromBuild(unset)
{
- if (tool.AdditionalFiles.isEmpty())
- return xml;
- return xml
- << tag(tool.DeploymentTag)
- << attrS(_RemoteDirectory, tool.RemoteDirectory)
- << attrE(_RegisterOutput, tool.RegisterOutput)
- << attrS(_AdditionalFiles, tool.AdditionalFiles)
- << closetag(tool.DeploymentTag);
-}
-
-// VCEventTool -------------------------------------------------
-XmlOutput &operator<<(XmlOutput &xml, const VCEventTool &tool)
-{
- return xml
- << tag(_Tool)
- << attrS(_Name, tool.ToolName)
- << attrS(_Path, tool.ToolPath)
- << attrS(_CommandLine, tool.CommandLine.join(vcCommandSeparator()))
- << attrS(_Description, tool.Description)
- << attrT(_ExcludedFromBuild, tool.ExcludedFromBuild)
- << closetag(_Tool);
+ EventName = eventName;
+ ToolName = "VC";
+ ToolName += eventName;
+ ToolName += "Tool";
}
// VCPostBuildEventTool ---------------------------------------------
VCPostBuildEventTool::VCPostBuildEventTool()
+ : VCEventTool("PostBuildEvent")
{
- ToolName = "VCPostBuildEventTool";
}
// VCPreBuildEventTool ----------------------------------------------
VCPreBuildEventTool::VCPreBuildEventTool()
+ : VCEventTool("PreBuildEvent")
{
- ToolName = "VCPreBuildEventTool";
}
// VCPreLinkEventTool -----------------------------------------------
VCPreLinkEventTool::VCPreLinkEventTool()
+ : VCEventTool("PreLinkEvent")
{
- ToolName = "VCPreLinkEventTool";
}
// VCConfiguration --------------------------------------------------
@@ -2034,41 +2065,9 @@ VCConfiguration::VCConfiguration()
compiler.config = this;
linker.config = this;
idl.config = this;
+ custom.config = this;
}
-XmlOutput &operator<<(XmlOutput &xml, const VCConfiguration &tool)
-{
- xml << tag(_Configuration)
- << attrS(_Name, tool.Name)
- << attrS(_OutputDirectory, tool.OutputDirectory)
- << attrT(_ATLMinimizesCRunTimeLibraryUsage, tool.ATLMinimizesCRunTimeLibraryUsage)
- << attrT(_BuildBrowserInformation, tool.BuildBrowserInformation)
- << attrE(_CharacterSet, tool.CharacterSet, /*ifNot*/ charSetNotSet)
- << attrE(_ConfigurationType, tool.ConfigurationType)
- << attrS(_DeleteExtensionsOnClean, tool.DeleteExtensionsOnClean)
- << attrS(_ImportLibrary, tool.ImportLibrary)
- << attrS(_IntermediateDirectory, tool.IntermediateDirectory)
- << attrS(_PrimaryOutput, tool.PrimaryOutput)
- << attrS(_ProgramDatabase, tool.ProgramDatabase)
- << attrT(_RegisterOutput, tool.RegisterOutput)
- << attrE(_UseOfATL, tool.UseOfATL, /*ifNot*/ useATLNotSet)
- << attrE(_UseOfMfc, tool.UseOfMfc)
- << attrT(_WholeProgramOptimization, tool.WholeProgramOptimization)
- << tool.compiler
- << tool.custom;
- if (tool.ConfigurationType == typeStaticLibrary)
- xml << tool.librarian;
- else
- xml << tool.linker;
- xml << tool.idl
- << tool.postBuild
- << tool.preBuild
- << tool.preLink
- << tool.resource
- << tool.deployment
- << closetag(_Configuration);
- return xml;
-}
// VCFilter ---------------------------------------------------------
VCFilter::VCFilter()
: ParseFiles(unset),
@@ -2105,7 +2104,7 @@ void VCFilter::modifyPCHstage(QString str)
break;
}
}
- bool isHFile = str.endsWith(".h") && (str == Project->precompH);
+ bool isHFile = Option::hasFileExtension(str, Option::h_ext) && (str == Project->precompH);
bool isCPPFile = pchThroughSourceFile && (str == Project->precompCPP);
if(!isCFile && !isHFile && !isCPPFile)
@@ -2130,7 +2129,9 @@ void VCFilter::modifyPCHstage(QString str)
lines << "*";
lines << "* This file is auto-generated by qmake since no PRECOMPILED_SOURCE was";
lines << "* specified, and is used as the common stdafx.cpp. The file is only";
- lines << "* generated when creating .vcproj project files, and is not used for";
+ lines << QLatin1String("* generated when creating ")
+ + (Config->CompilerVersion < NET2010 ? ".vcproj" : ".vcxproj")
+ + " project files, and is not used for";
lines << "* command line compilations by nmake.";
lines << "*";
lines << "* WARNING: All changes made in this file will be lost.";
@@ -2145,7 +2146,7 @@ void VCFilter::modifyPCHstage(QString str)
useCompilerTool = true;
// Setup PCH options
CompilerTool.UsePrecompiledHeader = (isCFile ? pchNone : pchCreateUsingSpecific);
- CompilerTool.PrecompiledHeaderThrough = (isCPPFile ? QString("$(INHERIT)") : QString("$(NOINHERIT)"));
+ CompilerTool.PrecompiledHeaderThrough = (isCPPFile ? Project->precompHFilename : QString("$(NOINHERIT)"));
CompilerTool.ForcedIncludeFiles = QStringList("$(NOINHERIT)");
}
@@ -2287,7 +2288,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info)
// Output in info.additionalFile -----------
if (!CustomBuildTool.Description.isEmpty())
- CustomBuildTool.Description += " & ";
+ CustomBuildTool.Description += ", ";
CustomBuildTool.Description += cmd_name;
CustomBuildTool.CommandLine += VCToolBase::fixCommandLine(cmd.trimmed());
int space = cmd.indexOf(' ');
@@ -2318,135 +2319,17 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info)
return useCustomBuildTool;
}
-void VCFilter::outputFileConfig(XmlOutput &xml, const QString &filename)
-{
- // Clearing each filter tool
- useCustomBuildTool = false;
- useCompilerTool = false;
- CustomBuildTool = VCCustomBuildTool();
- CompilerTool = VCCLCompilerTool();
-
- // Unset some default options
- CompilerTool.BufferSecurityCheck = unset;
- CompilerTool.DebugInformationFormat = debugUnknown;
- CompilerTool.ExceptionHandling = ehDefault;
- CompilerTool.GeneratePreprocessedFile = preprocessUnknown;
- CompilerTool.Optimization = optimizeDefault;
- CompilerTool.ProgramDataBaseFileName.clear();
- CompilerTool.RuntimeLibrary = rtUnknown;
- CompilerTool.WarningLevel = warningLevelUnknown;
- CompilerTool.config = Config;
-
- bool inBuild = false;
- VCFilterFile info;
- for (int i = 0; i < Files.count(); ++i) {
- if (Files.at(i).file == filename) {
- info = Files.at(i);
- inBuild = true;
- }
- }
- inBuild &= !info.excludeFromBuild;
-
- if (inBuild) {
- addExtraCompiler(info);
- if(Project->usePCH)
- modifyPCHstage(info.file);
- } else {
- // Excluded files uses an empty compiler stage
- if(info.excludeFromBuild)
- useCompilerTool = true;
- }
-
- // Actual XML output ----------------------------------
- if(useCustomBuildTool || useCompilerTool || !inBuild) {
- xml << tag(_FileConfiguration)
- << attr(_Name, (*Config).Name)
- << (!inBuild ? attrS(_ExcludedFromBuild, "true") : noxml());
- if (useCustomBuildTool)
- xml << CustomBuildTool;
- if (useCompilerTool)
- xml << CompilerTool;
- xml << closetag(_FileConfiguration);
- }
-}
-
-XmlOutput &operator<<(XmlOutput &xml, VCFilter &tool)
-{
- if(!tool.Files.count())
- return xml;
-
- if (!tool.Name.isEmpty()) {
- xml << tag(_Filter)
- << attrS(_Name, tool.Name)
- << attrS(_Filter, tool.Filter)
- << attrS(_UniqueIdentifier, tool.Guid)
- << attrT(_ParseFiles, tool.ParseFiles);
- }
- for (int i = 0; i < tool.Files.count(); ++i) {
- const VCFilterFile &info = tool.Files.at(i);
- xml << tag(q_File)
- << attrS(_RelativePath, Option::fixPathToLocalOS(info.file))
- << data(); // In case no custom builds, to avoid "/>" endings
- tool.outputFileConfig(xml, tool.Files.at(i).file);
- xml << closetag(q_File);
- }
- if (!tool.Name.isEmpty())
- xml << closetag(_Filter);
- return xml;
-}
-
// VCProjectSingleConfig --------------------------------------------
-VCFilter nullFilter;
VCFilter& VCProjectSingleConfig::filterForExtraCompiler(const QString &compilerName)
{
for (int i = 0; i < ExtraCompilersFiles.count(); ++i)
if (ExtraCompilersFiles.at(i).Name == compilerName)
return ExtraCompilersFiles[i];
- return nullFilter;
-}
-
-XmlOutput &operator<<(XmlOutput &xml, const VCProjectSingleConfig &tool)
-{
- xml << decl("1.0", "Windows-1252")
- << tag(_VisualStudioProject)
- << attrS(_ProjectType, "Visual C++")
- << attrS(_Version, tool.Version)
- << attrS(_Name, tool.Name)
- << attrS(_ProjectGUID, tool.ProjectGUID)
- << attrS(_Keyword, tool.Keyword)
- << attrS(_SccProjectName, tool.SccProjectName)
- << attrS(_SccLocalPath, tool.SccLocalPath)
- << tag(_Platforms)
- << tag(_Platform)
- << attrS(_Name, tool.PlatformName)
- << closetag(_Platforms)
- << tag(_Configurations)
- << tool.Configuration;
- xml << closetag(_Configurations)
- << tag(q_Files);
- // Add this configuration into a multi-config project, since that's where we have the flat/tree
- // XML output functionality
- VCProject tempProj;
- tempProj.SingleProjects += tool;
- tempProj.outputFilter(xml, "Sources");
- tempProj.outputFilter(xml, "Headers");
- tempProj.outputFilter(xml, "GeneratedFiles");
- tempProj.outputFilter(xml, "LexYaccFiles");
- tempProj.outputFilter(xml, "TranslationFiles");
- tempProj.outputFilter(xml, "FormFiles");
- tempProj.outputFilter(xml, "ResourceFiles");
- for (int x = 0; x < tempProj.ExtraCompilers.count(); ++x) {
- tempProj.outputFilter(xml, tempProj.ExtraCompilers.at(x));
- }
- tempProj.outputFilter(xml, "RootFiles");
- xml << closetag(q_Files)
- << tag(_Globals)
- << data(); // No "/>" end tag
- return xml;
+ static VCFilter nullFilter;
+ return nullFilter;
}
-
// Tree file generation ---------------------------------------------
void TreeNode::generateXML(XmlOutput &xml, const QString &tagName, VCProject &tool, const QString &filter) {
if (children.size()) {
@@ -2470,69 +2353,406 @@ void TreeNode::generateXML(XmlOutput &xml, const QString &tagName, VCProject &to
xml << closetag("Filter");
} else {
// Leaf
- tool.outputFileConfigs(xml, info, filter);
+ VCProjectWriter::outputFileConfigs(tool, xml, info, filter);
}
}
-
// Flat file generation ---------------------------------------------
void FlatNode::generateXML(XmlOutput &xml, const QString &/*tagName*/, VCProject &tool, const QString &filter) {
if (children.size()) {
ChildrenMapFlat::ConstIterator it = children.constBegin();
ChildrenMapFlat::ConstIterator end = children.constEnd();
for (; it != end; ++it) {
- tool.outputFileConfigs(xml, (*it), filter);
+ VCProjectWriter::outputFileConfigs(tool, xml, (*it), filter);
}
}
}
+void VCProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool)
+{
+ xml << decl("1.0", "Windows-1252")
+ << tag(_VisualStudioProject)
+ << attrS(_ProjectType, "Visual C++")
+ << attrS(_Version, tool.Version)
+ << attrS(_Name, tool.Name)
+ << attrS(_ProjectGUID, tool.ProjectGUID)
+ << attrS(_Keyword, tool.Keyword)
+ << attrS(_SccProjectName, tool.SccProjectName)
+ << attrS(_SccLocalPath, tool.SccLocalPath)
+ << tag(_Platforms)
+ << tag(_Platform)
+ << attrS(_Name, tool.PlatformName)
+ << closetag(_Platforms)
+ << tag(_Configurations);
+ write(xml, tool.Configuration);
+ xml << closetag(_Configurations)
+ << tag(q_Files);
+ // Add this configuration into a multi-config project, since that's where we have the flat/tree
+ // XML output functionality
+ VCProject tempProj;
+ tempProj.SingleProjects += tool;
+ outputFilter(tempProj, xml, "Sources");
+ outputFilter(tempProj, xml, "Headers");
+ outputFilter(tempProj, xml, "GeneratedFiles");
+ outputFilter(tempProj, xml, "LexYaccFiles");
+ outputFilter(tempProj, xml, "TranslationFiles");
+ outputFilter(tempProj, xml, "FormFiles");
+ outputFilter(tempProj, xml, "ResourceFiles");
+ for (int x = 0; x < tempProj.ExtraCompilers.count(); ++x) {
+ outputFilter(tempProj, xml, tempProj.ExtraCompilers.at(x));
+ }
+ outputFilter(tempProj, xml, "RootFiles");
+ xml << closetag(q_Files)
+ << tag(_Globals)
+ << data(); // No "/>" end tag
+}
-// VCProject --------------------------------------------------------
-// Output all configurations (by filtername) for a file (by info)
-// A filters config output is in VCFilter.outputFileConfig()
-void VCProject::outputFileConfigs(XmlOutput &xml,
-// VCProjectSingleConfig::FilterTypes type
- const VCFilterFile &info,
- const QString &filtername)
+void VCProjectWriter::write(XmlOutput &xml, VCProject &tool)
{
- xml << tag(q_File)
- << attrS(_RelativePath, Option::fixPathToLocalOS(info.file));
- for (int i = 0; i < SingleProjects.count(); ++i) {
- VCFilter filter;
- if (filtername == "RootFiles") {
- filter = SingleProjects.at(i).RootFiles;
- } else if (filtername == "Sources") {
- filter = SingleProjects.at(i).SourceFiles;
- } else if (filtername == "Headers") {
- filter = SingleProjects.at(i).HeaderFiles;
- } else if (filtername == "GeneratedFiles") {
- filter = SingleProjects.at(i).GeneratedFiles;
- } else if (filtername == "LexYaccFiles") {
- filter = SingleProjects.at(i).LexYaccFiles;
- } else if (filtername == "TranslationFiles") {
- filter = SingleProjects.at(i).TranslationFiles;
- } else if (filtername == "FormFiles") {
- filter = SingleProjects.at(i).FormFiles;
- } else if (filtername == "ResourceFiles") {
- filter = SingleProjects.at(i).ResourceFiles;
- } else {
- // ExtraCompilers
- filter = SingleProjects[i].filterForExtraCompiler(filtername);
- }
+ if (tool.SingleProjects.count() == 0) {
+ warn_msg(WarnLogic, "Generator: .NET: no single project in merge project, no output");
+ return;
+ }
- if (filter.Config) // only if the filter is not empty
- filter.outputFileConfig(xml, info.file);
+ xml << decl("1.0", "Windows-1252")
+ << tag(_VisualStudioProject)
+ << attrS(_ProjectType, "Visual C++")
+ << attrS(_Version, tool.Version)
+ << attrS(_Name, tool.Name)
+ << attrS(_ProjectGUID, tool.ProjectGUID)
+ << attrS(_Keyword, tool.Keyword)
+ << attrS(_SccProjectName, tool.SccProjectName)
+ << attrS(_SccLocalPath, tool.SccLocalPath)
+ << tag(_Platforms)
+ << tag(_Platform)
+ << attrS(_Name, tool.PlatformName)
+ << closetag(_Platforms)
+ << tag(_Configurations);
+ // Output each configuration
+ for (int i = 0; i < tool.SingleProjects.count(); ++i)
+ write(xml, tool.SingleProjects.at(i).Configuration);
+ xml << closetag(_Configurations)
+ << tag(q_Files);
+ outputFilter(tool, xml, "Sources");
+ outputFilter(tool, xml, "Headers");
+ outputFilter(tool, xml, "GeneratedFiles");
+ outputFilter(tool, xml, "LexYaccFiles");
+ outputFilter(tool, xml, "TranslationFiles");
+ outputFilter(tool, xml, "FormFiles");
+ outputFilter(tool, xml, "ResourceFiles");
+ for (int x = 0; x < tool.ExtraCompilers.count(); ++x) {
+ outputFilter(tool, xml, tool.ExtraCompilers.at(x));
}
- xml << closetag(q_File);
+ outputFilter(tool, xml, "RootFiles");
+ xml << closetag(q_Files)
+ << tag(_Globals)
+ << data(); // No "/>" end tag
+}
+
+void VCProjectWriter::write(XmlOutput &xml, const VCCLCompilerTool &tool)
+{
+ xml << tag(_Tool)
+ << attrS(_Name, _VCCLCompilerTool)
+ << attrX(_AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories)
+ << attrX(_AdditionalOptions, tool.AdditionalOptions, " ")
+ << attrX(_AdditionalUsingDirectories, tool.AdditionalUsingDirectories)
+ << attrS(_AssemblerListingLocation, tool.AssemblerListingLocation)
+ << attrE(_AssemblerOutput, tool.AssemblerOutput, /*ifNot*/ asmListingNone)
+ << attrE(_BasicRuntimeChecks, tool.BasicRuntimeChecks, /*ifNot*/ runtimeBasicCheckNone)
+ << attrE(_BrowseInformation, tool.BrowseInformation, /*ifNot*/ brInfoNone)
+ << attrS(_BrowseInformationFile, tool.BrowseInformationFile)
+ << attrT(_BufferSecurityCheck, tool.BufferSecurityCheck)
+ << attrE(_CallingConvention, tool.CallingConvention, /*ifNot*/ callConventionDefault)
+ << attrE(_CompileAs, tool.CompileAs, compileAsDefault)
+ << attrE(_CompileAsManaged, tool.CompileAsManaged, /*ifNot*/ managedDefault)
+ << attrT(_CompileOnly, tool.CompileOnly)
+ << attrE(_DebugInformationFormat, tool.DebugInformationFormat, /*ifNot*/ debugUnknown)
+ << attrT(_DefaultCharIsUnsigned, tool.DefaultCharIsUnsigned)
+ << attrT(_Detect64BitPortabilityProblems, tool.Detect64BitPortabilityProblems)
+ << attrT(_DisableLanguageExtensions, tool.DisableLanguageExtensions)
+ << attrX(_DisableSpecificWarnings, tool.DisableSpecificWarnings)
+ << attrE(_EnableEnhancedInstructionSet, tool.EnableEnhancedInstructionSet, /*ifnot*/ archNotSet)
+ << attrT(_EnableFiberSafeOptimizations, tool.EnableFiberSafeOptimizations)
+ << attrT(_EnableFunctionLevelLinking, tool.EnableFunctionLevelLinking)
+ << attrT(_EnableIntrinsicFunctions, tool.EnableIntrinsicFunctions)
+ << xformExceptionHandlingNET2005(tool.ExceptionHandling, tool.config->CompilerVersion)
+ << attrT(_ExpandAttributedSource, tool.ExpandAttributedSource)
+ << attrE(_FavorSizeOrSpeed, tool.FavorSizeOrSpeed, /*ifNot*/ favorNone)
+
+ << attrE(_FloatingPointModel, tool.FloatingPointModel, /*ifNot*/ floatingPointNotSet)
+ << attrT(_FloatingPointExceptions, tool.FloatingPointExceptions)
+
+ << attrT(_ForceConformanceInForLoopScope, tool.ForceConformanceInForLoopScope)
+ << attrX(_ForcedIncludeFiles, tool.ForcedIncludeFiles)
+ << attrX(_ForcedUsingFiles, tool.ForcedUsingFiles)
+ << attrE(_GeneratePreprocessedFile, tool.GeneratePreprocessedFile, /*ifNot*/ preprocessUnknown)
+ << attrT(_GlobalOptimizations, tool.GlobalOptimizations)
+ << attrT(_IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath)
+ << attrT(_ImproveFloatingPointConsistency, tool.ImproveFloatingPointConsistency)
+ << attrE(_InlineFunctionExpansion, tool.InlineFunctionExpansion, /*ifNot*/ expandDefault)
+ << attrT(_KeepComments, tool.KeepComments)
+ << attrT(_MinimalRebuild, tool.MinimalRebuild)
+ << attrS(_ObjectFile, tool.ObjectFile)
+ << attrT(_OmitFramePointers, tool.OmitFramePointers)
+ << attrT(_OpenMP, tool.OpenMP)
+ << attrE(_Optimization, tool.Optimization, /*ifNot*/ optimizeDefault)
+ << attrE(_OptimizeForProcessor, tool.OptimizeForProcessor, /*ifNot*/ procOptimizeBlended)
+ << attrT(_OptimizeForWindowsApplication, tool.OptimizeForWindowsApplication)
+ << attrS(_OutputFile, tool.OutputFile)
+ << attrS(_PrecompiledHeaderFile, tool.PrecompiledHeaderFile)
+ << attrS(_PrecompiledHeaderThrough, tool.PrecompiledHeaderThrough)
+ << attrX(_PreprocessorDefinitions, tool.PreprocessorDefinitions)
+ << (tool.ProgramDataBaseFileName.isNull() ? noxml() : attr(_ProgramDataBaseFileName, tool.ProgramDataBaseFileName))
+ << attrE(_RuntimeLibrary, tool.RuntimeLibrary, /*ifNot*/ rtUnknown)
+ << attrT(_RuntimeTypeInfo, tool.RuntimeTypeInfo)
+ << attrT(_ShowIncludes, tool.ShowIncludes)
+ << attrT(_SmallerTypeCheck, tool.SmallerTypeCheck)
+ << attrT(_StringPooling, tool.StringPooling)
+ << attrE(_StructMemberAlignment, tool.StructMemberAlignment, /*ifNot*/ alignNotSet)
+ << attrT(_SuppressStartupBanner, tool.SuppressStartupBanner)
+ << attrT(_TreatWChar_tAsBuiltInType, tool.TreatWChar_tAsBuiltInType)
+ << attrT(_TurnOffAssemblyGeneration, tool.TurnOffAssemblyGeneration)
+ << attrT(_UndefineAllPreprocessorDefinitions, tool.UndefineAllPreprocessorDefinitions)
+ << attrX(_UndefinePreprocessorDefinitions, tool.UndefinePreprocessorDefinitions)
+ << xformUsePrecompiledHeaderForNET2005(tool.UsePrecompiledHeader, tool.config->CompilerVersion)
+ << attrT(_WarnAsError, tool.WarnAsError)
+ << attrE(_WarningLevel, tool.WarningLevel, /*ifNot*/ warningLevelUnknown)
+ << attrT(_WholeProgramOptimization, tool.WholeProgramOptimization)
+ << attrE(_CompileForArchitecture, tool.CompileForArchitecture, /*ifNot*/ archUnknown)
+ << attrT(_InterworkCalls, tool.InterworkCalls)
+
+ << closetag(_Tool);
+}
+
+void VCProjectWriter::write(XmlOutput &xml, const VCLinkerTool &tool)
+{
+ xml << tag(_Tool)
+ << attrS(_Name, _VCLinkerTool)
+ << attrX(_AdditionalDependencies, tool.AdditionalDependencies, " ")
+ << attrX(_AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories)
+ << attrX(_AdditionalOptions, tool.AdditionalOptions, " ")
+ << attrX(_AddModuleNamesToAssembly, tool.AddModuleNamesToAssembly)
+ << attrS(_BaseAddress, tool.BaseAddress)
+ << attrX(_DelayLoadDLLs, tool.DelayLoadDLLs)
+ << attrE(_EnableCOMDATFolding, tool.EnableCOMDATFolding, /*ifNot*/ optFoldingDefault)
+ << attrS(_EntryPointSymbol, tool.EntryPointSymbol)
+ << attrX(_ForceSymbolReferences, tool.ForceSymbolReferences)
+ << attrS(_FunctionOrder, tool.FunctionOrder)
+ << attrT(_GenerateDebugInformation, tool.GenerateDebugInformation)
+ << attrT(_GenerateMapFile, tool.GenerateMapFile)
+ << attrL(_HeapCommitSize, tool.HeapCommitSize, /*ifNot*/ -1)
+ << attrL(_HeapReserveSize, tool.HeapReserveSize, /*ifNot*/ -1)
+ << attrT(_IgnoreAllDefaultLibraries, tool.IgnoreAllDefaultLibraries)
+ << attrX(_IgnoreDefaultLibraryNames, tool.IgnoreDefaultLibraryNames)
+ << attrT(_IgnoreEmbeddedIDL, tool.IgnoreEmbeddedIDL)
+ << attrT(_IgnoreImportLibrary, tool.IgnoreImportLibrary)
+ << attrS(_ImportLibrary, tool.ImportLibrary)
+ << attrE(_LargeAddressAware, tool.LargeAddressAware, /*ifNot*/ addrAwareDefault)
+ << attrT(_LinkDLL, tool.LinkDLL)
+ << attrE(_LinkIncremental, tool.LinkIncremental, /*ifNot*/ linkIncrementalDefault)
+ << attrE(_LinkTimeCodeGeneration, tool.LinkTimeCodeGeneration)
+ << attrS(_LinkToManagedResourceFile, tool.LinkToManagedResourceFile)
+ << attrT(_MapExports, tool.MapExports)
+ << attrS(_MapFileName, tool.MapFileName)
+ << attrT(_MapLines, tool.MapLines)
+ << attrS(_MergedIDLBaseFileName, tool.MergedIDLBaseFileName)
+ << attrS(_MergeSections, tool.MergeSections)
+ << attrS(_MidlCommandFile, tool.MidlCommandFile)
+ << attrS(_ModuleDefinitionFile, tool.ModuleDefinitionFile)
+ << attrE(_OptimizeForWindows98, tool.OptimizeForWindows98, /*ifNot*/ optWin98Default)
+ << attrE(_OptimizeReferences, tool.OptimizeReferences, /*ifNot*/ optReferencesDefault)
+ << attrS(_OutputFile, tool.OutputFile)
+ << attr(_ProgramDatabaseFile, tool.ProgramDatabaseFile)
+ << attrT(_RegisterOutput, tool.RegisterOutput)
+ << attrT(_ResourceOnlyDLL, tool.ResourceOnlyDLL)
+ << attrT(_SetChecksum, tool.SetChecksum)
+ << attrE(_ShowProgress, tool.ShowProgress, /*ifNot*/ linkProgressNotSet)
+ << attrL(_StackCommitSize, tool.StackCommitSize, /*ifNot*/ -1)
+ << attrL(_StackReserveSize, tool.StackReserveSize, /*ifNot*/ -1)
+ << attrS(_StripPrivateSymbols, tool.StripPrivateSymbols)
+ << attrE(_SubSystem, tool.SubSystem)
+ << attrT(_SupportUnloadOfDelayLoadedDLL, tool.SupportUnloadOfDelayLoadedDLL)
+ << attrT(_SuppressStartupBanner, tool.SuppressStartupBanner)
+ << attrT(_SwapRunFromCD, tool.SwapRunFromCD)
+ << attrT(_SwapRunFromNet, tool.SwapRunFromNet)
+ << attrE(_TargetMachine, tool.TargetMachine, /*ifNot*/ machineNotSet)
+ << attrE(_TerminalServerAware, tool.TerminalServerAware, /*ifNot*/ termSvrAwareDefault)
+ << attrT(_TurnOffAssemblyGeneration, tool.TurnOffAssemblyGeneration)
+ << attrS(_TypeLibraryFile, tool.TypeLibraryFile)
+ << attrL(_TypeLibraryResourceID, tool.TypeLibraryResourceID, /*ifNot*/ rcUseDefault)
+ << attrS(_Version, tool.Version)
+ << closetag(_Tool);
+}
+
+void VCProjectWriter::write(XmlOutput &xml, const VCMIDLTool &tool)
+{
+ xml << tag(_Tool)
+ << attrS(_Name, _VCMIDLTool)
+ << attrX(_AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories)
+ << attrX(_AdditionalOptions, tool.AdditionalOptions, " ")
+ << attrX(_CPreprocessOptions, tool.CPreprocessOptions)
+ << attrE(_DefaultCharType, tool.DefaultCharType)
+ << attrS(_DLLDataFileName, tool.DLLDataFileName)
+ << attrE(_EnableErrorChecks, tool.EnableErrorChecks)
+ << attrT(_ErrorCheckAllocations, tool.ErrorCheckAllocations)
+ << attrT(_ErrorCheckBounds, tool.ErrorCheckBounds)
+ << attrT(_ErrorCheckEnumRange, tool.ErrorCheckEnumRange)
+ << attrT(_ErrorCheckRefPointers, tool.ErrorCheckRefPointers)
+ << attrT(_ErrorCheckStubData, tool.ErrorCheckStubData)
+ << attrX(_FullIncludePath, tool.FullIncludePath)
+ << attrT(_GenerateStublessProxies, tool.GenerateStublessProxies)
+ << attrT(_GenerateTypeLibrary, tool.GenerateTypeLibrary)
+ << attrS(_HeaderFileName, tool.HeaderFileName)
+ << attrT(_IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath)
+ << attrS(_InterfaceIdentifierFileName, tool.InterfaceIdentifierFileName)
+ << attrT(_MkTypLibCompatible, tool.MkTypLibCompatible)
+ << attrS(_OutputDirectory, tool.OutputDirectory)
+ << attrX(_PreprocessorDefinitions, tool.PreprocessorDefinitions)
+ << attrS(_ProxyFileName, tool.ProxyFileName)
+ << attrS(_RedirectOutputAndErrors, tool.RedirectOutputAndErrors)
+ << attrE(_StructMemberAlignment, tool.StructMemberAlignment, /*ifNot*/ midlAlignNotSet)
+ << attrT(_SuppressStartupBanner, tool.SuppressStartupBanner)
+ << attrE(_TargetEnvironment, tool.TargetEnvironment, /*ifNot*/ midlTargetNotSet)
+ << attrS(_TypeLibraryName, tool.TypeLibraryName)
+ << attrX(_UndefinePreprocessorDefinitions, tool.UndefinePreprocessorDefinitions)
+ << attrT(_ValidateParameters, tool.ValidateParameters)
+ << attrT(_WarnAsError, tool.WarnAsError)
+ << attrE(_WarningLevel, tool.WarningLevel)
+ << closetag(_Tool);
+}
+
+void VCProjectWriter::write(XmlOutput &xml, const VCCustomBuildTool &tool)
+{
+ xml << tag(_Tool)
+ << attrS(_Name, tool.ToolName)
+ << attrX(_AdditionalDependencies, tool.AdditionalDependencies, ";")
+ << attrS(_CommandLine, tool.CommandLine.join(vcCommandSeparator()))
+ << attrS(_Description, tool.Description)
+ << attrX(_Outputs, tool.Outputs, ";")
+ << attrS(_Path, tool.ToolPath)
+ << closetag(_Tool);
+}
+
+void VCProjectWriter::write(XmlOutput &xml, const VCLibrarianTool &tool)
+{
+ xml
+ << tag(_Tool)
+ << attrS(_Name, _VCLibrarianTool)
+ << attrX(_AdditionalDependencies, tool.AdditionalDependencies)
+ << attrX(_AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories)
+ << attrX(_AdditionalOptions, tool.AdditionalOptions, " ")
+ << attrX(_ExportNamedFunctions, tool.ExportNamedFunctions)
+ << attrX(_ForceSymbolReferences, tool.ForceSymbolReferences)
+ << attrT(_IgnoreAllDefaultLibraries, tool.IgnoreAllDefaultLibraries)
+ << attrX(_IgnoreDefaultLibraryNames, tool.IgnoreDefaultLibraryNames)
+ << attrS(_ModuleDefinitionFile, tool.ModuleDefinitionFile)
+ << attrS(_OutputFile, tool.OutputFile)
+ << attrT(_SuppressStartupBanner, tool.SuppressStartupBanner)
+ << closetag(_Tool);
+}
+
+void VCProjectWriter::write(XmlOutput &xml, const VCResourceCompilerTool &tool)
+{
+ xml
+ << tag(_Tool)
+ << attrS(_Name, _VCResourceCompilerTool)
+ << attrS(_Path, tool.ToolPath)
+ << attrX(_AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories)
+ << attrX(_AdditionalOptions, tool.AdditionalOptions, " ")
+ << attrE(_Culture, tool.Culture, /*ifNot*/ rcUseDefault)
+ << attrX(_FullIncludePath, tool.FullIncludePath)
+ << attrT(_IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath)
+ << attrX(_PreprocessorDefinitions, tool.PreprocessorDefinitions)
+ << attrS(_ResourceOutputFileName, tool.ResourceOutputFileName)
+ << attrE(_ShowProgress, tool.ShowProgress, /*ifNot*/ linkProgressNotSet)
+ << closetag(_Tool);
+}
+
+void VCProjectWriter::write(XmlOutput &xml, const VCEventTool &tool)
+{
+ xml
+ << tag(_Tool)
+ << attrS(_Name, tool.ToolName)
+ << attrS(_Path, tool.ToolPath)
+ << attrS(_CommandLine, tool.CommandLine.join(vcCommandSeparator()))
+ << attrS(_Description, tool.Description)
+ << attrT(_ExcludedFromBuild, tool.ExcludedFromBuild)
+ << closetag(_Tool);
+}
+
+void VCProjectWriter::write(XmlOutput &xml, const VCDeploymentTool &tool)
+{
+ if (tool.AdditionalFiles.isEmpty())
+ return;
+ xml << tag(tool.DeploymentTag)
+ << attrS(_RemoteDirectory, tool.RemoteDirectory)
+ << attrE(_RegisterOutput, tool.RegisterOutput)
+ << attrS(_AdditionalFiles, tool.AdditionalFiles)
+ << closetag(tool.DeploymentTag);
+}
+
+void VCProjectWriter::write(XmlOutput &xml, const VCConfiguration &tool)
+{
+ xml << tag(_Configuration)
+ << attrS(_Name, tool.Name)
+ << attrS(_OutputDirectory, tool.OutputDirectory)
+ << attrT(_ATLMinimizesCRunTimeLibraryUsage, tool.ATLMinimizesCRunTimeLibraryUsage)
+ << attrT(_BuildBrowserInformation, tool.BuildBrowserInformation)
+ << attrE(_CharacterSet, tool.CharacterSet, /*ifNot*/ charSetNotSet)
+ << attrE(_ConfigurationType, tool.ConfigurationType)
+ << attrS(_DeleteExtensionsOnClean, tool.DeleteExtensionsOnClean)
+ << attrS(_ImportLibrary, tool.ImportLibrary)
+ << attrS(_IntermediateDirectory, tool.IntermediateDirectory)
+ << attrS(_PrimaryOutput, tool.PrimaryOutput)
+ << attrS(_ProgramDatabase, tool.ProgramDatabase)
+ << attrT(_RegisterOutput, tool.RegisterOutput)
+ << attrE(_UseOfATL, tool.UseOfATL, /*ifNot*/ useATLNotSet)
+ << attrE(_UseOfMfc, tool.UseOfMfc)
+ << attrT(_WholeProgramOptimization, tool.WholeProgramOptimization);
+ write(xml, tool.compiler);
+ write(xml, tool.custom);
+ if (tool.ConfigurationType == typeStaticLibrary)
+ write(xml, tool.librarian);
+ else
+ write(xml, tool.linker);
+ write(xml, tool.idl);
+ write(xml, tool.postBuild);
+ write(xml, tool.preBuild);
+ write(xml, tool.preLink);
+ write(xml, tool.resource);
+ write(xml, tool.deployment);
+ xml << closetag(_Configuration);
+}
+
+void VCProjectWriter::write(XmlOutput &xml, VCFilter &tool)
+{
+ if(!tool.Files.count())
+ return;
+
+ if (!tool.Name.isEmpty()) {
+ xml << tag(_Filter)
+ << attrS(_Name, tool.Name)
+ << attrS(_Filter, tool.Filter)
+ << attrS(_UniqueIdentifier, tool.Guid)
+ << attrT(_ParseFiles, tool.ParseFiles);
+ }
+ for (int i = 0; i < tool.Files.count(); ++i) {
+ const VCFilterFile &info = tool.Files.at(i);
+ xml << tag(q_File)
+ << attrS(_RelativePath, Option::fixPathToLocalOS(info.file))
+ << data(); // In case no custom builds, to avoid "/>" endings
+ outputFileConfig(tool, xml, tool.Files.at(i).file);
+ xml << closetag(q_File);
+ }
+ if (!tool.Name.isEmpty())
+ xml << closetag(_Filter);
}
// outputs a given filter for all existing configurations of a project
-void VCProject::outputFilter(XmlOutput &xml,
-// VCProjectSingleConfig::FilterTypes type
- const QString &filtername)
+void VCProjectWriter::outputFilter(VCProject &project, XmlOutput &xml, const QString &filtername)
{
Node *root;
- if (SingleProjects.at(0).flat_files)
+ if (project.SingleProjects.at(0).flat_files)
root = new FlatNode;
else
root = new TreeNode;
@@ -2540,27 +2760,28 @@ void VCProject::outputFilter(XmlOutput &xml,
QString name, extfilter, guid;
triState parse;
- for (int i = 0; i < SingleProjects.count(); ++i) {
+ for (int i = 0; i < project.SingleProjects.count(); ++i) {
VCFilter filter;
+ const VCProjectSingleConfig &projectSingleConfig = project.SingleProjects.at(i);
if (filtername == "RootFiles") {
- filter = SingleProjects.at(i).RootFiles;
+ filter = projectSingleConfig.RootFiles;
} else if (filtername == "Sources") {
- filter = SingleProjects.at(i).SourceFiles;
+ filter = projectSingleConfig.SourceFiles;
} else if (filtername == "Headers") {
- filter = SingleProjects.at(i).HeaderFiles;
+ filter = projectSingleConfig.HeaderFiles;
} else if (filtername == "GeneratedFiles") {
- filter = SingleProjects.at(i).GeneratedFiles;
+ filter = projectSingleConfig.GeneratedFiles;
} else if (filtername == "LexYaccFiles") {
- filter = SingleProjects.at(i).LexYaccFiles;
+ filter = projectSingleConfig.LexYaccFiles;
} else if (filtername == "TranslationFiles") {
- filter = SingleProjects.at(i).TranslationFiles;
+ filter = projectSingleConfig.TranslationFiles;
} else if (filtername == "FormFiles") {
- filter = SingleProjects.at(i).FormFiles;
+ filter = projectSingleConfig.FormFiles;
} else if (filtername == "ResourceFiles") {
- filter = SingleProjects.at(i).ResourceFiles;
+ filter = projectSingleConfig.ResourceFiles;
} else {
// ExtraCompilers
- filter = SingleProjects[i].filterForExtraCompiler(filtername);
+ filter = project.SingleProjects[i].filterForExtraCompiler(filtername);
}
// Merge all files in this filter to root tree
@@ -2588,52 +2809,98 @@ void VCProject::outputFilter(XmlOutput &xml,
<< attrS(_UniqueIdentifier, guid)
<< attrT(_ParseFiles, parse);
}
- root->generateXML(xml, "", *this, filtername); // output root tree
+ root->generateXML(xml, "", project, filtername); // output root tree
if (!name.isEmpty())
xml << closetag(_Filter);
}
-XmlOutput &operator<<(XmlOutput &xml, VCProject &tool)
+// Output all configurations (by filtername) for a file (by info)
+// A filters config output is in VCFilter.outputFileConfig()
+void VCProjectWriter::outputFileConfigs(VCProject &project, XmlOutput &xml, const VCFilterFile &info, const QString &filtername)
{
- if (tool.SingleProjects.count() == 0) {
- warn_msg(WarnLogic, "Generator: .NET: no single project in merge project, no output");
- return xml;
+ xml << tag(q_File)
+ << attrS(_RelativePath, Option::fixPathToLocalOS(info.file));
+ for (int i = 0; i < project.SingleProjects.count(); ++i) {
+ VCFilter filter;
+ const VCProjectSingleConfig &projectSingleConfig = project.SingleProjects.at(i);
+ if (filtername == "RootFiles") {
+ filter = projectSingleConfig.RootFiles;
+ } else if (filtername == "Sources") {
+ filter = projectSingleConfig.SourceFiles;
+ } else if (filtername == "Headers") {
+ filter = projectSingleConfig.HeaderFiles;
+ } else if (filtername == "GeneratedFiles") {
+ filter = projectSingleConfig.GeneratedFiles;
+ } else if (filtername == "LexYaccFiles") {
+ filter = projectSingleConfig.LexYaccFiles;
+ } else if (filtername == "TranslationFiles") {
+ filter = projectSingleConfig.TranslationFiles;
+ } else if (filtername == "FormFiles") {
+ filter = projectSingleConfig.FormFiles;
+ } else if (filtername == "ResourceFiles") {
+ filter = projectSingleConfig.ResourceFiles;
+ } else {
+ // ExtraCompilers
+ filter = project.SingleProjects[i].filterForExtraCompiler(filtername);
+ }
+
+ if (filter.Config) // only if the filter is not empty
+ outputFileConfig(filter, xml, info.file);
}
+ xml << closetag(q_File);
+}
- xml << decl("1.0", "Windows-1252")
- << tag(_VisualStudioProject)
- << attrS(_ProjectType, "Visual C++")
- << attrS(_Version, tool.Version)
- << attrS(_Name, tool.Name)
- << attrS(_ProjectGUID, tool.ProjectGUID)
- << attrS(_Keyword, tool.Keyword)
- << attrS(_SccProjectName, tool.SccProjectName)
- << attrS(_SccLocalPath, tool.SccLocalPath)
- << tag(_Platforms)
- << tag(_Platform)
- << attrS(_Name, tool.PlatformName)
- << closetag(_Platforms)
- << tag(_Configurations);
- // Output each configuration
- for (int i = 0; i < tool.SingleProjects.count(); ++i)
- xml << tool.SingleProjects.at(i).Configuration;
- xml << closetag(_Configurations)
- << tag(q_Files);
- tool.outputFilter(xml, "Sources");
- tool.outputFilter(xml, "Headers");
- tool.outputFilter(xml, "GeneratedFiles");
- tool.outputFilter(xml, "LexYaccFiles");
- tool.outputFilter(xml, "TranslationFiles");
- tool.outputFilter(xml, "FormFiles");
- tool.outputFilter(xml, "ResourceFiles");
- for (int x = 0; x < tool.ExtraCompilers.count(); ++x) {
- tool.outputFilter(xml, tool.ExtraCompilers.at(x));
+void VCProjectWriter::outputFileConfig(VCFilter &filter, XmlOutput &xml, const QString &filename)
+{
+ // Clearing each filter tool
+ filter.useCustomBuildTool = false;
+ filter.useCompilerTool = false;
+ filter.CustomBuildTool = VCCustomBuildTool();
+ filter.CompilerTool = VCCLCompilerTool();
+
+ // Unset some default options
+ filter.CustomBuildTool.config = filter.Config;
+ filter.CompilerTool.BufferSecurityCheck = unset;
+ filter.CompilerTool.DebugInformationFormat = debugUnknown;
+ filter.CompilerTool.ExceptionHandling = ehDefault;
+ filter.CompilerTool.GeneratePreprocessedFile = preprocessUnknown;
+ filter.CompilerTool.Optimization = optimizeDefault;
+ filter.CompilerTool.ProgramDataBaseFileName.clear();
+ filter.CompilerTool.RuntimeLibrary = rtUnknown;
+ filter.CompilerTool.WarningLevel = warningLevelUnknown;
+ filter.CompilerTool.config = filter.Config;
+
+ bool inBuild = false;
+ VCFilterFile info;
+ for (int i = 0; i < filter.Files.count(); ++i) {
+ if (filter.Files.at(i).file == filename) {
+ info = filter.Files.at(i);
+ inBuild = true;
+ }
+ }
+ inBuild &= !info.excludeFromBuild;
+
+ if (inBuild) {
+ filter.addExtraCompiler(info);
+ if(filter.Project->usePCH)
+ filter.modifyPCHstage(info.file);
+ } else {
+ // Excluded files uses an empty compiler stage
+ if(info.excludeFromBuild)
+ filter.useCompilerTool = true;
+ }
+
+ // Actual XML output ----------------------------------
+ if (filter.useCustomBuildTool || filter.useCompilerTool || !inBuild) {
+ xml << tag(_FileConfiguration)
+ << attr(_Name, filter.Config->Name)
+ << (!inBuild ? attrS(_ExcludedFromBuild, "true") : noxml());
+ if (filter.useCustomBuildTool)
+ filter.Project->projectWriter->write(xml, filter.CustomBuildTool);
+ if (filter.useCompilerTool)
+ filter.Project->projectWriter->write(xml, filter.CompilerTool);
+ xml << closetag(_FileConfiguration);
}
- tool.outputFilter(xml, "RootFiles");
- xml << closetag(q_Files)
- << tag(_Globals)
- << data(); // No "/>" end tag
- return xml;
}
QT_END_NAMESPACE
diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h
index 7d602d9..3e62fb4 100644
--- a/qmake/generators/win32/msvc_objectmodel.h
+++ b/qmake/generators/win32/msvc_objectmodel.h
@@ -86,6 +86,9 @@ enum triState {
_False = 0,
_True = 1
};
+
+triState operator!(const triState &rhs);
+
enum addressAwarenessType {
addrAwareDefault,
addrAwareNoLarge,
@@ -363,6 +366,7 @@ enum optLinkTimeCodeGenType {
optLTCGUpdate
};
enum pchOption {
+ pchUnset = -1,
pchNone,
pchCreateUsingSpecific,
pchGenerateAuto,
@@ -467,7 +471,7 @@ enum warningLevelOption {
class VCToolBase {
protected:
// Functions
- VCToolBase(){};
+ VCToolBase(){}
virtual ~VCToolBase(){}
virtual bool parseOption(const char* option) = 0;
public:
@@ -521,6 +525,7 @@ public:
QStringList ForcedIncludeFiles;
QStringList ForcedUsingFiles;
preprocessOption GeneratePreprocessedFile;
+ triState PreprocessSuppressLineNumbers;
triState GlobalOptimizations;
triState IgnoreStandardIncludePath;
triState ImproveFloatingPointConsistency;
@@ -528,6 +533,7 @@ public:
triState KeepComments;
triState MinimalRebuild;
QString ObjectFile;
+ triState OmitDefaultLibName;
triState OmitFramePointers;
triState OpenMP;
optimizeOption Optimization;
@@ -550,11 +556,24 @@ public:
triState UndefineAllPreprocessorDefinitions;
QStringList UndefinePreprocessorDefinitions;
pchOption UsePrecompiledHeader;
+ triState UseUnicodeForAssemblerListing;
triState WarnAsError;
warningLevelOption WarningLevel;
triState WholeProgramOptimization;
useOfArchitecture CompileForArchitecture;
triState InterworkCalls;
+
+ // VS2010
+ triState EnablePREfast;
+ triState DisplayFullPaths;
+ triState MultiProcessorCompilation;
+ QString MultiProcessorCompilationProcessorCount;
+ triState GenerateXMLDocumentationFiles;
+ QString XMLDocumentationFileName;
+ QString ErrorReporting;
+ triState CreateHotpatchableImage;
+ QString PreprocessOutputPath;
+
VCConfiguration* config;
};
@@ -572,6 +591,7 @@ public:
QStringList AdditionalOptions;
QStringList AddModuleNamesToAssembly;
QString BaseAddress;
+ triState DataExecutionPrevention;
QStringList DelayLoadDLLs;
optFoldingType EnableCOMDATFolding;
QString EntryPointSymbol;
@@ -602,6 +622,7 @@ public:
optRefType OptimizeReferences;
QString OutputFile;
QString ProgramDatabaseFile;
+ triState RandomizedBaseAddress;
triState RegisterOutput;
triState ResourceOnlyDLL;
triState SetChecksum;
@@ -616,10 +637,33 @@ public:
triState SwapRunFromNet;
machineTypeOption TargetMachine;
termSvrAwarenessType TerminalServerAware;
+ triState TreatWarningsAsErrors;
triState TurnOffAssemblyGeneration;
QString TypeLibraryFile;
qlonglong TypeLibraryResourceID;
QString Version;
+
+ // VS2010
+ triState GenerateManifest;
+ QStringList AdditionalManifestDependencies;
+ QString ManifestFile;
+ triState EnableUAC;
+ QString UACExecutionLevel;
+ triState UACUIAccess;
+ qlonglong SectionAlignment;
+ triState PreventDllBinding;
+ triState AllowIsolation;
+ triState AssemblyDebug;
+ QStringList AssemblyLinkResource;
+ QString CLRImageType;
+ QString CLRSupportLastError;
+ QString CLRThreadAttribute;
+ triState CLRUnmanagedCodeCheck;
+ triState DelaySign;
+ QString KeyContainer;
+ QString KeyFile;
+ QString LinkErrorReporting;
+
VCConfiguration* config;
};
@@ -662,6 +706,18 @@ public:
triState ValidateParameters;
triState WarnAsError;
midlWarningLevelOption WarningLevel;
+
+ // VS 2010
+ triState ApplicationConfigurationMode;
+ QString GenerateClientFiles;
+ QString ClientStubFile;
+ QString TypeLibFormat;
+ triState ValidateAllParameters;
+ triState SuppressCompilerWarnings;
+ QString GenerateServerFiles;
+ QString ServerStubFile;
+ qlonglong LocaleID;
+
VCConfiguration* config;
};
@@ -671,7 +727,7 @@ public:
// Functions
VCLibrarianTool();
virtual ~VCLibrarianTool(){}
- bool parseOption(const char*){ return false; };
+ bool parseOption(const char*){ return false; }
// Variables
QStringList AdditionalDependencies;
@@ -692,7 +748,7 @@ public:
// Functions
VCCustomBuildTool();
virtual ~VCCustomBuildTool(){}
- bool parseOption(const char*){ return false; };
+ bool parseOption(const char*){ return false; }
// Variables
QStringList AdditionalDependencies;
@@ -701,6 +757,8 @@ public:
QStringList Outputs;
QString ToolName;
QString ToolPath;
+
+ VCConfiguration* config;
};
class VCResourceCompilerTool : public VCToolBase
@@ -709,7 +767,7 @@ public:
// Functions
VCResourceCompilerTool();
virtual ~VCResourceCompilerTool(){}
- bool parseOption(const char*){ return false; };
+ bool parseOption(const char*){ return false; }
// Variables
QStringList AdditionalIncludeDirectories;
@@ -721,6 +779,7 @@ public:
QString ResourceOutputFileName;
linkProgressOption ShowProgress;
QString ToolPath;
+ triState SuppressStartupBanner;
};
class VCDeploymentTool
@@ -741,15 +800,16 @@ class VCEventTool : public VCToolBase
{
protected:
// Functions
- VCEventTool() : ExcludedFromBuild(unset){};
+ VCEventTool(const QString &eventName);
virtual ~VCEventTool(){}
- bool parseOption(const char*){ return false; };
+ bool parseOption(const char*){ return false; }
public:
// Variables
QStringList CommandLine;
QString Description;
triState ExcludedFromBuild;
+ QString EventName;
QString ToolName;
QString ToolPath;
};
@@ -792,7 +852,8 @@ public:
QString DeleteExtensionsOnClean;
QString ImportLibrary;
QString IntermediateDirectory;
- QString Name;
+ QString Name; // "ConfigurationName|PlatformName"
+ QString ConfigurationName;
QString OutputDirectory;
QString PrimaryOutput;
QString ProgramDatabase;
@@ -849,14 +910,13 @@ class VCFilter
public:
// Functions
VCFilter();
- ~VCFilter(){};
+ ~VCFilter(){}
void addFile(const QString& filename);
void addFile(const VCFilterFile& fileInfo);
void addFiles(const QStringList& fileList);
bool addExtraCompiler(const VCFilterFile &info);
void modifyPCHstage(QString str);
- void outputFileConfig(XmlOutput &xml, const QString &filename);
// Variables
QString Name;
@@ -874,9 +934,6 @@ public:
bool useCompilerTool;
VCCLCompilerTool CompilerTool;
-
-private:
- friend XmlOutput &operator<<(XmlOutput &xml, VCFilter &tool);
};
typedef QList<VCFilter> VCFilterList;
@@ -894,7 +951,7 @@ public:
Extras
};
// Functions
- VCProjectSingleConfig(){};
+ VCProjectSingleConfig(){}
~VCProjectSingleConfig(){}
// Variables
@@ -924,8 +981,6 @@ public:
VCFilter &filterForExtraCompiler(const QString &compilerName);
};
-
-
// Tree & Flat view of files --------------------------------------------------
class VCFilter;
class Node
@@ -1051,30 +1106,35 @@ public:
// List of all extracompilers
QStringList ExtraCompilers;
+};
- // Functions
- void outputFilter(XmlOutput &xml,
-// VCProjectSingleConfig::FilterTypes type,
- const QString &filtername);
-
- void outputFileConfigs(XmlOutput &xml,
-// VCProjectSingleConfig::FilterTypes type,
- const VCFilterFile &info,
- const QString &filtername);
-};
-
-XmlOutput &operator<<(XmlOutput &, const VCCLCompilerTool &);
-XmlOutput &operator<<(XmlOutput &, const VCLinkerTool &);
-XmlOutput &operator<<(XmlOutput &, const VCMIDLTool &);
-XmlOutput &operator<<(XmlOutput &, const VCCustomBuildTool &);
-XmlOutput &operator<<(XmlOutput &, const VCLibrarianTool &);
-XmlOutput &operator<<(XmlOutput &, const VCResourceCompilerTool &);
-XmlOutput &operator<<(XmlOutput &, const VCEventTool &);
-XmlOutput &operator<<(XmlOutput &, const VCDeploymentTool &);
-XmlOutput &operator<<(XmlOutput &, const VCConfiguration &);
-XmlOutput &operator<<(XmlOutput &, VCFilter &);
-XmlOutput &operator<<(XmlOutput &, const VCProjectSingleConfig &);
-XmlOutput &operator<<(XmlOutput &, VCProject &);
+class VCProjectWriter
+{
+public:
+ virtual ~VCProjectWriter() {}
+
+ virtual void write(XmlOutput &, VCProjectSingleConfig &);
+ virtual void write(XmlOutput &, VCProject &);
+
+ virtual void write(XmlOutput &, const VCCLCompilerTool &);
+ virtual void write(XmlOutput &, const VCLinkerTool &);
+ virtual void write(XmlOutput &, const VCMIDLTool &);
+ virtual void write(XmlOutput &, const VCCustomBuildTool &);
+ virtual void write(XmlOutput &, const VCLibrarianTool &);
+ virtual void write(XmlOutput &, const VCResourceCompilerTool &);
+ virtual void write(XmlOutput &, const VCEventTool &);
+ virtual void write(XmlOutput &, const VCDeploymentTool &);
+ virtual void write(XmlOutput &, const VCConfiguration &);
+ virtual void write(XmlOutput &, VCFilter &);
+
+private:
+ static void outputFilter(VCProject &project, XmlOutput &xml, const QString &filtername);
+ static void outputFileConfigs(VCProject &project, XmlOutput &xml, const VCFilterFile &info, const QString &filtername);
+ static void outputFileConfig(VCFilter &filter, XmlOutput &xml, const QString &filename);
+
+ friend class TreeNode;
+ friend class FlatNode;
+};
QT_END_NAMESPACE
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index 364eca0..80f5bde 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.cpp
@@ -51,7 +51,6 @@
#include <stdlib.h>
//#define DEBUG_SOLUTION_GEN
-//#define DEBUG_PROJECT_GEN
QT_BEGIN_NAMESPACE
// Filter GUIDs (Do NOT change these!) ------------------------------
@@ -206,9 +205,18 @@ const char _slnExtSections[] = "\n\tGlobalSection(ExtensibilityGlobals) = pos
"\n\tEndGlobalSection";
// ------------------------------------------------------------------
-VcprojGenerator::VcprojGenerator() : Win32MakefileGenerator(), init_flag(false)
+VcprojGenerator::VcprojGenerator()
+ : Win32MakefileGenerator(),
+ init_flag(false),
+ projectWriter(0)
{
}
+
+VcprojGenerator::~VcprojGenerator()
+{
+ delete projectWriter;
+}
+
bool VcprojGenerator::writeMakefile(QTextStream &t)
{
initProject(); // Fills the whole project with proper data
@@ -229,7 +237,7 @@ bool VcprojGenerator::writeMakefile(QTextStream &t)
if(!project->isActiveConfig("build_pass")) {
debug_msg(1, "Generator: MSVC.NET: Writing single configuration project file");
XmlOutput xmlOut(t);
- xmlOut << vcProject;
+ projectWriter->write(xmlOut, vcProject);
}
return true;
}
@@ -272,7 +280,7 @@ bool VcprojGenerator::writeProjectMakefile()
mergedProjects.at(0)->vcProject.Name ==
mergedProjects.at(1)->vcProject.Name)
mergedProjects.at(0)->writePrlFile();
- mergedProject.Name = unescapeFilePath(project->first("QMAKE_ORIG_TARGET"));
+ mergedProject.Name = project->first("QMAKE_PROJECT_NAME");
mergedProject.Version = mergedProjects.at(0)->vcProject.Version;
mergedProject.ProjectGUID = project->isEmpty("QMAKE_UUID") ? getProjectUUID().toString().toUpper() : project->first("QMAKE_UUID");
mergedProject.Keyword = project->first("VCPROJ_KEYWORD");
@@ -281,7 +289,7 @@ bool VcprojGenerator::writeProjectMakefile()
mergedProject.PlatformName = mergedProjects.at(0)->vcProject.PlatformName;
XmlOutput xmlOut(t);
- xmlOut << mergedProject;
+ projectWriter->write(xmlOut, mergedProject);
return true;
} else if(project->first("TEMPLATE") == "vcsubdirs") {
return writeMakefile(t);
@@ -451,6 +459,7 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
tmp_vcproj.setProjectFile(&tmp_proj);
Option::qmake_mode = old_mode;
if(Option::debug_level) {
+ debug_msg(1, "Dumping all variables:");
QMap<QString, QStringList> &vars = tmp_proj.variables();
for(QMap<QString, QStringList>::Iterator it = vars.begin();
it != vars.end(); ++it) {
@@ -460,8 +469,8 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
}
}
- // We assume project filename is [QMAKE_ORIG_TARGET].vcproj
- QString vcproj = unescapeFilePath(tmp_vcproj.project->first("QMAKE_ORIG_TARGET") + project->first("VCPROJ_EXTENSION"));
+ // We assume project filename is [QMAKE_PROJECT_NAME].vcproj
+ QString vcproj = unescapeFilePath(tmp_vcproj.project->first("QMAKE_PROJECT_NAME") + project->first("VCPROJ_EXTENSION"));
QString vcprojDir = qmake_getpwd();
// If file doesn't exsist, then maybe the users configuration
@@ -649,12 +658,13 @@ bool VcprojGenerator::hasBuiltinCompiler(const QString &file)
void VcprojGenerator::init()
{
- if(init_flag)
+ if (init_flag)
return;
- if(project->first("TEMPLATE") == "vcsubdirs") { //too much work for subdirs
- init_flag = true;
+ init_flag = true;
+ projectWriter = createProjectWriter();
+
+ if(project->first("TEMPLATE") == "vcsubdirs") //too much work for subdirs
return;
- }
debug_msg(1, "Generator: MSVC.NET: Initializing variables");
@@ -667,6 +677,20 @@ void VcprojGenerator::init()
project->values("QMAKESPEC").append(qgetenv("QMAKESPEC"));
processVars();
+
+ project->values("QMAKE_LIBS") += escapeFilePaths(project->values("LIBS"));
+ project->values("QMAKE_LIBS_PRIVATE") += escapeFilePaths(project->values("LIBS_PRIVATE"));
+
+ if(!project->values("VERSION").isEmpty()) {
+ QString version = project->values("VERSION")[0];
+ int firstDot = version.indexOf(".");
+ QString major = version.left(firstDot);
+ QString minor = version.right(version.length() - firstDot - 1);
+ minor.replace(QRegExp("\\."), "");
+ project->values("QMAKE_LFLAGS").append("/VERSION:" + major + "." + minor);
+ }
+
+ MakefileGenerator::init();
initOld(); // Currently calling old DSP code to set variables. CLEAN UP!
// Figure out what we're trying to build
@@ -749,11 +773,16 @@ void VcprojGenerator::init()
bool VcprojGenerator::mergeBuildProject(MakefileGenerator *other)
{
- VcprojGenerator *otherVC = static_cast<VcprojGenerator*>(other);
- if (!otherVC) {
+ if (!other || !other->projectFile()) {
+ warn_msg(WarnLogic, "VcprojGenerator: Cannot merge null project.");
+ return false;
+ }
+ if (other->projectFile()->first("MAKEFILE_GENERATOR") != project->first("MAKEFILE_GENERATOR")) {
warn_msg(WarnLogic, "VcprojGenerator: Cannot merge other types of projects! (ignored)");
return false;
}
+
+ VcprojGenerator *otherVC = static_cast<VcprojGenerator*>(other);
mergedProjects += otherVC;
return true;
}
@@ -777,6 +806,9 @@ void VcprojGenerator::initProject()
// Own elements -----------------------------
vcProject.Name = unescapeFilePath(project->first("QMAKE_ORIG_TARGET"));
switch(which_dotnet_version()) {
+ case NET2010:
+ vcProject.Version = "10.00";
+ break;
case NET2008:
vcProject.Version = "9,00";
break;
@@ -846,9 +878,22 @@ void VcprojGenerator::initConfiguration()
break;
}
+ conf.OutputDirectory = project->first("DESTDIR");
+ if (conf.OutputDirectory.isEmpty())
+ conf.OutputDirectory = ".\\";
+ if (!conf.OutputDirectory.endsWith("\\"))
+ conf.OutputDirectory += '\\';
+ if (conf.CompilerVersion >= NET2010) {
+ // The target name could have been changed.
+ conf.PrimaryOutput = project->first("TARGET");
+ if ( !conf.PrimaryOutput.isEmpty() && !project->first("TARGET_VERSION_EXT").isEmpty() && project->isActiveConfig("shared"))
+ conf.PrimaryOutput.append(project->first("TARGET_VERSION_EXT"));
+ }
+
conf.Name = project->values("BUILD_NAME").join(" ");
if (conf.Name.isEmpty())
conf.Name = isDebug ? "Debug" : "Release";
+ conf.ConfigurationName = conf.Name;
if (project->isEmpty("CE_SDK") || project->isEmpty("CE_ARCH")) {
conf.Name += (conf.idl.TargetEnvironment == midlTargetWin64 ? "|Win64" : "|Win32");
} else {
@@ -861,8 +906,6 @@ void VcprojGenerator::initConfiguration()
conf.DeleteExtensionsOnClean = project->first("DeleteExtensionsOnClean");
conf.ImportLibrary = conf.linker.ImportLibrary;
conf.IntermediateDirectory = project->first("OBJECTS_DIR");
- conf.OutputDirectory = ".";
- conf.PrimaryOutput = project->first("PrimaryOutput");
conf.WholeProgramOptimization = conf.compiler.WholeProgramOptimization;
temp = project->first("UseOfATL");
if(!temp.isEmpty())
@@ -887,7 +930,6 @@ void VcprojGenerator::initConfiguration()
} else {
conf.compiler.PreprocessorDefinitions += "NDEBUG";
}
-
}
void VcprojGenerator::initCompilerTool()
@@ -907,39 +949,24 @@ void VcprojGenerator::initCompilerTool()
conf.compiler.PrecompiledHeaderFile = "$(IntDir)\\" + precompPch;
conf.compiler.PrecompiledHeaderThrough = project->first("PRECOMPILED_HEADER");
conf.compiler.ForcedIncludeFiles = project->values("PRECOMPILED_HEADER");
- // Minimal build option triggers an Internal Compiler Error
- // when used in conjunction with /FI and /Yu, so remove it
- project->values("QMAKE_CFLAGS_DEBUG").removeAll("-Gm");
- project->values("QMAKE_CFLAGS_DEBUG").removeAll("/Gm");
- project->values("QMAKE_CXXFLAGS_DEBUG").removeAll("-Gm");
- project->values("QMAKE_CXXFLAGS_DEBUG").removeAll("/Gm");
- }
- conf.compiler.parseOptions(project->values("QMAKE_CXXFLAGS"));
- if(project->isActiveConfig("debug")){
- // Debug version
- if((projectTarget == Application) || (projectTarget == StaticLib))
- conf.compiler.parseOptions(project->values("QMAKE_CXXFLAGS_MT_DBG"));
- else
- conf.compiler.parseOptions(project->values("QMAKE_CXXFLAGS_MT_DLLDBG"));
- } else {
- // Release version
- conf.compiler.PreprocessorDefinitions += "QT_NO_DEBUG";
- conf.compiler.PreprocessorDefinitions += "NDEBUG";
- if((projectTarget == Application) || (projectTarget == StaticLib))
- conf.compiler.parseOptions(project->values("QMAKE_CXXFLAGS_MT"));
- else
- conf.compiler.parseOptions(project->values("QMAKE_CXXFLAGS_MT_DLL"));
+ if (conf.CompilerVersion <= NET2003) {
+ // Minimal build option triggers an Internal Compiler Error
+ // when used in conjunction with /FI and /Yu, so remove it
+ // ### work-around for a VS 2003 bug. Move to some prf file or remove completely.
+ project->values("QMAKE_CFLAGS_DEBUG").removeAll("-Gm");
+ project->values("QMAKE_CFLAGS_DEBUG").removeAll("/Gm");
+ project->values("QMAKE_CXXFLAGS_DEBUG").removeAll("-Gm");
+ project->values("QMAKE_CXXFLAGS_DEBUG").removeAll("/Gm");
+ }
}
- // Common for both release and debug
- if(project->isActiveConfig("windows"))
- conf.compiler.PreprocessorDefinitions += project->values("MSVCPROJ_WINCONDEF");
+ conf.compiler.parseOptions(project->values("QMAKE_CXXFLAGS"));
- // Can this be set for ALL configs?
- // If so, use qmake.conf!
- if(projectTarget == SharedLib)
+ if (project->isActiveConfig("windows"))
conf.compiler.PreprocessorDefinitions += "_WINDOWS";
+ else if (project->isActiveConfig("console"))
+ conf.compiler.PreprocessorDefinitions += "_CONSOLE";
conf.compiler.PreprocessorDefinitions += project->values("DEFINES");
conf.compiler.PreprocessorDefinitions += project->values("PRL_EXPORT_DEFINES");
@@ -949,13 +976,7 @@ void VcprojGenerator::initCompilerTool()
void VcprojGenerator::initLibrarianTool()
{
VCConfiguration &conf = vcProject.Configuration;
- conf.librarian.OutputFile = project->first("DESTDIR");
- if(conf.librarian.OutputFile.isEmpty())
- conf.librarian.OutputFile = ".\\";
-
- if(!conf.librarian.OutputFile.endsWith("\\"))
- conf.librarian.OutputFile += '\\';
-
+ conf.librarian.OutputFile = "$(OutDir)\\";
conf.librarian.OutputFile += project->first("MSVCPROJ_TARGET");
conf.librarian.AdditionalOptions += project->values("QMAKE_LIBFLAGS");
}
@@ -964,7 +985,17 @@ void VcprojGenerator::initLinkerTool()
{
findLibraries(); // Need to add the highest version of the libs
VCConfiguration &conf = vcProject.Configuration;
- conf.linker.parseOptions(project->values("MSVCPROJ_LFLAGS"));
+ conf.linker.parseOptions(project->values("QMAKE_LFLAGS"));
+
+ foreach (const QString &libDir, project->values("QMAKE_LIBDIR")) {
+ if (libDir.startsWith("/LIBPATH:"))
+ conf.linker.AdditionalLibraryDirectories += libDir.mid(9);
+ else
+ conf.linker.AdditionalLibraryDirectories += libDir;
+ }
+
+ if (!project->values("DEF_FILE").isEmpty())
+ conf.linker.ModuleDefinitionFile = project->first("DEF_FILE");
foreach(QString libs, project->values("MSVCPROJ_LIBS")) {
if (libs.left(9).toUpper() == "/LIBPATH:") {
@@ -975,24 +1006,7 @@ void VcprojGenerator::initLinkerTool()
}
}
- switch (projectTarget) {
- case Application:
- conf.linker.OutputFile = project->first("DESTDIR");
- break;
- case SharedLib:
- conf.linker.parseOptions(project->values("MSVCPROJ_LIBOPTIONS"));
- conf.linker.OutputFile = project->first("DESTDIR");
- break;
- case StaticLib: //unhandled - added to remove warnings..
- break;
- }
-
- if(conf.linker.OutputFile.isEmpty())
- conf.linker.OutputFile = ".\\";
-
- if(!conf.linker.OutputFile.endsWith("\\"))
- conf.linker.OutputFile += '\\';
-
+ conf.linker.OutputFile = "$(OutDir)\\";
conf.linker.OutputFile += project->first("MSVCPROJ_TARGET");
if(project->isActiveConfig("dll")){
@@ -1011,10 +1025,9 @@ void VcprojGenerator::initResourceTool()
if(project->isActiveConfig("debug"))
conf.resource.PreprocessorDefinitions += "_DEBUG";
if(project->isActiveConfig("staticlib"))
- conf.resource.ResourceOutputFileName = project->first("DESTDIR") + "/$(InputName).res";
+ conf.resource.ResourceOutputFileName = "$(OutDir)\\$(InputName).res";
}
-
void VcprojGenerator::initIDLTool()
{
}
@@ -1030,22 +1043,26 @@ void VcprojGenerator::initPreBuildEventTools()
void VcprojGenerator::initPostBuildEventTools()
{
VCConfiguration &conf = vcProject.Configuration;
- if(!project->values("QMAKE_POST_LINK").isEmpty()) {
+ if (!project->values("QMAKE_POST_LINK").isEmpty()) {
QStringList cmdline = VCToolBase::fixCommandLine(var("QMAKE_POST_LINK"));
conf.postBuild.CommandLine = cmdline;
conf.postBuild.Description = cmdline.join(QLatin1String("\r\n"));
+ conf.postBuild.ExcludedFromBuild = _False;
}
QString signature = !project->isEmpty("SIGNATURE_FILE") ? var("SIGNATURE_FILE") : var("DEFAULT_SIGNATURE");
bool useSignature = !signature.isEmpty() && !project->isActiveConfig("staticlib") &&
!project->isEmpty("CE_SDK") && !project->isEmpty("CE_ARCH");
- if(useSignature)
+ if (useSignature) {
conf.postBuild.CommandLine.prepend(
QLatin1String("signtool sign /F ") + signature + QLatin1String(" \"$(TargetPath)\""));
+ conf.postBuild.ExcludedFromBuild = _False;
+ }
- if(!project->values("MSVCPROJ_COPY_DLL").isEmpty()) {
+ if (!project->values("MSVCPROJ_COPY_DLL").isEmpty()) {
conf.postBuild.Description += var("MSVCPROJ_COPY_DLL_DESC");
conf.postBuild.CommandLine += var("MSVCPROJ_COPY_DLL");
+ conf.postBuild.ExcludedFromBuild = _False;
}
}
@@ -1133,7 +1150,8 @@ void VcprojGenerator::initDeploymentTool()
devicePath = Option::fixPathToLocalOS(QDir::cleanPath(targetPath + QLatin1Char('\\') + devicePath));
}
// foreach d in item.sources
- foreach(QString source, project->values(item + ".sources")) {
+ // ### Qt 5: remove .sources, inconsistent with INSTALLS
+ foreach(QString source, project->values(item + ".sources") + project->values(item + ".files")) {
QString itemDevicePath = devicePath;
source = Option::fixPathToLocalOS(source);
QString nameFilter;
@@ -1175,6 +1193,7 @@ void VcprojGenerator::initPreLinkEventTools()
QStringList cmdline = VCToolBase::fixCommandLine(var("QMAKE_PRE_LINK"));
conf.preLink.CommandLine = cmdline;
conf.preLink.Description = cmdline.join(QLatin1String("\r\n"));
+ conf.preLink.ExcludedFromBuild = _False;
}
}
@@ -1266,7 +1285,6 @@ void VcprojGenerator::initTranslationFiles()
vcProject.TranslationFiles.CustomBuild = none;
}
-
void VcprojGenerator::initFormFiles()
{
vcProject.FormFiles.Name = "Form Files";
@@ -1282,7 +1300,6 @@ void VcprojGenerator::initFormFiles()
vcProject.FormFiles.CustomBuild = none;
}
-
void VcprojGenerator::initResourceFiles()
{
vcProject.ResourceFiles.Name = "Resource Files";
@@ -1410,86 +1427,11 @@ void VcprojGenerator::initExtraCompilerOutputs()
}
}
-/* \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;
-
- // Decode version, and add it to $$MSVCPROJ_VERSION --------------
- if(!project->values("VERSION").isEmpty()) {
- QString version = project->values("VERSION")[0];
- int firstDot = version.indexOf(".");
- QString major = version.left(firstDot);
- QString minor = version.right(version.length() - firstDot - 1);
- minor.replace(QRegExp("\\."), "");
- project->values("MSVCPROJ_VERSION").append("/VERSION:" + major + "." + minor);
- project->values("QMAKE_LFLAGS").append("/VERSION:" + major + "." + minor);
- }
-
- project->values("QMAKE_LIBS") += escapeFilePaths(project->values("LIBS"));
- project->values("QMAKE_LIBS_PRIVATE") += escapeFilePaths(project->values("LIBS_PRIVATE"));
-
- // Get filename w/o extension -----------------------------------
- QString msvcproj_project = "";
- QString targetfilename = "";
- if(!project->isEmpty("TARGET")) {
- project->values("TARGET") = unescapeFilePaths(project->values("TARGET"));
- targetfilename = msvcproj_project = project->first("TARGET");
- }
-
- // Init base class too -------------------------------------------
- MakefileGenerator::init();
-
- if(msvcproj_project.isEmpty())
- msvcproj_project = Option::output.fileName();
-
- msvcproj_project = msvcproj_project.right(msvcproj_project.length() - msvcproj_project.lastIndexOf("\\") - 1);
- msvcproj_project = msvcproj_project.left(msvcproj_project.lastIndexOf("."));
- msvcproj_project.replace(QRegExp("-"), "");
-
- project->values("MSVCPROJ_PROJECT").append(msvcproj_project);
- QStringList &proj = project->values("MSVCPROJ_PROJECT");
-
- for(it = proj.begin(); it != proj.end(); ++it)
- (*it).replace(QRegExp("\\.[a-zA-Z0-9_]*$"), "");
-
- // SUBSYSTEM -----------------------------------------------------
- if(!project->values("QMAKE_APP_FLAG").isEmpty()) {
- project->values("MSVCPROJ_TEMPLATE").append("win32app" + project->first("VCPROJ_EXTENSION"));
- if(project->isActiveConfig("console")) {
- project->values("MSVCPROJ_CONSOLE").append("CONSOLE");
- project->values("MSVCPROJ_WINCONDEF").append("_CONSOLE");
- project->values("MSVCPROJ_VCPROJTYPE").append("0x0103");
- project->values("MSVCPROJ_SUBSYSTEM").append("CONSOLE");
- } else {
- project->values("MSVCPROJ_CONSOLE").clear();
- project->values("MSVCPROJ_WINCONDEF").append("_WINDOWS");
- project->values("MSVCPROJ_VCPROJTYPE").append("0x0101");
- project->values("MSVCPROJ_SUBSYSTEM").append("WINDOWS");
- }
- }
-
// $$QMAKE.. -> $$MSVCPROJ.. -------------------------------------
project->values("MSVCPROJ_LIBS") += project->values("QMAKE_LIBS");
project->values("MSVCPROJ_LIBS") += project->values("QMAKE_LIBS_PRIVATE");
- project->values("MSVCPROJ_LFLAGS") += project->values("QMAKE_LFLAGS");
- if(!project->values("QMAKE_LIBDIR").isEmpty()) {
- QStringList strl = project->values("QMAKE_LIBDIR");
- QStringList::iterator stri;
- for(stri = strl.begin(); stri != strl.end(); ++stri) {
- if(!(*stri).startsWith("/LIBPATH:"))
- (*stri).prepend("/LIBPATH:");
- }
- project->values("MSVCPROJ_LFLAGS") += strl;
- }
- project->values("MSVCPROJ_CXXFLAGS") += project->values("QMAKE_CXXFLAGS");
QStringList &incs = project->values("INCLUDEPATH");
for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) {
QString inc = (*incit);
@@ -1528,9 +1470,6 @@ void VcprojGenerator::initOld()
project->values("MSVCPROJ_COPY_DLL_DESC").append(deststr);
}
- if (!project->values("DEF_FILE").isEmpty())
- project->values("MSVCPROJ_LFLAGS").append("/DEF:"+project->first("DEF_FILE"));
-
project->values("QMAKE_INTERNAL_PRL_LIBS") << "MSVCPROJ_LIBS";
// Verbose output if "-d -d"...
@@ -1540,6 +1479,11 @@ void VcprojGenerator::initOld()
// ------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------
+VCProjectWriter *VcprojGenerator::createProjectWriter()
+{
+ return new VCProjectWriter;
+}
+
QString VcprojGenerator::replaceExtraCompilerVariables(const QString &var, const QStringList &in, const QStringList &out)
{
QString ret = MakefileGenerator::replaceExtraCompilerVariables(var, in, out);
@@ -1558,8 +1502,6 @@ QString VcprojGenerator::replaceExtraCompilerVariables(const QString &var, const
return ret;
}
-
-
bool VcprojGenerator::openOutput(QFile &file, const QString &/*build*/) const
{
QString outdir;
@@ -1611,28 +1553,13 @@ QString VcprojGenerator::findTemplate(QString file)
return ret;
}
-
-void VcprojGenerator::processPrlVariable(const QString &var, const QStringList &l)
-{
- if(var == "QMAKE_PRL_DEFINES") {
- QStringList &out = project->values("MSVCPROJ_DEFINES");
- for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
- if(out.indexOf((*it)) == -1)
- out.append((" /D " + *it));
- }
- } else {
- MakefileGenerator::processPrlVariable(var, l);
- }
-}
-
void VcprojGenerator::outputVariables()
{
#if 0
qDebug("Generator: MSVC.NET: List of current variables:");
for(QMap<QString, QStringList>::ConstIterator it = project->variables().begin(); it != project->variables().end(); ++it)
- qDebug("Generator: MSVC.NET: %s => %s", it.key().toLatin1().constData(), it.data().join(" | ").toLatin1().constData());
+ qDebug("Generator: MSVC.NET: %s => %s", qPrintable(it.key()), qPrintable(it.value().join(" | ")));
#endif
}
QT_END_NAMESPACE
-
diff --git a/qmake/generators/win32/msvc_vcproj.h b/qmake/generators/win32/msvc_vcproj.h
index 8e55211..fdcd73f 100644
--- a/qmake/generators/win32/msvc_vcproj.h
+++ b/qmake/generators/win32/msvc_vcproj.h
@@ -78,8 +78,10 @@ public:
QMap<QString, QStringList> extraCompilerSources;
QMap<QString, QStringList> extraCompilerOutputs;
bool usePCH;
+ VCProjectWriter *projectWriter;
protected:
+ virtual VCProjectWriter *createProjectWriter();
virtual bool doDepends() const { return false; } //never necesary
virtual void processSources() { filterIncludedFiles("SOURCES"); filterIncludedFiles("GENERATED_SOURCES"); }
virtual QString replaceExtraCompilerVariables(const QString &, const QStringList &, const QStringList &);
@@ -90,7 +92,6 @@ protected:
virtual bool mergeBuildProject(MakefileGenerator *other);
virtual bool openOutput(QFile &file, const QString &build) const;
- virtual void processPrlVariable(const QString &, const QStringList &);
virtual bool findLibraries();
virtual void outputVariables();
QString fixFilename(QString ofile) const;
@@ -134,9 +135,6 @@ private:
friend class VCFilter;
};
-inline VcprojGenerator::~VcprojGenerator()
-{ }
-
inline QString VcprojGenerator::defaultMakefile() const
{
return project->first("TARGET") + project->first("VCPROJ_EXTENSION");
diff --git a/qmake/generators/win32/msvc_vcxproj.cpp b/qmake/generators/win32/msvc_vcxproj.cpp
index 2b628a5..1e7c4b7 100644
--- a/qmake/generators/win32/msvc_vcxproj.cpp
+++ b/qmake/generators/win32/msvc_vcxproj.cpp
@@ -64,770 +64,10 @@ QT_BEGIN_NAMESPACE
VcxprojGenerator::VcxprojGenerator() : VcprojGenerator()
{
}
-bool VcxprojGenerator::writeMakefile(QTextStream &t)
-{
- initProject(); // Fills the whole project with proper data
-
- // Generate solution file
- if(project->first("TEMPLATE") == "vcsubdirs") {
- if (!project->isActiveConfig("build_pass")) {
- debug_msg(1, "Generator: MSVC.NET: Writing solution file");
- writeSubDirs(t);
- } else {
- debug_msg(1, "Generator: MSVC.NET: Not writing solution file for build_pass configs");
- }
- return true;
- } else
- // Generate single configuration project file
- if (project->first("TEMPLATE") == "vcapp" ||
- project->first("TEMPLATE") == "vclib") {
- if(!project->isActiveConfig("build_pass")) {
- debug_msg(1, "Generator: MSVC.NET: Writing single configuration project file");
- XmlOutput xmlOut(t);
- xmlOut << vcxProject;
- }
- return true;
- }
- return project->isActiveConfig("build_pass");
-}
-
-
-void VcxprojGenerator::initProject()
-{
- // Initialize XML sub elements
- // - Do this first since project elements may need
- // - to know of certain configuration options
- initConfiguration();
- initRootFiles();
- initSourceFiles();
- initHeaderFiles();
- initGeneratedFiles();
- initLexYaccFiles();
- initTranslationFiles();
- initFormFiles();
- initResourceFiles();
- initExtraCompilerOutputs();
-
- // Own elements -----------------------------
- vcxProject.Name = unescapeFilePath(project->first("QMAKE_ORIG_TARGET"));
-
- vcxProject.Keyword = project->first("VCPROJ_KEYWORD");
- if (project->isEmpty("CE_SDK") || project->isEmpty("CE_ARCH")) {
- vcxProject.PlatformName = vcxProject.Configuration.idl.TargetEnvironment;
- if ( vcxProject.Configuration.idl.TargetEnvironment.isEmpty() )
- vcxProject.PlatformName = "Win32";
- } else {
- vcxProject.PlatformName = project->values("CE_SDK").join(" ") + " (" + project->first("CE_ARCH") + ")";
- }
- // These are not used by Qt, but may be used by customers
- vcxProject.SccProjectName = project->first("SCCPROJECTNAME");
- vcxProject.SccLocalPath = project->first("SCCLOCALPATH");
- vcxProject.flat_files = project->isActiveConfig("flat");
-}
-
-
-void VcxprojGenerator::initConfiguration()
-{
- // Initialize XML sub elements
- // - Do this first since main configuration elements may need
- // - to know of certain compiler/linker options
- VCXConfiguration &conf = vcxProject.Configuration;
-
- initCompilerTool();
-
- // Only on configuration per build
- bool isDebug = project->isActiveConfig("debug");
-
- if(projectTarget == StaticLib)
- initLibrarianTool();
- else {
- conf.linker.GenerateDebugInformation = isDebug ? _True : _False;
- initLinkerTool();
- }
- initResourceTool();
- initIDLTool();
-
- // Own elements -----------------------------
- QString temp = project->first("BuildBrowserInformation");
- switch (projectTarget) {
- case SharedLib:
- conf.ConfigurationType = "DynamicLibrary";
- break;
- case StaticLib:
- conf.ConfigurationType = "StaticLibrary";
- break;
- case Application:
- default:
- conf.ConfigurationType = "Application";
- break;
- }
-
- conf.OutputDirectory = project->first("DESTDIR");
-
- if(conf.OutputDirectory.isEmpty())
- conf.OutputDirectory = ".\\";
-
- if(!conf.OutputDirectory.endsWith("\\"))
- conf.OutputDirectory += '\\';
-
- // The target name could have been changed.
- conf.TargetName = project->first("TARGET");
- if ( !conf.TargetName.isEmpty() && !project->first("TARGET_VERSION_EXT").isEmpty() && project->isActiveConfig("shared"))
- conf.TargetName.append(project->first("TARGET_VERSION_EXT"));
-
- conf.Name = project->values("BUILD_NAME").join(" ");
- if (conf.Name.isEmpty())
- conf.Name = isDebug ? "Debug" : "Release";
- conf.ConfigurationName = conf.Name;
- if (project->isEmpty("CE_SDK") || project->isEmpty("CE_ARCH")) {
- conf.Name += (conf.idl.TargetEnvironment == "Win64" ? "|Win64" : "|Win32");
- } else {
- conf.Name += "|" + project->values("CE_SDK").join(" ") + " (" + project->first("CE_ARCH") + ")";
- }
- conf.ATLMinimizesCRunTimeLibraryUsage = (project->first("ATLMinimizesCRunTimeLibraryUsage").isEmpty() ? _False : _True);
- conf.BuildBrowserInformation = triState(temp.isEmpty() ? (short)unset : temp.toShort());
- temp = project->first("CharacterSet");
- if (!temp.isEmpty())
- {
- switch (charSet(temp.toShort())) {
-
- case charSetMBCS:
- conf.CharacterSet = "MultiByte";
- break;
- case charSetUnicode:
- conf.CharacterSet = "Unicode";
- break;
- case charSetNotSet:
- default:
- conf.CharacterSet = "NotSet";
- break;
- }
- }
- conf.DeleteExtensionsOnClean = project->first("DeleteExtensionsOnClean");
- conf.ImportLibrary = conf.linker.ImportLibrary;
- conf.IntermediateDirectory = project->first("OBJECTS_DIR");
- //conf.OutputDirectory = ".";
- conf.PrimaryOutput = project->first("PrimaryOutput");
- conf.WholeProgramOptimization = conf.compiler.WholeProgramOptimization;
- temp = project->first("UseOfATL");
- if(!temp.isEmpty())
- {
- switch (useOfATL(temp.toShort())) {
-
- case useATLStatic:
- conf.UseOfATL = "Static";
- break;
- case useATLDynamic:
- conf.UseOfATL = "Dynamic";
- break;
- case useATLNotSet:
- default:
- conf.UseOfATL = "false";
- break;
- }
- }
- temp = project->first("UseOfMfc");
- if(!temp.isEmpty())
- {
- switch (useOfMfc(temp.toShort())) {
-
- case useMfcStatic:
- conf.UseOfMfc = "Static";
- break;
- case useMfcDynamic:
- conf.UseOfMfc = "Dynamic";
- break;
- case useMfcStdWin:
- default:
- conf.UseOfMfc = "false";
- break;
- }
- }
-
- // Configuration does not need parameters from
- // these sub XML items;
- initCustomBuildTool();
- initPreBuildEventTools();
- initPostBuildEventTools();
- // Only deploy for CE projects
- if (!project->isEmpty("CE_SDK") && !project->isEmpty("CE_ARCH"))
- initDeploymentTool();
- initPreLinkEventTools();
-
- // Set definite values in both configurations
- if (isDebug) {
- conf.compiler.PreprocessorDefinitions.removeAll("NDEBUG");
- } else {
- conf.compiler.PreprocessorDefinitions += "NDEBUG";
- }
-}
-
-
-void VcxprojGenerator::initCompilerTool()
-{
- QString placement = project->first("OBJECTS_DIR");
- if(placement.isEmpty())
- placement = ".\\";
-
- VCXConfiguration &conf = vcxProject.Configuration;
- conf.compiler.AssemblerListingLocation = placement ;
- conf.compiler.ProgramDataBaseFileName = ".\\" ;
- conf.compiler.ObjectFileName = placement ;
- conf.compiler.ExceptionHandling = "false";
- // PCH
- if (usePCH) {
- conf.compiler.PrecompiledHeader = "Use";
- conf.compiler.PrecompiledHeaderOutputFile = "$(IntDir)\\" + precompPch;
- conf.compiler.PrecompiledHeaderFile = project->first("PRECOMPILED_HEADER");
- conf.compiler.ForcedIncludeFiles = project->values("PRECOMPILED_HEADER");
- conf.compiler.PreprocessToFile = _False;
- conf.compiler.PreprocessSuppressLineNumbers = _False;
- // Minimal build option triggers an Internal Compiler Error
- // when used in conjunction with /FI and /Yu, so remove it
- project->values("QMAKE_CFLAGS_DEBUG").removeAll("-Gm");
- project->values("QMAKE_CFLAGS_DEBUG").removeAll("/Gm");
- project->values("QMAKE_CXXFLAGS_DEBUG").removeAll("-Gm");
- project->values("QMAKE_CXXFLAGS_DEBUG").removeAll("/Gm");
- }
-
- conf.compiler.parseOptions(project->values("QMAKE_CXXFLAGS"));
- if(project->isActiveConfig("debug")){
- // Debug version
- if((projectTarget == Application) || (projectTarget == StaticLib))
- conf.compiler.parseOptions(project->values("QMAKE_CXXFLAGS_MT_DBG"));
- else
- conf.compiler.parseOptions(project->values("QMAKE_CXXFLAGS_MT_DLLDBG"));
- } else {
- // Release version
- conf.compiler.PreprocessorDefinitions += "QT_NO_DEBUG";
- conf.compiler.PreprocessorDefinitions += "NDEBUG";
- if((projectTarget == Application) || (projectTarget == StaticLib))
- conf.compiler.parseOptions(project->values("QMAKE_CXXFLAGS_MT"));
- else
- conf.compiler.parseOptions(project->values("QMAKE_CXXFLAGS_MT_DLL"));
- }
-
- // Common for both release and debug
- if(project->isActiveConfig("windows"))
- conf.compiler.PreprocessorDefinitions += project->values("MSVCPROJ_WINCONDEF");
-
- // Can this be set for ALL configs?
- // If so, use qmake.conf!
- if(projectTarget == SharedLib)
- conf.compiler.PreprocessorDefinitions += "_WINDOWS";
-
- conf.compiler.PreprocessorDefinitions += project->values("DEFINES");
- conf.compiler.PreprocessorDefinitions += project->values("PRL_EXPORT_DEFINES");
- conf.compiler.parseOptions(project->values("MSVCPROJ_INCPATH"));
-}
-
-void VcxprojGenerator::initLinkerTool()
-{
- findLibraries(); // Need to add the highest version of the libs
- VCXConfiguration &conf = vcxProject.Configuration;
- conf.linker.parseOptions(project->values("MSVCPROJ_LFLAGS"));
-
- foreach(QString libs, project->values("MSVCPROJ_LIBS")) {
- if (libs.left(9).toUpper() == "/LIBPATH:") {
- QStringList l = QStringList(libs);
- conf.linker.parseOptions(l);
- } else {
- conf.linker.AdditionalDependencies += libs;
- }
- }
-
- switch (projectTarget) {
- case Application:
- conf.linker.OutputFile = project->first("DESTDIR");
- break;
- case SharedLib:
- conf.linker.parseOptions(project->values("MSVCPROJ_LIBOPTIONS"));
- conf.linker.OutputFile = project->first("DESTDIR");
- break;
- case StaticLib: //unhandled - added to remove warnings..
- break;
- }
-
- if(conf.linker.OutputFile.isEmpty())
- conf.linker.OutputFile = ".\\";
-
- if(!conf.linker.OutputFile.endsWith("\\"))
- conf.linker.OutputFile += '\\';
-
- conf.linker.OutputFile += project->first("MSVCPROJ_TARGET");
-
- if(project->isActiveConfig("dll")){
- conf.linker.parseOptions(project->values("QMAKE_LFLAGS_QT_DLL"));
- }
-}
-
-void VcxprojGenerator::initResourceTool()
-{
- VCXConfiguration &conf = vcxProject.Configuration;
- conf.resource.PreprocessorDefinitions = conf.compiler.PreprocessorDefinitions;
-
- // We need to add _DEBUG for the debug version of the project, since the normal compiler defines
- // do not contain it. (The compiler defines this symbol automatically, which is wy we don't need
- // to add it for the compiler) However, the resource tool does not do this.
- if(project->isActiveConfig("debug"))
- conf.resource.PreprocessorDefinitions += "_DEBUG";
- if(project->isActiveConfig("staticlib"))
- conf.resource.ResourceOutputFileName = project->first("DESTDIR") + "/$(InputName).res";
-}
-
-
-void VcxprojGenerator::initPostBuildEventTools()
-{
- VCXConfiguration &conf = vcxProject.Configuration;
- if(!project->values("QMAKE_POST_LINK").isEmpty()) {
- QStringList cmdline = VCToolBase::fixCommandLine(var("QMAKE_POST_LINK"));
- conf.postBuild.CommandLine = cmdline;
- conf.postBuild.Description = cmdline.join(QLatin1String("\r\n"));
- conf.postBuild.UseInBuild = _True;
- }
-
- QString signature = !project->isEmpty("SIGNATURE_FILE") ? var("SIGNATURE_FILE") : var("DEFAULT_SIGNATURE");
- bool useSignature = !signature.isEmpty() && !project->isActiveConfig("staticlib") &&
- !project->isEmpty("CE_SDK") && !project->isEmpty("CE_ARCH");
- if(useSignature) {
- conf.postBuild.CommandLine.prepend(
- QLatin1String("signtool sign /F ") + signature + QLatin1String(" \"$(TargetPath)\""));
- conf.postBuild.UseInBuild = _True;
- }
-
- if(!project->values("MSVCPROJ_COPY_DLL").isEmpty()) {
- conf.postBuild.Description += var("MSVCPROJ_COPY_DLL_DESC");
- conf.postBuild.CommandLine += var("MSVCPROJ_COPY_DLL");
- conf.postBuild.UseInBuild = _True;
- }
-}
-
-
-void VcxprojGenerator::initDeploymentTool()
-{
- VCXConfiguration &conf = vcxProject.Configuration;
- QString targetPath = project->values("deploy.path").join(" ");
- if (targetPath.isEmpty())
- targetPath = QString("%CSIDL_PROGRAM_FILES%\\") + project->first("TARGET");
- if (targetPath.endsWith("/") || targetPath.endsWith("\\"))
- targetPath.chop(1);
-
- // Only deploy Qt libs for shared build
- if (!project->values("QMAKE_QT_DLL").isEmpty()) {
- QStringList& arg = project->values("MSVCPROJ_LIBS");
- for (QStringList::ConstIterator it = arg.constBegin(); it != arg.constEnd(); ++it) {
- if (it->contains(project->first("QMAKE_LIBDIR"))) {
- QString dllName = *it;
-
- if (dllName.contains(QLatin1String("QAxContainer"))
- || dllName.contains(QLatin1String("qtmain"))
- || dllName.contains(QLatin1String("QtUiTools")))
- continue;
- dllName.replace(QLatin1String(".lib") , QLatin1String(".dll"));
- QFileInfo info(dllName);
- conf.deployment.AdditionalFiles += info.fileName()
- + "|" + QDir::toNativeSeparators(info.absolutePath())
- + "|" + targetPath
- + "|0;";
- }
- }
- }
-
- // C-runtime deployment
- QString runtime = project->values("QT_CE_C_RUNTIME").join(QLatin1String(" "));
- if (!runtime.isEmpty() && (runtime != QLatin1String("no"))) {
- QString runtimeVersion = QLatin1String("msvcr");
- QString mkspec = project->first("QMAKESPEC");
- // If no .qmake.cache has been found, we fallback to the original mkspec
- if (mkspec.isEmpty())
- mkspec = project->first("QMAKESPEC_ORIGINAL");
-
- if (!mkspec.isEmpty()) {
- if (mkspec.endsWith("2010"))
- runtimeVersion.append("100");
- else if (mkspec.endsWith("2008"))
- runtimeVersion.append("90");
- else
- runtimeVersion.append("80");
- if (project->isActiveConfig("debug"))
- runtimeVersion.append("d");
- runtimeVersion.append(".dll");
-
- if (runtime == "yes") {
- // Auto-find C-runtime
- QString vcInstallDir = qgetenv("VCINSTALLDIR");
- if (!vcInstallDir.isEmpty()) {
- vcInstallDir += "\\ce\\dll\\";
- vcInstallDir += project->values("CE_ARCH").join(QLatin1String(" "));
- if (!QFileInfo(vcInstallDir + QDir::separator() + runtimeVersion).exists())
- runtime.clear();
- else
- runtime = vcInstallDir;
- }
- }
- }
-
- if (!runtime.isEmpty() && runtime != QLatin1String("yes")) {
- conf.deployment.AdditionalFiles += runtimeVersion
- + "|" + QDir::toNativeSeparators(runtime)
- + "|" + targetPath
- + "|0;";
- }
- }
-
- // foreach item in DEPLOYMENT
- foreach(QString item, project->values("DEPLOYMENT")) {
- // get item.path
- QString devicePath = project->first(item + ".path");
- if (devicePath.isEmpty())
- devicePath = targetPath;
- // check if item.path is relative (! either /,\ or %)
- if (!(devicePath.at(0) == QLatin1Char('/')
- || devicePath.at(0) == QLatin1Char('\\')
- || devicePath.at(0) == QLatin1Char('%'))) {
- // create output path
- devicePath = Option::fixPathToLocalOS(QDir::cleanPath(targetPath + QLatin1Char('\\') + devicePath));
- }
- // foreach d in item.sources
- foreach(QString source, project->values(item + ".sources")) {
- QString itemDevicePath = devicePath;
- source = Option::fixPathToLocalOS(source);
- QString nameFilter;
- QFileInfo info(source);
- QString searchPath;
- if (info.isDir()) {
- nameFilter = QLatin1String("*");
- itemDevicePath += "\\" + info.fileName();
- searchPath = info.absoluteFilePath();
- } else {
- nameFilter = source.split('\\').last();
- searchPath = info.absolutePath();
- }
-
- int pathSize = searchPath.size();
- QDirIterator iterator(searchPath, QStringList() << nameFilter
- , QDir::Files | QDir::NoDotAndDotDot | QDir::NoSymLinks
- , QDirIterator::Subdirectories);
- // foreach dirIterator-entry in d
- while(iterator.hasNext()) {
- iterator.next();
- QString absoluteItemPath = Option::fixPathToLocalOS(QFileInfo(iterator.filePath()).absolutePath());
- // Identify if it is just another subdir
- int diffSize = absoluteItemPath.size() - pathSize;
- // write out rules
- conf.deployment.AdditionalFiles += iterator.fileName()
- + "|" + absoluteItemPath
- + "|" + itemDevicePath + (diffSize ? (absoluteItemPath.right(diffSize)) : QLatin1String(""))
- + "|0;";
- }
- }
- }
-}
-
-void VcxprojGenerator::initPreLinkEventTools()
-{
- VCXConfiguration &conf = vcxProject.Configuration;
- if(!project->values("QMAKE_PRE_LINK").isEmpty()) {
- QStringList cmdline = VCToolBase::fixCommandLine(var("QMAKE_PRE_LINK"));
- conf.preLink.CommandLine = cmdline;
- conf.preLink.Description = cmdline.join(QLatin1String("\r\n"));
- conf.preLink.UseInBuild = _True;
- }
-}
-
-void VcxprojGenerator::initRootFiles()
-{
- vcxProject.RootFiles.addFiles(project->values("RC_FILE"));
- vcxProject.RootFiles.Project = this;
- vcxProject.RootFiles.Config = &(vcxProject.Configuration);
- vcxProject.RootFiles.CustomBuild = none;
-}
-
-void VcxprojGenerator::initSourceFiles()
-{
- vcxProject.SourceFiles.Name = "Source Files";
- vcxProject.SourceFiles.Filter = "cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx";
- vcxProject.SourceFiles.Guid = _GUIDSourceFiles;
-
- vcxProject.SourceFiles.addFiles(project->values("SOURCES"));
-
- vcxProject.SourceFiles.Project = this;
- vcxProject.SourceFiles.Config = &(vcxProject.Configuration);
- vcxProject.SourceFiles.CustomBuild = none;
-}
-
-void VcxprojGenerator::initHeaderFiles()
-{
- vcxProject.HeaderFiles.Name = "Header Files";
- vcxProject.HeaderFiles.Filter = "h;hpp;hxx;hm;inl;inc;xsd";
- vcxProject.HeaderFiles.Guid = _GUIDHeaderFiles;
-
- vcxProject.HeaderFiles.addFiles(project->values("HEADERS"));
- if (usePCH) // Generated PCH cpp file
- vcxProject.HeaderFiles.addFile(precompH);
-
- vcxProject.HeaderFiles.Project = this;
- vcxProject.HeaderFiles.Config = &(vcxProject.Configuration);
-}
-
-void VcxprojGenerator::initGeneratedFiles()
-{
- vcxProject.GeneratedFiles.Name = "Generated Files";
- vcxProject.GeneratedFiles.Filter = "cpp;c;cxx;moc;h;def;odl;idl;res";
- vcxProject.GeneratedFiles.Guid = _GUIDGeneratedFiles;
-
- // ### These cannot have CustomBuild (mocSrc)!!
- vcxProject.GeneratedFiles.addFiles(project->values("GENERATED_SOURCES"));
- vcxProject.GeneratedFiles.addFiles(project->values("GENERATED_FILES"));
- vcxProject.GeneratedFiles.addFiles(project->values("IDLSOURCES"));
- vcxProject.GeneratedFiles.addFiles(project->values("RES_FILE"));
- vcxProject.GeneratedFiles.addFiles(project->values("QMAKE_IMAGE_COLLECTION")); // compat
- if(!extraCompilerOutputs.isEmpty())
- vcxProject.GeneratedFiles.addFiles(extraCompilerOutputs.keys());
-
- vcxProject.GeneratedFiles.Project = this;
- vcxProject.GeneratedFiles.Config = &(vcxProject.Configuration);
-}
-
-void VcxprojGenerator::initLexYaccFiles()
-{
- vcxProject.LexYaccFiles.Name = "Lex / Yacc Files";
- vcxProject.LexYaccFiles.ParseFiles = _False;
- vcxProject.LexYaccFiles.Filter = "l;y";
- vcxProject.LexYaccFiles.Guid = _GUIDLexYaccFiles;
-
- vcxProject.LexYaccFiles.addFiles(project->values("LEXSOURCES"));
- vcxProject.LexYaccFiles.addFiles(project->values("YACCSOURCES"));
-
- vcxProject.LexYaccFiles.Project = this;
- vcxProject.LexYaccFiles.Config = &(vcxProject.Configuration);
- vcxProject.LexYaccFiles.CustomBuild = lexyacc;
-}
-
-void VcxprojGenerator::initTranslationFiles()
-{
- vcxProject.TranslationFiles.Name = "Translation Files";
- vcxProject.TranslationFiles.ParseFiles = _False;
- vcxProject.TranslationFiles.Filter = "ts;xlf";
- vcxProject.TranslationFiles.Guid = _GUIDTranslationFiles;
-
- vcxProject.TranslationFiles.addFiles(project->values("TRANSLATIONS"));
-
- vcxProject.TranslationFiles.Project = this;
- vcxProject.TranslationFiles.Config = &(vcxProject.Configuration);
- vcxProject.TranslationFiles.CustomBuild = none;
-}
-
-
-void VcxprojGenerator::initFormFiles()
-{
- vcxProject.FormFiles.Name = "Form Files";
- vcxProject.FormFiles.ParseFiles = _False;
- vcxProject.FormFiles.Filter = "ui";
- vcxProject.FormFiles.Guid = _GUIDFormFiles;
-
- vcxProject.FormFiles.addFiles(project->values("FORMS"));
- vcxProject.FormFiles.addFiles(project->values("FORMS3"));
-
- vcxProject.FormFiles.Project = this;
- vcxProject.FormFiles.Config = &(vcxProject.Configuration);
- vcxProject.FormFiles.CustomBuild = none;
-}
-
-
-void VcxprojGenerator::initResourceFiles()
-{
- vcxProject.ResourceFiles.Name = "Resource Files";
- vcxProject.ResourceFiles.ParseFiles = _False;
- vcxProject.ResourceFiles.Filter = "qrc;*"; //"rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;ts;xlf;qrc";
- vcxProject.ResourceFiles.Guid = _GUIDResourceFiles;
-
- // Bad hack, please look away -------------------------------------
- QString rcc_dep_cmd = project->values("rcc.depend_command").join(" ");
- if(!rcc_dep_cmd.isEmpty()) {
- QStringList qrc_files = project->values("RESOURCES");
- QStringList deps;
- if(!qrc_files.isEmpty()) {
- for (int i = 0; i < qrc_files.count(); ++i) {
- char buff[256];
- QString dep_cmd = replaceExtraCompilerVariables(rcc_dep_cmd, qrc_files.at(i),"");
-
- dep_cmd = Option::fixPathToLocalOS(dep_cmd, true, false);
- if(canExecute(dep_cmd)) {
- if(FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), "r")) {
- QString indeps;
- while(!feof(proc)) {
- int read_in = (int)fread(buff, 1, 255, proc);
- if(!read_in)
- break;
- indeps += QByteArray(buff, read_in);
- }
- QT_PCLOSE(proc);
- if(!indeps.isEmpty())
- deps += fileFixify(indeps.replace('\n', ' ').simplified().split(' '));
- }
- }
- }
- vcxProject.ResourceFiles.addFiles(deps);
- }
- }
- // You may look again --------------------------------------------
-
- vcxProject.ResourceFiles.addFiles(project->values("RESOURCES"));
- vcxProject.ResourceFiles.addFiles(project->values("IMAGES"));
-
- vcxProject.ResourceFiles.Project = this;
- vcxProject.ResourceFiles.Config = &(vcxProject.Configuration);
- vcxProject.ResourceFiles.CustomBuild = none;
-}
-
-void VcxprojGenerator::initExtraCompilerOutputs()
-{
- QStringList otherFilters;
- otherFilters << "FORMS"
- << "FORMS3"
- << "GENERATED_FILES"
- << "GENERATED_SOURCES"
- << "HEADERS"
- << "IDLSOURCES"
- << "IMAGES"
- << "LEXSOURCES"
- << "QMAKE_IMAGE_COLLECTION"
- << "RC_FILE"
- << "RESOURCES"
- << "RES_FILE"
- << "SOURCES"
- << "TRANSLATIONS"
- << "YACCSOURCES";
- const QStringList &quc = project->values("QMAKE_EXTRA_COMPILERS");
- for(QStringList::ConstIterator it = quc.begin(); it != quc.end(); ++it) {
- QString extracompilerName = project->first((*it) + ".name");
- if (extracompilerName.isEmpty())
- extracompilerName = (*it);
-
- // Create an extra compiler filter and add the files
- VCXFilter extraCompile;
- extraCompile.Name = extracompilerName;
- extraCompile.ParseFiles = _False;
- extraCompile.Filter = "";
- extraCompile.Guid = QString(_GUIDExtraCompilerFiles) + "-" + (*it);
-
- // If the extra compiler has a variable_out set the output file
- // is added to an other file list, and does not need its own..
- bool addOnInput = hasBuiltinCompiler(project->first((*it) + ".output"));
- QString tmp_other_out = project->first((*it) + ".variable_out");
- if (!tmp_other_out.isEmpty() && !addOnInput)
- continue;
-
- if (!addOnInput) {
- QString tmp_out = project->first((*it) + ".output");
- if (project->values((*it) + ".CONFIG").indexOf("combine") != -1) {
- // Combined output, only one file result
- extraCompile.addFile(
- Option::fixPathToTargetOS(replaceExtraCompilerVariables(tmp_out, QString(), QString()), false));
- } else {
- // One output file per input
- QStringList tmp_in = project->values(project->first((*it) + ".input"));
- for (int i = 0; i < tmp_in.count(); ++i) {
- const QString &filename = tmp_in.at(i);
- if (extraCompilerSources.contains(filename))
- extraCompile.addFile(
- Option::fixPathToTargetOS(replaceExtraCompilerVariables(filename, tmp_out, QString()), false));
- }
- }
- } else {
- // In this case we the outputs have a built-in compiler, so we cannot add the custom
- // build steps there. So, we turn it around and add it to the input files instead,
- // provided that the input file variable is not handled already (those in otherFilters
- // are handled, so we avoid them).
- QStringList inputVars = project->values((*it) + ".input");
- foreach(QString inputVar, inputVars) {
- if (!otherFilters.contains(inputVar)) {
- QStringList tmp_in = project->values(inputVar);
- for (int i = 0; i < tmp_in.count(); ++i) {
- const QString &filename = tmp_in.at(i);
- if (extraCompilerSources.contains(filename))
- extraCompile.addFile(
- Option::fixPathToTargetOS(replaceExtraCompilerVariables(filename, QString(), QString()), false));
- }
- }
- }
- }
- extraCompile.Project = this;
- extraCompile.Config = &(vcxProject.Configuration);
- extraCompile.CustomBuild = none;
-
- vcxProject.ExtraCompilersFiles.append(extraCompile);
- }
-}
-
-
-
-bool VcxprojGenerator::writeProjectMakefile()
-{
- usePlatformDir();
- QTextStream t(&Option::output);
-
- // Check if all requirements are fulfilled
- if(!project->values("QMAKE_FAILED_REQUIREMENTS").isEmpty()) {
- fprintf(stderr, "Project file not generated because all requirements not met:\n\t%s\n",
- var("QMAKE_FAILED_REQUIREMENTS").toLatin1().constData());
- return true;
- }
-
- // Generate project file
- if(project->first("TEMPLATE") == "vcapp" ||
- project->first("TEMPLATE") == "vclib") {
- if (!mergedProjects.count()) {
- warn_msg(WarnLogic, "Generator: MSVC.NET: no single configuration created, cannot output project!");
- return false;
- }
-
- debug_msg(1, "Generator: MSVC.NET: Writing project file");
- VCXProject mergedProject;
- for (int i = 0; i < mergedProjects.count(); ++i) {
- VCXProjectSingleConfig *singleProject = &(mergedProjects.at(i)->vcxProject);
- mergedProject.SingleProjects += *singleProject;
- for (int j = 0; j < singleProject->ExtraCompilersFiles.count(); ++j) {
- const QString &compilerName = singleProject->ExtraCompilersFiles.at(j).Name;
- if (!mergedProject.ExtraCompilers.contains(compilerName))
- mergedProject.ExtraCompilers += compilerName;
- }
- }
-
- if(mergedProjects.count() > 1 &&
- mergedProjects.at(0)->vcxProject.Name ==
- mergedProjects.at(1)->vcxProject.Name)
- mergedProjects.at(0)->writePrlFile();
- mergedProject.Name = unescapeFilePath(project->first("QMAKE_ORIG_TARGET"));
- mergedProject.Version = mergedProjects.at(0)->vcxProject.Version;
- mergedProject.ProjectGUID = project->isEmpty("QMAKE_UUID") ? getProjectUUID().toString().toUpper() : project->first("QMAKE_UUID");
- mergedProject.Keyword = project->first("VCPROJ_KEYWORD");
- mergedProject.SccProjectName = mergedProjects.at(0)->vcxProject.SccProjectName;
- mergedProject.SccLocalPath = mergedProjects.at(0)->vcxProject.SccLocalPath;
- mergedProject.PlatformName = mergedProjects.at(0)->vcxProject.PlatformName;
-
- XmlOutput xmlOut(t);
- xmlOut << mergedProject;
- return true;
- } else if(project->first("TEMPLATE") == "vcsubdirs") {
- return writeMakefile(t);
- }
- return false;
-}
-
-
-
-bool VcxprojGenerator::mergeBuildProject(MakefileGenerator *other)
+VCProjectWriter *VcxprojGenerator::createProjectWriter()
{
- VcxprojGenerator *otherVC = static_cast<VcxprojGenerator*>(other);
- if (!otherVC) {
- warn_msg(WarnLogic, "VcxprojGenerator: Cannot merge other types of projects! (ignored)");
- return false;
- }
- mergedProjects += otherVC;
- return true;
+ return new VCXProjectWriter;
}
QT_END_NAMESPACE
diff --git a/qmake/generators/win32/msvc_vcxproj.h b/qmake/generators/win32/msvc_vcxproj.h
index d871af3..3283cc7 100644
--- a/qmake/generators/win32/msvc_vcxproj.h
+++ b/qmake/generators/win32/msvc_vcxproj.h
@@ -50,45 +50,15 @@ QT_BEGIN_NAMESPACE
class VcxprojGenerator : public VcprojGenerator
{
- bool writeMakefile(QTextStream &);
- bool writeProjectMakefile();
-
public:
VcxprojGenerator();
~VcxprojGenerator();
protected:
- virtual bool supportsMetaBuild() { return true; }
- virtual bool supportsMergedBuilds() { return true; }
- virtual bool mergeBuildProject(MakefileGenerator *other);
-
- virtual void initProject();
-
- void initConfiguration();
- void initCompilerTool();
- void initDeploymentTool();
- void initLinkerTool();
- void initPreLinkEventTools();
- void initPostBuildEventTools();
- void initRootFiles();
- void initResourceTool();
- void initSourceFiles();
- void initHeaderFiles();
- void initGeneratedFiles();
- void initTranslationFiles();
- void initFormFiles();
- void initResourceFiles();
- void initLexYaccFiles();
- void initExtraCompilerOutputs();
-
- // Used for single project
- VCXProjectSingleConfig vcxProject;
-
- // Holds all configurations for glue (merged) project
- QList<VcxprojGenerator*> mergedProjects;
+ virtual VCProjectWriter *createProjectWriter();
private:
- friend class VCXFilter;
+ friend class VCFilter;
};
diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp
index 947bd23..ef234ec 100644
--- a/qmake/generators/win32/winmakefile.cpp
+++ b/qmake/generators/win32/winmakefile.cpp
@@ -78,8 +78,14 @@ Win32MakefileGenerator::findHighestVersion(const QString &d, const QString &stem
int biggest=-1;
if(!project->isActiveConfig("no_versionlink")) {
- QDir dir(bd);
- QStringList entries = dir.entryList();
+ static QHash<QString, QStringList> dirEntryListCache;
+ QStringList entries = dirEntryListCache.value(bd);
+ if (entries.isEmpty()) {
+ QDir dir(bd);
+ entries = dir.entryList();
+ dirEntryListCache.insert(bd, entries);
+ }
+
QRegExp regx(QString("((lib)?%1([0-9]*)).(%2|prl)$").arg(dllStem).arg(ext), Qt::CaseInsensitive);
for(QStringList::Iterator it = entries.begin(); it != entries.end(); ++it) {
if(regx.exactMatch((*it))) {
@@ -290,6 +296,11 @@ void Win32MakefileGenerator::processVars()
}
project->values("QMAKE_ORIG_TARGET") = project->values("TARGET");
+ if (project->isEmpty("QMAKE_PROJECT_NAME"))
+ project->values("QMAKE_PROJECT_NAME") = project->values("QMAKE_ORIG_TARGET");
+ else if (project->first("TEMPLATE").startsWith("vc"))
+ project->values("MAKEFILE") = project->values("QMAKE_PROJECT_NAME");
+
if (!project->values("QMAKE_INCDIR").isEmpty())
project->values("INCLUDEPATH") += project->values("QMAKE_INCDIR");
@@ -445,6 +456,10 @@ void Win32MakefileGenerator::processRcFileVar()
ts << "\t\t\t\tVALUE \"ProductName\", \"" << productName << "\\0\"" << endl;
ts << "\t\t\tEND" << endl;
ts << "\t\tEND" << endl;
+ ts << "\t\tBLOCK \"VarFileInfo\"" << endl;
+ ts << "\t\tBEGIN" << endl;
+ ts << "\t\t\tVALUE \"Translation\", 0x409, 1200" << endl;
+ ts << "\t\tEND" << endl;
ts << "\tEND" << endl;
ts << "/* End of Version info */" << endl;
ts << endl;
@@ -798,11 +813,6 @@ QString Win32MakefileGenerator::getLibTarget()
return QString(project->first("TARGET") + project->first("TARGET_VERSION_EXT") + ".lib");
}
-QString Win32MakefileGenerator::getPdbTarget()
-{
- return QString(project->first("TARGET") + project->first("TARGET_VERSION_EXT") + ".pdb");
-}
-
QString Win32MakefileGenerator::defaultInstall(const QString &t)
{
if((t != "target" && t != "dlltarget") ||
@@ -831,6 +841,18 @@ QString Win32MakefileGenerator::defaultInstall(const QString &t)
uninst.append("\n\t");
uninst.append("-$(DEL_FILE) \"" + dst_prl + "\"");
}
+ if(project->isActiveConfig("create_pc")) {
+ QString dst_pc = pkgConfigFileName(false);
+ if (!dst_pc.isEmpty()) {
+ dst_pc = filePrefixRoot(root, targetdir + dst_pc);
+ if(!ret.isEmpty())
+ ret += "\n\t";
+ ret += "-$(INSTALL_FILE) \"" + pkgConfigFileName(true) + "\" \"" + dst_pc + "\"";
+ if(!uninst.isEmpty())
+ uninst.append("\n\t");
+ uninst.append("-$(DEL_FILE) \"" + dst_pc + "\"");
+ }
+ }
if(project->isActiveConfig("shared") && !project->isActiveConfig("plugin")) {
QString lib_target = getLibTarget();
lib_target.remove('"');
@@ -843,18 +865,6 @@ QString Win32MakefileGenerator::defaultInstall(const QString &t)
uninst.append("\n\t");
uninst.append("-$(DEL_FILE) \"" + dst_targ + "\"");
}
- if(project->isActiveConfig("shared") && project->isActiveConfig("debug")) {
- QString pdb_target = getPdbTarget();
- pdb_target.remove('"');
- QString src_targ = (project->isEmpty("DESTDIR") ? QString("$(DESTDIR)") : project->first("DESTDIR")) + pdb_target;
- QString dst_targ = filePrefixRoot(root, fileFixify(targetdir + pdb_target, FileFixifyAbsolute));
- if(!ret.isEmpty())
- ret += "\n\t";
- ret += QString("-$(INSTALL_FILE)") + " \"" + src_targ + "\" \"" + dst_targ + "\"";
- if(!uninst.isEmpty())
- uninst.append("\n\t");
- uninst.append("-$(DEL_FILE) \"" + dst_targ + "\"");
- }
}
if(t == "dlltarget" || project->values(t + ".CONFIG").indexOf("no_dll") == -1) {
diff --git a/qmake/generators/win32/winmakefile.h b/qmake/generators/win32/winmakefile.h
index fa3f292..fb11e1a 100644
--- a/qmake/generators/win32/winmakefile.h
+++ b/qmake/generators/win32/winmakefile.h
@@ -83,7 +83,6 @@ protected:
virtual void processRcFileVar();
virtual void processFileTagsVar();
virtual QString getLibTarget();
- virtual QString getPdbTarget();
};
inline Win32MakefileGenerator::~Win32MakefileGenerator()
diff --git a/qmake/option.cpp b/qmake/option.cpp
index e65b35c..1354281 100644
--- a/qmake/option.cpp
+++ b/qmake/option.cpp
@@ -260,6 +260,8 @@ Option::parseCommandLine(int argc, char **argv, int skip)
Option::host_mode = HOST_WIN_MODE;
Option::target_mode = TARG_WIN_MODE;
Option::target_mode_overridden = true;
+ } else if(opt == "integrity") {
+ Option::target_mode = TARG_INTEGRITY_MODE;
} else if(opt == "d") {
Option::debug_level++;
} else if(opt == "version" || opt == "v" || opt == "-version") {
@@ -621,7 +623,7 @@ Option::fixString(QString string, uchar flags)
static QHash<FixStringCacheKey, QString> *cache = 0;
if(!cache) {
cache = new QHash<FixStringCacheKey, QString>;
- qmakeAddCacheClear(qmakeDeleteCacheClear_QHashFixStringCacheKeyQString, (void**)&cache);
+ qmakeAddCacheClear(qmakeDeleteCacheClear<QHash<FixStringCacheKey, QString> >, (void**)&cache);
}
FixStringCacheKey cacheKey(string, flags);
if(cache->contains(cacheKey)) {
diff --git a/qmake/option.h b/qmake/option.h
index 23be12f..bc87343 100644
--- a/qmake/option.h
+++ b/qmake/option.h
@@ -139,6 +139,14 @@ struct Option
return fixString(in, flags);
}
+ inline static bool hasFileExtension(const QString &str, const QStringList &extensions)
+ {
+ foreach (const QString &ext, extensions)
+ if (str.endsWith(ext))
+ return true;
+ return false;
+ }
+
//global qmake mode, can only be in one mode per invocation!
enum QMAKE_MODE { QMAKE_GENERATE_NOTHING, QMAKE_GENERATE_PROJECT, QMAKE_GENERATE_MAKEFILE,
QMAKE_GENERATE_PRL, QMAKE_SET_PROPERTY, QMAKE_QUERY_PROPERTY };
@@ -156,7 +164,7 @@ struct Option
enum HOST_MODE { HOST_UNKNOWN_MODE, HOST_UNIX_MODE, HOST_WIN_MODE, HOST_MACX_MODE };
static HOST_MODE host_mode;
enum TARG_MODE { TARG_UNKNOWN_MODE, TARG_UNIX_MODE, TARG_WIN_MODE, TARG_MACX_MODE,
- TARG_SYMBIAN_MODE };
+ TARG_SYMBIAN_MODE, TARG_INTEGRITY_MODE };
static TARG_MODE target_mode;
static bool target_mode_overridden;
static QString user_template, user_template_prefix;
@@ -195,7 +203,6 @@ private:
inline QString fixEnvVariables(const QString &x) { return Option::fixString(x, Option::FixEnvVars); }
inline QStringList splitPathList(const QString &paths) { return paths.split(Option::dirlist_sep); }
-
// this is a stripped down version of the one found in QtCore
class QLibraryInfo
{
diff --git a/qmake/project.cpp b/qmake/project.cpp
index e985401..815f210 100644
--- a/qmake/project.cpp
+++ b/qmake/project.cpp
@@ -87,7 +87,7 @@ QMap<QString, ExpandFunc> qmake_expandFunctions()
static QMap<QString, ExpandFunc> *qmake_expand_functions = 0;
if(!qmake_expand_functions) {
qmake_expand_functions = new QMap<QString, ExpandFunc>;
- qmakeAddCacheClear(qmakeDeleteCacheClear_QMapStringInt, (void**)&qmake_expand_functions);
+ qmakeAddCacheClear(qmakeDeleteCacheClear<QMap<QString, ExpandFunc> >, (void**)&qmake_expand_functions);
qmake_expand_functions->insert("member", E_MEMBER);
qmake_expand_functions->insert("first", E_FIRST);
qmake_expand_functions->insert("last", E_LAST);
@@ -237,59 +237,56 @@ static QStringList split_arg_list(const QString &params)
const ushort RPAREN = ')';
const ushort SINGLEQUOTE = '\'';
const ushort DOUBLEQUOTE = '"';
+ const ushort BACKSLASH = '\\';
const ushort COMMA = ',';
const ushort SPACE = ' ';
//const ushort TAB = '\t';
- ushort unicode;
const QChar *params_data = params.data();
const int params_len = params.length();
- int last = 0;
- while(last < params_len && (params_data[last].unicode() == SPACE
- /*|| params_data[last].unicode() == TAB*/))
- ++last;
- for(int x = last, parens = 0; x <= params_len; x++) {
- unicode = params_data[x].unicode();
- if(x == params_len) {
- while(x && params_data[x-1].unicode() == SPACE)
- --x;
- QString mid(params_data+last, x-last);
- if(quote) {
- if(mid[0] == quote && mid[(int)mid.length()-1] == quote)
- mid = mid.mid(1, mid.length()-2);
+ for(int last = 0; ;) {
+ while(last < params_len && (params_data[last].unicode() == SPACE
+ /*|| params_data[last].unicode() == TAB*/))
+ ++last;
+ for(int x = last, parens = 0; ; x++) {
+ if(x == params_len) {
+ while(x > last && params_data[x-1].unicode() == SPACE)
+ --x;
+ args << params.mid(last, x - last);
+ // Could do a check for unmatched parens here, but split_value_list()
+ // is called on all our output, so mistakes will be caught anyway.
+ return args;
+ }
+ ushort unicode = params_data[x].unicode();
+ if(x != (int)params_len-1 && unicode == BACKSLASH &&
+ (params_data[x+1].unicode() == SINGLEQUOTE || params_data[x+1].unicode() == DOUBLEQUOTE)) {
+ x++; //get that 'escape'
+ } else if(quote && unicode == quote) {
quote = 0;
+ } else if(!quote && (unicode == SINGLEQUOTE || unicode == DOUBLEQUOTE)) {
+ quote = unicode;
+ } else if(unicode == RPAREN) {
+ --parens;
+ } else if(unicode == LPAREN) {
+ ++parens;
+ }
+ if(!parens && !quote && unicode == COMMA) {
+ int prev = last;
+ last = x+1;
+ while(x > prev && params_data[x-1].unicode() == SPACE)
+ --x;
+ args << params.mid(prev, x - prev);
+ break;
}
- args << mid;
- break;
- }
- if(unicode == LPAREN) {
- --parens;
- } else if(unicode == RPAREN) {
- ++parens;
- } else if(quote && unicode == quote) {
- quote = 0;
- } else if(!quote && (unicode == SINGLEQUOTE || unicode == DOUBLEQUOTE)) {
- quote = unicode;
- }
- if(!parens && !quote && unicode == COMMA) {
- QString mid = params.mid(last, x - last).trimmed();
- args << mid;
- last = x+1;
- while(last < params_len && (params_data[last].unicode() == SPACE
- /*|| params_data[last].unicode() == TAB*/))
- ++last;
}
}
- // Could do a check for unmatched parens here, but split_value_list()
- // is called on all our output, so mistakes will be caught anyway.
- return args;
}
static QStringList split_value_list(const QString &vals)
{
QString build;
QStringList ret;
- QStack<char> quote;
+ ushort quote = 0;
int parens = 0;
const ushort LPAREN = '(';
@@ -306,17 +303,17 @@ static QStringList split_value_list(const QString &vals)
if(x != (int)vals_len-1 && unicode == BACKSLASH &&
(vals_data[x+1].unicode() == SINGLEQUOTE || vals_data[x+1].unicode() == DOUBLEQUOTE)) {
build += vals_data[x++]; //get that 'escape'
- } else if(!quote.isEmpty() && unicode == quote.top()) {
- quote.pop();
- } else if(unicode == SINGLEQUOTE || unicode == DOUBLEQUOTE) {
- quote.push(unicode);
+ } else if(quote && unicode == quote) {
+ quote = 0;
+ } else if(!quote && (unicode == SINGLEQUOTE || unicode == DOUBLEQUOTE)) {
+ quote = unicode;
} else if(unicode == RPAREN) {
--parens;
} else if(unicode == LPAREN) {
++parens;
}
- if(!parens && quote.isEmpty() && (vals_data[x] == Option::field_sep)) {
+ if(!parens && !quote && (vals_data[x] == Option::field_sep)) {
ret << build;
build.clear();
} else {
@@ -1655,7 +1652,7 @@ QMakeProject::doProjectInclude(QString file, uchar flags, QMap<QString, QStringL
static QStringList *feature_roots = 0;
if(!feature_roots) {
feature_roots = new QStringList(qmake_feature_paths(prop));
- qmakeAddCacheClear(qmakeDeleteCacheClear_QStringList, (void**)&feature_roots);
+ qmakeAddCacheClear(qmakeDeleteCacheClear<QStringList>, (void**)&feature_roots);
}
debug_msg(2, "Looking for feature '%s' in (%s)", file.toLatin1().constData(),
feature_roots->join("::").toLatin1().constData());
diff --git a/qmake/qmake.pri b/qmake/qmake.pri
index 3a0ab12..d6c5f09 100644
--- a/qmake/qmake.pri
+++ b/qmake/qmake.pri
@@ -57,6 +57,8 @@ bootstrap { #Qt code
qfile.cpp \
qabstractfileengine.cpp \
qfileinfo.cpp \
+ qfilesystementry.cpp \
+ qfilesystemengine.cpp \
qfsfileengine.cpp \
qfsfileengine_iterator.cpp \
qglobal.cpp \
@@ -80,6 +82,7 @@ bootstrap { #Qt code
quuid.cpp \
qsettings.cpp \
qlibraryinfo.cpp \
+ qsystemerror.cpp \
qvariant.cpp \
qvector.cpp \
qvsnprintf.cpp \
@@ -96,6 +99,7 @@ bootstrap { #Qt code
qdatetime.h \
qdatetime_p.h \
qdir.h \
+ qdir_p.h \
qdiriterator.h \
qfile.h \
qabstractfileengine.h \
@@ -116,6 +120,7 @@ bootstrap { #Qt code
qstring.h \
qstringlist.h \
qstringmatcher.h \
+ qsystemerror_p.h \
qtemporaryfile.h \
qtextstream.h \
qurl.h \
@@ -125,14 +130,15 @@ bootstrap { #Qt code
qxmlutils.h
unix {
- SOURCES += qfsfileengine_unix.cpp qfsfileengine_iterator_unix.cpp
+ SOURCES += qfilesystemengine_unix.cpp qfilesystemiterator_unix.cpp qfsfileengine_unix.cpp
mac {
+ SOURCES += qfilesystemengine_mac.cpp
SOURCES += qcore_mac.cpp qsettings_mac.cpp
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4 #enables weak linking for 10.4 (exported)
LIBS += -framework ApplicationServices
}
} else:win32 {
- SOURCES += qfsfileengine_win.cpp qfsfileengine_iterator_win.cpp qsettings_win.cpp \
+ SOURCES += qfilesystemengine_win.cpp qfsfileengine_win.cpp qfilesystemiterator_win.cpp qsettings_win.cpp \
qsystemlibrary.cpp
win32-msvc*:LIBS += ole32.lib advapi32.lib
win32-g++*:LIBS += -lole32 -luuid -ladvapi32 -lkernel32