Marzac / le3d

A straightforward and easy to use 3D software renderer for real-time retro graphics.
https://marzac.github.io/le3d/
MIT License
60 stars 6 forks source link

cxx flags configurable #13

Closed m0ppers closed 6 years ago

m0ppers commented 6 years ago

I am still unsure about the correct way to do this. Initially I went for target_compile_options to set compiler flags.

However that has the big drawback that it is not configurable from the outside (unless you change CMakeLists.txt of course).

The -m32 setting that you had in there initially was biting me all around because I can't build 32 bit stuff here. So I simply commented it out (and then accidentally commited it :S)

So here is another approach. I am assembling a list of flags into LE3D_CXX_FLAGS_SUGGESTION . Whenever you first run cmake now that variable is being saved into CMakeCache.txt. From then on it is user editable via cmake ui. This means you don't have to touch any files under source control (and no more accidental commits).

This setting will then feed CMAKE_CXX_FLAGS which will be used everywhere then (including subdirectories e.g. cube example etc).

As I said..Still unsure what the correct way to do would be. Open for comments.

Marzac commented 6 years ago

My bad, you are totally right.

The -m32 flag was a mistake, so was the march=pentium4 and mfpmath=SSE instruction set selector. They are too architecture specific for this project. I commented the -m32 out too because my Linux distribution is x86-64 and therefore libc6 is 64bit by default so it would not compile or link or both.

I really like the new approach, I think it's a great compromise, I merge the pull then.