From: nethack.allison Date: Sun, 15 Jan 2012 17:43:54 +0000 (+0000) Subject: More Microsoft Visual Studio 2010 Express compiler build X-Git-Tag: MOVE2GIT~84 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ead5101e0a7fa29c3acfb1f42a361a43e9656d51;p=nethack More Microsoft Visual Studio 2010 Express compiler build More updates to support the latest freely downloadable Microsoft compiler. --- diff --git a/sys/winnt/Install.nt b/sys/winnt/Install.nt index bff01cf05..cc7af7962 100644 --- a/sys/winnt/Install.nt +++ b/sys/winnt/Install.nt @@ -1,8 +1,9 @@ - Copyright (c) NetHack Development Team 1990-2010 + Copyright (c) NetHack Development Team 1990-2012 NetHack may be freely redistributed. See license for details. ============================================================== - Instructions for compiling and installing - NetHack 3.5 on a Windows 200x, XP, or Windows 7 system + Instructions for compiling and installing + NetHack 3.5 on a Windows system + (Windows XP and Windows 2003 or later only) ============================================================== Last revision: $Date$ @@ -21,7 +22,16 @@ You can build either the TTY version of NetHack or the Windows Graphical version. In either case you can use one of the following build environments: - o A copy of Microsoft Visual C++ Express 2010 + o A copy of Microsoft Visual Studio 2010 Express + The current NetHack code has not been tested with earlier versions + of the compiler. + + 64-bit Note: To build a 64-bit target with the Express edition, you + will also need to download and install the + Windows Software Development Kit version 7.1 + Visual Studio 2010 Express does not include a 64 bit + C compiler by default. + (http://msdn.microsoft.com/en-us/windowsserver/bb980924.aspx) OR @@ -97,14 +107,14 @@ I. Dispelling the Myths: We have provided a Makefile for each of the following compilers: - o Microsoft Visual C++ 2010 Express Edition + o Microsoft Visual Studio 2010 Express Visual C++ Compiler o Borland C 5.5.1 o MinGW 2.0 (with GCC 3.2) - The Microsoft Visual C Makefile was created for use with MS NMAKE - which is provided with the Microsoft compiler. The supplied Makefile - has not been tested with any other versions of the Microsoft 32-bit - compiler. + The Microsoft Visual Studio 2010 Express Makefile was created for use + with MS NMAKE which is provided with the Microsoft compiler. + The supplied Makefile may work with earlier versions of the Microsoft + compiler, but that has not been tested. The Borland C Makefile was created for use with Borland MAKE which is provided with the Borland compiler. @@ -126,10 +136,33 @@ Setting Up all the necessary environment variables for the compiler environment are set correctly. - For Visual Studio 2010 Express Edition, the installation will have - placed a command prompt option on the menus that is properly configured - for building. These instructions assume that you are using that to start - your command prompt window for building. + For Visual Studio 2010 Express, the installation should have placed + a command prompt option on the Start menus that is properly configured + for building: + From + Start | All Programs | Microsoft Visual Studio 2010 Express + Select + Visual Studio Command Prompt 2010 + + + 64-bit Note: The additional installation of Microsoft Windows SDK V7.1 + will have placed a command prompt option on the Start menus + that is properly configured for building as well, but + supports the Windows SDK tools. That is what should be + used if you wish to target an x64 build for example. + From + Start | All Programs | Microsoft Windows SDK v7.1 + Select + Windows SDK 7.1 Command Prompt + + Then, for an x86 (32-bit) target run the following at the + command prompt: + SETENV /x86 + + If you prefer to target an x64 (64-bit) build run the + following at the command prompt: + SETENV /x64 + For the GCC Makefile, add \bin to your path, where is your MinGW root directory.). @@ -221,16 +254,48 @@ Setting Up Compiling -5. Now that everything is set up, change your current directory to src. - - For Microsoft compiler: - nmake install +5. Now that everything is set up... + + For Visual Studio 2010 Express, as mentioned above, the installation should + have placed a command prompt option on the Start menus that is properly configured + for building: + From + Start | All Programs | Microsoft Visual Studio 2010 Express + Select + Visual Studio Command Prompt 2010 + Change your current directory to the NetHack src directory. + Issue this command: + nmake install + + 64-bit Note: As previously mentioned, you should start your + command prompt from the Windows SDK v7.1 menu + which is properly configured for building using + the Windows SDK tools. + From + Start | All Programs | Microsoft Windows SDK v7.1 + Select + Windows SDK 7.1 Command Prompt + Change your current directory to the NetHack src directory. + + Then, for an x86 (32-bit) target run the following at the + command prompt: + SETENV /x86 + nmake install + + If you prefer to target an x64 (64-bit) build run the + following at the command prompt: + SETENV /x64 + nmake install For Borland compiler: - make /f Makefile.bcc install + Change your current directory to the NetHack src directory. + Issue this command: + make /f Makefile.bcc install For GCC: - mingw32-make -f Makefile.gcc install + Change your current directory to the NetHack src directory. + Issue this command: + mingw32-make -f Makefile.gcc install If you get any errors along the way then something has not been set up correctly. The time it takes to compile depends on your @@ -266,22 +331,22 @@ Notes: have to delete dgn_flex.c, dgn_yacc.c, lev_flex.c, and lev_yacc.c from the util directory to ensure that they are remade. -2. The executable produced by the TTY build is a 32-bit, flat-address - space, non-overlayed .exe file, which should run on any true Win32 - environment with console I/O support. - - The executable built by the graphical built is a 32-bit, - flat-address space, non-overlayed .exe file, which should run on any - true Win32 graphical environment. +2. Depending on the build and compiler and tools used above, the + executable produced by the TTY build is either: + - a 32-bit (x86), flat-address space, non-overlayed .exe file, + which should run on any true Win32 environment. + or + - a 64-bit (x64) .exe file, + which should run on any 64-bit Windows O/S. To run NetHack, proceed to RUNNING NETHACK. -/--------------------------------\ -| BUILDING USING VISUAL C's IDE | -\--------------------------------/ +/-------------------------------------------------\ +| BUILDING USING VISUAL STUDIO 2010 EXPRESS IDE | +\-------------------------------------------------/ -Only the Win32 native port built on the Windows API, or Graphical -NetHack, can be built using the Visual C IDE. +Only the native port built on the Windows API, or Graphical +NetHack, can be built using the Visual Studo 2010 Express IDE. I. Dispelling the Myths: @@ -294,15 +359,18 @@ I. Dispelling the Myths: as described at the top of this document. If you didn't, you must go back and do so before proceeding. -II. To compile your copy of NetHack for Windows on a Windows NT/2000/XP - machine using the Visual C IDE: +II. To compile your copy of NetHack for Windows on a Windows machine + using the Visual Studio 2010 Express IDE: Setting Up 1. It almost goes without saying that you should make sure that your - tools are set up and running correctly. (For the Microsoft Visual C - IDE it should correctly fire up when you choose it in your Start | - Programs menus.) + tools are set up and running correctly. (For the Microsoft Visual + Studio 2010 ExpressIDE it should correctly fire up when you choose + it: + Start | All Programs | Microsoft Visual Studio 2010 Express + and select + Visual C++ 2010 Express 2. Make sure all the NetHack files are in the appropriate directory structure. You should have a main directory with subdirectories @@ -351,11 +419,15 @@ Setting Up 3. Ready your tool. Note: It's possible to build a graphical version using the Makefile, as explained above. However, the IDE build has full game - functionality and is the officially released build. + functionality. + + Start the Visual Studio 2010 Express IDE: + Start | All Programs | Microsoft Visual Studio 2010 Express + and select + Visual C++ 2010 Express - Start the Visual C++ 2010 Express Edition IDE. - In the Visual C++ 2010 Express Edition IDE menus, choose: - File | Open | Project/Solution + In the Visual C++ 2010 Express IDE menus, choose: + File | Open Project/Solution 4. Set up for the build. @@ -363,31 +435,39 @@ Setting Up In the Visual C dialog box, navigate to the top of your NetHack source directory. - In there, highlight "nethack.sln" for Visual C++ 2010 - Express Edition and click on Open. + In there, highlight "nethack.sln" for Visual C++ 2010 Express Edition + and click on Open. + Once the workspace or solution has been opened, you should see the following list in the Visual C selection left pane: - + makedefs + dgncomp + dgnstuff + dlb_main + levcomp + levstuff + + makedefs + nethackw + recover + tile2bmp + tilemap + uudecode - For Visual C++ 2010 Express Edition, highlight 'nethackw' and - select: - Project | Set as Startup Project + On the Visual C++ 2010 Express IDE menus, NetHackW should be the startup + project in bold, but if it isn't make it so by right-clicking and + choosing "set as Startup Project." + + In Visual C 2010 Express IDE menus right-click on + "Solution NetHack (12 Projects)" and select "Configuration Manager." - In Visual C++ 2010 Express Edition, you can just choose "Debug" or - "Release" right on the menu in the "solutions configuration" box. + Set the "Active Solution Configuration" to either + Debug + or + Release + and click the "Close" button. - The build of NetHackW which does not contain all the - debugging information is smaller, and runs slightly quicker. + + The Release build of NetHackW which does not contain all the + debugging information and is smaller, and runs slightly quicker. The Debug build of NetHackW will spend time writing debug information to the disk as the game is played. Unless you are debugging or enhancing NetHack for Windows, you probably will want to choose the @@ -397,16 +477,18 @@ Building 5. Start your build. - In the Visual C++ 2010 Express Edition menus once again, highlight - NetHackW, right-click and choose: - Build - This starts the build. It is likely that the IDE message window + On the Visual C++ Express IDE menus once again, choose: + Debug | Build Solution + or press to accomplish the same thing. + + That starts the build. It is likely that the IDE message window where you are doing the compiling will be occupied for a while. 6. If all has gone well to this point, you should now have a NetHack executable called NetHackW.exe in the "binary" directory, along with all the support files that it needs. + /-----------------\ | RUNNING NETHACK | diff --git a/sys/winnt/Makefile.msc b/sys/winnt/Makefile.msc index aec40ac59..2fe01f5e1 100644 --- a/sys/winnt/Makefile.msc +++ b/sys/winnt/Makefile.msc @@ -1,12 +1,11 @@ # NetHack 3.5 Makefile.msc $Date$ $Revision$ -# Copyright (c) NetHack PC Development Team 1993-2010 +# Copyright (c) NetHack PC Development Team 1993-2012 # -# NetHack 3.5.x Makefile for MS Visual C++ +# NetHack 3.5.x Makefile for MS Visual Studio Visual C++ compiler # # Win32 Compilers Tested: -# - Microsoft Visual C++ 2005 Express, with the Platform SDK -# - Microsoft 32 bit Visual C++ V4.x -# - Microsoft 32 bit Visual C++ V6.0 SP3, SP4 +# - Microsoft Visual Studio 2010 Express +# - Microsoft Visual Studio 2010 Express, with the Platform SDK # # This is used for building two versions of NetHack: # A tty port utilizing the Win32 Console I/O subsystem, Console @@ -25,10 +24,7 @@ # If you have any questions read the sys/winnt/Install.nt file included # with the distribution. #============================================================================== -# Do not delete the following 3 lines. -# -TARGETOS=BOTH -APPVER=4.0 +# Do not delete the following line. !include # Graphical interface @@ -214,11 +210,15 @@ cdebug = -Zi -Od !ENDIF !ENDIF +cflags2 = $(cflags:-W4=-W3) +#More verbose below +#cflags2 = $(cflags) -wd4131 + #========================================== # Util builds #========================================== -cflagsUtil = $(cdebug) $(cflags) $(INCLDIR) \ +cflagsUtil = $(cdebug) $(cflags2) $(INCLDIR) \ $(WINPFLAG) $(DLBFLG) lflagsUtil = $(ldebug) $(lflags) $(conlibs) @@ -232,14 +232,14 @@ LIBS= user32.lib winmm.lib $(ZLIB) !IF ("$(GRAPHICAL)"=="Y") -cflagsGame = $(cdebug) $(cflags) $(guiflags) $(INCLDIR) \ - $(WINPFLAG) $(DLBFLG) $(GAMEPDBFILE) $(GAMEMAPFILE) +cflagsGame = $(cdebug) $(cflags2) $(guiflags) $(INCLDIR) \ + $(WINPFLAG) $(DLBFLG) $(GAMEPDBFILE) $(GAMEMAPFILE) /W3 lflagsGame = $(ldebug) $(lflags) $(guilibs) !ELSE -cflagsGame = $(cdebug) $(cflags) $(conflags) $(INCLDIR) \ - $(WINPFLAG) $(DLBFLG) $(GAMEPDBFILE) $(GAMEMAPFILE) +cflagsGame = $(cdebug) $(cflags2) $(conflags) $(INCLDIR) \ + $(WINPFLAG) $(DLBFLG) $(GAMEPDBFILE) $(GAMEMAPFILE) /W3 lflagsGame = $(ldebug) $(lflags) $(conlibs) !ENDIF @@ -682,17 +682,17 @@ $(U)nhsizes.exe: $(O)nhsizes.o $(link) $(lflagsUtil) -out:$@ $(O)nhsizes.o $(O)panic.o $(O)alloc.o $(O)nhsizes.o: $(CONFIG_H) nhsizes.c - $(CC) $(cflagsUtil) -Fo$@ nhsizes.c + @$(CC) $(cflagsUtil) -Fo$@ nhsizes.c $(U)makedefs.exe: $(MAKEOBJS) - $(link) $(lflagsUtil) /PDB:"$(O)$(@B).PDB" /MAP:"$(O)$(@B).MAP" -out:$@ $(MAKEOBJS) + @$(link) $(lflagsUtil) /PDB:"$(O)$(@B).PDB" /MAP:"$(O)$(@B).MAP" -out:$@ $(MAKEOBJS) $(O)makedefs.o: $(CONFIG_H) $(INCL)\monattk.h $(INCL)\monflag.h $(INCL)\objclass.h \ $(INCL)\monsym.h $(INCL)\qtext.h $(INCL)\patchlevel.h \ $(U)makedefs.c @if not exist $(OBJ)\*.* echo creating directory $(OBJ) @if not exist $(OBJ)\*.* mkdir $(OBJ) - @$(CC) $(cflagsUtil) -Fo$@ $(U)makedefs.c + $(CC) $(cflagsUtil) -Fo$@ $(U)makedefs.c # # date.h should be remade every time any of the source or include @@ -1091,7 +1091,13 @@ $(O)til2bm32.o: $(WSHR)\tile2bmp.c $(HACK_H) $(TILE_H) $(INCL)\win32api.h spotless: clean ! IF ("$(OBJ)"!="") - -rmdir $(OBJ) /s /Q + if exist $(OBJ)\* rmdir $(OBJ) /s /Q + if exist $(GAMEDIR)\nhdefkey.dll del $(GAMEDIR)\nhdefkey.dll + if exist $(GAMEDIR)\nh340key.dll del $(GAMEDIR)\nh340key.dll + if exist $(GAMEDIR)\nhraykey.dll del $(GAMEDIR)\nhraykey.dll + if exist $(GAMEDIR)\NetHack.exe del $(GAMEDIR)\NetHack.exe + if exist $(GAMEDIR)\NetHack.pdb del $(GAMEDIR)\NetHack.pdb + if exist $(GAMEDIR)\nhdat del $(GAMEDIR)\nhdat ! ENDIF if exist $(INCL)\date.h del $(INCL)\date.h if exist $(INCL)\onames.h del $(INCL)\onames.h @@ -1156,6 +1162,36 @@ clean: if exist $(SRC)\*.lnk del $(SRC)\*.lnk if exist $(SRC)\*.map del $(SRC)\*.map if exist $(O)install.tag del $(O)install.tag + if exist $(O)console.res del $(O)console.res + if exist $(O)dgncomp.MAP del $(O)dgncomp.MAP + if exist $(O)dgncomp.PDB del $(O)dgncomp.PDB + if exist $(O)dlb_main.MAP del $(O)dlb_main.MAP + if exist $(O)dlb_main.PDB del $(O)dlb_main.PDB + if exist $(O)gamedir.tag del $(O)gamedir.tag + if exist $(O)levcomp.MAP del $(O)levcomp.MAP + if exist $(O)levcomp.PDB del $(O)levcomp.PDB + if exist $(O)makedefs.MAP del $(O)makedefs.MAP + if exist $(O)makedefs.PDB del $(O)makedefs.PDB + if exist $(O)nh340key.def del $(O)nh340key.def + if exist $(O)nh340key.exp del $(O)nh340key.exp + if exist $(O)nh340key.lib del $(O)nh340key.lib + if exist $(O)nh340key.map del $(O)nh340key.map + if exist $(O)nh340key.PDB del $(O)nh340key.PDB + if exist $(O)nhdefkey.def del $(O)nhdefkey.def + if exist $(O)nhdefkey.exp del $(O)nhdefkey.exp + if exist $(O)nhdefkey.lib del $(O)nhdefkey.lib + if exist $(O)nhdefkey.map del $(O)nhdefkey.map + if exist $(O)nhdefkey.PDB del $(O)nhdefkey.PDB + if exist $(O)nhraykey.def del $(O)nhraykey.def + if exist $(O)nhraykey.exp del $(O)nhraykey.exp + if exist $(O)nhraykey.lib del $(O)nhraykey.lib + if exist $(O)nhraykey.map del $(O)nhraykey.map + if exist $(O)nhraykey.PDB del $(O)nhraykey.PDB + if exist $(O)obj.tag del $(O)obj.tag + if exist $(O)sp_lev.tag del $(O)sp_lev.tag + if exist $(O)uudecode.MAP del $(O)uudecode.MAP + if exist $(O)uudecode.PDB del $(O)uudecode.PDB + ! IF ("$(WINPFLAG)"!="") if exist $(TILEBMP16) del $(TILEBMP16) if exist $(TILEBMP32) del $(TILEBMP32)