Skip to content

Commit

Permalink
Add legacy macro option to cmake build system. Changed netcdf_plugin_…
Browse files Browse the repository at this point in the history
…install_dir to use /usr/local/hdf5/lib/plugin by default unless a 'prefix' is specified by the user, in which case it becomes prefix/hdf5/lib/plugin. This can still be overridden with the build flags appropriate to the build system.
  • Loading branch information
WardF committed Sep 25, 2024
1 parent de7992c commit a222922
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
19 changes: 12 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -667,14 +667,18 @@ if(ENABLE_PLUGIN_INSTALL)
set(NETCDF_PLUGIN_INSTALL_DIR "$ENV{HDF5_PLUGIN_PATH}")
else()
if(ISMSVC OR ISMINGW)
set(NETCDF_PLUGIN_INSTALL_DIR "$ENV{ALLUSERSPROFILE}\\hdf5\\lib\\plugin")
else()
set(NETCDF_PLUGIN_INSTALL_DIR "/usr/local/hdf5/lib/plugin")
endif()
endif()
message(STATUS "Defaulting to -DPLUGIN_INSTALL_DIR=${NETCDF_PLUGIN_INSTALL_DIR}")
set(NETCDF_PLUGIN_INSTALL_DIR "$ENV{ALLUSERSPROFILE}\\hdf5\\lib\\plugin")
else()
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
set(NETCDF_PLUGIN_INSTALL_DIR "/usr/local/hdf5/lib/plugin")
else()
set(NETCDF_PLUGIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/hdf5/lib/plugin")
endif(NOT DEFINED CMAKE_INSTALL_PREFIX)
endif(ISMSVC OR ISMINGW)
endif(DEFINED ENV{HDF5_PLUGIN_PATH})
message(STATUS "Defaulting to -DPLUGIN_INSTALL_DIR=${NETCDF_PLUGIN_INSTALL_DIR}")
endif()
endif()
endif(ENABLE_PLUGIN_INSTALL)

if(ENABLE_PLUGIN_INSTALL)
# Use the lowest priority dir in the path
Expand Down Expand Up @@ -1699,6 +1703,7 @@ is_enabled(NETCDF_ENABLE_PARALLEL4 HAS_PARALLEL4)
is_enabled(NETCDF_ENABLE_DAP HAS_DAP)
is_enabled(NETCDF_ENABLE_DAP2 HAS_DAP2)
is_enabled(NETCDF_ENABLE_DAP4 HAS_DAP4)
is_enabled(NETCDF_ENABLE_LEGACY_MACROS HAS_LEGACY_MACROS)
is_enabled(NETCDF_ENABLE_BYTERANGE HAS_BYTERANGE)
is_enabled(NETCDF_ENABLE_DISKLESS HAS_DISKLESS)
is_enabled(USE_MMAP HAS_MMAP)
Expand Down
11 changes: 9 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1943,6 +1943,7 @@ AM_CONDITIONAL(USE_DAP, [test "x$enable_dap" = xyes]) # Alias
# Provide protocol specific flags
AM_CONDITIONAL(NETCDF_ENABLE_DAP, [test "x$enable_dap" = xyes])
AM_CONDITIONAL(NETCDF_ENABLE_DAP4, [test "x$enable_dap4" = xyes])
AM_CONDITIONAL(NETCDF_ENABLE_LEGACY_MACROS, [test "x$netcdf_enable_legacy_macros" = xyes])
AM_CONDITIONAL(USE_STRICT_NULL_BYTE_HEADER_PADDING, [test x$enable_strict_null_byte_header_padding = xyes])
AM_CONDITIONAL(NETCDF_ENABLE_CDF5, [test "x$enable_cdf5" = xyes])
AM_CONDITIONAL(NETCDF_ENABLE_DAP_REMOTE_TESTS, [test "x$enable_dap_remote_tests" = xyes])
Expand Down Expand Up @@ -2061,6 +2062,7 @@ AC_SUBST(NC_LIBS,[$NC_LIBS])
AC_SUBST(HAS_DAP,[$enable_dap])
AC_SUBST(HAS_DAP2,[$enable_dap])
AC_SUBST(HAS_DAP4,[$enable_dap4])
AC_SUBST(HAS_LEGACY_MACROS,[$enable_legacy_macros])
AC_SUBST(HAS_NC2,[$nc_build_v2])
AC_SUBST(HAS_CDF5,[$enable_cdf5])
AC_SUBST(HAS_HDF4,[$enable_hdf4])
Expand Down Expand Up @@ -2167,8 +2169,13 @@ elif test "x$with_plugin_dir" = xyes ; then # --with-plugin-dir, no argument
if test "x$ISMSVC" = xyes || test "x$ISMINGW" = xyes; then
PLUGIN_PATH="${ALLUSERSPROFILE}\\hdfd5\\lib\\plugin"
else
PLUGIN_PATH="/usr/local/hdf5/lib/plugin"
fi
if test "x${prefix}" = x ; then
PLUGIN_PATH="/usr/local/hdf5/lib/plugin"
else
PLUGIN_PATH="${prefix}/hdf5/lib/plugin"
fi

fi
fi
# Use the lowest priority dir in the path
if test "x$ISMSVC" = xyes || test "x$ISMINGW" = xyes; then
Expand Down
1 change: 1 addition & 0 deletions libnetcdf.settings.in
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Shared Library: @enable_shared@
Static Library: @enable_static@
Extra libraries: @LIBS@
XML Parser: @XMLPARSER@
Legacy Macros: @HAS_LEGACY_MACROS@

# Features
--------
Expand Down

0 comments on commit a222922

Please sign in to comment.