Skip to content

Commit

Permalink
Updates cprnc buildlib to check /externals for source
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonb5 committed Dec 1, 2023
1 parent 58943e8 commit 82149a6
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions CIME/build_scripts/buildlib.cprnc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sys.path.append(os.path.join(_CIMEROOT, "CIME", "Tools"))

from standard_script_setup import *
from CIME import utils
from CIME.utils import run_bld_cmd_ensure_logging
from CIME.utils import run_bld_cmd_ensure_logging, CIMEError
from CIME.case import Case
from CIME.build import get_standard_cmake_args

Expand Down Expand Up @@ -63,10 +63,35 @@ def buildlib(bldroot, installpath, case):
)

cmake_args = get_standard_cmake_args(case, "ignore_sharedpath")

os.environ["CIMEROOT"] = cimeroot
cmake_cmd = ". ./.env_mach_specific.sh && NETCDF=$(dirname $(dirname $(which nf-config))) cmake {cmake_args} -DMPILIB=mpi-serial -DDEBUG=FALSE -C Macros.cmake {cimeroot}/CIME/non_py/cprnc -DCMAKE_PREFIX_PATH={dest_path} -DBLDROOT={bldroot}".format(
cimeroot=cimeroot, dest_path=installpath, cmake_args=cmake_args, bldroot=bldroot

srcroot = case.get_value("SRCROOT")

cprnc_src_root = None
candidate_paths = (
os.path.join(cimeroot, "CIME/non_py/cprnc"),
os.path.join(srcroot, "externals/cprnc"),
)

for candidate in candidate_paths:
if os.path.exists(candidate):
cprnc_src_root = candidate

break
else:
logger.debug("{!r} is not a valid cprnc source path")

if cprnc_src_root is None:
raise CIMEError("Could not find a valid cprnc source directory")

cmake_cmd = ". ./.env_mach_specific.sh && NETCDF=$(dirname $(dirname $(which nf-config))) cmake {cmake_args} -DMPILIB=mpi-serial -DDEBUG=FALSE -C Macros.cmake {cprnc_src_root} -DCMAKE_PREFIX_PATH={dest_path} -DBLDROOT={bldroot}".format(
cprnc_src_root=cprnc_src_root,
dest_path=installpath,
cmake_args=cmake_args,
bldroot=bldroot,
)

run_bld_cmd_ensure_logging(cmake_cmd, logger, from_dir=bldroot)

gmake_cmd = case.get_value("GMAKE")
Expand Down

0 comments on commit 82149a6

Please sign in to comment.