mmozeiko / build-sdl3

Automatic build of SDL3 libraries for Windows
41 stars 6 forks source link

Static Libs #2

Closed jarroddavis68 closed 9 months ago

jarroddavis68 commented 9 months ago

Hi, I was wondering what changes need to be made to build SDL libs as static?

mmozeiko commented 9 months ago

I have not tried, but I believe for SDL build itself changing -DBUILD_SHARED_LIBS=ON to OFF should work. For all the other SDL libraries adding -c and removing -DDLL_EXPORT and nothing after -link argument should produce just .obj files. After that it's either lib.exe to create .lib file out of .obj files, or just add all of them directly to your linker arguments.

jarroddavis68 commented 9 months ago

Hi, thanks for your reply.

The first problem I ran into (on win11, latest), is that the script does not seem to download all the dependencies. For example, it would error on /build/zlib-1.3.1 not found. Just to get things to go, I had to manually download all the remaining and manually unzip them to build. Then I managed to get it to compile everything up to SDL3-static.lib. I'm currently stuck at SDL3_image.

jarroddavis68 commented 9 months ago

Hmm, it had issues because of the folder I called build.cmd from, I think. Used build-sdl3 which is what was it unzipped to, and it had issues for whatever reason. Removed the - and it seems to now download the dependencies. Will continue and see if I can get it static build working.

jarroddavis68 commented 9 months ago

Well all right, success! I have been looking to automate building SDL and combine everything into a single DLL. Thanks to your script, and your change suggestions, I was finally able to do it.

So, thanks again bro!

build-static.zip