I set CMAKE_CXX_FLAGS_RELEASE to -O2 instead of -O3 -DNDEBUG and built with cmake --build dist --config Release. Result: 16.5 MB. It is minus 1.4 MB for Release but Debug is 12.0 MB
If you still want to make it smaller, you could optimize for size and/or use a packer, as you did before; now it will be much more useful because there’s no more debug data to pack.
You can also add -s flag to linker to strip right after DLL is linked.
Unfortunately, I don’t have Linux. I don’t have enough space on my laptop to install Linux on Virtual Box. I think it would require at least 5GB. There would be some program to use console commands, like in Linux, but on Windows.
It would be great if the CMake GUI had a single checkbox “Use OpenGL only” and “Use Vulkan only” that would disable everything else, even the extra .cpp files that are included. For example, I don’t need Vulkan. I only need OpenGL 2.1, OpenGL ES 2.0, and a joystick.
Unfortunately, I don’t have Linux. I don’t have enough space on my laptop to install Linux on Virtual Box. I think it would require at least 5GB. There would be some program to use console commands, like in Linux, but on Windows.
Fortunately, all these tools are available on Windows as part of the mingw-w64 package, you can also install MSYS2 to get a comfy POSIX-like environment. And of course you can skip all these steps I described and just strip the library or add the -s linker flag.
It would be great if the CMake GUI had a single checkbox “Use OpenGL only” and “Use Vulkan only” that would disable everything else, even the extra .cpp files that are included. For example, I don’t need Vulkan. I only need OpenGL 2.1, OpenGL ES 2.0, and a joystick.
There are more rendering backends, and it will require adding an option like this for each of them, and what if the user has both ONLY_VULKAN and ONLY_OPENGL enabled ?
Too much complexity for something that can be achieved with manual (and more precise) option control.