@@ -7,7 +7,7 @@ _CIMEROOT = os.environ.get("CIMEROOT")
77if _CIMEROOT is None :
88 raise SystemExit ("ERROR: must set CIMEROOT environment variable" )
99
10- sys .path .append (os .path .join (_CIMEROOT , "scripts " , "Tools" ))
10+ sys .path .append (os .path .join (_CIMEROOT , "CIME " , "Tools" ))
1111
1212import shutil , glob , itertools
1313from standard_script_setup import *
@@ -629,13 +629,36 @@ def compare_drv_flds_in(first, second, infile1, infile2):
629629 % (infile1 , infile2 ),
630630 )
631631
632+ def cmeps_lib_list (case ):
633+ # provide a list of support libs that must be built for this case
634+ # should be ordered with dependent libraries listed after those depended on
635+ # the library names should match the keys in variable BUILD_LIB_FILE from config_files.xml
636+ ufs_driver = os .environ .get ("UFS_DRIVER" )
637+ if ufs_driver :
638+ logger .info ("UFS_DRIVER is set to {}" .format (ufs_driver ))
639+
640+ libs = case .get_values ("CASE_SUPPORT_LIBRARIES" )
641+
642+ mpilib = case .get_value ("MPILIB" )
643+ if mpilib == "mpi-serial" :
644+ libs .insert (0 , mpilib )
645+
646+ ocn_model = case .get_value ("COMP_OCN" )
647+ # These will be handled by MOM and CAM, included here for backward compatibility.
648+ atm_dycore = case .get_value ("CAM_DYCORE" )
649+ if (ocn_model == "mom" or (atm_dycore and atm_dycore == "fv3" )) and "FMS" not in libs :
650+ libs .append ("FMS" )
651+ return libs
632652
633653###############################################################################
634654def buildnml (case , caseroot , component ):
635655 ###############################################################################
636656 if component != "drv" :
637657 raise AttributeError
638658
659+ libs = cmeps_lib_list (case )
660+ case .set_value ("CASE_SUPPORT_LIBRARIES" , "," .join (libs ))
661+
639662 esmfmkfile = os .getenv ("ESMFMKFILE" )
640663 expect (
641664 esmfmkfile and os .path .isfile (esmfmkfile ),
@@ -726,7 +749,7 @@ def buildnml(case, caseroot, component):
726749def _main_func ():
727750 caseroot = parse_input (sys .argv )
728751
729- with Case (caseroot ) as case :
752+ with Case (caseroot , read_only = False ) as case :
730753 buildnml (case , caseroot , "drv" )
731754
732755
0 commit comments