I've written a PRO file to generate a GUI for my CUDA application under linux (already compiled under windows now porting same components to ubuntu 1404).
I've first compiled a helper library "mylib.a" and linked that with my application "myapp.cu" and tested that it compiles and runs nicely without Qt in the picture (done via nsight eclipse).
For building with Qt I've generated the following PRO file:
#############################
# basic PRO file for qmake
##############################
# QT libs to use
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
##########################################
# QT basic files
##########################################
SOURCES+=main.cpp
SOURCES+=myGUI.cpp
HEADERS += myGUI.h
FORMS += myGUI.ui
# Project dir and outputs
PROJECT_DIR = $$system(pwd)
OBJECTS_DIR = $$PROJECT_DIR/Obj
DESTDIR = ../bin
##########################################
# CUDA source files
##########################################
CUDA_SOURCES += myApp.cu
CUDA_SOURCES += kernel1.cu
CUDA_SOURCES += kernel2.cu
##########################################
# CUDA related components
##########################################
CUDA_DIR = /usr/local/cuda
CUDA_ARCH = sm_35
NVCCFLAGS = --compiler-options -fno-strict-aliasing -use_fast_math --ptxas-options=-v
##########################################
# include paths
##########################################
# CUDA
INCLUDEPATH += $$CUDA_DIR/include
# Additional dependencies
INCLUDEPATH += /usr/include/
##########################################
# library directories
##########################################
QMAKE_LIBDIR += $$CUDA_DIR/lib64
QMAKE_LIBDIR += $$CUDA_DIR/samples/common/lib
##########################################
# LIBS
##########################################
LIBS += -lnvToolsExt
LIBS += -lopengl
#libcudart_static
#LIBS += -lcudart_static
LIBS += -lcuda
LIBS += -lcudart
LIBS += -lGL
# My library is added here
LIBS += -lmyLib
# join the includes in a line
CUDA_INC = $$join(INCLUDEPATH,' -I','-I',' ')
##########################################
# Extra compiler configuration for CUDA
##########################################
cuda.input = CUDA_SOURCES
cuda.output = ${OBJECTS_DIR}${QMAKE_FILE_BASE}.o
cuda.commands = $$CUDA_DIR/bin/nvcc $$CUDA_DEFINES -m64 -g -arch=$$CUDA_ARCH -c $$NVCCFLAGS $$CUDA_INC $$LIBS ${QMAKE_FILE_NAME} -c -o ${QMAKE_FILE_OUT}
cuda.dependency_type = TYPE_C
cuda.depend_command = $$CUDA_DIR/bin/nvcc $$CUDA_DEFINES -g -M $$CUDA_INC $$NVCCFLAGS ${QMAKE_FILE_NAME}
# Tell Qt that we want add more stuff to the Makefile
QMAKE_EXTRA_UNIX_COMPILERS += cuda
Try these in your .pro file. I used it to link to CUDA on Linux successfully :
# Define output directories
CONFIG(release, debug|release): CUDA_OBJECTS_DIR = release/cuda
else: CUDA_OBJECTS_DIR = debug/cuda
# This makes the .cu files appear in your project
OTHER_FILES += vectorAddition.cu
# CUDA settings <-- may change depending on your system
CUDA_SOURCES += vectorAddition.cu
unix{
CUDA_SDK = "/usr/local/cuda-5.5/" # Path to cuda SDK install
CUDA_DIR = "/usr/local/cuda-5.5/" # Path to cuda toolkit install
}
unix: SYSTEM_NAME = unix
SYSTEM_TYPE = 32 # '32' or '64', depending on your system
CUDA_ARCH = sm_30 # Type of CUDA architecture, for example 'compute_10', 'compute_11', 'sm_10'
NVCC_OPTIONS = --use_fast_math
# include paths
INCLUDEPATH += $$CUDA_DIR/include
#$$CUDA_SDK/common/inc/ \
#$$CUDA_SDK/../shared/inc/
# library directories
unix:{
QMAKE_LIBDIR += $$CUDA_DIR/lib
}
# Add the necessary libraries
unix:
{
CUDA_LIBS = -lcuda -lcudart
# The following makes sure all path names (which often include spaces) are put between quotation marks
CUDA_INC = $$join(INCLUDEPATH,'" -I"','-I"','"')
NVCC_LIBS = $$join(CUDA_LIBS,' -l','-l', '')
LIBS += $$CUDA_LIBS
}
# Configuration of the Cuda compiler
CONFIG(debug, debug|release) {
# Debug mode
cuda_d.input = CUDA_SOURCES
cuda_d.output = $$CUDA_OBJECTS_DIR/${QMAKE_FILE_BASE}_cuda.o
unix: cuda_d.commands = $$CUDA_DIR/bin/nvcc -D_DEBUG $$NVCC_OPTIONS $$CUDA_INC $$NVCC_LIBS --machine $$SYSTEM_TYPE -arch=$$CUDA_ARCH -c -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME}
cuda_d.dependency_type = TYPE_C
QMAKE_EXTRA_COMPILERS += cuda_d
}
else {
# Release mode
cuda.input = CUDA_SOURCES
cuda.output = $$CUDA_OBJECTS_DIR/${QMAKE_FILE_BASE}_cuda.o
unix: cuda.commands = $$CUDA_DIR/bin/nvcc $$NVCC_OPTIONS $$CUDA_INC $$NVCC_LIBS --machine $$SYSTEM_TYPE -arch=$$CUDA_ARCH -c -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME}
cuda.dependency_type = TYPE_C
QMAKE_EXTRA_COMPILERS += cuda
}
Related
I've installed Debian Bullseye from this page:
https://raspi.debian.net/daily-images/
on a Raspberry Pi 4 machine and prepared the required libraries and packages following these guides:
https://www.interelectronix.com/qt-515-cross-compilation-raspberry-compute-module-4-ubuntu-20-lts.html
https://github.com/abhiTronix/raspberry-pi-cross-compilers/blob/master/QT_build_instructions.md
This is the compiler I'm using: https://snapshots.linaro.org/gnu-toolchain/12.0-2021.10-1/aarch64-linux-gnu/gcc-linaro-12.0.0-2021.10-x86_64_aarch64-linux-gnu.tar.xz
from this page: https://snapshots.linaro.org/gnu-toolchain/12.0-2021.10-1/aarch64-linux-gnu/
issue description
When I run ./configure... after some processing the compiler throws an error:
aarch64-linux-gnu-g++: error: unrecognized command-line option -mfloat-abi=softfp
Meanwhile, Linaro or official ARM compilers do not support VFP, FPU, etc. so I had to change the qmake.conf to try to remove that command-line option from the compiler flags.
QMAKE_CFLAGS -= -mfloat-abi=softfp
QMAKE_CFLAGS_RELEASE -= -mfloat-abi=softfp
QMAKE_CXXFLAGS -= -mfloat-abi=softfp
QMAKE_CXXFLAGS_RELEASE -= -mfloat-abi=softfp
I've tried every solution listed on: Qmake: how to remove compiler flag for a certain project, without changing qmake.conf?
But still had no luck! That command-line magically appears again!
Have you had any luck compiling for aarch64?
How can I resolve this issue?
UPDATE
my configure command:
~/Qt/5.15.2/Src/configure -release -device linux-rasp-pi4-v3d-g++ \
-device-option CROSS_COMPILE=~/Documents/Qt-CrossCompile-RaspberryPi/raspberrypi4/tools/gcc-linaro-12.0.0-2021.10-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- \
-sysroot ~/Documents/Qt-CrossCompile-RaspberryPi/raspberrypi4/sysroot -prefix /usr/local/qt5.15.2 \
-extprefix ~/Documents/Qt-CrossCompile-RaspberryPi/raspberrypi4/qt5.15.2 \
-opensource -confirm-license -skip qtscript -skip qtwayland -skip qtwebengine \
-nomake tests -make libs -pkg-config -no-use-gold-linker -v -recheck \
-L~/Documents/Qt-CrossCompile-RaspberryPi/raspberrypi4/sysroot/usr/lib/aarch64-linux-gnu \
-I~/Documents/Qt-CrossCompile-RaspberryPi/raspberrypi4/sysroot/usr/include/aarch64-linux-gnu
I edited qmake.conf in linux-rasp-pi4-v3d-g++ folder:
include(../common/linux_device_pre.conf)
#QMAKE_LIBS_EGL += -lEGL
#QMAKE_LIBS_OPENGL_ES2 += -lGLESv2 -lEGL
#QMAKE_CFLAGS = -march=armv8-a -mtune=cortex-a72 -mfpu=crypto-neon-fp-armv8
QMAKE_CFLAGS = -march=armv8-a -mtune=cortex-a72
QMAKE_CXXFLAGS = $$QMAKE_CFLAGS
#DISTRO_OPTS += hard-float
DISTRO_OPTS += deb-multi-arch
#EGLFS_DEVICE_INTEGRATION = eglfs_kms
include(../common/linux_arm_device_post.conf)
QMAKE_CFLAGS = $$replace(QMAKE_CFLAGS, "-mfloat-abi=softfp", "")
QMAKE_CFLAGS_RELEASE = $$replace(QMAKE_CFLAGS_RELEASE, "-mfloat-abi=softfp", "")
QMAKE_CXXFLAGS = $$replace(QMAKE_CXXFLAGS, "-mfloat-abi=softfp", "")
QMAKE_CXXFLAGS_RELEASE = $$replace(QMAKE_CXXFLAGS_RELEASE, "-mfloat-abi=softfp", "")
COMPILER_FLAGS = $$replace(COMPILER_FLAGS, "-mfloat-abi=softfp", "")
load(qt_config)
fixed this by editing the qmake.conf
used linux_device_post instead of linux_arm_device_post
include(../common/linux_device_pre.conf)
QT_QPA_DEFAULT_PLATFORM =
QMAKE_CFLAGS = -march=armv8-a -mtune=cortex-a72
QMAKE_CXXFLAGS = $$QMAKE_CFLAGS
DISTRO_OPTS += deb-multi-arch
include(../common/linux_device_post.conf)
load(qt_config)
I have an application running on Yocto Zeus 3.0.1 with Qt5 and relies on OpenGL EGL. The application builds fine, but fails with the following message:
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
QXcbIntegration: Cannot create platform offscreen surface, neither GLX nor EGL are enabled
I have added all the needed OpenGL drivers in image .bb file:
IMAGE_INSTALL += "libegl-mesa libgl-mesa libegl-mesa-dev libgl-mesa-dev libgles3-mesa-dev mesa-megadriver"
The following is my qt5/qtbase_%.bbappend file.
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
PACKAGECONFIG_append = "gles2 mtdev sql-sqlite glib fontconfig gif accessibility"
PACKAGECONFIG_append = " widgets"
do_configure_prepend () {
cat >> ${S}/mkspecs/linux-oe-g++/qmake.conf <<EOF
# the below indentation is important - Soham
QMAKE_LIBS_EGL += -lEGL -ldl -lglib-2.0 -lpthread
QMAKE_LIBS_OPENGL_ES2 += -lGLESv2 -lgsl -lEGL -ldl -lglib-2.0 -lpthread
QMAKE_CFLAGS += -DLINUX=1 -DWL_EGL_PLATFORM -DEGL_API_FB=1
QMAKE_CXXFLAGS += -DLINUX=1 -DWL_EGL_PLATFORM -DEGL_API_FB=1
QT_QPA_DEFAULT_PLATFORM = xcb
load(qt_config)
EOF
}
I am building the application on the target itself. Therefore, I added the -dev files.
What am I missing here?
I needed to change my qtbase_%.bbappend. It should look like the following:
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
IMAGE_FEATURES += "accessibility"
IMAGE_FEATURES += "gles2 mtdev sql-sqlite glib fontconfig gif accessibility xcb egl libs xkb xkmcommon"
QT_CONFIG_FLAGS_APPEND = "-xcb"
PACKAGECONFIG_append = " widgets"
DEPENDS += "gsl libxkbcommon"
RDEPENDS_${PN} += "gsl xrandr libxkbcommon"
do_configure_prepend () {
# the below indentation is important - Soham
cat > ${S}/mkspecs/oe-device-extra.pri <<EOF
QMAKE_LIBS_EGL += -lEGL -ldl -lglib-2.0 -lpthread -lX11 -lxcb -lXrandr -lxcb-glx
QMAKE_LIBS_OPENGL_ES2 += -lGLESv2 -lgsl -lEGL -ldl -lglib-2.0 -lpthread -lX11 -lxcb -lXrandr -lxcb-glx
QMAKE_CFLAGS += -DLINUX=1 -DWL_EGL_PLATFORM -DEGL_API_FB=1 -DXCB_USE_EGL -DXCB_USE_GLX
QMAKE_CXXFLAGS += -DLINUX=1 -DWL_EGL_PLATFORM -DEGL_API_FB=1 -DXCB_USE_EGL -DXCB_USE_GLX
QT_QPA_DEFAULT_PLATFORM = xcb
QT_XCB_GL_INTEGRATION = xcb_egl
EOF
}
I have this .pro file :
TEMPLATE = subdirs
SUBDIRS += internal app
app.depends = internal
app.subdir = src/app
internal.subdir = src/internal
TRANSLATIONS = \
$$PWD/translations/croatian.ts \
$$PWD/translations/danish.ts \
$$PWD/translations/english.ts \
$$PWD/translations/french.ts \
$$PWD/translations/german.ts \
$$PWD/translations/italian.ts \
$$PWD/translations/norwegian.ts \
$$PWD/translations/portuguese.ts \
$$PWD/translations/romanian.ts \
$$PWD/translations/spanish.ts
internal.pro is this:
TEMPLATE = lib
TARGET = internal
CONFIG += c++1z
QT += core core-private gui quick serialport sql multimedia
DEFINES += CURRENT_PATH=\\\"$$PWD\\\"
CONFIG(release, debug|release) {
CONFIG += qtquickcompiler
QMAKE_CXXFLAGS += -O3
}
CONFIG(debug, debug|release) {
QMAKE_CXXFLAGS += -O0
QMAKE_CXXFLAGS -= -O1
QMAKE_CXXFLAGS -= -O2
QMAKE_CXXFLAGS -= -O3
QMAKE_CXXFLAGS += --debug
}
#MS_SKELETON_MODULES = core utils network
#include($$PWD/../external/ms-skeleton/ms-skeleton.pri)
include($$PWD/aggiornamento/aggiornamento.pri)
include($$PWD/allarmi/allarmi.pri)
include($$PWD/comunicazione/comunicazione.pri)
include($$PWD/core/core.pri)
include($$PWD/jsoncpp/jsoncpp.pri)
include($$PWD/mqtt/mqtt.pri)
include($$PWD/other/other.pri)
include($$PWD/parametri/parametri.pri)
include($$PWD/programs/programs.pri)
include($$PWD/serializer/serializer.pri)
unix: target.path = /opt/Tagliavini/lib
!isEmpty(target.path): INSTALLS += target
and app.pro is this :
TEMPLATE = app
TARGET = UserInterface
CONFIG += c++1z
QT += core gui quick sql multimedia
DEFINES += CURRENT_PATH=\\\"$$PWD\\\"
CONFIG(release, debug|release) {
CONFIG += qtquickcompiler
QMAKE_CXXFLAGS += -O3
}
CONFIG(debug, debug|release) {
QMAKE_CXXFLAGS += -O0
QMAKE_CXXFLAGS -= -O1
QMAKE_CXXFLAGS -= -O2
QMAKE_CXXFLAGS -= -O3
QMAKE_CXXFLAGS += --debug
}
LIBS += -L$$shadowed($$PWD)/../internal/ -linternal
INCLUDEPATH += \
$$PWD/../internal \
$$PWD/../external/ms-skeleton
SOURCES += $$PWD/main.cpp
RESOURCES += \
$$PWD/../../font/fonts.qrc \
$$PWD/../../images/images.qrc \
$$PWD/qml/qml.qrc \
$$PWD/../../sounds/sounds.qrc
unix: target.path = /opt/Tagliavini/bin
!isEmpty(target.path): INSTALLS += target
when i try to create file .ts with lupdate , the files are generated correctly , but the file .ts not cointeins the qstr strings that are into qml files. ( the file qml are into app.pro ), instead the string that i want to translate into .cpp files are all recognized correctly and put into .ts file.(these are into internal.pro) Where is the problem??
It seems that you are including your .qml files in .qrc resources but not in the project SOURCES itself. lupdate will not pick/parse your .qrc files to list .qml files.
So, you will have to add your .qml files to SOURCES either one-by-one or per directory.
lupdate_only{
SOURCES+=example.qml
SOURCES+=app/FancyControls/*.qml
}
This will duplicate your QML file entries in Qt Creator project pane tree which is not very desirable. So, you can comment out those lines in your .pro file and uncomment it before any lupdate. It's also mandatory to fence those imports in lupdate_only{} conditional statement. Make sure that there is no space between lupdate_only and the curly bracket. Actually, your C/C++ compiler would not expect a qml file to be compiled.
I'm starting to use Cuda 8.0 in Qt5.8 with Qt creator with Visual Studio 2015 x64 on Windows 10 and I got unresolved symbols like:
cuda_code_cuda.o : error LNK2019: 澷朄夝愅揑奜晹晞崋 atexit丆
cuda_code_cuda.o : error LNK2019: 澷朄夝愅揑奜晹晞崋 cudaDeviceSynchronize丆
cuda_code_cuda.o : error LNK2019: 澷朄夝愅揑奜晹晞崋 cudaConfigureCall丆
cuda_code_cuda.o : error LNK2019: 澷朄夝愅揑奜晹晞崋 cudaSetupArgument丆
cuda_code_cuda.o : error LNK2019: 澷朄夝愅揑奜晹晞崋 cudaLaunch丆
cuda_code_cuda.o : error LNK2019: 澷朄夝愅揑奜晹晞崋 __imp_fminf丆
...
And my .pro file looks like:
QT += core
QT -= gui
CONFIG += c++11
TARGET = QtWithCuda
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
#-------------------------------------------------
# CUDA settings
CUDA_SOURCES += cuda_code.cu
CUDA_DIR = "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0/"
SYSTEM_NAME = x64
SYSTEM_TYPE = 64
CUDA_ARCH = compute_50
CUDA_CODE = sm_50
NVCC_OPTIONS = --use_fast_math
# include paths
INCLUDEPATH += "$$CUDA_DIR/include"
# library directories
QMAKE_LIBDIR += "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib\x64" \
"E:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\lib\amd64" \
"E:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\amd64" \
"C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\ucrt\x64" \
# "C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x64" \
"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\um\x64" \
"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\Lib\um\x64"
# The following makes sure all path names (which often include spaces) are put between quotation marks
CUDA_INC = $$join(INCLUDEPATH,'" -I"','-I"','"')
# Add the necessary libraries
CUDA_LIB_NAMES += \
cuda \
cudart \
kernel32 \
user32 \
gdi32 \
winspool \
comdlg32 \
advapi32 \
shell32 \
ole32 \
oleaut32 \
uuid \
odbc32 \
odbccp32 \
ucrt
for(lib, CUDA_LIB_NAMES) {
CUDA_LIBS += $$lib.lib
}
for(lib, CUDA_LIB_NAMES) {
NVCC_LIBS += -l$$lib
}
LIBS += $$CUDA_LIBS
# The following library conflicts with something in Cuda
QMAKE_LFLAGS_RELEASE = /NODEFAULTLIB:msvcrt.lib
QMAKE_LFLAGS_DEBUG = /NODEFAULTLIB:msvcrtd.lib
# MSVCRT link option (static or dynamic, it must be the same with your Qt SDK link option)
MSVCRT_LINK_FLAG_DEBUG = "/MDd"
MSVCRT_LINK_FLAG_RELEASE = "/MD"
# Configuration of the Cuda compiler
CONFIG(debug, debug|release) {
# Debug mode
DESTDIR = debug
OBJECTS_DIR = debug/obj
CUDA_OBJECTS_DIR = debug/cuda
cuda_d.input = CUDA_SOURCES
cuda_d.output = $$CUDA_OBJECTS_DIR/${QMAKE_FILE_BASE}_cuda.o
cuda_d.commands = $$CUDA_DIR/bin/nvcc.exe -D_DEBUG $$NVCC_OPTIONS $$CUDA_INC $$NVCC_LIBS \
--machine $$SYSTEM_TYPE -arch=$$CUDA_ARCH -code=$$CUDA_CODE \
--compile -cudart static -g -DWIN32 -D_MBCS \
-Xcompiler "/wd4819,/EHsc,/W3,/nologo,/Od,/Zi,/RTC1" \
-Xcompiler $$MSVCRT_LINK_FLAG_DEBUG \
-c -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME}
cuda_d.dependency_type = TYPE_C
QMAKE_EXTRA_COMPILERS += cuda_d
}
else {
# Release mode
DESTDIR = release
OBJECTS_DIR = release/obj
CUDA_OBJECTS_DIR = release/cuda
cuda.input = CUDA_SOURCES
cuda.output = $$CUDA_OBJECTS_DIR/${QMAKE_FILE_BASE}_cuda.o
cuda.commands = $$CUDA_DIR/bin/nvcc.exe $$NVCC_OPTIONS $$CUDA_INC $$NVCC_LIBS \
--machine $$SYSTEM_TYPE -arch=$$CUDA_ARCH -code=$$CUDA_CODE \
#--use-local-env --cl-version 2015 -ccbin "E:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64" \
--compile -cudart static -D_MBCS \
-Xcompiler "/wd4819,/EHsc,/W3,/nologo,/O2,/Zi" \
-Xcompiler $$MSVCRT_LINK_FLAG_RELEASE \
-c -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME}
cuda.dependency_type = TYPE_C
QMAKE_EXTRA_COMPILERS += cuda
}
I have read some threads about configuring cuda on qt but seems no one got the same error like this. I have copied all the lib files appeared in the VS sample linker setting, and still get the error. What should I do?
I solved it now this is by adding msvcrt to lib list. Wondering why this file is not listed in sample Visual Studio projects.
I have a qt project that uses some ffmpeg functionality, that i have compiled previously on windows (x86) and ubuntu. However, its x86 binaries do not work correctly on x64 windows machine. I have tried compiling it but have run into a strange problem.
All ffmpeg functions i use are listed as unresolved exgternals; and the most pecicular thing is, their names all ahve a leading underscore attached to them (so, avformat_close_input -> _avformat_close_input etc). To be sure, i have downloaded latest ffmpeg libraries for x64 machines and run them through a dependency walker - no leading underscores anywhere.
How to fix this problem?
Here is my .pro file:
#-------------------------------------------------
#
# Project created by QtCreator 2013-05-17T10:55:01
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = LPR_Demo
TEMPLATE = app
# The application version
VERSION = 1.0
# Define the preprocessor macro to get the application version in our application.
DEFINES += APP_VERSION=\\\"$$VERSION\\\"
SOURCES += main.cpp\
mainwindow.cpp \
imgProcessor.cpp \
qpicturelabel.cpp \
aboutdialog.cpp \
state.cpp \
qt_videoreader.cpp \
roidialog.cpp \
recognitionresult.cpp \
ffmpeg_reader.cpp \
label_videoplayer.cpp
HEADERS += mainwindow.h \
imgProcessor.h \
qpicturelabel.h \
aboutdialog.h \
state.h \
qt_videoreader.h \
roidialog.h \
recognitionresult.h \
global.h \
ffmpeg_reader.h \
label_videoplayer.h
FORMS += mainwindow.ui \
aboutdialog.ui \
roidialog.ui
LPRDIR = $$PWD/LPR
win32: LIBS += -L$$LPRDIR/bin/ -lliblpr
unix:LIBS += -L$$LPRDIR/bin -lLPR
INCLUDEPATH += $$LPRDIR/include
DEPENDPATH += $$LPRDIR/include
INCLUDEPATH += $$PWD/
DEPENDPATH += $$PWD/
#OTHER_FILES += \
# ffmpeg.pri
include(ffmpeg.pri)
#LIBS += -lavformat -lavcodec -lavutil -lswscale
RESOURCES += \
lpr_Res.qrc
win32 {
dlls_to_move.path += $$OUT_PWD/bin
dlls_to_move.files += $$LPRDIR/bin/liblpr.dll
QTDIR=C:/Qt/4.8.4/
CONFIG (debug, debug|release) {
dlls_to_move.files += $$QTDIR/bin/QtCored4.dll \
$$QTDIR/bin/QtGuid4.dll
}
CONFIG (release, debug|release) {
dlls_to_move.files += $$QTDIR/bin/QtCore4.dll \
$$QTDIR/bin/QtGui4.dll
}
img_format.path += $$OUT_PWD/bin/imageformats
CONFIG (debug, debug|release) {
img_format.files += $$QTDIR/plugins/imageformats/qgifd4.dll \
$$QTDIR/plugins/imageformats/qicod4.dll \
$$QTDIR/plugins/imageformats/qjpegd4.dll \
$$QTDIR/plugins/imageformats/qmngd4.dll \
$$QTDIR/plugins/imageformats/qsvgd4.dll \
$$QTDIR/plugins/imageformats/qtgad4.dll \
$$QTDIR/plugins/imageformats/qtiffd4.dll
}
CONFIG (release, debug|release) {
img_format.files += $$QTDIR/plugins/imageformats/qgif4.dll \
$$QTDIR/plugins/imageformats/qico4.dll \
$$QTDIR/plugins/imageformats/qjpeg4.dll \
$$QTDIR/plugins/imageformats/qmng4.dll \
$$QTDIR/plugins/imageformats/qsvg4.dll \
$$QTDIR/plugins/imageformats/qtga4.dll \
$$QTDIR/plugins/imageformats/qtiff4.dll
}
ffmpeg_dll.path += $$OUT_PWD/bin
ffmpeg_dll.files += $$FFMPEG_LIBRARY_PATH/avutil-*.dll \
$$FFMPEG_LIBRARY_PATH/avcodec-*.dll \
$$FFMPEG_LIBRARY_PATH/avformat-*.dll \
$$FFMPEG_LIBRARY_PATH/swscale-*.dll
main_exe.path += $$OUT_PWD/bin
CONFIG (debug, debug|release) {
main_exe.files += $$OUT_PWD/debug/LPR_Demo.exe
}
CONFIG (release, debug|release) {
main_exe.files += $$OUT_PWD/release/LPR_Demo.exe
}
INSTALLS += dlls_to_move img_format ffmpeg_dll main_exe
}
unix {
CONFIG (release, debug|release) {
QMAKE_PRE_LINK += rm LPR_Demo_cmpr LPR_Demo$$escape_expand(\n\t)
QMAKE_POST_LINK += upx -9 -oLPR_Demo_cmpr LPR_Demo$$escape_expand(\n\t)
QMAKE_POST_LINK += cp -v -u LPR_Demo_cmpr $$OUT_PWD/../artifacts/examples/qt_demo/bin/unix
}
}
and here is pri file for ffmpeg:
# Include the configuration file below in the QT .pro file, and modify the path accordingly.
# ##############################################################################
# ##############################################################################
# FFMPEG: START OF CONFIGURATION BELOW ->
# Copy these lines into your own project
# Make sure to set the path variables for:
# 1) ffmpeg_reader,
# 2) FFMPEG include path (i.e. where the directories libavcodec, libavutil, etc. lie),
# 3) the binary FFMPEG libraries (that must be compiled separately).
# Under Linux path 2 and 3 may not need to be set as these are usually in the standard include and lib path.
# Under Windows, path 2 and 3 must be set to the location where you placed the FFMPEG includes and compiled binaries
# Note that the FFMPEG dynamic librairies (i.e. the .dll files) must be in the PATH
# ##############################################################################
# ##############################################################################
# ##############################################################################
# Modify here: set FFMPEG_LIBRARY_PATH and FFMPEG_INCLUDE_PATH
# ##############################################################################
# Set FFMPEG_LIBRARY_PATH to point to the directory containing the FFmpeg import libraries (if needed - typically for Windows), i.e. the dll.a files
win32:FFMPEG_LIBRARY_PATH = $$PWD/ffmpeg/lib
unix: FFMPEG_LIBRARY_PATH = /usr/local/lib
# Set FFMPEG_INCLUDE_PATH to point to the directory containing the FFMPEG includes (if needed - typically for Windows)
win32:FFMPEG_INCLUDE_PATH = $$PWD/ffmpeg/include
unix:FFMPEG_INCLUDE_PATH = /usr/local/include
# ##############################################################################
# Do not modify: FFMPEG default settings
# ##############################################################################
# Set list of required FFmpeg libraries
#unix:LIBS += -L$$FFMPEG_LIBRARY_PATH
unix:LIBS += -lavformat -lavcodec -lavutil -lswscale
# Add the path
win32:LIBS += -L$$FFMPEG_LIBRARY_PATH
win32:LIBS += -lavformat -lavcodec -lavutil -lswscale
INCLUDEPATH += $$FFMPEG_INCLUDE_PATH
# Requied for some C99 defines
DEFINES += __STDC_CONSTANT_MACROS
# ##############################################################################
# FFMPEG: END OF CONFIGURATION
# ##############################################################################