Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

qmake: handling options for both gcc and msvc

I would like to make a project file that would work both with msvc and gcc.

For instances, to optimize for speed you would do cl /O2 and g++ -O3.

But I don't know how to tell the project file to make the difference. I would like something like :

msvc:QMAKE_CXXFLAGS_RELEASE += /O2 /openmp /arch:AVX
else:QMAKE_CXXFLAGS_RELEASE += -O3 -march=native -fopenmp -D_GLIBCXX_PARALLEL

which doesn't work sadly.

Other way would be to change the mkspecs and bundle the new ones with my app, but it is not very portable. Thanks !

like image 942
Jean-Michaël Celerier Avatar asked Aug 22 '13 04:08

Jean-Michaël Celerier


1 Answers

Jean, to be precise, you should use this based on your description:

msvc:QMAKE_CXXFLAGS_RELEASE += /O2 /openmp /arch:AVX
gcc:QMAKE_CXXFLAGS_RELEASE += -O3 -march=native -fopenmp -D_GLIBCXX_PARALLEL
like image 105
lpapp Avatar answered Oct 28 '22 07:10

lpapp