diff --git a/Build/Scripts/HYPRE/build_hypre.bat b/Build/Scripts/HYPRE/build_hypre.bat index ac4fc68d4fa..7034c3e05db 100644 --- a/Build/Scripts/HYPRE/build_hypre.bat +++ b/Build/Scripts/HYPRE/build_hypre.bat @@ -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 @@ -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. @@ -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. @@ -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% @@ -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 @@ -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. diff --git a/Build/Scripts/SUNDIALS/build_sundials.bat b/Build/Scripts/SUNDIALS/build_sundials.bat index ac78a83e298..bdf5ae9247d 100644 --- a/Build/Scripts/SUNDIALS/build_sundials.bat +++ b/Build/Scripts/SUNDIALS/build_sundials.bat @@ -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 @@ -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 @@ -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% @@ -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 @@ -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. diff --git a/Build/Scripts/build_thirdparty_libs.bat b/Build/Scripts/build_thirdparty_libs.bat new file mode 100644 index 00000000000..fe68f36c25b --- /dev/null +++ b/Build/Scripts/build_thirdparty_libs.bat @@ -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% \ No newline at end of file diff --git a/Build/Scripts/build_thirdparty_libs.sh b/Build/Scripts/build_thirdparty_libs.sh index a279dddcdb4..03226b8b82d 100755 --- a/Build/Scripts/build_thirdparty_libs.sh +++ b/Build/Scripts/build_thirdparty_libs.sh @@ -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 diff --git a/Build/impi_intel_win/make_fds.bat b/Build/impi_intel_win/make_fds.bat index f8599d5f0bd..19668a1f8b6 100644 --- a/Build/impi_intel_win/make_fds.bat +++ b/Build/impi_intel_win/make_fds.bat @@ -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% diff --git a/Build/impi_intel_win_db/make_fds.bat b/Build/impi_intel_win_db/make_fds.bat index ab002311c95..5eb6cfb11fd 100644 --- a/Build/impi_intel_win_db/make_fds.bat +++ b/Build/impi_intel_win_db/make_fds.bat @@ -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% diff --git a/Build/impi_intel_win_dv/make_fds.bat b/Build/impi_intel_win_dv/make_fds.bat index d20b8a53a9f..2f8dc8cd080 100644 --- a/Build/impi_intel_win_dv/make_fds.bat +++ b/Build/impi_intel_win_dv/make_fds.bat @@ -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% diff --git a/Build/impi_intel_win_openmp/make_fds.bat b/Build/impi_intel_win_openmp/make_fds.bat index 9723b066695..cde89571f39 100644 --- a/Build/impi_intel_win_openmp/make_fds.bat +++ b/Build/impi_intel_win_openmp/make_fds.bat @@ -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% diff --git a/Build/impi_intel_win_openmp_db/make_fds.bat b/Build/impi_intel_win_openmp_db/make_fds.bat index 2977966636b..a040474b9c9 100644 --- a/Build/impi_intel_win_openmp_db/make_fds.bat +++ b/Build/impi_intel_win_openmp_db/make_fds.bat @@ -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% diff --git a/Build/impi_intel_win_openmp_dv/make_fds.bat b/Build/impi_intel_win_openmp_dv/make_fds.bat index 92a90c214cc..e9babd4cbe7 100644 --- a/Build/impi_intel_win_openmp_dv/make_fds.bat +++ b/Build/impi_intel_win_openmp_dv/make_fds.bat @@ -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% diff --git a/Build/impi_intel_win_vt/make_fds.bat b/Build/impi_intel_win_vt/make_fds.bat index f8599d5f0bd..19668a1f8b6 100644 --- a/Build/impi_intel_win_vt/make_fds.bat +++ b/Build/impi_intel_win_vt/make_fds.bat @@ -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%