qmake

Build Qt in “Release with Debug Info” mode?

北城以北 提交于 2019-11-30 08:05:09
Is there a way to build Qt in "Release with Debug info" mode ? My application crashes only in "release" mode (works fine in Debug mode) and seems the issue comes from Qt (may be a bug in Qt).So I want to see the debug info of Qt. Qt docs has "debug" , "release" but not "release with debug" mode. [Upate] My application works fine with Mingw 32bit Release/Debug and VSC++ Compiler 64bit Debug. Only crashes on VSC++ 64Bit Release Any tips ? Update: See @milanw's answer below. This is now supported directly in qmake We use qmake to generate vcproj files to build Qt. I wrote a python script (but sed

How to refer to the source directory in qmake?

懵懂的女人 提交于 2019-11-30 07:12:37
I added version.target = version.h version.commands = bash generate-version.sh QMAKE_EXTRA_TARGETS += version PRE_TARGETDEPS += version.h to the project, but it attempts to run "generate-version.sh" in destination directory: make: Leaving directory `.../qqq-build-desktop' make: Entering directory `.../qqq-build-desktop' Makefile:236: warning: overriding commands for target `version.h' Makefile:233: warning: ignoring old commands for target `version.h' bash generate-version.sh bash: generate-version.sh: No such file or directory make: Leaving directory `.../qqq-build-desktop' There is $$DESTDIR

How to convert qmake to cmake?

社会主义新天地 提交于 2019-11-30 06:57:27
I have a .pro file on my project, but now I want to port it to a CMakeLists.txt file, how can I do this ? QT += core QT -= gui CONFIG += c++11 TARGET = test CONFIG += console CONFIG -= app_bundle TEMPLATE = app QT += network SOURCES += main.cpp \ test_interface.cpp \ motomanlibrary.cpp \ processing.cpp SOURCES += main.cpp \ test_interface.h \ motomanlibrary.h \ processing.h QMake: The required libraries. QT += core QT -= gui QT += network CMake: only the add is necessary. An exclude (QT -= gui) is not required. find_package(Qt5Core REQUIRED) find_package(Qt5Network REQUIRED) QMake: Additional

How to put generated files (e.g. object files) into a separate folder when using Qt/qmake?

风格不统一 提交于 2019-11-30 06:45:14
I have a Qt project that uses qmake. To improve clarity and readability, I'd like to keep the source files build system generated files (such as object files) separate. So my first step was putting the source files into a src/ sub directory: myproject/ myproject.pro src/ main.cpp MainWindow.ui ... That way I separated the source files from the build system (*.pro). However, when I then run qmake followed by make , the generated files (object files, etc) are placed into the main project folder: myproject/ myproject.pro Makefile main.o ui_MainWindow.h ... src/ main.cpp MainWindow.ui ... Well, at

Copy a file to build directory after compiling project with Qt

妖精的绣舞 提交于 2019-11-30 06:24:53
问题 I have seen several suggestions, but nothing really worked for me as I want. I just need to copy a file to the desired destination directory. Say, for example from this answer: install_it.path = %{buildDir} install_it.files += %{sourceDir}/settings.ini INSTALLS += install_it Variables %{buildDir} and %{sourceDir} should be defined, to make this work. Ok, there's no problem with %{sourceDir} : it is just . . But how can I get %{buildDir} ? EDIT1 Say, I have a project my_project here: /path/to

Qt 5.5 with qmake: Linker cannot resolve OpenGL function calls

为君一笑 提交于 2019-11-30 05:22:56
问题 When using Qt 5.5, qmake and MSVC 13 to compile a basic, boilerplate Qt application with some fundamental OpenGL function calls, I get the following linker errors: glwidget.obj:-1: error: LNK2019: unresolved external symbol __imp__glClear@4 referenced in function "public: virtual void __thiscall GLWidget::initializeGL(void)" (?initializeGL@GLWidget@@UAEXXZ) glwidget.obj:-1: error: LNK2019: unresolved external symbol __imp__glClearColor@16 referenced in function "public: virtual void _

How to check the selected version of Qt in a .pro file?

主宰稳场 提交于 2019-11-30 04:48:13
I have multiple versions of Qt installed, and I need to compile my project with all of them. Using a pro file, I could not find in the documentation how to do a conditional compilation. Ideally, this is what I would like to do: QT_VERSION = 5 # this can be 4, set manually if(QT_VERSION == 5) { QT += widgets } if(QT_VERSION == 4) { QT += gui } Naturally, the if() command does not exist in pro files. Is there a better way to do the same thing? Nemanja Boric You can use conditional functions and scopes here: QT_VERSION = 5 # this can be 4, set manually equals(QT_VERSION, 5){ QT += widgets }

Qt - Using asterisk (*) in .pro-File with directories

旧时模样 提交于 2019-11-30 04:23:24
问题 I have a .pro file which looks like: SOURCES += myfolder/source1.cpp \ myfolder/source2.cpp HEADERS += myfolder/header1.h\ myfolder/header2.h FORMS += myfolder/form1.ui\ myfolder/form2.ui And everything works great. However, if I try to use an asterisk to include all the files, i.e.: SOURCES += myfolder/*.cpp HEADERS += myfolder/*.h FORMS += myfolder/*.ui qmake throws a file-not-found-error: WARNING: Failure to find: myfolder\*.cpp [...] :-1: error: No rule to make target `myfolder/*.cpp',

Using QMAKE to build a both 32 and 64 bits versions of project

别来无恙 提交于 2019-11-30 04:14:22
I need to generate a 32 bits version of my application however I am compiling on a 64 bits OS. I'm looking for a way to make QMake to generate both 32 and 64 bits versions of my application. If this is not possible I would like to know how to switch to 32 bits. I would also like to avoid having to mess with the generated makefile. Use a construction something like: CONFIG += 32bit CONFIG(32bit) { TARGET = 32bit_binary QMAKE_CXXFLAGS += -m32 LIBS += -L<path to 32bit libraries> } CONFIG(64bit) { TARGET = 64bit_binary } in your .pro file. Then you only need to change one line to recompile for the

Developing QT applications in Xcode?

一曲冷凌霜 提交于 2019-11-30 02:57:33
问题 My IDE of choice for the Mac (at least for C++ and Objective-C development) is Xcode. I have a 64-bit Intel Mac with OS X Lion installed, and Xcode version 4.2 downloaded from the Mac App Store. My problem is that Qt is apparently not compatible with Xcode 4 (it crashes when launching projects generated by qmake), so I'm basically asking how I can integrate Qt with Xcode. I don't have to be able to run and debug the project from Xcode, just build it. So I thought it might be a solution to use