qt5base-lts/tools/configure/Makefile.mingw
Thiago Macieira b0afad8f0b Implement support for ref-qualified QString::toLatin1 & friends
This is the first step in implementing an in-place conversion of QString
to QByteArray. This requires ref-qualifiers in member functions so we
know that we have an rvalue QString.

Converting from UTF-16 to Latin1 always requires half the memory.

For conversion from UTF-16 to UTF-8, the typical string will also need
the same memory or less: characters from U+0000 to U+007F consume one
fewer byte; characters from U+0080 to U+07FF and from U+10000 to
U+1FFFFF occupy the same space in UTF-8 and UTF-16; it's only the ones
from U+0800 to U+FFFF that consume more space in the UTF-8 string.

For the locale's 8-bit codec, we can't be sure and the code (currently)
needs to go through QTextCodec anyway.

This requires a #define set before #include'ing "qstring.h". However,
since qstring.h is included by the QtCore PCH, we need an extra qmake
compiler without the PCH flags to compile this .cpp.

After this change, the distribution of calls in QtCore, Network, Gui,
and Widgets is as follows:

                  const &               &&
 toUtf8           31 (74%)              11 (26%)
 toLatin1         79 (77%)              24 (23%)
 toLocal8Bit      26 (16%)              138 (84%)

Change-Id: Idd96f9ddb51b989bc59f6da50054dd10c953dd4f
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2013-12-13 09:29:58 +01:00

124 lines
3.3 KiB
Makefile

CORESRC = $(QTSRC)src/corelib
TOOLSRC = $(QTSRC)tools
CONFSRC = $(TOOLSRC)/configure
RAW_PCH = configure_pch.h
PCH = $(RAW_PCH).gch/c++
CXX = g++
DEFINES = -DUNICODE -DQT_NO_DATASTREAM -DQT_NO_CODECS -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_LITE_COMPONENT -DQT_NO_COMPRESS -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -D_CRT_SECURE_NO_DEPRECATE -DQT_BOOTSTRAPPED -DQT_BUILD_CONFIGURE -DCOMMERCIAL_VERSION
INCPATH = -I"../../include" -I"../../include/QtCore" -I"../../include/QtCore/$(QTVERSION)" -I"../../include/QtCore/$(QTVERSION)/QtCore" -I"$(TOOLSRC)/shared" -I"$(QTSRC)mkspecs/win32-g++"
CXXFLAGS_BARE = -fno-rtti -fno-exceptions -mthreads -Wall -Wextra $(DEFINES) $(INCPATH)
CXXFLAGS = -include $(RAW_PCH) $(CXXFLAGS_BARE)
LINK = g++
LFLAGS = -Wl,-subsystem,console -mthreads
LIBS = -lole32 -ladvapi32 -luuid
TARGET = ../../configure.exe
OBJECTS = \
main.o \
configureapp.o \
environment.o \
tools.o \
qarraydata.o \
qbytearray.o \
qbytearraymatcher.o \
qhash.o \
qlist.o \
qlocale.o \
qlocale_win.o \
qlocale_tools.o \
qvector.o \
qutfcodec.o \
qtextcodec.o \
qglobal.o \
qnumeric.o \
qbuffer.o \
qdatastream.o \
qdir.o \
qdiriterator.o \
qfiledevice.o \
qfile.o \
qfileinfo.o \
qabstractfileengine.o \
qfilesystementry.o \
qfilesystemengine.o \
qfilesystemengine_win.o \
qfilesystemiterator_win.o \
qfsfileengine.o \
qfsfileengine_win.o \
qfsfileengine_iterator.o \
qiodevice.o \
qtextstream.o \
qlogging.o \
qtemporaryfile.o \
qstandardpaths.o \
qstandardpaths_win.o \
qsystemlibrary.o \
qbitarray.o \
qdatetime.o \
qmap.o \
qregexp.o \
qstring.o \
qstring_compat.o \
qstringlist.o \
qvsnprintf.o \
qvariant.o \
qsystemerror.o \
qmetatype.o \
qmalloc.o \
qxmlstream.o \
qxmlutils.o \
quuid.o \
registry.o
$(TARGET): $(OBJECTS)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS)
$(OBJECTS): $(PCH)
# 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.bat
# 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)
CHK_DIR_EXISTS = test -d
CHK_DIR_EXISTS_GLUE = ||
MKDIR = mkdir -p
else
CHK_DIR_EXISTS = if not exist
CHK_DIR_EXISTS_GLUE =
MKDIR = md
endif
$(PCH): $(CONFSRC)/configure_pch.h
@$(CHK_DIR_EXISTS) $(RAW_PCH).gch $(CHK_DIR_EXISTS_GLUE) $(MKDIR) $(RAW_PCH).gch
$(CXX) -x c++-header -c $(CXXFLAGS_BARE) -o $@ $<
VPATH = $(CONFSRC):$(TOOLSRC)/shared/windows:$(CORESRC)/global:$(CORESRC)/kernel:$(CORESRC)/tools:$(CORESRC)/codecs:$(CORESRC)/io:$(CORESRC)/xml:$(CORESRC)/plugin
main.o: $(CONFSRC)/configureapp.h
configureapp.o: $(CONFSRC)/configureapp.h $(CONFSRC)/environment.h $(CONFSRC)/tools.h
environment.o: $(CONFSRC)/environment.h
tools.o: $(CONFSRC)/tools.h
clean:
-rm -f *.o
-rm -rf *.gch