Added 'examples' directory to CMake

This commit is contained in:
Ward Fisher 2012-08-28 22:31:07 +00:00
parent 6d6542a85a
commit 31cfdd5910
9 changed files with 136 additions and 65 deletions

View File

@ -58,6 +58,19 @@ MACRO(GEN_m4 filename)
)
ENDMACRO(GEN_m4)
MACRO(add_bin_test prefix F)
ADD_EXECUTABLE(${prefix}_${F} ${F}.c)
TARGET_LINK_LIBRARIES(${prefix}_${F} netcdf)
ADD_TEST(${prefix}_${F} ${EXECUTABLE_OUTPUT_PATH}/${prefix}_${F})
ENDMACRO()
# Shell script Macro
MACRO(add_sh_test prefix F)
ADD_TEST(${prefix}_${F} sh ${CMAKE_CURRENT_BINARY_DIR}/${F}.sh)
ENDMACRO()
#####
# Option checks
#####
@ -89,6 +102,10 @@ OPTION (BUILD_UTILITIES "Build ncgen, ncgen3, ncdump." ON)
# Option to use MMAP
OPTION (BUILD_MMAP "Use MMAP." OFF)
# Option to use examples.
OPTION (ENABLE_EXAMPLES "Build Examples" ON)
# Option to use Diskless
OPTION (ENABLE_DISKLESS "Build Diskless." OFF)
IF(ENABLE_DISKLESS)
@ -123,7 +140,7 @@ ENDIF (USE_HDF4)
# Option to Build DLL
OPTION (ENABLE_DLL "Build a Windows DLL." OFF)
IF (ENABLE_DLL)
SET(BUILD_DLL ON)
SET(BUILD_DLL ON CACHE BOOL "")
ADD_DEFINITIONS(-DDLL_NETCDF)
ADD_DEFINITIONS(-DDLL_EXPORT)
ENDIF ()
@ -467,6 +484,11 @@ IF(ENABLE_TESTS)
IF(USE_DAP)
ADD_SUBDIRECTORY(ncdap_test)
ENDIF()
IF(ENABLE_EXAMPLES)
ADD_SUBDIRECTORY(examples)
ENDIF()
ENDIF()
#####

13
examples/C/CMakeLists.txt Normal file
View File

@ -0,0 +1,13 @@
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
INCLUDE_DIRECTORIES(".")
SET(exam_C_tests simple_xy_wr simple_xy_rd sfc_pres_temp_wr sfc_pres_temp_rd pres_temp_4D_wr pres_temp_4D_rd)
FOREACH(F ${exam_C_tests})
add_bin_test(C_tests ${F})
ENDFOREACH()
SET(CLEANFILES sfc_pres_temp.nc simple_xy.nc pres_temp_4D.nc simple_nc4.nc simple_xy_nc4.nc)
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CLEANFILES}")

View File

@ -0,0 +1,17 @@
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
INCLUDE_DIRECTORIES(".")
SET(CDL_EXAMPLE_TESTS create_sample_files do_comps)
FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.sh ${CMAKE_CURRENT_SOURCE_DIR}/*.cdl)
FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR} FILE_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE)
FOREACH(F ${CDL_EXAMPLE_TESTS})
add_sh_test(cdl ${F})
ENDFOREACH()
SET(CLEANFILES simple_xy.nc sfc_pres_temp.nc pres_temp_4D.nc)
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CLEANFILES}")

View File

@ -1,6 +1,20 @@
#!/bin/sh
# This shell script creates the netCDF example files from CDL scipts.
# $Id: create_sample_files.sh,v 1.2 2006/07/14 18:39:45 ed Exp $
srcdir=`dirname $0`
# compute the build directory
# Do a hack to remove e.g. c: for CYGWIN
cd `pwd`
builddir=`pwd`/..
# Hack for CYGWIN
cd $srcdir
srcdir=`pwd`
if [ `uname | cut -d "_" -f 1` = "MINGW32" ]; then
srcdir=`pwd | sed 's/\/c\//c:\//g'`
builddir=`echo $builddir | sed 's/\/c\//c:\//g'`
fi
set -e
echo ""

View File

@ -1,6 +1,20 @@
#!/bin/sh
# This shell script runs the cmp test on the example programs.
# $Id: do_comps.sh,v 1.1 2006/06/27 17:44:54 ed Exp $
srcdir=`dirname $0`
# compute the build directory
# Do a hack to remove e.g. c: for CYGWIN
cd `pwd`
builddir=`pwd`/..
# Hack for CYGWIN
cd $srcdir
srcdir=`pwd`
if [ `uname | cut -d "_" -f 1` = "MINGW32" ]; then
srcdir=`pwd | sed 's/\/c\//c:\//g'`
builddir=`echo $builddir | sed 's/\/c\//c:\//g'`
fi
set -e
echo ""

10
examples/CMakeLists.txt Normal file
View File

@ -0,0 +1,10 @@
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
INCLUDE_DIRECTORIES(".")
ADD_SUBDIRECTORY(C)
IF(BUILD_UTILITIES)
ADD_SUBDIRECTORY(CDL)
ENDIF()

View File

@ -21,33 +21,22 @@ IF(ENABLE_TESTS)
# must be run in a particular order. It is painful but will use macros to help
# keep it from being too bad.
# Binary Test Macro
MACRO(add_bin_test F)
ADD_EXECUTABLE(ncdap_${F} ${F}.c)
TARGET_LINK_LIBRARIES(ncdap_${F} netcdf)
ADD_TEST(ncdap_${F} ${EXECUTABLE_OUTPUT_PATH}/ncdap_${F})
ENDMACRO()
# Shell script Macro
MACRO(add_sh_test F)
ADD_TEST(ncdap_${F} sh ${CMAKE_CURRENT_BINARY_DIR}/${F}.sh)
ENDMACRO()
add_sh_test(tst_ncdap3)
add_sh_test(ncdap tst_ncdap3)
IF(ENABLE_DAP_REMOTE_TESTS)
add_sh_test(tst_remote3)
add_sh_test(ncdap tst_remote3)
ENDIF()
IF(ENABLE_DAP_LONG_TESTS)
add_sh_test(tst_longremote3)
add_sh_test(ncdap tst_longremote3)
ENDIF()
add_bin_test(t_dap3a)
add_bin_test(test_cvt)
add_bin_test(test_vara)
add_bin_test(test_partvar)
add_bin_test(test_varm3)
add_bin_test(ncdap t_dap3a)
add_bin_test(ncdap test_cvt)
add_bin_test(ncdap test_vara)
add_bin_test(ncdap test_partvar)
add_bin_test(ncdap test_varm3)
ENDIF()

View File

@ -39,58 +39,58 @@ IF(ENABLE_TESTS)
# must be run in a particular order. It is painful but will use macros to help
# keep it from being too bad.
# Binary Test Macro
MACRO(add_bin_test F)
ADD_EXECUTABLE(ncdump_${F} ${F}.c)
TARGET_LINK_LIBRARIES(ncdump_${F} netcdf)
ADD_TEST(ncdump_${F} ${EXECUTABLE_OUTPUT_PATH}/ncdump_${F})
#MACRO(add_bin_test F)
# ADD_EXECUTABLE(ncdump_${F} ${F}.c)
# TARGET_LINK_LIBRARIES(ncdump_${F} netcdf)
# ADD_TEST(ncdump_${F} ${EXECUTABLE_OUTPUT_PATH}/ncdump_${F})
ENDMACRO()
#ENDMACRO()
# Shell script Macro
MACRO(add_sh_test F)
IF(NOT MSVC)
ADD_TEST(ncdump_${F} sh ${CMAKE_CURRENT_BINARY_DIR}/${F}.sh)
ENDIF()
ENDMACRO()
#MACRO(add_sh_test F)
# IF(NOT MSVC)
# ADD_TEST(ncdump_${F} sh ${CMAKE_CURRENT_BINARY_DIR}/${F}.sh)
# ENDIF()
#ENDMACRO()
## Start adding tests in the appropriate order
add_sh_test(run_tests)
add_sh_test(tst_64bit)
add_bin_test(ctest)
add_bin_test(ctest64)
add_sh_test(tst_output)
add_sh_test(tst_lengths)
add_sh_test(tst_calendars)
add_bin_test(tst_utf8)
add_sh_test(run_utf8_tests)
add_sh_test(tst_nccopy3)
add_sh_test(tst_charfill)
add_sh_test(tst_iter)
add_sh_test(ncdump run_tests)
add_sh_test(ncdump tst_64bit)
add_bin_test(ncdump ctest)
add_bin_test(ncdump ctest64)
add_sh_test(ncdump tst_output)
add_sh_test(ncdump tst_lengths)
add_sh_test(ncdump tst_calendars)
add_bin_test(ncdump tst_utf8)
add_sh_test(ncdump run_utf8_tests)
add_sh_test(ncdump tst_nccopy3)
add_sh_test(ncdump tst_charfill)
add_sh_test(ncdump tst_iter)
IF(EXTRA_TESTS)
add_sh_test(run_back_comp_tests)
add_sh_test(ncdump run_back_comp_tests)
ENDIF()
IF(USE_NETCDF4)
add_bin_test(tst_create_files)
add_bin_test(tst_group_data)
add_bin_test(tst_enum_data)
add_bin_test(tst_opaque_data)
add_bin_test(tst_string_data)
add_bin_test(tst_vlen_data)
add_bin_test(tst_comp)
add_bin_test(tst_comp2)
add_bin_test(tst_nans)
add_bin_test(tst_special_atts)
add_bin_test(ncdump tst_create_files)
add_bin_test(ncdump tst_group_data)
add_bin_test(ncdump tst_enum_data)
add_bin_test(ncdump tst_opaque_data)
add_bin_test(ncdump tst_string_data)
add_bin_test(ncdump tst_vlen_data)
add_bin_test(ncdump tst_comp)
add_bin_test(ncdump tst_comp2)
add_bin_test(ncdump tst_nans)
add_bin_test(ncdump tst_special_atts)
#add_sh_test(tst_netcdf4)
#add_bin_test(tst_h_rdc0)
add_bin_test(tst_unicode)
add_bin_test(ncdump tst_unicode)
#add_bin_test(tst_fillbug)
#add_sh_test(tst_fillbug)
add_sh_test(tst_netcdf4_4)
add_bin_test(tst_compress)
add_sh_test(ncdump tst_netcdf4_4)
add_bin_test(ncdump tst_compress)
#add_sh_test(tst_nccopy4)
add_sh_test(tst_grp_spec)
add_sh_test(ncdump tst_grp_spec)
ENDIF()
#add_sh_test(tst_ncgen4_classic)

View File

@ -72,9 +72,6 @@
/* Line 336 of yacc.c */
#line 9 "/Users/wfisher/Desktop/win_netcdf/ncgen3/ncgen.y"
/* Line 268 of yacc.c */
#line 9 "/home/wfisher/Desktop/win_netcdf/ncgen3/ncgen.y"
#ifdef sccs
static char SccsId[] = "$Id: ncgen.y,v 1.34 2010/03/31 18:18:41 dmh Exp $";
#endif
@ -157,11 +154,6 @@ int yyerror(char*);
# endif
# endif
/* Enabling traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
/* Enabling verbose error messages. */
#ifdef YYERROR_VERBOSE
# undef YYERROR_VERBOSE