Building and Running Purgatorio on Windows 11
Sat, 10 Jan 26 13:56:54 CETI wanted to try building purgatorio (inferno) on a Windows system, and with some effort I got it compile using Visual Studio. Even more than that, I was able to set up Visual Studio in a way that I can use IntelliSense and the debugger.
Here are a few notes:
- make sure that git doesn't change line endings to CRLF! This is important!
- to "fix" files later, change the file and use
git restoreto restore it after settinggit config core.autocrlf false
- to "fix" files later, change the file and use
- it's easiest to open folder in VS, then open the programmer command line. This sets up
%PATH%etc.- Tools → Command Line → Developer Command Prompt
- Do not try to run
makemk.shetc. Just use the NT binaries that are shipped with the repo (Nt/386/bin). - adjust
mkconfig - set
%PATH%to includeNt/386/bin:set PATH=%PATH%;... - mkfiles: cl/link/lib args replace
-with/— mostly optional- the tools sometimes print warnings that the dash options will be deprecated. I think for the future we should change the mkfiles for Nt.
/is the windows way for options.
- the tools sometimes print warnings that the dash options will be deprecated. I think for the future we should change the mkfiles for Nt.
libinterp: first manuallymk *.h(individual headers)utils/mkfile: windows can't build mk properly:- multiple arguments are bundled to a single argument, which can't be understood by cl
- mk is already built and likely won't change, so you can just comment out mk in the mkfile (
NOTPLAN9) - I assume the issue is this line:
CFLAGS=$CFLAGS -I../include -DROOT'="'$ROOT'"', and$CFLAGSis included as a single option, not a list of options.
Setting up Visual Studio
Store these files in the root folder of the project:
launch.vs.json: Needed for launching. Pick emu in the selection.
{
"version": "0.2.1",
"configurations": [
{
"name": "emu",
"project": "emu\\Nt\\iemu.exe",
"args": [ "-r", "${workspaceRoot}", "/dis/wm/wm.dis" ]
}
]
}
CppProperties.json: Needed for IntelliSense.
{
"configurations": [
{
"inheritEnvironments": [
"msvc_x86"
],
"name": "x86-Debug",
"includePath": [
"${env.INCLUDE}",
"${workspaceRoot}\\**"
],
"defines": [
"WIN32",
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"intelliSenseMode": "windows-msvc-x86"
}
]
}
tasks.vs.json: If you want right-click → build for mkfiles.
{
"version": "0.2.1",
"tasks": [
{
"taskLabel": "runmk",
"appliesTo": "mkfile",
"contextType": "build",
"type": "launch",
"command": "mk",
"args": [ "install" ],
"envVars": {
"PATH": "${workspaceRoot}\\Nt\\386\\bin;${env.PATH}"
}
}
]
}