#
# qmake configuration for VxWorks on Intel (Skylake NUC)
#
# This mkspec is tested with a framebuffer (vxworksfb)
# A typical configure line looks like:
# <path-to-qt-src>/configure -commercial -confirm-license -release -static
#     -device vxworks-x86-clang -sysroot <full_path_to_x86_VSB_DIR>
#     -no-gcc-sysroot -hostprefix <path_to_host_dir>/qt5host -no-openssl
#     -nomake tools -nomake examples -no-libjpeg -no-opengl
#     -no-feature-qml-jit -skip qtgamepad
#

# Target architecture dependent way to specify the base address of the
# absolutely linked RTP executables
VX_RTP_LINK_ADDR = 0x200000

# Compile for Intel
CROSS_COMPILE = pentium

include(../common/vxworks_device_pre.conf)

QT_QPA_DEFAULT_PLATFORM = eglfs
EGLFS_DEVICE_INTEGRATION = eglfs_kms

QMAKE_LIBS_EGL = --start-group -lgfxLibDRM -lgfxMesaDriI965 -lgfxMesaEGL -lgfxMesaGL -lgfxMesa -lgfxMesaSw -lxml --end-group
QMAKE_LIBS_OPENGL_ES2 = $$QMAKE_LIBS_EGL

DEFINES += _MESA
DEFINES += _MESA_DRI=yes
DEFINES += GFX_USE_GBM
DEFINES += GFX_USE_EVDEV

QMAKE_INCDIR_EGL        += $$[QT_SYSROOT]/usr/h/public
QMAKE_INCDIR_OPENGL_ES2 += $$[QT_SYSROOT]/usr/h/public
QMAKE_LIBDIR_EGL        += $$[QT_SYSROOT]/usr/lib/common
QMAKE_LIBDIR_OPENGL_ES2 += $$[QT_SYSROOT]/usr/lib/common

equals(VXWORKS_BUILD_LIBRARY_TYPE, "static") {
#    QMAKE_LIBS_EGL = --start-group -l:libgfxMesaEGL.a -l:libgfxMesaDriI965.a -l:libgfxLibDRM.a -l:libgfxMesaGL.a -l:libgfxMesa.a -l:libgfxMesaSw.a -l:libxml.a --end-group
	QMAKE_LIBS_EGL = --start-group -lgfxMesaEGL -lgfxMesaDriI965 -lgfxLibDRM -lgfxMesaGL -lgfxMesa -lgfxMesaSw -lxml --end-group
    QMAKE_LIBS_OPENGL_ES2 = $$QMAKE_LIBS_EGL
}

DEFINES += GL_GLES_PROTOTYPES
DEFINES += GL_GLEXT_PROTOTYPES

ADD_LFLAGS = -m elf_x86_64 -z noseparate-code

QMAKE_LFLAGS_APP    += $$ADD_LFLAGS
QMAKE_LFLAGS_SHLIB  += $$ADD_LFLAGS
QMAKE_LFLAGS_PLUGIN += $$ADD_LFLAGS

ADD_CFLAGS = --target=x86_64 -m64 -mcmodel=small -fno-omit-frame-pointer -march=skylake -std=c++14 -mllvm -two-entry-phi-node-folding-threshold=2 -Wconversion -Wno-sign-conversion -MD -MP -D_VX_CPU=_VX_SKYLAKE -D_VX_TOOL_FAMILY=llvm -D_VX_TOOL=llvm -D_VSB_CONFIG_FILE=\'<$$[QT_SYSROOT]/h/config/vsbConfig.h>\' -v

QMAKE_CFLAGS        += $$ADD_CFLAGS
QMAKE_CXXFLAGS      += $$ADD_CFLAGS

load(qt_config)
