2019-07-10 08:30:18 +08:00
|
|
|
@echo off
|
2019-07-08 10:26:24 +08:00
|
|
|
rem Copyright 1998-2019 Lawrence Livermore National Security, LLC and other
|
|
|
|
|
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
|
|
|
|
|
cd %srcdir%\test && rmdir /s /q cmbuild & mkdir cmbuild
|
|
|
|
|
|
|
|
|
|
rem run cmake for hypre library and test directory
|
|
|
|
|
cd %srcdir%\cmbuild
|
|
|
|
|
%CMAKE% -G "Visual Studio 15 2017" %cmakeopts% .. > %outdir%\lib-cmake.out
|
|
|
|
|
cd %srcdir%\test\cmbuild
|
|
|
|
|
%CMAKE% -G "Visual Studio 15 2017" %cmakeopts% .. > %outdir%\test-cmake.out
|
|
|
|
|
|
|
|
|
|
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
|
|
|
cd %srcdir%\test\cmbuild
|
2017-11-11 09:14:44 +08:00
|
|
|
%MSBUILD% ALL_BUILD.vcxproj /t:Rebuild /p:Configuration=Release > %outdir%\test-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
|
|
|
cd %srcdir%\test\cmbuild
|
2017-11-11 09:14:44 +08:00
|
|
|
%MSBUILD% ALL_BUILD.vcxproj /t:Rebuild /p:Configuration=Release > %outdir%\test-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
|