SFML community forums

Help => General => Topic started by: steelmanx on January 01, 2014, 06:59:08 pm

Title: sfml-main.lib static vs dynamic compile
Post by: steelmanx on January 01, 2014, 06:59:08 pm
Last night i compiled sfml 2.1 on vs2013.
Except some minor problems with cmake on the static compilation it went very well.
i ended up with release and debug versions of both static and dynamic libs.
All the libs had correct names( -d for debug and -s for static) except for sfml-main.lib had the same name for both static and dynamic builds. I checked and both files have different sizes.
Is there a reason for this inconsistency?
Title: Re: sfml-main.lib static vs dynamic compile
Post by: eXpl0it3r on January 01, 2014, 08:38:20 pm
Just look at (https://github.com/SFML/SFML/blob/master/src/SFML/Main/SFML_Main.cpp) what sfml-main actually does and you'll understand that there's really no reason to make a dynamic lib out of it and CMake doesn't even generate one, regardless whether you choose dynamic or static, no DLL will be generated. There's only a debug and a release version. The debug version will contain some debugging information and will thus most likely be a bit bigger.
You should also always link the debug libs to your debug version and the release libs to your release version. ;)
Title: Re: sfml-main.lib static vs dynamic compile
Post by: steelmanx on January 01, 2014, 08:47:44 pm
I know that it is just a simple solution for portability and that no dll is created.
But i still don't get why i ended up with different versions for static and dynamic compilation.
Title: Re: sfml-main.lib static vs dynamic compile
Post by: eXpl0it3r on January 01, 2014, 08:52:57 pm
You can also look at the build script (https://github.com/SFML/SFML/blob/master/src/SFML/Main/CMakeLists.txt) of the sfml-main library. There's branching for static and dynamic builds, so you'll have to either ask the CMake guys and/or the Visual Studio 2013 guys, why and more importantly how there would be a difference in size.