Skip to content

Commit

Permalink
Merge pull request #13682 from gforney/master
Browse files Browse the repository at this point in the history
modify the windows sundials and hypre build scripts so they are consistent with the linux/osx build scripts
  • Loading branch information
gforney authored Nov 4, 2024
2 parents c4663a4 + 46b3634 commit f92666e
Show file tree
Hide file tree
Showing 11 changed files with 185 additions and 48 deletions.
70 changes: 46 additions & 24 deletions Build/Scripts/HYPRE/build_hypre.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ set LIB_TAG=v2.32.0
set LIB_DIR=%LIB_TAG%


::*** placehoder for parsing options
::*** parse options

set clean_hypre=

call :getopts %*
if %stopscript% == 1 exit /b
Expand All @@ -28,34 +30,43 @@ cd %FIREMODELS%
set FIREMODELS=%CD%
cd %CURDIR%

set INSTALLDIR=%FIREMODELS%\libs\hypre\%LIB_DIR%

::*** erase install directory if clean option was specified

if "x%clean_hypre%" == "x" goto endif1
if exist %INSTALLDIR% rmdir /s /q %INSTALLDIR%
:endif1

::*** if hypre library directory exists exit and use it

set INSTALLDIR=%FIREMODELS%\libs\hypre\%LIB_DIR%
if not exist %INSTALLDIR% goto endif1
if not exist %INSTALLDIR% goto endif2
set HYPRE_HOME=%INSTALLDIR%
set buildstatus=prebuilt
goto eof
:endif1

::*** if directory pointed to by HYPRE_HOME exists exit and use it

if "x%HYPRE_HOME%" == "x" goto endif2
if not exist %HYPRE_HOME% goto endif2
set buildstatus=prebuilt
goto eof
:endif2

::*** if hypre repo does not exist exit and build fds without it
::*** if hypre repo exists build library

set LIB_REPO=%FIREMODELS%\hypre
if exist %LIB_REPO% goto endif3
if exist %LIB_REPO% goto buildlib

::*** if directory pointed to by HYPRE_HOME exists exit and use it
:: if it doesn't exist then exit and build fds without the hypre library

if "x%HYPRE_HOME%" == "x" goto else4
if not exist %HYPRE_HOME% goto else4
set buildstatus=prebuilt
goto endif4
:else4
set HYPRE_HOME=
set buildstatus=norepo
goto eof
:endif3
:endif4
goto eof

::*** if we've gotten this far the prebuilt libraries do not exist, the repo does exist so build the hypre library

:buildlib
cd %CURDIR%

echo.
Expand Down Expand Up @@ -92,15 +103,13 @@ git checkout %LIB_TAG%
echo.
echo ----------------------------------------------------------
echo ----------------------------------------------------------
echo modify HYPRE_config.h.cmake.in file
echo changing HYPRE_FMANGLE 0 to HYPRE_FMANGLE 4
echo in the file HYPRE_config.h.cmake.in
echo ----------------------------------------------------------
echo ----------------------------------------------------------
echo.
echo change HYPRE_FMANGLE line to #define HYPRE_FMANGLE 4
echo after saving file, press enter
notepad %LIB_REPO%\src\config\HYPRE_config.h.cmake.in
powershell -Command "(Get-Content %LIB_REPO%\src\config\HYPRE_config.h.cmake.in) -replace 'HYPRE_FMANGLE 0', 'HYPRE_FMANGLE 4' | Set-Content %LIB_REPO%\src\config\HYPRE_config.h.cmake.in"

pause
cd %CURDIR%

echo.
Expand Down Expand Up @@ -143,7 +152,7 @@ call make install

echo.
set HYPRE_HOME=%INSTALLDIR%
echo Hypre library version %LIB_TAG% built in %INSTALLDIR%
echo The Hypre library version %LIB_TAG% was built and installed in %INSTALLDIR%
echo.

cd %CURDIR%
Expand All @@ -157,6 +166,15 @@ goto eof
if (%1)==() exit /b
set valid=0
set arg=%1
if /I "%1" EQU "--clean-hypre" (
set clean_hypre=1
set valid=1
)
if /I "%1" EQU "--help" (
call :usage
set stopscript=1
exit /b
)
if /I "%1" EQU "-help" (
call :usage
set stopscript=1
Expand Down Expand Up @@ -210,10 +228,14 @@ exit /b
:: -------------------------------------------------------------
echo build hypre
echo.
echo -help - display this message
echo --clean-hypre - force build of hypre library
echo --help - display this message
exit /b

:eof
echo.
if "%buildstatus%" == "norepo" echo HYPRE library not built, The hypre git repo does not exist
if "%buildstatus%" == "prebuilt" echo HYPRE library not built. It exists in %HYPRE_HOME%
echo.
if "%buildstatus%" == "norepo" echo The Hypre git repo does not exist, The Hypre library was not built. FDS will be built without it.
if "%buildstatus%" == "prebuilt" echo The Hypre library was not built. FDS will be built using the
if "%buildstatus%" == "prebuilt" echo Hypre library in %HYPRE_HOME%
echo.
66 changes: 42 additions & 24 deletions Build/Scripts/SUNDIALS/build_sundials.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ set LIB_TAG=v6.7.0

set LIB_DIR=%LIB_TAG%

::*** placehoder for parsing options
::*** parse options

set clean_sundials=
call :getopts %*
if %stopscript% == 1 exit /b

Expand All @@ -27,34 +28,41 @@ cd %FIREMODELS%
set FIREMODELS=%CD%
cd %CURDIR%

set INSTALLDIR=%FIREMODELS%\libs\sundials\%LIB_DIR%

::*** erase directory if it exists and clean option was specified

if "x%clean_sundials%" == "x" goto endif1
if exist %INSTALLDIR% rmdir /s /q %INSTALLDIR%
:endif1

::*** if sundials library directory exists exit and use it

set INSTALLDIR=%FIREMODELS%\libs\sundials\%LIB_DIR%
if not exist %INSTALLDIR% goto endif1
if not exist %INSTALLDIR% goto endif2
set SUNDIALS_HOME=%INSTALLDIR%
set buildstatus=prebuilt
goto eof
:endif1

::*** if directory pointed to by SUNDIALS_HOME exists exit and use it

if "x%SUNDIALS_HOME%" == "x" goto endif2
if not exist %SUNDIALS_HOME% goto endif2
set buildstatus=prebuilt
goto eof
:endif2

::*** if sundials repo does not exist exit and build fds without it
::*** sundials library doesn't exist, if sundials repo exists build sundials library

set LIB_REPO=%FIREMODELS%\sundials
if exist %LIB_REPO% goto endif3
set SUNDIALS_HOME=
set buildstatus=norepo
goto eof
:endif3
if exist %LIB_REPO% goto buildlib

::*** if directory pointed to by SUNDIALS_HOME exists exit and use it

if "x%SUNDIALS_HOME%" == "x" goto else4
if not exist %SUNDIALS_HOME% goto else4
set buildstatus=prebuilt
goto endif4
:else4
set build_status=norepo
:endif4
goto eof

::*** if we've gotten this far the prebuilt libraries do not exist, the repo does exist so build the sundials library

:buildlib
cd %LIB_REPO%

set buildstatus=build
Expand Down Expand Up @@ -145,9 +153,7 @@ echo setting SUNDIALS_HOME environment variable to %INSTALLDIR%
set SUNDIALS_HOME=%INSTALLDIR%
echo.

echo sundials version %LIB_TAG% installed in %INSTALLDIR%
echo ----------------------------------------------------------
echo ----------------------------------------------------------
echo The Sundials library version %LIB_TAG% was built and installed in %INSTALLDIR%
echo.

cd %CURDIR%
Expand All @@ -161,7 +167,16 @@ goto eof
if (%1)==() exit /b
set valid=0
set arg=%1
if /I "%1" EQU "-help" (
if /I "%1" EQU "--clean-sundials" (
set clean_sundials=1
set valid=1
)
if /I "%1" EQU "--help" (
call :usage
set stopscript=1
exit /b
)
if /I "%1" EQU "-help" (
call :usage
set stopscript=1
exit /b
Expand Down Expand Up @@ -214,10 +229,13 @@ exit /b
:: -------------------------------------------------------------
echo build sundials
echo.
echo -help - display this message
echo --clean-sundials - force build of sundials library
echo --help - display this message
exit /b

:eof
echo.
if "%buildstatus%" == "norepo" echo Sundials library not built, The sundials git repo does not exist
if "%buildstatus%" == "prebuilt" echo Sundials library not built. It exists in %SUNDIALS_HOME%
if "%buildstatus%" == "norepo" echo The Sundials git repo does not exist, The Sundials library was not built. FDS will be built without it.
if "%buildstatus%" == "prebuilt" echo The Sundials library was not built. FDS will be built using the
if "%buildstatus%" == "prebuilt" echo Sundials library in %SUNDIALS_HOME%
echo.
78 changes: 78 additions & 0 deletions Build/Scripts/build_thirdparty_libs.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
@echo off

set clean_hypre=
set clean_sundials=
set FDS_BUILDDIR=%CD%

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


goto eof

:: -------------------------------------------------------------
:getopts
:: -------------------------------------------------------------
set stopscript=0
if (%1)==() exit /b
set valid=0
set arg=%1
if /I "%1" EQU "--clean-hypre" (
set clean_hypre=--clean-hypre
set valid=1
)
if /I "%1" EQU "bot" (
set valid=1
)
if /I "%1" EQU "--clean-sundials" (
set clean_sundials=--clean-sundials
set valid=1
)
if /I "%1" EQU "--clean-all" (
set clean_hypre=--clean-hypre
set clean_sundials=--clean-sundials
set valid=1
)
if /I "%1" EQU "-help" (
call :usage
set stopscript=1
exit /b
)
shift
if %valid% == 0 (
echo.
echo ***Error: the input argument %arg% is invalid
echo.
echo Usage:
call :usage
set stopscript=1
exit /b
)
if not (%1)==() goto getopts
exit /b

:: -------------------------------------------------------------
:usage
:: -------------------------------------------------------------
echo build 3rd party libraries
echo.
echo --clean-all - rebuild all libraries
echo --clean-hypre - rebuild hypre library
echo --clean-sundials - rebuild sundials library
echo -help - display this message
exit /b

:eof

set CURDIR_3RDPARTY=%CD%
set SCRIPTDIR=%~dp0
cd %SCRIPTDIR%
SET SCRIPTDIR=%CD%

cd %SCRIPTDIR%\HYPRE
call build_hypre %clean_hypre%

cd %SCRIPTDIR%\SUNDIALS
call build_sundials %clean_sundials%

cd %CURDIR_3RDPARTY%
5 changes: 5 additions & 0 deletions Build/Scripts/build_thirdparty_libs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ ARG=""
# Loop through the options
while [[ $# -gt 0 ]]; do
case "$1" in
--clean-all)
clean_hypre=true
clean_sundials=true
shift
;;
--clean-hypre)
clean_hypre=true # Set the flag to true when --clean-hypre is used
shift
Expand Down
2 changes: 2 additions & 0 deletions Build/impi_intel_win/make_fds.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ if x%arg1% == xbot goto endif1
call ..\Scripts\setup_intel_compilers.bat
:endif1

::call ..\Scripts\build_thirdparty_libs %*

Title Building FDS (Intel MPI/%INTEL_IFORT%) for 64 bit Windows %TARGET%

make SHELL="%ComSpec%" VPATH="../../Source" -f ..\makefile %TARGET%
Expand Down
2 changes: 2 additions & 0 deletions Build/impi_intel_win_db/make_fds.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ if x%arg1% == xbot goto endif1
call ..\Scripts\setup_intel_compilers.bat
:endif1

::call ..\Scripts\build_thirdparty_libs %*

Title Building debug FDS (Intel MPI/%INTEL_IFORT%) for 64 bit Windows %TARGET%

make SHELL="%ComSpec%" VPATH="../../Source" -f ..\makefile %TARGET%
Expand Down
2 changes: 2 additions & 0 deletions Build/impi_intel_win_dv/make_fds.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ if x%arg1% == xbot goto endif1
call ..\Scripts\setup_intel_compilers.bat
:endif1

::call ..\Scripts\build_thirdparty_libs %*

Title Building DV FDS (Intel MPI/%INTEL_IFORT%) for 64 bit Windows %TARGET%

make SHELL="%ComSpec%" VPATH="../../Source" -f ..\makefile %TARGET%
Expand Down
2 changes: 2 additions & 0 deletions Build/impi_intel_win_openmp/make_fds.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ if x%arg1% == xbot goto endif1
call ..\Scripts\setup_intel_compilers.bat
:endif1

::call ..\Scripts\build_thirdparty_libs %*

Title Building OpenMP FDS (Intel MPI/%INTEL_IFORT% OpenMP) for 64 bit Windows %TARGET%

make SHELL="%ComSpec%" VPATH="../../Source" -f ..\makefile %TARGET%
Expand Down
2 changes: 2 additions & 0 deletions Build/impi_intel_win_openmp_db/make_fds.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ if x%arg1% == xbot goto endif1
call ..\Scripts\setup_intel_compilers.bat
:endif1

::call ..\Scripts\build_thirdparty_libs %*

Title Building debug OpenMP FDS (Intel MPI/%INTEL_IFORT% OpenMP) for 64 bit Windows %TARGET%

make SHELL="%ComSpec%" VPATH="../../Source" -f ..\makefile %TARGET%
Expand Down
2 changes: 2 additions & 0 deletions Build/impi_intel_win_openmp_dv/make_fds.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ if x%arg1% == xbot goto endif1
call ..\Scripts\setup_intel_compilers.bat
:endif1

::call ..\Scripts\build_thirdparty_libs %*

Title Building dv OpenMP FDS (Intel MPI/%INTEL_IFORT% OpenMP) for 64 bit Windows %TARGET%

make SHELL="%ComSpec%" VPATH="../../Source" -f ..\makefile %TARGET%
Expand Down
Loading

0 comments on commit f92666e

Please sign in to comment.