From 2723f932a68c55a74d406759c0b6e384c40c8819 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Mon, 19 Oct 2020 13:04:23 -0600 Subject: [PATCH 1/8] Increase version number to 2.0.0 --- VERSION | 2 +- tmplModulefiles/NCEPLIBS/NCEPLIBS.lua | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 tmplModulefiles/NCEPLIBS/NCEPLIBS.lua diff --git a/VERSION b/VERSION index 26aaba0..227cea2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.2.0 +2.0.0 diff --git a/tmplModulefiles/NCEPLIBS/NCEPLIBS.lua b/tmplModulefiles/NCEPLIBS/NCEPLIBS.lua new file mode 100644 index 0000000..d39448c --- /dev/null +++ b/tmplModulefiles/NCEPLIBS/NCEPLIBS.lua @@ -0,0 +1,15 @@ +help([[ +]]) + +local pkgName = myModuleName() +local pkgVersion = myModuleVersion() + +conflict(pkgName) + +local prefix = "#NCEPLIBS_ROOT#" + +setenv("NCEPLIBS_ROOT", prefix) + +setenv("CC", "#CC#") +setenv("CXX", "#CXX#") +setenv("FC", "#FC#") From b706b48f923a9e46e06d60f3567d5091da25bbeb Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Mon, 19 Oct 2020 13:08:58 -0600 Subject: [PATCH 2/8] Add umbrella modulefile and umbrella shell scripts (bash and tcsh), always overwrite existing files --- CMakeLists.txt | 29 +++++++--------- deploy_modulefiles.sh.in | 74 +++++++++++++++++++++++++++++++++++----- lua2tcl.py | 34 +++++++++++++----- 3 files changed, 105 insertions(+), 32 deletions(-) mode change 100644 => 100755 deploy_modulefiles.sh.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 5083f11..ea9d716 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,8 @@ file(STRINGS "VERSION" pVersion) project( NCEPLIBS VERSION ${pVersion} - LANGUAGES C Fortran) + # CXX isn't actually used, but need CMAKE_CXX_COMPILER in umbrella module + LANGUAGES C CXX Fortran) include(ExternalProject) include(GNUInstallDirs) @@ -27,13 +28,13 @@ endif() set(DEFAULT_LIBCOMPS ${CMAKE_CURRENT_SOURCE_DIR}/COMPONENTS) # User options -option(OPENMP "Enable OpenMP threading" OFF) -option(ENABLE_TESTS "Enable testing" OFF) -option(BUILD_CRTM "Build CRTM library" ON) -option(BUILD_POST "Build NCEPpost library" ON) -option(DEPLOY "Deploy modulefiles" OFF) -option(TCLMOD "Create Tcl modulefiles " OFF) -option(FLAT "Flat install structure" ON) +option(OPENMP "Enable OpenMP threading" OFF) +option(ENABLE_TESTS "Enable testing" OFF) +option(BUILD_CRTM "Build CRTM library" ON) +option(BUILD_POST "Build NCEPpost library" ON) +option(DEPLOY "Deploy modulefiles/shellscripts" ON) +option(TCLMOD "Create Tcl modulefiles " OFF) +option(FLAT "Flat install structure" ON) option(LIBCOMPS "File to read components from" ${DEFAULT_LIBCOMPS}) option(DOWNLOAD_ONLY "Just download the components" OFF) option(USE_LOCAL "Use locally downloaded components" OFF) @@ -59,13 +60,9 @@ if(BUILD_POST) set(BUILD_CRTM ON) endif() -# Option to overwrite modulefile (if DEPLOY = ON) +# Deploy modulefile if requested if(DEPLOY) - message(STATUS "Installing NCEPLIBS modulefiles at ${CMAKE_INSTALL_PREFIX}/modules") - option(OVERWRITEMODULES "Overwrite existing modules (if found!)" OFF) - if(OVERWRITEMODULES) - message(STATUS "WARNING: Overwriting NCEPLIBS modulefiles is ON") - endif() + message(STATUS "Installing NCEPLIBS modulefiles at ${CMAKE_INSTALL_PREFIX}/modules, NCEPLIBs shell scripts at ${CMAKE_INSTALL_PREFIX}/bin") endif() function(trapLocalError sourceDir) @@ -255,7 +252,7 @@ if(DOWNLOAD_ONLY) add_dependencies(tarball ${_comps}) endif() -# Prepare to deploy modulefiles +# Prepare to deploy configure_file(${CMAKE_CURRENT_SOURCE_DIR}/deploy_modulefiles.sh.in ${CMAKE_CURRENT_BINARY_DIR}/deploy_modulefiles.sh @ONLY) @@ -264,7 +261,7 @@ add_custom_target(prep2deploy ALL COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/deploy_modulefiles.sh DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/deploy_modulefiles.sh) -# Deploy modulefiles (if enabled), but do not add to make all (make user do it) +# Deploy modulefiles and shell scripts (if enabled), but do not add to make all (make user do it) if(DEPLOY) add_custom_target(deploy COMMAND ${CMAKE_CURRENT_BINARY_DIR}/deploy_modulefiles.sh) diff --git a/deploy_modulefiles.sh.in b/deploy_modulefiles.sh.in old mode 100644 new mode 100755 index 323f50e..c284c66 --- a/deploy_modulefiles.sh.in +++ b/deploy_modulefiles.sh.in @@ -3,8 +3,8 @@ set -e # Defaults to user options will be provided by CMake -modulesDestDir=${1:-"@CMAKE_INSTALL_PREFIX@/modules"} -DOVERWRITEMODULES=${2:-"@OVERWRITEMODULES@"} +modulesDestDir="@CMAKE_INSTALL_PREFIX@/modules" +NCEPLIBS_VERSION="@pVersion@" # These will be filled by CMake nceplibsInstallDir=@CMAKE_INSTALL_PREFIX@ @@ -12,14 +12,20 @@ tmplModulefilesDir=@CMAKE_CURRENT_SOURCE_DIR@/tmplModulefiles LIBCOMPS=@LIBCOMPS_FILE@ DFLAT="@FLAT@" -[[ $DOVERWRITEMODULES == "ON" ]] && OVERWRITE="Y" || OVERWRITE="N" [[ $DFLAT == "ON" ]] && FLAT="Y" || FLAT="N" +# All module load commands for the umbrella module +moduleLoadCommands="" + +# All export statements for the umbrella shell scripts +bashScriptContents="#!/bin/bash" +tcshScriptContents="#!/bin/tcsh" + echo "Begin deploying modules ..." for libName in $(ls -1 $tmplModulefilesDir); do - # Ensure $libName is indeed a library being installed + # Ensure $libName is indeed a library being installed - this will skip the umbrella module "NCEPLIBS" isAbsent=$(cat $LIBCOMPS | grep -w $libName | wc -l) [[ $isAbsent -eq 0 ]] && continue @@ -37,10 +43,6 @@ for libName in $(ls -1 $tmplModulefilesDir); do # Create destination directory for the modulefile and copy template to it mkdir -p $modulesDestDir/$libName - if [[ -f $dstModulefile ]]; then - [[ $OVERWRITE =~ [YyTt] ]] && ( echo "WARNING: $dstModulefile exists, OVERWRITING!"; \rm -f $dstModulefile ) \ - || ( echo "ERROR: $dstModulefile exists, ABORT!"; exit 1 ) - fi \cp $srcModulefile $dstModulefile [[ $FLAT =~ [YyTt] ]] && prefix=${nceplibsInstallDir} || prefix=${nceplibsInstallDir}/$libName @@ -52,8 +54,64 @@ for libName in $(ls -1 $tmplModulefilesDir); do # Replace #NCEPLIBS_ROOT# from template with $nceplibsInstallDir sed -i -e "s/#NCEPLIBS_ROOT#/${repl}/g" $dstModulefile + # Add to module load commands for umbrella module + moduleLoadCommands="${moduleLoadCommands} +module load $libName/$ver" + + # Add to export statements for umbrella shell scripts + bashScriptContents="${bashScriptContents} +export ${libName}_ROOT=\"${prefix}\"" + tcshScriptContents="${tcshScriptContents} +setenv ${libName}_ROOT \"${prefix}\"" + done +# Create NCEPLIBS umbrella module file +srcModulefile=$tmplModulefilesDir/NCEPLIBS/nceplibs.lua +dstModulefile=$modulesDestDir/NCEPLIBS/${NCEPLIBS_VERSION}.lua +mkdir -p $modulesDestDir/NCEPLIBS +\cp $srcModulefile $dstModulefile + +# Replace #NCEPLIBS_ROOT# from template with $nceplibsInstallDir +repl=$(echo ${nceplibsInstallDir} | sed -e "s#/#\\\/#g") +sed -i -e "s/#NCEPLIBS_ROOT#/${repl}/g" $dstModulefile + +# Set compiler environment variables for the umbrella modulefile +repl=$(echo "@CMAKE_C_COMPILER@" | sed -e "s#/#\\\/#g") +sed -i -e "s/#CC#/${repl}/g" $dstModulefile +repl=$(echo "@CMAKE_CXX_COMPILER@" | sed -e "s#/#\\\/#g") +sed -i -e "s/#CXX#/${repl}/g" $dstModulefile +repl=$(echo "@CMAKE_Fortran_COMPILER@" | sed -e "s#/#\\\/#g") +sed -i -e "s/#FC#/${repl}/g" $dstModulefile + +# Append all module load commands to umbrella module +echo "${moduleLoadCommands}" >> $dstModulefile + +# Temporary workaround: if exists, remove .lua-e file that gets created by sed for a reason I don't understand +rm -vf ${dstModulefile}-e + echo "Done deploying modules ..." +echo "Generating shell scripts ..." + +bashScript="@CMAKE_INSTALL_PREFIX@/bin/setenv_nceplibs.sh" +tcshScript="@CMAKE_INSTALL_PREFIX@/bin/setenv_nceplibs.csh" + +# Set compiler environment variables for the shell scripts +bashScriptContents="${bashScriptContents} +export CC=\"@CMAKE_C_COMPILER@\" +export CXX=\"@CMAKE_CXX_COMPILER@\" +export FC=\"@CMAKE_Fortran_COMPILER@\"" +tcshScriptContents="${tcshScriptContents} +setenv CC \"@CMAKE_C_COMPILER@\" +setenv CXX \"@CMAKE_CXX_COMPILER@\" +setenv FC \"@CMAKE_Fortran_COMPILER@\"" + +echo "${bashScript}" +echo "${bashScriptContents}" > $bashScript +echo "${tcshScript}" +echo "${tcshScriptContents}" > $tcshScript + +echo "Done generating shell scripts ..." + exit 0 diff --git a/lua2tcl.py b/lua2tcl.py index 4523b9d..a3ad12b 100755 --- a/lua2tcl.py +++ b/lua2tcl.py @@ -27,7 +27,9 @@ setenv {name}_ROOT "${{base}}" setenv {name}_VERSION "{version}" + {setenv_commands} +{module_commands} """ for root,dirs,files in os.walk(basedir): @@ -43,6 +45,7 @@ prefix = None base = None setenv_commands = '' + module_commands = '' for line_in in lua_in: line = line_in.rstrip('\n') if line.startswith("local prefix = \""): @@ -51,20 +54,35 @@ elif line.startswith("setenv"): if line == 'setenv("{name}_ROOT", base)'.format(name=name): continue + elif line == 'setenv("{name}_ROOT", prefix)'.format(name=name): + continue elif line == 'setenv("{name}_VERSION", pkgVersion)'.format(name=name): continue else: # Match lines like the following # setenv("BACIO_LIB8", pathJoin(base,"lib/libbacio_8.a")) match = re.match('^setenv\("(\w+)",\s+pathJoin\(base,"(.+)"\)\)$', line) - if not match: - raise Exception("Error while parsing line '{}' in {}".format(line, infile)) - envvar = match.group(1) - value = match.group(2) - path = '${base}' + '/' + value - setenv_commands += 'setenv {envvar} "{path}"\n'.format(envvar=envvar, path=path) - continue - tcl_out = TCL_TEMPLATE.format(name=name, version=version, base=base, setenv_commands=setenv_commands) + if match: + envvar = match.group(1) + value = match.group(2) + path = '${base}' + '/' + value + setenv_commands += 'setenv {envvar} "{path}"\n'.format(envvar=envvar, path=path) + else: + # Match lines like the following + # setenv("CC", "/usr/local/bin/gcc-9") + match = re.match('^setenv\("(\w+)",\s+"(.+)"\)$', line) + if match: + envvar = match.group(1) + value = match.group(2) + setenv_commands += 'setenv {envvar} "{value}"\n'.format(envvar=envvar, value=value) + else: + raise Exception("Error while parsing line '{}' in {}".format(line, infile)) + elif line.startswith("module"): + module_commands += '{line}\n'.format(line=line) + + tcl_out = TCL_TEMPLATE.format(name=name, version=version, base=base, + setenv_commands=setenv_commands, + module_commands=module_commands) if os.path.isfile(outfile): os.remove(outfile) with open(outfile, "w") as f: From 5cd71f9f110628e27815032e4e9cd4125e2d059f Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Mon, 19 Oct 2020 13:43:35 -0600 Subject: [PATCH 3/8] deploy_modulefiles.sh.in: add '' after -i for each of the sed commands to avoid writing the NCEPLIBS .lua-e file (macOS only) --- deploy_modulefiles.sh.in | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/deploy_modulefiles.sh.in b/deploy_modulefiles.sh.in index c284c66..d8137ae 100755 --- a/deploy_modulefiles.sh.in +++ b/deploy_modulefiles.sh.in @@ -14,6 +14,13 @@ DFLAT="@FLAT@" [[ $DFLAT == "ON" ]] && FLAT="Y" || FLAT="N" +# Account for differences in the sed command on Linux and macOS +if [[ "@CMAKE_SYSTEM_NAME@" == "Darwin" ]]; then + sedI="-i ''" +else + sedI="-i" +fi + # All module load commands for the umbrella module moduleLoadCommands="" @@ -52,7 +59,7 @@ for libName in $(ls -1 $tmplModulefilesDir); do repl=$(echo ${prefix} | sed -e "s#/#\\\/#g") # Replace #NCEPLIBS_ROOT# from template with $nceplibsInstallDir - sed -i -e "s/#NCEPLIBS_ROOT#/${repl}/g" $dstModulefile + sed $sedI -e "s/#NCEPLIBS_ROOT#/${repl}/g" $dstModulefile # Add to module load commands for umbrella module moduleLoadCommands="${moduleLoadCommands} @@ -74,22 +81,19 @@ mkdir -p $modulesDestDir/NCEPLIBS # Replace #NCEPLIBS_ROOT# from template with $nceplibsInstallDir repl=$(echo ${nceplibsInstallDir} | sed -e "s#/#\\\/#g") -sed -i -e "s/#NCEPLIBS_ROOT#/${repl}/g" $dstModulefile +sed $sedI -e "s/#NCEPLIBS_ROOT#/${repl}/g" $dstModulefile # Set compiler environment variables for the umbrella modulefile repl=$(echo "@CMAKE_C_COMPILER@" | sed -e "s#/#\\\/#g") -sed -i -e "s/#CC#/${repl}/g" $dstModulefile +sed $sedI -e "s/#CC#/${repl}/g" $dstModulefile repl=$(echo "@CMAKE_CXX_COMPILER@" | sed -e "s#/#\\\/#g") -sed -i -e "s/#CXX#/${repl}/g" $dstModulefile +sed $sedI -e "s/#CXX#/${repl}/g" $dstModulefile repl=$(echo "@CMAKE_Fortran_COMPILER@" | sed -e "s#/#\\\/#g") -sed -i -e "s/#FC#/${repl}/g" $dstModulefile +sed $sedI -e "s/#FC#/${repl}/g" $dstModulefile # Append all module load commands to umbrella module echo "${moduleLoadCommands}" >> $dstModulefile -# Temporary workaround: if exists, remove .lua-e file that gets created by sed for a reason I don't understand -rm -vf ${dstModulefile}-e - echo "Done deploying modules ..." echo "Generating shell scripts ..." From 6856d60cc35035fb3dda8074d516ae782dd419d0 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Tue, 20 Oct 2020 21:18:12 -0600 Subject: [PATCH 4/8] Convert all lua module templates into tcl/tk module templates --- tmplModulefiles/NCEPLIBS/NCEPLIBS | 19 +++++++++++++++ tmplModulefiles/NCEPLIBS/NCEPLIBS.lua | 15 ------------ tmplModulefiles/bacio/bacio | 19 +++++++++++++++ tmplModulefiles/bacio/bacio.lua | 17 ------------- tmplModulefiles/bufr/bufr | 27 +++++++++++++++++++++ tmplModulefiles/bufr/bufr.lua | 25 ------------------- tmplModulefiles/crtm/crtm | 17 +++++++++++++ tmplModulefiles/crtm/crtm.lua | 15 ------------ tmplModulefiles/g2/g2 | 19 +++++++++++++++ tmplModulefiles/g2/g2.lua | 17 ------------- tmplModulefiles/g2tmpl/g2tmpl | 17 +++++++++++++ tmplModulefiles/g2tmpl/g2tmpl.lua | 15 ------------ tmplModulefiles/gfsio/gfsio | 17 +++++++++++++ tmplModulefiles/gfsio/gfsio.lua | 15 ------------ tmplModulefiles/ip/ip | 21 ++++++++++++++++ tmplModulefiles/ip/ip.lua | 19 --------------- tmplModulefiles/ip2/ip2 | 21 ++++++++++++++++ tmplModulefiles/ip2/ip2.lua | 19 --------------- tmplModulefiles/landsfcutil/landsfcutil | 19 +++++++++++++++ tmplModulefiles/landsfcutil/landsfcutil.lua | 17 ------------- tmplModulefiles/nceppost/nceppost | 19 +++++++++++++++ tmplModulefiles/nceppost/nceppost.lua | 17 ------------- tmplModulefiles/nemsio/nemsio | 18 ++++++++++++++ tmplModulefiles/nemsio/nemsio.lua | 16 ------------ tmplModulefiles/nemsiogfs/nemsiogfs | 17 +++++++++++++ tmplModulefiles/nemsiogfs/nemsiogfs.lua | 15 ------------ tmplModulefiles/sfcio/sfcio | 17 +++++++++++++ tmplModulefiles/sfcio/sfcio.lua | 15 ------------ tmplModulefiles/sigio/sigio | 17 +++++++++++++ tmplModulefiles/sigio/sigio.lua | 15 ------------ tmplModulefiles/sp/sp | 21 ++++++++++++++++ tmplModulefiles/sp/sp.lua | 19 --------------- tmplModulefiles/w3emc/w3emc | 21 ++++++++++++++++ tmplModulefiles/w3emc/w3emc.lua | 19 --------------- tmplModulefiles/w3nco/w3nco | 21 ++++++++++++++++ tmplModulefiles/w3nco/w3nco.lua | 19 --------------- tmplModulefiles/wgrib2/wgrib2 | 19 +++++++++++++++ tmplModulefiles/wgrib2/wgrib2.lua | 18 -------------- tmplModulefiles/wrf_io/wrf_io | 17 +++++++++++++ tmplModulefiles/wrf_io/wrf_io.lua | 15 ------------ 40 files changed, 383 insertions(+), 342 deletions(-) create mode 100644 tmplModulefiles/NCEPLIBS/NCEPLIBS delete mode 100644 tmplModulefiles/NCEPLIBS/NCEPLIBS.lua create mode 100644 tmplModulefiles/bacio/bacio delete mode 100644 tmplModulefiles/bacio/bacio.lua create mode 100644 tmplModulefiles/bufr/bufr delete mode 100644 tmplModulefiles/bufr/bufr.lua create mode 100644 tmplModulefiles/crtm/crtm delete mode 100644 tmplModulefiles/crtm/crtm.lua create mode 100644 tmplModulefiles/g2/g2 delete mode 100644 tmplModulefiles/g2/g2.lua create mode 100644 tmplModulefiles/g2tmpl/g2tmpl delete mode 100644 tmplModulefiles/g2tmpl/g2tmpl.lua create mode 100644 tmplModulefiles/gfsio/gfsio delete mode 100644 tmplModulefiles/gfsio/gfsio.lua create mode 100644 tmplModulefiles/ip/ip delete mode 100644 tmplModulefiles/ip/ip.lua create mode 100644 tmplModulefiles/ip2/ip2 delete mode 100644 tmplModulefiles/ip2/ip2.lua create mode 100644 tmplModulefiles/landsfcutil/landsfcutil delete mode 100644 tmplModulefiles/landsfcutil/landsfcutil.lua create mode 100644 tmplModulefiles/nceppost/nceppost delete mode 100644 tmplModulefiles/nceppost/nceppost.lua create mode 100644 tmplModulefiles/nemsio/nemsio delete mode 100644 tmplModulefiles/nemsio/nemsio.lua create mode 100644 tmplModulefiles/nemsiogfs/nemsiogfs delete mode 100644 tmplModulefiles/nemsiogfs/nemsiogfs.lua create mode 100644 tmplModulefiles/sfcio/sfcio delete mode 100644 tmplModulefiles/sfcio/sfcio.lua create mode 100644 tmplModulefiles/sigio/sigio delete mode 100644 tmplModulefiles/sigio/sigio.lua create mode 100644 tmplModulefiles/sp/sp delete mode 100644 tmplModulefiles/sp/sp.lua create mode 100644 tmplModulefiles/w3emc/w3emc delete mode 100644 tmplModulefiles/w3emc/w3emc.lua create mode 100644 tmplModulefiles/w3nco/w3nco delete mode 100644 tmplModulefiles/w3nco/w3nco.lua create mode 100644 tmplModulefiles/wgrib2/wgrib2 delete mode 100644 tmplModulefiles/wgrib2/wgrib2.lua create mode 100644 tmplModulefiles/wrf_io/wrf_io delete mode 100644 tmplModulefiles/wrf_io/wrf_io.lua diff --git a/tmplModulefiles/NCEPLIBS/NCEPLIBS b/tmplModulefiles/NCEPLIBS/NCEPLIBS new file mode 100644 index 0000000..fd1c88e --- /dev/null +++ b/tmplModulefiles/NCEPLIBS/NCEPLIBS @@ -0,0 +1,19 @@ +#%Module###################################################################### + +proc ModulesHelp { } { + puts "Set environment variables for #NAME#-#VERSION#" +} + +# Make sure another version of the same package is not already loaded +conflict #NAME# + +setenv #NAME#_ROOT "#NCEPLIBS_ROOT#" +setenv #NAME#_VERSION "#VERSION#" + +prepend-path CMAKE_PREFIX_PATH "#NCEPLIBS_ROOT#" + +setenv CC "#CC#" +setenv CXX "#CXX#" +setenv FC "#FC#" + +# Module load commands diff --git a/tmplModulefiles/NCEPLIBS/NCEPLIBS.lua b/tmplModulefiles/NCEPLIBS/NCEPLIBS.lua deleted file mode 100644 index d39448c..0000000 --- a/tmplModulefiles/NCEPLIBS/NCEPLIBS.lua +++ /dev/null @@ -1,15 +0,0 @@ -help([[ -]]) - -local pkgName = myModuleName() -local pkgVersion = myModuleVersion() - -conflict(pkgName) - -local prefix = "#NCEPLIBS_ROOT#" - -setenv("NCEPLIBS_ROOT", prefix) - -setenv("CC", "#CC#") -setenv("CXX", "#CXX#") -setenv("FC", "#FC#") diff --git a/tmplModulefiles/bacio/bacio b/tmplModulefiles/bacio/bacio new file mode 100644 index 0000000..844bbaa --- /dev/null +++ b/tmplModulefiles/bacio/bacio @@ -0,0 +1,19 @@ +#%Module###################################################################### + +proc ModulesHelp { } { + puts "Set environment variables for #NAME#-#VERSION#" +} + +# Make sure another version of the same package is not already loaded +conflict #NAME# + +# Set environment variables +set base "#NCEPLIBS_ROOT#/#NAME#-#VERSION#" + +setenv #NAME#_ROOT "${base}" +setenv #NAME#_VERSION "#VERSION#" + +setenv BACIO_INC4 "${base}/include_4" +setenv BACIO_INC8 "${base}/include_8" +setenv BACIO_LIB4 "${base}/lib/libbacio_4.a" +setenv BACIO_LIB8 "${base}/lib/libbacio_8.a" diff --git a/tmplModulefiles/bacio/bacio.lua b/tmplModulefiles/bacio/bacio.lua deleted file mode 100644 index a0494e4..0000000 --- a/tmplModulefiles/bacio/bacio.lua +++ /dev/null @@ -1,17 +0,0 @@ -help([[ -]]) - -local pkgName = myModuleName() -local pkgVersion = myModuleVersion() - -conflict(pkgName) - -local prefix = "#NCEPLIBS_ROOT#" -local base = pathJoin(prefix,pkgName .. '-' .. pkgVersion) - -setenv("bacio_ROOT", base) -setenv("bacio_VERSION", pkgVersion) -setenv("BACIO_INC4", pathJoin(base,"include_4")) -setenv("BACIO_INC8", pathJoin(base,"include_8")) -setenv("BACIO_LIB4", pathJoin(base,"lib/libbacio_4.a")) -setenv("BACIO_LIB8", pathJoin(base,"lib/libbacio_8.a")) diff --git a/tmplModulefiles/bufr/bufr b/tmplModulefiles/bufr/bufr new file mode 100644 index 0000000..292e2c5 --- /dev/null +++ b/tmplModulefiles/bufr/bufr @@ -0,0 +1,27 @@ +#%Module###################################################################### + +proc ModulesHelp { } { + puts "Set environment variables for #NAME#-#VERSION#" +} + +# Make sure another version of the same package is not already loaded +conflict #NAME# + +# Set environment variables +set base "#NCEPLIBS_ROOT#/#NAME#-#VERSION#" + +setenv #NAME#_ROOT "${base}" +setenv #NAME#_VERSION "#VERSION#" + +setenv BUFR_INC4 "${base}/include_4" +setenv BUFR_INC8 "${base}/include_8" +setenv BUFR_INCd "${base}/include_d" +setenv BUFR_LIB4 "${base}/lib/libbufr_4.a" +setenv BUFR_LIB8 "${base}/lib/libbufr_8.a" +setenv BUFR_LIBd "${base}/lib/libbufr_d.a" +setenv BUFR_INC4_DA "${base}/include_4_DA" +setenv BUFR_INC8_DA "${base}/include_8_DA" +setenv BUFR_INCd_DA "${base}/include_d_DA" +setenv BUFR_LIB4_DA "${base}/lib/libbufr_4_DA.a" +setenv BUFR_LIB8_DA "${base}/lib/libbufr_8_DA.a" +setenv BUFR_LIBd_DA "${base}/lib/libbufr_d_DA.a" diff --git a/tmplModulefiles/bufr/bufr.lua b/tmplModulefiles/bufr/bufr.lua deleted file mode 100644 index 75878e8..0000000 --- a/tmplModulefiles/bufr/bufr.lua +++ /dev/null @@ -1,25 +0,0 @@ -help([[ -]]) - -local pkgName = myModuleName() -local pkgVersion = myModuleVersion() - -conflict(pkgName) - -local prefix = "#NCEPLIBS_ROOT#" -local base = pathJoin(prefix,pkgName .. '-' .. pkgVersion) - -setenv("bufr_ROOT", base) -setenv("bufr_VERSION", pkgVersion) -setenv("BUFR_INC4", pathJoin(base,"include_4")) -setenv("BUFR_INC8", pathJoin(base,"include_8")) -setenv("BUFR_INCd", pathJoin(base,"include_d")) -setenv("BUFR_LIB4", pathJoin(base,"lib/libbufr_4.a")) -setenv("BUFR_LIB8", pathJoin(base,"lib/libbufr_8.a")) -setenv("BUFR_LIBd", pathJoin(base,"lib/libbufr_d.a")) -setenv("BUFR_INC4_DA", pathJoin(base,"include_4_DA")) -setenv("BUFR_INC8_DA", pathJoin(base,"include_8_DA")) -setenv("BUFR_INCd_DA", pathJoin(base,"include_d_DA")) -setenv("BUFR_LIB4_DA", pathJoin(base,"lib/libbufr_4_DA.a")) -setenv("BUFR_LIB8_DA", pathJoin(base,"lib/libbufr_8_DA.a")) -setenv("BUFR_LIBd_DA", pathJoin(base,"lib/libbufr_d_DA.a")) diff --git a/tmplModulefiles/crtm/crtm b/tmplModulefiles/crtm/crtm new file mode 100644 index 0000000..b190627 --- /dev/null +++ b/tmplModulefiles/crtm/crtm @@ -0,0 +1,17 @@ +#%Module###################################################################### + +proc ModulesHelp { } { + puts "Set environment variables for #NAME#-#VERSION#" +} + +# Make sure another version of the same package is not already loaded +conflict #NAME# + +# Set environment variables +set base "#NCEPLIBS_ROOT#/#NAME#-#VERSION#" + +setenv #NAME#_ROOT "${base}" +setenv #NAME#_VERSION "#VERSION#" + +setenv CRTM_INC "${base}/include" +setenv CRTM_LIB "${base}/lib/libcrtm.a" diff --git a/tmplModulefiles/crtm/crtm.lua b/tmplModulefiles/crtm/crtm.lua deleted file mode 100644 index dff5c9c..0000000 --- a/tmplModulefiles/crtm/crtm.lua +++ /dev/null @@ -1,15 +0,0 @@ -help([[ -]]) - -local pkgName = myModuleName() -local pkgVersion = myModuleVersion() - -conflict(pkgName) - -local prefix = "#NCEPLIBS_ROOT#" -local base = pathJoin(prefix,pkgName .. '-' .. pkgVersion) - -setenv("crtm_ROOT", base) -setenv("crtm_VERSION", pkgVersion) -setenv("CRTM_INC", pathJoin(base,"include")) -setenv("CRTM_LIB", pathJoin(base,"lib/libcrtm.a")) diff --git a/tmplModulefiles/g2/g2 b/tmplModulefiles/g2/g2 new file mode 100644 index 0000000..38887aa --- /dev/null +++ b/tmplModulefiles/g2/g2 @@ -0,0 +1,19 @@ +#%Module###################################################################### + +proc ModulesHelp { } { + puts "Set environment variables for #NAME#-#VERSION#" +} + +# Make sure another version of the same package is not already loaded +conflict #NAME# + +# Set environment variables +set base "#NCEPLIBS_ROOT#/#NAME#-#VERSION#" + +setenv #NAME#_ROOT "${base}" +setenv #NAME#_VERSION "#VERSION#" + +setenv G2_INC4 "${base}/include_4" +setenv G2_INCd "${base}/include_d" +setenv G2_LIB4 "${base}/lib/libg2_4.a" +setenv G2_LIBd "${base}/lib/libg2_d.a" diff --git a/tmplModulefiles/g2/g2.lua b/tmplModulefiles/g2/g2.lua deleted file mode 100644 index e6b696f..0000000 --- a/tmplModulefiles/g2/g2.lua +++ /dev/null @@ -1,17 +0,0 @@ -help([[ -]]) - -local pkgName = myModuleName() -local pkgVersion = myModuleVersion() - -conflict(pkgName) - -local prefix = "#NCEPLIBS_ROOT#" -local base = pathJoin(prefix,pkgName .. '-' .. pkgVersion) - -setenv("g2_ROOT", base) -setenv("g2_VERSION", pkgVersion) -setenv("G2_INC4", pathJoin(base,"include_4")) -setenv("G2_INCd", pathJoin(base,"include_d")) -setenv("G2_LIB4", pathJoin(base,"lib/libg2_4.a")) -setenv("G2_LIBd", pathJoin(base,"lib/libg2_d.a")) diff --git a/tmplModulefiles/g2tmpl/g2tmpl b/tmplModulefiles/g2tmpl/g2tmpl new file mode 100644 index 0000000..6708ed1 --- /dev/null +++ b/tmplModulefiles/g2tmpl/g2tmpl @@ -0,0 +1,17 @@ +#%Module###################################################################### + +proc ModulesHelp { } { + puts "Set environment variables for #NAME#-#VERSION#" +} + +# Make sure another version of the same package is not already loaded +conflict #NAME# + +# Set environment variables +set base "#NCEPLIBS_ROOT#/#NAME#-#VERSION#" + +setenv #NAME#_ROOT "${base}" +setenv #NAME#_VERSION "#VERSION#" + +setenv G2TMPL_INC "${base}/include" +setenv G2TMPL_LIB "${base}/lib/libg2tmpl.a" diff --git a/tmplModulefiles/g2tmpl/g2tmpl.lua b/tmplModulefiles/g2tmpl/g2tmpl.lua deleted file mode 100644 index f2b3a5e..0000000 --- a/tmplModulefiles/g2tmpl/g2tmpl.lua +++ /dev/null @@ -1,15 +0,0 @@ -help([[ -]]) - -local pkgName = myModuleName() -local pkgVersion = myModuleVersion() - -conflict(pkgName) - -local prefix = "#NCEPLIBS_ROOT#" -local base = pathJoin(prefix,pkgName .. '-' .. pkgVersion) - -setenv("g2tmpl_ROOT", base) -setenv("g2tmpl_VERSION", pkgVersion) -setenv("G2TMPL_INC", pathJoin(base,"include")) -setenv("G2TMPL_LIB", pathJoin(base,"lib/libg2tmpl.a")) diff --git a/tmplModulefiles/gfsio/gfsio b/tmplModulefiles/gfsio/gfsio new file mode 100644 index 0000000..14bce37 --- /dev/null +++ b/tmplModulefiles/gfsio/gfsio @@ -0,0 +1,17 @@ +#%Module###################################################################### + +proc ModulesHelp { } { + puts "Set environment variables for #NAME#-#VERSION#" +} + +# Make sure another version of the same package is not already loaded +conflict #NAME# + +# Set environment variables +set base "#NCEPLIBS_ROOT#/#NAME#-#VERSION#" + +setenv #NAME#_ROOT "${base}" +setenv #NAME#_VERSION "#VERSION#" + +setenv GFSIO_INC "${base}/include" +setenv GFSIO_LIB "${base}/lib/libgfsio.a" diff --git a/tmplModulefiles/gfsio/gfsio.lua b/tmplModulefiles/gfsio/gfsio.lua deleted file mode 100644 index b61f0f6..0000000 --- a/tmplModulefiles/gfsio/gfsio.lua +++ /dev/null @@ -1,15 +0,0 @@ -help([[ -]]) - -local pkgName = myModuleName() -local pkgVersion = myModuleVersion() - -conflict(pkgName) - -local prefix = "#NCEPLIBS_ROOT#" -local base = pathJoin(prefix,pkgName .. '-' .. pkgVersion) - -setenv("gfsio_ROOT", base) -setenv("gfsio_VERSION", pkgVersion) -setenv("GFSIO_INC", pathJoin(base,"include")) -setenv("GFSIO_LIB", pathJoin(base,"lib/libgfsio.a")) diff --git a/tmplModulefiles/ip/ip b/tmplModulefiles/ip/ip new file mode 100644 index 0000000..92c6764 --- /dev/null +++ b/tmplModulefiles/ip/ip @@ -0,0 +1,21 @@ +#%Module###################################################################### + +proc ModulesHelp { } { + puts "Set environment variables for #NAME#-#VERSION#" +} + +# Make sure another version of the same package is not already loaded +conflict #NAME# + +# Set environment variables +set base "#NCEPLIBS_ROOT#/#NAME#-#VERSION#" + +setenv #NAME#_ROOT "${base}" +setenv #NAME#_VERSION "#VERSION#" + +setenv IP_INC4 "${base}/include_4" +setenv IP_INC8 "${base}/include_8" +setenv IP_INCd "${base}/include_d" +setenv IP_LIB4 "${base}/lib/libip_4.a" +setenv IP_LIB8 "${base}/lib/libip_8.a" +setenv IP_LIBd "${base}/lib/libip_d.a" diff --git a/tmplModulefiles/ip/ip.lua b/tmplModulefiles/ip/ip.lua deleted file mode 100644 index d21ae08..0000000 --- a/tmplModulefiles/ip/ip.lua +++ /dev/null @@ -1,19 +0,0 @@ -help([[ -]]) - -local pkgName = myModuleName() -local pkgVersion = myModuleVersion() - -conflict(pkgName) - -local prefix = "#NCEPLIBS_ROOT#" -local base = pathJoin(prefix,pkgName .. '-' .. pkgVersion) - -setenv("ip_ROOT", base) -setenv("ip_VERSION", pkgVersion) -setenv("IP_INC4", pathJoin(base,"include_4")) -setenv("IP_INC8", pathJoin(base,"include_8")) -setenv("IP_INCd", pathJoin(base,"include_d")) -setenv("IP_LIB4", pathJoin(base,"lib/libip_4.a")) -setenv("IP_LIB8", pathJoin(base,"lib/libip_8.a")) -setenv("IP_LIBd", pathJoin(base,"lib/libip_d.a")) diff --git a/tmplModulefiles/ip2/ip2 b/tmplModulefiles/ip2/ip2 new file mode 100644 index 0000000..8bbaf28 --- /dev/null +++ b/tmplModulefiles/ip2/ip2 @@ -0,0 +1,21 @@ +#%Module###################################################################### + +proc ModulesHelp { } { + puts "Set environment variables for #NAME#-#VERSION#" +} + +# Make sure another version of the same package is not already loaded +conflict #NAME# + +# Set environment variables +set base "#NCEPLIBS_ROOT#/#NAME#-#VERSION#" + +setenv #NAME#_ROOT "${base}" +setenv #NAME#_VERSION "#VERSION#" + +setenv IP2_INC4 "${base}/include_4" +setenv IP2_INC8 "${base}/include_8" +setenv IP2_INCd "${base}/include_d" +setenv IP2_LIB4 "${base}/lib/libip2_4.a" +setenv IP2_LIB8 "${base}/lib/libip2_8.a" +setenv IP2_LIBd "${base}/lib/libip2_d.a" diff --git a/tmplModulefiles/ip2/ip2.lua b/tmplModulefiles/ip2/ip2.lua deleted file mode 100644 index 756e208..0000000 --- a/tmplModulefiles/ip2/ip2.lua +++ /dev/null @@ -1,19 +0,0 @@ -help([[ -]]) - -local pkgName = myModuleName() -local pkgVersion = myModuleVersion() - -conflict(pkgName) - -local prefix = "#NCEPLIBS_ROOT#" -local base = pathJoin(prefix,pkgName .. '-' .. pkgVersion) - -setenv("ip2_ROOT", base) -setenv("ip2_VERSION", pkgVersion) -setenv("IP2_INC4", pathJoin(base,"include_4")) -setenv("IP2_INC8", pathJoin(base,"include_8")) -setenv("IP2_INCd", pathJoin(base,"include_d")) -setenv("IP2_LIB4", pathJoin(base,"lib/libip2_4.a")) -setenv("IP2_LIB8", pathJoin(base,"lib/libip2_8.a")) -setenv("IP2_LIBd", pathJoin(base,"lib/libip2_d.a")) diff --git a/tmplModulefiles/landsfcutil/landsfcutil b/tmplModulefiles/landsfcutil/landsfcutil new file mode 100644 index 0000000..08de36d --- /dev/null +++ b/tmplModulefiles/landsfcutil/landsfcutil @@ -0,0 +1,19 @@ +#%Module###################################################################### + +proc ModulesHelp { } { + puts "Set environment variables for #NAME#-#VERSION#" +} + +# Make sure another version of the same package is not already loaded +conflict #NAME# + +# Set environment variables +set base "#NCEPLIBS_ROOT#/#NAME#-#VERSION#" + +setenv #NAME#_ROOT "${base}" +setenv #NAME#_VERSION "#VERSION#" + +setenv LANDSFCUTIL_INC4 "${base}/include_4" +setenv LANDSFCUTIL_INCd "${base}/include_d" +setenv LANDSFCUTIL_LIB4 "${base}/lib/liblandsfcutil_4.a" +setenv LANDSFCUTIL_LIBd "${base}/lib/liblandsfcutil_d.a" diff --git a/tmplModulefiles/landsfcutil/landsfcutil.lua b/tmplModulefiles/landsfcutil/landsfcutil.lua deleted file mode 100644 index f6a3674..0000000 --- a/tmplModulefiles/landsfcutil/landsfcutil.lua +++ /dev/null @@ -1,17 +0,0 @@ -help([[ -]]) - -local pkgName = myModuleName() -local pkgVersion = myModuleVersion() - -conflict(pkgName) - -local prefix = "#NCEPLIBS_ROOT#" -local base = pathJoin(prefix,pkgName .. '-' .. pkgVersion) - -setenv("landsfcutil_ROOT", base) -setenv("landsfcutil_VERSION", pkgVersion) -setenv("LANDSFCUTIL_INC4", pathJoin(base,"include_4")) -setenv("LANDSFCUTIL_INCd", pathJoin(base,"include_d")) -setenv("LANDSFCUTIL_LIB4", pathJoin(base,"lib/liblandsfcutil_4.a")) -setenv("LANDSFCUTIL_LIBd", pathJoin(base,"lib/liblandsfcutil_d.a")) diff --git a/tmplModulefiles/nceppost/nceppost b/tmplModulefiles/nceppost/nceppost new file mode 100644 index 0000000..9758313 --- /dev/null +++ b/tmplModulefiles/nceppost/nceppost @@ -0,0 +1,19 @@ +#%Module###################################################################### + +proc ModulesHelp { } { + puts "Set environment variables for #NAME#-#VERSION#" +} + +# Make sure another version of the same package is not already loaded +conflict #NAME# + +# Set environment variables +set base "#NCEPLIBS_ROOT#/#NAME#-#VERSION#" + +setenv #NAME#_ROOT "${base}" +setenv #NAME#_VERSION "#VERSION#" + +setenv NCEPPOST_INC "${base}/include" +setenv NCEPPOST_LIB "${base}/lib/libnceppost.a" +setenv POST_INC "${base}/include" +setenv POST_LIB "${base}/lib/libnceppost.a" diff --git a/tmplModulefiles/nceppost/nceppost.lua b/tmplModulefiles/nceppost/nceppost.lua deleted file mode 100644 index 5e62f6b..0000000 --- a/tmplModulefiles/nceppost/nceppost.lua +++ /dev/null @@ -1,17 +0,0 @@ -help([[ -]]) - -local pkgName = myModuleName() -local pkgVersion = myModuleVersion() - -conflict(pkgName) - -local prefix = "#NCEPLIBS_ROOT#" -local base = pathJoin(prefix,pkgName .. '-' .. pkgVersion) - -setenv("nceppost_ROOT", base) -setenv("nceppost_VERSION", pkgVersion) -setenv("NCEPPOST_INC", pathJoin(base,"include")) -setenv("NCEPPOST_LIB", pathJoin(base,"lib/libnceppost.a")) -setenv("POST_INC", pathJoin(base,"include")) -setenv("POST_LIB", pathJoin(base,"lib/libnceppost.a")) diff --git a/tmplModulefiles/nemsio/nemsio b/tmplModulefiles/nemsio/nemsio new file mode 100644 index 0000000..cef578d --- /dev/null +++ b/tmplModulefiles/nemsio/nemsio @@ -0,0 +1,18 @@ +#%Module###################################################################### + +proc ModulesHelp { } { + puts "Set environment variables for #NAME#-#VERSION#" +} + +# Make sure another version of the same package is not already loaded +conflict #NAME# + +# Set environment variables +set base "#NCEPLIBS_ROOT#/#NAME#-#VERSION#" + +setenv #NAME#_ROOT "${base}" +setenv #NAME#_VERSION "#VERSION#" + +setenv NEMSIO_INC "${base}/include" +setenv NEMSIO_LIB "${base}/lib/libnemsio.a" +prepend-path PATH "${base}/bin" diff --git a/tmplModulefiles/nemsio/nemsio.lua b/tmplModulefiles/nemsio/nemsio.lua deleted file mode 100644 index 5b3e5fa..0000000 --- a/tmplModulefiles/nemsio/nemsio.lua +++ /dev/null @@ -1,16 +0,0 @@ -help([[ -]]) - -local pkgName = myModuleName() -local pkgVersion = myModuleVersion() - -conflict(pkgName) - -local prefix = "#NCEPLIBS_ROOT#" -local base = pathJoin(prefix,pkgName .. '-' .. pkgVersion) - -setenv("nemsio_ROOT", base) -setenv("nemsio_VERSION", pkgVersion) -setenv("NEMSIO_INC", pathJoin(base,"include")) -setenv("NEMSIO_LIB", pathJoin(base,"lib/libnemsio.a")) -prepend_path("PATH", pathJoin(base,"bin")) diff --git a/tmplModulefiles/nemsiogfs/nemsiogfs b/tmplModulefiles/nemsiogfs/nemsiogfs new file mode 100644 index 0000000..379bfbb --- /dev/null +++ b/tmplModulefiles/nemsiogfs/nemsiogfs @@ -0,0 +1,17 @@ +#%Module###################################################################### + +proc ModulesHelp { } { + puts "Set environment variables for #NAME#-#VERSION#" +} + +# Make sure another version of the same package is not already loaded +conflict #NAME# + +# Set environment variables +set base "#NCEPLIBS_ROOT#/#NAME#-#VERSION#" + +setenv #NAME#_ROOT "${base}" +setenv #NAME#_VERSION "#VERSION#" + +setenv NEMSIOGFS_INC "${base}/include" +setenv NEMSIOGFS_LIB "${base}/lib/libnemsiogfs.a" diff --git a/tmplModulefiles/nemsiogfs/nemsiogfs.lua b/tmplModulefiles/nemsiogfs/nemsiogfs.lua deleted file mode 100644 index 0348ee8..0000000 --- a/tmplModulefiles/nemsiogfs/nemsiogfs.lua +++ /dev/null @@ -1,15 +0,0 @@ -help([[ -]]) - -local pkgName = myModuleName() -local pkgVersion = myModuleVersion() - -conflict(pkgName) - -local prefix = "#NCEPLIBS_ROOT#" -local base = pathJoin(prefix,pkgName .. '-' .. pkgVersion) - -setenv("nemsiogfs_ROOT", base) -setenv("nemsiogfs_VERSION", pkgVersion) -setenv("NEMSIOGFS_INC", pathJoin(base,"include")) -setenv("NEMSIOGFS_LIB", pathJoin(base,"lib/libnemsiogfs.a")) diff --git a/tmplModulefiles/sfcio/sfcio b/tmplModulefiles/sfcio/sfcio new file mode 100644 index 0000000..d9be6e3 --- /dev/null +++ b/tmplModulefiles/sfcio/sfcio @@ -0,0 +1,17 @@ +#%Module###################################################################### + +proc ModulesHelp { } { + puts "Set environment variables for #NAME#-#VERSION#" +} + +# Make sure another version of the same package is not already loaded +conflict #NAME# + +# Set environment variables +set base "#NCEPLIBS_ROOT#/#NAME#-#VERSION#" + +setenv #NAME#_ROOT "${base}" +setenv #NAME#_VERSION "#VERSION#" + +setenv SFCIO_INC "${base}/include" +setenv SFCIO_LIB "${base}/lib/libsfcio.a" diff --git a/tmplModulefiles/sfcio/sfcio.lua b/tmplModulefiles/sfcio/sfcio.lua deleted file mode 100644 index 4322b1f..0000000 --- a/tmplModulefiles/sfcio/sfcio.lua +++ /dev/null @@ -1,15 +0,0 @@ -help([[ -]]) - -local pkgName = myModuleName() -local pkgVersion = myModuleVersion() - -conflict(pkgName) - -local prefix = "#NCEPLIBS_ROOT#" -local base = pathJoin(prefix,pkgName .. '-' .. pkgVersion) - -setenv("sfcio_ROOT", base) -setenv("sfcio_VERSION", pkgVersion) -setenv("SFCIO_INC", pathJoin(base,"include")) -setenv("SFCIO_LIB", pathJoin(base,"lib/libsfcio.a")) diff --git a/tmplModulefiles/sigio/sigio b/tmplModulefiles/sigio/sigio new file mode 100644 index 0000000..32c9e05 --- /dev/null +++ b/tmplModulefiles/sigio/sigio @@ -0,0 +1,17 @@ +#%Module###################################################################### + +proc ModulesHelp { } { + puts "Set environment variables for #NAME#-#VERSION#" +} + +# Make sure another version of the same package is not already loaded +conflict #NAME# + +# Set environment variables +set base "#NCEPLIBS_ROOT#/#NAME#-#VERSION#" + +setenv #NAME#_ROOT "${base}" +setenv #NAME#_VERSION "#VERSION#" + +setenv SIGIO_INC "${base}/include" +setenv SIGIO_LIB "${base}/lib/libsigio.a" diff --git a/tmplModulefiles/sigio/sigio.lua b/tmplModulefiles/sigio/sigio.lua deleted file mode 100644 index 1d880a0..0000000 --- a/tmplModulefiles/sigio/sigio.lua +++ /dev/null @@ -1,15 +0,0 @@ -help([[ -]]) - -local pkgName = myModuleName() -local pkgVersion = myModuleVersion() - -conflict(pkgName) - -local prefix = "#NCEPLIBS_ROOT#" -local base = pathJoin(prefix,pkgName .. '-' .. pkgVersion) - -setenv("sigio_ROOT", base) -setenv("sigio_VERSION", pkgVersion) -setenv("SIGIO_INC", pathJoin(base,"include")) -setenv("SIGIO_LIB", pathJoin(base,"lib/libsigio.a")) diff --git a/tmplModulefiles/sp/sp b/tmplModulefiles/sp/sp new file mode 100644 index 0000000..203bf09 --- /dev/null +++ b/tmplModulefiles/sp/sp @@ -0,0 +1,21 @@ +#%Module###################################################################### + +proc ModulesHelp { } { + puts "Set environment variables for #NAME#-#VERSION#" +} + +# Make sure another version of the same package is not already loaded +conflict #NAME# + +# Set environment variables +set base "#NCEPLIBS_ROOT#/#NAME#-#VERSION#" + +setenv #NAME#_ROOT "${base}" +setenv #NAME#_VERSION "#VERSION#" + +setenv SP_INC4 "${base}/include_4" +setenv SP_INC8 "${base}/include_8" +setenv SP_INCd "${base}/include_d" +setenv SP_LIB4 "${base}/lib/libsp_4.a" +setenv SP_LIB8 "${base}/lib/libsp_8.a" +setenv SP_LIBd "${base}/lib/libsp_d.a" diff --git a/tmplModulefiles/sp/sp.lua b/tmplModulefiles/sp/sp.lua deleted file mode 100644 index 8dc52d3..0000000 --- a/tmplModulefiles/sp/sp.lua +++ /dev/null @@ -1,19 +0,0 @@ -help([[ -]]) - -local pkgName = myModuleName() -local pkgVersion = myModuleVersion() - -conflict(pkgName) - -local prefix = "#NCEPLIBS_ROOT#" -local base = pathJoin(prefix,pkgName .. '-' .. pkgVersion) - -setenv("sp_ROOT", base) -setenv("sp_VERSION", pkgVersion) -setenv("SP_INC4", pathJoin(base,"include_4")) -setenv("SP_INC8", pathJoin(base,"include_8")) -setenv("SP_INCd", pathJoin(base,"include_d")) -setenv("SP_LIB4", pathJoin(base,"lib/libsp_4.a")) -setenv("SP_LIB8", pathJoin(base,"lib/libsp_8.a")) -setenv("SP_LIBd", pathJoin(base,"lib/libsp_d.a")) diff --git a/tmplModulefiles/w3emc/w3emc b/tmplModulefiles/w3emc/w3emc new file mode 100644 index 0000000..67644bf --- /dev/null +++ b/tmplModulefiles/w3emc/w3emc @@ -0,0 +1,21 @@ +#%Module###################################################################### + +proc ModulesHelp { } { + puts "Set environment variables for #NAME#-#VERSION#" +} + +# Make sure another version of the same package is not already loaded +conflict #NAME# + +# Set environment variables +set base "#NCEPLIBS_ROOT#/#NAME#-#VERSION#" + +setenv #NAME#_ROOT "${base}" +setenv #NAME#_VERSION "#VERSION#" + +setenv W3EMC_INC4 "${base}/include_4" +setenv W3EMC_INC8 "${base}/include_8" +setenv W3EMC_INCd "${base}/include_d" +setenv W3EMC_LIB4 "${base}/lib/libw3emc_4.a" +setenv W3EMC_LIB8 "${base}/lib/libw3emc_8.a" +setenv W3EMC_LIBd "${base}/lib/libw3emc_d.a" diff --git a/tmplModulefiles/w3emc/w3emc.lua b/tmplModulefiles/w3emc/w3emc.lua deleted file mode 100644 index a556374..0000000 --- a/tmplModulefiles/w3emc/w3emc.lua +++ /dev/null @@ -1,19 +0,0 @@ -help([[ -]]) - -local pkgName = myModuleName() -local pkgVersion = myModuleVersion() - -conflict(pkgName) - -local prefix = "#NCEPLIBS_ROOT#" -local base = pathJoin(prefix,pkgName .. '-' .. pkgVersion) - -setenv("w3emc_ROOT", base) -setenv("w3emc_VERSION", pkgVersion) -setenv("W3EMC_INC4", pathJoin(base,"include_4")) -setenv("W3EMC_INC8", pathJoin(base,"include_8")) -setenv("W3EMC_INCd", pathJoin(base,"include_d")) -setenv("W3EMC_LIB4", pathJoin(base,"lib/libw3emc_4.a")) -setenv("W3EMC_LIB8", pathJoin(base,"lib/libw3emc_8.a")) -setenv("W3EMC_LIBd", pathJoin(base,"lib/libw3emc_d.a")) diff --git a/tmplModulefiles/w3nco/w3nco b/tmplModulefiles/w3nco/w3nco new file mode 100644 index 0000000..0d70c1d --- /dev/null +++ b/tmplModulefiles/w3nco/w3nco @@ -0,0 +1,21 @@ +#%Module###################################################################### + +proc ModulesHelp { } { + puts "Set environment variables for #NAME#-#VERSION#" +} + +# Make sure another version of the same package is not already loaded +conflict #NAME# + +# Set environment variables +set base "#NCEPLIBS_ROOT#/#NAME#-#VERSION#" + +setenv #NAME#_ROOT "${base}" +setenv #NAME#_VERSION "#VERSION#" + +setenv W3NCO_INC4 "${base}/include_4" +setenv W3NCO_INC8 "${base}/include_8" +setenv W3NCO_INCd "${base}/include_d" +setenv W3NCO_LIB4 "${base}/lib/libw3nco_4.a" +setenv W3NCO_LIB8 "${base}/lib/libw3nco_8.a" +setenv W3NCO_LIBd "${base}/lib/libw3nco_d.a" diff --git a/tmplModulefiles/w3nco/w3nco.lua b/tmplModulefiles/w3nco/w3nco.lua deleted file mode 100644 index 74565a9..0000000 --- a/tmplModulefiles/w3nco/w3nco.lua +++ /dev/null @@ -1,19 +0,0 @@ -help([[ -]]) - -local pkgName = myModuleName() -local pkgVersion = myModuleVersion() - -conflict(pkgName) - -local prefix = "#NCEPLIBS_ROOT#" -local base = pathJoin(prefix,pkgName .. '-' .. pkgVersion) - -setenv("w3nco_ROOT", base) -setenv("w3nco_VERSION", pkgVersion) -setenv("W3NCO_INC4", pathJoin(base,"include_4")) -setenv("W3NCO_INC8", pathJoin(base,"include_8")) -setenv("W3NCO_INCd", pathJoin(base,"include_d")) -setenv("W3NCO_LIB4", pathJoin(base,"lib/libw3nco_4.a")) -setenv("W3NCO_LIB8", pathJoin(base,"lib/libw3nco_8.a")) -setenv("W3NCO_LIBd", pathJoin(base,"lib/libw3nco_d.a")) diff --git a/tmplModulefiles/wgrib2/wgrib2 b/tmplModulefiles/wgrib2/wgrib2 new file mode 100644 index 0000000..969c573 --- /dev/null +++ b/tmplModulefiles/wgrib2/wgrib2 @@ -0,0 +1,19 @@ +#%Module###################################################################### + +proc ModulesHelp { } { + puts "Set environment variables for #NAME#-#VERSION#" +} + +# Make sure another version of the same package is not already loaded +conflict #NAME# + +# Set environment variables +set base "#NCEPLIBS_ROOT#/#NAME#-#VERSION#" + +setenv #NAME#_ROOT "${base}" +setenv #NAME#_VERSION "#VERSION#" + +setenv WGRIB2_INC "${base}/include" +setenv WGRIB_LIB "${base}/lib/libwgrib2.a" +setenv WGRIB2_LIBAPI "${base}/lib/libwgrib2_api.a" +prepend-path PATH "${base}/bin" diff --git a/tmplModulefiles/wgrib2/wgrib2.lua b/tmplModulefiles/wgrib2/wgrib2.lua deleted file mode 100644 index e63937b..0000000 --- a/tmplModulefiles/wgrib2/wgrib2.lua +++ /dev/null @@ -1,18 +0,0 @@ -help([[ -]]) - -local pkgName = myModuleName() -local pkgVersion = myModuleVersion() - -conflict(pkgName) - -local prefix = "#NCEPLIBS_ROOT#" -local base = pathJoin(prefix,pkgName .. '-' .. pkgVersion) - -setenv("wgrib2_ROOT", base) -setenv("wgrib2_VERSION", pkgVersion) -setenv("WGRIB2_INC", pathJoin(base,"include")) -setenv("WGRIB_LIB", pathJoin(base,"lib/libwgrib2.a")) -setenv("WGRIB2_LIBAPI", pathJoin(base,"lib/libwgrib2_api.a")) - -prepend_path("PATH", pathJoin(base,"bin")) \ No newline at end of file diff --git a/tmplModulefiles/wrf_io/wrf_io b/tmplModulefiles/wrf_io/wrf_io new file mode 100644 index 0000000..de2875e --- /dev/null +++ b/tmplModulefiles/wrf_io/wrf_io @@ -0,0 +1,17 @@ +#%Module###################################################################### + +proc ModulesHelp { } { + puts "Set environment variables for #NAME#-#VERSION#" +} + +# Make sure another version of the same package is not already loaded +conflict #NAME# + +# Set environment variables +set base "#NCEPLIBS_ROOT#/#NAME#-#VERSION#" + +setenv #NAME#_ROOT "${base}" +setenv #NAME#_VERSION "#VERSION#" + +setenv WRF_IO_INC "${base}/include" +setenv WRF_IO_LIB "${base}/lib/libwrf_io.a" diff --git a/tmplModulefiles/wrf_io/wrf_io.lua b/tmplModulefiles/wrf_io/wrf_io.lua deleted file mode 100644 index a145ff7..0000000 --- a/tmplModulefiles/wrf_io/wrf_io.lua +++ /dev/null @@ -1,15 +0,0 @@ -help([[ -]]) - -local pkgName = myModuleName() -local pkgVersion = myModuleVersion() - -conflict(pkgName) - -local prefix = "#NCEPLIBS_ROOT#" -local base = pathJoin(prefix,pkgName .. '-' .. pkgVersion) - -setenv("wrf_io_ROOT", base) -setenv("wrf_io_VERSION", pkgVersion) -setenv("WRF_IO_INC", pathJoin(base,"include")) -setenv("WRF_IO_LIB", pathJoin(base,"lib/libwrf_io.a")) From 1f2a426d6b0f09f066a6c894e54eb534e5735258 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Wed, 21 Oct 2020 07:32:35 -0600 Subject: [PATCH 5/8] Add submodule CMakeModules for FindESMF.cmake, remove lua2tcl logic, updates of umbrella module and shell scripts --- .gitmodules | 3 ++ CMakeLists.txt | 15 +++--- CMakeModules | 1 + deploy_modulefiles.sh.in | 58 +++++++++++++------- lua2tcl.py | 89 ------------------------------- tmplModulefiles/NCEPLIBS/NCEPLIBS | 2 + 6 files changed, 53 insertions(+), 115 deletions(-) create mode 160000 CMakeModules delete mode 100755 lua2tcl.py diff --git a/.gitmodules b/.gitmodules index e69de29..39ccdcb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "CMakeModules"] + path = CMakeModules + url = https://github.com/NOAA-EMC/CMakeModules diff --git a/CMakeLists.txt b/CMakeLists.txt index ea9d716..69c45cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,6 +11,8 @@ project( include(ExternalProject) include(GNUInstallDirs) +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeModules/Modules/") + if(NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel)$") message(STATUS "Setting build type to 'Release' as none was specified.") set(CMAKE_BUILD_TYPE @@ -33,7 +35,6 @@ option(ENABLE_TESTS "Enable testing" OFF) option(BUILD_CRTM "Build CRTM library" ON) option(BUILD_POST "Build NCEPpost library" ON) option(DEPLOY "Deploy modulefiles/shellscripts" ON) -option(TCLMOD "Create Tcl modulefiles " OFF) option(FLAT "Flat install structure" ON) option(LIBCOMPS "File to read components from" ${DEFAULT_LIBCOMPS}) option(DOWNLOAD_ONLY "Just download the components" OFF) @@ -263,12 +264,14 @@ add_custom_target(prep2deploy ALL # Deploy modulefiles and shell scripts (if enabled), but do not add to make all (make user do it) if(DEPLOY) + # Find ESMF so that ESMFMKFILE can be added to the + # umbrella module file and the umbrella shell scripts + find_package(ESMF REQUIRED) + if (NOT ESMF_FOUND) + message(FATAL_ERROR "ESMF not found, abort") + endif() + # add_custom_target(deploy COMMAND ${CMAKE_CURRENT_BINARY_DIR}/deploy_modulefiles.sh) add_dependencies(deploy prep2deploy) - if(TCLMOD) - add_custom_target(tcl - COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/lua2tcl.py ${CMAKE_INSTALL_PREFIX}/modules) - add_dependencies(tcl deploy) - endif() endif() diff --git a/CMakeModules b/CMakeModules new file mode 160000 index 0000000..1865869 --- /dev/null +++ b/CMakeModules @@ -0,0 +1 @@ +Subproject commit 18658695a0b87ad6fcf33982b9cb13e6d7373911 diff --git a/deploy_modulefiles.sh.in b/deploy_modulefiles.sh.in index d8137ae..c11662f 100755 --- a/deploy_modulefiles.sh.in +++ b/deploy_modulefiles.sh.in @@ -14,13 +14,6 @@ DFLAT="@FLAT@" [[ $DFLAT == "ON" ]] && FLAT="Y" || FLAT="N" -# Account for differences in the sed command on Linux and macOS -if [[ "@CMAKE_SYSTEM_NAME@" == "Darwin" ]]; then - sedI="-i ''" -else - sedI="-i" -fi - # All module load commands for the umbrella module moduleLoadCommands="" @@ -45,8 +38,8 @@ for libName in $(ls -1 $tmplModulefilesDir); do # Define source and destination modulefile name # Destination filename must be consistent with CMakeLists.txt - srcModulefile=$tmplModulefilesDir/$libName/$libName.lua - dstModulefile=$modulesDestDir/$libName/$ver.lua + srcModulefile=$tmplModulefilesDir/$libName/$libName + dstModulefile=$modulesDestDir/$libName/$ver # Create destination directory for the modulefile and copy template to it mkdir -p $modulesDestDir/$libName @@ -54,12 +47,18 @@ for libName in $(ls -1 $tmplModulefilesDir); do [[ $FLAT =~ [YyTt] ]] && prefix=${nceplibsInstallDir} || prefix=${nceplibsInstallDir}/$libName + # Replace #NAME# and #VERSION# + sed -i -e "s/#NAME#/${libName}/g" $dstModulefile + sed -i -e "s/#VERSION#/${ver}/g" $dstModulefile + # sed does not like delimiter (/) to be a part of replacement string - # so do magic repl=$(echo ${prefix} | sed -e "s#/#\\\/#g") # Replace #NCEPLIBS_ROOT# from template with $nceplibsInstallDir - sed $sedI -e "s/#NCEPLIBS_ROOT#/${repl}/g" $dstModulefile + sed -i -e "s/#NCEPLIBS_ROOT#/${repl}/g" $dstModulefile + + # Workaround for macOS: remove files created because of differing sed syntax + rm -f ${dstModulefile}-e # Add to module load commands for umbrella module moduleLoadCommands="${moduleLoadCommands} @@ -74,26 +73,37 @@ setenv ${libName}_ROOT \"${prefix}\"" done # Create NCEPLIBS umbrella module file -srcModulefile=$tmplModulefilesDir/NCEPLIBS/nceplibs.lua -dstModulefile=$modulesDestDir/NCEPLIBS/${NCEPLIBS_VERSION}.lua +srcModulefile=$tmplModulefilesDir/NCEPLIBS/nceplibs +dstModulefile=$modulesDestDir/NCEPLIBS/${NCEPLIBS_VERSION} mkdir -p $modulesDestDir/NCEPLIBS \cp $srcModulefile $dstModulefile -# Replace #NCEPLIBS_ROOT# from template with $nceplibsInstallDir +# Replace #NAME# and #VERSION# +sed -i -e "s/#NAME#/NCEPLIBS/g" $dstModulefile +sed -i -e "s/#VERSION#/${NCEPLIBS_VERSION}/g" $dstModulefile + +# sed does not like delimiter (/) to be a part of replacement string repl=$(echo ${nceplibsInstallDir} | sed -e "s#/#\\\/#g") -sed $sedI -e "s/#NCEPLIBS_ROOT#/${repl}/g" $dstModulefile + +# Replace #NCEPLIBS_ROOT# from template with $nceplibsInstallDir +sed -i -e "s/#NCEPLIBS_ROOT#/${repl}/g" $dstModulefile # Set compiler environment variables for the umbrella modulefile repl=$(echo "@CMAKE_C_COMPILER@" | sed -e "s#/#\\\/#g") -sed $sedI -e "s/#CC#/${repl}/g" $dstModulefile +sed -i -e "s/#CC#/${repl}/g" $dstModulefile repl=$(echo "@CMAKE_CXX_COMPILER@" | sed -e "s#/#\\\/#g") -sed $sedI -e "s/#CXX#/${repl}/g" $dstModulefile +sed -i -e "s/#CXX#/${repl}/g" $dstModulefile repl=$(echo "@CMAKE_Fortran_COMPILER@" | sed -e "s#/#\\\/#g") -sed $sedI -e "s/#FC#/${repl}/g" $dstModulefile +sed -i -e "s/#FC#/${repl}/g" $dstModulefile +repl=$(echo "@ESMFMKFILE@" | sed -e "s#/#\\\/#g") +sed -i -e "s/#ESMFMKFILE#/${repl}/g" $dstModulefile # Append all module load commands to umbrella module echo "${moduleLoadCommands}" >> $dstModulefile +# Workaround for macOS: remove files created because of differing sed syntax +rm -f ${dstModulefile}-e + echo "Done deploying modules ..." echo "Generating shell scripts ..." @@ -105,11 +115,19 @@ tcshScript="@CMAKE_INSTALL_PREFIX@/bin/setenv_nceplibs.csh" bashScriptContents="${bashScriptContents} export CC=\"@CMAKE_C_COMPILER@\" export CXX=\"@CMAKE_CXX_COMPILER@\" -export FC=\"@CMAKE_Fortran_COMPILER@\"" +export FC=\"@CMAKE_Fortran_COMPILER@\" +export CMAKE_PREFIX_PATH=\"@CMAKE_PREFIX_PATH@\${CMAKE_PREFIX_PATH:+:\$CMAKE_PREFIX_PATH}\" +export ESMFMKFILE=\"@ESMFMKFILE@\"" tcshScriptContents="${tcshScriptContents} setenv CC \"@CMAKE_C_COMPILER@\" setenv CXX \"@CMAKE_CXX_COMPILER@\" -setenv FC \"@CMAKE_Fortran_COMPILER@\"" +setenv FC \"@CMAKE_Fortran_COMPILER@\" +if (! \$?CMAKE_PREFIX_PATH) then + setenv CMAKE_PREFIX_PATH \"@CMAKE_PREFIX_PATH@\" +else + setenv CMAKE_PREFIX_PATH \"@CMAKE_PREFIX_PATH@:\${CMAKE_PREFIX_PATH}\" +endif +setenv ESMFMKFILE \"@ESMFMKFILE@\"" echo "${bashScript}" echo "${bashScriptContents}" > $bashScript diff --git a/lua2tcl.py b/lua2tcl.py deleted file mode 100755 index a3ad12b..0000000 --- a/lua2tcl.py +++ /dev/null @@ -1,89 +0,0 @@ -#!/usr/bin/env python - -import os -import re -import sys - -""" -This script converts the NCEPLIBS lua modules into tcl modules for dinosaur systems -that do not know how to handle lua modules in the 21st century. This script is not -a general tool to convert lua modulefiles to tcl modules. It only works for the -auto-generated lua modulefiles of the NCEPLIBS umbrella build. -""" - -basedir=sys.argv[1] - -TCL_TEMPLATE="""#%Module###################################################################### - -proc ModulesHelp {{ }} {{ - puts "Set environment variables for {name}-{version}" -}} - -# Make sure another version of the same package is not already loaded -conflict {name} - -# Set environment variables -set base {base} - -setenv {name}_ROOT "${{base}}" -setenv {name}_VERSION "{version}" - -{setenv_commands} -{module_commands} -""" - -for root,dirs,files in os.walk(basedir): - for file in files: - if file.endswith(".lua"): - version = file.rstrip(".lua") - name = os.path.split(root)[1] - infile = os.path.join(root,file) - outfile = os.path.join(root,file.rstrip(".lua")) - print("Converting {} to {} ...".format(infile, outfile)) - with open(infile) as f: - lua_in = f.readlines() - prefix = None - base = None - setenv_commands = '' - module_commands = '' - for line_in in lua_in: - line = line_in.rstrip('\n') - if line.startswith("local prefix = \""): - prefix = line.lstrip("local prefix = \"").rstrip("\"") - base = os.path.join(prefix,"{name}-{version}".format(name=name, version=version)) - elif line.startswith("setenv"): - if line == 'setenv("{name}_ROOT", base)'.format(name=name): - continue - elif line == 'setenv("{name}_ROOT", prefix)'.format(name=name): - continue - elif line == 'setenv("{name}_VERSION", pkgVersion)'.format(name=name): - continue - else: - # Match lines like the following - # setenv("BACIO_LIB8", pathJoin(base,"lib/libbacio_8.a")) - match = re.match('^setenv\("(\w+)",\s+pathJoin\(base,"(.+)"\)\)$', line) - if match: - envvar = match.group(1) - value = match.group(2) - path = '${base}' + '/' + value - setenv_commands += 'setenv {envvar} "{path}"\n'.format(envvar=envvar, path=path) - else: - # Match lines like the following - # setenv("CC", "/usr/local/bin/gcc-9") - match = re.match('^setenv\("(\w+)",\s+"(.+)"\)$', line) - if match: - envvar = match.group(1) - value = match.group(2) - setenv_commands += 'setenv {envvar} "{value}"\n'.format(envvar=envvar, value=value) - else: - raise Exception("Error while parsing line '{}' in {}".format(line, infile)) - elif line.startswith("module"): - module_commands += '{line}\n'.format(line=line) - - tcl_out = TCL_TEMPLATE.format(name=name, version=version, base=base, - setenv_commands=setenv_commands, - module_commands=module_commands) - if os.path.isfile(outfile): - os.remove(outfile) - with open(outfile, "w") as f: - f.write(tcl_out) diff --git a/tmplModulefiles/NCEPLIBS/NCEPLIBS b/tmplModulefiles/NCEPLIBS/NCEPLIBS index fd1c88e..2e2fff7 100644 --- a/tmplModulefiles/NCEPLIBS/NCEPLIBS +++ b/tmplModulefiles/NCEPLIBS/NCEPLIBS @@ -16,4 +16,6 @@ setenv CC "#CC#" setenv CXX "#CXX#" setenv FC "#FC#" +setenv ESMFMKFILE "#ESMFMKFILE#" + # Module load commands From c22d27d3a5a45b100ce04a3cfc07984002a4319a Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Wed, 21 Oct 2020 08:56:48 -0600 Subject: [PATCH 6/8] Add PATH entry to umbrella module and shell scripts --- deploy_modulefiles.sh.in | 2 ++ tmplModulefiles/NCEPLIBS/NCEPLIBS | 1 + 2 files changed, 3 insertions(+) diff --git a/deploy_modulefiles.sh.in b/deploy_modulefiles.sh.in index c11662f..8232007 100755 --- a/deploy_modulefiles.sh.in +++ b/deploy_modulefiles.sh.in @@ -116,12 +116,14 @@ bashScriptContents="${bashScriptContents} export CC=\"@CMAKE_C_COMPILER@\" export CXX=\"@CMAKE_CXX_COMPILER@\" export FC=\"@CMAKE_Fortran_COMPILER@\" +export PATH=\"@CMAKE_PREFIX_PATH@:\${PATH}\" export CMAKE_PREFIX_PATH=\"@CMAKE_PREFIX_PATH@\${CMAKE_PREFIX_PATH:+:\$CMAKE_PREFIX_PATH}\" export ESMFMKFILE=\"@ESMFMKFILE@\"" tcshScriptContents="${tcshScriptContents} setenv CC \"@CMAKE_C_COMPILER@\" setenv CXX \"@CMAKE_CXX_COMPILER@\" setenv FC \"@CMAKE_Fortran_COMPILER@\" +setenv PATH \"@CMAKE_PREFIX_PATH@:\${PATH}\" if (! \$?CMAKE_PREFIX_PATH) then setenv CMAKE_PREFIX_PATH \"@CMAKE_PREFIX_PATH@\" else diff --git a/tmplModulefiles/NCEPLIBS/NCEPLIBS b/tmplModulefiles/NCEPLIBS/NCEPLIBS index 2e2fff7..987ff43 100644 --- a/tmplModulefiles/NCEPLIBS/NCEPLIBS +++ b/tmplModulefiles/NCEPLIBS/NCEPLIBS @@ -11,6 +11,7 @@ setenv #NAME#_ROOT "#NCEPLIBS_ROOT#" setenv #NAME#_VERSION "#VERSION#" prepend-path CMAKE_PREFIX_PATH "#NCEPLIBS_ROOT#" +prepend-path PATH "#NCEPLIBS_ROOT#/bin" setenv CC "#CC#" setenv CXX "#CXX#" From 3bc743aaba2c57b1ae9e4e32f04f7dc140b38428 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Wed, 21 Oct 2020 11:33:45 -0600 Subject: [PATCH 7/8] Add NETCDF to umbrella module and shell scripts --- CMakeLists.txt | 29 +++++++++++++++++------------ deploy_modulefiles.sh.in | 10 ++++++++-- tmplModulefiles/NCEPLIBS/NCEPLIBS | 1 + 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 69c45cf..835c9b8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,7 +63,7 @@ endif() # Deploy modulefile if requested if(DEPLOY) - message(STATUS "Installing NCEPLIBS modulefiles at ${CMAKE_INSTALL_PREFIX}/modules, NCEPLIBs shell scripts at ${CMAKE_INSTALL_PREFIX}/bin") + message(STATUS "Installing NCEPLIBS modulefiles at ${CMAKE_INSTALL_PREFIX}/modules, NCEPLIBS shell scripts at ${CMAKE_INSTALL_PREFIX}/bin") endif() function(trapLocalError sourceDir) @@ -253,24 +253,29 @@ if(DOWNLOAD_ONLY) add_dependencies(tarball ${_comps}) endif() -# Prepare to deploy -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/deploy_modulefiles.sh.in - ${CMAKE_CURRENT_BINARY_DIR}/deploy_modulefiles.sh - @ONLY) - -add_custom_target(prep2deploy ALL - COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/deploy_modulefiles.sh - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/deploy_modulefiles.sh) - -# Deploy modulefiles and shell scripts (if enabled), but do not add to make all (make user do it) if(DEPLOY) + # Find NetCDF so that NETCDF can be added to the + # umbrella module file and the umbrella shell scripts + find_package(NetCDF REQUIRED COMPONENTS C Fortran) + execute_process(COMMAND ${NetCDF_Fortran_CONFIG_EXECUTABLE} --prefix + OUTPUT_VARIABLE NetCDF_ROOT OUTPUT_STRIP_TRAILING_WHITESPACE) + message(STATUS "Found NetCDF: ${NetCDF_ROOT}") # Find ESMF so that ESMFMKFILE can be added to the # umbrella module file and the umbrella shell scripts find_package(ESMF REQUIRED) if (NOT ESMF_FOUND) message(FATAL_ERROR "ESMF not found, abort") endif() - # + + # Prepare to deploy + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/deploy_modulefiles.sh.in + ${CMAKE_CURRENT_BINARY_DIR}/deploy_modulefiles.sh + @ONLY) + add_custom_target(prep2deploy ALL + COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/deploy_modulefiles.sh + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/deploy_modulefiles.sh) + + # Deploy modulefiles and shell scripts (if enabled), but do not add to make all (make user do it) add_custom_target(deploy COMMAND ${CMAKE_CURRENT_BINARY_DIR}/deploy_modulefiles.sh) add_dependencies(deploy prep2deploy) diff --git a/deploy_modulefiles.sh.in b/deploy_modulefiles.sh.in index 8232007..d616c13 100755 --- a/deploy_modulefiles.sh.in +++ b/deploy_modulefiles.sh.in @@ -18,8 +18,10 @@ DFLAT="@FLAT@" moduleLoadCommands="" # All export statements for the umbrella shell scripts -bashScriptContents="#!/bin/bash" -tcshScriptContents="#!/bin/tcsh" +bashScriptContents="#!/bin/bash +echo \"Setting environment variables for ufs-srweather-app/ufs-weather-model\"" +tcshScriptContents="#!/bin/tcsh +echo \"Setting environment variables for ufs-srweather-app/ufs-weather-model\"" echo "Begin deploying modules ..." @@ -95,6 +97,8 @@ repl=$(echo "@CMAKE_CXX_COMPILER@" | sed -e "s#/#\\\/#g") sed -i -e "s/#CXX#/${repl}/g" $dstModulefile repl=$(echo "@CMAKE_Fortran_COMPILER@" | sed -e "s#/#\\\/#g") sed -i -e "s/#FC#/${repl}/g" $dstModulefile +repl=$(echo "@NetCDF_ROOT@" | sed -e "s#/#\\\/#g") +sed -i -e "s/#NETCDF#/${repl}/g" $dstModulefile repl=$(echo "@ESMFMKFILE@" | sed -e "s#/#\\\/#g") sed -i -e "s/#ESMFMKFILE#/${repl}/g" $dstModulefile @@ -118,6 +122,7 @@ export CXX=\"@CMAKE_CXX_COMPILER@\" export FC=\"@CMAKE_Fortran_COMPILER@\" export PATH=\"@CMAKE_PREFIX_PATH@:\${PATH}\" export CMAKE_PREFIX_PATH=\"@CMAKE_PREFIX_PATH@\${CMAKE_PREFIX_PATH:+:\$CMAKE_PREFIX_PATH}\" +export NETCDF=\"@NetCDF_ROOT@\" export ESMFMKFILE=\"@ESMFMKFILE@\"" tcshScriptContents="${tcshScriptContents} setenv CC \"@CMAKE_C_COMPILER@\" @@ -129,6 +134,7 @@ if (! \$?CMAKE_PREFIX_PATH) then else setenv CMAKE_PREFIX_PATH \"@CMAKE_PREFIX_PATH@:\${CMAKE_PREFIX_PATH}\" endif +setenv NETCDF \"@NetCDF_ROOT@\" setenv ESMFMKFILE \"@ESMFMKFILE@\"" echo "${bashScript}" diff --git a/tmplModulefiles/NCEPLIBS/NCEPLIBS b/tmplModulefiles/NCEPLIBS/NCEPLIBS index 987ff43..50459e0 100644 --- a/tmplModulefiles/NCEPLIBS/NCEPLIBS +++ b/tmplModulefiles/NCEPLIBS/NCEPLIBS @@ -17,6 +17,7 @@ setenv CC "#CC#" setenv CXX "#CXX#" setenv FC "#FC#" +setenv NETCDF "#NETCDF#" setenv ESMFMKFILE "#ESMFMKFILE#" # Module load commands From c90a7f745a3887be0b4e2b34bffe3112bd9809cd Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Thu, 22 Oct 2020 20:14:55 -0600 Subject: [PATCH 8/8] Capitalize nceplibs in deploy_modulefiles.sh.in --- deploy_modulefiles.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy_modulefiles.sh.in b/deploy_modulefiles.sh.in index d616c13..50f8084 100755 --- a/deploy_modulefiles.sh.in +++ b/deploy_modulefiles.sh.in @@ -75,7 +75,7 @@ setenv ${libName}_ROOT \"${prefix}\"" done # Create NCEPLIBS umbrella module file -srcModulefile=$tmplModulefilesDir/NCEPLIBS/nceplibs +srcModulefile=$tmplModulefilesDir/NCEPLIBS/NCEPLIBS dstModulefile=$modulesDestDir/NCEPLIBS/${NCEPLIBS_VERSION} mkdir -p $modulesDestDir/NCEPLIBS \cp $srcModulefile $dstModulefile