#
# qmake configuration for 64-bit Tegra X1 boards, like the DRIVE CX, using Vibrante Linux
#
# A typical configure line might look like:
# configure \
#   -device drive-cx \
#   -device-option VIBRANTE_SDK_TOPDIR=/opt/nvidia/vibrante-t186ref-linux
#   -device-option CROSS_COMPILE=/opt/nvidia/toolchains/tegra-4.9-nv/usr/bin/aarch64-gnu-linux/aarch64-gnu-linux- \
#   -sysroot /opt/nvidia/vibrante-t186ref-linux/targetfs \
#   -no-gcc-sysroot \
#   -opengl es2

# Note: This enables eglfs and wayland only. To enable xcb (with EGL
# support) as well, add -qt-xcb and fix the SDK's X11 headers. See
# QTBUG-55140.

include(../common/linux_device_pre.conf)

QMAKE_INCDIR += \
    $${VIBRANTE_SDK_TOPDIR}/include \
    $$[QT_SYSROOT]/usr/include

QMAKE_LIBDIR += \
    $${VIBRANTE_SDK_TOPDIR}/lib-target \
    $$[QT_SYSROOT]/usr/lib \
    $$[QT_SYSROOT]/lib/aarch64-linux-gnu \
    $$[QT_SYSROOT]/usr/lib/aarch64-linux-gnu

QMAKE_LFLAGS += \
    -Wl,-rpath-link,$${VIBRANTE_SDK_TOPDIR}/lib-target \
    -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib \
    -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib/aarch64-linux-gnu \
    -Wl,-rpath-link,$$[QT_SYSROOT]/lib/aarch64-linux-gnu

DISTRO_OPTS                  += aarch64

# Do not define WIN_INTERFACE_CUSTOM here. It is suitable for drm and
# wayland, but not X11. Leave it to qt_egl_p.h instead.
COMPILER_FLAGS               += -mtune=cortex-a57.cortex-a53 -march=armv8-a

EGLFS_DEVICE_INTEGRATION = eglfs_kms_egldevice

include(../common/linux_arm_device_post.conf)

# override the default from linux_arm_device_post.conf
defineTest(qtConfSanitizeMkspec) {
    isEmpty(VIBRANTE_SDK_TOPDIR): \
        error("You must pass -device-option VIBRANTE_SDK_TOPDIR=/path/to/sdk")
    deviceSanityCheckCompiler()
}

load(qt_config)
