Skip to content

Commit a8fce54

Browse files
authored
Merge pull request #13674 from gforney/master
updates to windows hypre and sundials build scripts to make them more consistent with linux/mac versions
2 parents 08a9b1b + 6f5962d commit a8fce54

File tree

2 files changed

+135
-124
lines changed

2 files changed

+135
-124
lines changed
Lines changed: 70 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,95 @@
11
@echo off
2-
set HYPREVERSION=2.31.0
3-
set HYPRETAG=v2.31.0
2+
set LIB_TAG=v2.32.0
3+
4+
::*** library and tag name are the same
5+
6+
set LIB_DIR=%LIB_TAG%
7+
8+
9+
::*** placehoder for parsing options
410

511
call :getopts %*
612
if %stopscript% == 1 exit /b
713

8-
set have_setx=1
9-
call :have_program setx || set have_setx=0
14+
::*** make sure cmake and gcc are installed
1015

1116
set abort=0
17+
set buildstatus=
1218
call :is_file_installed cmake || set abort=1
1319
call :is_file_installed gcc || set abort=1
1420
if %abort% == 1 exit /b
1521

1622
set CURDIR=%CD%
1723

24+
::*** define root directory where fds repo and libs directories are located
25+
1826
set FIREMODELS=..\..\..\..
1927
cd %FIREMODELS%
2028
set FIREMODELS=%CD%
2129
cd %CURDIR%
2230

23-
set LIBS=%FIREMODELS%\libs
24-
if not exist %LIBS% mkdir %LIBS%
25-
if not exist %LIBS% echo failed to create %LIBS% directory
26-
if not exist %LIBS% exit
31+
::*** if hypre library directory exists exit and use it
32+
33+
set INSTALLDIR=%FIREMODELS%\libs\hypre\%LIB_DIR%
34+
if not exist %INSTALLDIR% goto endif1
35+
set HYPRE_HOME=%INSTALLDIR%
36+
set buildstatus=prebuilt
37+
goto eof
38+
:endif1
39+
40+
::*** if directory pointed to by HYPRE_HOME exists exit and use it
41+
42+
if "x%HYPRE_HOME%" == "x" goto endif2
43+
if not exist %HYPRE_HOME% goto endif2
44+
set buildstatus=prebuilt
45+
goto eof
46+
:endif2
47+
48+
::*** if hypre repo does not exist exit and build fds without it
49+
50+
set LIB_REPO=%FIREMODELS%\hypre
51+
if exist %LIB_REPO% goto endif3
52+
set HYPRE_HOME=
53+
set buildstatus=norepo
54+
goto eof
55+
:endif3
2756

28-
cd %LIBS%
29-
set LIBS=%CD%
30-
if not exist %LIBS%\hypre mkdir %LIBS%\hypre
31-
if not exist %LIBS%\hypre echo failed to create %LIBS%\hypre directory
32-
if not exist %LIBS%\hypre exit
57+
::*** if we've gotten this far the prebuilt libraries do not exist, the repo does exist so build the hypre library
3358

34-
set INSTALLDIR=%LIBS%\hypre\%HYPREVERSION%
3559
cd %CURDIR%
3660

61+
echo.
3762
echo ----------------------------------------------------------
3863
echo ----------------------------------------------------------
39-
echo setting up Intel compilers
64+
echo building Hypre library version %LIB_TAG%
4065
echo ----------------------------------------------------------
4166
echo ----------------------------------------------------------
4267
echo.
43-
call %FIREMODELS%\fds\Build\Scripts\setup_intel_compilers.bat
44-
45-
cd %CURDIR%
46-
47-
set HYPRE=%FIREMODELS%\hypre
4868

49-
:: clone hypre repo (at same level as fds, smv etc repos) if it doesn't exist
50-
if exist %HYPRE% goto endif1
69+
set buildstatus=build
70+
echo.
5171
echo ----------------------------------------------------------
5272
echo ----------------------------------------------------------
53-
echo cloning hypre from https://github.com/LLNL/hypre.git
73+
echo setting up Intel compilers
5474
echo ----------------------------------------------------------
5575
echo ----------------------------------------------------------
5676
echo.
77+
call %FIREMODELS%\fds\Build\Scripts\setup_intel_compilers.bat
78+
79+
cd %CURDIR%
5780

58-
cd %FIREMODELS%
59-
git clone https://github.com/hypre-space/hypre.git
60-
cd hypre
81+
echo.
6182
echo ----------------------------------------------------------
6283
echo ----------------------------------------------------------
63-
echo checking out tag %HYPRETAG%
84+
echo checking out tag %LIB_TAG%
6485
echo ----------------------------------------------------------
6586
echo ----------------------------------------------------------
6687
echo.
67-
git checkout %HYPRETAG%
88+
cd %LIB_REPO%
89+
git checkout %LIB_REPO%\src\config\HYPRE_config.h.cmake.in
90+
git checkout %LIB_TAG%
6891

92+
echo.
6993
echo ----------------------------------------------------------
7094
echo ----------------------------------------------------------
7195
echo modify HYPRE_config.h.cmake.in file
@@ -74,73 +98,52 @@ echo ----------------------------------------------------------
7498
echo.
7599
echo change HYPRE_FMANGLE line to #define HYPRE_FMANGLE 4
76100
echo after saving file, press enter
77-
notepad %HYPRE%\src\config\HYPRE_config.h.cmake.in
101+
notepad %LIB_REPO%\src\config\HYPRE_config.h.cmake.in
78102

79-
pause
80-
cd %CURDIR%
81-
:endif1
103+
pause
104+
cd %CURDIR%
82105

106+
echo.
83107
echo ----------------------------------------------------------
84108
echo ----------------------------------------------------------
85109
echo cleaning hypre repo
86110
echo ----------------------------------------------------------
87111
echo ----------------------------------------------------------
88112
echo.
89113

90-
cd %HYPRE%
91-
set HYPRE=%CD%
114+
cd %LIB_REPO%
92115
git clean -dxf
93116

94-
:: configure hypre
117+
echo.
95118
echo ----------------------------------------------------------
96119
echo ----------------------------------------------------------
97-
echo configuring hypre version %HYPRETAG%
120+
echo configuring hypre version %LIB_TAG%
98121
echo ----------------------------------------------------------
99122
echo ----------------------------------------------------------
100123
echo.
101124

102-
set BUILDDIR=%HYPRE%\src\cmbuild
125+
set BUILDDIR=%LIB_REPO%\src\cmbuild
103126
cd %BUILDDIR%
104127
cmake ..\ ^
105128
-G "MinGW Makefiles" ^
106129
-DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" ^
107130
-DCMAKE_C_COMPILER=icx ^
108131
-DCMAKE_C_FLAGS="/DWIN32 -O3 /fp:precise" ^
109-
-DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded"
132+
-DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded" ^
133+
-DCMAKE_INSTALL_LIBDIR="lib"
110134

111-
:: build and install hypre
135+
echo.
112136
echo ----------------------------------------------------------
113137
echo ----------------------------------------------------------
114-
echo building and installing hypre version %HYPRETAG%
138+
echo building and installing hypre version %LIB_TAG%
115139
echo ----------------------------------------------------------
116140
echo ----------------------------------------------------------
117141
echo.
118142
call make install
119143

120-
if %have_setx% == 0 goto else_setx
121-
echo ----------------------------------------------------------
122-
echo ----------------------------------------------------------
123-
echo setting HYPRE_HOME environment variable to %INSTALLDIR%
124-
setx HYPRE_HOME %INSTALLDIR%
125-
echo note: the environment variable HYPRE_HOME takes effect after opening a new command shell
126-
echo ----------------------------------------------------------
127-
echo ----------------------------------------------------------
128144
echo.
129-
goto endif_setx
130-
:else_setx
131-
echo ----------------------------------------------------------
132-
echo ----------------------------------------------------------
133-
echo set environment variable HYPRE_HOME to %INSTALLDIR%
134-
echo ----------------------------------------------------------
135-
echo ----------------------------------------------------------
136-
echo.
137-
:endif_setx
138-
139-
echo ----------------------------------------------------------
140-
echo ----------------------------------------------------------
141-
echo hypre version %HYPRETAG% installed in %INSTALLDIR%
142-
echo ----------------------------------------------------------
143-
echo ----------------------------------------------------------
145+
set HYPRE_HOME=%INSTALLDIR%
146+
echo Hypre library version %LIB_TAG% built in %INSTALLDIR%
144147
echo.
145148

146149
cd %CURDIR%
@@ -210,4 +213,7 @@ echo.
210213
echo -help - display this message
211214
exit /b
212215

213-
:eof
216+
:eof
217+
echo.
218+
if "%buildstatus%" == "norepo" echo HYPRE library not built, The hypre git repo does not exist
219+
if "%buildstatus%" == "prebuilt" echo HYPRE library not built. It exists in %HYPRE_HOME%

0 commit comments

Comments
 (0)