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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With