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 so3 package #5178

Merged
merged 10 commits into from
May 17, 2021
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
7 changes: 7 additions & 0 deletions recipes/astro-informatics-so3/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/astro-informatics-so3/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
"1.3.4":
url: "https://github.com/astro-informatics/so3/archive/refs/tags/v1.3.4.zip"
sha256: "383431c3078faa073c3017ceb3e0108885ab7628e81af13488f9aa021b95bbc7"
62 changes: 62 additions & 0 deletions recipes/astro-informatics-so3/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
from conans import CMake, ConanFile, tools
from conans.errors import ConanInvalidConfiguration
from glob import glob
import os


class AstroInformaticsSO3(ConanFile):
name = "astro-informatics-so3"
license = "GPL-3.0-or-later"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/astro-informatics/so3"
description = "Fast and accurate Wigner transforms"
settings = "os", "arch", "compiler", "build_type"
topics = ("physics", "astrophysics", "radio interferometry")
options = {"fPIC": [True, False]}
default_options = {"fPIC": True}
requires = "fftw/3.3.9", "ssht/1.3.7"
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"

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

def config_options(self):
if self.settings.compiler == "Visual Studio":
raise ConanInvalidConfiguration(
"SO3 requires C99 support for complex numbers."
)

def source(self):
tools.get(**self.conan_data["sources"][self.version])
extracted_dir = glob("so3-*/")[0]
os.rename(extracted_dir, self._source_subfolder)

@property
def cmake(self):
if not hasattr(self, "_cmake"):
self._cmake = CMake(self)
self._cmake.definitions["BUILD_TESTING"] = False
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 = ["astro-informatics-so3"]
if self.settings.os == "Linux":
self.cpp_info.system_libs = ["m"]
12 changes: 12 additions & 0 deletions recipes/astro-informatics-so3/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
cmake_minimum_required(VERSION 3.1)
project(test_package C)

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

find_package(astro-informatics-so3 REQUIRED NO_MODULE)

add_executable(${PROJECT_NAME} example.c)
target_compile_features(${PROJECT_NAME} PUBLIC c_std_99)
target_link_libraries(${PROJECT_NAME}
astro-informatics-so3::astro-informatics-so3)
17 changes: 17 additions & 0 deletions recipes/astro-informatics-so3/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)
10 changes: 10 additions & 0 deletions recipes/astro-informatics-so3/all/test_package/example.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include <so3/so3_sampling.h>
#include <so3/so3_types.h>

int main(int argc, char *argv[])
{
so3_parameters_t params;
params.sampling_scheme = SO3_SAMPLING_MW;
so3_sampling_weight(&params, 2);
return 0;
}
3 changes: 3 additions & 0 deletions recipes/astro-informatics-so3/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"1.3.4":
folder: all