/********************************** INTEL COOK OPTIONS **********************************/ /*required reentry of the cook process to setup the environment*/ #include [cookbook]/reentry.cook /********************************** INITILIZE IFORT ENVIRONMENT **********************************/ if [is_windows] then { if [and [not [defined ifort_arch]] [strlen [getenv TARGET_ARCH]]] then{ ifort_arch = [getenv TARGET_ARCH]; } } else { /*if not set inspect the environment variable IFORT_HOME*/ if [and [not [defined ifort_home]] [strlen [getenv IFORT_HOME]]] then{ ifort_home = [getenv IFORT_HOME]; } if [not [defined ifort_home]] then{ function print ****************************************************; function print "INVALID INTEL COMPILER CONFIGURATION"; function print "ifort_home not defined in a config file or IFORT_HOME enviroment variable not set:"; function print [config]; function print [config-system]; function print [config-node]; function print ****************************************************; fail; } } /*if the target platform for ifort has not been set then figure it out*/ if [not [defined ifort_arch]] then{ if [in [os machine] x86 i386] then{ ifort_arch = ia32; } else if [in [os machine] x86_64 i686] then{ ifort_arch = intel64; } else{ function print ****************************************************; function print "INVALID INTEL COMPILER CONFIGURATION"; function print "Unknown machine type:" [os machine]; function print ****************************************************; fail; } } else if [not [in [ifort_arch] ia32 intel64]] then{ function print ****************************************************; function print "INVALID INTEL COMPILER CONFIGURATION"; function print "ifort_arch="[ifort_arch]; function print "Valid values: ia32|intel64"; function print ****************************************************; fail; } /*init different variables if windows or unix*/ if [is_windows] then { /*if [exists [ifort_home]/bin/compilervars.bat] then{ function print "Calling reentry"; function print "ifort_arch="[ifort_arch]; function enqueue-reentry-win \"[ifort_home]/bin/compilervars.bat\" \"[ifort_arch]\"; } else{ function print ****************************************************; function print "INVALID INTEL COMPILER CONFIGURATION"; function print "Valid ifort installation not found."; function print "WINDOWS: ifort_home="[ifort_home]; function print ****************************************************; fail; }*/ } else{ /*unix ifort*/ if [exists [ifort_home]/bin/compilervars.sh] then{ function print "Calling reentry"; function print "ifort_arch="[ifort_arch]; function enqueue-reentry [ifort_home]/bin/compilervars.sh [ifort_arch]; } else{ function print ****************************************************; function print "INVALID INTEL COMPILER CONFIGURATION"; function print "Valid ifort installation not found."; function print "ifort_home="[ifort_home]; function print ****************************************************; fail; } } /********************************** COMPILER **********************************/ fc = ifort; fc_compile_flag = "-c -Tf"; fc_out_flag = "-o "; fc_flags = "-nologo"; fc_flags += "-assume:nominus0 -assume:nostd_minus0_rounding"; /* use old Fortran std for printing out zeros */ /* add preprocessing for all builds */ fc_flags += "-fpp"; if [is_windows] then { fc_version = [collect_lines [fc] -what |& head -1]; } else { fc_version = [collect_lines [fc] --version | head -1]; } if [is_windows] then { /* setup for specifying linker to use within ifort */ /* Determine which version of MS Visual Studio is being used */ if [and [not [defined target_vs]] [strlen [getenv TARGET_VS]]] then { target_vs = [getenv TARGET_VS]; function print "target_vs: " [target_vs]; } else { function print "no TARGET_VS env variable found: " [getenv TARGET_VS]; target_vs = ""; function print "target_vs being set to: " [target_vs]; } /* Test for MS Visual Studio 2017 */ if [matches "vs2017" [target_vs]] then { if [and [not [defined vctoolsinstalldir]] [strlen [getenv VCToolsInstallDir]]] then { vctoolsinstalldir = [getenv VCToolsInstallDir]; function print "vctoolsinstalldir: " [vctoolsinstalldir]; vctoolsinstalld = [shell cygpath -ams '"`echo -n $VCToolsInstallDir`"']; function print "vctoolsinstalld: " [vctoolsinstalld]; Cvctoolsinstalld = [shell cygpath -ams '"`echo -n $VCToolsInstallDir`"' | cygpath -uf -]; function print "Cvctoolsinstalld: " [Cvctoolsinstalld]; if [and [not [defined target_vs_arch]] [strlen [getenv TARGET_VS_ARCH]]] then { target_vs_arch = [getenv TARGET_VS_ARCH]; function print "target_vs_arch: " [target_vs_arch]; if [matches "amd64" [target_vs_arch]] then { HostX = "HostX64"; } else { HostX = "HostX86"; } function print "HostX: " [HostX]; vs_linkdir = [vctoolsinstalld]/bin/[HostX]/x64; function print "vs_linkdir: " [vs_linkdir]; } } } /* Test for earlier versions of MS Visual Studio (2013 tested) */ else if [and [not [defined vcinstalldir]] [strlen [getenv VCINSTALLDIR]]] then { vcinstalldir = [getenv VCINSTALLDIR]; function print "vcinstalldir: " [vcinstalldir]; vcinstalld = [shell cygpath -ams '"`echo -n $VCINSTALLDIR`"']; function print "vcinstalld: " [vcinstalld]; Cvcinstalld = [shell cygpath -ams '"`echo -n $VCINSTALLDIR`"' | cygpath -uf -]; function print "Cvcinstalld: " [Cvcinstalld]; vs_linkdir = [vcinstalld]/Bin; function print "vs_linkdir: " [vs_linkdir]; } else { fail "Cannot find valid linker path."; } /* Checks to see if "link.exe" is actually in the discovered directory (tested with VS 2017 and VS 2013)*/ if [exists [vs_linkdir]] then { function print "link.exe file exists here: " [vs_linkdir]; } else { fail "link.exe file doesn't exist here: " [vs_linkdir]; } fc_flags +=-Qlocation,link,[vs_linkdir]; function print "fc_flags: " [fc_flags]; } fc_fixed =""; fc_free = "-free"; /* default mode flags */ if [is_windows] then { fc_default ="-Od"; fc_mod_out_flag = "-module:"; } else { /* Linux */ fc_default ="-O0"; fc_mod_out_flag = "-module "; } /* debug flags */ if [is_windows] then { fc_debug ="/debug /warn:all /gen-interfaces"; /*fc_debug ="/debug /warn:all /gen-interfaces /r8";*/ } else { /* Linux */ fc_debug ="-g"; } /* optimization flags */ fc_optimize ="-O2"; /*release flags */ fc_release = [fc_optimize]; /* includes */ fc_inc_flag = "-I "; fc_inc_join = [false]; /*if true, the includes are joined into a single argument with the separator */ fc_inc_sep = ; fc_mod_inc_flag = "-I "; /* Case of the module names: lower, upper or mixed*/ fc_mod_case = lower;; /********************************** LINKER **********************************/ if [is_windows] then { /* The following 3 lines aren't "linking" the executable weps.exe */ ld = [fc]; ld_version = [fc_version]; ld_flags =-Qlocation,link,[vs_linkdir]; /* This fixes the issue with the linker not running with the correct args from ifort. */ /*ld = [vs_linkdir]/link.exe; ld_version = [collect [ld] | head -1]; ld_flags ="";*/ ld_out_flag = "-o "; /* debug flags */ ld_debug =; /* optimization flags */ ld_optimize =; /* includes */ ld_inc_flag = [fc_inc_flag]; ld_inc_join = [fc_inc_join]; /*if true, the includes are joined into a single argument with the separator */ ld_inc_sep = [fc_inc_sep]; ld_lib_prefix = ""; ld_lib_suffix = ""; } else { ld = [fc]; ld_version = [fc_version]; ld_link_flag =; ld_out_flag = "-o "; /* debug flags */ ld_debug =; /* optimization flags */ ld_optimize ="-fast"; /* includes */ ld_inc_flag = [fc_inc_flag]; ld_inc_join = [fc_inc_join]; /*if true, the includes are joined into a single argument with the separator */ ld_inc_sep = [fc_inc_sep]; ld_lib_prefix = "-Xlinker --start-group "; ld_lib_suffix = " -Xlinker --end-group"; } /********************************** ARCHIVER **********************************/ if [is_windows] then { ar = lib; /* ar = [vs_linkdir]/lib.exe; */ ar_flags = "-nologo"; ar_flags += "-out:"; ar_version = [collect [ar] -verbose | head -1]; } else { /* Linux */ ar = xiar; ar_version = ?; ar_flags = "-cq "; }