]> granicus.if.org Git - nethack/commitdiff
Improvements to build.bat scripts used to build Windows builds. Remove CRT Secure...
authorBart House <bart@barthouse.com>
Mon, 4 Sep 2017 20:41:07 +0000 (13:41 -0700)
committerPasi Kallinen <paxed@alt.org>
Tue, 5 Sep 2017 10:14:13 +0000 (13:14 +0300)
sys/winnt/Install.nt
win/win32/vs2015/build.bat
win/win32/vs2017/build.bat
win/win32/vs2017/common.props

index 71bc67d1a03265455dfacd10c03dc740e5d05cb9..477213b72cff60498f804a620dffb5f8dd7a3f42 100644 (file)
@@ -21,14 +21,18 @@ tty and graphical win32 versions of NetHack 3.6.1.
 You can build a TTY version of NetHack and a Windows Graphical 
 version.  You can use one of the following build environments:
 
+  o A copy of Microsoft Visual Studio 2017 Express
+
+    OR
+
   o A copy of Microsoft Visual Studio 2015 Express
 
-       OR
+    OR
 
   o A copy of Microsoft Visual Studio 2013 Express
     The current NetHack code has not been tested with earlier versions 
     of the compiler.
-    
+
     OR
 
   o A copy of MinGW. MinGW is a collection of header 
@@ -46,31 +50,36 @@ that allow you to build the Windows Graphical version from Microsoft
 Visual C's IDE (Integrated Development Environment.)
 
 /--------------------------------------------------------\
-| Building And Running Using Visual Studio 2015          |
+| Building And Running Using Visual Studio 2015 or       |
+|                            Visual Studio 2017          |
 \--------------------------------------------------------/
 
-If you are NOT using Visual Studio 2015, proceed to "FIRST STEP -
-MOVING THINGS AROUND".
+If you are NOT using Visual Studio 2015 or Visual Studio 2017, proceed
+to "FIRST STEP - MOVING THINGS AROUND".
 
-When using Visual Studio 2015, you do not need to move things around.
-You simply need to load the Visual Studio 2015 NetHack solution file
+When using either Visual Studio 2015 or Visual Studio 2017, you do not
+need to move things around.  You simply need to load the solution file
 within the IDE, build the solution and run the version of NetHack
 you wish to run.
 
 The Visual Studio 2015 NetHack solution file can be found here:
     win\win32\vs2015\NetHack.sln
 
-From a command prompt, you can launch and load this solution file by:
-       start win\win32\vs2015\NetHack.sln
+The Visual Studio 2017 NetHack solution file can be found here:
+    win\win32\vs2017\NetHack.sln
 
-From within the IDE:
-       1. select the build configuration you wish to use.
-       2. from build menu, select build solution.
-       3. type F5 to start debugging.
+So the steps are:
+    1. Launch the IDE.
+    2. Open the appropriate solution file.
+    3. Select the build configuration you wish to use.
+    4. From build menu, select build solution.
+    5. Type F5 to start debugging.
 
-You can build all the projects for all platforms and configurations
-using a Visual Studio MSBuild command prompt.  Open the MSBuild command
-prompt, change directory to win\win32\vs2015 and run "build.bat".
+You can also build all the projects for all platforms and configurations
+using a "build.bat" batch file found in the same directory as the solution.
+
+Change to the appropriate directory (i.e. win\win32\vs2015 for VS2015 builds)
+and run "build.bat".
 
 /-----------------------------------\
 | FIRST STEP - MOVING THINGS AROUND |
@@ -80,11 +89,11 @@ The first step in building either version of NetHack is to execute
 sys\winnt\nhsetup.bat to move some files to their required locations.  
 
 From the command prompt:
-       cd sys\winnt
-       nhsetup
+        cd sys\winnt
+        nhsetup
 
 From a Windows explorer window:
-       double-click on nhsetup.bat
+        double-click on nhsetup.bat
 
 A "binary" directory will be created off the top of the NetHack source
 tree to house the completed build.
index c2798cf1ba4d9727115668a1600468b44d3fb1a1..78b7356ad570fb9785901a42999ac3a059a68c7f 100644 (file)
@@ -1,4 +1,44 @@
+@echo off
+
+if "%VisualStudioVersion%"=="" (
+       echo MSBuild environment not set ... attempting to setup build environment.
+       call :setup_environment
+)
+
+if "%VisualStudioVersion%"=="" (
+       echo Unable to setup build environment.  Exiting.
+       goto :EOF
+)
+
 msbuild NetHack.sln /t:Clean;Build /p:Configuration=Debug;Platform=Win32
 msbuild NetHack.sln /t:Clean;Build /p:Configuration=Debug;Platform=x64
 msbuild NetHack.sln /t:Clean;Build /p:Configuration=Release;Platform=Win32
 msbuild NetHack.sln /t:Clean;Build /p:Configuration=Release;Platform=x64
+
+goto :EOF
+
+:setup_environment
+
+
+if "%VS140COMNTOOLS%"=="" (
+       call :set_vs14comntools
+)
+
+if "%VS140COMNTOOLS%"=="" (
+       echo Can not find Visual Studio 2015 Common Tools path.
+       echo Set VS140COMNTOOLS appropriately.
+       goto :EOF
+)
+
+call "%VS140COMNTOOLS%VsMSBuildCmd.bat"
+cd %~dp0
+
+goto :EOF
+
+:set_vs14comntools
+
+if exist "%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\Common7\Tools" (
+       set "VS140COMNTOOLS=%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\Common7\Tools\"
+)
+
+goto :EOF
index c2798cf1ba4d9727115668a1600468b44d3fb1a1..2a10d62394ef5aa69e1581b1e985c9c6ef567e15 100644 (file)
@@ -1,4 +1,44 @@
+@echo off
+
+if "%VSCMD_VER%"=="" (
+       echo MSBuild environment not set ... attempting to setup build environment.
+       call :setup_environment
+)
+
+if "%VSCMD_VER%"=="" (
+       echo Unable to setup build environment.  Exiting.
+       goto :EOF
+)
+
 msbuild NetHack.sln /t:Clean;Build /p:Configuration=Debug;Platform=Win32
 msbuild NetHack.sln /t:Clean;Build /p:Configuration=Debug;Platform=x64
 msbuild NetHack.sln /t:Clean;Build /p:Configuration=Release;Platform=Win32
 msbuild NetHack.sln /t:Clean;Build /p:Configuration=Release;Platform=x64
+
+goto :EOF
+
+:setup_environment
+
+
+if "%VS150COMNTOOLS%"=="" (
+       call :set_vs15comntools
+)
+
+if "%VS150COMNTOOLS%"=="" (
+       echo Can not find Visual Studio 2017 Common Tools path.
+       echo Set VS150COMNTOOLS appropriately.
+       goto :EOF
+)
+
+call "%VS150COMNTOOLS%VsMSBuildCmd.bat"
+cd %~dp0
+
+goto :EOF
+
+:set_vs15comntools
+
+if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Professional\Common7\Tools" (
+       set "VS150COMNTOOLS=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Professional\Common7\Tools\"
+)
+
+goto :EOF
index 4b12025cb270f743ddec933c2ddf0a8e06a2fa6f..8f5d2a450c857f2801d256e790d2f734a3abe573 100644 (file)
@@ -9,7 +9,7 @@
   <ItemDefinitionGroup>
     <ClCompile>
       <WarningLevel>Level3</WarningLevel>
-      <PreprocessorDefinitions>WIN32;CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>WIN32;CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
     <Link>
       <SubSystem>Console</SubSystem>