Skip to content

new package: netcdf 4.7.4 #2060

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

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
16 changes: 16 additions & 0 deletions recipes/netcdf/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
sources:
"4.7.4":
url: "https://github.com/Unidata/netcdf-c/archive/v4.7.4.tar.gz"
sha256: "99930ad7b3c4c1a8e8831fb061cb02b2170fc8e5ccaeda733bd99c3b9d31666b"
"4.7.3":
url: "https://github.com/Unidata/netcdf-c/archive/v4.7.3.tar.gz"
sha256: "05d064a2d55147b83feff3747bea13deb77bef390cb562df4f9f9f1ce147840d"
"4.7.2":
url: "https://github.com/Unidata/netcdf-c/archive/v4.7.2.tar.gz"
sha256: "7648db7bd75fdd198f7be64625af7b276067de48a49dcdfd160f1c2ddff8189c"
"4.7.1":
url: "https://github.com/Unidata/netcdf-c/archive/v4.7.1.tar.gz"
sha256: "583e6b89c57037293fc3878c9181bb89151da8c6015ecea404dd426fea219b2c"
"4.7.0":
url: "https://github.com/Unidata/netcdf-c/archive/v4.7.0.tar.gz"
sha256: "26d03164074363b3911ed79b7cddd045c22adf5ebaf978943db11a1d9f15e9d3"
115 changes: 115 additions & 0 deletions recipes/netcdf/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
import os
import glob
from conans import ConanFile, AutoToolsBuildEnvironment, tools


class NetcdfConan(ConanFile):
name = "netcdf"
description = ("NetCDF is a set of software libraries and "
"self-describing, machine-independent data "
"formats that support the creation, access, "
"and sharing of array-oriented scientific data.")
license = "BSD-3-Clause"
homepage = "https://www.unidata.ucar.edu/software/netcdf/"
url = "https://github.com/conan-io/conan-center-index"
topics = ("array", "dataset", "scientific")

settings = "os", "compiler", "build_type", "arch"
options = {
"shared": [True, False],
"fPIC": [True, False],
"with_netcdf4": [True, False],
"with_dap": [True, False],
"with_utilities": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
"with_netcdf4": True,
"with_dap": True,
"with_utilities": True,
}

@property
def _source_subfolder(self):
return "source_subfolder"

@property
def _build_subfolder(self):
return "build_subfolder"

def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC

def configure(self):
del self.settings.compiler.libcxx
del self.settings.compiler.cppstd

def requirements(self):
if self.options.with_netcdf4:
self.requires("hdf5/[>=1.8.9]")
if self.options.with_dap:
self.requires("libcurl/[>=7.18.0]")

def source(self):
tools.get(**self.conan_data["sources"][self.version])
extracted_dir = "netcdf-c-{}".format(self.version)
os.rename(extracted_dir, self._source_subfolder)

def build(self):
args = [
"--prefix={}".format(self.package_folder),
]

if self.options.shared:
args.append("--enable-shared")
args.append("--disable-static")
else:
args.append("--disable-shared")
args.append("--enable-static")

if self.options.with_netcdf4:
args.append("--enable-netcdf4")
else:
args.append("--disable-netcdf4")

if self.options.with_dap:
args.append("--enable-dap")
else:
args.append("--disable-netcdf4")

if self.options.with_utilities:
args.append("--enable-utilities")
else:
args.append("--disable-utilities")

if self.settings.compiler != 'Visual Studio' and self.options.fPIC:
args.append('--with-pic')

env_build = AutoToolsBuildEnvironment(self)
env_build.configure(self._source_subfolder, args=args)
env_build.make()

def package(self):
self.copy("COPYRIGHT", dst="licenses", src=self._source_subfolder)
env_build = AutoToolsBuildEnvironment(self)
env_build.make(["install"])
tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))
for filename in glob.glob(
os.path.join(self.package_folder, "lib", "*.la")):
os.remove(filename)
for filename in glob.glob(
os.path.join(self.package_folder, "lib", "*.settings")):
os.remove(filename)
tools.rmdir(os.path.join(self.package_folder, "share"))

def package_info(self):
self.cpp_info.libs = ["netcdf"]

self.env_info.PATH.append(os.path.join(self.package_folder, "bin"))
if self.options.shared:
self.env_info.LD_LIBRARY_PATH.append(
os.path.join(self.package_folder, "lib"))
self.env_info.DYLD_LIBRARY_PATH.append(
os.path.join(self.package_folder, "lib"))
10 changes: 10 additions & 0 deletions recipes/netcdf/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
cmake_minimum_required(VERSION 2.8.0 FATAL_ERROR)
project (netcdf_example)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)

add_executable(example
${CMAKE_SOURCE_DIR}/example.c
)
target_link_libraries(example CONAN_PKG::netcdf)
16 changes: 16 additions & 0 deletions recipes/netcdf/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from conans import ConanFile, CMake
import os


class NetcdfTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def test(self):
os.chdir("bin")
self.run(".%sexample" % os.sep)
12 changes: 12 additions & 0 deletions recipes/netcdf/all/test_package/example.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* This is part of Unidata's netCDF package. Copyright 2018.
This is a test program for the nc-config utility. */
#include <netcdf.h>
#include <stdio.h>

int
main()
{
printf("NetCDF version: %s\n", nc_inq_libvers());
printf("*** SUCCESS!\n");
return 0;
}
11 changes: 11 additions & 0 deletions recipes/netcdf/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
versions:
"4.7.4":
folder: all
"4.7.3":
folder: all
"4.7.2":
folder: all
"4.7.1":
folder: all
"4.7.0":
folder: all