catseye / Befunge-93

MIRROR of https://codeberg.org/catseye/Befunge-93 : The NEW reference distribution for Befunge-93!
https://catseye.tc/node/Befunge-93
Other
98 stars 9 forks source link

Support compiling on MSVC #13

Closed j4james closed 6 years ago

j4james commented 6 years ago

I don't know if this is something that you'd necessarily want to support, but when I saw the work you were doing to get bef compiling on different platforms, I thought you might be interested in the patch I use to compile in Microsoft's Visual C (the cl command line compiler).

The only change required in the code was a mapping of the sleep function to Microsoft's _sleep. The bigger issue was getting a working Makefile. I don't believe it's possible to create something that's compatible with both GNU make and Microsoft's nmake, so I just created a completely separate NMakefile (I build with nmake -f NMakefile).

Anyway, if you're interested, I've included the patch below. This is against the develop-2018-1 branch, in case that matters. If you prefer a PR, I could probably do that too.

msvc-patch.txt

cpressey commented 6 years ago

I've applied this patch on a branch off develop-2018-1 here.

I don't have anything to test it with at the moment but I'm sure it's fine.

I kind of prefer separate Makefiles/build scripts when architectures are significantly different anyway.

I'll try to get this into the 2.24 release.

j4james commented 6 years ago

Thanks for merging this. And FWIW, I can at least confirm that your branch works for me.

cpressey commented 6 years ago

PR is here, if you want to review it: #15

Do you know the version of MSVC that it is known to compile with? If so, we can note that too.

j4james commented 6 years ago

The version numbering issue is kind of complicated. I have two versions of the IDE - Visual Studio 2015 and Visual Studio 2017 - and I had previously tested successfully with both of them. VS 2015 comes with MSVC++ 14.0, which for me has an internal version number of 19.00.24215.1 (that's what I see when calling cl.exe from the command line). VS 2017 has had a range of MSVC++ versions (14.10 to 14.15, with internal versions 19.10 to 19.15), and I'm currently on version 14.15 (internal version 19.15.26726).

The thing is, I've only just upgraded to 14.15 today and I'm not sure what I had before. And while 14.15 still works, it's now producing warnings about spectre mitigation, which I wasn't getting before. If we want those warnings suppressed, so we get a nice clean build, we'd need to add -wd5045 to the WARNS list.

In short, I can confirm for certain that it compiles on MSVC++ 14.0 and 14.15 (internal versions 19.00.24215.1 and 19.15.26726), but quite likely also everything in between. However, the latest version is producing warnings, which I'd probably recommend suppressing.

cpressey commented 6 years ago

That's very entertaining reading. Well, I've called it 14.15 and suppressed that warning. Let's get this merged in and get something released.