From e58eb3d6f953c224c2d47cd344bc41ba9f499223 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 23 Nov 2016 20:11:17 +0100 Subject: [PATCH] move device spec validation to configure instead of letting the specs validate themselves on each call, let them only define a callback for use by the verifyspec configure test. this is somewhat faster, and allows them to be loaded before qdevice.pri is populated. Change-Id: I2b60d006b33bbf42c28949f10ad429520ed32f46 Reviewed-by: Laszlo Agocs Reviewed-by: Lars Knoll --- config.tests/common/verifyspec/verifyspec.pro | 36 +++++++++++++++++++ mkspecs/devices/common/linux_device_post.conf | 6 ++-- .../devices/linux-archos-gen8-g++/qmake.conf | 6 ++-- .../linux-arm-amlogic-8726M-g++/qmake.conf | 6 ++-- .../linux-arm-trident-pnx8473-g++/qmake.conf | 18 ++++++---- .../qmake.conf | 16 +++++---- .../linux-sh4-stmicro-ST7108-g++/qmake.conf | 6 ++-- .../linux-sh4-stmicro-ST7540-g++/qmake.conf | 6 ++-- mkspecs/devices/linux-snowball-g++/qmake.conf | 6 ++-- mkspecs/features/device_config.prf | 33 ----------------- 10 files changed, 81 insertions(+), 58 deletions(-) diff --git a/config.tests/common/verifyspec/verifyspec.pro b/config.tests/common/verifyspec/verifyspec.pro index d78ed2985a..11a280e4ce 100644 --- a/config.tests/common/verifyspec/verifyspec.pro +++ b/config.tests/common/verifyspec/verifyspec.pro @@ -1 +1,37 @@ SOURCES = verifyspec.cpp + +# Provide a function to be used by mkspecs +defineTest(deviceSanityCheckCompiler) { + equals(QMAKE_HOST.os, Windows): \ + sfx = .exe + else: \ + sfx = + + # Build the compiler filename using the first value in QMAKE_CXX in order to + # support tools like ccache, which give QMAKE_CXX values of the form: + # ccache + compiler = $$first(QMAKE_CXX)$$sfx + + # Check if the binary exists with an absolute path. Do this check + # before the CROSS_COMPILE empty check below to allow the mkspec + # to derive the compiler path from other device options. + exists($$compiler): return() + + # Check for possible reasons of failure + # check if CROSS_COMPILE device-option is set + isEmpty(CROSS_COMPILE): \ + error("CROSS_COMPILE needs to be set via -device-option CROSS_COMPILE=") + + # Check if QMAKE_CXX points to an executable. + ensurePathEnv() + for (dir, QMAKE_PATH_ENV) { + exists($$dir/$${compiler}): \ + return() + } + + # QMAKE_CXX does not point to a compiler. + error("Compiler $$QMAKE_CXX not found. Check the value of CROSS_COMPILE -device-option") +} + +defined(qtConfSanitizeMkspec, test): \ + qtConfSanitizeMkspec() diff --git a/mkspecs/devices/common/linux_device_post.conf b/mkspecs/devices/common/linux_device_post.conf index 88fa31d805..cf1608f32b 100644 --- a/mkspecs/devices/common/linux_device_post.conf +++ b/mkspecs/devices/common/linux_device_post.conf @@ -1,3 +1,7 @@ +defineTest(qtConfSanitizeMkspec) { + deviceSanityCheckCompiler() +} + contains(DISTRO_OPTS, deb-multi-arch) { QMAKE_LFLAGS += -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib/$${GCC_MACHINE_DUMP} \ -Wl,-rpath-link,$$[QT_SYSROOT]/lib/$${GCC_MACHINE_DUMP} @@ -10,5 +14,3 @@ contains(DISTRO_OPTS, boot2qt) { QMAKE_CFLAGS += $$COMPILER_FLAGS QMAKE_CXXFLAGS += $$COMPILER_FLAGS QMAKE_LFLAGS += $$LINKER_FLAGS - -deviceSanityCheckCompiler() diff --git a/mkspecs/devices/linux-archos-gen8-g++/qmake.conf b/mkspecs/devices/linux-archos-gen8-g++/qmake.conf index 891559f3bf..66662f90ca 100644 --- a/mkspecs/devices/linux-archos-gen8-g++/qmake.conf +++ b/mkspecs/devices/linux-archos-gen8-g++/qmake.conf @@ -16,6 +16,10 @@ include(../../common/g++-unix.conf) load(device_config) +defineTest(qtConfSanitizeMkspec) { + deviceSanityCheckCompiler() +} + QT_QPA_DEFAULT_PLATFORM = eglfs # modifications to g++.conf @@ -51,6 +55,4 @@ QMAKE_LIBS_EGL = -lEGL -lIMGegl -lsrv_um QMAKE_LIBS_OPENGL_ES2 = -lGLESv2 $${QMAKE_LIBS_EGL} QMAKE_LIBS_OPENVG = -lOpenVG $${QMAKE_LIBS_EGL} -deviceSanityCheckCompiler() - load(qt_config) diff --git a/mkspecs/devices/linux-arm-amlogic-8726M-g++/qmake.conf b/mkspecs/devices/linux-arm-amlogic-8726M-g++/qmake.conf index da2e046d08..74eaf0dd09 100644 --- a/mkspecs/devices/linux-arm-amlogic-8726M-g++/qmake.conf +++ b/mkspecs/devices/linux-arm-amlogic-8726M-g++/qmake.conf @@ -12,6 +12,10 @@ include(../../common/g++-unix.conf) load(device_config) +defineTest(qtConfSanitizeMkspec) { + deviceSanityCheckCompiler() +} + QMAKE_CC = $${CROSS_COMPILE}gcc QMAKE_CXX = $${CROSS_COMPILE}g++ QMAKE_LINK = $${QMAKE_CXX} @@ -25,8 +29,6 @@ QMAKE_STRIP = $${CROSS_COMPILE}strip QMAKE_CFLAGS += -mfloat-abi=softfp -mfpu=neon -mcpu=cortex-a9 QMAKE_CXXFLAGS += $$QMAKE_CFLAGS -deviceSanityCheckCompiler() - EGLFS_PLATFORM_HOOKS_SOURCES = $$PWD/qeglfshooks_8726m.cpp QT_QPA_DEFAULT_PLATFORM = eglfs diff --git a/mkspecs/devices/linux-arm-trident-pnx8473-g++/qmake.conf b/mkspecs/devices/linux-arm-trident-pnx8473-g++/qmake.conf index 3bbb7b6db9..b131f65a79 100644 --- a/mkspecs/devices/linux-arm-trident-pnx8473-g++/qmake.conf +++ b/mkspecs/devices/linux-arm-trident-pnx8473-g++/qmake.conf @@ -14,11 +14,17 @@ include(../../common/g++-unix.conf) load(device_config) -# Sanity checks -isEmpty(TRIDENT_SHINER_SDK_BUILDTREE): error("TRIDENT_SHINER_SDK_BUILDTREE needs to be set via -device-option TRIDENT_SHINER_SDK_BUILDTREE=") -isEmpty(TRIDENT_SHINER_SDK_BUILDSPEC): error("TRIDENT_SHINER_SDK_BUILDSPEC needs to be set via -device-option TRIDENT_SHINER_SDK_BUILDSPEC=") -isEmpty(TRIDENT_SHINER_SDK_INCDIR_EGL_OPENGL_ES2): error("TRIDENT_SHINER_SDK_INCDIR_EGL_OPENGL_ES2 needs to be set via -device-option TRIDENT_SHINER_SDK_INCDIR_EGL_OPENGL_ES2=") -isEmpty(TRIDENT_SHINER_SDK_LIBDIR_EGL_OPENGL_ES2): error("TRIDENT_SHINER_SDK_LIBDIR_EGL_OPENGL_ES2 needs to be set via -device-option TRIDENT_SHINER_SDK_LIBDIR_EGL_OPENGL_ES2=") +defineTest(qtConfSanitizeMkspec) { + isEmpty(TRIDENT_SHINER_SDK_BUILDTREE): \ + error("TRIDENT_SHINER_SDK_BUILDTREE needs to be set via -device-option TRIDENT_SHINER_SDK_BUILDTREE=") + isEmpty(TRIDENT_SHINER_SDK_BUILDSPEC): \ + error("TRIDENT_SHINER_SDK_BUILDSPEC needs to be set via -device-option TRIDENT_SHINER_SDK_BUILDSPEC=") + isEmpty(TRIDENT_SHINER_SDK_INCDIR_EGL_OPENGL_ES2): \ + error("TRIDENT_SHINER_SDK_INCDIR_EGL_OPENGL_ES2 needs to be set via -device-option TRIDENT_SHINER_SDK_INCDIR_EGL_OPENGL_ES2=") + isEmpty(TRIDENT_SHINER_SDK_LIBDIR_EGL_OPENGL_ES2): \ + error("TRIDENT_SHINER_SDK_LIBDIR_EGL_OPENGL_ES2 needs to be set via -device-option TRIDENT_SHINER_SDK_LIBDIR_EGL_OPENGL_ES2=") + deviceSanityCheckCompiler() +} QMAKE_CC = $${CROSS_COMPILE}gcc QMAKE_CXX = $${CROSS_COMPILE}g++ @@ -35,8 +41,6 @@ QMAKE_CFLAGS += --sysroot=$${TRIDENT_SHINER_SDK_BUILDTREE}/open_source QMAKE_CXXFLAGS += --sysroot=$${TRIDENT_SHINER_SDK_BUILDTREE}/open_source_archive/linux/toolchains/gcc-4.5.2_uclibc/ QMAKE_LFLAGS += --sysroot=$${TRIDENT_SHINER_SDK_BUILDTREE}/open_source_archive/linux/toolchains/gcc-4.5.2_uclibc/ -deviceSanityCheckCompiler() - QMAKE_CFLAGS = -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard QMAKE_CXXFLAGS = $$QMAKE_CFLAGS diff --git a/mkspecs/devices/linux-mipsel-broadcom-97425-g++/qmake.conf b/mkspecs/devices/linux-mipsel-broadcom-97425-g++/qmake.conf index e196f279d7..9211551daf 100644 --- a/mkspecs/devices/linux-mipsel-broadcom-97425-g++/qmake.conf +++ b/mkspecs/devices/linux-mipsel-broadcom-97425-g++/qmake.conf @@ -12,6 +12,16 @@ include(../../common/g++-unix.conf) load(device_config) +defineTest(qtConfSanitizeMkspec) { + isEmpty(B_REFSW_DEBUG): \ + error("B_REFSW_DEBUG needs to be set via -device-option B_REFSW_DEBUG=(y|n)") + isEmpty(BRCM_ROCKFORD_PATH): \ + error("BRCM_ROCKFORD_PATH needs to be set via -device-option BRCM_ROCKFORD_PATH=") + isEmpty(BRCM_APPLIBS_PATH): \ + error("BRCM_APPLIBS_PATH needs to be set via -device-option BRCM_APPLIBS_PATH=") + deviceSanityCheckCompiler() +} + # Modify the defaults we loaded above CROSS_COMPILE = mipsel-linux- QMAKE_CC = $${CROSS_COMPILE}gcc @@ -31,12 +41,6 @@ QMAKE_STRIP = $${CROSS_COMPILE}strip BRCM_PLATFORM = 97425 -# Sanity checks -deviceSanityCheckCompiler() -isEmpty(B_REFSW_DEBUG):error("B_REFSW_DEBUG needs to be set via -device-option B_REFSW_DEBUG=(y|n).") -isEmpty(BRCM_ROCKFORD_PATH):error("BRCM_ROCKFORD_PATH needs to be set via -device-option BRCM_ROCKFORD_PATH=path.") -isEmpty(BRCM_APPLIBS_PATH):error("BRCM_APPLIBS_PATH needs to be set via -device-option BRCM_APPLIBS_PATH=path.") - # Figure the kind of directfb build used. BRCM_BUILD_TYPE = debug contains(B_REFSW_DEBUG, [Nn]) { diff --git a/mkspecs/devices/linux-sh4-stmicro-ST7108-g++/qmake.conf b/mkspecs/devices/linux-sh4-stmicro-ST7108-g++/qmake.conf index 18d07dad63..8dab1ea287 100644 --- a/mkspecs/devices/linux-sh4-stmicro-ST7108-g++/qmake.conf +++ b/mkspecs/devices/linux-sh4-stmicro-ST7108-g++/qmake.conf @@ -14,6 +14,10 @@ include(../../common/g++-unix.conf) load(device_config) +defineTest(qtConfSanitizeMkspec) { + deviceSanityCheckCompiler() +} + QMAKE_CC = $${CROSS_COMPILE}gcc QMAKE_CXX = $${CROSS_COMPILE}g++ QMAKE_LINK = $${QMAKE_CXX} @@ -24,8 +28,6 @@ QMAKE_OBJCOPY = $${CROSS_COMPILE}objcopy QMAKE_NM = $${CROSS_COMPILE}nm -P QMAKE_STRIP = $${CROSS_COMPILE}strip -deviceSanityCheckCompiler() - QMAKE_LIBS_EGL += -lMali QT_QPA_DEFAULT_PLATFORM = eglfs diff --git a/mkspecs/devices/linux-sh4-stmicro-ST7540-g++/qmake.conf b/mkspecs/devices/linux-sh4-stmicro-ST7540-g++/qmake.conf index 5672829da9..04b0a80d1f 100644 --- a/mkspecs/devices/linux-sh4-stmicro-ST7540-g++/qmake.conf +++ b/mkspecs/devices/linux-sh4-stmicro-ST7540-g++/qmake.conf @@ -14,6 +14,10 @@ include(../../common/g++-unix.conf) load(device_config) +defineTest(qtConfSanitizeMkspec) { + deviceSanityCheckCompiler() +} + QMAKE_CC = $${CROSS_COMPILE}gcc QMAKE_CXX = $${CROSS_COMPILE}g++ QMAKE_LINK = $${QMAKE_CXX} @@ -24,8 +28,6 @@ QMAKE_OBJCOPY = $${CROSS_COMPILE}objcopy QMAKE_NM = $${CROSS_COMPILE}nm -P QMAKE_STRIP = $${CROSS_COMPILE}strip -deviceSanityCheckCompiler() - QMAKE_INCDIR_EGL += $$[QT_SYSROOT]/root/modules/include/ QMAKE_LIBDIR_EGL += $$[QT_SYSROOT]/root/modules/ diff --git a/mkspecs/devices/linux-snowball-g++/qmake.conf b/mkspecs/devices/linux-snowball-g++/qmake.conf index 3520c7a922..9791119363 100644 --- a/mkspecs/devices/linux-snowball-g++/qmake.conf +++ b/mkspecs/devices/linux-snowball-g++/qmake.conf @@ -12,6 +12,10 @@ include(../../common/g++-unix.conf) load(device_config) +defineTest(qtConfSanitizeMkspec) { + deviceSanityCheckCompiler() +} + QMAKE_CC = $${CROSS_COMPILE}gcc QMAKE_CXX = $${CROSS_COMPILE}g++ QMAKE_LINK = $${QMAKE_CXX} @@ -26,6 +30,4 @@ QMAKE_STRIP = $${CROSS_COMPILE}strip QMAKE_LFLAGS += -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib/arm-linux-gnueabihf \ -Wl,-rpath-link,$$[QT_SYSROOT]/lib/arm-linux-gnueabihf -deviceSanityCheckCompiler() - load(qt_config) diff --git a/mkspecs/features/device_config.prf b/mkspecs/features/device_config.prf index 9281d3e407..5c5b094a9c 100644 --- a/mkspecs/features/device_config.prf +++ b/mkspecs/features/device_config.prf @@ -10,36 +10,3 @@ unset(DEVICE_PRI) # this variable can be persisted via qmake -set CROSS_COMPILE /foo !host_build:isEmpty(CROSS_COMPILE): CROSS_COMPILE = $$[CROSS_COMPILE] - -# Provide a function to be used by mkspecs -defineTest(deviceSanityCheckCompiler) { - equals(QMAKE_HOST.os, Windows): \ - sfx = .exe - else: \ - sfx = - - # Build the compiler filename using the first value in QMAKE_CXX in order to - # support tools like ccache, which give QMAKE_CXX values of the form: - # ccache - compiler = $$first(QMAKE_CXX)$$sfx - - # Check if the binary exists with an absolute path. Do this check - # before the CROSS_COMPILE empty check below to allow the mkspec - # to derive the compiler path from other device options. - exists($$compiler):return() - - # Check for possible reasons of failure - # check if CROSS_COMPILE device-option is set - isEmpty(CROSS_COMPILE):error("CROSS_COMPILE needs to be set via -device-option CROSS_COMPILE=") - - # Check if QMAKE_CXX points to an executable. - ensurePathEnv() - for (dir, QMAKE_PATH_ENV) { - exists($$dir/$${compiler}): \ - return() - } - - # QMAKE_CXX does not point to a compiler. - error("Compiler $$QMAKE_CXX not found. Check the value of CROSS_COMPILE -device-option") -} -