Cuberite Forum
change cmake gcc flags? - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html)
+--- Forum: Development (https://forum.cuberite.org/forum-13.html)
+--- Thread: change cmake gcc flags? (/thread-2421.html)



change cmake gcc flags? - danny9484 - 04-05-2016

hey,
I was wondering if you can compile cuberite with different gcc flags like march=native option ... would like to test if there is any difference in performance. But I have no idea how cmake works so is this possible? and what I would have to do?


RE: change cmake gcc flags? - bearbin - 04-07-2016

By default I believe that Cuberite is compiled with march=native (unless you use the CROSSCOMPILE flag)

https://github.com/cuberite/cuberite/blob/8fc9cfa41101b6b99cbf1dda21be1a22980aab0f/SetFlags.cmake#L127


RE: change cmake gcc flags? - danny9484 - 04-07-2016

ok march was a bad example. I also meant other experimental flags like -O3 and -ffast-math.
So do I have to add them to that line or is there another way to pass through these flags?


RE: change cmake gcc flags? - bearbin - 04-08-2016

I believe you should just be able to do

Code:
CFLAGS="-O3" CXXFLAGS="-O3" cmake ..."



RE: change cmake gcc flags? - danny9484 - 04-10-2016

yep thats it thanksBig Grin


RE: change cmake gcc flags? - worktycho - 04-23-2016

(04-07-2016, 11:35 PM)danny9484 Wrote: ok march was a bad example. I also meant other experimental flags like -O3 and -ffast-math.
So do I have to add them to that line or is there another way to pass through these flags?

If you compile with -DCMAKE_BUILD_TYPE=RELEASE -O3 and -ffast-math are used as well.