Skip to content

Commit

Permalink
Merge pull request #10 from ocefpaf/bump
Browse files Browse the repository at this point in the history
Bump to 4.3.0
  • Loading branch information
kmuehlbauer committed Jun 20, 2016
2 parents 01dd040 + 9d261e9 commit f0e34b2
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 38 deletions.
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))

0 comments on commit f0e34b2

Please sign in to comment.