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

Bump to 4.3.0 #10

Merged
merged 4 commits into from
Jun 20, 2016
Merged
Show file tree
Hide file tree
Changes from all 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
58 changes: 27 additions & 31 deletions recipe/build.sh
Original file line number Diff line number Diff line change
@@ -1,38 +1,34 @@
#!/usr/bin/env bash

if [ "$(uname)" == "Darwin" ]
then
# for Mac OSX
export CC=clang
export CXX=clang++
export MACOSX_VERSION_MIN="10.7"
export MACOSX_DEPLOYMENT_TARGET="${MACOSX_VERSION_MIN}"
export CXXFLAGS="${CXXFLAGS} -mmacosx-version-min=${MACOSX_VERSION_MIN}"
export CXXFLAGS="${CXXFLAGS} -stdlib=libc++ -std=c++11"
export LDFLAGS="${LDFLAGS} -mmacosx-version-min=${MACOSX_VERSION_MIN}"
export LDFLAGS="${LDFLAGS} -stdlib=libc++ -lc++"
export LINKFLAGS="${LDFLAGS}"
# See http://www.unidata.ucar.edu/support/help/MailArchives/netcdf/msg11939.html
export DYLD_LIBRARY_PATH=${PREFIX}/lib
elif [ "$(uname)" == "Linux" ]
then
# for Linux
export CC=gcc
export CXX=g++
export CXXFLAGS="${CXXFLAGS} -DBOOST_MATH_DISABLE_FLOAT128"
export LDFLAGS="${LDFLAGS}"
export LINKFLAGS="${LDFLAGS}"
else
echo "This system is unsupported by the toolchain."
exit 1
fi
# Build shared library using cmake
# works for both linux and osx, but missing ncxx4-config
# see https://github.com/Unidata/netcdf-cxx4/issues/36

# Build static.
mkdir build_static && cd build_static
cmake -D CMAKE_INSTALL_PREFIX=$PREFIX \
-D CMAKE_INSTALL_LIBDIR:PATH=$PREFIX/lib \
-D BUILD_SHARED_LIBS=OFF \
-D NCXX_ENABLE_TESTS=ON \
-D ENABLE_DOXYGEN=OFF \
$SRC_DIR
make
# ctest # Run only for the shared lib build to save time.
make install

export CFLAGS="${CFLAGS} -m${ARCH}"
export CXXFLAGS="${CXXFLAGS} -m${ARCH}"

make clean

CPPFLAGS=-I$PREFIX/include LDFLAGS=-L$PREFIX/lib ./configure --prefix=$PREFIX
cd ..

# Build shared.
mkdir build_shared && cd build_shared
cmake -D CMAKE_INSTALL_PREFIX=$PREFIX \
-D CMAKE_INSTALL_LIBDIR:PATH=$PREFIX/lib \
-D BUILD_SHARED_LIBS=ON \
-D NCXX_ENABLE_TESTS=ON \
-D ENABLE_DOXYGEN=OFF \
$SRC_DIR
make
make check
make install
ctest
make install
20 changes: 13 additions & 7 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
{% set version = "4.2.1" %}
{% set version = "4.3.0" %}

package:
name: netcdf-cxx4
version: {{ version }}

source:
git_url: https://github.com/Unidata/netcdf-cxx4
git_tag: v{{ version }}
fn: netcdf-cxx4-{{ version }}.tar.gz
url: https://github.com/Unidata/netcdf-cxx4/archive/v{{ version }}.tar.gz
sha256: 25da1c97d7a01bc4cee34121c32909872edd38404589c0427fefa1301743f18f

build:
number: 2
number: 0
skip: True # [win]

requirements:
build:
- libnetcdf 4.3*
- cmake
- libnetcdf 4.4.*
run:
- libnetcdf 4.3*
- libnetcdf 4.4.*

test:
requires:
- python {{ environ['PY_VER'] + '*' }} # [win]
commands:
- ncxx4-config --all
#- ncxx4-config --all # FIXME: no ncxx4-config for cmake yet.
- test -f ${PREFIX}/lib/libnetcdf-cxx4.a # [unix]
- conda inspect linkages -n _test netcdf-cxx4 # [linux]

about:
home: https://github.com/Unidata/netcdf-cxx4
Expand Down
18 changes: 18 additions & 0 deletions recipe/run_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Load the libraries using ctypes.
import os
import sys
import ctypes

platform = sys.platform

if platform.startswith('linux'):
path = os.path.join(sys.prefix, 'lib', 'libnetcdf-cxx4.so')
lib = ctypes.CDLL(path)
elif platform == 'darwin':
path = os.path.join(sys.prefix, 'lib', 'libnetcdf-cxx4.dylib')
lib = ctypes.CDLL(path)
elif platform == 'win32':
path = os.path.join(sys.prefix, 'Library', 'bin', 'libnetcdf-cxx4.dll')
lib = ctypes.CDLL(path)
else:
raise ValueError('Unrecognized platform: {}'.format(platform))