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

Add s2let/2.2.4 package #5550

Merged
merged 4 commits into from
Jun 14, 2021
Merged
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
7 changes: 7 additions & 0 deletions recipes/s2let/all/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.0)
project(cmake_wrapper)

include(conanbuildinfo.cmake)
conan_basic_setup()

add_subdirectory(source_subfolder)
4 changes: 4 additions & 0 deletions recipes/s2let/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
"2.2.3":
mdavezac marked this conversation as resolved.
Show resolved Hide resolved
url: "https://github.com/astro-informatics/s2let/archive/refs/tags/v2.2.3rc1.zip"
mdavezac marked this conversation as resolved.
Show resolved Hide resolved
sha256: "fef6c3ac8c9c8413f3e8ee02f0744ebae5fb01287cb53c31e32cb79f27c90c68"
63 changes: 63 additions & 0 deletions recipes/s2let/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
from conans import CMake, ConanFile, tools
from conans.errors import ConanInvalidConfiguration
from glob import glob
import os


mdavezac marked this conversation as resolved.
Show resolved Hide resolved
class S2let(ConanFile):
name = "s2let"
license = "GPL-3.0-or-later"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/astro-informatics/s2let"
description = "Fast wavelets on the sphere"
settings = "os", "arch", "compiler", "build_type"
topics = ("physics", "astrophysics", "radio interferometry")
options = {"fPIC": [True, False]}
default_options = {"fPIC": True}
mdavezac marked this conversation as resolved.
Show resolved Hide resolved
requires = "astro-informatics-so3/[>=1.3.4]", "cfitsio/[>=3.490]"
mdavezac marked this conversation as resolved.
Show resolved Hide resolved
generators = "cmake", "cmake_find_package"
exports_sources = ["CMakeLists.txt"]

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

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

mdavezac marked this conversation as resolved.
Show resolved Hide resolved
def configure(self):
del self.settings.compiler.cppstd
del self.settings.compiler.libcxx

mdavezac marked this conversation as resolved.
Show resolved Hide resolved
def config_options(self):
if self.settings.compiler == "Visual Studio":
raise ConanInvalidConfiguration(
"SO3 requires C99 support for complex numbers."
mdavezac marked this conversation as resolved.
Show resolved Hide resolved
)

def source(self):
tools.get(**self.conan_data["sources"][self.version])
mdavezac marked this conversation as resolved.
Show resolved Hide resolved
extracted_dir = glob("s2let-*/")[0]
os.rename(extracted_dir, self._source_subfolder)

@property
def cmake(self):
mdavezac marked this conversation as resolved.
Show resolved Hide resolved
if not hasattr(self, "_cmake"):
self._cmake = CMake(self)
self._cmake.definitions["BUILD_TESTING"] = False
self._cmake.definitions["cfitsio"] = True
self._cmake.configure(build_folder=self._build_subfolder)
return self._cmake

def build(self):
self.cmake.build()

def package(self):
self.copy("LICENSE", dst="licenses", src=self._source_subfolder)
self.cmake.install()

def package_info(self):
self.cpp_info.libs = ["s2let"]
mdavezac marked this conversation as resolved.
Show resolved Hide resolved
if self.settings.os == "Linux":
self.cpp_info.system_libs = ["m"]
11 changes: 11 additions & 0 deletions recipes/s2let/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cmake_minimum_required(VERSION 3.1)
mdavezac marked this conversation as resolved.
Show resolved Hide resolved
project(test_package C)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
mdavezac marked this conversation as resolved.
Show resolved Hide resolved

find_package(s2let REQUIRED NO_MODULE)

add_executable(${PROJECT_NAME} example.c)
target_compile_features(${PROJECT_NAME} PUBLIC c_std_99)
target_link_libraries(${PROJECT_NAME} s2let::s2let)
17 changes: 17 additions & 0 deletions recipes/s2let/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import os
from conans import ConanFile, CMake, tools


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

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

def test(self):
if not tools.cross_building(self.settings):
bin_path = os.path.join("bin", "test_package")
self.run(bin_path, run_environment=True)
9 changes: 9 additions & 0 deletions recipes/s2let/all/test_package/example.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include <s2let/s2let.h>

int main(int argc, char *argv[])
{
complex double *buffer;
s2let_allocate_lm(&buffer, 5);
free(buffer);
return 0;
}
3 changes: 3 additions & 0 deletions recipes/s2let/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"2.2.3":
folder: all