SDL icon indicating copy to clipboard operation
SDL copied to clipboard

Add support for building SDL with Watcom compilers using CMake

Open madebr opened this issue 1 year ago • 8 comments

This pr ports Makefile.w32 and Makefile.os2 to the cmake build script.

madebr avatar Jul 31 '22 21:07 madebr

When targeting windows with watcom, __cdecl gets in the way and needs handling properly: Our current solution is defining DECLSPEC as an empty macro and using an exports file. See lines 36 and 252 of Makefile.w32 if you haven't handled that already.

sezero avatar Jul 31 '22 21:07 sezero

Does cmake automatically add -bd to compiler switches when building a dll?

sezero avatar Jul 31 '22 21:07 sezero

When targeting windows with watcom, __cdecl gets in the way and needs handling properly: Our current solution is defining DECLSPEC as an empty macro and using an exports file. See lines 36 and 252 of Makefile.w32 if you haven't handled that already.

I saw those lines, but forgot to port these as I didn't see any link errors when using/testing the DLL. I'll add those lines.

Does cmake automatically add -bd to compiler switches when building a dll?

Yes, it's added automatically.

madebr avatar Jul 31 '22 21:07 madebr

When targeting windows with watcom, __cdecl gets in the way and needs handling properly: Our current solution is defining DECLSPEC as an empty macro and using an exports file. See lines 36 and 252 of Makefile.w32 if you haven't handled that already.

I saw those lines, but forgot to port these as I didn't see any link errors when using/testing the DLL

The issue is, if you don't do that the dll will only work exes built with watcom against a watcom-generated import library. This way you can replace the mingw- or msvc-built dll with a watcom-built one and the corresponding exe will still work correctly.

sezero avatar Jul 31 '22 21:07 sezero

Thanks for explaining to me, I fixed it in the latest commit.

If anybody wants to test this on their local Windows machine, make sure to use the latest nightly open watcom 2.0 build because older versions cannot handle response files that are too big.

madebr avatar Jul 31 '22 21:07 madebr

Is this something that someone asked for? It seems like Makefile.os2 has been around and does what we need for that platform.

slouken avatar Jul 31 '22 22:07 slouken

The cost of supporting Watcom in the cmake script is low. There were already some references to OS2 in the cmake script, but they were not used (until now). Adding CMake support allows our users to keep using their cmake based build system when targeting these legacy operating systems.

madebr avatar Jul 31 '22 22:07 madebr

There were already some references to OS2 in the cmake script, but they were not used (until now).

They were there for emx (gcc-based toolchain targeting os/2 but native-only, no cross-solutions at all.)

sezero avatar Jul 31 '22 23:07 sezero

@sezero, you just removed the custom Watcom Makefiles, is this something you still want?

slouken avatar Nov 23 '22 18:11 slouken

@sezero, you just removed the custom Watcom Makefiles, is this something you still want?

No, we don't want this anymore

sezero avatar Nov 23 '22 18:11 sezero