NHDT->ANH, nethack->anethack, nhdat->anhdat
[aNetHack.git] / sys / winnt / nhsetup.bat
blob0b637ab1f4b83816c10bd2902d0763b40f4013ca
1 @REM  aNetHack 0.0.1    nhsetup.bat     $ANH-Date: 1432512794 2015/05/25 00:13:14 $  $ANH-Branch: master $:$ANH-Revision: 1.33 $ */
2 @REM  Copyright (c) aNetHack PC Development Team 1993-2015
3 @REM  aNetHack may be freely redistributed.  See license for details. 
4 @REM  Win32 setup batch file, see Install.nt for details
5 @REM
6 @echo off
7 pushd %~dp0
8 set WIN32PATH=..\..\win\win32
9 set BUILDPATH=..\..\build
10 set BINPATH=..\..\binary
11 set VCDir=
13 :studiocheck
14 @REM Set fallbacks here for 32-bit VS2010
15 SET REGTREE=HKLM\Software\Microsoft\VCExpress\12.0\Setup\VC
16 SET MSVCVERSION=2010
18 @REM if we're in a 64-bit cmd prompt, gotta include Wow6432Node
19 echo Checking for 64-bit environment...
20 if "%ProgramFiles%" NEQ "%ProgramFiles(x86)%" SET REGTREE=HKLM\Software\Wow6432Node\Microsoft\VCExpress\12.0\Setup\VC
22 @REM i can see your house from here... or at least your VC++ folder
23 echo Checking version of VC++ installed...
24 echo Checking for VC2013 Express...
25 for /f "usebackq skip=2 tokens=1-2*" %%a IN (`reg query %REGTREE% /v ProductDir`) do @set VCDir="%%c"
26 if not defined VCDir goto :othereditions
27 if not exist %VCDir% goto :othereditions
29 set MSVCVERSION=2013
30 goto :fallback
32 :othereditions
33 @REM TODO: teach ourselves to detect full versions of Studio, which are under a different registry hive
34 echo VC2013 Express not found; dropping back.
36 :fallback
37 echo Using VS%MSVCVERSION%.
38 set SRCPATH=%WIN32PATH%\vs%MSVCVERSION%
40 :nxtcheck
41 echo Checking to see if directories are set up properly...
42 if not exist ..\..\include\hack.h goto :err_dir
43 if not exist ..\..\src\hack.c goto :err_dir
44 if not exist ..\..\dat\wizard.des goto :err_dir
45 if not exist ..\..\util\makedefs.c goto :err_dir
46 if not exist ..\..\sys\winnt\winnt.c goto :err_dir
47 echo Directories look ok.
49 :do_tty
50 if NOT exist %BINPATH%\*.* mkdir %BINPATH%
51 if NOT exist %BINPATH%\license copy ..\..\dat\license %BINPATH%\license >nul
52 echo Copying Microsoft Makefile - Makefile.msc to ..\..\src\Makefile...
53 if NOT exist ..\..\src\Makefile goto :domsc
54 copy ..\..\src\Makefile ..\..\src\Makefile-orig >nul
55 echo      Your existing
56 echo           ..\..\src\Makefile
57 echo      has been renamed to
58 echo           ..\..\src\Makefile-orig
59 :domsc
60 copy Makefile.msc ..\..\src\Makefile >nul
61 echo Microsoft Makefile copied ok.
63 echo Copying MinGW Makefile - Makefile.gcc to ..\..\src\Makefile.gcc...
64 if NOT exist ..\..\src\Makefile.gcc goto :dogcc
65 copy ..\..\src\Makefile.gcc ..\..\src\Makefile.gcc-orig >nul
66 echo      Your existing
67 echo           ..\..\src\Makefile.gcc
68 echo      has been renamed to
69 echo           ..\..\src\Makefile.gcc-orig
70 :dogcc
71 copy Makefile.gcc ..\..\src\Makefile.gcc >nul
72 echo MinGW Makefile copied ok.
74 :do_win
75 if not exist %SRCPATH%\anethack.sln goto :err_win
77 echo.
78 if exist %BUILDPATH%\*.* goto projectcopy
80 echo Creating %BUILDPATH% directory...
81 mkdir %BUILDPATH%
83 :projectcopy
85 @REM Visual Studio Express solution file
86 if NOT exist %SRCPATH%\anethack.sln goto skipsoln
87 echo Copying %SRCPATH%\anethack.sln to ..\..\anethack.sln...
88 copy %SRCPATH%\anethack.sln  ..\.. >nul
89 :skipsoln
91 if NOT exist %BINPATH%\*.* echo Creating %BINPATH% directory...
92 if NOT exist %BINPATH%\*.* mkdir %BINPATH%
93 if NOT exist %BINPATH%\license copy ..\..\dat\license %BINPATH%\license >nul
95 echo Copying Visual C project files to %BUILDPATH% directory...
97 copy %WIN32PATH%\dgnstuff.mak  %BUILDPATH% >nul
98 copy %WIN32PATH%\levstuff.mak  %BUILDPATH% >nul
99 copy %WIN32PATH%\tiles.mak     %BUILDPATH% >nul
101 @REM Visual C++ 201X Express project files
102 :vcexpress
103 if NOT exist %SRCPATH%\makedefs.vcxproj goto skipvcexpress
104 if NOT exist %SRCPATH%\tile2bmp.vcxproj goto skipvcexpress
105 if NOT exist %SRCPATH%\tilemap.vcxproj goto skipvcexpress
106 if NOT exist %SRCPATH%\uudecode.vcxproj goto skipvcexpress
107 if NOT exist %SRCPATH%\aNetHackW.vcxproj goto skipvcexpress
108 if NOT exist %SRCPATH%\aNetHack.vcxproj goto skipvcexpress
109 if NOT exist %SRCPATH%\dgncomp.vcxproj goto skipvcexpress
110 if NOT exist %SRCPATH%\dgnstuff.vcxproj goto skipvcexpress
111 if NOT exist %SRCPATH%\dlb_main.vcxproj goto skipvcexpress
112 if NOT exist %SRCPATH%\levcomp.vcxproj goto skipvcexpress
113 if NOT exist %SRCPATH%\levstuff.vcxproj goto skipvcexpress
114 if NOT exist %SRCPATH%\recover.vcxproj goto skipvcexpress
115 if NOT exist %SRCPATH%\tiles.vcxproj goto skipvcexpress
116 if NOT exist %SRCPATH%\nhdefkey.vcxproj goto skipvcexpress
118 copy %SRCPATH%\makedefs.vcxproj %BUILDPATH% >nul
119 copy %SRCPATH%\tile2bmp.vcxproj %BUILDPATH% >nul
120 copy %SRCPATH%\tilemap.vcxproj %BUILDPATH% >nul
121 copy %SRCPATH%\uudecode.vcxproj %BUILDPATH% >nul
122 copy %SRCPATH%\aNetHackW.vcxproj %BUILDPATH% >nul
123 copy %SRCPATH%\aNetHack.vcxproj %BUILDPATH% >nul
124 copy %SRCPATH%\dgncomp.vcxproj %BUILDPATH% >nul
125 copy %SRCPATH%\dgnstuff.vcxproj %BUILDPATH% >nul
126 copy %SRCPATH%\dlb_main.vcxproj %BUILDPATH% >nul
127 copy %SRCPATH%\levcomp.vcxproj %BUILDPATH% >nul
128 copy %SRCPATH%\levstuff.vcxproj %BUILDPATH% >nul
129 copy %SRCPATH%\recover.vcxproj %BUILDPATH% >nul
130 copy %SRCPATH%\tiles.vcxproj %BUILDPATH% >nul
131 copy %SRCPATH%\nhdefkey.vcxproj %BUILDPATH% >nul
132 echo LIBRARY nhdefkey >%BUILDPATH%\nhdefkey64.def
133 echo LIBRARY nhdefkey >%BUILDPATH%\nhdefkey.def
134 echo EXPORTS >>%BUILDPATH%\nhdefkey.def
135 echo ProcessKeystroke >>%BUILDPATH%\nhdefkey.def
136 echo NHkbhit >>%BUILDPATH%\nhdefkey.def
137 echo CheckInput >>%BUILDPATH%\nhdefkey.def 
138 echo SourceWhere >>%BUILDPATH%\nhdefkey.def
139 echo SourceAuthor >>%BUILDPATH%\nhdefkey.def
140 echo KeyHandlerName >>%BUILDPATH%\nhdefkey.def
142 echo Done copying files.
143 :skipvcexpress
145 goto :done
147 :err_win
148 echo Some of the files needed to build graphical aNetHack
149 echo for Windows are not in the expected places.
150 echo Check "Install.nt" for a list of the steps required 
151 echo to build aNetHack.
152 goto :fini
154 :err_data
155 echo A required file ..\..\dat\data.bas seems to be missing.
156 echo Check "Files." in the root directory for your aNetHack distribution
157 echo and make sure that all required files exist.
158 goto :fini
160 :err_dir
161 echo Your directories are not set up properly, please re-read the
162 echo documentation and sys/winnt/Install.nt.
163 goto :fini
165 :done
166 echo done!
167 echo.
168 echo Proceed with the next step documented in Install.nt 
169 echo.
171 :fini
172 :end
173 set _pause=N
174 for %%x in (%cmdcmdline%) do if /i "%%~x"=="/c" set _pause=Y
175 if "%_pause%"=="Y" pause
176 set _pause=
177 popd