"Fossies" - the Fresh Open Source Software Archive

Member "netcdf-fortran-4.4.5/nf_test/CMakeLists.txt" (31 Jan 2019, 7623 Bytes) of package /linux/misc/netcdf-fortran-4.4.5.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "CMakeLists.txt": 4.4.4_vs_4.4.5.

    1 CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
    2 
    3 SET(CMAKE_VERBOSE_MAKEFILE OFF)
    4 SET(CMAKE_BUILD_TYPE "RelWithDebInfo")
    5 SET(CMAKE_INCLUDE_CURRENT_DIR ON)
    6 
    7 
    8 # Process these files with m4.
    9 SET(m4_SOURCES test_get test_put)
   10 foreach (f ${m4_SOURCES})
   11 		   GEN_m4(${f})
   12 endforeach(f)
   13 
   14 
   15 IF (BUILD_F03)
   16   SET(nf_test_SOURCES
   17     f03lib_f_interfaces.f90 test_get.F test_put.F nf_error.F nf_test.F
   18     test_read.F test_write.F util.F f03lib.c tests.inc)
   19 ELSE()
   20   SET(nf_test_SOURCES
   21     test_get.F test_put.F nf_error.F nf_test.F
   22     test_read.F test_write.F util.F fortlib.c tests.inc
   23     )
   24 ENDIF()
   25 
   26 SET(TESTS nf_test)
   27 IF (BUILD_V2)
   28   SET(check_PROGRAMS tst_f77_v2)
   29   SET(tst_f77_v2_SOURCES tst_f77_v2.F)
   30   SET(TESTS ${TESTS} tst_f77_v2)
   31 ENDIF(BUILD_V2)
   32 
   33 # Is the user building netCDF-4?
   34 if (USE_NETCDF4)
   35   # Add these netCDF-4 test programs.
   36   SET(nc4_check_PROGRAMS
   37     ftst_vars ftst_vars2 ftst_vars3 ftst_vars4 ftst_vars5
   38     ftst_vars6 ftst_types ftst_types2 ftst_types3 ftst_groups ftst_path ftst_rengrps)
   39   SET(check_PROGRAMS ${check_PROGRAMS} ${nc4_check_PROGRAMS})
   40   SET(TESTS ${TESTS} ${nc4_check_PROGRAMS})
   41 
   42   if (BUILD_F03)
   43     SET(ftst_types_SOURCES ftst_types.F f03lib_f_interfaces.f90 f03lib.c handle_err.F)
   44     SET(ftst_types2_SOURCES ftst_types2.F f03lib_f_interfaces.f90 f03lib.c handle_err.F)
   45     SET(ftst_types3_SOURCES ftst_types3.F f03lib_f_interfaces.f90 f03lib.c handle_err.F)
   46     SET(ftst_vars_SOURCES ftst_vars.F f03lib_f_interfaces.f90 f03lib.c handle_err.F)
   47     SET(ftst_vars2_SOURCES ftst_vars2.F f03lib_f_interfaces.f90 f03lib.c handle_err.F)
   48     SET(ftst_vars3_SOURCES ftst_vars3.F f03lib_f_interfaces.f90 f03lib.c handle_err.F)
   49     SET(ftst_vars4_SOURCES ftst_vars4.F f03lib_f_interfaces.f90 f03lib.c handle_err.F)
   50     SET(ftst_vars5_SOURCES ftst_vars5.F f03lib_f_interfaces.f90 f03lib.c handle_err.F)
   51     SET(ftst_vars6_SOURCES ftst_vars6.F f03lib_f_interfaces.f90 f03lib.c handle_err.F)
   52     SET(ftst_groups_SOURCES ftst_groups.F f03lib_f_interfaces.f90 f03lib.c handle_err.F)
   53     SET(ftst_path_SOURCES ftst_path.F f03lib_f_interfaces.f90 f03lib.c handle_err.F)
   54     SET(ftst_rengrps_SOURCES ftst_rengrps.F f03lib_f_interfaces.f90 f03lib.c handle_err.F)
   55   else()
   56     SET(ftst_types_SOURCES ftst_types.F fortlib.c handle_err.F)
   57     SET(ftst_types2_SOURCES ftst_types2.F fortlib.c handle_err.F)
   58     SET(ftst_types3_SOURCES ftst_types3.F fortlib.c handle_err.F)
   59     SET(ftst_vars_SOURCES ftst_vars.F fortlib.c handle_err.F)
   60     SET(ftst_vars2_SOURCES ftst_vars2.F fortlib.c handle_err.F)
   61     SET(ftst_vars3_SOURCES ftst_vars3.F fortlib.c handle_err.F)
   62     SET(ftst_vars4_SOURCES ftst_vars4.F fortlib.c handle_err.F)
   63     SET(ftst_vars5_SOURCES ftst_vars5.F fortlib.c handle_err.F)
   64     SET(ftst_vars6_SOURCES ftst_vars6.F fortlib.c handle_err.F)
   65     SET(ftst_groups_SOURCES ftst_groups.F fortlib.c handle_err.F)
   66     SET(ftst_path_SOURCES ftst_path.F fortlib.c handle_err.F)
   67     SET(ftst_rengrps_SOURCES ftst_rengrps.F fortlib.c handle_err.F)
   68   endif(BUILD_F03)
   69   # Add these netCDF-4 f90 test programs.
   70   SET(nc4_f90_PROGRAMS
   71     f90tst_vars tst_types tst_types2 f90tst_vars_vlen
   72     tst_f90_nc4 f90tst_grps f90tst_fill f90tst_fill2 f90tst_vars3
   73     f90tst_vars4 f90tst_vars2)
   74   SET(check_PROGRAMS ${check_PROGRAMS} ${nc4_f90_PROGRAMS})
   75   SET(TESTS ${TESTS} ${nc4_f90_PROGRAMS})
   76   SET(f90tst_vars_SOURCES f90tst_vars.f90)
   77   SET(tst_types_SOURCES tst_types.f90)
   78   SET(tst_types2_SOURCES tst_types2.f90)
   79   SET(tst_f90_nc4_SOURCES tst_f90_nc4.f90)
   80   SET(f90tst_vars_vlen_SOURCES f90tst_vars_vlen.f90)
   81   SET(f90tst_grps_SOURCES f90tst_grps.f90)
   82   SET(f90tst_fill_SOURCES f90tst_fill.f90)
   83   SET(f90tst_fill2_SOURCES f90tst_fill2.f90)
   84   SET(f90tst_vars2_SOURCES f90tst_vars2.f90)
   85   SET(f90tst_vars3_SOURCES f90tst_vars3.f90)
   86   SET(f90tst_vars4_SOURCES f90tst_vars4.f90)
   87 
   88   # This is a netCDF-4 V2 test program.
   89   IF (BUILD_V2)
   90     SET(nc4_v2_PROGRAMS ftst_v2)
   91     SET(check_PROGRAMS ${check_PROGRAMS} ${nc4_v2_PROGRAMS})
   92     SET(TESTS ${TESTS} ${nc4_v2_PROGRAMS})
   93     SET(ftst_v2_SOURCES ftst_v2.F)
   94   ENDIF (BUILD_V2)
   95 
   96   # This is the netCDF-4 F90 large file test.
   97   IF (LARGE_FILE_TESTS)
   98     SET(nc4_largefile_PROGRAMS tst_flarge)
   99     SET(check_PROGRAMS ${check_PROGRAMS} ${nc4_largefile_PROGRAMS})
  100     SET(TESTS ${TESTS} ${nc4_largefile_PROGRAMS})
  101     SET(tst_flarge_SOURCES tst_flarge.f90)
  102   ENDIF(LARGE_FILE_TESTS)
  103 
  104   # This is an f90 benchmark.
  105   IF(BUILD_BENCHMARKS)
  106     SET(nc4_io_PROGRAMS tst_io)
  107     SET(check_PROGRAMS ${check_PROGRAMS} ${nc4_io_PROGRAMS})
  108     SET(TESTS ${TESTS} ${nc4_io_PROGRAMS})
  109     SET(tst_io_SOURCES tst_io.f90)
  110   ENDIF(BUILD_BENCHMARKS)
  111 
  112   # Test parallel I/O.
  113   IF (TEST_PARALLEL)
  114     SET(check_PROGRAMS ${check_PROGRAMS} f90tst_parallel f90tst_parallel2 f90tst_parallel3
  115       f90tst_nc4_par)
  116 
  117     build_bin_test(f90tst_parallel ".F90")
  118     build_bin_test(f90tst_parallel2 ".F90")
  119     build_bin_test(f90tst_parallel3 ".F90")
  120     build_bin_test(f90tst_nc4_par ".F90")
  121 
  122     #SET(f90tst_parallel_fill_SOURCES f90tst_parallel_fill.f90)
  123 
  124   ENDIF (TEST_PARALLEL)
  125 
  126   # Test parallel I/O for F77.
  127   IF (TEST_PARALLEL)
  128     SET(check_PROGRAMS ${check_PROGRAMS} ftst_parallel ftst_parallel_nasa)
  129     SET(SCRIPT_TESTS ${SCRIPT_TESTS} run_f77_par_test)
  130 
  131     # Add executables for f77_par_tst
  132     build_bin_test(ftst_parallel ".F")
  133     build_bin_test(ftst_parallel_nasa ".F")
  134 
  135   ENDIF (TEST_PARALLEL)
  136 
  137   IF(ENABLE_FILTER_TEST)
  138     LIST(APPEND check_PROGRAMS ftst_filter)
  139     LIST(APPEND CLEANFILES ftst_filter.nc)
  140     SET(ftst_filter_SOURCES ftst_filter.F)
  141   ENDIF(ENABLE_FILTER_TEST)
  142 
  143 endif(USE_NETCDF4)
  144 
  145 # This is the fortran v2 test. It depends on the utilities being built
  146 # to generate its input file.
  147 IF (BUILD_V2)
  148   SET(check_PROGRAMS ${check_PROGRAMS} ftest)
  149   SET(TESTS ${TESTS} ftest)
  150   IF (BUILD_F03)
  151     SET(ftest_SOURCES ftest.F f03lib.c)
  152   ELSE()
  153     SET(ftest_SOURCES ftest.F fortlib.c)
  154   ENDIF(BUILD_F03)
  155 ENDIF(BUILD_V2)
  156 
  157 SET(check_PROGRAMS ${check_PROGRAMS} tst_f90)
  158 SET(TESTS ${TESTS} tst_f90)
  159 SET(tst_f90_SOURCES tst_f90.f90)
  160 
  161 FIND_LIBRARY(NETCDF_C_LIBRARY NAMES netcdf libnetcdf)
  162 FIND_PATH(NETCDF_C_INCLUDE_DIR netcdf.h)
  163 IF(NOT NETCDF_C_LIBRARY)
  164   MESSAGE(FATAL_ERROR "Cannot find netCDF C library, needed for netCDF Fortran tests.")
  165 ENDIF()
  166 
  167 # Need a copy of ref_fills.nc for ftest
  168 execute_process(COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/ref_fills.nc
  169   ${CMAKE_CURRENT_BINARY_DIR}/fills.nc)
  170 
  171 INCLUDE_DIRECTORIES(BEFORE
  172   ${CMAKE_CURRENT_BINARY_DIR}
  173   ${CMAKE_BINARY_DIR}/fortran
  174   ${CMAKE_BINARY_DIR}/libsrc
  175   ${CMAKE_SOURCE_DIR}
  176   ${CMAKE_SOURCE_DIR}/fortran
  177   ${CMAKE_SOURCE_DIR}/libsrc)
  178 
  179 INCLUDE_DIRECTORIES(
  180   ${CMAKE_CPP_FLAGS}
  181   ${NETCDF_C_INCLUDE_DIR})
  182 
  183 LINK_DIRECTORIES(${CMAKE_SOURCE_DIR}/fortran ${CMAKE_SOURCE_DIR}/libsrc
  184   ${NC4F_BINARY_DIR}/fortran)
  185 
  186 # Create pre-compiled tests.
  187 FOREACH(t ${TESTS})
  188   ADD_EXECUTABLE(${t} ${${t}_SOURCES})
  189   TARGET_LINK_LIBRARIES(${t} netcdff)
  190   ADD_TEST(${t} ${t})
  191 ENDFOREACH()
  192 
  193 # Copy test scripts in to current directory.
  194 FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.sh)
  195 FILE(COPY ${COPY_FILES}
  196 	  DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/
  197 	  FILE_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE)
  198 
  199 # Add script-based tests.
  200 FOREACH(t ${SCRIPT_TESTS})
  201   add_sh_test(nf_test ${t})
  202 ENDFOREACH()
  203 
  204 
  205 # test_get.F and test_put.f need to be distributed, so that the user
  206 # need not have m4. fills.nc is used by test program ftest.
  207 SET (EXTRA_DIST test_get.F test_put.F fills.cdl create_fills.sh
  208   run_f90_par_test.sh run_f77_par_test.sh ref_fills.nc)
  209 
  210 # Cleaning up files created during the process.
  211 SET (CLEANFILES scratch.nc test.nc copy.nc fills.nc tst_*.nc ftst_*.nc f90tst_*.nc)
  212 
  213 SET (MAINTAINERCLEANFILES test_get.F test_put.F)