Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 1 addition & 28 deletions Build/Scripts/HYPRE/build_hypre.bat
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,6 @@ echo ----------------------------------------------------------
echo ----------------------------------------------------------
echo.

set buildstatus=build
echo.
echo ----------------------------------------------------------
echo ----------------------------------------------------------
echo setting up Intel compilers
echo ----------------------------------------------------------
echo ----------------------------------------------------------
echo.
call %FIREMODELS%\fds\Build\Scripts\setup_intel_compilers.bat

cd %CURDIR%

echo.
echo ----------------------------------------------------------
echo ----------------------------------------------------------
Expand Down Expand Up @@ -130,27 +118,12 @@ echo ----------------------------------------------------------
echo ----------------------------------------------------------
echo.

::Check if make.bat or make.exe exists, and set CMAKE_MAKE_PROGRAM accordingly
set CMAKE_MAKE_PROGRAM=
for /f "delims=" %%i in ('where make.bat 2^>nul') do set CMAKE_MAKE_PROGRAM=%%i
if not defined CMAKE_MAKE_PROGRAM (
for /f "delims=" %%i in ('where make.exe 2^>nul') do set CMAKE_MAKE_PROGRAM=%%i
)
if not defined CMAKE_MAKE_PROGRAM (
echo Error: Neither make.bat nor make.exe found in PATH.
exit /b 1
)

echo.
echo make proram is %CMAKE_MAKE_PROGRAM%
echo.

set BUILDDIR=%LIB_REPO%\src\cmbuild
cd %BUILDDIR%
cmake ..\ ^
-G "MinGW Makefiles" ^
-DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" ^
-DCMAKE_C_COMPILER=%CC% ^
-DCMAKE_C_COMPILER=%COMP_CC% ^
-DCMAKE_C_FLAGS="/DWIN32 -O3 /fp:precise" ^
-DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded" ^
-DCMAKE_MAKE_PROGRAM="%CMAKE_MAKE_PROGRAM%" ^
Expand Down
5 changes: 1 addition & 4 deletions Build/Scripts/HYPRE/confmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fi

cmake_args=(
-DCMAKE_INSTALL_PREFIX="$HYPRE_INSTALL_PREFIX"
-DCMAKE_C_COMPILER="$CC"
-DCMAKE_C_COMPILER="$COMP_CC"
-DCMAKE_C_FLAGS="$C_FLAGS"
-DCMAKE_INSTALL_LIBDIR="lib"
)
Expand All @@ -27,7 +27,4 @@ fi
# Run cmake with the arguments
cmake ../ "${cmake_args[@]}"

# ./configure CC=$CC FC=mpiifort CFLAGS="-O3 -fno-unsafe-math-optimizations -fp-model=precise" FFLAGS="-O3 -fno-unsafe-math-optimizations -fp-model=precise" \
# --prefix=$FIREMODELS/libs/hypre/$HYPRE_VERSION

make install
28 changes: 2 additions & 26 deletions Build/Scripts/SUNDIALS/build_sundials.bat
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,6 @@ echo ----------------------------------------------------------
echo ----------------------------------------------------------
echo.

echo.
echo ----------------------------------------------------------
echo ----------------------------------------------------------
echo setting up Intel compilers
echo ----------------------------------------------------------
echo ----------------------------------------------------------
echo.
call %FIREMODELS%\fds\Build\Scripts\setup_intel_compilers.bat

git checkout %LIB_TAG%

echo.
Expand Down Expand Up @@ -110,28 +101,13 @@ echo ----------------------------------------------------------
echo ----------------------------------------------------------
echo.

::Check if make.bat or make.exe exists, and set CMAKE_MAKE_PROGRAM accordingly
set CMAKE_MAKE_PROGRAM=
for /f "delims=" %%i in ('where make.bat 2^>nul') do set CMAKE_MAKE_PROGRAM=%%i
if not defined CMAKE_MAKE_PROGRAM (
for /f "delims=" %%i in ('where make.exe 2^>nul') do set CMAKE_MAKE_PROGRAM=%%i
)
if not defined CMAKE_MAKE_PROGRAM (
echo Error: Neither make.bat nor make.exe found in PATH.
exit /b 1
)

echo.
echo make proram is %CMAKE_MAKE_PROGRAM%
echo.

cmake ..\ ^
-G "MinGW Makefiles" ^
-DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" ^
-DEXAMPLES_INSTALL_PATH="%INSTALLDIR%\examples" ^
-DBUILD_FORTRAN_MODULE_INTERFACE=ON ^
-DCMAKE_C_COMPILER=%CC% ^
-DCMAKE_Fortran_COMPILER=%FC% ^
-DCMAKE_C_COMPILER=%COMP_CC% ^
-DCMAKE_Fortran_COMPILER=%COMP_FC% ^
-DEXAMPLES_ENABLE_C=OFF ^
-DEXAMPLES_ENABLE_CXX=OFF ^
-DEXAMPLES_ENABLE_F2003=OFF ^
Expand Down
6 changes: 3 additions & 3 deletions Build/Scripts/SUNDIALS/confmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ export SUNDIALS_INSTALL_PREFIX=$FIREMODELS/libs/sundials/$SUNDIALS_VERSION
cmake_args=(
-DCMAKE_INSTALL_PREFIX="$SUNDIALS_INSTALL_PREFIX"
-DEXAMPLES_INSTALL_PATH="$SUNDIALS_INSTALL_PREFIX/examples"
-DCMAKE_C_COMPILER="$CC"
-DCMAKE_CXX_COMPILER="$CXX"
-DCMAKE_Fortran_COMPILER="$FC"
-DCMAKE_C_COMPILER="$COMP_CC"
-DCMAKE_CXX_COMPILER="$COMP_CXX"
-DCMAKE_Fortran_COMPILER="$COMP_FC"
-DBUILD_FORTRAN_MODULE_INTERFACE=ON
-DEXAMPLES_ENABLE_CXX=OFF
-DEXAMPLES_ENABLE_CUDA=OFF
Expand Down
15 changes: 3 additions & 12 deletions Build/Scripts/build_thirdparty_libs.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
@echo off

:: Select the compilers
call ..\Scripts\set_compilers.bat

set clean_hypre=
set clean_sundials=
set clean_fds=
Expand Down Expand Up @@ -89,18 +92,6 @@ cd %SCRIPTDIR%
SET SCRIPTDIR=%CD%


:: Decide C and FORTRAN COMPILER for third-party builds
set CC=icx
if "x%INTEL_IFORT%" == "x" (
set FC=ifx
) else (
set FC=%INTEL_IFORT%
)
echo.
echo Third-party libs C Compiler=%CC%
echo Third-party libs Fortran Compiler=%FC%
echo.


::Call HYPRE and SUNDIALS build script
cd %SCRIPTDIR%\HYPRE
Expand Down
5 changes: 3 additions & 2 deletions Build/Scripts/build_thirdparty_libs.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# PARSE OPTIONS FOR CLEAN LIBRARY BUILDS ####################################

# Decide compilers
source ../Scripts/set_compilers.sh

# Set FIREMODELS environment variable if it is not already exists.
if [ -z "${FIREMODELS}" ]; then
export FIREMODELS="$(readlink -f "$(pwd)/../../../")"
Expand Down Expand Up @@ -64,8 +67,6 @@ fi

# FINISHED WITH CLEANING OPTIONS ###########################################

# Decide compilers
source ../Scripts/set_thirdparty_compilers.sh

# build hypre
source ../Scripts/HYPRE/build_hypre.sh confmake.sh $clean_hypre
Expand Down
64 changes: 64 additions & 0 deletions Build/Scripts/set_compilers.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
@echo off

:: Initialize compiler flags
set set_COMP_CC=0
set set_COMP_FC=0

:: Check and set C compiler
if defined FIREMODELS_CC (
set COMP_CC=%FIREMODELS_CC%
where /q %COMP_CC% && (
set set_COMP_CC=1
) || (
echo Warning: %FIREMODELS_CC% is not available. Searching for an alternative.
)
)
if %set_COMP_CC%==0 (
for %%C in (icx icc) do (
where /q %%C && set COMP_CC=%%C && set set_COMP_CC=1 && goto :found_cc
)
echo Error: Neither icx nor icc is available. & exit /b 1
)
:found_cc

:: Check and set Fortran compiler
if defined FIREMODELS_FC (
set COMP_FC=%FIREMODELS_FC%
where /q %COMP_FC% && (
set set_COMP_FC=1
) || (
echo Warning: %FIREMODELS_FC% is not available. Searching for an alternative.
)
)
if %set_COMP_FC%==0 (
for %%F in (ifx ifort) do (
where /q %%F && set COMP_FC=%%F && set set_COMP_FC=1 && goto :found_fc
)
echo Error: Neither ifx nor ifort is available. & exit /b 1
)
:found_fc

:: Display selected compilers
echo.
echo Third-party libs C Compiler: %COMP_CC%
echo Firemodels and Third-party libs Fortran Compiler: %COMP_FC%
echo.


::Check if make.bat or make.exe exists, and set CMAKE_MAKE_PROGRAM accordingly
::------------------------------------------------------------------------------
set CMAKE_MAKE_PROGRAM=
for /f "delims=" %%i in ('where make.bat 2^>nul') do set CMAKE_MAKE_PROGRAM=%%i
if not defined CMAKE_MAKE_PROGRAM (
for /f "delims=" %%i in ('where make.exe 2^>nul') do set CMAKE_MAKE_PROGRAM=%%i
)
if not defined CMAKE_MAKE_PROGRAM (
echo Error: Neither make.bat nor make.exe found in PATH.
exit /b 1
)

echo.
echo make proram is %CMAKE_MAKE_PROGRAM%
echo.


Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
echo "FDS build target = $FDS_BUILD_TARGET"

# Initialize variables and check environment variables
set_compiler_var() {
local var_name=$1 # Variable name to set (e.g., CC, CXX, FC)
local env_var=$2 # Environment variable to check (e.g., FIREMODELS_LIBS_CC)
local set_flag_var=$3 # Flag variable name (e.g., set_CC, set_CXX, set_FC)
set_compiler_from_env_var() {
local var_name=$1 # Variable name to set (e.g., COMP_CC, COMP_CXX, COMP_FC)
local env_var=$2 # Environment variable to check (e.g., FIREMODELS_CC)
local set_flag_var=$3 # Flag variable name (e.g., set_COMP_CC, set_COMP_CXX, set_COMP_FC)

if [ -n "${!env_var}" ]; then
eval "$var_name=${!env_var}"
Expand All @@ -18,8 +18,8 @@ set_compiler_var() {


# Set compilers based on the build target
select_compiler() {
local var_name=$1 # Variable to set (CC, CXX, FC)
select_compiler_from_system() {
local var_name=$1 # Variable to set (COMP_CC, COMP_CXX, COMP_FC)
shift
local compilers=("$@") # List of compilers to check in order
local set_flag_var="set_$var_name"
Expand All @@ -41,39 +41,35 @@ select_compiler() {
}


# Following variables indicate if compilers are set using environment variables FIREMODELS_LIBS_XXX.
set_CC=0
set_CXX=0
set_FC=0
# Following variables indicate if compilers are set using environment variables FIREMODELS_XXX.
set_COMP_CC=0
set_COMP_CXX=0
set_COMP_FC=0

# Check environment variables for compilers
set_compiler_var CC FIREMODELS_LIBS_CC set_CC
set_compiler_var CXX FIREMODELS_LIBS_CXX set_CXX
set_compiler_var FC FIREMODELS_LIBS_FC set_FC
set_compiler_from_env_var COMP_CC FIREMODELS_CC set_COMP_CC
set_compiler_from_env_var COMP_CXX FIREMODELS_CXX set_COMP_CXX
set_compiler_from_env_var COMP_FC FIREMODELS_FC set_COMP_FC

# Determine compiler list based on build target
if [[ "$FDS_BUILD_TARGET" == *"osx"* ]]; then
select_compiler CC mpicc clang gcc
select_compiler CXX mpicxx clang++ g++
select_compiler FC mpifort gfortran
select_compiler_from_system COMP_CC mpicc clang gcc
select_compiler_from_system COMP_CXX mpicxx clang++ g++
select_compiler_from_system COMP_FC mpifort
elif [[ "$FDS_BUILD_TARGET" == *"intel"* ]]; then
select_compiler CC mpiicx icx mpiicc icc
select_compiler CXX mpiicpx icpx mpiicpc icpc
select_compiler FC ifort mpiifx ifx
select_compiler_from_system COMP_CC mpiicx icx mpiicc icc
select_compiler_from_system COMP_CXX mpiicpx icpx mpiicpc icpc
select_compiler_from_system COMP_FC mpiifx mpiifort
else # Default to GNU compilers
select_compiler CC mpicc gcc
select_compiler CXX mpicxx g++
select_compiler FC mpifort gfortran
select_compiler_from_system COMP_CC mpicc gcc
select_compiler_from_system COMP_CXX mpicxx g++
select_compiler_from_system COMP_FC mpifort
fi

echo "Thirdparty libs C Compiler COMP_CC=$COMP_CC"
echo "Thirdparty libs C++ compiler COMP_CXX=$COMP_CXX"
echo "Firemodels and Thirdparty libs Fortran compiler COMP_FC=$COMP_FC"

echo "Third-party libs C Compiler=$CC"
echo "Third-party libs C++ compiler=$CXX"
echo "Third-party libs Fortran compiler=$FC"

export CC=$CC
export CXX=$CXX
export FC=$FC



export COMP_CC=$COMP_CC
export COMP_CXX=$COMP_CXX
export COMP_FC=$COMP_FC
9 changes: 4 additions & 5 deletions Build/impi_intel_win/make_fds.bat
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
@echo off
set arg1=%1

:: build hypre and/or sundials libraries if necessary

call ..\Scripts\build_thirdparty_libs %*
if %stopscript% == 1 exit /b

for %%I in (.) do set TARGET=%%~nxI

:: setup compiler environment
if x%arg1% == xbot goto endif1
call ..\Scripts\setup_intel_compilers.bat
:endif1

:: build hypre and/or sundials libraries if necessary
call ..\Scripts\build_thirdparty_libs %*
if %stopscript% == 1 exit /b

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

make SHELL="%ComSpec%" VPATH="../../Source" -f ..\makefile %TARGET%
Expand Down
9 changes: 4 additions & 5 deletions Build/impi_intel_win_db/make_fds.bat
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
@echo off
set arg1=%1

:: build hypre and/or sundials libraries if necessary

call ..\Scripts\build_thirdparty_libs %*
if %stopscript% == 1 exit /b

for %%I in (.) do set TARGET=%%~nxI

:: setup compiler environment
if x%arg1% == xbot goto endif1
call ..\Scripts\setup_intel_compilers.bat
:endif1

:: build hypre and/or sundials libraries if necessary
call ..\Scripts\build_thirdparty_libs %*
if %stopscript% == 1 exit /b

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

make SHELL="%ComSpec%" VPATH="../../Source" -f ..\makefile %TARGET%
Expand Down
9 changes: 4 additions & 5 deletions Build/impi_intel_win_dv/make_fds.bat
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
@echo off
set arg1=%1

:: build hypre and/or sundials libraries if necessary

call ..\Scripts\build_thirdparty_libs %*
if %stopscript% == 1 exit /b

for %%I in (.) do set TARGET=%%~nxI

:: setup compiler environment
if x%arg1% == xbot goto endif1
call ..\Scripts\setup_intel_compilers.bat
:endif1

:: build hypre and/or sundials libraries if necessary
call ..\Scripts\build_thirdparty_libs %*
if %stopscript% == 1 exit /b

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

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