use helper libs via QMAKE_USE

for that, qt_help_lib.prf gains the ability to write "external module
pri" files that contain suitable information for QMAKE_USE.

these files have a bunch of limitations:
- they are not installed, because a) they are not relocatable and b) the
  helper libs' headers are not installed, either
- it won't work with qmake -r, which is ok, as qt5 does not build with
  qmake -r anyway
- deps are not transitive, neither at build nor at use time

the freetype, harfbuzz-ng, pcre, and png helper libs have been adjusted
accordingly, and their uses replaced with QMAKE_USE instances. this also
allowed inlining the now trivial {harfbuzz,pcrc,png}_dependency.pri
files. freetype_dependency.pri remains due to its funkiness.

Change-Id: I16890eecb122e34ec49f3d3e68380d1ea71a198a
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
This commit is contained in:
Oswald Buddenhagen 2016-09-30 20:53:53 +02:00 committed by Oswald Buddenhagen
parent 81755e9623
commit 9a088e7869
16 changed files with 49 additions and 45 deletions

View File

@ -15,6 +15,9 @@ TEMPLATE = lib
CONFIG -= qt
QT = # In case qt is re-added.
INCLUDEPATH += $$MODULE_INCLUDEPATH
DEFINES += $$MODULE_DEFINES
CONFIG -= warning_clean # Don't presume 3rd party code to be clean
load(qt_common)
@ -25,6 +28,28 @@ qtConfig(build_all): CONFIG += build_all
DESTDIR = $$MODULE_BASE_OUTDIR/lib
DLLDESTDIR = $$MODULE_BASE_OUTDIR/bin
!build_pass {
MODULE = $$replace(TARGET, ^qt, )
MODULE_PRI = $$MODULE_QMAKE_OUTDIR/mkspecs/modules/qt_ext_$${MODULE}.pri
ucmodule = $$upper($$MODULE)
MODULE_PRI_CONT = \
"QMAKE_INCDIR_$${ucmodule} = $$val_escape(MODULE_INCLUDEPATH)" \
"QMAKE_DEFINES_$${ucmodule} = $$val_escape(MODULE_DEFINES)"
MODULE_LIBS = -L$$DESTDIR -l$$TARGET
debug_and_release {
win32: MODULE_DEBUG_LIBS = -L$$DESTDIR -l$${TARGET}d
darwin: MODULE_DEBUG_LIBS = -L$$DESTDIR -l$${TARGET}_debug
MODULE_PRI_CONT += \
"QMAKE_LIBS_$${ucmodule}_DEBUG = $$val_escape(MODULE_DEBUG_LIBS)" \
"QMAKE_LIBS_$${ucmodule}_RELEASE = $$val_escape(MODULE_LIBS)"
} else {
MODULE_PRI_CONT += \
"QMAKE_LIBS_$${ucmodule} = $$val_escape(MODULE_LIBS)"
}
write_file($$MODULE_PRI, MODULE_PRI_CONT)|error()
}
# In static builds of Qt, convenience libraries must be installed,
# as in this case they are not linked to the final library/plugin.
installed|if(!not_installed:qtConfig(static)): load(qt_installs)

View File

@ -6,6 +6,8 @@ CONFIG += \
exceptions_off rtti_off warn_off \
installed
MODULE_INCLUDEPATH += $$PWD/include
load(qt_helper_lib)
SOURCES += \
@ -61,16 +63,12 @@ win32 {
INCLUDEPATH += $$PWD/builds/unix
}
INCLUDEPATH += $$PWD/include
DEFINES += FT2_BUILD_LIBRARY
DEFINES += FT_CONFIG_OPTION_SYSTEM_ZLIB
include(../zlib_dependency.pri)
QT_FOR_CONFIG += gui-private
include($$OUT_PWD/../../gui/qtgui-config.pri)
DEFINES += FT_CONFIG_OPTION_USE_PNG
include($$PWD/../png_dependency.pri)
QMAKE_USE_PRIVATE += libpng
DEFINES += TT_CONFIG_OPTION_SUBPIXEL_HINTING

View File

@ -1,6 +1,5 @@
qtConfig(system-freetype) {
QMAKE_USE_PRIVATE += freetype/nolink
} else: qtConfig(freetype) {
INCLUDEPATH += $$PWD/freetype/include
LIBS_PRIVATE += -L$$QT_BUILD_TREE/lib -lqtfreetype$$qtPlatformTargetSuffix()
QMAKE_USE_PRIVATE += freetype
}

View File

@ -1,10 +1,12 @@
TARGET = qtharfbuzzng
TARGET = qtharfbuzz
CONFIG += \
static \
hide_symbols \
exceptions_off rtti_off warn_off
MODULE_INCLUDEPATH += $$PWD/include
load(qt_helper_lib)
# built-in shapers list configuration:
@ -24,8 +26,6 @@ win32: DEFINES += HB_NO_WIN1256
#Workaround https://code.google.com/p/android/issues/detail?id=194631
android: DEFINES += _POSIX_C_SOURCE=200112L
INCLUDEPATH += $$PWD/include
# Harfbuzz-NG inside Qt uses the Qt atomics (inline code only)
INCLUDEPATH += $$QT.core.includes
DEFINES += QT_NO_VERSION_TAGGING

View File

@ -1,6 +0,0 @@
qtConfig(system-harfbuzz) {
QMAKE_USE_PRIVATE += harfbuzz
} else: qtConfig(harfbuzz) {
INCLUDEPATH += $$PWD/harfbuzz-ng/include
LIBS_PRIVATE += -L$$QT_BUILD_TREE/lib -lqtharfbuzzng$$qtPlatformTargetSuffix()
}

View File

@ -1,4 +1,4 @@
TARGET = qtpng
TARGET = qtlibpng
CONFIG += \
static \
@ -6,6 +6,8 @@ CONFIG += \
exceptions_off rtti_off warn_off \
installed
MODULE_INCLUDEPATH = $$PWD
load(qt_helper_lib)
DEFINES += PNG_ARM_NEON_OPT=0

View File

@ -5,12 +5,14 @@ CONFIG += \
hide_symbols \
exceptions_off rtti_off warn_off
win32: MODULE_DEFINES += PCRE_STATIC
MODULE_INCLUDEPATH += $$PWD
load(qt_helper_lib)
DEFINES += HAVE_CONFIG_H
# platform/compiler specific definitions
win32: DEFINES += PCRE_STATIC
uikit|qnx|winrt: DEFINES += PCRE_DISABLE_JIT
SOURCES += \

View File

@ -1,7 +0,0 @@
qtConfig(system-pcre) {
QMAKE_USE_PRIVATE += pcre
} else {
win32: DEFINES += PCRE_STATIC
INCLUDEPATH += $$PWD/pcre
LIBS_PRIVATE += -L$$QT_BUILD_TREE/lib -lqtpcre$$qtPlatformTargetSuffix()
}

View File

@ -1,6 +0,0 @@
qtConfig(system-png) {
QMAKE_USE_PRIVATE += libpng
} else: qtConfig(png) {
INCLUDEPATH += $$PWD/libpng
LIBS_PRIVATE += -L$$QT_BUILD_TREE/lib -lqtpng$$qtPlatformTargetSuffix()
}

View File

@ -3,7 +3,8 @@ DEF_FILE_TARGET=$${TARGET}
TARGET=$$qtLibraryTarget($${LIBEGL_NAME})
winrt: LIBS_PRIVATE += -ld3d11
LIBS_PRIVATE += -ldxguid -L$$QT_BUILD_TREE/lib -l$$qtLibraryTarget($${LIBGLESV2_NAME})
LIBS_PRIVATE += -ldxguid
QMAKE_USE_PRIVATE += $${LIBGLESV2_NAME}
DEFINES += GL_APICALL= GL_GLEXT_PROTOTYPES= EGLAPI= LIBEGL_IMPLEMENTATION

View File

@ -174,7 +174,7 @@ qtConfig(timezone) {
}
qtConfig(regularexpression) {
include($$PWD/../../3rdparty/pcre_dependency.pri)
QMAKE_USE_PRIVATE += pcre
HEADERS += tools/qregularexpression.h
SOURCES += tools/qregularexpression.cpp

View File

@ -74,7 +74,7 @@ SOURCES += \
qtConfig(png) {
HEADERS += image/qpnghandler_p.h
SOURCES += image/qpnghandler.cpp
include($$PWD/../../3rdparty/png_dependency.pri)
QMAKE_USE_PRIVATE += libpng
}
# SIMD

View File

@ -88,7 +88,7 @@ HEADERS += \
qtConfig(harfbuzz)|qtConfig(system-harfbuzz) {
DEFINES += QT_ENABLE_HARFBUZZ_NG
include($$PWD/../../3rdparty/harfbuzz_dependency.pri)
QMAKE_USE_PRIVATE += harfbuzz
SOURCES += text/qharfbuzzng.cpp
HEADERS += text/qharfbuzzng_p.h

View File

@ -22,10 +22,7 @@ CONFIG += qpa/genericunixfontdatabase
!qtConfig(system-xcb) {
DEFINES += XCB_USE_RENDER
XCB_DIR = $$clean_path($$PWD/../../../../3rdparty/xcb)
INCLUDEPATH += $$XCB_DIR/include $$XCB_DIR/include/xcb $$XCB_DIR/sysinclude
LIBS += -L$$MODULE_BASE_OUTDIR/lib -lxcb-static$$qtPlatformTargetSuffix()
QMAKE_USE += xcb
QMAKE_USE += xcb-static xcb
} else {
qtConfig(xkb): QMAKE_USE += xcb_xkb
# to support custom cursors with depth > 1

View File

@ -5,11 +5,11 @@
# libxcb-xinerama
#
CONFIG += static
load(qt_helper_lib)
XCB_DIR = ../../../../3rdparty/xcb
INCLUDEPATH += $$XCB_DIR/include $$XCB_DIR/include/xcb $$XCB_DIR/sysinclude
MODULE_INCLUDEPATH += $$XCB_DIR/include $$XCB_DIR/sysinclude
INCLUDEPATH += $$XCB_DIR/include/xcb
QMAKE_USE += xcb/nolink
@ -75,3 +75,5 @@ SOURCES += \
OTHER_FILES = $$XCB_DIR/README
TR_EXCLUDE += $$XCB_DIR/*
load(qt_helper_lib)

View File

@ -68,10 +68,7 @@ CONFIG += qpa/genericunixfontdatabase
!qtConfig(system-xcb) {
DEFINES += XCB_USE_RENDER
XCB_DIR = ../../../3rdparty/xcb
INCLUDEPATH += $$XCB_DIR/include $$XCB_DIR/sysinclude
LIBS += -L$$MODULE_BASE_OUTDIR/lib -lxcb-static$$qtPlatformTargetSuffix()
QMAKE_USE += xcb
QMAKE_USE += xcb-static xcb
} else {
LIBS += -lxcb-xinerama ### there is no configure test for this!
qtConfig(xkb): QMAKE_USE += xcb_xkb