Skip to content

Commit

Permalink
move device spec validation to configure
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Lars Knoll <[email protected]>
  • Loading branch information
ossilator committed Dec 13, 2016
1 parent e2eab15 commit e58eb3d
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 58 deletions.
36 changes: 36 additions & 0 deletions config.tests/common/verifyspec/verifyspec.pro
Original file line number Diff line number Diff line change
@@ -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()
6 changes: 4 additions & 2 deletions mkspecs/devices/common/linux_device_post.conf
Original file line number Diff line number Diff line change
@@ -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}
Expand All @@ -10,5 +14,3 @@ contains(DISTRO_OPTS, boot2qt) {
QMAKE_CFLAGS += $$COMPILER_FLAGS
QMAKE_CXXFLAGS += $$COMPILER_FLAGS
QMAKE_LFLAGS += $$LINKER_FLAGS

deviceSanityCheckCompiler()
6 changes: 4 additions & 2 deletions mkspecs/devices/linux-archos-gen8-g++/qmake.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ include(../../common/g++-unix.conf)

load(device_config)

defineTest(qtConfSanitizeMkspec) {
deviceSanityCheckCompiler()
}

QT_QPA_DEFAULT_PLATFORM = eglfs

# modifications to g++.conf
Expand Down Expand Up @@ -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)
6 changes: 4 additions & 2 deletions mkspecs/devices/linux-arm-amlogic-8726M-g++/qmake.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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
Expand Down
18 changes: 11 additions & 7 deletions mkspecs/devices/linux-arm-trident-pnx8473-g++/qmake.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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++
Expand All @@ -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

Expand Down
16 changes: 10 additions & 6 deletions mkspecs/devices/linux-mipsel-broadcom-97425-g++/qmake.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]) {
Expand Down
6 changes: 4 additions & 2 deletions mkspecs/devices/linux-sh4-stmicro-ST7108-g++/qmake.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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
Expand Down
6 changes: 4 additions & 2 deletions mkspecs/devices/linux-sh4-stmicro-ST7540-g++/qmake.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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/

Expand Down
6 changes: 4 additions & 2 deletions mkspecs/devices/linux-snowball-g++/qmake.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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)
33 changes: 0 additions & 33 deletions mkspecs/features/device_config.prf
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

0 comments on commit e58eb3d

Please sign in to comment.