Skip to content
Commits on Source (6)
......@@ -54,7 +54,7 @@ endif()
#on multi-configuration generators (Visual Studio, Xcode) define only 2 types: Debug;Release
#/////////////////////////////////////////////////////////////////////////////////////
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build.")
if(CMAKE_CONFIGURATION_TYPES)
set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
endif()
......@@ -85,11 +85,11 @@ set(find_opt NO_SYSTEM_ENVIRONMENT_PATH)
#If not found, business as usual
#//////////////////////////
# NETCDF_ROOT, if found in environment, will be searched after specific command line locations for NETCDF_INCLUDE
# and NETCDF_LIBRARY
set(netcdf_root "$ENV{NETCDF_ROOT}")
if(netcdf_root)
set(NETCDF_INCLUDE "${netcdf_root}/include")
set(NETCDF_LIBRARY_PATH "${netcdf_root}/lib")
message("${color_blue}-- Using user defined netCDF location: ${netcdf_root}${color_reset}")
message("${color_blue}-- Using user-defined netCDF root location: ${netcdf_root}${color_reset}")
endif()
#//////////////////////////
......@@ -97,12 +97,19 @@ endif()
#//////////////////////////
if(NETCDF_INCLUDE)
if(EXISTS "${NETCDF_INCLUDE}/netcdf.h")
message("-- Using ${NETCDF_INCLUDE}/netcdf.h")
else()
if(netcdf_root)
set(NETCDF_INCLUDE "${netcdf_root}/include")
endif()
if(EXISTS "${NETCDF_INCLUDE}/netcdf.h")
message("-- Using ${NETCDF_INCLUDE}/netcdf.h")
else()
message(FATAL_ERROR "${color_red}netcdf.h not found at ${NETCDF_INCLUDE}${color_reset}")
endif()
endif()
endif()
find_path(NETCDF_INCLUDE netcdf.h ${find_opt})
if(NOT NETCDF_INCLUDE)
......@@ -118,10 +125,14 @@ endif()
if(NETCDF_LIBRARY)
if(EXISTS "${NETCDF_LIBRARY}")
message("-- Using ${NETCDF_LIBRARY}")
else()
if(netcdf_root)
set(NETCDF_LIBRARY_PATH "${netcdf_root}/lib")
else()
message(FATAL_ERROR "${color_red}Specified ${NETCDF_LIBRARY} does not exist${color_reset}")
endif()
endif()
endif()
find_library(NETCDF_LIBRARY NAMES netcdf PATHS ${NETCDF_LIBRARY_PATH} NO_DEFAULT_PATH)
find_library(NETCDF_LIBRARY NAMES netcdf ${find_opt})
......@@ -145,12 +156,34 @@ if (has_nc_inq_path)
message("-- Found nc_inq_path in: " ${NETCDF_LIBRARY})
add_definitions(-DHAVE_NC_INQ_PATH)
endif()
check_library_exists(${NETCDF_LIBRARY} nc_inq_format "" has_nc_inq_format)
if (has_nc_inq_format)
message("-- Found nc_inq_format in: " ${NETCDF_LIBRARY})
add_definitions(-DHAVE_NC_INQ_FORMAT)
endif()
#/////////////////////////////////////////////////////////////////////////////////////
#netCDF 4.6.0
#nc_def_var_filter , has_inq_var_filter, define NC_LIB_VERSION=460 if both found
#/////////////////////////////////////////////////////////////////////////////////////
check_library_exists(${NETCDF_LIBRARY} nc_def_var_filter "" has_nc_def_var_filter)
if (has_nc_def_var_filter)
message("-- Found nc_def_var_filter in: " ${NETCDF_LIBRARY})
add_definitions(-DHAVE_NC_DEF_VAR_FILTER)
endif()
check_library_exists(${NETCDF_LIBRARY} nc_inq_var_filter "" has_inq_var_filter)
if (has_inq_var_filter)
message("-- Found has_inq_var_filter in: " ${NETCDF_LIBRARY})
add_definitions(-DHAVE_NC_INQ_VAR_FILTER)
endif()
if (has_nc_def_var_filter AND has_inq_var_filter)
add_definitions(-DNC_LIB_VERSION=460)
endif ()
find_path(path_netcdf_mem_h netcdf_mem.h PATHS ${NETCDF_INCLUDE})
if (path_netcdf_mem_h)
message("-- Found netcdf_mem.h in: " ${path_netcdf_mem_h})
......@@ -295,24 +328,18 @@ if (MSVC)
message("-- Using static CRT ${MSVC_USE_STATIC_CRT}")
foreach(flag_var CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_RELWITHDEBINFO)
CMAKE_C_FLAGS_RELEASE)
string(REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
endforeach()
endif()
endif(MSVC_USE_STATIC_CRT)
#//////////////////////////
#compile as C++ Code (/TP)
#//////////////////////////
foreach(flag_var CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_RELWITHDEBINFO)
CMAKE_C_FLAGS_RELEASE)
set(${flag_var} "/TP ${${flag_var}}")
endforeach()
......@@ -474,21 +501,21 @@ add_executable(ncatted src/nco/ncatted.c)
set(ncwa_SOURCES ${ncwa_SOURCES})
set(ncwa_SOURCES ${ncwa_SOURCES} src/nco/ncwa.c)
find_package(BISON QUIET)
# find_package(BISON QUIET)
find_package(FLEX QUIET)
if(BISON_FOUND AND FLEX_FOUND)
if(FLEX_FOUND)
add_definitions(-DHAVE_BISON_FLEX)
message("-- Bison found at ${BISON_EXECUTABLE}")
# message("-- Bison found at ${BISON_EXECUTABLE}")
message("-- Flex found at ${FLEX_EXECUTABLE}")
BISON_TARGET(nco_parser src/nco/ncap_yacc.y ${CMAKE_CURRENT_BINARY_DIR}/ncap_yacc.c COMPILE_FLAGS "--name-prefix=nco_yy")
# BISON_TARGET(nco_parser src/nco/ncap_yacc.y ${CMAKE_CURRENT_BINARY_DIR}/ncap_yacc.c COMPILE_FLAGS "--name-prefix=nco_yy")
FLEX_TARGET(nco_scanner src/nco/ncap_lex.l ${CMAKE_CURRENT_BINARY_DIR}/ncap_lex.c COMPILE_FLAGS "-Pnco_yy")
ADD_FLEX_BISON_DEPENDENCY(nco_scanner nco_parser)
# ADD_FLEX_BISON_DEPENDENCY(nco_scanner nco_parser)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(src/nco)
message("-- Bison/Flex will generate ${BISON_nco_parser_OUTPUTS} ${FLEX_nco_scanner_OUTPUTS}")
set(ncwa_SOURCES ${ncwa_SOURCES} ${BISON_nco_parser_OUTPUTS} ${FLEX_nco_scanner_OUTPUTS} src/nco/ncap_utl.c)
message("-- Flex will generate ${FLEX_nco_scanner_OUTPUTS}")
set(ncwa_SOURCES ${ncwa_SOURCES} ${FLEX_nco_scanner_OUTPUTS} src/nco/ncap_utl.c)
else()
message("${color_magenta}-- Bison/Flex not found${color_reset}")
message("${color_magenta}--Flex not found${color_reset}")
endif()
add_executable(ncwa ${ncwa_SOURCES})
......@@ -986,3 +1013,53 @@ if (UNIX)
file(APPEND ${file_sh} "export PATH=\"${path}\"")
execute_process(COMMAND chmod a+x ${file_sh} RESULT_VARIABLE res)
endif()
#//////////////////////////
# compiler/linker warnings
#//////////////////////////
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
set(MSVC_DEVELOPER ON CACHE BOOL "Disable MSVC warnings /wd4267 /wd4244 /wd4477")
if (MSVC_DEVELOPER)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /wd4267 /wd4244 /wd4477")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /wd4267 /wd4244 /wd4477")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /wd4267 /wd4244 /wd4477")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /wd4267 /wd4244 /wd4477")
endif()
endif()
#//////////////////////////
# disable .pdb not found warnings
#//////////////////////////
if (MSVC)
set_target_properties(ncks PROPERTIES LINK_FLAGS "/ignore:4099")
set_target_properties(ncbo PROPERTIES LINK_FLAGS "/ignore:4099")
set_target_properties(ncecat PROPERTIES LINK_FLAGS "/ignore:4099")
set_target_properties(ncflint PROPERTIES LINK_FLAGS "/ignore:4099")
set_target_properties(ncpdq PROPERTIES LINK_FLAGS "/ignore:4099")
set_target_properties(ncra PROPERTIES LINK_FLAGS "/ignore:4099")
set_target_properties(ncrename PROPERTIES LINK_FLAGS "/ignore:4099")
set_target_properties(ncatted PROPERTIES LINK_FLAGS "/ignore:4099")
set_target_properties(ncwa PROPERTIES LINK_FLAGS "/ignore:4099")
set_target_properties(ncap2 PROPERTIES LINK_FLAGS "/ignore:4099")
endif (MSVC)
#//////////////////////////
# use of strcasecmp and strncasecmp
# UDUNITS2 defines strcasecmp
#//////////////////////////
if (UDUNITS2_LIBRARY AND UDUNITS2_INCLUDE)
set(have_udunits)
endif()
if (MSVC)
if (NOT ${have_udunits})
add_definitions(-DNEED_STRCASECMP)
endif()
add_definitions(-DNEED_STRNCASECMP)
endif(MSVC)
......@@ -304,8 +304,6 @@ SHELL = @SHELL@
STRIP = @STRIP@
UDUNITS2_PATH = @UDUNITS2_PATH@
VERSION = @VERSION@
YACC = @YACC@
YFLAGS = @YFLAGS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
......
......@@ -20,15 +20,15 @@ install:
- cmd: call %CONDA_INSTALL_LOCN%\Scripts\activate.bat
# # Add path, activate `conda` and update conda.
- cmd: conda config --set always_yes yes --set changeps1 no --set show_channel_urls true
- cmd: conda update conda
- cmd: conda config --prepend channels conda-forge
- cmd: conda.exe config --set always_yes yes --set changeps1 no --set show_channel_urls true
- cmd: conda.exe update conda
- cmd: conda.exe config --prepend channels conda-forge
- cmd: set PYTHONUNBUFFERED=1
- cmd: conda install conda-build
- cmd: conda info --all
- cmd: conda list
- cmd: conda.exe install conda-build
- cmd: conda.exe info --all
- cmd: conda.exe list
# Skip .NET project specific build phase.
......
......@@ -15,6 +15,7 @@
# Machine build parameters
# Source Method Packages Compiler
# aerosol.ess.uci.edu: NCO Configure All else clang
# AppVeyor CI : NCO CMake All else MSVC
# cheyenne.ucar.edu : NCO Makefile All else Intel
# cooley.alcf.anl.g : NCO Configure All else GCC
# edison.nersc.gov : NCO Configure All else Intel
......@@ -22,11 +23,10 @@
# frazil.ess.uci.edu : NCO Configure All else clang
# glace.ess.uci.edu : NCO CMake All else GCC
# grele.ess.uci.edu : NCO Makefile All else GCC
# katabatic.ess.uci.e: NCO All else clang
# katabatic.ess.uci.e: NCO CMake All else clang
# rhea.ccs.ornl.gov : NCO Makefile All else GCC
# roulee.ess.uci.edu : NCO + netCDF Makefile All else GCC
# skyglow.ess.uci.edu: NCO + netCDF Configure All else GCC
# travis CI : NCO Configure All else gcc,clang,g++
# Travis CI : NCO Configure All else gcc,clang,g++
# Usage (testing):
# make tst # Vanilla regression test
......@@ -75,7 +75,7 @@
# cd ~/nco/bld;ANTLR=/sopt/ifort_icpc/bin/antlr ANTLR_ROOT=/sopt/ifort_icpc SZ_LIB=/sopt/lib UDUNITS_INC=/sopt/include UDUNITS_LIB=/sopt/lib make OMP=Y OPTS=D NETCDF4=Y SZ=Y UDUNITS=N allinone;cd - # greenplanet intel
# cd ~/nco/bld;ANTLR=/sopt/pgf90_pgcc/bin/antlr ANTLR_ROOT=/sopt/pgf90_pgcc SZ_LIB=/sopt/lib UDUNITS_INC=/sopt/include UDUNITS_LIB=/sopt/lib make OMP=Y OPTS=D NETCDF4=N SZ=Y UDUNITS=N allinone;cd - # greenplanet pgi
# cd ~/nco/bld;make OMP=Y OPTS=D NETCDF4=N UDUNITS=Y allinone;cd - # pbs
# cd ~/nco/bld;make OMP=Y OPTS=D NETCDF4=N UDUNITS=Y allinone;cd - # grele
# cd ~/nco/bld;make OMP=Y OPTS=D UDUNITS=Y UBUNTU_440=Y allinone # grele
# cd ~/nco/bld;make NETCDF4=N all ncap2;cd - # tephra
# cd ~/nco/bld;make OMP=Y OPTS=D NETCDF4=N UDUNITS=N allinone;cd - # silt, clay
# cd ~/nco/bld;NETCDF_INC='/usr/include/netcdf-3' NETCDF_LIB='/usr/lib64' make GSL=N OMP=N OPTS=D NETCDF4=N UDUNITS=N allinone;cd - # snow
......@@ -574,8 +574,8 @@ TAGS_FILTER_FILES := .//libnco_tst.c .//libnco_c++_tst.cc ../bld/lex.${NCO_YY_PF
# TAGS_FILTER_FILES := .//libnco_tst.c .//libnco_c++_tst.cc
# Variables having to do with ncap
MDL_NCAP_SRC := $(addprefix ${MY_SRC_DIR}/,ncap_yacc.y ncap_lex.l ncap.h) # `make tags' includes these files
MDL_NCAP_TRG := ncap_yacc.c ncap_yacc.h ncap_lex.c # `make ncap' creates these files
MDL_NCAP_SRC := $(addprefix ${MY_SRC_DIR}/,ncap_lex.l ncap_utl.h) # `make tags' includes these files
MDL_NCAP_TRG := ncap_lex.c # `make ncap' creates these files
MDL_NCAP := $(addprefix ${MY_SRC_DIR}/,${MDL_NCAP_TRG}) # `make distclean' removes these files
# Variables having to do with C++ source and documentation
......@@ -656,8 +656,10 @@ CPP_TKN_OS := -DHAVE_REGEX_H -DNCO_HAVE_REGEX_FUNCTIONALITY -DHAVE_GETPAGESIZE -
CPP_TKN_OS += -DHAVE_NC_INQ_FORMAT
# Assume netCDF >= 4.3.2
CPP_TKN_OS += -DHAVE_NC_INQ_PATH
# Assume netCDF >= 4.4.0
# Assume netCDF >= 4.4.0, but Ubuntu 4.4.0 (e.g., on grele) fumbled netcdf_mem.h header
ifndef UBUNTU_440
CPP_TKN_OS += -DHAVE_NETCDF_MEM_H
endif # !grele
# gcc 4.7.3 finally includes strcasestr() in string.h iff _GNU_SOURCE token is defined
# NB: C++ (or at least g++ 4.7.3) always includes strcasestr()---work around this with tokens in nco_sng_utl.[ch]
ifneq (${PVM_ARCH},CRAY)
......@@ -1681,8 +1683,8 @@ ${MY_BIN_DIR}/mpncra: ${MY_OBJ_DIR}/mpncra.o lib
cd ${MY_BIN_DIR}; rm -f mpnces; ln -s -f mpncra mpnces
cd ${MY_BIN_DIR}; rm -f mpncrcat; ln -s -f mpncra mpncrcat
mpncwa: ${MY_BIN_DIR}/mpncwa
${MY_BIN_DIR}/mpncwa: ${MY_OBJ_DIR}/mpncwa.o ${MY_OBJ_DIR}/ncap_yacc.o ${MY_OBJ_DIR}/ncap_lex.o ${MY_OBJ_DIR}/ncap_utl.o lib
${MPICC} -o $@${BNR_SFX} $< ${MY_OBJ_DIR}/ncap_yacc.o ${MY_OBJ_DIR}/ncap_lex.o ${MY_OBJ_DIR}/ncap_utl.o ${LDFLAGS}
${MY_BIN_DIR}/mpncwa: ${MY_OBJ_DIR}/mpncwa.o ${MY_OBJ_DIR}/ncap_lex.o ${MY_OBJ_DIR}/ncap_utl.o lib
${MPICC} -o $@${BNR_SFX} $< ${MY_OBJ_DIR}/ncap_lex.o ${MY_OBJ_DIR}/ncap_utl.o ${LDFLAGS}
chmod 755 $@${BNR_SFX}
ncatted: ${MY_BIN_DIR}/ncatted
${MY_BIN_DIR}/ncatted: ${MY_OBJ_DIR}/ncatted.o lib
......@@ -1729,11 +1731,11 @@ ${MY_BIN_DIR}/ncrename: ${MY_OBJ_DIR}/ncrename.o lib
${CC} -o $@${BNR_SFX} $< ${LDFLAGS}
chmod 755 $@${BNR_SFX}
ncwa: ${MY_BIN_DIR}/ncwa
${MY_BIN_DIR}/ncwa: ${MY_OBJ_DIR}/ncwa.o ${MY_OBJ_DIR}/ncap_yacc.o ${MY_OBJ_DIR}/ncap_lex.o ${MY_OBJ_DIR}/ncap_utl.o lib
${MY_BIN_DIR}/ncwa: ${MY_OBJ_DIR}/ncwa.o ${MY_OBJ_DIR}/ncap_lex.o ${MY_OBJ_DIR}/ncap_utl.o lib
ifeq (${MSVC},TRUE)
${CC} -o $@${BNR_SFX} $< ${LDFLAGS}
else
${CC} -o $@${BNR_SFX} $< ${MY_OBJ_DIR}/ncap_yacc.o ${MY_OBJ_DIR}/ncap_lex.o ${MY_OBJ_DIR}/ncap_utl.o ${LDFLAGS}
${CC} -o $@${BNR_SFX} $< ${MY_OBJ_DIR}/ncap_lex.o ${MY_OBJ_DIR}/ncap_utl.o ${LDFLAGS}
endif
chmod 755 $@${BNR_SFX}
bin: ${MDL_BIN_TRG} ${MDL_BIN_SPT}
......@@ -2175,18 +2177,12 @@ ncap : LDFLAGS += -lC
endif # endif AIX VA Compiler Collection
endif # endif AIX
# For some reason, ncap_lex.c is not remade when I expect it to be, so I explicitly remove the object file every time
ncap: ${MY_OBJ_DIR}/ncap_yacc.o ${MY_OBJ_DIR}/ncap_lex.o ncap_yacc.h ${MY_OBJ_DIR}/ncap.o ${MY_OBJ_DIR}/ncap_utl.o ${libnco}.a
# ${YACC} --name-prefix=nco_
ifneq (${null},$(findstring ${PVM_ARCH},LINUXALPHALINUXAMD64LINUXARMFREEBSDWIN32SGIMP64))
${CC} ${CFLAGS} -o ${MY_BIN_DIR}/$@ ${MY_OBJ_DIR}/$@.o ${MY_OBJ_DIR}/ncap_utl.o ${MY_OBJ_DIR}/$@_yacc.o ${MY_OBJ_DIR}/$@_lex.o ${LDFLAGS}
else
${CC} ${CFLAGS} -o ${MY_BIN_DIR}/$@ ${MY_OBJ_DIR}/$@.o ${MY_OBJ_DIR}/ncap_utl.o ${MY_OBJ_DIR}/$@_yacc.o ${MY_OBJ_DIR}/$@_lex.o -ll -ly ${LDFLAGS}
endif
chmod 755 ${MY_BIN_DIR}/$@${BNR_SFX}
ncap: ${MY_OBJ_DIR}/ncap_lex.o ${MY_OBJ_DIR}/ncap_utl.o ${libnco}.a
ncap2 :
-cd ../src/nco++; ${MAKE} -f Makefile.old DAP=${DAP} DBG=${DBG} GSL=${GSL} MPI=${MPI} NETCDF4=${NETCDF4} OMP=${OMP} OPTS=${OPTS} PNETCDF=${PNETCDF} SZ=${SZ} UDUNITS=${UDUNITS} all
# /bin/rm -f ${MDL_NCAP} ${MY_OBJ_DIR}/$@_lex.o ${MY_OBJ_DIR}/ncap_yacc.h ${MY_OBJ_DIR}/ncap_yacc.c
# /bin/rm -f ${MDL_NCAP} ${MY_OBJ_DIR}/$@_lex.o
# Create dependency files only if they will not be immediately deleted
INCLUDE_DPN := TRUE
......
......@@ -2,17 +2,17 @@
# http://cvs.fedoraproject.org/viewvc/devel/nco/nco.spec?view=co
Name: nco
Version: 4.7.2
Version: 4.7.3
Release: 1%{?dist}
Summary: Programs that manipulate netCDF files
Group: Applications/Engineering
License: GPL3
URL: http://nco.sf.net/
# Obtain NCO version 4.7.2-1 tar.gz from Sourceforge using CVS:
# Obtain NCO version 4.7.3-1 tar.gz from Sourceforge using CVS:
# cvs -d:pserver:anonymous@nco.cvs.sf.net:/cvsroot/nco login
# cvs -z3 -d:pserver:anonymous@nco.cvs.sf.net:/cvsroot/nco co -r nco-4.7.2-1 -d nco-%{version} nco
# tar czf nco-%{version}.tar.gz --exclude='nco-4.7.2/debian*' --exclude='.cvsignore' --exclude=ncap_lex.c --exclude='ncap_yacc.[ch]' ./nco-%{version}
# cvs -z3 -d:pserver:anonymous@nco.cvs.sf.net:/cvsroot/nco co -r nco-4.7.3-1 -d nco-%{version} nco
# tar czf nco-%{version}.tar.gz --exclude='nco-4.7.3/debian*' --exclude='.cvsignore' --exclude=ncap_lex.c --exclude='ncap_yacc.[ch]' ./nco-%{version}
Source0: nco-%{version}.tar.gz
#Patch0: nco_install_C_headers.patch
#Patch1: nco_find_udunits-dat.patch
......@@ -108,7 +108,10 @@ fi
# %{_libdir}/libnco++.so
%changelog
* Thu Jan 21 2018 Charlie Zender <zender@uci.edu> - 4.7.2-1
* Fri Mar 03 2018 Charlie Zender <zender@uci.edu> - 4.7.3-1
- new upstream 4.7.3
* Thu Jan 25 2018 Charlie Zender <zender@uci.edu> - 4.7.2-1
- new upstream 4.7.2
* Thu Dec 21 2017 Charlie Zender <zender@uci.edu> - 4.7.1-1
......
......@@ -5,20 +5,20 @@
# Usage:
# Export tagged, public versions
# /usr/bin/scp ${DATA}/nco-4.7.2.tar.gz zender,nco@web.sf.net:/home/project-web/nco/htdocs/src
# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --bld --cln nco-4.7.2 # Build, do not release on SF
# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --bld --cln --sf nco-4.7.2 # Build, release on SF
# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --nst_all nco-4.7.2 # Install, do not build
# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --bld --cln --nst_all nco-4.7.2 # Build and install
# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --acd_cnt nco-4.7.2
# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --acd_prs nco-4.7.2
# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --cgd_cnt nco-4.7.2
# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --cray_prs nco-4.7.2
# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --bbl_cnt nco-4.7.2
# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --blk_cnt nco-4.7.2
# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --dat_cnt nco-4.7.2
# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --ute_prs nco-4.7.2
# /usr/bin/scp ${DATA}/nco-4.7.3.tar.gz zender,nco@web.sf.net:/home/project-web/nco/htdocs/src
# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --bld --cln nco-4.7.3 # Build, do not release on SF
# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --bld --cln --sf nco-4.7.3 # Build, release on SF
# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --nst_all nco-4.7.3 # Install, do not build
# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --bld --cln --nst_all nco-4.7.3 # Build and install
# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --acd_cnt nco-4.7.3
# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --acd_prs nco-4.7.3
# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --cgd_cnt nco-4.7.3
# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --cray_prs nco-4.7.3
# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --bbl_cnt nco-4.7.3
# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --blk_cnt nco-4.7.3
# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --dat_cnt nco-4.7.3
# ${HOME}/nco/bld/nco_dst.pl --dbg=2 --cln --ute_prs nco-4.7.3
# Export daily snapshot
# ${HOME}/nco/bld/nco_dst.pl --dbg=2
......@@ -256,7 +256,7 @@ if($bld){
# Set up FTP server
chdir $dst_pth_pfx or die "$prg_nm: ERROR unable to chdir to $dst_pth_pfx: $!\n"; # $! is system error string
cmd_prc("$cp_cmd $doc_fl ./$dst_vrs/doc"); # Copy derived documentation to source directory
cmd_prc("$tar_cmd cvzf $dst_fl --exclude='nco-4.7.2/debian*' --exclude='.cvsignore' --exclude=ncap_lex.c --exclude=ncap_yacc.[ch] ./$dst_vrs"); # Create gzipped tarfile
cmd_prc("$tar_cmd cvzf $dst_fl --exclude='nco-4.7.3/debian*' --exclude='.cvsignore' --exclude=ncap_lex.c --exclude=ncap_yacc.[ch] ./$dst_vrs"); # Create gzipped tarfile
cmd_prc("$rsh_cmd $www_mch $rm_cmd $www_drc/src/$dst_fl"); # Remove any distribution with same name
if($dly_snp){cmd_prc("$rsh_cmd $www_mch $rm_cmd -r $www_drc/src/nco-????????.tar.gz");} # Remove previous daily snapshots from WWW server
cmd_prc("$rcp_cmd $dst_fl $www_mch:$www_drc/src"); # Copy local tarfile to WWW server
......
......@@ -686,7 +686,7 @@ sub tst_run {
$cmd_lst_cnt++;
if ($dbg_lvl > 2) {
print "\ntst_run: test cycle held - hit <Enter> to continue\n";
my $wait = <STDIN>;
# my $wait = <STDIN>;
}
} # end loop: foreach (@cmd_lst)
} # end of client side 'else'
......@@ -910,7 +910,7 @@ sub SS_prepare {
####################
sub failed {
$failure{$opr_nm}++;
$err_sng .= " ERR: FAILURE in $opr_nm failure: $dsc_sng\n";
$err_sng .= " ERR: FAILED in $opr_nm test: $dsc_sng\n";
foreach(@cmd_lst) { $err_sng .= " $_\n";}
$err_sng .= " ERR::EXPLAIN: Result: [$cmd_rsl] != Expected: [$nsr_xpc]\n\n" ;
return;
......
......@@ -108,9 +108,10 @@ sub tst_rgr {
# 440 (for library 4.4.0)
# 441 (for library 4.4.1.x)
# 450 (for library 4.5.0)
# 451 (for library 4.5.1)
# 452 (for library 4.5.2)
# 453 (for library 4.5.3)
# 451 (for library 4.5.1) (development-only)
# 460 (for library 4.6.0.x)
# 461 (for library 4.6.1)
# 462 (for library 4.6.2)
if($exit_value == 410){print "netCDF version 4.1.x detected\n";}
if($exit_value == 431){print "netCDF version 4.3.1 detected\n";}
......@@ -119,9 +120,10 @@ sub tst_rgr {
if($exit_value == 440){print "netCDF version 4.4.0 detected\n";}
if($exit_value == 441){print "netCDF version 4.4.1 detected\n";}
if($exit_value == 450){print "netCDF version 4.5.0 detected\n";}
if($exit_value == 451){print "netCDF version 4.5.1 detected\n";}
if($exit_value == 452){print "netCDF version 4.5.2 detected\n";}
if($exit_value == 453){print "netCDF version 4.5.3 detected\n";}
if($exit_value == 451){print "netCDF version 4.5.1 detected\n";} # development-only
if($exit_value == 460){print "netCDF version 4.6.0 detected\n";}
if($exit_value == 461){print "netCDF version 4.6.1 detected\n";}
if($exit_value == 462){print "netCDF version 4.6.2 detected\n";}
if($exit_value >= 400){$RUN_NETCDF4_TESTS=1;}
if($exit_value >= 431){$RUN_NETCDF4_TESTS_VERSION_GE_431=1;}
......@@ -487,6 +489,18 @@ if($USER eq 'zender'){
NCO_bm::tst_run(\@tst_cmd);
$#tst_cmd=0; # Reset array
# ncap2 #17
$dsc_sng="Run script to test sort functions";
$tst_cmd[0]="ncap2 -h -O $fl_fmt $nco_D_flg -v -S '../data/sort.nco' $in_pth_arg in.nc %tmp_fl_00%";
$tst_cmd[1]="ncks -C -H --trd -v nbr_err -s '%d' %tmp_fl_00%";
$tst_cmd[2]="0";
$tst_cmd[3]="SS_OK";
NCO_bm::tst_run(\@tst_cmd);
$#tst_cmd=0; # Reset array
if($dodap eq "FALSE"){
####################
#### ncatted tests #
......@@ -1247,7 +1261,7 @@ if($USER eq 'zender'){
$#tst_cmd=0; # Reset array
#nces #19 (check coordinate variables)
# ncra -Y ncge -h -O mdl_1.nc ~/foo.nc
# ncra -Y ncge -h -O ~/nco/data/mdl_1.nc ~/foo.nc
# ncks -g cesm -v time ~/foo.nc
# NB: This test succeeds when it fails, i.e., the NCO command fails as it should because the input files do not conform
$dsc_sng="(Groups) Ensemble record coordinate variables";
......@@ -5919,7 +5933,7 @@ if($RUN_NETCDF4_TESTS_VERSION_GE_431){
#ncrename -O -d lev,z -d lat,y -d lon,x ~/nco/data/in_grp.nc ~/foo.nc
#ncks -H --trd -s %d -v one ~/foo.nc
# Check for corruption after simultaneously renaming multiple dimensions in netCDF4 file
$dsc_sng="netCDF4: Simultaneously rename multiple dimensions (netCDF bug, will require Unidata to fix in netCDF 4.5.???)";
$dsc_sng="netCDF4: Simultaneously rename multiple dimensions (netCDF bug, will require Unidata to fix)";
$tst_cmd[0]="ncrename -O $fl_fmt $nco_D_flg -d lev,z -d lat,y -d lon,x $in_pth_arg in_grp.nc %tmp_fl_00%";
$tst_cmd[1]="ncks -H --trd -s %d -v one %tmp_fl_00%";
$tst_cmd[2]="1";
......
load "bm_lib.ncl"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; vars that are in ?????_xps_img.mc
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; bm_times=new((/9/), float)
; single plot list
if(True) then
years=(/1,3,5,10,15,20/)
years@units="years"
my_list=NewList("fifo")
bmx=make_benchmark("ctl","-3","-3",(/1.87,2.38,2.92,4.29,5.68,7.08/),"black")
ListPush(my_list,bmx)
ret=xy_benchmarks_plot(my_list,years,"test plot ",1.0,9.0)
end if
if (False) then
my_list=NewList("fifo")
years=(/1,3,5/)
years@units="years"
ListPush(my_list, make_benchmark("ctl","-6","-6",(/63.74,68.85,74.51/) , "black"))
ListPush(my_list, make_benchmark("xpt1", "-6","-7",(/283.23,279.85,278.51/) ,"red"))
ListPush(my_list, make_benchmark( "xpt2","-6", "-7 -L 1", (/346.56,362.56,367.27/) ,"blue"))
ListPush(my_list, make_benchmark("xpt3", "-6", "-7 -L 9", (/643.09,700.14,728.24/) ,"orange") )
ListPush(my_list, make_benchmark("xpt4","-6", "-7 -L 1 --ppc default=3",(/401.07,436.10,431.86/) ,"green"))
ListPush(my_list, make_benchmark("xpt5", "-6", "-7 --cnk_plc=g2d --cnk_map=nc4",(/355.09,360.92,366.49/) , "grey"))
ListPush(my_list, make_benchmark("xpt6", "-6", "-7 --cnk_plc=g2d --cnk_map=nco",(/332.39,327.01,342.70/) , "orange"))
ListPush(my_list, make_benchmark("xpt7", "-6", "-7 --cnk_plc=g2d --cnk_map=rew",(/319.36,317.23,341.30/) , "purple"))
ret=xy_benchmarks_plot(my_list,years,"ncclimo run times",0.0,0.0)
end if
;************************************************
undef("xy_benchmarks_plot")
function xy_benchmarks_plot(rfl_img, xaxis, str_title:string, ymin:float, ymax:float)
local nList, n, data, LineColors, LineThicknesses, res, wks
begin
;
;************************************************
; deal with multiple plots on graph
nList=ListCount(rfl_img)
; data = new((/nList,dimsizes(rfl_img[0]&years)/),float)
data = new((/nList,dimsizes(xaxis)/),float)
LineColors=new((/nList/),string)
LineThicknesses=new((/nList/),float)
Markers=new((/nList/),integer)
LineLabelStrings=new((/nList/),string)
do n=0,nList-1
data(n,:)=rfl_img[n](:)
if( isatt(rfl_img[n],"Color" ) )
LineColors(n)=rfl_img[n]@Color
else
LineColors(n)="blue"
end if
LineThicknesses(n)=4.0
; set default to circle
Markers(n)=16
LineLabelStrings(n)=rfl_img[n]@xpr_str
end do
str_fname=str_sub_str(str_title," and ","__")
;************************************************
; plotting parameters
;************************************************
if(ymin.eq.ymax) then
ymin = min(data)
ymax = max(data)
end if
wks = gsn_open_wks ("png",str_fname) ; send graphics to PNG file
res = True ; plot mods desired
res@tiMainString = str_title ; add title
res@tiYAxisString = rfl_img[0]@units
; res@tmXBMode = "auto"
res@trXMinF = min(xaxis)
res@trXMaxF = max(xaxis)
res@tiXAxisString = xaxis@units
res@tmXBValues=xaxis
res@trYMinF = ymin
res@trYMaxF = ymax*1.06 ; make bound 6% larger than max value - tidy
res@xyLineThicknesses = LineThicknesses
; res@xyLineColors = (/"blue","red"/) ; change line color
res@xyLineColors = LineColors
res@xyMarkLineMode = "MarkLines" ; Markers *and* lines
res@xyMarkers = Markers ; different markers
; set marker colors same as line color
res@xyMarkerColors := LineColors
res@xyDashPattern = 0 ; Make curves all solid
wks@wkWidth = 800
wks@wkHeight = 800
plot = gsn_csm_xy (wks,xaxis,data,res) ; create plot
;***********************************************
; legend resources
;***********************************************
lgres = True
lgres@lgLineColors = LineColors
lgres@lgLineThicknessF = LineThicknesses
lgres@lgItemType = "Lines" ; show lines only (default)
lgres@lgLabelFontHeightF = .04 ; set the legend label font thickness
lgres@lgMonoDashIndex = True
lgres@lgDashIndex = 0 ; set all lines solid
lgres@vpWidthF = 0.15 ; width of legend (NDC)
lgres@vpHeightF = 0.3 ; height of legend (NDC)
lgres@lgPerimColor = "grey" ; draw the box perimeter in orange
lgres@lgPerimThicknessF = 5.0 ; thicken the box perimeter
lbid = gsn_create_legend(wks,nList,LineLabelStrings,lgres) ; create legend
amres = True
amres@amParallelPosF = -0.8 ; move legend to the right
amres@amOrthogonalPosF = -0.8 ; move the legend down
; amres@amZone = 1
; amres@amSide = 0 ; NhlLEFT
;amres@amTrackData = True
; amres@amDataXF = 0.0
; amres@amDataYF = 0.0
amres@amJust = 0 ;NhlTOPLEFT
annoid1 = gsn_add_annotation(plot,lbid,amres) ; add legend to plot
draw(plot) ; Draw base plot.
frame(wks) ; advance frame
return 1
end
undef(" make_benchmark")
function make_benchmark( xpr_str:string, cmd_in_str:string, cmd_out_str:string, bm, Color:string)
begin
bm@xpr_str=xpr_str
bm@cmd_in_str=cmd_in_str
bm@cmd_out_str=cmd_out_str
bm@Color=Color
bm@units="seconds" ; dont think this should be here
return(bm)
end
#!/bin/sh
# Flush and clear the disk caches.
if [ -z "$OSTYPE" ]; then
echo "$0: unknown OS type env-var OSTYPE not set"
exit 1;
fi
case "$OSTYPE" in
darwin*)
purge
;;
linux*)
echo "$0: about to clear caches for linux"
sync
sudo sh -c "echo 3 > /proc/sys/vm/drop_caches"
;;
bsd*)
;;
# windoze
msys*)
;;
#default do nothing
*)
;;
esac
exit 0
#!/bin/bash
#######################################################################################
# purpose: benchmark chunking tools nccopy, h5repack ncks
# author: Henry Btowsky
# date: 28th February 2018
#######################################################################################
# usage examples
# chunking-times.sh <tool> <input-netcdf-file>
#
# chunking-times.sh nccopy cnk-tst-1032-29-35.nc
# chunking-times.sh ncks foo.nc
# chunking-times.sh h5repack cnk-tst-1032-29-35.nc
#######################################################################################
# get time from stderr log
function ex_time () {
tt_ar=($( cat "$1" |grep zzz))
tt_el="${tt_ar[0]}"
echo $tt_el
}
dbg_flg=1
sim_flag=0
idx=0
# nccopy or h5repack
tool="$1" #
in_fl="$2"
out_dir="."
lst_tst="C1 C2 C3 C4"
# lst_tst="C4"
for tst in $lst_tst; do
case "$tst" in
C1)
info_dbg="C1 test 516x20x25"
cnk=(516 20 25);
;;
C2)
info_dbg="C2 test 64x8x8"
cnk=(64 8 8);
;;
C3)
info_dbg="C2 test 46x6x7"
cnk=(46 6 7);
;;
C4)
info_dbg="C2 test 33x5x6"
cnk=(33 5 6);
;;
esac
out_fl="$out_dir/cnk-tst-dbg-${cnk[0]}-${cnk[1]}-${cnk[2]}.nc"
[[ -e "$out_fl" ]] && rm "$out_fl"
if [[ $tool = "nccopy" ]]; then
arg_chunks="time/${cnk[0]},y/${cnk[1]},x/${cnk[2]}"
exe_cmd="nccopy -k 4 -d0 -c ${arg_chunks} ${in_fl} ${out_fl}"
elif [[ $tool = "h5repack" ]]; then
arg_chunks="T:CHUNK=${cnk[0]}x${cnk[1]}x${cnk[2]}"
exe_cmd="h5repack -l ${arg_chunks} -i ${in_fl} -o ${out_fl}"
elif [[ $tool = "ncks" ]]; then
arg_chunks="--cnk_dmn time,${cnk[0]} --cnk_dmn y,${cnk[1]} --cnk_dmn x,${cnk[2]}"
exe_cmd="ncks -O -4 --cnk_plc g3d $arg_chunks ${in_fl} ${out_fl}"
fi
# do the deed - nb zzz is so we can grep stderr
[[ $dbg_flg -ne 0 ]] && echo "exe_cmd=$exe_cmd"
# delete old climo files
# rm "$out_fl"
eval "/usr/bin/time --format \" %e zzz\" $exe_cmd 2>my_error_log"
if [[ $? -ne 0 ]]; then
echo "$tool ERROR"
cat my_error_log
fi
# extract time from stderr
ts=$(ex_time my_error_log)
[[ $dbg_flg -ne 0 ]] && echo "test $info_dbg time=$ts"
if [[ -n "$ts" ]]; then
bm_times[idx]="$ts"
fi
: $(( idx++ ))
done
# format times into ncl array
# e.g (/3.60,4.83,6.07,9.13,12.29,15.34/)
ncl_sng="(/${bm_times[@]}/)"
ncl_sng="${ncl_sng// /,}"
echo $ncl_sng
#!/bin/bash
# get time from stderr log
function ex_time () {
tt_ar=($( cat "$1" |grep zzz))
tt_el="${tt_ar[0]}"
echo $tt_el
}
dbg_flg=1
sim_flag=0
idx=0
model="cam"
ncclimo_sh="/ccs/home/butowsky/bin/ncclimo"
in_dir="/lustre/atlas1/cli115/world-shared/mbranst/famipc5_ne120_v0.3_00003-wget-test"
out_dir="/lustre/atlas/proj-shared/cli115/butowsky/ne120"
# lst_tst="B1 B3 B5 B10 B15 B20"
lst_tst="B1 B3 B5"
# add_opts="-7 -L 7 --cnk_plc=g2d --cnk_map=rew"
std_opts="$1"
ext_args="$2"
for tst in $lst_tst; do
case "$tst" in
B1)
info_dbg="B1 - test a single year "
srt_year=1979
end_year=1979
;;
B3)
info_dbg="B3 - test 3 years"
srt_year=1979
end_year=1981
;;
B5)
info_dbg="test B5 - test 5 years "
srt_year=1979
end_year=1983
;;
B10)
info_dbg="test B10 - test 10 years"
srt_year=1979
end_year=1988
;;
B15)
info_dbg="test B15 - test 15 years"
srt_year=0000
end_year=0014
;;
B20)
info_dbg="test B20 - test 20 years"
srt_year=0000
end_year=0019
;;
DEBUG)
info_dbg="B1 - test a single year "
exe_cmd="ncclimo -i . -o out_climo/ -c essgcm14 -m $model -s 0000 -e 0000 -a sdc"
;;
esac
exe_cmd="${ncclimo_sh} -d 1 -p mpi -i $in_dir -o $out_dir -c famipc5_ne120_v0.3_00003 -m $model -s $srt_year -e $end_year -a sdc $std_opts -n '$ext_args'"
# do the deed - nb zzz is so we can grep stderr
[[ $dbg_flg -ne 0 ]] && echo "exe_cmd=$exe_cmd"
# delete old climo files
rm "${out_dir}/*.nc"
eval "/usr/bin/time --format \" %e zzz\" $exe_cmd 2>my_error_log"
if [[ $? -ne 0 ]]; then
echo "NCO ERROR"
cat my_error_log
fi
# extract time from stderr
ts=$(ex_time my_error_log)
[[ $dbg_flg -ne 0 ]] && echo "test $info_dbg time=$ts"
if [[ -n "$ts" ]]; then
bm_times[idx]="$ts"
fi
: $(( idx++ ))
done
# format times into ncl array
# e.g (/3.60,4.83,6.07,9.13,12.29,15.34/)
ncl_sng="(/${bm_times[@]}/)"
ncl_sng="${ncl_sng// /,}"
echo $ncl_sng
......@@ -257,9 +257,8 @@ if ($os_sng =~ /Darwin/){
If you want life to be better, consider installing the GNU coreutils
which will provide an acceptable 'cut'.
Hit <Enter> to acknowledge your miserable state of cut kharma.
BADCUT
$tmp=<STDIN>;
# $tmp=<STDIN>;
$gnu_cut=0;
}
}
......@@ -427,9 +426,9 @@ if(-e "/usr/bin/time" && -x "/usr/bin/time"){
$tmr_app="time "; # bash builtin or other 'time'-like application (AIX)
} # endif time
if($dbg_lvl > 1){
if($dbg_lvl >= 4){
print "\nAbout to begin requested tests; waiting for keypress to proceed.\n";
my $tmp=<STDIN>;
# my $tmp=<STDIN>;
}
# Regression tests
......
......@@ -6,7 +6,6 @@ https://github.com/nco/nco
Do
```
clone.bat
bld.bat
```
......@@ -56,17 +55,17 @@ INCLUDE_DIRECTORIES(${HDF5_HL_INCLUDE_DIR})
NCO should detect the ZLIB dependency in HDF5 as
```
-- Looking for H5Z_DEFLATE in I:/nco/cmake/hdf5/build/bin/Debug/libhdf5_D.lib
-- Looking for H5Z_DEFLATE in I:/nco/cmake/hdf5/build/bin/Debug/libhdf5_D.lib - found
-- Looking for H5Z_DEFLATE in I:/nco/cmake/build/hdf5/build/bin/Debug/libhdf5_D.lib
-- Looking for H5Z_DEFLATE in I:/nco/cmake/build/hdf5/build/bin/Debug/libhdf5_D.lib - found
-- ZLIB library is needed...
```
the netcdf function detection should be
```
-- Found netcdf library at: I:/nco/cmake/netcdf-c/build/liblib/Debug/netcdf.lib
-- Looking for nc_inq_path in I:/nco/cmake/netcdf-c/build/liblib/Debug/netcdf.lib
-- Looking for nc_inq_path in I:/nco/cmake/netcdf-c/build/liblib/Debug/netcdf.lib - found
-- Found netcdf library at: I:/nco/cmake/build/netcdf-c/build/liblib/Debug/netcdf.lib
-- Looking for nc_inq_path in I:/nco/cmake/build/netcdf-c/build/liblib/Debug/netcdf.lib
-- Looking for nc_inq_path in I:/nco/cmake/build/netcdf-c/build/liblib/Debug/netcdf.lib - found
```
# NCO tests
......@@ -124,7 +123,7 @@ edit hdf5-static.vcxproj and add full path of ZLIB and SZIP libraries as depende
```
<Lib>
<AdditionalOptions>%(AdditionalOptions) /machine:x64</AdditionalOptions>
<AdditionalDependencies>I:\nco\cmake\zlib\build\Debug\zlibstaticd.lib;I:\nco\cmake\szip\build\bin\Debug\libszip_D.lib</AdditionalDependencies>
<AdditionalDependencies>E:\nco\cmake\build\zlib\build\Debug\zlibstaticd.lib;E:\nco\cmake\build\szip\build\bin\Debug\libszip_D.lib</AdditionalDependencies>
</Lib>
```
......@@ -135,7 +134,7 @@ edit netcdf.vcxproj and add full path of HDF5 and curl libraries as dependencies
```
<Lib>
<AdditionalOptions>%(AdditionalOptions) /machine:x64</AdditionalOptions>
<AdditionalDependencies>I:\nco\cmake\hdf5\build\bin\Debug\libhdf5_hl_D.lib;I:\nco\cmake\hdf5\build\bin\Debug\libhdf5_D.lib;I:\nco\cmake\curl\builds\libcurl-vc14-x64-debug-static-ipv6-sspi-winssl\lib\libcurl_a_debug.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>E:\nco\cmake\build\hdf5\build\bin\Debug\libhdf5_hl_D.lib;E:\nco\cmake\build\hdf5\build\bin\Debug\libhdf5_D.lib;E:\nco\cmake\build\curl\builds\libcurl-vc14-x64-debug-static-ipv6-sspi-winssl\lib\libcurl_a_debug.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Lib>
```
......@@ -145,7 +144,7 @@ edit netcdf.vcxproj and add full path of HDF5 and curl libraries as dependencies
```
git clone https://github.com/Unidata/netcdf-c
pushd netcdf-c
git checkout tags/v4.5.0
git checkout tags/v4.6.0
popd
git clone https://github.com/curl/curl
git clone https://github.com/madler/zlib
......@@ -154,7 +153,7 @@ git clone https://github.com/live-clones/hdf5
git clone https://github.com/Unidata/UDUNITS-2
git clone https://github.com/libexpat/libexpat
git clone https://github.com/ampl/gsl
git clone https://github.com/Distrotech/antlr2
git clone https://github.com/nco/antlr
```
......
......@@ -3,10 +3,7 @@
@echo off
if not defined DevEnvDir (
echo "%VS140COMNTOOLS%VsDevCmd.bat"
call "%VS140COMNTOOLS%VsDevCmd.bat"
echo "%VCINSTALLDIR%vcvarsall.bat" amd64
call "%VCINSTALLDIR%vcvarsall.bat" amd64
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64
if errorlevel 1 goto :eof
)
......@@ -19,13 +16,99 @@ set MSVC_VERSION="Visual Studio 14 2015 Win64"
echo using static crt %STATIC_CRT%
echo using %MSVC_VERSION%
:: replace the character string '\' with '/' needed for cmake
:: 'git clone' all the dependencies
:: the build folder is 'build'
:: git clone https://github.com/Unidata/netcdf-c
:: git clone https://github.com/curl/curl
:: git clone https://github.com/madler/zlib
:: git clone https://github.com/soumagne/szip
:: git clone https://github.com/live-clones/hdf5
:: git clone https://github.com/Unidata/UDUNITS-2
:: git clone https://github.com/libexpat/libexpat
:: git clone https://github.com/ampl/gsl
:: git clone https://github.com/nco/antlr2
:: current place
set root_win=%cd%
set root=%root_win:\=/%
set build=%root_win%\build
if not exist %build% (
mkdir %build%
echo cloning/building in %build%
) else (
echo skipping mkdir %build%
)
:: change to build place
:: replace the character string '\' with '/' needed for cmake
pushd %build%
set tmp=%cd%
set root=%tmp:\=/%
echo cmake root is %root%
if not exist %build%\netcdf-c (
git clone https://github.com/nco/netcdf-c
pushd netcdf-c
git checkout Branch_v4.6.0
popd
) else (
echo skipping netcdf git clone
)
if not exist %build%\curl (
git clone https://github.com/curl/curl
) else (
echo skipping curl git clone
)
if not exist %build%\zlib (
git clone https://github.com/madler/zlib
) else (
echo skipping zlib git clone
)
if not exist %build%\szip (
git clone https://github.com/soumagne/szip
) else (
echo skipping szip git clone
)
if not exist %build%\hdf5 (
git clone https://github.com/live-clones/hdf5
) else (
echo skipping hdf5 git clone
)
if not exist %build%\UDUNITS-2 (
git clone https://github.com/Unidata/UDUNITS-2
) else (
echo skipping UDUNITS-2 git clone
)
if not exist %build%\libexpat (
git clone https://github.com/libexpat/libexpat
) else (
echo skipping libexpat git clone
)
if not exist %build%\gsl (
git clone https://github.com/ampl/gsl
) else (
echo skipping gsl git clone
)
if not exist %build%\antlr2 (
git clone https://github.com/nco/antlr2
) else (
echo skipping antlr2 git clone
)
:: //////////////////////////////////////////////////////////
:: zlib
:: //////////////////////////////////////////////////////////
:build_zlib
if exist %root_win%\zlib\build\zlib.sln (
if exist %build%\zlib\build\zlib.sln (
echo skipping zlib build
goto build_szip
) else (
......@@ -37,15 +120,19 @@ if exist %root_win%\zlib\build\zlib.sln (
-DMSVC_USE_STATIC_CRT=%STATIC_CRT% ^
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ^
-DBUILD_SHARED_LIBS=OFF
msbuild zlib.sln /target:build /property:configuration=debug
cp %root%\zlib\build\zconf.h %root%\zlib
msbuild zlib.sln /target:build /property:configuration=debug /nologo /verbosity:minimal
cp %build%\zlib\build\zconf.h %build%\zlib
popd
popd
if errorlevel 1 goto :eof
)
:: //////////////////////////////////////////////////////////
:: szip
:: //////////////////////////////////////////////////////////
:build_szip
if exist %root_win%\szip\build\SZIP.sln (
if exist %build%\szip\build\SZIP.sln (
echo skipping szip build
goto build_hdf5
) else (
......@@ -58,14 +145,18 @@ if exist %root_win%\szip\build\SZIP.sln (
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ^
-DBUILD_SHARED_LIBS=OFF ^
-DBUILD_TESTING=OFF
msbuild SZIP.sln /target:build /property:configuration=debug
msbuild SZIP.sln /target:build /property:configuration=debug /nologo /verbosity:minimal
popd
popd
if errorlevel 1 goto :eof
)
:: //////////////////////////////////////////////////////////
:: hdf5
:: //////////////////////////////////////////////////////////
:build_hdf5
if exist %root_win%\hdf5\build\bin\Debug\h5dump.exe (
if exist %build%\hdf5\build\bin\Debug\h5dump.exe (
echo skipping hdf5 build
goto build_curl
) else (
......@@ -90,15 +181,18 @@ if exist %root_win%\hdf5\build\bin\Debug\h5dump.exe (
-DSZIP_FOUND=ON ^
-DSZIP_STATIC_LIBRARY:FILEPATH=%root%/szip/build/bin/Debug/libszip_D.lib ^
-DSZIP_INCLUDE_DIRS:PATH=%root%/szip/src
msbuild HDF5.sln /target:build /property:configuration=debug
msbuild HDF5.sln /target:build /property:configuration=debug /nologo /verbosity:minimal
popd
popd
if errorlevel 1 goto :eof
)
:: //////////////////////////////////////////////////////////
:: curl
:: //////////////////////////////////////////////////////////
:build_curl
if exist %root_win%\curl\builds\libcurl-vc14-x64-debug-static-ipv6-sspi-winssl\lib\libcurl_a_debug.lib (
if exist %build%\curl\builds\libcurl-vc14-x64-debug-static-ipv6-sspi-winssl\lib\libcurl_a_debug.lib (
echo skipping curl build
goto build_netcdf
) else (
......@@ -118,9 +212,12 @@ if exist %root_win%\curl\builds\libcurl-vc14-x64-debug-static-ipv6-sspi-winssl\l
if errorlevel 1 goto :eof
)
:: //////////////////////////////////////////////////////////
:: netcdf
:: //////////////////////////////////////////////////////////
:build_netcdf
if exist %root_win%\netcdf-c\build\ncdump\ncdump.exe (
if exist %build%\netcdf-c\build\ncdump\ncdump.exe (
echo skipping netcdf build
goto test_netcdf
) else (
......@@ -143,7 +240,7 @@ if exist %root_win%\netcdf-c\build\ncdump\ncdump.exe (
-DHDF5_HL_INCLUDE_DIR=%root%/hdf5/hl/src ^
-DCURL_LIBRARY=%root%/curl/builds/libcurl-vc14-x64-debug-static-ipv6-sspi-winssl/lib/libcurl_a_debug.lib ^
-DCURL_INCLUDE_DIR=%root%/curl/include
msbuild netcdf.sln /target:build /property:configuration=debug
msbuild netcdf.sln /target:build /property:configuration=debug /nologo /verbosity:minimal
popd
popd
if errorlevel 1 goto :eof
......@@ -151,17 +248,21 @@ if exist %root_win%\netcdf-c\build\ncdump\ncdump.exe (
:test_netcdf
if exist %root_win%\netcdf-c\build\ncdump\ncdump.exe (
if exist %build%\netcdf-c\build\ncdump\ncdump.exe (
echo testing netcdf build
@echo on
%root_win%\netcdf-c\build\ncdump\ncdump.exe -k http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/cmap/enh/precip.mon.mean.nc
%build%\netcdf-c\build\ncdump\ncdump.exe -h http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/cmap/enh/precip.mon.mean.nc
@echo off
@echo.
goto build_expat
)
:: //////////////////////////////////////////////////////////
:: expat
:: //////////////////////////////////////////////////////////
:build_expat
if exist %root_win%\libexpat\expat\build\expat.sln (
if exist %build%\libexpat\expat\build\expat.sln (
echo skipping expat build
goto build_udunits
) else (
......@@ -175,16 +276,19 @@ if exist %root_win%\libexpat\expat\build\expat.sln (
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ^
-DBUILD_SHARED_LIBS=OFF ^
-DBUILD_shared=OFF
msbuild expat.sln /target:build /property:configuration=debug
msbuild expat.sln /target:build /property:configuration=debug /nologo /verbosity:minimal
popd
popd
popd
if errorlevel 1 goto :eof
)
:: //////////////////////////////////////////////////////////
:: udunits
:: //////////////////////////////////////////////////////////
:build_udunits
if exist %root_win%\UDUNITS-2\build\udunits.sln (
if exist %build%\UDUNITS-2\build\udunits.sln (
echo skipping udunits build
goto build_gsl
) else (
......@@ -198,15 +302,18 @@ if exist %root_win%\UDUNITS-2\build\udunits.sln (
-DBUILD_SHARED_LIBS=OFF ^
-DEXPAT_INCLUDE_DIR=%root%/libexpat/expat/lib ^
-DEXPAT_LIBRARY=%root%/libexpat/expat/build/Debug/expatd.lib
msbuild udunits.sln /target:build /property:configuration=debug
msbuild udunits.sln /target:build /property:configuration=debug /nologo /verbosity:minimal
popd
popd
if errorlevel 1 goto :eof
)
:: //////////////////////////////////////////////////////////
:: gsl
:: //////////////////////////////////////////////////////////
:build_gsl
if exist %root_win%\GSL\build\GSL.sln (
if exist %build%\GSL\build\GSL.sln (
echo skipping gsl build
goto build_antlr
) else (
......@@ -225,14 +332,18 @@ if exist %root_win%\GSL\build\GSL.sln (
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ^
-DBUILD_SHARED_LIBS=OFF ^
-DGSL_DISABLE_TESTS=ON
msbuild GSL.sln /target:build /property:configuration=debug
msbuild GSL.sln /target:build /property:configuration=debug /nologo /verbosity:minimal
popd
popd
if errorlevel 1 goto :eof
)
:: //////////////////////////////////////////////////////////
:: antlr
:: //////////////////////////////////////////////////////////
:build_antlr
if exist %root_win%\antlr2\lib\cpp\build\Project.sln (
if exist %build%\antlr2\lib\cpp\build\antlr.sln (
echo skipping antlr build
goto build_nco
) else (
......@@ -246,7 +357,7 @@ if exist %root_win%\antlr2\lib\cpp\build\Project.sln (
-DMSVC_USE_STATIC_CRT=%STATIC_CRT% ^
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ^
-DBUILD_SHARED_LIBS=OFF
msbuild Project.sln /target:build /property:configuration=debug
msbuild antlr.sln /target:build /property:configuration=debug /nologo /verbosity:minimal
popd
popd
popd
......@@ -254,18 +365,24 @@ if exist %root_win%\antlr2\lib\cpp\build\Project.sln (
if errorlevel 1 goto :eof
)
:: //////////////////////////////////////////////////////////
:: NCO
:: use undocumented option -H (location of CMakeLists.txt)
:: //////////////////////////////////////////////////////////
:build_nco
if exist Debug\ncks.exe (
if exist %build%\Debug\ncks.exe (
echo skipping nco build
goto test_nco
) else (
echo building NCO
rm -rf CMakeCache.txt CMakeFiles
cmake .. -G %MSVC_VERSION% ^
-DMSVC_USE_STATIC_CRT=%STATIC_CRT% ^
cmake .. -H..\.. ^
-G %MSVC_VERSION% ^
-DMSVC_DEVELOPER=ON ^
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ^
-DMSVC_USE_STATIC_CRT=%STATIC_CRT% ^
-DNETCDF_INCLUDE:PATH=%root%/netcdf-c/include ^
-DNETCDF_LIBRARY:FILE=%root%/netcdf-c/build/liblib/Debug/netcdf.lib ^
-DHDF5_LIBRARY:FILE=%root%/hdf5/build/bin/Debug/libhdf5_D.lib ^
......@@ -281,25 +398,27 @@ if exist Debug\ncks.exe (
-DGSL_CBLAS_LIBRARY:FILE=%root%/gsl/build/Debug/gslcblas.lib ^
-DANTLR_INCLUDE:PATH=%root%/antlr2/lib/cpp ^
-DANTLR_LIBRARY:FILE=%root%/antlr2/lib/cpp/build/Debug/antlr.lib
msbuild nco.sln /target:build /property:configuration=debug
msbuild nco.sln /target:build /property:configuration=debug /nologo /verbosity:minimal
if errorlevel 1 goto :eof
)
:test_nco
set data=%root_win%\..\data
@echo on
%root_win%\netcdf-c\build\ncgen\ncgen.exe -k netCDF-4 -b -o %root_win%\..\data\in_grp.nc %root_win%\..\data\in_grp.cdl
%root_win%\netcdf-c\build\ncgen\ncgen.exe -k netCDF-4 -b -o %root_win%\..\data\in.nc %root_win%\..\data\in.cdl
%root_win%\Debug\ncks.exe --jsn_fmt 2 -C -g g10 -v two_dmn_rec_var %root_win%\..\data\in_grp.nc
%root_win%\Debug\ncks.exe -v lat http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/cmap/enh/precip.mon.mean.nc
%build%\Debug\ncks.exe -v lat http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/cmap/enh/precip.mon.mean.nc
%build%\netcdf-c\build\ncgen\ncgen.exe -k netCDF-4 -b -o %data%\in_grp.nc %data%\in_grp.cdl
%build%\netcdf-c\build\ncgen\ncgen.exe -k netCDF-4 -b -o %data%\in.nc %data%\in.cdl
%build%\Debug\ncks.exe --jsn_fmt 2 -C -g g10 -v two_dmn_rec_var %data%\in_grp.nc
:: generate text files in_grp.nc.gen.txt from in_grp.nc and in.nc and use tool FC to compare contents
:: with pre-existing in_grp.nc.txt, in.nc.txt, generated in Linux
:: generation of in_grp.nc.gen.txt must be done in 'data' folder so that paths match
@pushd %root_win%\..\data
%root_win%\Debug\ncks.exe in_grp.nc > %root_win%\in_grp.nc.gen.txt
%root_win%\Debug\ncks.exe in.nc > %root_win%\in.nc.gen.txt
@pushd %data%
%build%\Debug\ncks.exe in_grp.nc > %build%\in_grp.nc.gen.txt
%build%\Debug\ncks.exe in.nc > %build%\in.nc.gen.txt
@popd
@popd
fc in_grp.nc.gen.txt in_grp.nc.txt
fc in.nc.gen.txt in.nc.txt
fc %build%\in_grp.nc.gen.txt in_grp.nc.txt
fc %build%\in.nc.gen.txt in.nc.txt
echo done
\ No newline at end of file
cmake .. ^
-DNETCDF_INCLUDE:PATH=I:/grafic_project/netcdf/include ^
-DNETCDF_LIBRARY:FILE=I:/grafic_project/Debug/netcdf.lib ^
-DHDF5_LIBRARY:FILE=I:/grafic_project/Debug/hdf5.1.8.5.patch1.lib ^
-DHDF5_HL_LIBRARY:FILE=I:/grafic_project/Debug/hdf5_hl.1.8.5.patch1.lib ^
-DZLIB_LIBRARY:FILE=I:/grafic_project/Debug/zlib.lib ^
-DSZIP_LIBRARY:FILE=I:/grafic_project/Debug/szlib.lib ^
-DCURL_LIBRARY:FILE=I:/grafic_project/Debug/libcurld.lib ^
-DANTLR_INCLUDE:PATH=I:/antlr-2.7.7/lib/cpp ^
-DANTLR_LIBRARY:FILE=I:/antlr-2.7.7/lib/cpp/debug/antlr.lib ^
-DUDUNITS2_INCLUDE:PATH=I:/udunits2/lib ^
-DUDUNITS2_LIBRARY:FILE=I:/udunits2/build/lib/Debug/udunits2.lib ^
-DEXPAT_LIBRARY:FILE=I:/expat/expat/win32/bin/Debug/libexpatMT.lib ^
-DGSL_INCLUDE:PATH=I:/gsl-1.8/src ^
-DGSL_LIBRARY:FILE=I:/gsl-1.8/src/gsl/1.8/gsl-1.8/VC8/libgsl/Debug-StaticLib/libgsl_d.lib ^
-DGSL_CBLAS_LIBRARY:FILE=I:/gsl-1.8/src/gsl/1.8/gsl-1.8/VC8/libgslcblas/Debug-StaticLib/libgslcblas_d.lib
msbuild nco.sln /target:build /property:configuration=debug
#!/usr/bin/env bash
rm -rf CMakeCache.txt CMakeFiles Makefile install_manifest.txt cmake_install.cmake cmake_uninstall.cmake
git clone https://github.com/Unidata/netcdf-c
pushd netcdf-c
git checkout tags/v4.5.0
popd
git clone https://github.com/curl/curl
git clone https://github.com/madler/zlib
git clone https://github.com/soumagne/szip
git clone https://github.com/live-clones/hdf5
git clone https://github.com/Unidata/UDUNITS-2
git clone https://github.com/libexpat/libexpat
git clone https://github.com/ampl/gsl
git clone https://github.com/Distrotech/antlr2
\ No newline at end of file
:: cmake build all NCO dependencies obtained with 'git clone' using nmake
:: Pedro Vicente
@echo off
@call "%VS140COMNTOOLS%VsDevCmd.bat" amd64
:: replace the character string '\' with '/' needed for cmake
set temp=%cd%
set root=%temp:\=/%
echo root is %root%
pushd zlib
if exist build\Makefile (
echo skipping zlib build
popd
goto build_hdf5
) else (
echo building zlib
mkdir build
pushd build
cmake .. -G "NMake Makefiles" ^
-DCMAKE_BUILD_TYPE=Debug ^
-DBUILD_SHARED_LIBS=OFF
nmake
popd
popd
)
:build_hdf5
pushd hdf5
if exist build\Makefile (
echo skipping hdf5 build
popd
goto build_curl
) else (
echo building hdf5
mkdir build
pushd build
cmake .. -G "NMake Makefiles" ^
-DCMAKE_BUILD_TYPE=Debug ^
-DBUILD_SHARED_LIBS=OFF ^
-DBUILD_STATIC_EXECS=ON ^
-DBUILD_TESTING=OFF ^
-DHDF5_BUILD_EXAMPLES=OFF ^
-DHDF5_BUILD_CPP_LIB=OFF
nmake
popd
popd
)
:build_curl
pushd curl
if exist build\Makefile (
echo skipping curl build
popd
goto build_netcdf
) else (
echo building curl
mkdir build
pushd build
cmake .. -G "NMake Makefiles" ^
-DCMAKE_BUILD_TYPE=Debug ^
-DBUILD_SHARED_LIBS=OFF ^
-DBUILD_TESTING=OFF
nmake
popd
popd
)
:build_netcdf
pushd netcdf-c
if exist build\ncdump\ncdump.exe (
echo skipping netcdf build
popd
goto test_netcdf
) else (
echo building netcdf
mkdir build
pushd build
cmake .. -G "NMake Makefiles" ^
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ^
-DENABLE_TESTS=OFF ^
-DCMAKE_BUILD_TYPE=Debug ^
-DBUILD_SHARED_LIBS=OFF ^
-DHDF5_HL_LIBRARY=%root%/hdf5/build/bin/libhdf5_hl_D.lib ^
-DHDF5_C_LIBRARY=%root%/hdf5/build/bin/libhdf5_D.lib ^
-DHDF5_INCLUDE_DIR=%root%/hdf5/src ^
-DZLIB_LIBRARY:FILE=%root%/zlib/build/zlibstaticd.lib ^
-DZLIB_INCLUDE_DIR:PATH=%root%/zlib ^
-DHAVE_HDF5_H=%root%/hdf5/build ^
-DHDF5_HL_INCLUDE_DIR=%root%/hdf5/hl/src ^
-DCURL_LIBRARY=%root%/curl/build/lib/libcurl-d_imp.lib ^
-DCURL_INCLUDE_DIR=%root%/curl/include
nmake
popd
popd
)
:test_netcdf
if exist %root%\netcdf-c\build\ncdump\ncdump.exe (
echo testing netcdf build
pushd netcdf-c
pushd build
pushd ncdump
cp %root%\curl\build\lib\libcurl-d.dll %root%\netcdf-c\build\ncdump
ncdump http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/cmap/enh/precip.mon.mean.nc
popd
popd
popd
goto build_nco
)
:build_nco
cmake .. ^
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ^
-DMSVC_USE_STATIC_CRT=OFF ^
-DNETCDF_INCLUDE:PATH=%root%/netcdf-c/include ^
-DNETCDF_LIBRARY:FILE=%root%/netcdf-c/build/liblib/netcdf.lib ^
-DHDF5_LIBRARY:FILE=%root%/hdf5/build/bin/libhdf5_D.lib ^
-DHDF5_HL_LIBRARY:FILE=%root%/hdf5/build/bin/libhdf5_hl_D.lib ^
-DZLIB_LIBRARY:FILE=%root%/zlib/build/zlibstaticd.lib ^
-DCURL_LIBRARY:FILE=%root%/curl/build/lib/libcurl-d_imp.lib
\ No newline at end of file