Adding glfw to Qt via cmake - qt

I am using qt6, win10, mingw.
I have dowloaded GLFW 64bit windows binary from the official site.
I know how to add it via qmake, but how could I add it via cmake.
.dll file location: linking\GLFW
.h file location: include\GLFW
I knwo that there is an integrate qt opengl, but I do not want to use that.

These are things which I did to make OpenGL work using CMake (This is on a Ubuntu system, it should be similar on Windows):
find_package(OpenGL REQUIRED)
find_package(GLUT REQUIRED)
find_package(Threads REQUIRED)
link_libraries(
${CMAKE_SOURCE_DIR}/libs/build_glfw/src/libglfw3.a
${CMAKE_SOURCE_DIR}/libs/glew-2.1.0/build/lib/libGLEW.a
${OPENGL_LIBRARIES}
${GLUT_LIBRARY}
${CMAKE_THREAD_LIBS_INIT}
${CMAKE_DL_LIBS}
)
include_directories(
${CMAKE_SOURCE_DIR}/libs/glew-2.1.0/include
${CMAKE_SOURCE_DIR}/libs/glfw/include
${OPENGL_INCLUDE_DIRS}
${GLUT_INCLUDE_DIRS}
)
This path you have to change according to your dll location:
${CMAKE_SOURCE_DIR}/libs/build_glfw/src/libglfw3.a
${CMAKE_SOURCE_DIR}/libs/glew-2.1.0/build/lib/libGLEW.a
These variables are provided by CMake:
${OPENGL_LIBRARIES}
${GLUT_LIBRARY}
${CMAKE_THREAD_LIBS_INIT}
${CMAKE_DL_LIBS}

Related

mingwm10.dll missing in the bin folder

I was trying to create a exe file of my Qt project.
I found this post: How to create executable file for a Qt Application?
and realised that i dont have a mingwm10.dll file in that directory.
Are there any other ways of creating a exe file or any other location where mingwm10.dll might be located?
I am using qt 5.6.
mingwm10.dll is a runtime file for the MinGW.org toolchain. Qt moved towards a MinGW-w64-based toolchain (which is essentially an expanded and newer implementation of the Win32 headers and import libraries), which doesn't have this runtime dependency. Ignore it, you don't need it. You might need the libgcc and libstdc++ DLLs though, but that's the same with any (non-statically built) toolchain.
Note you can use the windeployqt utility to automatically copy over all runtime depencies of an executable. You can enable it by adding windeployqt to CONFIG if you're using qmake, or you could just run it yourself:
windeployqt my_app.exe
This command will copy all DLLs (including the Qt platform plugins etc.) so that the application can be run by e.g. double-clicking, instead of only in the specific environment of an IDE.

How to install plugins into Qt Designer?

I have scoured the internet for information regarding the installation process for plugins into Qt Designer and I have found no helpful/relevant information.
The plugin I want to install is the echo plugin.
I have also looked through the Qt Designer program files and found the echoplugin folder but have no idea how to install it. Here is the file location:
C:\Qt\Examples\Qt-5.5\widgets\tools\echoplugin
This holds the following file types; Qt Project Files, C++ Header, C++ Source and JSON
System Information
Windows 10
PyQt4
Qt Designer 5.5.0
Official documentation describes it very well.
To install plugin for Qt Designer or Qt Creator you need to place the plugin to plugins\designer directory.
For Qt Creator it is located in it's bin directory.
Qt Designer is a part of Qt installation so directory will be QTDIR\plugins\designer where QTDIR is Qt installation path (for me it is "E:\DEV\Qt\5.5\msvc2015_desktop_shared" and full plugins path is "E:\DEV\Qt\5.5\msvc2015_desktop_shared\plugins\designer").
One important thing - Qt Designer / Qt Creator and the plugin must be compiled using the same compiler version. You can not install plugin compiled with MSVC 2015 to Qt Designer compiled with MSVC 2013!
Edit:
I am using C++ version of Qt.
It looks like echo plugin is not a plugin for Qt Designer / Qt Creator.

Configuring Qt creator for KDE applications

I want to build some KDE applications. Here's what I did so far:
sudo apt-get install kde-full
add LIBS += -lkdeui in the .pro file of a project which used KDE libraries.
I am using the QtCreator and the above mentioned steps don't seem to be enough. Error message: KApplication: no such file or directory.
What are the steps to configure my system for KDE application development?
The recommended way to build a KDE project is use CMake, not QMake. I really recommend you this approach because some KDE applications, like plasmoids, can not be build correctly using QMake.
In addition you can use KDevelop, but if you prefer Qt Creator, you can use it with a CMake project without problems.
http://techbase.kde.org/Development/Tutorials/CMake
KApplication.h is typically located in /usr/include/KDE folder. Make sure you have it in your include path (i.e. INCLUDEPATH += /usr/include/KDE).

Integrating QWT 6.0.1 with Qt Creator/Designer 4.8.0

I've installed the Qt SDK version 4.8.0 (to C:\QtSDK) on a Windows 7 64-bit machine. I've also installed and successfully compiled QWT 6.0.1 with MSVC2010.
I can use QWT in C++ code by linking to the libraries; however when I try to use the plugin I get an error that I can't seem to find on the Googles.
My failed plugin error is:
The plugin 'C:/QtSDK/QtCreator/bin/designer/qwt_designer_plugin.dll' uses an incompatible Qt library. (4.8.0) [release]
My QWTbuild.pri has CONFIG += debug_and_release
I built the plugin by doing:
C:\QtSDK\QWT\qwt-6.0.1\designer > qmake designer.pro
C:\QtSDK\QWT\qwt-6.0.1\designer > nmake release
I then copied the .dll generated (qwt_designer_plugin.dll) in C:\QtSDK\QWT\qwt-6.0.1\designer\plugins\designer to my plugin path for QtCreator (C:\QtSDK\QtCreator\bin\designer)
I've also put the .dll and the .lib generated in the Qt plugins folder (C:\QtSDK\Desktop\Qt\4.8.0\msvc2010\plugins\designer).
I've also linked my libraries in the project file containing the form I'm trying to build.
I'm sure that there's something small I'm missing, but I can't seem to find it. What am I doing wrong here? Any help would be greatly appreciated.
Regards,
Alexis
The Qt plugins should use the same version of Qt or a lower version with the same major number as the application they are loaded in.
Since the Qt Creator currently included in the Qt SDK seems to use Qt 4.7.4, you should probably recompile Qwt for that version of Qt.

Installing OpenGL for Qt

I just have installed Qt 4 on windows 7. I am now in a bit of a confusion
How do I get to install OpenGL so that it works with QT? Is there an installer for OpenGL?
Qt docs. say it has support for OpenGL, but when I include QTOpenGL and build, the compiler issues an error of "No such file or directory"
Thanks for the reply in advance!
Are you sure you followed this to the letter? You need to include <QtOpenGL> and set the QT += opengl option in your pro file.
What tool chain are you using? (Visual Studio, Qt Creator/g++) You need to specify somewhere in your project settings that you want to use the QtOpenGL module. This will result in a line in your .pro file similar to this:
QT = core gui opengl
This causes qmake to add the proper include path when invoking the compiler (I believe).
added the line QT += opengl to the .pro file

Resources