Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try win #48

Merged
merged 4 commits into from
Dec 16, 2017
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Current build status

Linux: [![Circle CI](https://circleci.com/gh/conda-forge/nco-feedstock.svg?style=shield)](https://circleci.com/gh/conda-forge/nco-feedstock)
OSX: [![TravisCI](https://travis-ci.org/conda-forge/nco-feedstock.svg?branch=master)](https://travis-ci.org/conda-forge/nco-feedstock)
Windows: ![](https://cdn.rawgit.com/conda-forge/conda-smithy/90845bba35bec53edac7a16638aa4d77217a3713/conda_smithy/static/disabled.svg)
Windows: [![AppVeyor](https://ci.appveyor.com/api/projects/status/github/conda-forge/nco-feedstock?svg=True)](https://ci.appveyor.com/project/conda-forge/nco-feedstock/branch/master)

Current release info
====================
Expand Down
54 changes: 54 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# This file was automatically generated by conda-smithy. To update a component of this
# file, make changes to conda-forge.yml and/or recipe/meta.yaml, and run
# "conda smithy rerender".

environment:

BINSTAR_TOKEN:
# The BINSTAR_TOKEN secure variable. This is defined canonically in conda-forge.yml.
secure: ipv/06DzgA7pzz2CIAtbPxZSsphDtF+JFyoWRnXkn3O8j7oRe3rzqj3LOoq2DZp4

matrix:
- TARGET_ARCH: x64
CONDA_PY: 36
CONDA_INSTALL_LOCN: C:\\Miniconda36-x64


# We always use a 64-bit machine, but can build x86 distributions
# with the TARGET_ARCH variable.
platform:
- x64

install:
# If there is a newer build queued for the same PR, cancel this one.
- cmd: |
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://raw.githubusercontent.com/conda-forge/conda-forge-build-setup-feedstock/master/recipe/ff_ci_pr_build.py', 'ff_ci_pr_build.py')"
ff_ci_pr_build -v --ci "appveyor" "%APPVEYOR_ACCOUNT_NAME%/%APPVEYOR_PROJECT_SLUG%" "%APPVEYOR_BUILD_NUMBER%" "%APPVEYOR_PULL_REQUEST_NUMBER%"
del ff_ci_pr_build.py

# Cywing's git breaks conda-build. (See https://github.com/conda-forge/conda-smithy-feedstock/pull/2.)
- cmd: rmdir C:\cygwin /s /q

# Add path, activate `conda` and update conda.
- cmd: call %CONDA_INSTALL_LOCN%\Scripts\activate.bat
- cmd: conda update --yes --quiet conda

- cmd: set PYTHONUNBUFFERED=1

# Add our channels.
- cmd: conda config --set show_channel_urls true
- cmd: conda config --remove channels defaults
- cmd: conda config --add channels defaults
- cmd: conda config --add channels conda-forge

# Configure the VM.
- cmd: conda install -n root --quiet --yes conda-forge-build-setup
- cmd: run_conda_forge_build_setup

# Skip .NET project specific build phase.
build: off

test_script:
- conda build recipe --quiet
deploy_script:
- cmd: upload_or_check_non_existence .\recipe conda-forge --channel=main
34 changes: 34 additions & 0 deletions recipe/bld.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
mkdir %SRC_DIR%\build
cd %SRC_DIR%\build

set "CFLAGS=%CFLAGS% -DWIN32 -DGSL_DLL"
set "CXXFLAGS=%CXXFLAGS% -DWIN32 -DGSL_DLL"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@czender GSL error was fixed with this

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. The linking issue was fixed by @isuruf.

Also, I just added the extra test in my latest commit. See 391c080


cmake -G "NMake Makefiles" ^
-D CMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
-D CMAKE_BUILD_TYPE=Release ^
-D NCO_MSVC_USE_MT=no ^
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you change this to yes? (Then there's no need for changing antlr)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest I don't know. I'll try this first and, if does not work, I'll change antlr.

-D CMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^
-D NETCDF_INCLUDE=%LIBRARY_INC% ^
-D NETCDF_LIBRARY=%LIBRARY_LIB%\netcdf.lib ^
-D HDF5_LIBRARY=%LIBRARY_LIB%\libhdf5.lib ^
-D HDF5_HL_LIBRARY=%LIBRARY_LIB%\libhdf5_hl.lib ^
-D GSL_INCLUDE=%LIBRARY_INC% ^
-D GSL_LIBRARY=%LIBRARY_LIB%\gsl.lib ^
-D GSL_CBLAS_LIBRARY=%LIBRARY_LIB%\gslcblas.lib ^
-D UDUNITS2_INCLUDE=%LIBRARY_LIB% ^
-D UDUNITS2_LIBRARY=%LIBRARY_LIB%\udunits2.lib ^
-D EXPAT_LIBRARY=%LIBRARY_LIB%\expat.lib ^
-D CURL_LIBRARY=%LIBRARY_LIB%\libcurl.lib ^
-D ANTLR_INCLUDE:PATH=%LIBRARY_INC%\antlr ^
%SRC_DIR%
if errorlevel 1 exit 1


nmake
if errorlevel 1 exit 1

nmake install
if errorlevel 1 exit 1

move %LIBRARY_PREFIX%\*.exe %LIBRARY_BIN% || exit 1
68 changes: 68 additions & 0 deletions recipe/cmake.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
--- nco.orig/CMakeLists.txt 2017-12-14 11:45:35.682879719 -0200
+++ nco/CMakeLists.txt 2017-12-14 12:13:11.007075309 -0200
@@ -52,10 +52,12 @@
#general C/C++ build flags
#/////////////////////////////////////////////////////////////////////////////////////

-set(CMAKE_BUILD_TYPE Debug)
-set(BUILD_STATIC_LIBS ON)
-set(BUILD_SHARED_LIBS OFF)
-add_definitions(-DENABLE_STATIC)
+set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build.")
+set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build static libs.")
+
+if (NOT BUILD_SHARED_LIBS)
+ add_definitions(-DENABLE_STATIC)
+endif()

#//////////////////////////
#detect minimum dependencies using
@@ -247,22 +249,27 @@
#compile as C++/static CRT on Visual Studio and as C99 on UNIX
#//////////////////////////

+set(NCO_MSVC_USE_MT yes CACHE BOOL "Use MT flags when compiling in MSVC")
+
if (MSVC)
add_definitions( "/D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE" )
- message("-- Building with static runtime library")
- set(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1")
- set(CMAKE_CXX_FLAGS_MINSIZEREL "/MT /O1 /Ob1 /D NDEBUG")
- set(CMAKE_CXX_FLAGS_RELEASE "/MT /O2 /Ob2 /D NDEBUG")
- set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MT /Zi /O2 /Ob1 /D NDEBUG")
-
+
+ if (NCO_MSVC_USE_MT)
+ foreach(CompilerFlag 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)
+ string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
+ endforeach()
+ endif()
+
#//////////////////////////
#compile as C++ Code (/TP)
#//////////////////////////
-
- set(CMAKE_C_FLAGS_DEBUG "/TP /D_DEBUG /MTd /Zi /Ob0 /Od /RTC1")
- set(CMAKE_C_FLAGS_MINSIZEREL "/TP /MT /O1 /Ob1 /D NDEBUG")
- set(CMAKE_C_FLAGS_RELEASE "/TP /MT /O2 /Ob2 /D NDEBUG")
- set(CMAKE_C_FLAGS_RELWITHDEBINFO "/TP /MT /Zi /O2 /Ob1 /D NDEBUG")
+ foreach(CompilerFlag CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
+ CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
+ set(${CompilerFlag} "/TP ${${CompilerFlag}}")
+ endforeach()

#//////////////////////////
#visual studio defines math symbols in math.h, avoid duplicate definition
@@ -402,7 +409,8 @@
set(nco_SOURCES ${nco_SOURCES} src/nco/nco_var_scv.c src/nco/nco_var_scv.h)
set(nco_SOURCES ${nco_SOURCES} src/nco/nco_var_utl.c src/nco/nco_var_utl.h)

-add_library(nco STATIC ${nco_SOURCES})
+# Type of library (SHARED, STATIC) is configured using BUILD_SHARED_LIBS
+add_library(nco ${nco_SOURCES})
add_executable(ncks src/nco/ncks.c)
add_executable(ncbo src/nco/ncbo.c)
add_executable(ncecat src/nco/ncecat.c)
44 changes: 28 additions & 16 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,55 @@ package:
version: {{ version }}

source:
url: https://github.com/nco/nco/archive/{{ version }}.tar.gz
sha256: 5ba930f00a0e9775f85748d145acecfe142f917c180de538b2f8994788446cf8
# url: https://github.com/nco/nco/archive/{{ version }}.tar.gz
# sha256: 5ba930f00a0e9775f85748d145acecfe142f917c180de538b2f8994788446cf8
# Just testing before we have a new release.
git_url: https://github.com/nco/nco.git
git_branch: master

build:
number: 4
skip: True # [win]
skip: True # [win32 or (win and py<=35)]
features:
- vc14 # [win and (py35 or py36)]

requirements:
build:
- gsl >=2.2,<2.3
- python # [win]
- cmake # [win]
- antlr >=2.7.7,<3
- bison # [not win]
- texinfo # [not win]
- flex # [not win]
- m4 # [not win]
- curl >=7.44.0,<8
- zlib 1.2.11
- expat 2.2.*
- gsl >=2.2,<2.3
- hdf5 1.10.1
- krb5 1.14.* # [not win]
- libnetcdf 4.4.*
- udunits2
- expat 2.2.*
- krb5 1.14.*
- texinfo
- bison
- flex
- m4
- zlib 1.2.11
- vc 14 # [win and (py35 or py36)]
run:
- curl >=7.44.0,<8
- expat 2.2.*
- gsl >=2.2,<2.3
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using gsl on Windows is still a no-no. See https://ci.appveyor.com/project/ocefpaf/nco-feedstock/build/1.0.47

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- hdf5 1.10.1
- krb5 1.14.* # [not win]
- libnetcdf 4.4.*
- udunits2
- expat 2.2.*
- libgcc
- esmf
- openblas 0.2.20|0.2.20*
- libgcc # [not win]
- openblas 0.2.20|0.2.20* # [not win]
- esmf # [not win]
- vc 14 # [win and (py35 or py36)]

test:
source_files:
- data/in.nc
- data/in.cdl
commands:
- ncks --help
- ncks -M "http://tds.marine.rutgers.edu/thredds/dodsC/roms/espresso/2013_da/his/ESPRESSO_Real-Time_v2_History_Best"
- ncap2 --help
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- conda inspect linkages -p $PREFIX $PKG_NAME # [not win]
- conda inspect objects -p $PREFIX $PKG_NAME # [osx]
Expand Down
6 changes: 6 additions & 0 deletions recipe/run_test.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
cd data

ncgen -o in.nc in.cdl

ncks -H --trd -v one in.nc
if errorlevel 1 exit 1
24 changes: 18 additions & 6 deletions recipe/run_test.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
#!/bin/bash

URL="http://tds.marine.rutgers.edu/thredds/dodsC/roms/espresso/2013_da/his/ESPRESSO_Real-Time_v2_History_Best"
ncgen -o data/in.nc data/in.cdl
fin=data/in.nc

ncks -M $URL
ncks -H --trd -v one $fin

fin=data/in.nc
ncks -O --rgr skl=skl_t42.nc \
--rgr grid=grd_t42.nc \
--rgr latlon=64,128 \
--rgr lat_typ=gss \
--rgr lon_typ=Grn_ctr \
$fin \
foo.nc

ncks -O --rgr grid=grd_2x2.nc \
--rgr latlon=90,180 \
--rgr lat_typ=eqa \
--rgr lon_typ=Grn_wst \
$fin \
foo.nc

ncks -O --rgr skl=skl_t42.nc --rgr grid=grd_t42.nc --rgr latlon=64,128 --rgr lat_typ=gss --rgr lon_typ=Grn_ctr $fin foo.nc
ncks -O --rgr grid=grd_2x2.nc --rgr latlon=90,180 --rgr lat_typ=eqa --rgr lon_typ=Grn_wst $fin foo.nc

ncap2 -O -s 'tst[lat,lon]=1.0f' skl_t42.nc dat_t42.nc
if [[ $(uname) == Darwin ]]; then
ncap2 -O -s 'tst[lat,lon]=1.0f' skl_t42.nc dat_t42.nc
ncremap -a conserve -s grd_t42.nc -g grd_2x2.nc -m map_t42_to_2x2.nc # FIXME: This call for reason prevent CircleCI from uploading the package!
ncremap -i dat_t42.nc -m map_t42_to_2x2.nc -o dat_2x2.nc
ncwa -O dat_2x2.nc dat_avg.nc
Expand Down
12 changes: 12 additions & 0 deletions recipe/strcasecmp.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- nco.orig/src/nco/nco_sng_utl.h 2017-12-14 11:45:35.782871098 -0200
+++ nco/src/nco/nco_sng_utl.h 2017-12-14 13:06:20.619851116 -0200
@@ -26,7 +26,8 @@

#ifdef _MSC_VER
# define NEED_STRSEP
-# define NEED_STRCASECMP
+//# define NEED_STRCASECMP (netcdf defines strcasecmp for MSVC)
+# define strncasecmp _strnicmp // (but not strncasecmp)
# define NEED_STRCASESTR
#endif /* !_MSC_VER */