Repository: conan-io/conan-center-index

Issue:
[request] ssht/1.3.6
### Package Details
  * Package Name/Version: **ssht/1.3.6**
  * Website: **http://astro-informatics.github.io/ssht/**
  * Source code: **https://github.com/astro-informatics/ssht**


### Description Of The Library / Tool

SSHT is a mature research code that implements fast and exact spin spherical harmonic transforms. Spin-spherical transforms are somewhat akin to Fourier transforms,  except they take place on a sphere rather than on a plane. They are used to describe natural phenomenon occurring on a sphere, e.g. climate, radio-astronomy, 360 VR images, etc... 


Discussion:

Resolving patch:
diff --git a/recipes/ssht/all/conanfile.py b/recipes/ssht/all/conanfile.py
new file mode 100644
--- /dev/null
+++ b/recipes/ssht/all/conanfile.py
@@ -0,0 +1,58 @@
+from conans import CMake, ConanFile, tools
+from conans.errors import ConanInvalidConfiguration
+from glob import glob
+import os
+
+
+
+class SshtConan(ConanFile):
+    name = "ssht"
+    license = "GPL-3.0-or-later"
+    url = "https://github.com/conan-io/conan-center-index"
+    homepage = "https://github.com/astro-informatics/ssht"
+    description = "Fast spin spherical harmonic 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"
+    generators = "cmake", "cmake_find_package", "cmake_paths"
+    exports_sources = ["CMakeLists.txt"]
+
+    @property
+    def _source_subfolder(self):
+        return "source_subfolder"
+
+    @property
+    def _build_subfolder(self):
+        return "build_subfolder"
+
+    def config_options(self):
+        if self.settings.compiler == "Visual Studio":
+            raise ConanInvalidConfiguration("SSHT requires C99 support for complex numbers.")
+        del self.settings.compiler.cppstd
+        del self.settings.compiler.libcxx
+
+    def source(self):
+        tools.get(**self.conan_data["sources"][self.version])
+        extracted_dir = glob('ssht-*/')[0]
+        os.rename(extracted_dir, self._source_subfolder)
+
+    @property
+    def cmake(self):
+        if not hasattr(self, "_cmake"):
+            self._cmake = CMake(self)
+            self._cmake.definitions["tests"] = False
+            self._cmake.definitions["python"] = 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 = ["ssht"]


Test patch:
diff --git a/recipes/ssht/all/test_package/CMakeLists.txt b/recipes/ssht/all/test_package/CMakeLists.txt
new file mode 100644
--- /dev/null
+++ b/recipes/ssht/all/test_package/CMakeLists.txt
@@ -0,0 +1,11 @@
+cmake_minimum_required(VERSION 3.1)
+project(test_package C)
+
+include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
+conan_basic_setup()
+
+find_package(Ssht REQUIRED NO_MODULE)
+
+add_executable(${PROJECT_NAME} example.c)
+target_compile_features(${PROJECT_NAME} PUBLIC c_std_99)
+target_link_libraries(${PROJECT_NAME} ssht::ssht)
diff --git a/recipes/ssht/all/test_package/conanfile.py b/recipes/ssht/all/test_package/conanfile.py
new file mode 100644
--- /dev/null
+++ b/recipes/ssht/all/test_package/conanfile.py
@@ -0,0 +1,20 @@
+import os
+from conans import ConanFile, CMake, tools
+
+
+class SshtTestConan(ConanFile):
+    settings = "os", "compiler", "build_type", "arch"
+    generators = "cmake", "cmake_find_package_multi"
+
+    def configure(self):
+        del self.settings.compiler.libcxx
+
+    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)
diff --git a/recipes/ssht/all/test_package/example.c b/recipes/ssht/all/test_package/example.c
new file mode 100644
--- /dev/null
+++ b/recipes/ssht/all/test_package/example.c
@@ -0,0 +1,7 @@
+#include <ssht/ssht_sampling.h>
+
+int main(int argc, char *argv[])
+{
+  ssht_sampling_weight_mw(5);
+  return 0;
+}