Add configure options for [experimental] HarfBuzz-NG support

Change-Id: I15f49b56f49ae53c16db904e03f668c3135edaa5
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This commit is contained in:
Konstantin Ritt 2013-08-26 18:44:36 +03:00 committed by The Qt Project
parent c88f1492c6
commit 3aa163491c
4 changed files with 121 additions and 8 deletions

View File

@ -0,0 +1,60 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the config.tests of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <harfbuzz/hb.h>
#if ((HB_VERSION_MAJOR*10000 + HB_VERSION_MINOR*100 + HB_VERSION_MICRO) < 912)
# error "This version of harfbuzz is too old."
#endif
int main(int, char **)
{
hb_buffer_t *buffer = hb_buffer_create();
const uint16_t string[] = { 'A', 'b', 'c' };
hb_buffer_add_utf16(buffer, string, 3, 0, 3);
hb_buffer_guess_segment_properties(buffer);
hb_buffer_set_flags(buffer, hb_buffer_flags_t(HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES));
hb_buffer_destroy(buffer);
return 0;
}

View File

@ -0,0 +1,3 @@
SOURCES = harfbuzz.cpp
CONFIG -= qt dylib
LIBS += -lharfbuzz

40
configure vendored
View File

@ -892,6 +892,7 @@ CFG_EGL=auto
CFG_SSE=auto
CFG_FONTCONFIG=auto
CFG_LIBFREETYPE=auto
CFG_HARFBUZZ=no
CFG_SQL_AVAILABLE=
QT_ALL_BUILD_PARTS=" libs tools examples tests "
QT_DEFAULT_BUILD_PARTS="libs tools examples"
@ -969,7 +970,6 @@ CFG_INOTIFY=auto
CFG_EVENTFD=auto
CFG_RPATH=yes
CFG_FRAMEWORK=auto
CFG_MAC_HARFBUZZ=no
DEFINES=
D_FLAGS=
I_FLAGS=
@ -1495,8 +1495,9 @@ while [ "$#" -gt 0 ]; do
OPT_OBSOLETE_HOST_ARG=yes
;;
harfbuzz)
if ([ "$BUILD_ON_MAC" = "yes" ] && [ "$VAL" = "yes" ]) || [ "$VAL" = "no" ]; then
CFG_MAC_HARFBUZZ="$VAL"
[ "$VAL" = "yes" ] && VAL=qt
if [ "$VAL" = "qt" ] || [ "$VAL" = "no" ] || [ "$VAL" = "system" ]; then
CFG_HARFBUZZ="$VAL"
else
UNKNOWN_OPT=yes
fi
@ -3534,6 +3535,14 @@ Third Party Libraries:
+ -system-libjpeg .... Use libjpeg from the operating system.
See http://www.ijg.org
* -no-harfbuzz ....... Do not compile HarfBuzz-NG support.
-qt-harfbuzz ....... (experimental) Use HarfBuzz-NG bundled with Qt
to do text shaping. It can still be disabled
by setting QT_HARFBUZZ environment variable to "old".
-system-harfbuzz ... (experimental) Use HarfBuzz-NG from the operating system
to do text shaping. It can still be disabled
by setting QT_HARFBUZZ environment variable to "old".
-no-openssl ........ Do not compile support for OpenSSL.
+ -openssl ........... Enable run-time OpenSSL support.
-openssl-linked .... Enabled linked OpenSSL support.
@ -3702,10 +3711,6 @@ Qt/Mac only:
-sdk <sdk> ......... Build Qt using Apple provided SDK <sdk>. The argument should be
one of the available SDKs as listed by 'xcodebuild -showsdks'.
-harfbuzz .......... Use HarfBuzz to do text layout instead of Core Text when possible.
* -no-harfbuzz ....... Disable HarfBuzz on Mac. It can still be enabled by setting
QT_ENABLE_HARFBUZZ environment variable.
EOF
fi
@ -5588,6 +5593,16 @@ if [ "$CFG_LIBFREETYPE" = "auto" ]; then
fi
fi
# harfbuzz support
[ "$XPLATFORM_MINGW" = "yes" ] && [ "$CFG_HARFBUZZ" = "auto" ] && CFG_HARFBUZZ=no
if [ "$CFG_HARFBUZZ" = "auto" ]; then
if compileTest unix/harfbuzz "HarfBuzz"; then
CFG_HARFBUZZ=system
else
CFG_HARFBUZZ=yes
fi
fi
if ! compileTest unix/stl "STL" &&
[ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
echo "STL functionality check failed! Cannot build Qt with this STL library."
@ -6002,6 +6017,14 @@ elif [ "$CFG_LIBFREETYPE" = "system" ]; then
else
QT_CONFIG="$QT_CONFIG freetype"
fi
if [ "$CFG_HARFBUZZ" = "no" ]; then
QT_CONFIG="$QT_CONFIG no-harfbuzz"
QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_HARFBUZZ"
elif [ "$CFG_HARFBUZZ" = "system" ]; then
QT_CONFIG="$QT_CONFIG system-harfbuzz"
else
QT_CONFIG="$QT_CONFIG harfbuzz"
fi
if [ "$CFG_GUI" = "auto" ]; then
CFG_GUI="yes"
fi
@ -6036,7 +6059,6 @@ fi
[ "$CFG_DBUS" = "linked" ] && QT_CONFIG="$QT_CONFIG dbus dbus-linked"
[ "$CFG_OPENSSL" = "yes" ] && QT_CONFIG="$QT_CONFIG openssl"
[ "$CFG_OPENSSL" = "linked" ] && QT_CONFIG="$QT_CONFIG openssl-linked"
[ "$CFG_MAC_HARFBUZZ" = "yes" ] && QT_CONFIG="$QT_CONFIG harfbuzz"
[ "$CFG_XCB" != "no" ] && QT_CONFIG="$QT_CONFIG xcb"
[ "$CFG_XINPUT2" = "yes" ] && QT_CONFIG="$QT_CONFIG xinput2"
[ "$CFG_SYSTEM_PROXIES" = "yes" ] && QT_CONFIG="$QT_CONFIG system-proxies"
@ -6849,6 +6871,8 @@ report_support " CUPS ..................." "$CFG_CUPS"
report_support " DirectWrite ............" "$CFG_DIRECTWRITE"
report_support " FontConfig ............." "$CFG_FONTCONFIG"
report_support " FreeType ..............." "$CFG_FREETYPE"
[ "$CFG_HARFBUZZ" != "no" ] && \
report_support " HarfBuzz ..............." "$CFG_HARFBUZZ"
report_support " Iconv .................." "$CFG_ICONV"
report_support " ICU ...................." "$CFG_ICU"
report_support " Image formats:"

View File

@ -260,6 +260,7 @@ Configure::Configure(int& argc, char** argv)
dictionary[ "LIBJPEG" ] = "auto";
dictionary[ "LIBPNG" ] = "auto";
dictionary[ "FREETYPE" ] = "yes";
dictionary[ "HARFBUZZ" ] = "no";
dictionary[ "ACCESSIBILITY" ] = "yes";
dictionary[ "OPENGL" ] = "yes";
@ -566,6 +567,13 @@ void Configure::parseCmdLine()
else if (configCmdLine.at(i) == "-system-freetype")
dictionary[ "FREETYPE" ] = "system";
else if (configCmdLine.at(i) == "-no-harfbuzz")
dictionary[ "HARFBUZZ" ] = "no";
else if (configCmdLine.at(i) == "-qt-harfbuzz")
dictionary[ "HARFBUZZ" ] = "yes";
else if (configCmdLine.at(i) == "-system-harfbuzz")
dictionary[ "HARFBUZZ" ] = "system";
// CE- C runtime --------------------------------------------
else if (configCmdLine.at(i) == "-crt") {
++i;
@ -1821,6 +1829,14 @@ bool Configure::displayHelp()
desc("FREETYPE", "yes", "-qt-freetype", "Use the libfreetype bundled with Qt.");
desc("FREETYPE", "system","-system-freetype", "Use the libfreetype provided by the system.");
desc("HARFBUZZ", "no", "-no-harfbuzz", "Do not compile in HarfBuzz-NG support.");
desc("HARFBUZZ", "yes", "-qt-harfbuzz", "(experimental) Use HarfBuzz-NG bundled with Qt\n"
"to do text shaping. It can still be disabled\n"
"by setting QT_HARFBUZZ environment variable to \"old\".");
desc("HARFBUZZ", "system","-system-harfbuzz", "(experimental) Use HarfBuzz-NG from the operating system\n"
"to do text shaping. It can still be disabled\n"
"by setting QT_HARFBUZZ environment variable to \"old\".");
if ((platform() == QNX) || (platform() == BLACKBERRY)) {
desc("SLOG2", "yes", "-slog2", "Compile with slog2 support.");
desc("SLOG2", "no", "-no-slog2", "Do not compile with slog2 support.");
@ -2071,6 +2087,9 @@ bool Configure::checkAvailability(const QString &part)
available = checkAngleAvailability();
}
else if (part == "HARFBUZZ")
available = tryCompileProject("unix/harfbuzz");
else if (part == "LIBJPEG")
available = findFile("jpeglib.h");
else if (part == "LIBPNG")
@ -2487,6 +2506,11 @@ void Configure::generateOutputVars()
else if (dictionary[ "FREETYPE" ] == "system")
qtConfig += "system-freetype";
if (dictionary[ "HARFBUZZ" ] == "yes")
qtConfig += "harfbuzz";
else if (dictionary[ "HARFBUZZ" ] == "system")
qtConfig += "system-harfbuzz";
// Styles -------------------------------------------------------
if (dictionary[ "STYLE_WINDOWS" ] == "yes")
qmakeStyles += "windows";
@ -3319,6 +3343,7 @@ void Configure::generateConfigfiles()
if (dictionary["DBUS"] == "no") qconfigList += "QT_NO_DBUS";
if (dictionary["QML_DEBUG"] == "no") qconfigList += "QT_QML_NO_DEBUGGER";
if (dictionary["FREETYPE"] == "no") qconfigList += "QT_NO_FREETYPE";
if (dictionary["HARFBUZZ"] == "no") qconfigList += "QT_NO_HARFBUZZ";
if (dictionary["NATIVE_GESTURES"] == "no") qconfigList += "QT_NO_NATIVE_GESTURES";
if (dictionary["OPENGL_ES_CM"] == "yes" ||
@ -3488,6 +3513,7 @@ void Configure::displayConfig()
sout << " JPEG support............" << dictionary[ "JPEG" ] << endl;
sout << " PNG support............." << dictionary[ "PNG" ] << endl;
sout << " FreeType support........" << dictionary[ "FREETYPE" ] << endl;
sout << " HarfBuzz-NG support....." << dictionary[ "HARFBUZZ" ] << endl;
sout << " PCRE support............" << dictionary[ "PCRE" ] << endl;
sout << " ICU support............." << dictionary[ "ICU" ] << endl;
if ((platform() == QNX) || (platform() == BLACKBERRY))