Skip to content

Commit 3e42512

Browse files
committed
Support building with external FMS and gtracers
1 parent 214fe0c commit 3e42512

2 files changed

Lines changed: 30 additions & 12 deletions

File tree

exp/MOM_compile.csh

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,11 @@ if ( ! -f $mppnccombine ) then
147147
endif
148148

149149
set mkmf_lib = "$mkmf -f -m Makefile -a $code_dir -t $mkmfTemplate"
150-
set lib_include_dirs = "$root/include $code_dir/shared/include $code_dir/shared/mpp/include"
150+
if ( ! $?FMS_EXTERNAL ) then
151+
set lib_include_dirs = "$root/include $code_dir/shared/include $code_dir/shared/mpp/include"
152+
else
153+
set lib_include_dirs = "$root/include $code_dir/shared/mpp/include"
154+
endif
151155

152156
if ( $cosima_version ) then
153157
echo "Including COSIMA version in build"
@@ -156,10 +160,14 @@ if ( $cosima_version ) then
156160
set cppDefs = "$cppDefs -DCOSIMA_VERSION"
157161
endif
158162

159-
# Build FMS.
160-
source ./FMS_compile.csh
161-
162-
set includes = "-I$code_dir/shared/include -I$executable:h:h/lib_FMS -I$executable:h:h/lib_ocean"
163+
if ( ! $?FMS_EXTERNAL ) then
164+
echo "Building type=$type with internal FMS"
165+
source ./FMS_compile.csh
166+
set includes = "-I$code_dir/shared/include -I$executable:h:h/lib_FMS -I$executable:h:h/lib_ocean"
167+
else
168+
echo "Building type=$type with external FMS"
169+
set includes = "-I$executable:h:h/lib_ocean"
170+
endif
163171

164172
if ( $cosima_version ) then
165173
set includes = "$includes -I$executable:h:h/lib_version/"
@@ -221,16 +229,16 @@ mkdir -p $executable:h
221229
cd $executable:h
222230
if( $type == MOM_solo ) then
223231
set srcList = ( mom5/drivers )
224-
set libs = "$executable:h:h/lib_ocean/lib_ocean.a $executable:h:h/lib_FMS/lib_FMS.a"
232+
set libs = "$executable:h:h/lib_ocean/lib_ocean.a"
225233
else if( $type == ACCESS-CM || $type == ACCESS-ESM) then
226234
set srcList = ( access/accesscm_coupler )
227-
set includes = "-I$executable:h:h/lib_FMS -I$executable:h:h/$type/lib_ocean"
235+
set includes = "-I$executable:h:h/$type/lib_ocean"
228236
set libs = "$executable:h:h/$type/lib_ocean/lib_ocean.a"
229237
setenv OASIS true
230238
else if( $type == ACCESS-OM || $type == ACCESS-OM-BGC) then
231239
set srcList = ( access/accessom_coupler )
232-
set includes = "-I$executable:h:h/lib_FMS -I$executable:h:h/$type/lib_ocean"
233-
set libs = "$executable:h:h/$type/lib_ocean/lib_ocean.a $executable:h:h/lib_FMS/lib_FMS.a"
240+
set includes = "-I$executable:h:h/$type/lib_ocean"
241+
set libs = "$executable:h:h/$type/lib_ocean/lib_ocean.a"
234242
else if( $type == MOM_SIS ) then
235243
set srcList = ( coupler )
236244
set includes = "$includes -I$executable:h:h/lib_ice -I$executable:h:h/lib_atmos_null -I$executable:h:h/lib_land_null"
@@ -260,8 +268,12 @@ if( $type =~ ACCESS-* ) then
260268
set srcList = ( $srcList access/shared )
261269
endif
262270

263-
# Always include FMS
264-
set libs = "$libs $executable:h:h/lib_FMS/lib_FMS.a"
271+
if ( ! $?FMS_EXTERNAL ) then
272+
set libs = "$libs $executable:h:h/lib_FMS/lib_FMS.a"
273+
if( $type == ACCESS-CM || $type == ACCESS-ESM || $type == ACCESS-OM || $type == ACCESS-OM-BGC) then
274+
set includes = "$includes -I$executable:h:h/lib_FMS"
275+
endif
276+
endif
265277

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

exp/ocean_compile.csh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@ if( $type == ACCESS-OM || $type == ACCESS-CM || $type == ACCESS-OM-BGC || $type
99
if( $type == ACCESS-OM-BGC ) then
1010
set srcList = ( $srcList mom5/ocean_csiro_bgc )
1111
else if ( $type == ACCESS-OM || $type == ACCESS-ESM ) then
12-
set srcList = ( $srcList mom5/ocean_bgc access/generic_tracers/generic_tracers access/generic_tracers/mocsy/src )
12+
13+
if ( ! $?GTRACERS_EXTERNAL ) then
14+
set srcList = ( $srcList mom5/ocean_bgc access/generic_tracers/generic_tracers access/generic_tracers/mocsy/src )
15+
else
16+
set srcList = ( $srcList mom5/ocean_bgc )
17+
endif
18+
1319
endif
1420
mkdir -p $executable:h:h/$type/$lib_name
1521
cd $executable:h:h/$type/$lib_name

0 commit comments

Comments
 (0)