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
511call :getopts %*
612if %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
1116set abort = 0
17+ set buildstatus =
1218call :is_file_installed cmake || set abort = 1
1319call :is_file_installed gcc || set abort = 1
1420if %abort% == 1 exit /b
1521
1622set CURDIR = %CD%
1723
24+ :: *** define root directory where fds repo and libs directories are located
25+
1826set FIREMODELS = ..\..\..\..
1927cd %FIREMODELS%
2028set FIREMODELS = %CD%
2129cd %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%
3559cd %CURDIR%
3660
61+ echo .
3762echo ----------------------------------------------------------
3863echo ----------------------------------------------------------
39- echo setting up Intel compilers
64+ echo building Hypre library version %LIB_TAG%
4065echo ----------------------------------------------------------
4166echo ----------------------------------------------------------
4267echo .
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 .
5171echo ----------------------------------------------------------
5272echo ----------------------------------------------------------
53- echo cloning hypre from https://github.com/LLNL/hypre.git
73+ echo setting up Intel compilers
5474echo ----------------------------------------------------------
5575echo ----------------------------------------------------------
5676echo .
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 .
6182echo ----------------------------------------------------------
6283echo ----------------------------------------------------------
63- echo checking out tag %HYPRETAG %
84+ echo checking out tag %LIB_TAG %
6485echo ----------------------------------------------------------
6586echo ----------------------------------------------------------
6687echo .
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 .
6993echo ----------------------------------------------------------
7094echo ----------------------------------------------------------
7195echo modify HYPRE_config.h.cmake.in file
@@ -74,73 +98,52 @@ echo ----------------------------------------------------------
7498echo .
7599echo change HYPRE_FMANGLE line to #define HYPRE_FMANGLE 4
76100echo 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 .
83107echo ----------------------------------------------------------
84108echo ----------------------------------------------------------
85109echo cleaning hypre repo
86110echo ----------------------------------------------------------
87111echo ----------------------------------------------------------
88112echo .
89113
90- cd %HYPRE%
91- set HYPRE = %CD%
114+ cd %LIB_REPO%
92115git clean -dxf
93116
94- :: configure hypre
117+ echo .
95118echo ----------------------------------------------------------
96119echo ----------------------------------------------------------
97- echo configuring hypre version %HYPRETAG %
120+ echo configuring hypre version %LIB_TAG %
98121echo ----------------------------------------------------------
99122echo ----------------------------------------------------------
100123echo .
101124
102- set BUILDDIR = %HYPRE % \src\cmbuild
125+ set BUILDDIR = %LIB_REPO % \src\cmbuild
103126cd %BUILDDIR%
104127cmake ..\ ^
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 .
112136echo ----------------------------------------------------------
113137echo ----------------------------------------------------------
114- echo building and installing hypre version %HYPRETAG %
138+ echo building and installing hypre version %LIB_TAG %
115139echo ----------------------------------------------------------
116140echo ----------------------------------------------------------
117141echo .
118142call 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 ----------------------------------------------------------
128144echo .
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%
144147echo .
145148
146149cd %CURDIR%
@@ -210,4 +213,7 @@ echo.
210213echo -help - display this message
211214exit /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