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

Too heavy executables produced by mingw64 using Makefile generated from CMAKE #11

Closed Marzac closed 6 years ago

Marzac commented 6 years ago

The executables produced by mingw64 using the generated Makefile from CMAKE are too heavy. It's a problem of the g++ / ld configuration as the old build.bat script still produces executables ~= 150Kb with the Cube example and the current codebase.

Marzac commented 6 years ago

Ok, I have fixed that.

Marzac commented 6 years ago

I have pushed a new version of CMake scripts including optimization flags to compile the examples executables. I don't know if this is the right way to do. Please have a look.

m0ppers commented 6 years ago

No it is not :)

The base CXX flags are derived from the CMAKE_BUILD_TYPE. That means it should not be set in the CMakelists file directly.

CMake knows a few compilers so it will generate a proper command line for the compiler.

Long story short:

cmake -DCMAKE_BUILD_TYPE=MinSizeRel

will generate an "-Os -DNDEBUG" for gcc.

cmake -DCMAKE_BUILD_TYPE=Release

will generate "-O3 -DNDEBUG"

etcetc.

So I think you should simply delete it.

For MSVC you can specify the build type on the command line when building:

cmake --build . --config MinRelSize
Marzac commented 6 years ago

Oups my bad again. I am learning CMAKE with you actually. I delete the optimization flags immediately.

Marzac commented 6 years ago

Ok you did it already within the pull request, that is great, many thanks.