diff options
author | Oswald Buddenhagen <oswald.buddenhagen@digia.com> | 2013-03-20 13:46:57 +0100 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@digia.com> | 2013-03-20 13:49:28 +0100 |
commit | 76c0be34cd4ff4564693162fa7528463e23ce9d8 (patch) | |
tree | f165b7bc319548fb0082365411a871028f92e89e /qmake | |
parent | 27b4fe96b59e9e63d1e570e802c072e9afdfb2d4 (diff) | |
parent | 36cb3f3f655a9090c82de609010cbfb88651a0f3 (diff) |
Merge branch 'dev' into stable
This starts Qt 5.1 release cycle
Conflicts:
src/gui/text/qfontdatabase.cpp
src/gui/text/qharfbuzz_copy_p.h
src/widgets/kernel/qapplication.cpp
src/widgets/kernel/qcoreapplication.cpp
Change-Id: I72fbf83ab3c2206aeea1b089428b0fc2a89bd62b
Diffstat (limited to 'qmake')
-rw-r--r-- | qmake/Makefile.unix | 78 | ||||
-rw-r--r-- | qmake/Makefile.win32 | 6 | ||||
-rw-r--r-- | qmake/Makefile.win32-g++ | 160 | ||||
-rw-r--r-- | qmake/generators/mac/pbuilder_pbx.cpp | 648 | ||||
-rw-r--r-- | qmake/generators/makefile.cpp | 9 | ||||
-rw-r--r-- | qmake/generators/makefile.h | 2 | ||||
-rw-r--r-- | qmake/generators/unix/unixmake.cpp | 19 | ||||
-rw-r--r-- | qmake/generators/unix/unixmake2.cpp | 21 | ||||
-rw-r--r-- | qmake/generators/win32/mingw_make.cpp | 4 | ||||
-rw-r--r-- | qmake/generators/win32/mingw_make.h | 2 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_nmake.cpp | 9 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_vcproj.cpp | 4 | ||||
-rw-r--r-- | qmake/library/qmakebuiltins.cpp | 5 | ||||
-rw-r--r-- | qmake/library/qmakeevaluator.cpp | 73 | ||||
-rw-r--r-- | qmake/library/qmakeevaluator_p.h | 1 | ||||
-rw-r--r-- | qmake/library/qmakeglobals.cpp | 1 | ||||
-rw-r--r-- | qmake/library/qmakeparser.cpp | 29 | ||||
-rw-r--r-- | qmake/main.cpp | 5 | ||||
-rw-r--r-- | qmake/qmake.pri | 1 |
19 files changed, 465 insertions, 612 deletions
diff --git a/qmake/Makefile.unix b/qmake/Makefile.unix index c8ac221293..7293f4c869 100644 --- a/qmake/Makefile.unix +++ b/qmake/Makefile.unix @@ -1,11 +1,3 @@ -SOURCE_PATH = @SOURCE_PATH@ -BUILD_PATH = @BUILD_PATH@ -QT_VERSION = @QT_VERSION@ -QTOBJS = @QMAKE_QTOBJS@ -QTSRCS = @QMAKE_QTSRCS@ -QMAKESPEC = @QMAKESPEC@ -LFLAGS = @QMAKE_LFLAGS@ - QMKSRC = $(SOURCE_PATH)/qmake QMKLIBSRC = $(QMKSRC)/library QMKGENSRC = $(QMKSRC)/generators @@ -22,18 +14,14 @@ OBJS=project.o option.o property.o main.o ioutils.o proitems.o \ #qt code QOBJS=qtextcodec.o qutfcodec.o qstring.o qstringbuilder.o qtextstream.o qiodevice.o qmalloc.o qglobal.o \ qarraydata.o qbytearray.o qbytearraymatcher.o qdatastream.o qbuffer.o qlist.o qfiledevice.o qfile.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 qsystemerror.o qlibraryinfo.o qvariant.o qvsnprintf.o \ - qlocale.o qlocale_tools.o qlocale_unix.o qlinkedlist.o qnumeric.o qcryptographichash.o \ - qxmlstream.o qxmlutils.o qlogging.o \ + qfilesystementry.o qfilesystemengine.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 qsystemerror.o qlibraryinfo.o \ + qvariant.o qvsnprintf.o qlocale.o qlocale_tools.o qlinkedlist.o qnumeric.o \ + qcryptographichash.o qxmlstream.o qxmlutils.o qlogging.o \ $(QTOBJS) - - #all sources, used for the depend target DEPEND_SRC = \ $(QMKSRC)/main.cpp $(QMKSRC)/project.cpp $(QMKSRC)/option.cpp $(QMKSRC)/property.cpp \ @@ -58,10 +46,15 @@ DEPEND_SRC = \ $(SOURCE_PATH)/src/corelib/tools/qarraydata.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/qfilesystementry.cpp \ + $(SOURCE_PATH)/src/corelib/io/qfilesystemengine_unix.cpp \ + $(SOURCE_PATH)/src/corelib/io/qfilesystemengine_win.cpp \ + $(SOURCE_PATH)/src/corelib/io/qfilesystemengine.cpp \ + $(SOURCE_PATH)/src/corelib/io/qfilesystemiterator_unix.cpp \ + $(SOURCE_PATH)/src/corelib/io/qfilesystemiterator_win.cpp \ + $(SOURCE_PATH)/src/corelib/io/qfsfileengine_unix.cpp \ + $(SOURCE_PATH)/src/corelib/io/qfsfileengine_win.cpp \ + $(SOURCE_PATH)/src/corelib/io/qabstractfileengine.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 \ @@ -74,6 +67,7 @@ DEPEND_SRC = \ $(SOURCE_PATH)/src/corelib/tools/qlocale.cpp \ $(SOURCE_PATH)/src/corelib/tools/qlocale_tools.cpp \ $(SOURCE_PATH)/src/corelib/tools/qlocale_unix.cpp \ + $(SOURCE_PATH)/src/corelib/tools/qlocale_win.cpp \ $(SOURCE_PATH)/src/corelib/tools/qlinkedlist.cpp \ $(SOURCE_PATH)/src/corelib/tools/qhash.cpp $(SOURCE_PATH)/src/corelib/kernel/qcore_mac.cpp \ $(SOURCE_PATH)/src/corelib/io/qtemporaryfile.cpp $(SOURCE_PATH)/src/corelib/kernel/qmetatype.cpp \ @@ -84,9 +78,11 @@ DEPEND_SRC = \ $(SOURCE_PATH)/src/corelib/xml/qxmlutils.cpp \ $(SOURCE_PATH)/src/corelib/kernel/qsystemerror.cpp \ $(SOURCE_PATH)/src/corelib/global/qlogging.cpp \ + $(SOURCE_PATH)/src/corelib/plugin/qsystemlibrary.cpp \ + $(SOURCE_PATH)/tools/shared/windows/registry.cpp \ $(QTSRCS) -CPPFLAGS = -g $(OPENSOURCE_CXXFLAGS) \ +CPPFLAGS = -g $(EXTRA_CPPFLAGS) \ -I$(QMKSRC) -I$(QMKLIBSRC) -I$(QMKSRC)/generators -I$(QMKSRC)/generators/unix -I$(QMKSRC)/generators/win32 \ -I$(QMKSRC)/generators/mac -I$(QMKSRC)/generators/integrity \ -I$(BUILD_PATH)/include -I$(BUILD_PATH)/include/QtCore \ @@ -98,19 +94,23 @@ CPPFLAGS = -g $(OPENSOURCE_CXXFLAGS) \ -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_COMPRESS \ -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM -CXXFLAGS = @QMAKE_CXXFLAGS@ $(CPPFLAGS) +CXXFLAGS = $(EXTRA_CXXFLAGS) $(CPPFLAGS) -first all: $(BUILD_PATH)/bin/qmake -qmake: $(BUILD_PATH)/bin/qmake +first all: $(BUILD_PATH)/bin/qmake$(EXEEXT) +qmake: $(BUILD_PATH)/bin/qmake$(EXEEXT) -$(BUILD_PATH)/bin/qmake: $(OBJS) $(QOBJS) +$(BUILD_PATH)/bin/qmake$(EXEEXT): $(OBJS) $(QOBJS) $(CXX) -o "$@" $(OBJS) $(QOBJS) $(LFLAGS) +Makefile: $(SOURCE_PATH)/qmake/Makefile.unix + @echo "Out of date, please rerun configure" + clean:: - rm -f $(OBJS) $(QOBJS) + $(RM_F) $(OBJS) $(QOBJS) distclean:: clean - rm -rf $(BUILD_PATH)/bin/qmake .deps + $(RM_RF) .deps + $(RM_F) $(BUILD_PATH)/bin/qmake$(EXEEXT) depend: makedepend -D__MAKEDEPEND__ $(CPPFLAGS) $(DEPEND_SRC) @@ -222,6 +222,9 @@ qnumeric.o: $(SOURCE_PATH)/src/corelib/global/qnumeric.cpp qsettings_mac.o: $(SOURCE_PATH)/src/corelib/io/qsettings_mac.cpp $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qsettings_mac.cpp +qsettings_win.o: $(SOURCE_PATH)/src/corelib/io/qsettings_win.cpp + $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qsettings_win.cpp + qiodevice.o: $(SOURCE_PATH)/src/corelib/io/qiodevice.cpp $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qiodevice.cpp @@ -270,6 +273,9 @@ qlocale_tools.o: $(SOURCE_PATH)/src/corelib/tools/qlocale_tools.cpp qlocale_unix.o: $(SOURCE_PATH)/src/corelib/tools/qlocale_unix.cpp $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qlocale_unix.cpp +qlocale_win.o: $(SOURCE_PATH)/src/corelib/tools/qlocale_win.cpp + $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qlocale_win.cpp + qdatastream.o: $(SOURCE_PATH)/src/corelib/io/qdatastream.cpp $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qdatastream.cpp @@ -294,12 +300,15 @@ qfilesystemengine.o: $(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 +qfilesystemengine_win.o: $(SOURCE_PATH)/src/corelib/io/qfilesystemengine_win.cpp + $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfilesystemengine_win.cpp qfilesystemiterator_unix.o: $(SOURCE_PATH)/src/corelib/io/qfilesystemiterator_unix.cpp $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfilesystemiterator_unix.cpp +qfilesystemiterator_win.o: $(SOURCE_PATH)/src/corelib/io/qfilesystemiterator_win.cpp + $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfilesystemiterator_win.cpp + qfsfileengine.o: $(SOURCE_PATH)/src/corelib/io/qfsfileengine.cpp $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfsfileengine.cpp @@ -309,6 +318,9 @@ 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_win.o: $(SOURCE_PATH)/src/corelib/io/qfsfileengine_win.cpp + $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfsfileengine_win.cpp + qabstractfileengine.o: $(SOURCE_PATH)/src/corelib/io/qabstractfileengine.cpp $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qabstractfileengine.cpp @@ -363,4 +375,10 @@ qxmlutils.o: $(SOURCE_PATH)/src/corelib/xml/qxmlutils.cpp qlogging.o: $(SOURCE_PATH)/src/corelib/global/qlogging.cpp $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/global/qlogging.cpp +qsystemlibrary.o: $(SOURCE_PATH)/src/corelib/plugin/qsystemlibrary.cpp + $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/plugin/qsystemlibrary.cpp + +registry.o: $(SOURCE_PATH)/tools/shared/windows/registry.cpp + $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/tools/shared/windows/registry.cpp + # DO NOT DELETE THIS LINE -- make depend depends on it diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32 index 222acfa9a6..63cdf50563 100644 --- a/qmake/Makefile.win32 +++ b/qmake/Makefile.win32 @@ -42,7 +42,7 @@ CFLAGS_BARE = -c -Fo./ \ -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_COMPRESS \ -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM \ -DUNICODE -CFLAGS = -Yuqmake_pch.h -FIqmake_pch.h -Fpqmake_pch.pch $(CFLAGS_BARE) $(CFLAGS) +CFLAGS = -Yuqmake_pch.h -FIqmake_pch.h -Fpqmake_pch.pch $(CFLAGS_BARE) $(CFLAGS) $(EXTRA_CPPFLAGS) CXXFLAGS_BARE = $(CFLAGS_BARE) CXXFLAGS = $(CFLAGS) @@ -66,10 +66,6 @@ OBJS = project.obj main.obj ioutils.obj proitems.obj \ msvc_objectmodel.obj msbuild_objectmodel.obj registry.obj \ gbuild.obj cesdkhandler.obj -!IFDEF QMAKE_OPENSOURCE_EDITION -CFLAGS = $(CFLAGS) -DQMAKE_OPENSOURCE_EDITION -!ENDIF - #qt code QTOBJS= \ qbitarray.obj \ diff --git a/qmake/Makefile.win32-g++ b/qmake/Makefile.win32-g++ deleted file mode 100644 index 565d5d2d51..0000000000 --- a/qmake/Makefile.win32-g++ +++ /dev/null @@ -1,160 +0,0 @@ -ifeq "$(SOURCE_PATH)" "" -SOURCE_PATH = .. -endif - -ifeq "$(BUILD_PATH)" "" -BUILD_PATH = .. -endif - -CORESRC = $(SOURCE_PATH)/src/corelib -TOOLSRC = $(SOURCE_PATH)/tools -QMKSRC = $(SOURCE_PATH)/qmake -QMKLIBSRC = $(QMKSRC)/library - -# SHELL is the full path of sh.exe, unless -# 1) it is found in the current directory -# 2) it is not found at all -# 3) it is overridden on the command line with an existing file -# ... otherwise it is always sh.exe. Specifically, SHELL from the -# environment has no effect. -# -# This check will fail if SHELL is explicitly set to a not -# sh-compatible shell. This is not a problem, because configure.exe -# will not do that. -ifeq ($(SHELL), sh.exe) - ifeq ($(wildcard $(CURDIR)/sh.exe), ) - SH = 0 - else - SH = 1 - endif -else - SH = 1 -endif - -ifeq ($(SH), 1) - COPY = cp - DEL = rm -f -else - COPY = copy - DEL = del /f -endif - -# -# specific stuff for mingw g++ make -# -CXX = g++ -CFLAGS = -c -o$@ -O \ - -I$(QMKSRC) -I$(QMKLIBSRC) -I$(QMKSRC)/generators -I$(QMKSRC)/generators/unix -I$(QMKSRC)/generators/win32 -I$(QMKSRC)/generators/mac -I$(QMKSRC)/generators/integrity \ - -I$(BUILD_PATH)/include -I$(BUILD_PATH)/include/QtCore -I$(BUILD_PATH)/include/QtCore/$(QT_VERSION) -I$(BUILD_PATH)/include/QtCore/$(QT_VERSION)/QtCore \ - -I$(BUILD_PATH)/src/corelib/global -DHAVE_QCONFIG_CPP \ - -I$(SOURCE_PATH)/mkspecs/win32-g++ \ - -I$(SOURCE_PATH)/tools/shared \ - -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DPROEVALUATOR_FULL -DPROEVALUATOR_DEBUG \ - -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_COMPRESS \ - -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM \ - -DUNICODE -CXXFLAGS = $(CFLAGS) -LFLAGS = -static -s -LIBS = -lole32 -luuid -ladvapi32 -lkernel32 -LINKQMAKE = g++ $(LFLAGS) -o qmake.exe $(OBJS) $(QTOBJS) $(LIBS) -ADDCLEAN = - - -#qmake code -OBJS = project.o main.o ioutils.o proitems.o \ - qmakeglobals.o qmakeparser.o qmakeevaluator.o qmakebuiltins.o \ - makefile.o unixmake.o unixmake2.o mingw_make.o \ - option.o winmakefile.o projectgenerator.o property.o meta.o \ - makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o \ - msvc_nmake.o msvc_vcproj.o msvc_vcxproj.o \ - msvc_objectmodel.o msbuild_objectmodel.o registry.o gbuild.o \ - cesdkhandler.o - -ifdef QMAKE_OPENSOURCE_EDITION -CFLAGS += -DQMAKE_OPENSOURCE_EDITION -endif - -#qt code -QTOBJS= \ - qbitarray.o \ - qbuffer.o \ - qarraydata.o \ - qbytearray.o \ - qcryptographichash.o \ - qvsnprintf.o \ - qbytearraymatcher.o \ - qconfig.o \ - qdatetime.o \ - qdir.o \ - qdiriterator.o \ - qfiledevice.o \ - qfile.o \ - qtemporaryfile.o \ - qfileinfo.o \ - qabstractfileengine.o \ - qfilesystementry.o \ - qfilesystemengine.o \ - qfilesystemengine_win.o \ - qfilesystemiterator_win.o \ - qfsfileengine.o \ - qfsfileengine_iterator.o \ - qfsfileengine_win.o \ - qglobal.o \ - qhash.o \ - qiodevice.o \ - qlibraryinfo.o \ - qlist.o \ - qlinkedlist.o \ - qlocale.o \ - qlocale_tools.o \ - qlocale_win.o \ - qmalloc.o \ - qmap.o \ - qregexp.o \ - qtextcodec.o \ - qutfcodec.o \ - qstring.o \ - qstringlist.o \ - qstringbuilder.o \ - qsystemerror.o \ - qsystemlibrary.o \ - qtextstream.o \ - quuid.o \ - qvector.o \ - qsettings.o \ - qsettings_win.o \ - qvariant.o \ - qmetatype.o \ - qxmlstream.o \ - qxmlutils.o \ - qnumeric.o \ - qlogging.o - - -qmake.exe: $(OBJS) $(QTOBJS) - $(LINKQMAKE) - -$(COPY) qmake.exe $(BUILD_PATH)\bin\qmake.exe - -Makefile: $(SOURCE_PATH)/qmake/Makefile.win32-g++ - @echo "Out of date, please rerun configure" - -clean:: - -$(DEL) $(OBJS) $(QTOBJS) $(ADDCLEAN) - -distclean:: clean - -$(DEL) qmake.exe - -.c.o: - $(CXX) $(CFLAGS) $< - -.cpp.o: - $(CXX) $(CXXFLAGS) $< - -QTVPATH = $(TOOLSRC)/shared/windows:$(CORESRC)/global:$(CORESRC)/kernel:$(CORESRC)/tools:$(CORESRC)/codecs:$(CORESRC)/io:$(CORESRC)/xml:$(CORESRC)/plugin:$(BUILD_PATH)/src/corelib/global -VPATH = $(QMKSRC):$(QMKLIBSRC):$(QMKSRC)/generators:$(QMKSRC)/generators/unix:$(QMKSRC)/generators/mac:$(QMKSRC)/generators/win32:$(QMKSRC)/generators/integrity:$(QTVPATH) - -project.o: $(QMKSRC)/project.h $(QMKSRC)/option.h -meta.o: $(QMKSRC)/project.h $(QMKSRC)/option.h -main.o: $(QMKSRC)/project.h -option.o: $(QMKSRC)/option.h -property.o: $(QMKSRC)/project.h $(QMKSRC)/option.h diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index c5b2c56f8f..6b23cbe42e 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -46,6 +46,7 @@ #include <qregexp.h> #include <qcryptographichash.h> #include <qdebug.h> +#include <qstring.h> #include <stdlib.h> #include <time.h> #ifdef Q_OS_UNIX @@ -222,7 +223,6 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t) << "\t\t\t" << writeSettings("lastKnownFileType", "wrapper.pb-project") << ";" << "\n" << "\t\t\t" << writeSettings("name", escapeFilePath(tmp_proj.first("TARGET") + projectSuffix())) << ";" << "\n" << "\t\t\t" << writeSettings("path", pbxproj) << ";" << "\n" - << "\t\t\t" << writeSettings("refType", "0", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("sourceTree", "<absolute>") << ";" << "\n" << "\t\t" << "};" << "\n"; //WRAPPER @@ -235,8 +235,7 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t) t << "\t\t\t" << writeSettings("fileType", "compiled.mach-o.dylib") << ";" << "\n" << "\t\t\t" << writeSettings("path", tmp_proj.first("TARGET") + ".dylib") << ";" << "\n"; } - t << "\t\t\t" << writeSettings("refType", "3", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("remoteRef", keyFor(pbxproj + "_WRAPPERREF")) << ";" << "\n" + t << "\t\t\t" << writeSettings("remoteRef", keyFor(pbxproj + "_WRAPPERREF")) << ";" << "\n" << "\t\t\t" << writeSettings("sourceTree", "BUILT_PRODUCTS_DIR", SettingsNoQuote) << ";" << "\n" << "\t\t" << "};" << "\n"; t << "\t\t" << keyFor(pbxproj + "_WRAPPERREF") << " = {" << "\n" @@ -252,7 +251,6 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t) << "\t\t\t" << writeSettings("children", project->values(ProKey(pbxproj + "_WRAPPER")), SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("isa", "PBXGroup", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("name", "Products") << ";" << "\n" - << "\t\t\t" << writeSettings("refType", "4", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("sourceTree", "<group>") << ";" << "\n" << "\t\t" << "};" << "\n"; } @@ -291,14 +289,13 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t) << "\t\t\t" << writeSettings("isa", "PBXGroup", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("children", grp_it.value(), SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("name", escapeFilePath(grp_it.key().section(Option::dir_sep, -1))) << ";" << "\n" - << "\t\t\t" << writeSettings("refType", "4", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("sourceTree", "<Group>") << ";" << "\n" << "\t\t" << "};" << "\n"; } //DUMP EVERYTHING THAT TIES THE ABOVE TOGETHER - //BUILDSTYLE - QString active_buildstyle; + //BUILDCONFIGURATIONS + QString defaultConfig; for(int as_release = 0; as_release < 2; as_release++) { QMap<QString, QString> settings; @@ -320,6 +317,8 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t) } QString name = (as_release ? "Release" : "Debug"); + if (project->isActiveConfig("debug") != (bool)as_release) + defaultConfig = name; QString key = keyFor("QMAKE_SUBDIR_PBX_BUILDCONFIG_" + name); project->values("QMAKE_SUBDIR_PBX_BUILDCONFIGS").append(key); t << "\t\t" << key << " = {" << "\n" @@ -330,26 +329,12 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t) t << "\t\t\t" << "};" << "\n" << "\t\t\t" << writeSettings("name", name) << ";" << "\n" << "\t\t" << "};" << "\n"; - - key = keyFor("QMAKE_SUBDIR_PBX_BUILDSTYLE_" + name); - project->values("QMAKE_SUBDIR_PBX_BUILDSTYLES").append(key); - if (project->isActiveConfig("debug") != (bool)as_release) - active_buildstyle = name; - t << "\t\t" << key << " = {" << "\n" - << "\t\t\t" << writeSettings("buildRules", ProStringList(), SettingsAsList, 4) << ";" << "\n" - << "\t\t\t" << "buildSettings = {" << "\n"; - for(QMap<QString, QString>::Iterator set_it = settings.begin(); set_it != settings.end(); ++set_it) - t << "\t\t\t\t" << writeSettings(set_it.key(), set_it.value()) << ";\n"; - t << "\t\t\t" << "};" << "\n" - << "\t\t\t" << writeSettings("isa", "PBXBuildStyle", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("name", name) << ";" << "\n" - << "\t\t" << "};" << "\n"; } t << "\t\t" << keyFor("QMAKE_SUBDIR_PBX_BUILDCONFIG_LIST") << " = {" << "\n" << "\t\t\t" << writeSettings("isa", "XCConfigurationList", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("buildConfigurations", project->values("QMAKE_SUBDIR_PBX_BUILDCONFIGS"), SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("defaultConfigurationIsVisible", "0", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("defaultConfigurationIsName", active_buildstyle) << ";" << "\n" + << "\t\t\t" << writeSettings("defaultConfigurationName", defaultConfig, SettingsNoQuote) << ";" << "\n" << "\t\t" << "};" << "\n"; #ifdef GENERATE_AGGREGRATE_SUBDIR @@ -376,7 +361,6 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t) t << "\t\t" << keyFor("QMAKE_SUBDIR_PBX_ROOT_GROUP") << " = {" << "\n" << "\t\t\t" << writeSettings("children", project->values("QMAKE_SUBDIR_PBX_GROUPS"), SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("isa", "PBXGroup", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("refType", "4", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("sourceTree", "<group>") << ";" << "\n" << "\t\t" << "};" << "\n"; @@ -451,18 +435,17 @@ public: ProjectBuilderSources::ProjectBuilderSources(const QString &k, bool b, const QString &g, const QString &c, bool o) : buildable(b), object_output(o), key(k), group(g), compiler(c) { - if(group.isNull()) { - if(k == "SOURCES") - group = "Sources"; - else if(k == "HEADERS") - group = "Headers"; - else if(k == "QMAKE_INTERNAL_INCLUDED_FILES") - group = "Sources [qmake]"; - else if(k == "GENERATED_SOURCES" || k == "GENERATED_FILES") - group = "Temporary Sources"; - else - fprintf(stderr, "No group available for %s!\n", k.toLatin1().constData()); - } + // Override group name for a few common keys + if (k == "SOURCES" || k == "OBJECTIVE_SOURCES" || k == "HEADERS") + group = "Sources"; + else if (k == "QMAKE_INTERNAL_INCLUDED_FILES") + group = "Supporting Files"; + else if (k == "GENERATED_SOURCES" || k == "GENERATED_FILES") + group = "Generated Sources"; + else if (k == "RESOURCES") + group = "Resources"; + else if (group.isNull()) + group = QString("Sources [") + c + "]"; } QStringList @@ -470,7 +453,6 @@ ProjectBuilderSources::files(QMakeProject *project) const { QStringList ret = project->values(ProKey(key)).toQStringList(); if(key == "QMAKE_INTERNAL_INCLUDED_FILES") { - ret.prepend(project->projectFile()); for(int i = 0; i < ret.size(); ++i) { QStringList newret; if(!ret.at(i).endsWith(Option::prf_ext)) @@ -483,10 +465,48 @@ ProjectBuilderSources::files(QMakeProject *project) const return ret; } +static QString xcodeFiletypeForFilename(const QString &filename) +{ + foreach (const QString &ext, Option::cpp_ext) { + if (filename.endsWith(ext)) + return QStringLiteral("sourcecode.cpp.cpp"); + } + + foreach (const QString &ext, Option::c_ext) { + if (filename.endsWith(ext)) + return QStringLiteral("sourcecode.c.c"); + } + + foreach (const QString &ext, Option::h_ext) { + if (filename.endsWith(ext)) + return "sourcecode.c.h"; + } + + if (filename.endsWith(QStringLiteral(".mm"))) + return QStringLiteral("sourcecode.cpp.objcpp"); + if (filename.endsWith(QStringLiteral(".m"))) + return QStringLiteral("sourcecode.c.objc"); + if (filename.endsWith(QStringLiteral(".framework"))) + return QStringLiteral("wrapper.framework"); + if (filename.endsWith(QStringLiteral(".a"))) + return QStringLiteral("archive.ar"); + if (filename.endsWith(QStringLiteral(".pro")) || filename.endsWith(QStringLiteral(".qrc"))) + return QStringLiteral("text"); + + return QString(); +} bool ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) { + // The code in this function assumes that the current directory matches + // the output directory, which is not actually the case when we are called + // from the generic generator code. Instead of changing every single + // assumption and fileFixify we cheat by moving into the output directory + // for the duration of this function. + QString input_dir = qmake_getpwd(); + qmake_setpwd(Option::output_dir); + ProStringList tmp; bool did_preprocess = false; @@ -508,6 +528,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) QFile mkf(mkfile); if(mkf.open(QIODevice::WriteOnly | QIODevice::Text)) { writingUnixMakefileGenerator = true; + qmake_setpwd(input_dir); // Makefile generation assumes input_dir as pwd debug_msg(1, "pbuilder: Creating file: %s", mkfile.toLatin1().constData()); QTextStream mkt(&mkf); writeHeader(mkt); @@ -516,6 +537,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) mkt.flush(); mkf.close(); writingUnixMakefileGenerator = false; + qmake_setpwd(Option::output_dir); } QString phase_key = keyFor("QMAKE_PBX_MAKEQMAKE_BUILDPHASE"); mkfile = fileFixify(mkfile, qmake_getpwd()); @@ -523,15 +545,18 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) t << "\t\t" << phase_key << " = {" << "\n" << "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("files", ProStringList(), SettingsAsList, 4) << ";" << "\n" - << "\t\t\t" << writeSettings("generatedFileNames", ProStringList(), SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("isa", "PBXShellScriptBuildPhase", SettingsNoQuote) << ";" << "\n" + << "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("name", "Qt Qmake") << ";" << "\n" - << "\t\t\t" << writeSettings("neededFileNames", ProStringList(), SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("shellPath", "/bin/sh") << ";" << "\n" << "\t\t\t" << writeSettings("shellScript", "make -C " + IoUtils::shellQuoteUnix(qmake_getpwd()) + " -f " + IoUtils::shellQuoteUnix(mkfile)) << ";" << "\n" << "\t\t" << "};" << "\n"; } + // FIXME: Move all file resolving logic out of ProjectBuilderSources::files(), as it + // doesn't have access to any of the information it needs to resolve relative paths. + project->values("QMAKE_INTERNAL_INCLUDED_FILES").prepend(fileFixify(project->projectFile(), qmake_getpwd(), input_dir)); + //DUMP SOURCES QMap<QString, ProStringList> groups; QList<ProjectBuilderSources> sources; @@ -545,14 +570,13 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) for (ProStringList::ConstIterator it = quc.begin(); it != quc.end(); ++it) { if (project->isEmpty(ProKey(*it + ".output"))) continue; - ProString name = *it; - const ProKey nkey(*it + ".name"); - if (!project->isEmpty(nkey)) - name = project->first(nkey); - const ProStringList &inputs = project->values(ProKey(*it + ".input")); - for(int input = 0; input < inputs.size(); ++input) { - if (project->isEmpty(inputs.at(input).toKey())) + ProStringList &inputs = project->values(ProKey(*it + ".input")); + int input = 0; + while (input < inputs.size()) { + if (project->isEmpty(inputs.at(input).toKey())) { + ++input; continue; + } bool duplicate = false; bool isObj = project->values(ProKey(*it + ".CONFIG")).indexOf("no_link") == -1; if (!isObj) { @@ -572,8 +596,15 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) } } sources.append(ProjectBuilderSources(inputs.at(input).toQString(), true, - QString("Sources [") + name + "]", (*it).toQString(), isObj)); + QString(), (*it).toQString(), isObj)); + + if (isObj) { + inputs.removeAt(input); + continue; + } } + + ++input; } } } @@ -618,30 +649,29 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) } last_grp = new_grp; } + if (groups[last_grp].contains(src_key)) + continue; groups[last_grp] += src_key; in_root = false; } } - if(in_root) + if (in_root) { + if (src_list.contains(src_key)) + continue; src_list.append(src_key); + } //source reference t << "\t\t" << src_key << " = {" << "\n" << "\t\t\t" << writeSettings("isa", "PBXFileReference", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("name", escapeFilePath(name)) << ";" << "\n" - << "\t\t\t" << writeSettings("path", escapeFilePath(file)) << ";" << "\n" - << "\t\t\t" << writeSettings("refType", QString::number(reftypeForFile(file)), SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("sourceTree", sourceTreeForFile(file)) << ";" << "\n"; - QString filetype; - for (QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) { - if (file.endsWith((*cppit))) { - filetype = "sourcecode.cpp.cpp"; - break; - } - } + << "\t\t\t" << writeSettings("path", escapeFilePath(file)) << ";" << "\n"; + if (name != file) + t << "\t\t\t" << writeSettings("name", escapeFilePath(name)) << ";" << "\n"; + t << "\t\t\t" << writeSettings("sourceTree", sourceTreeForFile(file)) << ";" << "\n"; + QString filetype = xcodeFiletypeForFilename(file); if (!filetype.isNull()) t << "\t\t\t" << writeSettings("lastKnownFileType", filetype) << ";" << "\n"; t << "\t\t" << "};" << "\n"; - if(sources.at(source).isBuildable()) { //build reference + if (sources.at(source).isBuildable() && sources.at(source).isObjectOutput(file)) { //build reference QString build_key = keyFor(file + ".BUILDABLE"); t << "\t\t" << build_key << " = {" << "\n" << "\t\t\t" << writeSettings("fileRef", src_key) << ";" << "\n" @@ -650,8 +680,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) << "\t\t\t\t" << writeSettings("ATTRIBUTES", ProStringList(), SettingsAsList, 5) << ";" << "\n" << "\t\t\t" << "};" << "\n" << "\t\t" << "};" << "\n"; - if(sources.at(source).isObjectOutput(file)) - project->values("QMAKE_PBX_OBJ").append(build_key); + project->values("QMAKE_PBX_OBJ").append(build_key); } } if(!src_list.isEmpty()) { @@ -671,7 +700,6 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) << "\t\t\t" << writeSettings("isa", "PBXGroup", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("children", grp_it.value(), SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("name", escapeFilePath(grp_it.key().section(Option::dir_sep, -1))) << ";" << "\n" - << "\t\t\t" << writeSettings("refType", "4", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("sourceTree", "<Group>") << ";" << "\n" << "\t\t" << "};" << "\n"; } @@ -775,10 +803,9 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) t << "\t\t" << phase_key << " = {" << "\n" << "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("files", ProStringList(), SettingsAsList, 4) << ";" << "\n" - << "\t\t\t" << writeSettings("generatedFileNames", fixListForOutput("QMAKE_PBX_OBJ"), SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("isa", "PBXShellScriptBuildPhase", SettingsNoQuote) << ";" << "\n" + << "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("name", "Qt Preprocessors") << ";" << "\n" - << "\t\t\t" << writeSettings("neededFileNames", fixListForOutput("QMAKE_PBX_OBJ"), SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("shellPath", "/bin/sh") << ";" << "\n" << "\t\t\t" << writeSettings("shellScript", "make -C " + IoUtils::shellQuoteUnix(qmake_getpwd()) + " -f " + IoUtils::shellQuoteUnix(mkfile)) << ";" << "\n" << "\t\t" << "};" << "\n"; @@ -786,12 +813,13 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) //SOURCE BUILDPHASE if(!project->isEmpty("QMAKE_PBX_OBJ")) { - QString grp = "Build Sources", key = keyFor(grp); + QString grp = "Compile Sources", key = keyFor(grp); project->values("QMAKE_PBX_BUILDPHASES").append(key); t << "\t\t" << key << " = {" << "\n" << "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("files", fixListForOutput("QMAKE_PBX_OBJ"), SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("isa", "PBXSourcesBuildPhase", SettingsNoQuote) << ";" << "\n" + << "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("name", grp) << ";" << "\n" << "\t\t" << "};" << "\n"; } @@ -899,26 +927,29 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) libdirs += path; } library = fileFixify(library); + QString filetype = xcodeFiletypeForFilename(library); QString key = keyFor(library); - bool is_frmwrk = (library.endsWith(".framework")); - t << "\t\t" << key << " = {" << "\n" - << "\t\t\t" << writeSettings("isa", "PBXFileReference", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("name", escapeFilePath(name)) << ";" << "\n" - << "\t\t\t" << writeSettings("path", escapeFilePath(library)) << ";" << "\n" - << "\t\t\t" << writeSettings("refType", QString::number(reftypeForFile(library)), SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("sourceTree", sourceTreeForFile(library)) << ";" << "\n"; - if (is_frmwrk) - t << "\t\t\t" << writeSettings("lastKnownFileType", "wrapper.framework") << ";" << "\n"; - t << "\t\t" << "};" << "\n"; - project->values("QMAKE_PBX_LIBRARIES").append(key); - QString build_key = keyFor(library + ".BUILDABLE"); - t << "\t\t" << build_key << " = {" << "\n" - << "\t\t\t" << writeSettings("fileRef", key) << ";" << "\n" - << "\t\t\t" << writeSettings("isa", "PBXBuildFile", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << "settings = {" << "\n" - << "\t\t\t" << "};" << "\n" - << "\t\t" << "};" << "\n"; - project->values("QMAKE_PBX_BUILD_LIBRARIES").append(build_key); + if (!project->values("QMAKE_PBX_LIBRARIES").contains(key)) { + bool is_frmwrk = (library.endsWith(".framework")); + t << "\t\t" << key << " = {" << "\n" + << "\t\t\t" << writeSettings("isa", "PBXFileReference", SettingsNoQuote) << ";" << "\n" + << "\t\t\t" << writeSettings("name", escapeFilePath(name)) << ";" << "\n" + << "\t\t\t" << writeSettings("path", escapeFilePath(library)) << ";" << "\n" + << "\t\t\t" << writeSettings("refType", QString::number(reftypeForFile(library)), SettingsNoQuote) << ";" << "\n" + << "\t\t\t" << writeSettings("sourceTree", sourceTreeForFile(library)) << ";" << "\n"; + if (is_frmwrk) + t << "\t\t\t" << writeSettings("lastKnownFileType", "wrapper.framework") << ";" << "\n"; + t << "\t\t" << "};" << "\n"; + project->values("QMAKE_PBX_LIBRARIES").append(key); + QString build_key = keyFor(library + ".BUILDABLE"); + t << "\t\t" << build_key << " = {" << "\n" + << "\t\t\t" << writeSettings("fileRef", key) << ";" << "\n" + << "\t\t\t" << writeSettings("isa", "PBXBuildFile", SettingsNoQuote) << ";" << "\n" + << "\t\t\t" << "settings = {" << "\n" + << "\t\t\t" << "};" << "\n" + << "\t\t" << "};" << "\n"; + project->values("QMAKE_PBX_BUILD_LIBRARIES").append(build_key); + } } if(remove) tmp.removeAt(x); @@ -957,10 +988,9 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) t << "\t\t" << phase_key << " = {" << "\n" << "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("files", ProStringList(), SettingsAsList, 4) << ";" << "\n" - << "\t\t\t" << writeSettings("generatedFileNames", ProStringList(), SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("isa", "PBXShellScriptBuildPhase", SettingsNoQuote) << ";" << "\n" + << "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("name", "Qt Sublibs") << ";" << "\n" - << "\t\t\t" << writeSettings("neededFileNames", ProStringList(), SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("shellPath", "/bin/sh") << "\n" << "\t\t\t" << writeSettings("shellScript", "make -C " + IoUtils::shellQuoteUnix(qmake_getpwd()) + " -f " + IoUtils::shellQuoteUnix(mkfile)) << ";" << "\n" << "\t\t" << "};" << "\n"; @@ -969,42 +999,24 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) if(!project->isEmpty("QMAKE_PBX_LIBRARIES")) { tmp = project->values("QMAKE_PBX_LIBRARIES"); if(!tmp.isEmpty()) { - QString grp("External Frameworks and Libraries"), key = keyFor(grp); + QString grp("Frameworks"), key = keyFor(grp); project->values("QMAKE_PBX_GROUPS").append(key); t << "\t\t" << key << " = {" << "\n" << "\t\t\t" << writeSettings("children", project->values("QMAKE_PBX_LIBRARIES"), SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("isa", "PBXGroup", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("name", escapeFilePath(grp)) << ";" << "\n" - << "\t\t\t" << writeSettings("path", ProStringList()) << ";" << "\n" - << "\t\t\t" << writeSettings("refType", "4", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("sourceTree", "<Group>") << ";" << "\n" << "\t\t" << "};" << "\n"; } } { - QString grp("Frameworks & Libraries"), key = keyFor(grp); + QString grp("Link Binary With Libraries"), key = keyFor(grp); project->values("QMAKE_PBX_BUILDPHASES").append(key); t << "\t\t" << key << " = {" << "\n" << "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("files", project->values("QMAKE_PBX_BUILD_LIBRARIES"), SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("isa", "PBXFrameworksBuildPhase", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("name", escapeFilePath(grp)) << ";" << "\n" - << "\t\t" << "};" << "\n"; - } - if(project->isActiveConfig("app_bundle") && project->first("TEMPLATE") == "app") { //BUNDLE RESOURCES - QString grp("Bundle Resources"), key = keyFor(grp); - project->values("QMAKE_PBX_BUILDPHASES").append(key); - t << "\t\t" << key << " = {" << "\n" - << "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << "files = (" << "\n"; - if(!project->isEmpty("ICON")) { - ProString icon = project->first("ICON"); - if (icon.length() >= 2 && (icon.at(0) == '"' || icon.at(0) == '\'') && icon.endsWith(icon.at(0))) - icon = icon.mid(1, icon.length()-2); - t << "\t\t\t\t" << keyFor(icon + ".BUILDABLE") << ",\n"; - } - t << "\t\t\t" << ");" << "\n" - << "\t\t\t" << writeSettings("isa", "PBXResourcesBuildPhase", SettingsNoQuote) << ";" << "\n" + << "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("name", escapeFilePath(grp)) << ";" << "\n" << "\t\t" << "};" << "\n"; } @@ -1026,78 +1038,96 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) << "\t\t\t" << writeSettings("shellScript", fixForOutput("cp -r $BUILT_PRODUCTS_DIR/$FULL_PRODUCT_NAME " + escapeFilePath(destDir))) << ";" << "\n" << "\t\t" << "};\n"; } - //BUNDLE_DATA BUILDPHASE (copy) - if(!project->isEmpty("QMAKE_BUNDLE_DATA")) { + // Copy Bundle Resources + if (!project->isEmpty("QMAKE_BUNDLE_DATA")) { ProStringList bundle_file_refs; + ProStringList bundle_resources_files; + + bool useCopyResourcesPhase = project->isActiveConfig("app_bundle") && project->first("TEMPLATE") == "app"; + //all bundle data const ProStringList &bundle_data = project->values("QMAKE_BUNDLE_DATA"); for(int i = 0; i < bundle_data.count(); i++) { - ProStringList pbx_files; + ProStringList bundle_files; + ProString path = project->first(ProKey(bundle_data[i] + ".path")); //all files const ProStringList &files = project->values(ProKey(bundle_data[i] + ".files")); for(int file = 0; file < files.count(); file++) { QString fn = files[file].toQString(); - QString file_ref_key = keyFor("QMAKE_PBX_BUNDLE_COPY_FILE_REF." + bundle_data[i] + "-" + fn); + QString file_ref_key = keyFor("QMAKE_PBX_BUNDLE_DATA_FILE_REF." + bundle_data[i] + "-" + fn); bundle_file_refs += file_ref_key; t << "\t\t" << file_ref_key << " = {" << "\n" << "\t\t\t" << writeSettings("isa", "PBXFileReference", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("path", escapeFilePath(fn)) << ";" << "\n" - << "\t\t\t" << writeSettings("refType", QString::number(reftypeForFile(fn)), SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("sourceTree", sourceTreeForFile(fn)) << ";" << "\n" << "\t\t" << "};" << "\n"; - QString copy_file_key = keyFor("QMAKE_PBX_BUNDLE_COPY_FILE." + bundle_data[i] + "-" + fn); - pbx_files += copy_file_key; - t << "\t\t" << copy_file_key << " = {\n" + QString file_key = keyFor("QMAKE_PBX_BUNDLE_DATA_FILE." + bundle_data[i] + "-" + fn); + bundle_files += file_key; + t << "\t\t" << file_key << " = {\n" << "\t\t\t" << writeSettings("fileRef", file_ref_key) << ";" << "\n" << "\t\t\t" << writeSettings("isa", "PBXBuildFile", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << "settings = {\n" - << "\t\t\t" << "}" << ";" << "\n" << "\t\t" << "}" << ";" << "\n"; } - //the phase - QString phase_key = keyFor("QMAKE_PBX_BUNDLE_COPY." + bundle_data[i]); - QString path; - if (!project->isEmpty(ProKey(bundle_data[i] + ".version"))) { - //### + + if (!useCopyResourcesPhase || !path.isEmpty()) { + // The resource copy phase doesn't support paths, so we have to use + // a regular file copy phase (which doesn't optimize the resources). + QString phase_key = keyFor("QMAKE_PBX_BUNDLE_COPY." + bundle_data[i]); + if (!project->isEmpty(ProKey(bundle_data[i] + ".version"))) { + //### + } + + project->values("QMAKE_PBX_PRESCRIPT_BUILDPHASES").append(phase_key); + t << "\t\t" << phase_key << " = {\n" + << "\t\t\t" << writeSettings("name", "Copy '" + bundle_data[i] + "' Files to Bundle") << ";" << "\n" + << "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";" << "\n" + << "\t\t\t" << writeSettings("dstPath", escapeFilePath(path)) << ";" << "\n" + << "\t\t\t" << writeSettings("dstSubfolderSpec", "1", SettingsNoQuote) << ";" << "\n" + << "\t\t\t" << writeSettings("files", bundle_files, SettingsAsList, 4) << ";" << "\n" + << "\t\t\t" << writeSettings("isa", "PBXCopyFilesBuildPhase", SettingsNoQuote) << ";" << "\n" + << "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";" << "\n" + << "\t\t" << "}" << ";" << "\n"; + } else { + // Otherwise we leave it to the resource copy phase below + bundle_resources_files += bundle_files; + } + } + + if (useCopyResourcesPhase) { + if (!project->isEmpty("ICON")) { + ProString icon = project->first("ICON"); + if (icon.length() >= 2 && (icon.at(0) == '"' || icon.at(0) == '\'') && icon.endsWith(icon.at(0))) { + icon = icon.mid(1, icon.length() - 2); + bundle_resources_files += keyFor(icon + ".BUILDABLE"); + } } - path += project->first(ProKey(bundle_data[i] + ".path")); - project->values("QMAKE_PBX_PRESCRIPT_BUILDPHASES").append(phase_key); - t << "\t\t" << phase_key << " = {\n" - << "\t\t\t" << writeSettings("name", "Bundle Copy [" + bundle_data[i] + "]") << ";" << "\n" + + QString grp("Copy Bundle Resources"), key = keyFor(grp); + project->values("QMAKE_PBX_BUILDPHASES").append(key); + t << "\t\t" << key << " = {" << "\n" << "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("dstPath", escapeFilePath(path)) << ";" << "\n" - << "\t\t\t" << writeSettings("dstSubfolderSpec", "1", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("files", pbx_files, SettingsAsList, 4) << ";" << "\n" - << "\t\t\t" << writeSettings("isa", "PBXCopyFilesBuildPhase", SettingsNoQuote) << ";" << "\n" + << "\t\t\t" << writeSettings("files", bundle_resources_files, SettingsAsList, 4) << ";" << "\n" + << "\t\t\t" << writeSettings("isa", "PBXResourcesBuildPhase", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";" << "\n" - << "\t\t" << "}" << ";" << "\n"; + << "\t\t\t" << writeSettings("name", escapeFilePath(grp)) << ";" << "\n" + << "\t\t" << "};" << "\n"; } - QString bundle_copy_key = keyFor("QMAKE_PBX_BUNDLE_COPY"); - project->values("QMAKE_PBX_GROUPS").append(bundle_copy_key); - t << "\t\t" << bundle_copy_key << " = {" << "\n" + + QString bundle_data_key = keyFor("QMAKE_PBX_BUNDLE_DATA"); + project->values("QMAKE_PBX_GROUPS").append(bundle_data_key); + t << "\t\t" << bundle_data_key << " = {" << "\n" << "\t\t\t" << writeSettings("children", bundle_file_refs, SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("isa", "PBXGroup", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("name", "Source [bundle data]") << ";" << "\n" - << "\t\t\t" << writeSettings("path", ProStringList()) << ";" << "\n" - << "\t\t\t" << writeSettings("refType", "4", SettingsNoQuote) << ";" << "\n" + << "\t\t\t" << writeSettings("name", "Bundle Resources") << ";" << "\n" << "\t\t\t" << writeSettings("sourceTree", "<Group>") << ";" << "\n" << "\t\t" << "};" << "\n"; } - //DUMP EVERYTHING THAT TIES THE ABOVE TOGETHER - //ROOT_GROUP - t << "\t\t" << keyFor("QMAKE_PBX_ROOT_GROUP") << " = {" << "\n" - << "\t\t\t" << writeSettings("children", project->values("QMAKE_PBX_GROUPS"), SettingsAsList, 4) << ";" << "\n" - << "\t\t\t" << writeSettings("isa", "PBXGroup", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("name", escapeFilePath(project->first("QMAKE_ORIG_TARGET"))) << ";" << "\n" - << "\t\t\t" << writeSettings("path", ProStringList()) << ";" << "\n" - << "\t\t\t" << writeSettings("refType", "4", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("sourceTree", "<Group>") << ";" << "\n" - << "\t\t" << "};" << "\n"; //REFERENCE project->values("QMAKE_PBX_PRODUCTS").append(keyFor(pbx_dir + "QMAKE_PBX_REFERENCE")); t << "\t\t" << keyFor(pbx_dir + "QMAKE_PBX_REFERENCE") << " = {" << "\n" - << "\t\t\t" << writeSettings("isa", "PBXFileReference", SettingsNoQuote) << ";" << "\n"; + << "\t\t\t" << writeSettings("isa", "PBXFileReference", SettingsNoQuote) << ";" << "\n" + << "\t\t\t" << writeSettings("includeInIndex", "0", SettingsNoQuote) << ";" << "\n"; if(project->first("TEMPLATE") == "app") { ProString targ = project->first("QMAKE_ORIG_TARGET"); if(project->isActiveConfig("bundle") && !project->isEmpty("QMAKE_BUNDLE_EXTENSION")) { @@ -1112,7 +1142,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) targ += ".app"; t << "\t\t\t" << writeSettings("explicitFileType", "wrapper.application") << ";" << "\n"; } else { - t << "\t\t\t" << writeSettings("explicitFileType", "wrapper.executable") << ";" << "\n"; + t << "\t\t\t" << writeSettings("explicitFileType", "compiled.mach-o.executable") << ";" << "\n"; } QString app = (!project->isEmpty("DESTDIR") ? project->first("DESTDIR") + project->first("QMAKE_ORIG_TARGET") : qmake_getpwd()) + Option::dir_sep + targ; @@ -1146,8 +1176,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) } t << "\t\t\t" << writeSettings("path", escapeFilePath(lib)) << ";" << "\n"; } - t << "\t\t\t" << writeSettings("refType", "3", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("sourceTree", "BUILT_PRODUCTS_DIR", SettingsNoQuote) << ";" << "\n" + t << "\t\t\t" << writeSettings("sourceTree", "BUILT_PRODUCTS_DIR", SettingsNoQuote) << ";" << "\n" << "\t\t" << "};" << "\n"; { //Products group QString grp("Products"), key = keyFor(grp); @@ -1156,177 +1185,38 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) << "\t\t\t" << writeSettings("children", project->values("QMAKE_PBX_PRODUCTS"), SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("isa", "PBXGroup", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("name", "Products") << ";" << "\n" - << "\t\t\t" << writeSettings("refType", "4", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("sourceTree", "<Group>") << ";" << "\n" << "\t\t" << "};" << "\n"; } + + //DUMP EVERYTHING THAT TIES THE ABOVE TOGETHER + //ROOT_GROUP + t << "\t\t" << keyFor("QMAKE_PBX_ROOT_GROUP") << " = {" << "\n" + << "\t\t\t" << writeSettings("children", project->values("QMAKE_PBX_GROUPS"), SettingsAsList, 4) << ";" << "\n" + << "\t\t\t" << writeSettings("isa", "PBXGroup", SettingsNoQuote) << ";" << "\n" + << "\t\t\t" << writeSettings("name", escapeFilePath(project->first("QMAKE_ORIG_TARGET"))) << ";" << "\n" + << "\t\t\t" << writeSettings("sourceTree", "<Group>") << ";" << "\n" + << "\t\t" << "};" << "\n"; + //TARGET QString target_key = keyFor(pbx_dir + "QMAKE_PBX_TARGET"); project->values("QMAKE_PBX_TARGETS").append(target_key); t << "\t\t" << target_key << " = {" << "\n" << "\t\t\t" << writeSettings("buildPhases", project->values("QMAKE_PBX_PRESCRIPT_BUILDPHASES") + project->values("QMAKE_PBX_BUILDPHASES"), - SettingsAsList, 4) << ";" << "\n" - << "\t\t\t" << "buildSettings = {" << "\n"; - ProString cCompiler = project->first("QMAKE_CC"); - if (!cCompiler.isEmpty()) { - t << "\t\t\t\t" << writeSettings("CC", fixForOutput(findProgram(cCompiler))) << ";" << "\n"; - } - cCompiler = project->first("QMAKE_CXX"); - if (!cCompiler.isEmpty()) { - t << "\t\t\t\t" << writeSettings("CPLUSPLUS", fixForOutput(findProgram(cCompiler))) << ";" << "\n"; - } - - t << "\t\t\t\t" << writeSettings("LEXFLAGS", fixListForOutput("QMAKE_LEXFLAGS")) << ";" << "\n" - << "\t\t\t\t" << writeSettings("YACCFLAGS", fixListForOutput("QMAKE_YACCFLAGS")) << ";" << "\n" - << "\t\t\t\t" << writeSettings("OTHER_REZFLAGS", ProStringList()) << ";" << "\n" - << "\t\t\t\t" << writeSettings("SECTORDER_FLAGS", ProStringList()) << ";" << "\n" - << "\t\t\t\t" << writeSettings("WARNING_CFLAGS", ProStringList()) << ";" << "\n" - << "\t\t\t\t" << writeSettings("PREBINDING", ProStringList((project->isEmpty("QMAKE_DO_PREBINDING") ? "NO" : "YES")), SettingsNoQuote) << ";" << "\n"; - if((project->first("TEMPLATE") == "app" && project->isActiveConfig("app_bundle")) || - (project->first("TEMPLATE") == "lib" && !project->isActiveConfig("staticlib") && - project->isActiveConfig("lib_bundle"))) { - QString plist = fileFixify(project->first("QMAKE_INFO_PLIST").toQString()); - if(plist.isEmpty()) - plist = specdir() + QDir::separator() + "Info.plist." + project->first("TEMPLATE"); - if(exists(plist)) { - QFile plist_in_file(plist); - if(plist_in_file.open(QIODevice::ReadOnly)) { - QTextStream plist_in(&plist_in_file); - QString plist_in_text = plist_in.readAll(); - plist_in_text = plist_in_text.replace("@ICON@", - (project->isEmpty("ICON") ? QString("") : project->first("ICON").toQString().section(Option::dir_sep, -1))); - if(project->first("TEMPLATE") == "app") { - plist_in_text = plist_in_text.replace("@EXECUTABLE@", project->first("QMAKE_ORIG_TARGET").toQString()); - } else { - plist_in_text = plist_in_text.replace("@LIBRARY@", project->first("QMAKE_ORIG_TARGET").toQString()); - } - if (!project->values("VERSION").isEmpty()) { - plist_in_text = plist_in_text.replace("@SHORT_VERSION@", project->first("VER_MAJ") + "." + - project->first("VER_MIN")); - } - plist_in_text = plist_in_text.replace("@TYPEINFO@", - (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ? QString::fromLatin1("????") : - project->first("QMAKE_PKGINFO_TYPEINFO").left(4).toQString())); - QFile plist_out_file("Info.plist"); - if(plist_out_file.open(QIODevice::WriteOnly | QIODevice::Text)) { - QTextStream plist_out(&plist_out_file); - plist_out << plist_in_text; - t << "\t\t\t\t" << writeSettings("INFOPLIST_FILE", "Info.plist") << ";" << "\n"; - } - } - } - } -#if 1 - t << "\t\t\t\t" << writeSettings("BUILD_ROOT", escapeFilePath(qmake_getpwd())) << ";" << "\n"; -#endif - if(!project->isActiveConfig("staticlib")) { - t << "\t\t\t\t" << writeSettings("OTHER_LDFLAGS", - fixListForOutput("SUBLIBS") - + fixListForOutput("QMAKE_LFLAGS") - + fixListForOutput("QMAKE_LIBS") - + fixListForOutput("QMAKE_LIBS_PRIVATE"), - SettingsAsList, 6) << ";" << "\n"; - } - if(!project->isEmpty("DESTDIR")) { - ProString dir = project->first("DESTDIR"); - if (QDir::isRelativePath(dir.toQString())) - dir.prepend(qmake_getpwd() + Option::dir_sep); - t << "\t\t\t\t" << writeSettings("INSTALL_DIR", dir) << ";" << "\n"; - } - if (project->first("TEMPLATE") == "lib") { - t << "\t\t\t\t" << writeSettings("INSTALL_PATH", ProStringList()) << ";" << "\n"; - } - if(!project->isEmpty("VERSION") && project->first("VERSION") != "0.0.0") { - t << "\t\t\t\t" << writeSettings("DYLIB_CURRENT_VERSION", project->first("VER_MAJ")+"."+project->first("VER_MIN")+"."+project->first("VER_PAT")) << ";" << "\n"; - if(project->isEmpty("COMPAT_VERSION")) - t << "\t\t\t\t" << writeSettings("DYLIB_COMPATIBILITY_VERSION", project->first("VER_MAJ")+"."+project->first("VER_MIN")) << ";" << "\n"; - if(project->first("TEMPLATE") == "lib" && !project->isActiveConfig("staticlib") && - project->isActiveConfig("lib_bundle")) - t << "\t\t\t\t" << writeSettings("FRAMEWORK_VERSION", project->first("QMAKE_FRAMEWORK_VERSION")) << ";" << "\n"; - } - if(!project->isEmpty("COMPAT_VERSION")) - t << "\t\t\t\t" << writeSettings("DYLIB_COMPATIBILITY_VERSION", project->first("COMPAT_VERSION")) << ";" << "\n"; - if(!project->isEmpty("QMAKE_MACOSX_DEPLOYMENT_TARGET")) - t << "\t\t\t\t" << writeSettings("MACOSX_DEPLOYMENT_TARGET", project->first("QMAKE_MACOSX_DEPLOYMENT_TARGET")) << ";" << "\n"; - if(project->first("TEMPLATE") == "app") { - t << "\t\t\t\t" << writeSettings("PRODUCT_NAME", fixForOutput(project->first("QMAKE_ORIG_TARGET").toQString())) << ";" << "\n"; - } else { - if(!project->isActiveConfig("plugin") && project->isActiveConfig("staticlib")) { - t << "\t\t\t\t" << writeSettings("LIBRARY_STYLE", "STATIC") << ";" << "\n"; - } else { - t << "\t\t\t\t" << writeSettings("LIBRARY_STYLE", "DYNAMIC") << ";" << "\n"; - } - ProString lib = project->first("QMAKE_ORIG_TARGET"); - if(!project->isActiveConfig("lib_bundle") && !project->isActiveConfig("staticlib")) - lib.prepend("lib"); - t << "\t\t\t\t" << writeSettings("PRODUCT_NAME", escapeFilePath(lib)) << ";" << "\n"; - } - tmp = project->values("QMAKE_PBX_VARS"); - for(int i = 0; i < tmp.count(); i++) { - QString var = tmp[i].toQString(), val = QString::fromLocal8Bit(qgetenv(var.toLatin1().constData())); - if(val.isEmpty() && var == "TB") - val = "/usr/bin/"; - t << "\t\t\t\t" << writeSettings(var, escapeFilePath(val)) << ";" << "\n"; - } - t << "\t\t\t" << "};" << "\n" - << "\t\t\t" << "conditionalBuildSettings = {" << "\n" - << "\t\t\t" << "};" << "\n" - << "\t\t\t" << writeSettings("dependencies", project->values("QMAKE_PBX_TARGET_DEPENDS"), SettingsAsList, 4) << ";" << "\n" - << "\t\t\t" << writeSettings("productReference", keyFor(pbx_dir + "QMAKE_PBX_REFERENCE")) << ";" << "\n" - << "\t\t\t" << writeSettings("shouldUseHeadermap", "1", SettingsNoQuote) << ";" << "\n"; + SettingsAsList, 4) << ";" << "\n"; + t << "\t\t\t" << writeSettings("dependencies", project->values("QMAKE_PBX_TARGET_DEPENDS"), SettingsAsList, 4) << ";" << "\n" + << "\t\t\t" << writeSettings("productReference", keyFor(pbx_dir + "QMAKE_PBX_REFERENCE")) << ";" << "\n"; t << "\t\t\t" << writeSettings("buildConfigurationList", keyFor("QMAKE_PBX_BUILDCONFIG_LIST_TARGET"), SettingsNoQuote) << ";" << "\n"; t << "\t\t\t" << writeSettings("isa", "PBXNativeTarget", SettingsNoQuote) << ";" << "\n"; + t << "\t\t\t" << writeSettings("buildRules", ProStringList(), SettingsAsList) << ";" << "\n"; if(project->first("TEMPLATE") == "app") { - if(!project->isActiveConfig("app_bundle")) { - if (!project->isEmpty("QMAKE_PBX_PRODUCT_TYPE")) - t << "\t\t\t" << writeSettings("productType", project->first("QMAKE_PBX_PRODUCT_TYPE")) << ";" << "\n"; - else - t << "\t\t\t" << writeSettings("productType", "com.apple.product-type.tool") << ";" << "\n"; + if (!project->isEmpty("QMAKE_PBX_PRODUCT_TYPE")) { + t << "\t\t\t" << writeSettings("productType", project->first("QMAKE_PBX_PRODUCT_TYPE")) << ";" << "\n"; } else { - if (!project->isEmpty("QMAKE_PBX_PRODUCT_TYPE")) - t << "\t\t\t" << writeSettings("productType", project->first("QMAKE_PBX_PRODUCT_TYPE")) << ";" << "\n"; - else + if (project->isActiveConfig("app_bundle")) t << "\t\t\t" << writeSettings("productType", "com.apple.product-type.application") << ";" << "\n"; - t << "\t\t\t" << "productSettingsXML = \""; - bool read_plist = false; - if(exists("Info.plist")) { - QFile plist("Info.plist"); - if (plist.open(QIODevice::ReadOnly)) { - read_plist = true; - QTextStream stream(&plist); - while(!stream.atEnd()) - t << stream.readLine().replace('"', "\\\"") << endl; - } - } - if(!read_plist) { - t << "<?xml version=" - << "\\\"1.0\\\" encoding=" << "\\\"UTF-8\\\"" << "?>" << "\n" - << "\t\t\t\t" << "<!DOCTYPE plist SYSTEM \\\"file://localhost/System/" - << "Library/DTDs/PropertyList.dtd\\\">" << "\n" - << "\t\t\t\t" << "<plist version=\\\"0.9\\\">" << "\n" - << "\t\t\t\t" << "<dict>" << "\n" - << "\t\t\t\t\t" << "<key>CFBundleDevelopmentRegion</key>" << "\n" - << "\t\t\t\t\t" << "<string>English</string>" << "\n" - << "\t\t\t\t\t" << "<key>CFBundleExecutable</key>" << "\n" - << "\t\t\t\t\t" << "<string>" << project->first("QMAKE_ORIG_TARGET") << "</string>" << "\n" - << "\t\t\t\t\t" << "<key>CFBundleIconFile</key>" << "\n" - << "\t\t\t\t\t" << "<string>" << var("ICON").section(Option::dir_sep, -1) << "</string>" << "\n" - << "\t\t\t\t\t" << "<key>CFBundleInfoDictionaryVersion</key>" << "\n" - << "\t\t\t\t\t" << "<string>6.0</string>" << "\n" - << "\t\t\t\t\t" << "<key>CFBundlePackageType</key>" << "\n" - << "\t\t\t\t\t" << "<string>APPL</string>" << "\n" - << "\t\t\t\t\t" << "<key>CFBundleSignature</key>" << "\n" - << "\t\t\t\t\t" << "<string>" - << (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ? QString::fromLatin1("????") : - project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << "</string>" << "\n" - << "\t\t\t\t\t" << "<key>CFBundleVersion</key>" << "\n" - << "\t\t\t\t\t" << "<string>0.1</string>" << "\n" - << "\t\t\t\t\t" << "<key>CSResourcesFileMapped</key>" << "\n" - << "\t\t\t\t\t" << "<true/>" << "\n" - << "\t\t\t\t" << "</dict>" << "\n" - << "\t\t\t\t" << "</plist>"; - } - t << "\";" << "\n"; + else + t << "\t\t\t" << writeSettings("productType", "com.apple.product-type.tool") << ";" << "\n"; } t << "\t\t\t" << writeSettings("name", escapeFilePath(project->first("QMAKE_ORIG_TARGET"))) << ";" << "\n" << "\t\t\t" << writeSettings("productName", escapeFilePath(project->first("QMAKE_ORIG_TARGET"))) << ";" << "\n"; @@ -1345,12 +1235,11 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) else t << "\t\t\t" << writeSettings("productType", "com.apple.product-type.library.dynamic") << ";" << "\n"; } - t << "\t\t\t" << writeSettings("startupPath", "<<ProjectDirectory>>") << ";" << "\n"; if(!project->isEmpty("DESTDIR")) t << "\t\t\t" << writeSettings("productInstallPath", escapeFilePath(project->first("DESTDIR"))) << ";" << "\n"; t << "\t\t" << "};" << "\n"; //DEBUG/RELEASE - QString active_buildstyle; + QString defaultConfig; for(int as_release = 0; as_release < 2; as_release++) { QMap<QString, QString> settings; @@ -1381,6 +1270,8 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) } QString name = (as_release ? "Release" : "Debug"); + if (project->isActiveConfig("debug") != (bool)as_release) + defaultConfig = name; for (int i = 0; i < buildConfigGroups.size(); i++) { QString key = keyFor("QMAKE_PBX_BUILDCONFIG_" + name + buildConfigGroups.at(i)); project->values(ProKey("QMAKE_PBX_BUILDCONFIGS_" + buildConfigGroups.at(i))).append(key); @@ -1389,15 +1280,104 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) << "\t\t\t" << "buildSettings = {" << "\n"; for (QMap<QString, QString>::Iterator set_it = settings.begin(); set_it != settings.end(); ++set_it) t << "\t\t\t\t" << writeSettings(set_it.key(), set_it.value()) << ";\n"; - if (!project->isEmpty("PRECOMPILED_HEADER")) { - t << "\t\t\t\t" << writeSettings("GCC_PRECOMPILE_PREFIX_HEADER", "YES") << ";" << "\n" - << "\t\t\t\t" << writeSettings("GCC_PREFIX_HEADER", escapeFilePath(project->first("PRECOMPILED_HEADER"))) << ";" << "\n"; - } if (buildConfigGroups.at(i) == QLatin1String("PROJECT")) { + if (!project->isEmpty("QMAKE_XCODE_GCC_VERSION")) + t << "\t\t\t\t" << writeSettings("GCC_VERSION", project->first("QMAKE_XCODE_GCC_VERSION"), SettingsNoQuote) << ";" << "\n"; + ProString program = project->first("QMAKE_CC"); + if (!program.isEmpty()) + t << "\t\t\t\t" << writeSettings("CC", fixForOutput(findProgram(program))) << ";" << "\n"; + program = project->first("QMAKE_CXX"); + // Xcode will automatically take care of using CC with the right -x option, + // and will actually break if we pass CPLUSPLUS, by adding an additional set of "++" + if (!program.isEmpty() && !program.contains("clang++")) + t << "\t\t\t\t" << writeSettings("CPLUSPLUS", fixForOutput(findProgram(program))) << ";" << "\n"; + program = project->first("QMAKE_LINK"); + if (!program.isEmpty()) + t << "\t\t\t\t" << writeSettings("LDPLUSPLUS", fixForOutput(findProgram(program))) << ";" << "\n"; + + if ((project->first("TEMPLATE") == "app" && project->isActiveConfig("app_bundle")) || + (project->first("TEMPLATE") == "lib" && !project->isActiveConfig("staticlib") && + project->isActiveConfig("lib_bundle"))) { + QString plist = fileFixify(project->first("QMAKE_INFO_PLIST").toQString()); + if (plist.isEmpty()) + plist = specdir() + QDir::separator() + "Info.plist." + project->first("TEMPLATE"); + if (exists(plist)) { + QFile plist_in_file(plist); + if (plist_in_file.open(QIODevice::ReadOnly)) { + QTextStream plist_in(&plist_in_file); + QString plist_in_text = plist_in.readAll(); + plist_in_text = plist_in_text.replace("@ICON@", + (project->isEmpty("ICON") ? QString("") : project->first("ICON").toQString().section(Option::dir_sep, -1))); + if (project->first("TEMPLATE") == "app") { + plist_in_text = plist_in_text.replace("@EXECUTABLE@", project->first("QMAKE_ORIG_TARGET").toQString()); + } else { + plist_in_text = plist_in_text.replace("@LIBRARY@", project->first("QMAKE_ORIG_TARGET").toQString()); + } + plist_in_text = plist_in_text.replace("@BUNDLEIDENTIFIER@", QLatin1String("${PRODUCT_NAME:rfc1034identifier}")); + if (!project->values("VERSION").isEmpty()) { + plist_in_text = plist_in_text.replace("@SHORT_VERSION@", project->first("VER_MAJ") + "." + + project->first("VER_MIN")); + } + plist_in_text = plist_in_text.replace("@TYPEINFO@", + (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") + ? QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4).toQString())); + QFile plist_out_file("Info.plist"); + if (plist_out_file.open(QIODevice::WriteOnly | QIODevice::Text)) { + QTextStream plist_out(&plist_out_file); + plist_out << plist_in_text; + t << "\t\t\t\t" << writeSettings("INFOPLIST_FILE", "Info.plist") << ";" << "\n"; + } + } + } + } + + t << "\t\t\t\t" << writeSettings("SYMROOT", escapeFilePath(qmake_getpwd())) << ";" << "\n"; + + if (!project->isEmpty("DESTDIR")) { + ProString dir = project->first("DESTDIR"); + if (QDir::isRelativePath(dir.toQString())) + dir.prepend(qmake_getpwd() + Option::dir_sep); + t << "\t\t\t\t" << writeSettings("TARGET_BUILD_DIR", dir) << ";" << "\n"; + } + + if (project->first("TEMPLATE") == "lib") + t << "\t\t\t\t" << writeSettings("INSTALL_PATH", ProStringList()) << ";" << "\n"; + + if (!project->isEmpty("VERSION") && project->first("VERSION") != "0.0.0") { + t << "\t\t\t\t" << writeSettings("DYLIB_CURRENT_VERSION", project->first("VER_MAJ")+"."+project->first("VER_MIN")+"."+project->first("VER_PAT")) << ";" << "\n"; + if (project->isEmpty("COMPAT_VERSION")) + t << "\t\t\t\t" << writeSettings("DYLIB_COMPATIBILITY_VERSION", project->first("VER_MAJ")+"."+project->first("VER_MIN")) << ";" << "\n"; + if (project->first("TEMPLATE") == "lib" && !project->isActiveConfig("staticlib") && + project->isActiveConfig("lib_bundle")) + t << "\t\t\t\t" << writeSettings("FRAMEWORK_VERSION", project->first("QMAKE_FRAMEWORK_VERSION")) << ";" << "\n"; + } + if (!project->isEmpty("COMPAT_VERSION")) + t << "\t\t\t\t" << writeSettings("DYLIB_COMPATIBILITY_VERSION", project->first("COMPAT_VERSION")) << ";" << "\n"; + + if (!project->isEmpty("QMAKE_MACOSX_DEPLOYMENT_TARGET")) + t << "\t\t\t\t" << writeSettings("MACOSX_DEPLOYMENT_TARGET", project->first("QMAKE_MACOSX_DEPLOYMENT_TARGET")) << ";" << "\n"; + if (!project->isEmpty("QMAKE_IOS_DEPLOYMENT_TARGET")) + t << "\t\t\t\t" << writeSettings("IPHONEOS_DEPLOYMENT_TARGET", project->first("QMAKE_IOS_DEPLOYMENT_TARGET")) << ";" << "\n"; + + if (!project->isEmpty("QMAKE_XCODE_CODE_SIGN_IDENTITY")) + t << "\t\t\t\t" << writeSettings("CODE_SIGN_IDENTITY", project->first("QMAKE_XCODE_CODE_SIGN_IDENTITY")) << ";" << "\n"; + + tmp = project->values("QMAKE_PBX_VARS"); + for (int i = 0; i < tmp.count(); i++) { + QString var = tmp[i].toQString(), val = QString::fromLocal8Bit(qgetenv(var.toLatin1().constData())); + if (val.isEmpty() && var == "TB") + val = "/usr/bin/"; + t << "\t\t\t\t" << writeSettings(var, escapeFilePath(val)) << ";" << "\n"; + } + if (!project->isEmpty("PRECOMPILED_HEADER")) { + t << "\t\t\t\t" << writeSettings("GCC_PRECOMPILE_PREFIX_HEADER", "YES") << ";" << "\n" + << "\t\t\t\t" << writeSettings("GCC_PREFIX_HEADER", escapeFilePath(project->first("PRECOMPILED_HEADER"))) << ";" << "\n"; + } t << "\t\t\t\t" << writeSettings("HEADER_SEARCH_PATHS", fixListForOutput("INCLUDEPATH") + ProStringList(fixForOutput(specdir())), SettingsAsList, 5) << ";" << "\n" << "\t\t\t\t" << writeSettings("LIBRARY_SEARCH_PATHS", fixListForOutput("QMAKE_PBX_LIBPATHS"), SettingsAsList, 5) << ";" << "\n" - << "\t\t\t\t" << writeSettings("FRAMEWORK_SEARCH_PATHS", fixListForOutput("QMAKE_FRAMEWORKPATH"), SettingsAsList, 5) << ";" << "\n" - << "\t\t\t\t" << writeSettings("INFOPLIST_FILE", "Info.plist") << ";" << "\n"; + << "\t\t\t\t" << writeSettings("FRAMEWORK_SEARCH_PATHS", fixListForOutput("QMAKE_FRAMEWORKPATH"), + !project->values("QMAKE_FRAMEWORKPATH").isEmpty() ? SettingsAsList : 0, 5) << ";" << "\n"; + { ProStringList cflags = fixListForOutput("QMAKE_CFLAGS"); const ProStringList &prl_defines = project->values("PRL_EXPORT_DEFINES"); @@ -1448,20 +1428,6 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) t << "\t\t\t" << "};" << "\n" << "\t\t\t" << writeSettings("name", name) << ";" << "\n" << "\t\t" << "};" << "\n"; - - key = keyFor("QMAKE_PBX_BUILDSTYLE_" + name); - project->values("QMAKE_PBX_BUILDSTYLES").append(key); - if (project->isActiveConfig("debug") != (bool)as_release) - active_buildstyle = name; - t << "\t\t" << key << " = {" << "\n" - << "\t\t\t" << writeSettings("buildRules", ProStringList(), SettingsAsList, 4) << ";" << "\n" - << "\t\t\t" << "buildSettings = {" << "\n"; - for(QMap<QString, QString>::Iterator set_it = settings.begin(); set_it != settings.end(); ++set_it) - t << "\t\t\t\t" << writeSettings(set_it.key(), set_it.value()) << ";" << "\n"; - t << "\t\t\t" << "};" << "\n" - << "\t\t\t" << writeSettings("isa", "PBXBuildStyle") << ";" << "\n" - << "\t\t\t" << writeSettings("name", name) << ";" << "\n" - << "\t\t" << "};" << "\n"; } } for (int i = 0; i < buildConfigGroups.size(); i++) { @@ -1469,20 +1435,24 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) << "\t\t\t" << writeSettings("isa", "XCConfigurationList", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("buildConfigurations", project->values(ProKey("QMAKE_PBX_BUILDCONFIGS_" + buildConfigGroups.at(i))), SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("defaultConfigurationIsVisible", "0", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("defaultConfigurationIsName", active_buildstyle) << ";" << "\n" + << "\t\t\t" << writeSettings("defaultConfigurationName", defaultConfig) << ";" << "\n" << "\t\t" << "};" << "\n"; } //ROOT t << "\t\t" << keyFor("QMAKE_PBX_ROOT") << " = {" << "\n" - << "\t\t\t" << writeSettings("buildStyles", project->values("QMAKE_PBX_BUILDSTYLES"), SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("hasScannedForEncodings", "1", SettingsNoQuote) << ";" << "\n" + << "\t\t\t" << writeSettings("compatibilityVersion", "Xcode 3.2") << ";" << "\n" << "\t\t\t" << writeSettings("isa", "PBXProject", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("mainGroup", keyFor("QMAKE_PBX_ROOT_GROUP")) << ";" << "\n"; + << "\t\t\t" << writeSettings("mainGroup", keyFor("QMAKE_PBX_ROOT_GROUP")) << ";" << "\n" + << "\t\t\t" << writeSettings("productRefGroup", keyFor("Products")) << ";" << "\n"; t << "\t\t\t" << writeSettings("buildConfigurationList", keyFor("QMAKE_PBX_BUILDCONFIG_LIST_PROJECT")) << ";" << "\n"; t << "\t\t\t" << writeSettings("projectDirPath", ProStringList()) << ";" << "\n" + << "\t\t\t" << writeSettings("projectRoot", "") << ";" << "\n" << "\t\t\t" << writeSettings("targets", project->values("QMAKE_PBX_TARGETS"), SettingsAsList, 4) << ";" << "\n" << "\t\t" << "};" << "\n"; + // FIXME: Deal with developmentRegion and knownRegions for QMAKE_PBX_ROOT + //FOOTER t << "\t" << "};" << "\n" << "\t" << writeSettings("rootObject", keyFor("QMAKE_PBX_ROOT")) << ";" << "\n" @@ -1513,6 +1483,9 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) writingUnixMakefileGenerator = false; } } + + qmake_setpwd(input_dir); + return true; } @@ -1726,10 +1699,9 @@ ProjectBuilderMakefileGenerator::reftypeForFile(const QString &where) QString ProjectBuilderMakefileGenerator::sourceTreeForFile(const QString &where) { - QString ret = "<absolute>"; - if (QDir::isRelativePath(unescapeFilePath(where))) - ret = "SOURCE_ROOT"; //relative - return ret; + // We always use absolute paths, instead of maintaining the SRCROOT + // build variable and making files relative to that. + return QLatin1String("<absolute>"); } QString diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 55c819657a..3cac073d72 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -305,8 +305,8 @@ MakefileGenerator::setProjectFile(QMakeProject *p) project = p; if (project->isActiveConfig("win32")) target_mode = TARG_WIN_MODE; - else if (project->isActiveConfig("macx")) - target_mode = TARG_MACX_MODE; + else if (project->isActiveConfig("mac")) + target_mode = TARG_MAC_MODE; else target_mode = TARG_UNIX_MODE; init(); @@ -448,6 +448,9 @@ MakefileGenerator::init() if (chkglue.isEmpty()) // Backwards compat with Qt4 specs chkglue = isWindowsShell() ? "" : "|| "; + if (v["QMAKE_LINK_O_FLAG"].isEmpty()) + v["QMAKE_LINK_O_FLAG"].append("-o "); + ProStringList &quc = v["QMAKE_EXTRA_COMPILERS"]; //make sure the COMPILERS are in the correct input/output chain order @@ -3233,7 +3236,7 @@ MakefileGenerator::writePkgConfigFile() t << "Libs: "; QString pkgConfiglibDir; QString pkgConfiglibName; - if (target_mode == TARG_MACX_MODE && project->isActiveConfig("lib_bundle")) { + if (target_mode == TARG_MAC_MODE && project->isActiveConfig("lib_bundle")) { pkgConfiglibDir = "-F${libdir}"; ProString bundle; if (!project->isEmpty("QMAKE_FRAMEWORK_BUNDLE_NAME")) diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h index 2f3e73ff6b..e1447c61c3 100644 --- a/qmake/generators/makefile.h +++ b/qmake/generators/makefile.h @@ -90,7 +90,7 @@ class MakefileGenerator : protected QMakeSourceFileInfo mutable QHash<ReplaceExtraCompilerCacheKey, QString> extraCompilerVariablesCache; protected: - enum TARG_MODE { TARG_UNIX_MODE, TARG_MACX_MODE, TARG_WIN_MODE } target_mode; + enum TARG_MODE { TARG_UNIX_MODE, TARG_MAC_MODE, TARG_WIN_MODE } target_mode; ProStringList createObjectList(const ProStringList &sources); diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp index da0da53e05..4f28321b09 100644 --- a/qmake/generators/unix/unixmake.cpp +++ b/qmake/generators/unix/unixmake.cpp @@ -142,6 +142,7 @@ UnixMakefileGenerator::init() project->values("QMAKE_L_FLAG") << (project->isActiveConfig("rvct_linker") ? "--userlibpath " : project->isActiveConfig("armcc_linker") ? "-L--userlibpath=" + : project->isActiveConfig("ti_linker") ? "--search_path=" : "-L"); ProStringList ldadd; if(!project->isEmpty("QMAKE_LIBDIR")) { @@ -490,10 +491,12 @@ UnixMakefileGenerator::findLibraries() } else if(opt.startsWith("-l")) { if (project->isActiveConfig("rvct_linker") || project->isActiveConfig("armcc_linker")) { (*it) = "lib" + opt.mid(2) + ".so"; + } else if (project->isActiveConfig("ti_linker")) { + (*it) = opt.mid(2); } else { stub = opt.mid(2); } - } else if (target_mode == TARG_MACX_MODE && opt.startsWith("-framework")) { + } else if (target_mode == TARG_MAC_MODE && opt.startsWith("-framework")) { if (opt.length() == 10) ++it; // Skip @@ -607,11 +610,11 @@ UnixMakefileGenerator::processPrlFiles() break; } } - } else if (target_mode == TARG_MACX_MODE && opt.startsWith("-F")) { + } else if (target_mode == TARG_MAC_MODE && opt.startsWith("-F")) { QMakeLocalFileName f(opt.right(opt.length()-2)); if(!frameworkdirs.contains(f)) frameworkdirs.insert(fwidx++, f); - } else if (target_mode == TARG_MACX_MODE && opt.startsWith("-framework")) { + } else if (target_mode == TARG_MAC_MODE && opt.startsWith("-framework")) { if(opt.length() > 11) opt = opt.mid(11); else @@ -650,7 +653,7 @@ UnixMakefileGenerator::processPrlFiles() ProKey arch("default"); ProString opt = l.at(lit).trimmed(); if(opt.startsWith("-")) { - if (target_mode == TARG_MACX_MODE && opt.startsWith("-Xarch")) { + if (target_mode == TARG_MAC_MODE && opt.startsWith("-Xarch")) { if (opt.length() > 7) { arch = opt.mid(7).toKey(); opt = l.at(++lit); @@ -658,7 +661,7 @@ UnixMakefileGenerator::processPrlFiles() } if (opt.startsWith(libArg) || - (target_mode == TARG_MACX_MODE && opt.startsWith("-F"))) { + (target_mode == TARG_MAC_MODE && opt.startsWith("-F"))) { if(!lflags[arch].contains(opt)) lflags[arch].append(opt); } else if(opt.startsWith("-l") || opt == "-pthread") { @@ -666,12 +669,12 @@ UnixMakefileGenerator::processPrlFiles() if (lflags[arch].contains(opt)) lflags[arch].removeAll(opt); lflags[arch].append(opt); - } else if (target_mode == TARG_MACX_MODE && opt.startsWith("-framework")) { + } else if (target_mode == TARG_MAC_MODE && opt.startsWith("-framework")) { if(opt.length() > 11) opt = opt.mid(11); else { opt = l.at(++lit); - if (target_mode == TARG_MACX_MODE && opt.startsWith("-Xarch")) + if (target_mode == TARG_MAC_MODE && opt.startsWith("-Xarch")) opt = l.at(++lit); // The user has done the right thing and prefixed each part } bool found = false; @@ -833,7 +836,7 @@ UnixMakefileGenerator::defaultInstall(const QString &t) uninst.append("-$(DEL_FILE) \"" + dst_targ + "\""); if(!links.isEmpty()) { for(int i = 0; i < links.size(); ++i) { - if (target_mode == TARG_UNIX_MODE || target_mode == TARG_MACX_MODE) { + if (target_mode == TARG_UNIX_MODE || target_mode == TARG_MAC_MODE) { QString link = Option::fixPathToTargetOS(destdir + links[i], false); int lslash = link.lastIndexOf(Option::dir_sep); if(lslash != -1) diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 41e40e0bb6..400908bc91 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -349,7 +349,8 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) << project->first("QMAKE_EXTENSION_STATICLIB") << " "; t << endl << endl; } - if(project->isActiveConfig("depend_prl") && !project->isEmpty("QMAKE_PRL_INTERNAL_FILES")) { + if ((project->isActiveConfig("depend_prl") || project->isActiveConfig("fast_depend_prl")) + && !project->isEmpty("QMAKE_PRL_INTERNAL_FILES")) { const ProStringList &l = project->values("QMAKE_PRL_INTERNAL_FILES"); ProStringList::ConstIterator it; for(it = l.begin(); it != l.end(); ++it) { @@ -361,8 +362,12 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) dir = (*it).left(slsh + 1); QString targ = dir + libinfo.first("QMAKE_PRL_TARGET"); target_deps += " " + targ; - t << targ << ":" << "\n\t" - << "@echo \"Creating '" << targ << "'\"" << "\n\t" + t << targ; + if (project->isActiveConfig("fast_depend_prl")) + t << ":\n\t@echo \"Creating '"; + else + t << ": FORCE\n\t@echo \"Creating/updating '"; + t << targ << "'\"" << "\n\t" << "(cd " << libinfo.first("QMAKE_PRL_BUILD_DIR") << ";" << "$(MAKE))" << endl; } @@ -436,7 +441,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "\n\t" << mkdir_p_asstring(destdir) << "\n\t"; if(!project->isEmpty("QMAKE_PRE_LINK")) t << var("QMAKE_PRE_LINK") << "\n\t"; - t << "$(LINK) $(LFLAGS) -o $(TARGET) " << incr_deps << " " << incr_objs << " $(OBJCOMP) $(LIBS)"; + t << "$(LINK) $(LFLAGS) " << var("QMAKE_LINK_O_FLAG") << "$(TARGET) " << incr_deps << " " << incr_objs << " $(OBJCOMP) $(LIBS)"; if(!project->isEmpty("QMAKE_POST_LINK")) t << "\n\t" << var("QMAKE_POST_LINK"); t << endl << endl; @@ -451,7 +456,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << mkdir_p_asstring(destdir) << "\n\t"; if (!project->isEmpty("QMAKE_PRE_LINK")) t << var("QMAKE_PRE_LINK") << "\n\t"; - t << "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)"; + t << "$(LINK) $(LFLAGS) " << var("QMAKE_LINK_O_FLAG") << "$(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)"; if (!project->isEmpty("QMAKE_POST_LINK")) t << "\n\t" << var("QMAKE_POST_LINK"); } @@ -503,7 +508,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << incr_target_dir << ": $(INCREMENTAL_OBJECTS)" << "\n\t"; if(!destdir.isEmpty()) t << mkdir_p_asstring(destdir) << "\n\t"; - t << "$(LINK) " << incr_lflags << " -o "<< incr_target_dir << + t << "$(LINK) " << incr_lflags << " " << var("QMAKE_LINK_O_FLAG") << incr_target_dir << " $(INCREMENTAL_OBJECTS)" << endl; //communicated below ProStringList &cmd = project->values("QMAKE_LINK_SHLIB_CMD"); @@ -1173,7 +1178,7 @@ void UnixMakefileGenerator::init2() } if (project->values("QMAKE_LINK_SHLIB_CMD").isEmpty()) project->values("QMAKE_LINK_SHLIB_CMD").append( - "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS) $(OBJCOMP)"); + "$(LINK) $(LFLAGS) " + project->first("QMAKE_LINK_O_FLAG") + "$(TARGET) $(OBJECTS) $(LIBS) $(OBJCOMP)"); } if (!project->values("QMAKE_APP_FLAG").isEmpty()) { project->values("QMAKE_CFLAGS") += project->values("QMAKE_CFLAGS_APP"); @@ -1218,7 +1223,7 @@ void UnixMakefileGenerator::init2() } if(!project->isEmpty("QMAKE_BUNDLE")) { - QString plist = fileFixify(project->first("QMAKE_INFO_PLIST").toQString()); + QString plist = fileFixify(project->first("QMAKE_INFO_PLIST").toQString(), qmake_getpwd()); if(plist.isEmpty()) plist = specdir() + QDir::separator() + "Info.plist." + project->first("TEMPLATE"); if(exists(Option::fixPathToLocalOS(plist))) { diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index 06e25c29f3..e64b2160b3 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -405,7 +405,7 @@ void MingwMakefileGenerator::writeBuildRulesPart(QTextStream &t) t << "\n\t" << objectsLinkLine << " " ; } } else if (project->first("TEMPLATE") != "aux") { - t << "\n\t" << "$(LINKER) $(LFLAGS) -o $(DESTDIR_TARGET) " << objectsLinkLine << " " << " $(LIBS)"; + t << "\n\t" << "$(LINKER) $(LFLAGS) " << var("QMAKE_LINK_O_FLAG") << "$(DESTDIR_TARGET) " << objectsLinkLine << " " << " $(LIBS)"; } if(!project->isEmpty("QMAKE_POST_LINK")) t << "\n\t" <<var("QMAKE_POST_LINK"); @@ -431,7 +431,7 @@ void MingwMakefileGenerator::writeRcFilePart(QTextStream &t) if (!rc_file.isEmpty()) { t << escapeDependencyPath(var("RES_FILE")) << ": " << rc_file << "\n\t" - << var("QMAKE_RC") << " -i " << rc_file << " -o " << var("RES_FILE") + << var("QMAKE_RC") << " -i " << rc_file << " -o " << var("RES_FILE") << incPathStr << " $(DEFINES)" << endl << endl; } } diff --git a/qmake/generators/win32/mingw_make.h b/qmake/generators/win32/mingw_make.h index 6bdcb7ea70..0e1267994e 100644 --- a/qmake/generators/win32/mingw_make.h +++ b/qmake/generators/win32/mingw_make.h @@ -65,7 +65,7 @@ private: void writeRcFilePart(QTextStream &t); QStringList &findDependencies(const QString &file); - + QString preCompHeaderOut; virtual bool findLibraries(); diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index 01243defd3..b620c270e0 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -276,6 +276,9 @@ void NmakeMakefileGenerator::init() project->values("QMAKE_LFLAGS").append("/VERSION:" + major + "." + minor); } + if (project->isEmpty("QMAKE_LINK_O_FLAG")) + project->values("QMAKE_LINK_O_FLAG").append("/OUT:"); + // Base class init! MakefileGenerator::init(); @@ -382,7 +385,7 @@ void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t) if(!project->isEmpty("QMAKE_PRE_LINK")) t << "\n\t" <<var("QMAKE_PRE_LINK"); if(project->isActiveConfig("staticlib")) { - t << "\n\t" << "$(LIBAPP) $(LIBFLAGS) /OUT:$(DESTDIR_TARGET) @<<" << "\n\t " + t << "\n\t" << "$(LIBAPP) $(LIBFLAGS) " << var("QMAKE_LINK_O_FLAG") << "$(DESTDIR_TARGET) @<<" << "\n\t " << "$(OBJECTS)" << "\n<<"; } else if (templateName != "aux") { @@ -448,7 +451,7 @@ void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t) } } QString signature = !project->isEmpty("SIGNATURE_FILE") ? var("SIGNATURE_FILE") : var("DEFAULT_SIGNATURE"); - bool useSignature = !signature.isEmpty() && !project->isActiveConfig("staticlib") && + bool useSignature = !signature.isEmpty() && !project->isActiveConfig("staticlib") && !project->isEmpty("CE_SDK") && !project->isEmpty("CE_ARCH"); if(useSignature) { t << "\n\tsigntool sign /F " << signature << " $(DESTDIR_TARGET)"; @@ -464,7 +467,7 @@ void NmakeMakefileGenerator::writeLinkCommand(QTextStream &t, const QString &ext t << "$(LINKER) $(LFLAGS)"; if (!extraFlags.isEmpty()) t << ' ' << extraFlags; - t << " /OUT:$(DESTDIR_TARGET) @<<\n" + t << " " << var("QMAKE_LINK_O_FLAG") << "$(DESTDIR_TARGET) @<<\n" << "$(OBJECTS) $(LIBS)"; if (!extraInlineFileContent.isEmpty()) t << ' ' << extraInlineFileContent; diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index b082fcb307..fce2147ed5 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -1060,10 +1060,6 @@ void VcprojGenerator::initLinkerTool() conf.linker.OutputFile = "$(OutDir)\\"; conf.linker.OutputFile += project->first("MSVCPROJ_TARGET").toQString(); - - if(project->isActiveConfig("dll")){ - conf.linker.parseOptions(project->values("QMAKE_LFLAGS_QT_DLL")); - } } void VcprojGenerator::initResourceTool() diff --git a/qmake/library/qmakebuiltins.cpp b/qmake/library/qmakebuiltins.cpp index f46d66ba89..0dedd64e6e 100644 --- a/qmake/library/qmakebuiltins.cpp +++ b/qmake/library/qmakebuiltins.cpp @@ -467,8 +467,7 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand( QString tmp = args.at(0).toQString(m_tmp1); for (int i = 1; i < args.count(); ++i) tmp = tmp.arg(args.at(i).toQString(m_tmp2)); - // Note: this depends on split_value_list() making a deep copy - ret = split_value_list(tmp); + ret << ProString(tmp); } break; case E_FORMAT_NUMBER: @@ -561,7 +560,7 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand( src = s; break; } - ret = split_value_list(before + var.join(glue) + after, src); + ret << ProString(before + var.join(glue) + after).setSource(src); } } break; diff --git a/qmake/library/qmakeevaluator.cpp b/qmake/library/qmakeevaluator.cpp index 8b6a0f8598..4f4e5854f1 100644 --- a/qmake/library/qmakeevaluator.cpp +++ b/qmake/library/qmakeevaluator.cpp @@ -126,6 +126,7 @@ void QMakeEvaluator::initStatics() statics.strforever = QLatin1String("forever"); statics.strhost_build = QLatin1String("host_build"); statics.strTEMPLATE = ProKey("TEMPLATE"); + statics.strQMAKE_PLATFORM = ProKey("QMAKE_PLATFORM"); #ifdef PROEVALUATOR_FULL statics.strREQUIRES = ProKey("REQUIRES"); #endif @@ -263,48 +264,55 @@ ProStringList QMakeEvaluator::split_value_list(const QString &vals, const ProFil { QString build; ProStringList ret; - QStack<char> quote; - - const ushort SPACE = ' '; - const ushort LPAREN = '('; - const ushort RPAREN = ')'; - const ushort SINGLEQUOTE = '\''; - const ushort DOUBLEQUOTE = '"'; - const ushort BACKSLASH = '\\'; if (!source) source = currentProFile(); - ushort unicode; const QChar *vals_data = vals.data(); const int vals_len = vals.length(); - int parens = 0; + ushort quote = 0; + bool hadWord = false; for (int x = 0; x < vals_len; x++) { - unicode = vals_data[x].unicode(); - 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 (unicode == RPAREN) { - --parens; - } else if (unicode == LPAREN) { - ++parens; + ushort unicode = vals_data[x].unicode(); + if (unicode == quote) { + quote = 0; + continue; } - - if (!parens && quote.isEmpty() && vals_data[x] == SPACE) { - ret << ProString(build).setSource(source); - build.clear(); - } else { - build += vals_data[x]; + switch (unicode) { + case '"': + case '\'': + quote = unicode; + hadWord = true; + continue; + case ' ': + case '\t': + if (!quote) { + if (hadWord) { + ret << ProString(build).setSource(source); + build.clear(); + hadWord = false; + } + continue; + } + build += QChar(unicode); + break; + case '\\': + if (x + 1 != vals_len) { + ushort next = vals_data[++x].unicode(); + if (next == '\'' || next == '"' || next == '\\') + unicode = next; + else + --x; + } + // fallthrough + default: + hadWord = true; + build += QChar(unicode); + break; } } - if (!build.isEmpty()) + if (hadWord) ret << ProString(build).setSource(source); - if (parens) - deprecationWarning(fL1S("Unmatched parentheses are deprecated.")); return ret; } @@ -924,6 +932,8 @@ void QMakeEvaluator::visitProVariable( if (varName == statics.strTEMPLATE) setTemplate(); + else if (varName == statics.strQMAKE_PLATFORM) + updateFeaturePaths(); #ifdef PROEVALUATOR_FULL else if (varName == statics.strREQUIRES) checkRequirements(values(varName)); @@ -1217,7 +1227,6 @@ bool QMakeEvaluator::loadSpec() } if (!loadSpecInternal()) return false; - updateFeaturePaths(); // The spec extends the feature search path, so rebuild the cache. if (!m_conffile.isEmpty() && evaluateFile(m_conffile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue) { return false; diff --git a/qmake/library/qmakeevaluator_p.h b/qmake/library/qmakeevaluator_p.h index 9830496424..935f112f52 100644 --- a/qmake/library/qmakeevaluator_p.h +++ b/qmake/library/qmakeevaluator_p.h @@ -89,6 +89,7 @@ struct QMakeStatics { QString strforever; QString strhost_build; ProKey strTEMPLATE; + ProKey strQMAKE_PLATFORM; #ifdef PROEVALUATOR_FULL ProKey strREQUIRES; #endif diff --git a/qmake/library/qmakeglobals.cpp b/qmake/library/qmakeglobals.cpp index ac9a0856ff..42bb85bb02 100644 --- a/qmake/library/qmakeglobals.cpp +++ b/qmake/library/qmakeglobals.cpp @@ -115,7 +115,6 @@ QMakeGlobals::QMakeGlobals() dirlist_sep = QLatin1Char(':'); dir_sep = QLatin1Char('/'); #endif - qmakespec = getEnv(QLatin1String("QMAKESPEC")); } QMakeGlobals::~QMakeGlobals() diff --git a/qmake/library/qmakeparser.cpp b/qmake/library/qmakeparser.cpp index f32267cf59..557a779717 100644 --- a/qmake/library/qmakeparser.cpp +++ b/qmake/library/qmakeparser.cpp @@ -1024,7 +1024,6 @@ void QMakeParser::finalizeCall(ushort *&tokPtr, ushort *uc, ushort *ptr, int arg m_tmp.setRawData((QChar *)uc + 4, nlen); const QString *defName; ushort defType; - uchar nest; if (m_tmp == statics.strfor) { if (m_invert || m_operator == OrOperator) { // '|' could actually work reasonably, but qmake does nonsense here. @@ -1101,13 +1100,20 @@ void QMakeParser::finalizeCall(ushort *&tokPtr, ushort *uc, ushort *ptr, int arg parseError(fL1S("%1(function) requires one literal argument.").arg(*defName)); return; } else if (m_tmp == statics.strreturn) { - if (argc > 1) { - parseError(fL1S("return() requires zero or one argument.")); - bogusTest(tokPtr); - return; + if (m_blockstack.top().nest & NestFunction) { + if (argc > 1) { + parseError(fL1S("return() requires zero or one argument.")); + bogusTest(tokPtr); + return; + } + } else { + if (*uce != TokFuncTerminator) { + parseError(fL1S("Top-level return() requires zero arguments.")); + bogusTest(tokPtr); + return; + } } defType = TokReturn; - nest = NestFunction; goto ctrlstm2; } else if (m_tmp == statics.strnext) { defType = TokNext; @@ -1120,15 +1126,14 @@ void QMakeParser::finalizeCall(ushort *&tokPtr, ushort *uc, ushort *ptr, int arg bogusTest(tokPtr); return; } - nest = NestLoop; - ctrlstm2: - if (m_invert) { - parseError(fL1S("Unexpected NOT operator in front of %1().").arg(m_tmp)); + if (!(m_blockstack.top().nest & NestLoop)) { + parseError(fL1S("Unexpected %1().").arg(m_tmp)); bogusTest(tokPtr); return; } - if (!(m_blockstack.top().nest & nest)) { - parseError(fL1S("Unexpected %1().").arg(m_tmp)); + ctrlstm2: + if (m_invert) { + parseError(fL1S("Unexpected NOT operator in front of %1().").arg(m_tmp)); bogusTest(tokPtr); return; } diff --git a/qmake/main.cpp b/qmake/main.cpp index e339239289..2056e36322 100644 --- a/qmake/main.cpp +++ b/qmake/main.cpp @@ -116,6 +116,11 @@ int runQMake(int argc, char **argv) if(!tmp_dir.isEmpty() && QFile::exists(tmp_dir)) dir = tmp_dir; } +#ifdef Q_OS_MAC + if (fi.fileName().endsWith(QStringLiteral(".pbxproj")) + && dir.endsWith(QStringLiteral(".xcodeproj"))) + dir += QStringLiteral("/.."); +#endif if(!dir.isNull() && dir != ".") Option::output_dir = dir; if(QDir::isRelativePath(Option::output_dir)) diff --git a/qmake/qmake.pri b/qmake/qmake.pri index aff0a9efda..66f7964c5f 100644 --- a/qmake/qmake.pri +++ b/qmake/qmake.pri @@ -131,7 +131,6 @@ bootstrap { #Qt code unix { SOURCES += qfilesystemengine_unix.cpp qfilesystemiterator_unix.cpp qfsfileengine_unix.cpp mac { - SOURCES += qfilesystemengine_mac.cpp SOURCES += qcore_mac.cpp qsettings_mac.cpp qlocale_mac.mm LIBS += -framework ApplicationServices } else { |