diff --git a/.github/workflows/run_tests_linux.yml b/.github/workflows/run_tests_linux.yml index 20fd91d3..e56e9e3a 100644 --- a/.github/workflows/run_tests_linux.yml +++ b/.github/workflows/run_tests_linux.yml @@ -6,6 +6,10 @@ name: Run netCDF-Fortran Linux tests on: [pull_request, workflow_dispatch] +concurrency: + group: ${{ github.workflow}}-${{ github.head_ref }} + cancel-in-progress: true + jobs: build-deps: @@ -19,7 +23,7 @@ jobs: steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install System dependencies shell: bash -l {0} @@ -37,7 +41,7 @@ jobs: ### - name: Cache libhdf5-${{ matrix.hdf5 }}-${{ matrix.netcdf }} id: cache-hdf5 - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ~/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }} key: hdf5-${{ runner.os }}-${{ matrix.hdf5 }}-${{ matrix.netcdf }} @@ -75,7 +79,7 @@ jobs: steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install System dependencies shell: bash -l {0} @@ -94,7 +98,7 @@ jobs: ### - name: Cache libhdf5-${{ matrix.hdf5 }}-${{ matrix.netcdf }}-par id: cache-hdf5-par - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ~/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }} key: hdf5-${{ runner.os }}-${{ matrix.hdf5 }}-${{ matrix.netcdf }}-par @@ -134,7 +138,7 @@ jobs: steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install System dependencies shell: bash -l {0} @@ -149,14 +153,14 @@ jobs: - run: echo "LD_LIBRARY_PATH=${HOME}/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}/lib" >> $GITHUB_ENV - run: echo "HDF5_PLUGIN_PATH=${HOME}/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}/lib" >> $GITHUB_ENV - run: echo "HDF5_PLUGIN_DIR=${HOME}/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}/lib" >> $GITHUB_ENV - + ### # Fetch Cache ### - name: Fetch HDF Cache id: cache-hdf - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ~/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }} key: hdf5-${{ runner.os }}-${{ matrix.hdf5 }}-${{ matrix.netcdf }} @@ -221,7 +225,7 @@ jobs: nf-autotools-par: - needs: build-deps-par + needs: build-deps-par runs-on: ubuntu-latest strategy: @@ -231,7 +235,7 @@ jobs: steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install System dependencies shell: bash -l {0} @@ -254,7 +258,7 @@ jobs: - name: Fetch HDF Cache id: cache-hdf-par - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ~/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }} key: hdf5-${{ runner.os }}-${{ matrix.hdf5 }}-${{ matrix.netcdf }}-par @@ -316,7 +320,7 @@ jobs: #- name: Make Distcheck # shell: bash -l {0} # run: CFLAGS=${CFLAGS} LDFLAGS=${LDFLAGS} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} make distcheck -j - + nf-cmake: needs: build-deps @@ -329,7 +333,7 @@ jobs: steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install System dependencies shell: bash -l {0} @@ -345,14 +349,14 @@ jobs: - run: echo "CMAKE_PREFIX_PATH=${HOME}/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf}}" >> $GITHUB_ENV - run: echo "HDF5_PLUGIN_PATH=${HOME}/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}/lib" >> $GITHUB_ENV - run: echo "HDF5_PLUGIN_DIR=${HOME}/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}/lib" >> $GITHUB_ENV - + ### # Fetch Cache ### - name: Fetch HDF Cache id: cache-hdf5 - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ~/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }} key: hdf5-${{ runner.os }}-${{ matrix.hdf5 }}-${{ matrix.netcdf }} @@ -381,36 +385,25 @@ jobs: - name: Perform out-of-directory build shell: bash -l {0} - run: | - mkdir build - cd build - LD_LIBRARY_PATH=${LD_LIBRARY_PATH} cmake .. -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} + run: LD_LIBRARY_PATH=${LD_LIBRARY_PATH} cmake -Bbuild -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} - name: Print Summary shell: bash -l {0} - run: | - cd build - cat libnetcdff.settings + run: cat build/libnetcdff.settings - name: Build All shell: bash -l {0} - run: | - cd build - LD_LIBRARY_PATH=${LD_LIBRARY_PATH} make -j 12 + run: LD_LIBRARY_PATH=${LD_LIBRARY_PATH} cmake --build build --parallel if: ${{ success() }} - name: Run Tests shell: bash -l {0} - run: | - cd build - LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ctest -j 1 . + run: LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ctest --test-dir build if: ${{ success() }} - name: Look at LastTest.log if error shell: bash -l {0} run: | - cat /home/runner/work/netcdf-fortran/netcdf-fortran/build/Testing/Temporary/LastTest.log - cd build - LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ctest --rerun-failed --output-on-failure - + cat build/Testing/Temporary/LastTest.log + LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ctest --test-dir build --rerun-failed --output-on-failure if: ${{ failure() }} diff --git a/.github/workflows/run_tests_macos.yml b/.github/workflows/run_tests_macos.yml index ef9bcc50..81a5cb63 100644 --- a/.github/workflows/run_tests_macos.yml +++ b/.github/workflows/run_tests_macos.yml @@ -6,6 +6,9 @@ name: Run netCDF-Fortran MacOS tests on: [ workflow_dispatch ] +concurrency: + group: ${{ github.workflow}}-${{ github.head_ref }} + cancel-in-progress: true jobs: @@ -20,7 +23,7 @@ jobs: steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 ### # Set Environmental Variables @@ -35,13 +38,13 @@ jobs: - run: echo "DYLD_LIBRARY_PATH=${HOME}/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}/lib" >> $GITHUB_ENV - run: echo "PATH=${HOME}/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}/bin:${PATH}" >> $GITHUB_ENV - - run: brew install automake libaec + - run: brew install automake libaec ### # Installing libhdf4 and libhdf5 ### - name: Cache libhdf5-${{ matrix.hdf5 }}-${{ matrix.netcdf }} id: cache-hdf5 - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ~/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }} key: hdf5-${{ runner.os }}-${{ matrix.hdf5 }}-${{ matrix.netcdf }} @@ -80,7 +83,7 @@ jobs: steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 ### # Set Environmental Variables ### @@ -89,14 +92,14 @@ jobs: - run: echo "FFLAGS=-I${HOME}/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}/include" >> $GITHUB_ENV - run: echo "CFLAGS=-I${HOME}/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}/include" >> $GITHUB_ENV - - run: echo "CPPFLAGS=-I${HOME}/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}/include" >> $GITHUB_ENV + - run: echo "CPPFLAGS=-I${HOME}/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}/include" >> $GITHUB_ENV - run: echo "LDFLAGS=-L${HOME}/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}/lib" >> $GITHUB_ENV - run: echo "LD_LIBRARY_PATH=${HOME}/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}/lib" >> $GITHUB_ENV - run: echo "DYLD_LIBRARY_PATH=${HOME}/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}/lib" >> $GITHUB_ENV - run: echo "PATH=${HOME}/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}/bin:${PATH}" >> $GITHUB_ENV - - run: brew install automake - + - run: brew install automake + ### # Fetch Cache @@ -104,7 +107,7 @@ jobs: - name: Fetch HDF Cache id: cache-hdf - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ~/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }} key: hdf5-${{ runner.os }}-${{ matrix.hdf5 }}-${{ matrix.netcdf }} @@ -166,7 +169,7 @@ jobs: steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 ### # Set Environmental Variables @@ -179,7 +182,7 @@ jobs: - run: echo "LD_LIBRARY_PATH=${HOME}/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }}/lib" >> $GITHUB_ENV - run: echo "CMAKE_PREFIX_PATH=${HOME}/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf}}" >> $GITHUB_ENV - - run: brew install automake + - run: brew install automake ### # Fetch Cache @@ -187,7 +190,7 @@ jobs: - name: Fetch HDF Cache id: cache-hdf5 - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ~/environments/${{ matrix.hdf5 }}-${{ matrix.netcdf }} key: hdf5-${{ runner.os }}-${{ matrix.hdf5 }}-${{ matrix.netcdf }} @@ -202,36 +205,26 @@ jobs: - name: Perform out-of-directory build shell: bash -l {0} - run: | - mkdir build - cd build - LD_LIBRARY_PATH=${LD_LIBRARY_PATH} cmake .. -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} + run: LD_LIBRARY_PATH=${LD_LIBRARY_PATH} cmake -B build -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} - name: Print Summary shell: bash -l {0} - run: | - cd build - cat libnetcdff.settings + run: cat build/libnetcdff.settings - name: Build All shell: bash -l {0} - run: | - cd build - LD_LIBRARY_PATH=${LD_LIBRARY_PATH} make -j 12 + run: LD_LIBRARY_PATH=${LD_LIBRARY_PATH} cmake --build build --parallel if: ${{ success() }} - name: Run Tests shell: bash -l {0} - run: | - cd build - LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ctest -j 1 . + run: LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ctest --test-dir build if: ${{ success() }} - name: Look at LastTest.log if error shell: bash -l {0} run: | - cat /home/runner/work/netcdf-fortran/netcdf-fortran/build/Testing/Temporary/LastTest.log - cd build - LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ctest --rerun-failed --output-on-failure + cat build/Testing/Temporary/LastTest.log + LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ctest --test-dir build --rerun-failed --output-on-failure if: ${{ failure() }} diff --git a/CMakeLists.txt b/CMakeLists.txt index 578a87b2..b0770dd5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,6 +23,7 @@ set(PACKAGE "${NC4F_CTEST_PROJECT_NAME}" CACHE STRING "") #Project Version SET(NC4F_VERSION_MAJOR 4) SET(NC4F_VERSION_MINOR 6) + SET(NC4F_VERSION_PATCH 2) SET(NC4F_VERSION_NOTE "-development") SET(NC4F_VERSION ${NC4F_VERSION_MAJOR}.${NC4F_VERSION_MINOR}.${NC4F_VERSION_PATCH}${NC4F_VERSION_NOTE}) @@ -33,20 +34,10 @@ SET(PACKAGE_VERSION ${VERSION}) # Set known dependencies. SET(EXTRA_DEPS "") -# Get system configuration, -# Use it to determine osname, -# os release, cpu. These will be used -# when committing to CDash. -find_program(UNAME NAMES uname) -IF(UNAME) - macro(getuname name flag) - exec_program("${UNAME}" ARGS "${flag}" OUTPUT_VARIABLE "${name}") - endmacro(getuname) - getuname(osname -s) - getuname(osrel -r) - getuname(cpu -m) - set(TMP_BUILDNAME "${osname}-${osrel}-${cpu}" CACHE STRING "Build name variable for CDash") -ENDIF() +set(TMP_BUILDNAME "${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_VERSION}-${CMAKE_SYSTEM_PROCESSOR}" CACHE STRING "Build name variable for CDash") + +# For CMAKE_INSTALL_LIBDIR +INCLUDE(GNUInstallDirs) ### # Allow for some customization of the buildname. @@ -192,12 +183,10 @@ IF(CMAKE_Fortran_COMPILER_ID MATCHES Intel) ENDIF() ENDIF() -ADD_DEFINITIONS() - # Supress CRT Warnings. # Only necessary for Windows IF(MSVC) - ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS) + add_compile_definitions(_CRT_SECURE_NO_WARNINGS) ENDIF() @@ -213,7 +202,7 @@ ENDIF() # Macro to append files to the EXTRA_DIST files. SET(EXTRA_DIST "") MACRO(ADD_EXTRA_DIST files) - FOREACH(F ${files}) + FOREACH(F IN LISTS files) list(APPEND EXTRA_DIST ${CMAKE_CURRENT_SOURCE_DIR}/${F}) ENDFOREACH() SET(EXTRA_DIST ${EXTRA_DIST} PARENT_SCOPE) @@ -323,7 +312,7 @@ MACRO(print_conf_summary) SET(ALL_DEP_LIBS "${NETCDF_C_LIBRARY};${EXTRA_DEPS}") MESSAGE(STATUS "\tLinking against:\t\t" "${ALL_DEP_LIBS}") - FOREACH(_LIB ${EXTRA_DEPS}) + FOREACH(_LIB IN LISTS EXTRA_DEPS) GET_FILENAME_COMPONENT(_LIB_NAME ${_LIB} NAME_WE) STRING(REGEX REPLACE "^lib" "" _NAME ${_LIB_NAME}) LIST(APPEND NCF_LIBS "-l${_NAME}") @@ -358,13 +347,13 @@ MACRO(specify_static_crt_flag) CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) - FOREACH(flag_var ${vars}) + FOREACH(flag_var IN LISTS vars) IF(${flag_var} MATCHES "/MD") STRING(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") ENDIF() ENDFOREACH() - FOREACH(flag_var ${vars}) + FOREACH(flag_var IN LISTS vars) MESSAGE(STATUS " '${flag_var}': ${${flag_var}}") ENDFOREACH() MESSAGE(STATUS "") @@ -550,26 +539,26 @@ CHECK_INCLUDE_FILE("netcdf.h" HAVE_NETCDF_H) # End Check for various system header files. ### -ADD_DEFINITIONS(-DNCSHORT_T=integer*2) -ADD_DEFINITIONS(-DNCBYTE_T=byte) -ADD_DEFINITIONS(-DNF_RELAX_COORD_BOUND) -ADD_DEFINITIONS(-DNF_HAS_PARALLEL4) -ADD_DEFINITIONS(-DNF_HAS_PNETCDF) -#ADD_DEFINITIONS(-DENABLE_CDF5) -ADD_DEFINITIONS(-DNF_INT1_IS_C_SIGNED_CHAR) -#ADD_DEFINITIONS(-DNF_INT1_IS_C_SHORT) -#ADD_DEFINITIONS(-DNF_INT1_IS_C_INT) -#ADD_DEFINITIONS(-DNF_INT1_IS_C_LONG) -ADD_DEFINITIONS(-DNF_INT2_IS_C_SHORT) -#ADD_DEFINITIONS(-DNF_INT2_IS_C_INT) -#ADD_DEFINITIONS(-DNF_INT2_IS_C_LONG) -ADD_DEFINITIONS(-DNF_INT_IS_C_INT) -#ADD_DEFINITIONS(-DNF_INT_IS_C_LONG) -ADD_DEFINITIONS(-DNF_INT8_IS_C_LONG_LONG) -ADD_DEFINITIONS(-DNF_REAL_IS_C_FLOAT) -#ADD_DEFINITIONS(-DNF_REAL_IS_C_DOUBLE) -ADD_DEFINITIONS(-DNF_DOUBLEPRECISION_IS_C_DOUBLE) -#ADD_DEFINITIONS(-DNF_DOUBLEPRECISION_IS_C_FLOAT) +add_compile_definitions(NCSHORT_T=integer*2) +add_compile_definitions(NCBYTE_T=byte) +add_compile_definitions(NF_RELAX_COORD_BOUND) +add_compile_definitions(NF_HAS_PARALLEL4) +add_compile_definitions(NF_HAS_PNETCDF) +#add_compile_definitions(ENABLE_CDF5) +add_compile_definitions(NF_INT1_IS_C_SIGNED_CHAR) +#add_compile_definitions(NF_INT1_IS_C_SHORT) +#add_compile_definitions(NF_INT1_IS_C_INT) +#add_compile_definitions(NF_INT1_IS_C_LONG) +add_compile_definitions(NF_INT2_IS_C_SHORT) +#add_compile_definitions(NF_INT2_IS_C_INT) +#add_compile_definitions(NF_INT2_IS_C_LONG) +add_compile_definitions(NF_INT_IS_C_INT) +#add_compile_definitions(NF_INT_IS_C_LONG) +add_compile_definitions(NF_INT8_IS_C_LONG_LONG) +add_compile_definitions(NF_REAL_IS_C_FLOAT) +#add_compile_definitions(NF_REAL_IS_C_DOUBLE) +add_compile_definitions(NF_DOUBLEPRECISION_IS_C_DOUBLE) +#add_compile_definitions(NF_DOUBLEPRECISION_IS_C_FLOAT) ### # Type checks @@ -668,12 +657,17 @@ CHECK_C_SOURCE_COMPILES(" #endif int main() {return 0;}" HAVE_QUANTIZE) if (HAVE_QUANTIZE) - ADD_DEFINITIONS(-DNF_HAS_QUANTIZE) + add_compile_definitions(NF_HAS_QUANTIZE) endif() CHECK_LIBRARY_EXISTS(${NETCDF_C_LIBRARY} nc_def_var_szip "" HAVE_DEF_VAR_SZIP) if (NOT HAVE_DEF_VAR_SZIP) - message(FATAL_ERROR "netcdf-c version 4.7.4 or greater is required") + message(FATAL_ERROR "netcdf-c version 4.7.4 or greater is required." + "If netCDF-C 4.7.4 is present but is built statically, you *must* specify all dependencies" + "by setting the LDFLAGS environmental variable.\n" + "Example:\n" + " $ export LDFLAGS=$(nc-config --libs)" + ) endif() ### @@ -755,12 +749,12 @@ ENDIF(BUILD_DAP) SET(ENABLE_NETCDF4 OFF) IF(USE_NETCDF4) SET(ENABLE_NETCDF4 ON) - ADD_DEFINITIONS(-DUSE_NETCDF4) + add_compile_definitions(USE_NETCDF4) SET(ENABLE_NETCDF4 ON CACHE BOOL "") ENDIF() IF (UNIX AND ${CMAKE_SIZEOF_VOID_P} MATCHES "8") - ADD_DEFINITIONS(-DLONGLONG_IS_LONG) + add_compile_definitions(LONGLONG_IS_LONG) # for easier debugging of cfortran.h IF (APPLE) IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang") @@ -794,10 +788,10 @@ try_compile(NF_HAS_PARALLEL4 ${CMAKE_CURRENT_BINARY_DIR} ) IF(NF_HAS_PARALLEL4) - ADD_DEFINITIONS(-DNF_HAS_PARALLEL4) + add_compile_definitions(NF_HAS_PARALLEL4) ENDIF() IF(NF_HAS_PNETCDF) - ADD_DEFINITIONS(-DNF_HAS_PNETCDF) + add_compile_definitions(NF_HAS_PNETCDF) ENDIF() IF(NF_HAS_PNETCDF OR NF_HAS_PARALLEL4) @@ -825,7 +819,7 @@ try_compile(COMPILE_SUCCESS ${CMAKE_CURRENT_BINARY_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/CMakeExtras/test_c_ptrdiff_t.f90" ) IF (COMPILE_SUCCESS) - ADD_DEFINITIONS(-DHAVE_TS29113_SUPPORT) + add_compile_definitions(HAVE_TS29113_SUPPORT) SET(HAVE_TS29113_SUPPORT TRUE) ELSE () # If the compile fails, PTRDIFF_T is not defined. @@ -844,7 +838,7 @@ ELSE () IF (SIZEOF_RESULT) MESSAGE (FATAL_ERROR "UNABLE TO DETERMINE SIZEOF PTRDIFF_T") ELSE (SIZEOF_RESULT) - ADD_DEFINITIONS(-DSIZEOF_PTRDIFF_T=${SIZEOF_PTRDIFF_T}) + add_compile_definitions(SIZEOF_PTRDIFF_T=${SIZEOF_PTRDIFF_T}) ENDIF (SIZEOF_RESULT) ELSE() MESSAGE(FATAL_ERROR "Unable to compile ptrdiff") @@ -930,16 +924,16 @@ IF(NOT MSVC) SET(CMAKE_MACOSX_RPATH ON) ENDIF() - SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") + SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") # add the automatically determined parts of the RPATH # which point to directories outside the build tree to the install RPATH SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) # the RPATH to be used when installing, but only if it's not a system directory - LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) + LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" isSystemDir) IF("${isSystemDir}" STREQUAL "-1") - SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") + SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") ENDIF("${isSystemDir}" STREQUAL "-1") ENDIF() @@ -971,7 +965,7 @@ SET(MOD_FLAG -I) SET(NC_EXTRA_DEPS "" CACHE STRING "Additional libraries to link against.") IF(NC_EXTRA_DEPS) STRING(REPLACE " " ";" DEPS_LIST ${NC_EXTRA_DEPS}) - FOREACH(_DEP ${DEPS_LIST}) + FOREACH(_DEP IN LISTS DEPS_LIST) STRING(REGEX REPLACE "^-l" "" _LIB ${_DEP}) FIND_LIBRARY("${_LIB}_DEP" NAMES "${_LIB}" "lib${_LIB}") # MESSAGE(${${_LIB}_DEP}) @@ -1036,26 +1030,6 @@ IF(CMAKE_LINK_FLAGS) SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${CMAKE_LINK_FLAGS}") ENDIF() -# Set -SET(prefix ${CMAKE_INSTALL_PREFIX}) -SET(exec_prefix ${CMAKE_INSTALL_PREFIX}) -SET(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}) -SET(includedir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}) -SET(CC ${CMAKE_C_COMPILER}) -SET(FC ${CMAKE_Fortran_COMPILER}) - -configure_file( - ${CMAKE_SOURCE_DIR}/netcdf-fortran.pc.in - ${CMAKE_BINARY_DIR}/netcdf-fortran.pc @ONLY) - -INSTALL(FILES ${CMAKE_BINARY_DIR}/netcdf-fortran.pc - DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig - COMPONENT utilities) - -INSTALL(PROGRAMS ${NC4F_BINARY_DIR}/nf-config - DESTINATION "${CMAKE_INSTALL_BINDIR}" - COMPONENT utilities) - # End autotools-style checks for config.h # Recurse into other subdirectories. @@ -1084,9 +1058,9 @@ print_conf_summary() # Set variables to mirror those used by autoconf. # This way we don't need to maintain two separate template # files. -SET(host_cpu "${cpu}") -SET(host_vendor "${osname}") -SET(host_os "${osrel}") +SET(host_cpu "${CMAKE_SYSTEM_PROCESSOR}") +SET(host_vendor "${CMAKE_SYSTEM_NAME}") +SET(host_os "${CMAKE_SYSTEM_VERSION}") SET(abs_top_builddir "${CMAKE_CURRENT_BINARY_DIR}") SET(abs_top_srcdir "${CMAKE_CURRENT_SOURCE_DIR}") @@ -1102,7 +1076,7 @@ SET(NC_FLIBS "") get_target_property(ALL_TLL_LIBS netcdff LINK_LIBRARIES) -FOREACH(_LIB ${ALL_TLL_LIBS}) +FOREACH(_LIB IN LISTS ALL_TLL_LIBS) GET_FILENAME_COMPONENT(_LIB_NAME ${_LIB} NAME_WE) STRING(REGEX REPLACE "^lib" "" _NAME ${_LIB_NAME}) LIST(APPEND NC_FLIBS "-l${_NAME}") @@ -1180,18 +1154,39 @@ INSTALL(FILES "${CMAKE_BINARY_DIR}/libnetcdff.settings" # End libnetcdff.settings section. ##### -# Generate nf-config form template. -CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/nf-config.cmake.in" +# Set variables used in nf-config and pkgconfig templates +set(prefix "${CMAKE_INSTALL_PREFIX}") +set(exec_prefix "${CMAKE_INSTALL_PREFIX}") +set(libdir "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") +set(includedir "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}") +set(fmoddir "${CMAKE_INSTALL_PREFIX}/${Fortran_INSTALL_MODDIR}") +set(CC "${CMAKE_C_COMPILER}") +set(FC "${CMAKE_Fortran_COMPILER}") +set(CPPFLAGS "${CMAKE_C_FLAGS} ${CMAKE_CPP_FLAGS}") + +# Generate nf-config from template +configure_file("${CMAKE_SOURCE_DIR}/nf-config.in" "${CMAKE_BINARY_DIR}/tmp/nf-config" @ONLY NEWLINE_STYLE LF) -FILE(COPY "${CMAKE_BINARY_DIR}/tmp/nf-config" +file(COPY "${CMAKE_BINARY_DIR}/tmp/nf-config" DESTINATION ${CMAKE_BINARY_DIR}/ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) +configure_file( + ${CMAKE_SOURCE_DIR}/netcdf-fortran.pc.in + ${CMAKE_BINARY_DIR}/netcdf-fortran.pc @ONLY) + +install(FILES ${CMAKE_BINARY_DIR}/netcdf-fortran.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig + COMPONENT utilities) + +install(PROGRAMS ${NC4F_BINARY_DIR}/nf-config + DESTINATION "${CMAKE_INSTALL_BINDIR}" + COMPONENT utilities) include(CMakePackageConfigHelpers) -set(ConfigPackageLocation "${CMAKE_INSTALL_LIBDIR}/cmake/netCDF") +set(ConfigPackageLocation "${CMAKE_INSTALL_LIBDIR}/cmake/netCDF-Fortran") write_basic_package_version_file( "${CMAKE_CURRENT_BINARY_DIR}/netCDF-FortranConfigVersion.cmake" diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 09bd88e9..2392c09f 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -36,7 +36,6 @@ Entries are in reverse chronological order (most recent first). ### Requirements * netCDF-C: 4.9.0+ - ### Notable Changes * We've added API support to take advantage of the Quantize functionality provided by libnetcdf 4.9.0+. [See this conversation](https://github.com/Unidata/netcdf-c/issues/1548) for more information. diff --git a/configure.ac b/configure.ac index 4ef3ccdb..bc26c410 100644 --- a/configure.ac +++ b/configure.ac @@ -9,8 +9,10 @@ AC_PREREQ([2.59]) # Initialize with name, version, and support email address. + AC_INIT([netCDF-Fortran], [4.6.2-development], [support-netcdf@unidata.ucar.edu]) + # Create the VERSION file, which contains the package version from # AC_INIT. echo -n AC_PACKAGE_VERSION>VERSION @@ -35,6 +37,7 @@ AC_CANONICAL_TARGET # This call is required by automake. AM_INIT_AUTOMAKE([1.13 foreign dist-zip subdir-objects]) +#AM_MAINTAINER_MODE() AC_MSG_NOTICE([checking user options]) @@ -550,7 +553,7 @@ AC_CHECK_FUNCS([nc_def_opaque nccreate nc_set_log_level oc_open nc_def_var_szip] # Starting with version 4.7.4, netcdf-c has function nc_def_var_szip(). if test "x$ac_cv_func_nc_def_var_szip" != xyes; then - AC_MSG_ERROR([netcdf-c version 4.7.4 or greater is required]) + AC_MSG_ERROR([netcdf-c version 4.7.4 or greater is required, built with underlying szip support.]) fi nc_build_v2=no diff --git a/docs/Doxyfile.developer b/docs/Doxyfile.developer index 0011d162..54e3dca0 100644 --- a/docs/Doxyfile.developer +++ b/docs/Doxyfile.developer @@ -38,6 +38,7 @@ PROJECT_NAME = netcdf-fortran # could be handy for archiving the generated documentation or if some version # control system is used. + PROJECT_NUMBER = 4.6.2-Development # Using the PROJECT_BRIEF tag one can provide an optional one line description diff --git a/fortran/CMakeLists.txt b/fortran/CMakeLists.txt index b08b2cc8..9aca68c0 100644 --- a/fortran/CMakeLists.txt +++ b/fortran/CMakeLists.txt @@ -11,18 +11,24 @@ SET(netcdff_SOURCES ) # Check if netcdf-c has parallel I/O feature enabled -IF (NETCDF_C_INCLUDE_DIR) +if (NETCDF_C_INCLUDE_DIR) file(READ "${NETCDF_C_INCLUDE_DIR}/netcdf_meta.h" header) string(REGEX MATCH "#define NC_HAS_PARALLEL *[01]" macrodef "${header}") string(REGEX MATCH "[01]" HAVE_PARALLEL "${macrodef}") - IF (HAVE_PARALLEL) - SET(netcdff_SOURCES ${netcdff_SOURCES} nf_nc.F90) - MESSAGE(STATUS "Whether NetCDF-C built with paralle I/O enabled: yes") - ELSE() - SET(netcdff_SOURCES ${netcdff_SOURCES} nf_nc_noparallel.F90) - MESSAGE(STATUS "Whether NetCDF-C built with paralle I/O enabled: no") - ENDIF(HAVE_PARALLEL) -ENDIF(NETCDF_C_INCLUDE_DIR) +else() + # Probably using CMake config file directly + set(HAVE_PARALLEL ${netCDF_HAS_PARALLEL}) +endif(NETCDF_C_INCLUDE_DIR) + +if (HAVE_PARALLEL) + set(netcdff_SOURCES ${netcdff_SOURCES} nf_nc.F90) + # Just for a more readable message + set(HAVE_PARALLEL "yes") +else() + set(netcdff_SOURCES ${netcdff_SOURCES} nf_nc_noparallel.F90) + set(HAVE_PARALLEL "no") +endif(HAVE_PARALLEL) +message(STATUS "Whether NetCDF-C built with parallel I/O enabled: ${HAVE_PARALLEL}") IF (USE_NETCDF4) SET(netcdff_SOURCES ${netcdff_SOURCES} @@ -141,24 +147,17 @@ IF (BUILD_SHARED_LIBS) ENDIF() # This is what we are building: a convenience library of Fortran 2003 functions. -# This just builds SHARED, even though STATIC is also specified -# ADD_LIBRARY(netcdff STATIC SHARED ${netcdff_SOURCES}) -# Builds only static, not shared # Compile C-code to object, then link with Fortran -ADD_LIBRARY(netcdff_c OBJECT ${netcdff_C_SOURCES}) +add_library(netcdff_c OBJECT ${netcdff_C_SOURCES}) install(TARGETS netcdff_c OBJECTS DESTINATION lib) -# or is this better? list(APPEND NETCDF_C_LIBRARY netcdff_c) -SET(NETCDF_C_LIBRARY ${NETCDF_C_LIBRARY} netcdff_c) -set_target_properties(netcdff_c PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${NETCDF_C_INCLUDE_DIR}" - ) -target_include_directories(netcdff_c PUBLIC "${NETCDF_C_INCLUDE_DIR}") +target_link_libraries(netcdff_c PUBLIC netCDF::netcdf) -ADD_LIBRARY(netcdff ${netcdff_SOURCES}) -TARGET_LINK_LIBRARIES(netcdff PUBLIC netCDF::netcdf) -TARGET_LINK_LIBRARIES(netcdff PRIVATE ${NETCDF_C_LIBRARY}) -TARGET_LINK_LIBRARIES(netcdff PUBLIC ${EXTRA_DEPS}) -SET_TARGET_PROPERTIES(netcdff PROPERTIES +add_library(netcdff ${netcdff_SOURCES}) +target_link_libraries(netcdff + PUBLIC netCDF::netcdf ${EXTRA_DEPS} + PRIVATE netcdff_c +) +set_target_properties(netcdff PROPERTIES VERSION ${NC4F_LIB_VERSION} SOVERSION ${NC4F_SO_VERSION} ) @@ -193,16 +192,16 @@ IF(NOT MSVC) # (but later on when installing) SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) - SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") + SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") # add the automatically determined parts of the RPATH # which point to directories outside the build tree to the install RPATH SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) # the RPATH to be used when installing, but only if it's not a system directory - LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) + LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" isSystemDir) IF("${isSystemDir}" STREQUAL "-1") - SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") + SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") ENDIF("${isSystemDir}" STREQUAL "-1") ENDIF() diff --git a/fortran/module_netcdf4_nc_interfaces.F90 b/fortran/module_netcdf4_nc_interfaces.F90 index 7be413e2..62b2ff34 100755 --- a/fortran/module_netcdf4_nc_interfaces.F90 +++ b/fortran/module_netcdf4_nc_interfaces.F90 @@ -310,13 +310,13 @@ Function nc_insert_array_compound_f(ncid, xtype, name, offset, field_typeid, & USE ISO_C_BINDING, ONLY: C_INT, C_SIZE_T, C_CHAR - Integer(C_INT), VALUE :: ncid, ndims - Integer(C_INT), VALUE :: xtype, field_typeid ! nc_type in C - Integer(C_SIZE_T), VALUE :: offset - Character(KIND=C_CHAR), Intent(IN) :: name(*) - Integer(C_INT), Intent(INOUT) :: dim_sizes(*) + Integer(C_INT), VALUE :: ncid, ndims + Integer(C_INT), VALUE :: xtype, field_typeid ! nc_type in C + Integer(C_SIZE_T), VALUE :: offset + Character(KIND=C_CHAR), Intent(IN) :: name(*) + Integer(C_INT), Intent(IN) :: dim_sizes(*) - Integer(C_INT) :: nc_insert_array_compound_f + Integer(C_INT) :: nc_insert_array_compound_f End Function nc_insert_array_compound_f End Interface diff --git a/fortran/module_netcdf4_nf_interfaces.F90 b/fortran/module_netcdf4_nf_interfaces.F90 index 158e4f97..7f2fe9d2 100755 --- a/fortran/module_netcdf4_nf_interfaces.F90 +++ b/fortran/module_netcdf4_nf_interfaces.F90 @@ -217,10 +217,10 @@ End Function nf_insert_compound Function nf_insert_array_compound( ncid, xtype, name, offset, field_typeid, & ndims, dim_sizes) RESULT (status) - Integer, Intent(IN) :: ncid, xtype, field_typeid, offset, ndims - Integer, Intent(INOUT) :: dim_sizes(*) - Character(LEN=*), Intent(IN) :: name - Integer :: status + Integer, Intent(IN) :: ncid, xtype, field_typeid, offset, ndims + Integer, Intent(IN) :: dim_sizes(*) + Character(LEN=*), Intent(IN) :: name + Integer :: status End Function nf_insert_array_compound End Interface @@ -483,9 +483,9 @@ End Function nf_inq_opaque Function nf_def_var_chunking( ncid, varid, contiguous, chunksizes) & RESULT(status) - Integer, Intent(IN) :: ncid, varid, contiguous - Integer, Intent(INOUT) :: chunksizes(*) - Integer :: status + Integer, Intent(IN) :: ncid, varid, contiguous + Integer, Intent(IN) :: chunksizes(*) + Integer :: status End Function nf_def_var_chunking End Interface diff --git a/fortran/module_netcdf_nc_data.F90 b/fortran/module_netcdf_nc_data.F90 index 9de2e74c..c7c9e118 100755 --- a/fortran/module_netcdf_nc_data.F90 +++ b/fortran/module_netcdf_nc_data.F90 @@ -314,6 +314,7 @@ Module netcdf_nc_data Integer(C_INT), Parameter :: NC_FATAL = 1 Integer(C_INT), Parameter :: NC_VERBOSE = 2 +#define USE_NETCDF4 #ifdef USE_NETCDF4 ! NETCDF4 data diff --git a/fortran/module_typesizes.F90 b/fortran/module_typesizes.F90 new file mode 100644 index 00000000..84c7f4f7 --- /dev/null +++ b/fortran/module_typesizes.F90 @@ -0,0 +1,65 @@ +! Description: +! Provide named kind parameters for use in declarations of real and integer +! variables with specific byte sizes (i.e. one, two, four, and eight byte +! integers; four and eight byte reals). The parameters can then be used +! in (KIND = XX) modifiers in declarations. +! A single function (byteSizesOK()) is provided to ensure that the selected +! kind parameters are correct. +! +! Input Parameters: +! None. +! +! Output Parameters: +! Public parameters, fixed at compile time: +! OneByteInt, TwoByteInt, FourByteInt, EightByteInt +! FourByteReal, EightByteRadl +! +! References and Credits: +! Written by +! Robert Pincus +! Cooperative Institue for Meteorological Satellite Studies +! University of Wisconsin - Madison +! 1225 W. Dayton St. +! Madison, Wisconsin 53706 +! Robert.Pincus@ssec.wisc.edu +! +! Design Notes: +! Fortran 90 doesn't allow one to check the number of bytes in a real variable; +! we check only that four byte and eight byte reals have different kind parameters. +! +module typesizes + implicit none + public + integer, parameter :: OneByteInt = selected_int_kind(2), & + TwoByteInt = selected_int_kind(4), & + FourByteInt = selected_int_kind(9), & + EightByteInt = selected_int_kind(18) + + integer, parameter :: & + FourByteReal = selected_real_kind(P = 6, R = 37), & + EightByteReal = selected_real_kind(P = 13, R = 307) +contains + logical function byteSizesOK() + ! Users may call this function once to ensure that the kind parameters + ! the module defines are available with the current compiler. + ! We can't ensure that the two REAL kinds are actually four and + ! eight bytes long, but we can ensure that they are distinct. + ! Early Fortran 90 compilers would sometimes report incorrect results for + ! the bit_size intrinsic, but I haven't seen this in a long time. + + ! Local variables + integer (kind = OneByteInt) :: One + integer (kind = TwoByteInt) :: Two + integer (kind = FourByteInt) :: Four + integer (kind = EightByteInt) :: Eight + + if (bit_size( One) == 8 .and. bit_size( Two) == 16 .and. & + bit_size(Four) == 32 .and. bit_size( Eight) == 64 .and. & + FourByteReal > 0 .and. EightByteReal > 0 .and. & + FourByteReal /= EightByteReal) then + byteSizesOK = .true. + else + byteSizesOK = .false. + end if + end function byteSizesOK +end module typeSizes diff --git a/fortran/netcdf.F90 b/fortran/netcdf.F90 index e47b6847..a18b36c9 100644 --- a/fortran/netcdf.F90 +++ b/fortran/netcdf.F90 @@ -43,18 +43,18 @@ module netcdf ! ! Update the dependencies in the Makefile.am when modifying the list of ! included files. -#include "netcdf_constants.f90" -#include "netcdf_externals.f90" -#include "netcdf_overloads.f90" -#include "netcdf_visibility.f90" +#include "netcdf_constants.F90" +#include "netcdf_externals.F90" +#include "netcdf_overloads.F90" +#include "netcdf_visibility.F90" contains -#include "netcdf_file.f90" -#include "netcdf3_file.f90" -#include "netcdf_dims.f90" -#include "netcdf_attributes.f90" -#include "netcdf_variables.f90" -#include "netcdf_text_variables.f90" -#include "netcdf_expanded_subset.f90" -#include "netcdf_get_nd_expanded.f90" -#include "netcdf_eightbyte_subset.f90" +#include "netcdf_file.F90" +#include "netcdf3_file.F90" +#include "netcdf_dims.F90" +#include "netcdf_attributes.F90" +#include "netcdf_variables.F90" +#include "netcdf_text_variables.F90" +#include "netcdf_expanded_subset.F90" +#include "netcdf_get_nd_expanded.F90" +#include "netcdf_eightbyte_subset.F90" end module netcdf diff --git a/fortran/netcdf4_func.F90 b/fortran/netcdf4_func.F90 index 0b92d656..bf1b99f8 100644 --- a/fortran/netcdf4_func.F90 +++ b/fortran/netcdf4_func.F90 @@ -183,7 +183,7 @@ function nf90_inq_dimids(ncid, ndims, dimids, include_parents) integer, intent(in) :: ncid integer, intent(out) :: ndims integer, dimension(:), intent(out) :: dimids - integer, intent(out) :: include_parents + integer, intent(in) :: include_parents integer :: nf90_inq_dimids nf90_inq_dimids = nf_inq_dimids(ncid, ndims, dimids, include_parents) @@ -255,7 +255,7 @@ function nf90_insert_array_compound(ncid, xtype, name, offset, field_typeid, & integer, intent(in) :: offset integer, intent(in) :: field_typeid integer, intent(in) :: ndims - integer, intent(in) :: dim_sizes + integer, dimension(:), intent(in) :: dim_sizes integer :: nf90_insert_array_compound nf90_insert_array_compound = nf_insert_array_compound(ncid, xtype, name, & @@ -319,7 +319,7 @@ function nf90_inq_compound_field(ncid, xtype, fieldid, name, offset, & integer, intent(out) :: offset integer, intent(out) :: field_typeid integer, intent(out) :: ndims - integer, intent(out) :: dim_sizes + integer, dimension(:), intent(out) :: dim_sizes integer :: nf90_inq_compound_field nf90_inq_compound_field = nf_inq_compound_field(ncid, xtype, fieldid, name, offset, & @@ -380,7 +380,7 @@ function nf90_inq_cmp_fielddim_sizes(ncid, xtype, fieldid, dim_sizes) integer, intent(in) :: ncid integer, intent(in) :: xtype integer, intent(in) :: fieldid - integer, intent(out) :: dim_sizes + integer, dimension(:), intent(out) :: dim_sizes integer :: nf90_inq_cmp_fielddim_sizes nf90_inq_cmp_fielddim_sizes = nf_inq_compound_fielddim_sizes(ncid, xtype, fieldid, dim_sizes) @@ -464,20 +464,20 @@ function nf90_inq_enum_member(ncid, xtype, idx, name, value) integer, intent(in) :: xtype integer, intent(in) :: idx character (len = *), intent(out) :: name - integer, intent(in) :: value + integer, intent(out) :: value integer :: nf90_inq_enum_member nf90_inq_enum_member = nf_inq_enum_member(ncid, xtype, idx, name, value) end function nf90_inq_enum_member ! ----------- - function nf90_inq_enum_ident(ncid, xtype, value, idx) + function nf90_inq_enum_ident(ncid, xtype, value, identifier) integer, intent(in) :: ncid integer, intent(in) :: xtype integer, intent(in) :: value - integer, intent(out) :: idx + character (len = *), intent(out) :: identifier integer :: nf90_inq_enum_ident - nf90_inq_enum_ident = nf_inq_enum_ident(ncid, xtype, value, idx) + nf90_inq_enum_ident = nf_inq_enum_ident(ncid, xtype, value, identifier) end function nf90_inq_enum_ident ! ----------- function nf90_def_opaque(ncid, size, name, xtype) diff --git a/fortran/nf_nc4.F90 b/fortran/nf_nc4.F90 index 30ea9ee9..a1b58f2a 100755 --- a/fortran/nf_nc4.F90 +++ b/fortran/nf_nc4.F90 @@ -566,11 +566,11 @@ Function nf_insert_array_compound( ncid, xtype, name, offset, field_typeid, & Implicit NONE - Integer, Intent(IN) :: ncid, xtype, field_typeid, offset, ndims - Character(LEN=*), Intent(IN) :: name - Integer, Intent(INOUT) :: dim_sizes(*) + Integer, Intent(IN) :: ncid, xtype, field_typeid, offset, ndims + Character(LEN=*), Intent(IN) :: name + Integer, Intent(IN) :: dim_sizes(*) - Integer :: status + Integer :: status Integer(C_INT) :: cncid, cxtype, ctypeid, cndims, cstatus Integer(C_SIZE_T) :: coffset @@ -1370,10 +1370,10 @@ Function nf_def_var_chunking( ncid, varid, contiguous, chunksizes) & Implicit NONE - Integer, Intent(IN) :: ncid, varid, contiguous - Integer, Intent(INOUT) :: chunksizes(*) + Integer, Intent(IN) :: ncid, varid, contiguous + Integer, Intent(IN) :: chunksizes(*) - Integer :: status + Integer :: status Integer(C_INT) :: cncid, cvarid, ccontiguous, cstat1, cstatus, & cndims diff --git a/m4/dummy.txt b/m4/dummy.txt deleted file mode 100644 index 0651e5fe..00000000 --- a/m4/dummy.txt +++ /dev/null @@ -1,2 +0,0 @@ -This file exists just to make git put the m4/ parent directory in the -repository, since git doesn't seem to like empty directories ... diff --git a/nf-config.cmake.in b/nf-config.cmake.in deleted file mode 100644 index f8e51cbd..00000000 --- a/nf-config.cmake.in +++ /dev/null @@ -1,133 +0,0 @@ -#! /bin/sh -# -# This forms the basis for the nf-config utility, which tells you -# various things about the netCDF Fortran installation. - - -prefix=@CMAKE_INSTALL_PREFIX@ -exec_prefix=@CMAKE_INSTALL_PREFIX@ -libdir=@CMAKE_INSTALL_PREFIX@/lib -includedir=@CMAKE_INSTALL_PREFIX@/include -fmoddir=@CMAKE_INSTALL_PREFIX@/@Fortran_INSTALL_MODDIR@ -# -cc="@CMAKE_C_COMPILER@" -fc="@CMAKE_Fortran_COMPILER@" -cflags="-I@CMAKE_INSTALL_PREFIX@/include @CMAKE_C_FLAGS@ @CMAKE_CPP_FLAGS@" -fflags="-I${includedir} @MOD_FLAG@${fmoddir}" -# -has_dap="@HAS_DAP@" -has_nc2="@HAS_NC2@" -has_nc4="@HAS_NC4@" -has_f90="@HAS_F90@" -has_f03="@HAS_F03@" -flibs="-L${libdir} @NC_FLIBS@" -version="@PACKAGE_NAME@ @PACKAGE_VERSION@" - - usage() - { - echo - echo "This $version has been built with the following features: " - echo - echo " --cc -> $cc" - echo " --cflags -> $cflags" - echo - echo " --fc -> $fc" - echo " --fflags -> $fflags" - echo " --flibs -> $flibs" - echo " --has-f90 -> $has_f90" - echo " --has-f03 -> $has_f03" - echo - echo " --has-nc2 -> $has_nc2" - echo " --has-nc4 -> $has_nc4" - echo - echo " --prefix -> $prefix" - echo " --includedir-> $includedir" - echo " --version -> $version" - echo - } - - if test $# -eq 0; then - usage 1 - fi - - while test $# -gt 0; do - case "$1" in - #this deals with options in the style - #--option=value and extracts the value part - #[not currently used] - -*=*) value=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) value= ;; - esac - - case "$1" in - - --help) - usage 0 - ;; - - --all) - all - ;; - - --cc) - echo $cc - ;; - - --fc) - echo $fc - ;; - - --cflags) - echo $cflags - ;; - - --fflags) - echo $fflags - ;; - - --has-dap) - echo $has_dap - ;; - - --has-nc2) - echo $has_nc2 - ;; - - --has-nc4) - echo $has_nc4 - ;; - - --has-f90) - echo $has_f90 - ;; - - --has-f03) - echo $has_f03 - ;; - - --flibs) - echo $flibs - ;; - - --prefix) - echo "${CMAKE_INSTALL_PREFIX}" - ;; - - --includedir) - echo "${includedir}" - ;; - - --version) - echo $version - ;; - - *) - echo "unknown option: $1" - usage - exit 1 - ;; - esac - shift - done - - exit 0 diff --git a/nf03_test/CMakeLists.txt b/nf03_test/CMakeLists.txt index 6306b570..4cdd3d1d 100644 --- a/nf03_test/CMakeLists.txt +++ b/nf03_test/CMakeLists.txt @@ -15,7 +15,7 @@ SET(tst_fill_int64_SOURCES tst_fill_int64.F90) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/fortran ${CMAKE_SOURCE_DIR}/libsrc ${CMAKE_SOURCE_DIR} ${CMAKE_CPP_FLAGS} ${NETCDF_C_INCLUDE_DIR}) LINK_DIRECTORIES(${CMAKE_SOURCE_DIR}/fortran ${CMAKE_SOURCE_DIR}/libsrc) -FOREACH(t ${TESTS}) +FOREACH(t IN LISTS TESTS) ADD_EXECUTABLE(${t} ${${t}_SOURCES}) TARGET_LINK_LIBRARIES(${t} netcdff) ADD_TEST(${t} ${t}) diff --git a/nf03_test4/CMakeLists.txt b/nf03_test4/CMakeLists.txt index d968241e..0f914f57 100644 --- a/nf03_test4/CMakeLists.txt +++ b/nf03_test4/CMakeLists.txt @@ -39,7 +39,7 @@ if (USE_NETCDF4) CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/run_f90_par_test.sh.in" "${CMAKE_CURRENT_SOURCE_DIR}/run_f90_par_test.sh" @ONLY) - FILE(COPY "${CMAKE_CURRENT_SOURCE_DIR}/run_f90_par_test.sh" + FILE(COPY "${CMAKE_CURRENT_SOURCE_DIR}/run_f90_par_test.sh" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE) @@ -74,7 +74,7 @@ if (USE_NETCDF4) endif(USE_NETCDF4) # Create pre-compiled tests. -FOREACH(t ${TESTS}) +FOREACH(t IN LISTS TESTS) ADD_EXECUTABLE(${t} ${${t}_SOURCES}) TARGET_LINK_LIBRARIES(${t} netcdff) ADD_TEST(${t} ${t}) diff --git a/nf_test/CMakeLists.txt b/nf_test/CMakeLists.txt index 42bca31e..eecc9392 100644 --- a/nf_test/CMakeLists.txt +++ b/nf_test/CMakeLists.txt @@ -4,8 +4,8 @@ SET(CMAKE_INCLUDE_CURRENT_DIR ON) # Process these files with m4. SET(m4_SOURCES test_get test_put) -foreach (f ${m4_SOURCES}) - GEN_m4(${f}) +foreach (f IN LISTS m4_SOURCES) + GEN_m4(${f}) endforeach(f) # Separate C and Fortran Sources @@ -59,7 +59,7 @@ LINK_DIRECTORIES(${CMAKE_SOURCE_DIR}/fortran ${CMAKE_SOURCE_DIR}/libsrc # Create pre-compiled tests. message ("Create pre-compiled tests.") -FOREACH(t ${TESTS}) +FOREACH(t IN LISTS TESTS) ADD_EXECUTABLE(${t} ${${t}_SOURCES}) message(" " ${t} " C_SOURCES: " ${${t}_C_SOURCES}) IF(${t}_C_SOURCES) @@ -80,7 +80,7 @@ FILE(COPY ${COPY_FILES} FILE_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE) # Add script-based tests. -FOREACH(t ${SCRIPT_TESTS}) +FOREACH(t IN LISTS SCRIPT_TESTS) add_sh_test(nf_test ${t}) ENDFOREACH() diff --git a/nf_test4/CMakeLists.txt b/nf_test4/CMakeLists.txt index 9842ddf3..ad56024e 100644 --- a/nf_test4/CMakeLists.txt +++ b/nf_test4/CMakeLists.txt @@ -67,7 +67,7 @@ IF (HAVE_SZIP_WRITE) ENDIF() # Create pre-compiled tests. -FOREACH(t ${TESTS}) +FOREACH(t IN LISTS TESTS) ADD_EXECUTABLE(${t} ${${t}_SOURCES}) TARGET_LINK_LIBRARIES(${t} netcdff) ADD_TEST(${t} ${t}) diff --git a/nf_test4/ftst_vars.F b/nf_test4/ftst_vars.F index fe8d9599..f8d6aa25 100644 --- a/nf_test4/ftst_vars.F +++ b/nf_test4/ftst_vars.F @@ -35,10 +35,12 @@ program ftst_vars integer endianness C Cache size stuff. - integer DEFAULT_CACHE_SIZE, DEFAULT_CACHE_NELEMS + integer DEFAULT_CACHE_SIZE, DEFAULT_CACHE_NELEMS_OLD + integer DEFAULT_CACHE_NELEMS_NEW integer DEFAULT_CACHE_PREEMPTION parameter (DEFAULT_CACHE_SIZE = 16777216) - parameter (DEFAULT_CACHE_NELEMS = 4133) + parameter (DEFAULT_CACHE_NELEMS_OLD = 4133) + parameter (DEFAULT_CACHE_NELEMS_NEW = 1000) parameter (DEFAULT_CACHE_PREEMPTION = 75) integer CACHE_SIZE, CACHE_NELEMS, CACHE_PREEMPTION parameter (CACHE_SIZE = 8000, CACHE_NELEMS = 500) @@ -63,7 +65,8 @@ program ftst_vars & cache_preemption_in) if (retval .ne. nf_noerr) stop 1 if (cache_size_in .ne. DEFAULT_CACHE_SIZE .or. - & cache_nelems_in .ne. DEFAULT_CACHE_NELEMS .or. + & (cache_nelems_in .ne. DEFAULT_CACHE_NELEMS_OLD .and. + & cache_nelems_in .ne. DEFAULT_CACHE_NELEMS_NEW) .or. & cache_preemption_in .ne. DEFAULT_CACHE_PREEMPTION) stop 4 C Change the cache size for the files created/opened in this program.