rewrite library handling in configure

so far, each library was distributed over a test and (optionally) a
'library' output of a feature. this was conceptually messy and limiting.
so instead, turn libraries into a category of their own.

libraries now support multiple properly separated sources, which makes
overriding them a lot saner. sources can be conditional to accommodate
platform differences.

as an immediate consequence, move (almost) all library references from
the config test projects to the json file.
a few tests were excluded, because they are doing somewhat magic things
that should not be handled in this bulk change:
- freetype: .pri file shared with actual source code
- clock-gettime: -lrt is conditional, and there is a .pri file which is
  shared with actual source code
- ipc_posix: -lrt & -lpthread conditional
- iconv: -liconv conditional

the multi-source mechanism is used to make a variety of tests work on
windows, where the library name differs from unix (and sometimes between
build configurations). some tests still needed minor adjustments to
actually work.

on the way, fix up disagreements between manually specified libraries
and pkg-config lines (affecting several xcb-related tests).

Change-Id: Ic8c58556fa0cf8f981d386b13ea34b4431b127c5
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Oswald Buddenhagen 2016-08-15 14:40:52 +02:00
parent 4b8dd9c846
commit c0cc505209
75 changed files with 910 additions and 889 deletions

View File

@ -1,4 +1,3 @@
SOURCES = libproxy.cpp
CONFIG -= qt dylib
mac:CONFIG -= app_bundle
LIBS += -lproxy

View File

@ -1,3 +1,2 @@
OBJECTIVE_SOURCES = corewlantest.mm
LIBS += -framework CoreWLAN -framework Foundation
CONFIG -= qt

View File

@ -1,4 +1,3 @@
SOURCES = direct2d.cpp
LIBS += -ld2d1 -ldwrite -ld3d11
CONFIG -= qt
CONFIG += console

View File

@ -1,12 +1,3 @@
SOURCES = egl-x11.cpp
for(p, QMAKE_LIBDIR_EGL) {
LIBS += -L$$p
}
!isEmpty(QMAKE_INCDIR_EGL): INCLUDEPATH += $$QMAKE_INCDIR_EGL
!isEmpty(QMAKE_LIBS_EGL): LIBS += $$QMAKE_LIBS_EGL
CONFIG -= qt
LIBS += -lxcb -lX11 -lX11-xcb

View File

@ -1,10 +1,3 @@
SOURCES = egl.cpp
for(p, QMAKE_LIBDIR_EGL) {
LIBS += -L$$p
}
!isEmpty(QMAKE_INCDIR_EGL): INCLUDEPATH += $$QMAKE_INCDIR_EGL
!isEmpty(QMAKE_LIBS_EGL): LIBS += $$QMAKE_LIBS_EGL
CONFIG -= qt

View File

@ -1,11 +1,3 @@
SOURCES = eglfs-brcm.cpp
CONFIG -= qt
INCLUDEPATH += $$QMAKE_INCDIR_EGL
for(p, QMAKE_LIBDIR_EGL) {
LIBS += -L$$p
}
LIBS += -lEGL -lGLESv2 -lbcm_host

View File

@ -1,9 +1,3 @@
SOURCES = eglfs-egldevice.cpp
for(p, QMAKE_LIBDIR_EGL) {
LIBS += -L$$p
}
INCLUDEPATH += $$QMAKE_INCDIR_EGL
LIBS += $$QMAKE_LIBS_EGL
CONFIG -= qt

View File

@ -1,5 +1,3 @@
SOURCES = eglfs-mali-2.cpp
CONFIG -= qt
LIBS += -lEGL -lGLESv2

View File

@ -1,5 +1,3 @@
SOURCES = eglfs-mali.cpp
CONFIG -= qt
LIBS += -lEGL -lGLESv2

View File

@ -5,10 +5,3 @@ integrity {
DEFINES += LINUX=1 EGL_API_FB=1
}
CONFIG -= qt
for(p, QMAKE_LIBDIR_OPENGL_EGL) {
exists($$p):LIBS += -L$$p
}
!isEmpty(QMAKE_INCDIR_EGL): INCLUDEPATH += $$QMAKE_INCDIR_EGL
!isEmpty(QMAKE_LIBS_EGL): LIBS += $$QMAKE_LIBS_EGL

View File

@ -1,4 +1,2 @@
SOURCES = gbm.cpp
CONFIG += link_pkgconfig
PKGCONFIG += gbm
CONFIG -= qt

View File

@ -1,8 +1,2 @@
SOURCES = kms.cpp
!contains(QT_CONFIG, no-pkg-config) {
CONFIG += link_pkgconfig
PKGCONFIG += libdrm
} else {
LIBS += -ldrm
}
CONFIG -= qt

View File

@ -1,4 +1,2 @@
SOURCES = mirclient.cpp
CONFIG += link_pkgconfig
PKGCONFIG += egl mirclient ubuntu-platform-api
CONFIG -= qt

View File

@ -1,5 +1,3 @@
SOURCES = wl.cpp
CONFIG -= qt
CONFIG += link_pkgconfig
PKGCONFIG += wayland-server

View File

@ -1,5 +1,2 @@
SOURCES = xcb-glx.cpp
CONFIG -= qt
LIBS += -lxcb -lxcb-glx

View File

@ -1,5 +1,2 @@
SOURCES = xcb-render.cpp
CONFIG -= qt
LIBS += -lxcb -lxcb-render -lxcb-render-util

View File

@ -1,5 +1,2 @@
SOURCES = xcb.cpp
CONFIG -= qt
LIBS += -lxcb -lxcb-image -lxcb-keysyms -lxcb-icccm -lxcb-sync -lxcb-xfixes -lxcb-randr

View File

@ -1,5 +1,2 @@
SOURCES = xcb-xkb.cpp
CONFIG -= qt
LIBS += -lxcb -lxcb-xkb

View File

@ -1,5 +1,2 @@
SOURCES = xcb-xlib.cpp
CONFIG -= qt
LIBS += -lxcb -lX11 -lX11-xcb

View File

@ -1,5 +1,2 @@
SOURCES = xcb.cpp
CONFIG -= qt
LIBS += -lxcb

View File

@ -1,3 +1,2 @@
SOURCES = alsatest.cpp
LIBS+=-lasound
CONFIG -= qt dylib

View File

@ -1,3 +1,2 @@
SOURCES = cups.cpp
CONFIG -= qt dylib
LIBS += -lcups

View File

@ -1,3 +1,2 @@
SOURCES = db2.cpp
CONFIG -= qt dylib
LIBS += -ldb2

View File

@ -1,2 +1,8 @@
SOURCES = dbus.cpp
CONFIG -= qt
CONFIG += build_all
CONFIG(debug, debug|release): \
LIBS += $$LIBS_DEBUG
else: \
LIBS += $$LIBS_RELEASE

View File

@ -1,4 +1,3 @@
SOURCES = doubleconversion.cpp
CONFIG -= qt
CONFIG += console
LIBS += -ldouble-conversion

View File

@ -1,4 +1,3 @@
SOURCES = fontconfig.cpp
CONFIG -= qt
LIBS += -lfreetype -lfontconfig
include(../../unix/freetype/freetype.pri)

View File

@ -1,4 +1,3 @@
SOURCES = freetype.cpp
CONFIG -= qt
LIBS += -lfreetype
include(freetype.pri)

View File

@ -1,3 +1,2 @@
SOURCES = getaddrinfotest.cpp
CONFIG -= qt dylib
LIBS += $$QMAKE_LIBS_NETWORK

View File

@ -1,4 +1,3 @@
SOURCES = getifaddrs.cpp
CONFIG -= qt
QT =
LIBS += $$QMAKE_LIBS_NETWORK

View File

@ -1,3 +1,2 @@
SOURCES = gnu-libiconv.cpp
CONFIG -= qt dylib
LIBS += -liconv

View File

@ -1,22 +1,4 @@
SOURCES += gstreamer.cpp
CONFIG += link_pkgconfig
gst-0.10 {
PKGCONFIG_PRIVATE += \
gstreamer-0.10 \
gstreamer-base-0.10 \
gstreamer-audio-0.10 \
gstreamer-video-0.10 \
gstreamer-pbutils-0.10
} else:gst-1.0 {
PKGCONFIG_PRIVATE += \
gstreamer-1.0 \
gstreamer-base-1.0 \
gstreamer-audio-1.0 \
gstreamer-video-1.0 \
gstreamer-pbutils-1.0
}
CONFIG -= qt

View File

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

View File

@ -1,3 +1,2 @@
SOURCES = ibase.cpp
CONFIG -= qt dylib
LIBS += -lgds

View File

@ -2,4 +2,8 @@ SOURCES = icu.cpp
CONFIG += console
CONFIG -= qt dylib
include($$PWD/../../../src/3rdparty/icu_dependency.pri)
CONFIG += build_all
CONFIG(debug, debug|release): \
LIBS += $$LIBS_DEBUG
else: \
LIBS += $$LIBS_RELEASE

View File

@ -1,46 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation 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 The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/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 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <sql.h>
#include <sqlext.h>
int main(int, char **)
{
return 0;
}

View File

@ -1,3 +0,0 @@
SOURCES = iodbc.cpp
CONFIG -= qt dylib
LIBS += -liodbc

View File

@ -1,4 +1,3 @@
SOURCES = ipv6ifname.cpp
CONFIG -= qt
QT =
LIBS += $$QMAKE_LIBS_NETWORK

View File

@ -1,10 +1,3 @@
SOURCES = journald.c
CONFIG += link_pkgconfig
packagesExist(libsystemd): \
PKGCONFIG_PRIVATE += libsystemd
else: \
PKGCONFIG_PRIVATE += libsystemd-journal
CONFIG -= qt

View File

@ -1,3 +1,2 @@
SOURCES = lgmon.cpp
CONFIG -= qt
LIBS += -llgmon

View File

@ -1,2 +0,0 @@
include(../dlopen/dlopen.pro)
LIBS += -ldl

View File

@ -1,4 +1,2 @@
SOURCES = libinput.cpp
CONFIG -= qt
LIBS += $$QMAKE_LIBS_LIBINPUT
INCLUDEPATH += $$QMAKE_INCDIR_LIBINPUT

View File

@ -1,3 +1,2 @@
SOURCES = libjpeg.cpp
CONFIG -= qt dylib
LIBS += -ljpeg

View File

@ -1,8 +1,2 @@
SOURCES = libpng.cpp
CONFIG -= qt dylib
!contains(QT_CONFIG, no-pkg-config) {
CONFIG += link_pkgconfig
PKGCONFIG += libpng
} else {
LIBS += -lpng
}

View File

@ -1,4 +1,2 @@
SOURCES = libudev.cpp
CONFIG -= qt
LIBS += $$QMAKE_LIBS_LIBUDEV
INCLUDEPATH += $$QMAKE_INCDIR_LIBUDEV

View File

@ -1,6 +1,3 @@
SOURCES = mtdev.cpp
CONFIG += link_pkgconfig
PKGCONFIG_PRIVATE += mtdev
CONFIG -= qt

View File

@ -36,6 +36,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(WIN64) || defined(_WIN64) || defined(__WIN64__)
#include <windows.h>
#endif
#include "mysql.h"

View File

@ -1,3 +1,2 @@
SOURCES = mysql.cpp
CONFIG -= qt dylib
LIBS += -lmysqlclient

View File

@ -1,3 +0,0 @@
SOURCES = ../mysql/mysql.cpp
CONFIG -= qt dylib
LIBS += -lmysqlclient_r

View File

@ -1,3 +1,2 @@
SOURCES = oci.cpp
CONFIG -= qt dylib
LIBS += -lclntsh

View File

@ -37,7 +37,7 @@
**
****************************************************************************/
#ifdef __MINGW32__
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(WIN64) || defined(_WIN64) || defined(__WIN64__)
#include <windows.h>
#endif
#include <sql.h>
@ -45,5 +45,7 @@
int main(int, char **)
{
SQLHANDLE env;
SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);
return 0;
}

View File

@ -1,4 +1,2 @@
SOURCES = odbc.cpp
CONFIG -= qt dylib
mingw:LIBS += -lodbc32
else:LIBS += -lodbc

View File

@ -1,11 +1,5 @@
SOURCES = opengldesktop.cpp
INCLUDEPATH += $$QMAKE_INCDIR_OPENGL
for(p, QMAKE_LIBDIR_OPENGL) {
exists($$p):LIBS += -L$$p
}
CONFIG -= qt
LIBS += $$QMAKE_LIBS_OPENGL
mac:DEFINES += Q_OS_MAC

View File

@ -1,12 +1,7 @@
SOURCES = opengles2.cpp
INCLUDEPATH += $$QMAKE_INCDIR_OPENGL_ES2
for(p, QMAKE_LIBDIR_OPENGL_ES2) {
LIBS += -L$$p
}
CONFIG -= qt
LIBS += $$QMAKE_LIBS_OPENGL_ES2
mac {
DEFINES += BUILD_ON_MAC
}

View File

@ -3,14 +3,9 @@
# the library.
SOURCES = opengles3.cpp
INCLUDEPATH += $$QMAKE_INCDIR_OPENGL_ES2
for(p, QMAKE_LIBDIR_OPENGL_ES2) {
LIBS += -L$$p
}
CONFIG -= qt
LIBS += $$QMAKE_LIBS_OPENGL_ES2
mac {
DEFINES += BUILD_ON_MAC
}

View File

@ -3,11 +3,5 @@
# the library.
SOURCES = opengles31.cpp
INCLUDEPATH += $$QMAKE_INCDIR_OPENGL_ES2
for(p, QMAKE_LIBDIR_OPENGL_ES2) {
LIBS += -L$$p
}
CONFIG -= qt
LIBS += $$QMAKE_LIBS_OPENGL_ES2

View File

@ -1,3 +1,2 @@
SOURCES = pcre.cpp
CONFIG -= qt dylib
LIBS += -lpcre16

View File

@ -1,3 +1,2 @@
SOURCES = pps.cpp
CONFIG -= qt
LIBS += -lpps

View File

@ -1,3 +1,2 @@
SOURCES = psql.cpp
CONFIG -= qt dylib
LIBS *= -lpq

View File

@ -1,3 +1,2 @@
SOURCES = pulseaudio.cpp
CONFIG -= qt
LIBS +=

View File

@ -1,3 +1,2 @@
SOURCES = qqnx_imf.cpp
CONFIG -= qt
LIBS += -linput_client

View File

@ -1,4 +1,3 @@
SOURCES = sctp.cpp
CONFIG -= qt
QT =
LIBS += $$QMAKE_LIBS_NETWORK

View File

@ -1,3 +1,2 @@
SOURCES = slog2.cpp
CONFIG -= qt
LIBS += -lslog2

View File

@ -1,3 +1,2 @@
SOURCES = sqlite2.cpp
CONFIG -= qt dylib
LIBS += -lsqlite

View File

@ -1,3 +1,2 @@
SOURCES = tds.cpp
CONFIG -= qt dylib
LIBS += -lsybdb

View File

@ -1,3 +1,2 @@
SOURCES = tslib.cpp
CONFIG -= qt
LIBS += -lts

View File

@ -1,3 +1,2 @@
SOURCES = zlib.cpp
CONFIG -= qt dylib
LIBS += -lz

View File

@ -1,4 +1,3 @@
SOURCES = directwrite.cpp
LIBS += -ldwrite
CONFIG -= qt
CONFIG += console

View File

@ -1,4 +1,3 @@
SOURCES = directwrite2.cpp
LIBS += -ldwrite
CONFIG -= qt
CONFIG += console

View File

@ -1,47 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** 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 The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/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 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <GL/gl.h>
int main(int, char **)
{
GLuint x;
x = 0;
return 0;
}

View File

@ -1,11 +0,0 @@
SOURCES = opengl.cpp
CONFIG += x11
INCLUDEPATH += $$QMAKE_INCDIR_OPENGL
for(p, QMAKE_LIBDIR_OPENGL) {
exists($$p):LIBS += -L$$p
}
CONFIG -= qt
mingw:LIBS += -lopengl32
else:LIBS += -lGL

View File

@ -1,4 +1,3 @@
CONFIG += x11
CONFIG -= qt
LIBS += -lXi
SOURCES = xinput2.cpp

View File

@ -1,4 +1,3 @@
SOURCES = xrender.cpp
CONFIG += x11
CONFIG -= qt
LIBS += -lXrender

File diff suppressed because it is too large Load Diff

View File

@ -228,19 +228,14 @@ defineTest(qtConfTest_buildParts) {
return(true)
}
defineTest(qtConfTest_openssl) {
defineTest(qtConfLibrary_openssl) {
libs = $$getenv("OPENSSL_LIBS")
!isEmpty(libs) {
$${1}.libs = $$libs
export($${1}.libs)
return(true)
}
$${1}.showNote = false
isEmpty(libs): $${1}.showNote = true
export($${1}.showNote)
return(true)
return(false)
}
defineTest(qtConfTest_checkCompiler) {
@ -288,7 +283,7 @@ defineReplace(filterLibraryPath) {
return($$str)
}
defineTest(qtConfTest_psqlCompile) {
defineTest(qtConfLibrary_psqlConfig) {
pg_config = $$config.input.psql_config
isEmpty(pg_config): \
pg_config = $$qtConfFindInPath("pg_config")
@ -304,21 +299,25 @@ defineTest(qtConfTest_psqlCompile) {
$${1}.includedir = "$$val_escape(includedir)"
!isEmpty(includedir): \
$${1}.cflags = "-I$$val_escape(includedir)"
export($${1}.libs)
export($${1}.includedir)
export($${1}.cflags)
return(true)
}
# Respect PSQL_LIBS if set
PSQL_LIBS = $$getenv(PSQL_LIBS)
!isEmpty($$PSQL_LIBS): $${1}.libs = $$PSQL_LIBS
export($${1}.libs)
export($${1}.includedir)
export($${1}.cflags)
qtConfTest_compile($${1}): return(true)
return(false)
}
defineTest(qtConfTest_mysqlCompile) {
defineTest(qtConfLibrary_psqlEnv) {
# Respect PSQL_LIBS if set
PSQL_LIBS = $$getenv(PSQL_LIBS)
!isEmpty(PSQL_LIBS) {
$${1}.libs = $$PSQL_LIBS
export($${1}.libs)
}
return(true)
}
defineTest(qtConfLibrary_mysqlConfig) {
mysql_config = $$config.input.mysql_config
isEmpty(mysql_config): \
mysql_config = $$qtConfFindInPath("mysql_config")
@ -346,23 +345,22 @@ defineTest(qtConfTest_mysqlCompile) {
export($${1}.libs)
export($${1}.includedir)
export($${1}.cflags)
return(true)
}
qtConfTest_compile($${1}): return(true)
return(false)
}
defineTest(qtConfTest_tdsCompile) {
defineTest(qtConfLibrary_sybaseEnv) {
libs =
sybase = $$getenv(SYBASE)
!isEmpty(sybase): \
libs += "-L$${sybase}/lib"
libs += $$getenv(SYBASE_LIBS)
$${1}.libs = "$$val_escape(libs)"
export($${1}.libs)
qtConfTest_compile($${1}): return(true)
return(false)
!isEmpty(libs) {
$${1}.libs = "$$val_escape(libs)"
export($${1}.libs)
}
return(true)
}

View File

@ -322,11 +322,75 @@ defineReplace(qtConfPrepareArgs) {
return($$args)
}
defineTest(qtConfTest_pkgConfig) {
defineTest(qtConfSetupLibraries) {
for (l, config.libraries._KEYS_) {
lpfx = config.libraries.$${l}
# 'export' may be omitted, in which case it falls back to the library's name
!defined($${lpfx}.export, var) {
$${lpfx}.export = $$l
export($${lpfx}.export)
}
isEmpty($${lpfx}.sources._KEYS_): \
error("Library $$l defines no sources")
for (s, $${lpfx}.sources._KEYS_) {
spfx = $${lpfx}.sources.$${s}
# link back to parent object
$${spfx}.library = $$l
export($${spfx}.library)
# a plain string is transformed into a structure
isEmpty($${spfx}._KEYS_) {
$${spfx}.libs = $$eval($${spfx})
export($${spfx}.libs)
}
# if the type is missing (implicitly in the case of plain strings), assume 'inline'
isEmpty($${spfx}.type) {
$${spfx}.type = inline
export($${spfx}.type)
}
}
}
}
# the library is specified inline in a 'libs' field.
# this source type cannot fail.
defineTest(qtConfLibrary_inline) {
lib = $$eval($${1}.library)
!defined($${1}.libs, var): \
error("'inline' source in library '$$lib' does not specify 'libs'.")
return(true)
}
# the library is provided by the qmake spec.
# this source type cannot fail.
defineTest(qtConfLibrary_makeSpec) {
spec = $$eval($${1}.spec)
isEmpty(spec): \
error("makeSpec source in library '$$eval($${1}.library)' does not specify 'spec'.")
$${1}.includedir = "$$val_escape(QMAKE_INCDIR_$$spec)"
export($${1}.includedir)
$${1}.cflags = "$$val_escape(QMAKE_CFLAGS_$$spec)"
export($${1}.cflags)
libs =
for (l, QMAKE_LIBDIR_$$spec): \
libs += -L$$l
libs += $$eval(QMAKE_LIBS_$$spec)
$${1}.libs = "$$val_escape(libs)"
export($${1}.libs)
# the library definition is always in scope, so no point in exporting it.
$${1}.export = false
export($${1}.export)
return(true)
}
# the library is found via pkg-config.
defineTest(qtConfLibrary_pkgConfig) {
pkg_config = $$qtConfPkgConfig($$eval($${1}.host))
isEmpty(pkg_config): \
return(false)
args = $$qtConfPrepareArgs($$eval($${1}.pkg-config-args))
args = $$qtConfPrepareArgs($$eval($${1}.args))
!qtConfPkgConfigPackageExists($$pkg_config, $$args): \
return(false)
@ -361,14 +425,117 @@ defineTest(qtConfTest_getPkgConfigVariable) {
return(true)
}
defineReplace(qtConfLibraryArgs) {
qmake_args =
libs = $$eval($${1}.libs)
!isEmpty(libs): \
qmake_args += $$system_quote(LIBS += $$libs)
for (b, $${1}.builds._KEYS_): \
qmake_args += $$system_quote(LIBS_$$upper($$b) += $$eval($${1}.builds.$${b}))
includedir = $$eval($${1}.includedir)
!isEmpty(includedir): \
qmake_args += $$system_quote(INCLUDEPATH *= $$includedir)
return($$qmake_args)
}
defineTest(qtConfExportLibrary) {
isEmpty(2): return()
!$$qtConfEvaluate($$eval($${1}.export)): return()
output = privatePro
eval(libs = $$eval($${1}.libs))
eval(cflags = $$eval($${1}.cflags))
eval(includes = $$eval($${1}.includedir))
version = $$split($${1}.version, '.')
NAME = $$upper($$2)
!isEmpty(libs): qtConfOutputVar(assign, $$output, QMAKE_LIBS_$$NAME, $$libs)
for (b, $${1}.builds._KEYS_): \
qtConfOutputVar(assign, $$output, QMAKE_LIBS_$${NAME}_$$upper($$b), \
$$eval($${1}.builds.$${b}))
!isEmpty(cflags): qtConfOutputVar(assign, $$output, QMAKE_CFLAGS_$$NAME, $$cflags)
!isEmpty(includes): qtConfOutputVar(assign, $$output, QMAKE_INCDIR_$$NAME, $$includes)
!isEmpty(version) {
qtConfOutputVar(assign, $$output, QMAKE_$${NAME}_VERSION_MAJOR, $$member(version, 0))
qtConfOutputVar(assign, $$output, QMAKE_$${NAME}_VERSION_MINOR, $$member(version, 1))
qtConfOutputVar(assign, $$output, QMAKE_$${NAME}_VERSION_PATCH, $$member(version, 2))
}
export(config.output.$${output})
}
defineTest(qtConfHandleLibrary) {
lpfx = config.libraries.$$1
defined($${lpfx}.result, var): return()
qtLogTestIntro($${lpfx})
msg = "looking for library $${1}"
write_file($$QMAKE_CONFIG_LOG, msg, append)
result = false
for (s, $${lpfx}.sources._KEYS_) {
qtLog("Trying source $$s of library $${1}.")
spfx = $${lpfx}.sources.$${s}
t = $$eval($${spfx}.type)
call = qtConfLibrary_$$t
!defined($$call, test): \
error("Library $${1} source $${s} has unknown type '$$t'")
!$$qtConfEvaluate($$eval($${spfx}.condition)) {
qtLog("Source $$s of library $$1 failed condition.")
next()
}
!$${call}($$spfx) {
qtLog("Source $$s of library $$1 produced no result.")
next()
}
# if the library defines a test, use it to verify the source.
!isEmpty($${lpfx}.test) {
$${lpfx}.literal_args = $$qtConfLibraryArgs($$spfx)
$${lpfx}.host = $$eval($${spfx}.host)
!qtConfTest_compile($$lpfx) {
qtLog("Source $$s of library $$1 failed verification.")
next()
}
}
# immediately output the library as well.
qtConfExportLibrary($${spfx}, $$eval($${lpfx}.export))
$${lpfx}.source = $$s
export($${lpfx}.source)
result = true
break()
}
qtLogTestResult($${lpfx}, $$result)
$${lpfx}.result = $$result
export($${lpfx}.result)
}
defineTest(qtConfTestPrepare_compile) {
for (u, $$list($$eval($${1}.use))) {
!contains(config.libraries._KEYS_, $$u): \
error("Test $$1 tries to use undeclared library '$$u'")
qtConfHandleLibrary($$u)
lpfx = config.libraries.$${u}
isEmpty($${lpfx}.source): \
return(false)
$${1}.literal_args += $$qtConfLibraryArgs($${lpfx}.sources.$$eval($${lpfx}.source))
}
export($${1}.literal_args)
return(true)
}
defineTest(qtConfTest_compile) {
test = $$eval($${1}.test)
host = $$eval($${1}.host)
isEmpty(host): host = false
# get package config information
qtConfTest_pkgConfig($${1})
test_dir = $$QMAKE_CONFIG_TESTS_DIR/$$test
test_out_dir = $$shadowed($$test_dir)
!isEmpty($${1}.pro): \
@ -416,14 +583,6 @@ defineTest(qtConfTest_compile) {
qmake_args += $$EXTRA_QMAKE_ARGS
}
libs = $$eval($${1}.libs)
!isEmpty(libs): \
qmake_args += "\"LIBS += $$libs\""
includedir = $$eval($${1}.includedir)
!isEmpty(includedir): \
qmake_args += "\"INCLUDEPATH *= $$includedir\""
# Clean up after previous run
exists($$test_out_dir/Makefile): \
QMAKE_MAKE = "$$QMAKE_MAKE clean && $$QMAKE_MAKE"
@ -431,7 +590,7 @@ defineTest(qtConfTest_compile) {
mkpath($$test_out_dir)|error()
# add possible command line args
qmake_args += $$qtConfPrepareArgs($$eval($${1}.args))
qmake_args += $$qtConfPrepareArgs($$eval($${1}.args)) $$eval($${1}.literal_args)
qtRunLoggedCommand("$$test_cmd_base $$qmake_args $$system_quote($$test_dir)") {
qtRunLoggedCommand("$$test_cmd_base $$QMAKE_MAKE"): \
@ -445,7 +604,19 @@ defineTest(logn) {
log("$${1}$$escape_expand(\\n)")
}
defineTest(qtLogTestIntro) {
description = $$eval($${1}.description)
isEmpty(description): return()
msg = "Checking for $${description}... "
log($$msg)
$$QMAKE_CONFIG_VERBOSE: log("$$escape_expand(\\n)")
write_file($$QMAKE_CONFIG_LOG, msg, append)
}
defineTest(qtLogTestResult) {
isEmpty($${1}.description): return()
!isEmpty($${1}.log) {
field = $$eval($${1}.log)
log_msg = $$eval($${1}.$$field)
@ -472,27 +643,27 @@ defineTest(qtRunSingleTest) {
tpfx = config.tests.$${1}
defined($${tpfx}.result, var): \
return()
result = true
type = $$eval($${tpfx}.type)
call = "qtConfTest_$$type"
!defined($$call, test): \
error("Configure test $${1} refers to nonexistent type $$type")
description = $$eval($${tpfx}.description)
!isEmpty(description) {
msg = "checking for $${description}... "
log($$msg)
$$QMAKE_CONFIG_VERBOSE: log("$$escape_expand(\\n)")
preCall = "qtConfTestPrepare_$$type"
defined($$preCall, test): \
!$${preCall}($${tpfx}): result = false
$$result {
qtLogTestIntro($${tpfx})
msg = "executing config test $${1}"
write_file($$QMAKE_CONFIG_LOG, msg, append)
!$${call}($${tpfx}): result = false
qtLogTestResult($${tpfx}, $$result)
}
msg = "executing config test $${1}"
write_file($$QMAKE_CONFIG_LOG, msg, append)
result = false
$${call}($${tpfx}): result = true
!isEmpty(description): qtLogTestResult($${tpfx}, $$result)
$${tpfx}.result = $$result
export($${tpfx}.result)
}
@ -537,6 +708,19 @@ defineReplace(qtConfEvaluateSingleExpression) {
error("Unknown test object $${test} in expression '$${1}'.")
qtRunSingleTest($$test)
result = $$eval(config.tests.$${test}.$${var})
} else: contains(e, "^libs\..*") {
!qt_conf_tests_allowed: \
error("Expression '$${1}' refers to a library, which is not allowed at this stage of configuring.")
lib = $$section(e, ".", 1, 1)
var = $$section(e, ".", 2, -1)
isEmpty(var): \
var = result
!contains(config.libraries._KEYS_, $$lib): \
error("Unknown library object $${lib} in expression '$${1}'.")
qtConfHandleLibrary($$lib)
!defined(config.libraries.$${lib}.$${var}, var): \
var = sources.$$eval(config.libraries.$${lib}.$${source}).$$var
result = $$eval(config.libraries.$${lib}.$${var})
} else: contains(e, "^features\..*") {
feature = $$section(e, ".", 1, 1)
var = $$section(e, ".", 2, -1)
@ -1067,39 +1251,6 @@ defineTest(qtConfOutput_privateFeature) {
}
}
defineTest(qtConfOutput_library) {
!$${2}: return()
output = privatePro
name = "$$eval($${1}.name)"
isEmpty(name): \
name = $$eval($${1}.feature)
NAME = $$upper($$replace(name, [-.], _))
test = $$eval($${1}.test)
isEmpty(test): \
error("Output type 'library' used in feature '$$eval($${1}.feature)' without a 'test' entry.")
lookup = "config.tests.$$test"
isEmpty($${lookup}._KEYS_): \
error("Output type 'library' used in feature '$$eval($${1}.feature)' refers to undefined test '$$test'.")
eval(libs = $$eval($${lookup}.libs))
eval(cflags = $$eval($${lookup}.cflags))
eval(includes = $$eval($${lookup}.includedir))
version = $$split($${lookup}.version, '.')
!isEmpty(libs): qtConfOutputVar(assign, $$output, QMAKE_LIBS_$$NAME, $$libs)
!isEmpty(cflags): qtConfOutputVar(assign, $$output, QMAKE_CFLAGS_$$NAME, $$cflags)
!isEmpty(includes): qtConfOutputVar(assign, $$output, QMAKE_INCDIR_$$NAME, $$includes)
!isEmpty(version) {
qtConfOutputVar(assign, $$output, QMAKE_$${NAME}_VERSION_MAJOR, $$first(version))
qtConfOutputVar(assign, $$output, QMAKE_$${NAME}_VERSION_MINOR, $$member(version, 1))
qtConfOutputVar(assign, $$output, QMAKE_$${NAME}_VERSION_PATCH, $$member(version, 2))
}
export(config.output.$${output})
}
defineTest(qtConfProcessOneOutput) {
feature = $${1}
fpfx = config.features.$${feature}
@ -1163,6 +1314,8 @@ defineTest(qtConfigure) {
!parseJson(configure_data, config): \
error("Invalid or non-existent file $${1}.")
qtConfSetupLibraries()
qtConfParseCommandLine()
# do early checks, mainly to validate the command line