Skip to content

Commit

Permalink
Merge pull request #4492 from ESMCI/jgfouca/macros_copy_only_needed
Browse files Browse the repository at this point in the history
Copy only necessary cmake macros to case

This implementation makes some assumptions about the context of /.../Macros.cmake, so I am only turning this on for E3SM.

I think this is a nice improvement. This will reduce the number of macros that get copied from nearly 100 to just a handful, making it easier for the user to view and edit their macros from the case.

Test suite: by-hand
Test baseline:
Test namelist changes:
Test status: [bit for bit, roundoff, climate changing]

Fixes [CIME Github issue #]

User interface changes?:

Update gh-pages html (Y/N)?:
  • Loading branch information
jgfouca authored Sep 26, 2023
2 parents b10d452 + cf66f90 commit b8d6d2b
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions CIME/case/case_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,29 @@ def _create_macros_cmake(
###############################################################################
if not os.path.isfile(os.path.join(caseroot, "Macros.cmake")):
safe_copy(os.path.join(cmake_macros_dir, "Macros.cmake"), caseroot)
if not os.path.exists(os.path.join(caseroot, "cmake_macros")):
shutil.copytree(cmake_macros_dir, case_cmake_path)

copy_depends_files(
mach_obj.get_machine_name(), mach_obj.machines_dir, caseroot, compiler
)
if not os.path.exists(case_cmake_path):
os.mkdir(case_cmake_path)

# This impl is coupled to contents of Macros.cmake
os_ = mach_obj.get_value("OS")
mach = mach_obj.get_machine_name()
macros = [
"universal.cmake",
os_ + ".cmake",
compiler + ".cmake",
"{}_{}.cmake".format(compiler, os),
mach + ".cmake",
"{}_{}.cmake".format(compiler, mach),
"CMakeLists.txt",
]
for macro in macros:
repo_macro = os.path.join(cmake_macros_dir, macro)
case_macro = os.path.join(case_cmake_path, macro)
if not os.path.exists(case_macro) and os.path.exists(repo_macro):
safe_copy(repo_macro, case_cmake_path)

copy_depends_files(mach, mach_obj.machines_dir, caseroot, compiler)


###############################################################################
Expand Down

0 comments on commit b8d6d2b

Please sign in to comment.