File: cmake.bat

package info (click to toggle)
hypre 3.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 58,112 kB
  • sloc: ansic: 408,221; cpp: 62,971; sh: 12,091; fortran: 9,433; makefile: 3,327; perl: 2,994; awk: 147; python: 126
file content (66 lines) | stat: -rwxr-xr-x 1,995 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
@echo off
rem Copyright (c) 1998 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)

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
%CMAKE% -G "Visual Studio 15 2017" %cmakeopts% "-DHYPRE_BUILD_TESTS=ON" ..               >  %outdir%\lib-cmake.out

rem build release version
cd %srcdir%\cmbuild
%MSBUILD% HYPRE.vcxproj /t:Rebuild /p:Configuration=Release     >  %outdir%\lib-release.out
%MSBUILD% INSTALL.vcxproj /p:Configuration=Release              >> %outdir%\lib-release.out

rem build debug version
cd %srcdir%\cmbuild
%MSBUILD% HYPRE.vcxproj /t:Rebuild /p:Configuration=Debug       >  %outdir%\lib-debug.out
%MSBUILD% INSTALL.vcxproj /p:Configuration=Debug                >> %outdir%\lib-debug.out

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
    if %sum% gtr 0 @echo %%f >> cmake.err
)

cd %rundir%

endlocal