-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from ocefpaf/bump
Bump to 4.3.0
- Loading branch information
Showing
3 changed files
with
58 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |