Files
nethack/sys/windows/build-nmake.txt
T
2026-06-21 14:18:00 -04:00

143 lines
5.4 KiB
Plaintext

Building NetHack using the Visual Studio nmake from the command line
Prerequisite Requirements:
o Visual Studio Community
A copy of Microsoft Visual Studio Community needs to
be installed on your machine. See:
https://visualstudio.microsoft.com/vs/community/
The build Makefiles and procedures produce two executables:
a. A TTY and curses version of NetHack in nethack.exe
b. A Windows and curses graphical version in nethackw.exe.
You can use one of the following build environments:
/---------------------------------------------\
| Directories for a Windows NetHack build |
\---------------------------------------------/
(NetHack-top)
|
+-----+------+-----+-------+-----------+-----------+-----~-----+------+
| | | | | | | | |
dat doc include lib src sys win submodules util
| | | |
+----------+ +------+ +----+ +----+
| | | | | | | |
| | | | | | | |
lua-5.4.8 pdcursesmod share windows tty win32 lua pdcursesmod
|
vs
|
+----------+-------+--------+--------+-----------+-------+-----+------+
| | | | | | | | |
makedefs NetHack NetHackW PDCurses PDCursesGui tile2bmp tilemap tiles uudecode
/-----------------------------------------------------------\
| Building From the Command Line Using nmake from one of the |
| Visual Studio Community versions |
\-----------------------------------------------------------/
Building
Two different versions of NetHack will be built for Windows from the
command line using the Makefile approach:
A tty port utilizing the Win32 Console I/O subsystem Console,
and a curses interface in an executable called NetHack.exe.
NetHack
A Win32 native port built on the Windows API Graphical NetHack,
and graphical curses in an executable called NetHackW.exe.
The Makefile configurations will build both; NetHack.exe and NetHackW.exe
and will be able to use the same datafiles, save files and bones files.
Since the last official release of NetHack, compilers and computer
architectures have evolved and you can now choose whether to build
a 32-bit x86 version, or a 64-bit x64 version. The default Makefile
is set up for a 32-bit x86 version, but that's only because it will
run on the most number of existing Windows environments. Change it if you
want. Be aware that NetHack's save files and bones files in the 5.0.0
release have not yet evolved enough to allow them to interchange between
the 32-bit version and the 64-bit version (or between different platforms).
That may change in future.
I. Dispelling the Myths:
Compiling NetHack for Windows is not as easy as it sounds, nor as hard
as it looks, however it will behoove you to read this entire section
through before beginning the task.
We have provided a Visual Studio nmake Makefile.make in
sys/windows/Makefile.nmake, which you use from the Windows command
line.
II. To compile your copy of NetHack on a Windows machine:
Setting Up
1. Change your current directory to the sys\windows subfolder of the nethack
source tree, if you are at the top of the NetHack source tree.
cd sys\windows.
2. Execute
.\nhsetup.bat
to place copies of the Makefiles in
the src subfolder. The file sys\windows\Makefile.nmake will copied
to a file src\Makefile.
.\nhsetup.bat
3. Execute
.\fetch.bat lua
to place a copy of Lua into the lib subfolder of the NetHack source
tree. NetHack 5.0 for Windows requires 3rd party Lua source that is not part
of the NetHack distribution or repository.
4. If you want to include support of the optional curses interface in your
build, execute
.\fetch.cmd pdcursesmod
to place a copy pdcursesmod into the lib subfolder of the NetHack
tree.
5. Change your current directory to the src subfolder of the nethack
source tree. The following command assumes you are still in the
sys\windows folder from steps #1 and #2 above:
cd ..\..\src
Compiling
6. Now that everything is set up, you should be ready to start the
process.
Your current directory should be the NetHack src directory.
Issue these following command:
nmake package
If all goes well, intermediate NetHack files will be placed in the
binary subfolder of the NetHack tree, and the final NetHack package
for windows will be in the package subfolder.
Notes:
N1. To rebuild NetHack after changing something, change your current directory
to src and issue the appropriate command for your compiler:
For Microsoft compiler:
nmake package
N2. Depending on the build and compiler and tools used above, the
package produced by the build will be either contain:
- a 32-bit (x86) .exe file,
which should run on any recent Win32 environment.
or
- a 64-bit (x64) .exe file,
which should run on any 64-bit Windows O/S.
**Note**: saved games and bones files are NOT compatible between the
32-bit and the 64-bit versions at this time.