Skip to content

Commit

Permalink
ENH: Finer control over Zoltan configure; mark UDUNITS as optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Patol75 committed Jul 7, 2022
1 parent 5e9529b commit 2dc3e82
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
23 changes: 15 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,10 @@ if(TCMALLOC_FOUND)
endif()

# Check for UDUNITS
pkg_search_module(UDUNITS REQUIRED udunits)
message(STATUS "Found UDUNITS ${UDUNITS_VERSION}")
pkg_search_module(UDUNITS QUIET udunits)
if(UDUNITS_FOUND)
message(STATUS "Found UDUNITS ${UDUNITS_VERSION}")
endif()

# Check for libsupermesh
pkg_search_module(LIBSUPERMESH QUIET libsupermesh)
Expand Down Expand Up @@ -156,11 +158,16 @@ set_target_properties(Judy
)

# Add Zoltan
set(ZOLTAN_CONFIGURE "../libzoltan/configure --enable-f90interface --with-gnumake --with-scotch --with-parmetis")
if(${CMAKE_C_COMPILER_VERSION} GREATER_EQUAL 10)
set(ZOLTAN_CONFIGURE ../libzoltan/configure FCFLAGS=-fallow-argument-mismatch --enable-f90interface --with-gnumake --with-scotch --with-scotch-incdir=$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/include --with-scotch-libdir=$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib --with-parmetis --with-parmetis-incdir=$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/include --with-parmetis-libdir=$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib)
else()
set(ZOLTAN_CONFIGURE ../libzoltan/configure --enable-f90interface --with-gnumake --with-scotch --with-scotch-incdir=$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/include --with-scotch-libdir=$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib --with-parmetis --with-parmetis-incdir=$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/include --with-parmetis-libdir=$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib)
string(APPEND ZOLTAN_CONFIGURE " FCFLAGS=-fallow-argument-mismatch")
endif()
if(DEFINED ENV{PETSC_ARCH})
string(APPEND ZOLTAN_CONFIGURE " --with-scotch-incdir=$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/include --with-scotch-libdir=$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib --with-parmetis-incdir=$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/include --with-parmetis-libdir=$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib")
else()
string(APPEND ZOLTAN_CONFIGURE " --with-scotch-incdir=$ENV{PETSC_DIR}/include --with-scotch-libdir=$ENV{PETSC_DIR}/lib --with-parmetis-incdir=$ENV{PETSC_DIR}/include --with-parmetis-libdir=$ENV{PETSC_DIR}/lib")
endif()
separate_arguments(ZOLTAN_CONFIGURE UNIX_COMMAND ${ZOLTAN_CONFIGURE})
ExternalProject_Add(libzoltan
PREFIX Zoltan
GIT_REPOSITORY https://github.com/sandialabs/Zoltan
Expand Down Expand Up @@ -329,8 +336,8 @@ target_compile_definitions(fluidity PUBLIC
$<$<BOOL:${EXODUSII_LIBRARY}>:HAVE_LIBEXOIIV2C>
HAVE_LIBNETCDF
$<$<BOOL:${LIBSUPERMESH_FOUND}>:HAVE_LIBSUPERMESH>
$<$<BOOL:${LIBTCMALLOC_FOUND}>:HAVE_LIBTCMALLOC>
HAVE_LIBUDUNITS
$<$<BOOL:${TCMALLOC_FOUND}>:HAVE_LIBTCMALLOC>
$<$<BOOL:${UDUNITS_FOUND}>:HAVE_LIBUDUNITS>
HAVE_MEMORY_STATS
HAVE_MBA_2D
# HAVE_MBA_3D
Expand Down Expand Up @@ -385,7 +392,7 @@ target_link_libraries(fluidity
# ${ARPACK_STATIC_LDFLAGS}
${NETCDF_STATIC_LDFLAGS}
$<$<BOOL:${TCMALLOC_STATIC_LDFLAGS}>:${TCMALLOC_STATIC_LDFLAGS}>
${UDUNITS_STATIC_LDFLAGS}
$<$<BOOL:${UDUNITS_STATIC_LDFLAGS}>:${UDUNITS_STATIC_LDFLAGS}>
$<$<BOOL:${LIBSUPERMESH_STATIC_LDFLAGS}>:${LIBSUPERMESH_STATIC_LDFLAGS}>

$<$<BOOL:${EXODUSII_LIBRARY}>:${EXODUSII_LIBRARY}>
Expand Down
5 changes: 4 additions & 1 deletion ocean_forcing/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
set(unittest_sources
test_coare_ocean_fluxes.cpp
test_FluxesReader.cpp
test_fluxes_reader_wrapper.F90
test_kara_ocean_fluxes.cpp
test_ncar_ocean_fluxes.cpp
)

cmake_language(CALL build_unittest_executable "${unittest_sources}")

if(UDUNITS_FOUND)
cmake_language(CALL build_unittest_executable "test_fluxes_reader_wrapper.F90")
endif()

0 comments on commit 2dc3e82

Please sign in to comment.