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 <laszlo.agocs@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Oswald Buddenhagen 2016-11-23 20:11:17 +01:00
parent e2eab15e34
commit e58eb3d6f9
10 changed files with 81 additions and 58 deletions

View File

@ -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 <path_to_compiler>
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=<path>")
# 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()

View File

@ -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()

View File

@ -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)

View File

@ -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

View File

@ -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=<path>")
isEmpty(TRIDENT_SHINER_SDK_BUILDSPEC): error("TRIDENT_SHINER_SDK_BUILDSPEC needs to be set via -device-option TRIDENT_SHINER_SDK_BUILDSPEC=<build spec>")
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=<path>")
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=<path>")
defineTest(qtConfSanitizeMkspec) {
isEmpty(TRIDENT_SHINER_SDK_BUILDTREE): \
error("TRIDENT_SHINER_SDK_BUILDTREE needs to be set via -device-option TRIDENT_SHINER_SDK_BUILDTREE=<path>")
isEmpty(TRIDENT_SHINER_SDK_BUILDSPEC): \
error("TRIDENT_SHINER_SDK_BUILDSPEC needs to be set via -device-option TRIDENT_SHINER_SDK_BUILDSPEC=<build spec>")
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=<path>")
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=<path>")
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

View File

@ -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=<path>")
isEmpty(BRCM_APPLIBS_PATH): \
error("BRCM_APPLIBS_PATH needs to be set via -device-option BRCM_APPLIBS_PATH=<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]) {

View File

@ -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

View File

@ -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/

View File

@ -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)

View File

@ -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 <path_to_compiler>
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=<path>")
# 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")
}