Skip to content

Commit

Permalink
Removed adding a version hash to build to every build except ACCESS-O…
Browse files Browse the repository at this point in the history
…M. Added option to also remove from ACCESS-OM
  • Loading branch information
aidanheerdegen committed Aug 4, 2023
1 parent 4f27455 commit 66ef4a3
Showing 1 changed file with 32 additions and 7 deletions.
39 changes: 32 additions & 7 deletions exp/MOM_compile.csh
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ set debug = 0
set repro = 0
set use_netcdf4 = 0
set environ = 1
set cosima_version = unset


set argv = (`getopt -u -o h -l type: -l platform: -l help -l unit_testing -l debug -l repro -l use_netcdf4 -l no_environ -- $*`)
set argv = (`getopt -u -o h -l type: -l platform: -l help -l unit_testing -l debug -l repro -l use_netcdf4 -l no_environ -l no_version -- $*`)
if ($status != 0) then
# Die if there are incorrect options
set help = 1
Expand All @@ -34,6 +35,8 @@ while ("$argv[1]" != "--")
set use_netcdf4 = 1; breaksw
case --no_environ:
set environ = 0; breaksw
case --no_version:
set cosima_version = 0; breaksw
case --help:
set help = 1; breaksw
case -h:
Expand Down Expand Up @@ -63,7 +66,9 @@ if ( $help ) then
echo
echo "--use_netcdf4 use NetCDF4, the default is NetCDF4. Warning: many of the standard experiments don't work with NetCDF4."
echo
echo "--no_environ do not source platform specific environment. Allows customising/overriding default environment"
echo "--no_environ do not source platform specific environment. Allows customising/overriding default environment"
echo
echo "--no_version disable COSIMA specific versioning for ACCESS-OM* builds"
echo
exit 1
endif
Expand All @@ -87,6 +92,15 @@ if($static) then
set cppDefs = "$cppDefs -DMOM_STATIC_ARRAYS -DNI_=360 -DNJ_=200 -DNK_=50 -DNI_LOCAL_=60 -DNJ_LOCAL_=50"
endif

if( $cosima_version == "unset" ) then
if( $type =~ ACCESS-OM* ) then
# default to cosima versioniing for ACCESS-OM if not set explicitly as no_version argument
set cosima_version = 1
else
set cosima_version = 0
endif
endif

if ( $type == EBM ) then
set cppDefs = ( "-Duse_netCDF -Duse_netCDF3 -Duse_libMPI -DLAND_BND_TRACERS -DOVERLOAD_C8 -DOVERLOAD_C4 -DOVERLOAD_R4" )
else if( $type == ACCESS-OM ) then
Expand Down Expand Up @@ -133,13 +147,20 @@ endif
set mkmf_lib = "$mkmf -f -m Makefile -a $code_dir -t $mkmfTemplate"
set lib_include_dirs = "$root/include $code_dir/shared/include $code_dir/shared/mpp/include"

# Build version
source ./version_compile.csh
if ( $cosima_version ) then
echo "Including COSIMA version in build"
# Build version. This prevents builds outside a git repo, so only enabled for COSIMA builds
source ./version_compile.csh
endif

# Build FMS.
source ./FMS_compile.csh

set includes = "-I$code_dir/shared/include -I$executable:h:h/lib_FMS -I$executable:h:h/lib_ocean -I$executable:h:h/lib_version/"
set includes = "-I$code_dir/shared/include -I$executable:h:h/lib_FMS -I$executable:h:h/lib_ocean"

if ( $cosima_version ) then
set includes = "$includes -I$executable:h:h/lib_version/"
endif

# Build the core ocean.
cd $root/exp
Expand Down Expand Up @@ -232,8 +253,12 @@ else
exit 1
endif

# Always include FMS and version
set libs = "$libs $executable:h:h/lib_version/lib_version.a $executable:h:h/lib_FMS/lib_FMS.a"
# Always include FMS
set libs = "$libs $executable:h:h/lib_FMS/lib_FMS.a"

if ( $cosima_version ) then
set libs = "$libs $executable:h:h/lib_version/lib_version.a"
endif

$mkmf_exec -o "$includes" -c "$cppDefs" -l "$libs" $srcList
make
Expand Down

0 comments on commit 66ef4a3

Please sign in to comment.