Reputation: 403
I am trying to compile http://www.kevinbeason.com/smallpt/ raytracer using Qt5 and Visual Studio 2012 compiler.
It works Okay but when I try to use openmp by adding
QMAKE_CXXFLAGS += -fopenmp
LIBS += -fopenmp
to project.pro , Qt says that /fopenmp is not recognized and ignored.
When I compile using VS command
cl /c /O2 /EHsc /openmp main.cpp
it works and I get a program 3 times faster then the one compiled from Qt.
How to make Qt recognize openmp and how to enable the other optimizations in the command line?
Thanks in advance.
Upvotes: 4
Views: 2206
Reputation: 23
I want to run Qt project with openmp. I have followed the above steps, I could build the project, but execution time is increasing instead of reducing.
Here is the configuration I used
CONFIG += console c++11
CONFIG -= app_bundle
#CONFIG -= qt
QMAKE_CXXFLAGS+= -openmp
Upvotes: 0
Reputation: 403
I finally got all the required elements to get it compiled with openmp from Qt Creator:
#include <omp.h>
to the source, which is not required if you compile with
the command line mentioned above.QMAKE_CXXFLAGS += -openmp
to the project file. It wont work
with -fopenmp
. No need for any openmp lib like I did ( LIBS += -openmp
) neither for QMAKE_LFLAGS += -openmp
The other optimization options are already configured in mkspecs\win32-msvc2012\
qmake.conf
Hope this helps someone else.
Upvotes: 7