Marzac/le3d

Too heavy executables produced by mingw64 using Makefile generated from CMAKE

Marzac opened this issue · 5 comments

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.

Ok, I have fixed that.

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.

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

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

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