xorvoid / forsp

Forsp: A Forth+Lisp Hybrid Lambda Calculus Language
MIT License
133 stars 16 forks source link

Runs on Windows, visual studio 2022 #3

Closed jpmikkers closed 3 months ago

jpmikkers commented 3 months ago

Not really an issue: I'm happy to report this compiles and runs out of the box on Windows 11, built using visual studio 2022.

Some minor changes needed to compile without warnings, see https://github.com/jpmikkers/forsp/commit/9d3828c2a2ab3de46d5b5499b344b2d36551d82b

I'd be happy to do a PR, but I would understand it if you don't want to maintain a visual studio project.

truedat101 commented 3 months ago

a happy unhappy medium might be a cmake file. I can try that, and it should produce a VS build with a minimum of wizard spells. Then you could choose to have your VS build, while officially not necessarily needing to have it be supported. Agree on warnings cleanup. I'll look at your changes.

xorvoid commented 3 months ago

Happy to merge whatever is the simplest solution. You're correct that I won't want to maintain windows builds. But I also expect that Forsp will not be changing a whole lot at this point.

xorvoid commented 3 months ago

Does anyone just build with a simple shell script on windows? That would be my preference.

jpmikkers commented 3 months ago

I'll give a simple command line build a try, then it's probably just a paragraph in the readme.

xorvoid commented 3 months ago

Okay, let me know what you come up with. I'm happy to merge something as long as it's minimalist. At least put up the warning fixes, please.

truedat101 commented 3 months ago

Does anyone just build with a simple shell script on windows? That would be my preference.

I do. But it does require a bit of posix centric thinking by the developer (i.e. uses a bash compatible shell) assuming you want to keep one shell script and not a batch file just for windows.

Alternative is to actually give a one liner in the readme as suggested by @jpmikkers which is an msbuild sort of command thing.

truedat101 commented 3 months ago

For a bash compatible bash shell the lowest common denominator on windows that is reliably found on many systems is git-bash, which should be installed by default if someone has installed git with the defaults.

xorvoid commented 3 months ago

Doesn't have to be bash. We can have a "build-windows.cmd" or whatever.

AlexBlandin commented 3 months ago

I've found no issues when building for Windows or other platforms with zig cc, with the flags as in build.sh translating to an error-free zig cc -std=c99 -Wall -Werror -O2 -g -o forsp forsp.c call. While not a solution for those specifically wanting a VS build, it has other merits, so may be worth including as an option alongside (Clang and Mingw-w64 are also available, but I've generally found zig cc to supersede them).

A Windows targetting build-zig.cmd that is just the most straightforward port of build.sh:

@echo off
setlocal

set CFLAGS=-std=c99 -Wall -Werror -O2 -g
set LDFLAGS=

zig cc %CFLAGS% -o forsp.exe forsp.c -target x86_64-windows-gnu %LDFLAGS%
endlocal