| 
									
										
										
										
											2019-07-10 08:30:18 +08:00
										 |  |  | @echo off | 
					
						
							| 
									
										
										
										
											2022-04-06 07:19:51 +08:00
										 |  |  | rem Copyright (c) 1998 Lawrence Livermore National Security, LLC and other | 
					
						
							| 
									
										
										
										
											2019-07-08 10:26:24 +08:00
										 |  |  | rem HYPRE Project Developers. See the top-level COPYRIGHT file for details. | 
					
						
							|  |  |  | rem | 
					
						
							|  |  |  | rem SPDX-License-Identifier: (Apache-2.0 OR MIT) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-11 08:21:45 +08:00
										 |  |  | setlocal | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | rem This script can be run from anywhere | 
					
						
							|  |  |  | rem Example usage: cmake.bat ..\src "-DHYPRE_SEQUENTIAL=ON" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | rem directory where script is being run | 
					
						
							|  |  |  | set rundir=%cd% | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | rem directory where script is located | 
					
						
							|  |  |  | cd %~dp0 | 
					
						
							|  |  |  | set scriptdir=%cd% | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | rem source directory passed in as argument 1 | 
					
						
							|  |  |  | cd %rundir% | 
					
						
							|  |  |  | cd %1 | 
					
						
							|  |  |  | set srcdir=%cd% | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | rem output directory is a subdirectory of rundir | 
					
						
							|  |  |  | set outdir=%rundir%\cmake.dir | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | rem cmake options passed in as argument 2 | 
					
						
							|  |  |  | set cmakeopts=%2 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | rem set location of cmake and msbuild programs | 
					
						
							|  |  |  | set CMAKE="C:\Program Files\CMake\bin\cmake.exe" | 
					
						
							|  |  |  | set MSBUILD="C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | rem create clean output directory | 
					
						
							|  |  |  | if exist %outdir% rmdir /s /q %outdir% | 
					
						
							|  |  |  | mkdir %outdir% | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | rem clean out 'cmbuild' directories | 
					
						
							|  |  |  | cd %srcdir%      && rmdir /s /q cmbuild & mkdir cmbuild | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | rem run cmake for hypre library and test directory | 
					
						
							|  |  |  | cd %srcdir%\cmbuild | 
					
						
							| 
									
										
										
										
											2019-08-21 02:20:30 +08:00
										 |  |  | %CMAKE% -G "Visual Studio 15 2017" %cmakeopts% "-DHYPRE_BUILD_TESTS=ON" ..               >  %outdir%\lib-cmake.out | 
					
						
							| 
									
										
										
										
											2017-11-11 08:21:45 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | rem build release version | 
					
						
							|  |  |  | cd %srcdir%\cmbuild | 
					
						
							| 
									
										
										
										
											2017-11-11 09:14:44 +08:00
										 |  |  | %MSBUILD% HYPRE.vcxproj /t:Rebuild /p:Configuration=Release     >  %outdir%\lib-release.out | 
					
						
							|  |  |  | %MSBUILD% INSTALL.vcxproj /p:Configuration=Release              >> %outdir%\lib-release.out | 
					
						
							| 
									
										
										
										
											2017-11-11 08:21:45 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | rem build debug version | 
					
						
							|  |  |  | cd %srcdir%\cmbuild | 
					
						
							| 
									
										
										
										
											2017-11-11 09:14:44 +08:00
										 |  |  | %MSBUILD% HYPRE.vcxproj /t:Rebuild /p:Configuration=Debug       >  %outdir%\lib-debug.out | 
					
						
							|  |  |  | %MSBUILD% INSTALL.vcxproj /p:Configuration=Debug                >> %outdir%\lib-debug.out | 
					
						
							| 
									
										
										
										
											2017-11-11 08:21:45 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | rem create error file - inspect output file lines with "Error(s)" substring | 
					
						
							|  |  |  | cd %rundir% | 
					
						
							|  |  |  | type NUL > cmake.err | 
					
						
							|  |  |  | for %%f in (%outdir%\*.out) do ( | 
					
						
							|  |  |  |     set sum=0 | 
					
						
							|  |  |  |     for /f "tokens=1" %%i in ('findstr "Error(s)" %%f') do set /a sum+=%%i | 
					
						
							| 
									
										
										
										
											2019-06-21 22:27:57 +08:00
										 |  |  |     if %sum% gtr 0 @echo %%f >> cmake.err | 
					
						
							| 
									
										
										
										
											2017-11-11 08:21:45 +08:00
										 |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | cd %rundir% | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | endlocal |