-
Notifications
You must be signed in to change notification settings - Fork 0
/
conanfile.py
60 lines (51 loc) · 1.89 KB
/
conanfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
from conans import CMake, ConanFile
class FlagConan(ConanFile):
name = "flag"
version = "1.0.0"
license = "GPL-3"
url = "https://github.com/astro-informatics/src_flag"
homepage = "https://github.com/astro-informatics/src_flag"
description = "Fast Fourier-Laguerre transform on the ball"
settings = "os", "arch", "compiler", "build_type"
topics = ("Physics", "Astrophysics", "Radio Interferometry")
options = {"fPIC": [True, False]}
default_options = {"fPIC": True}
generators = "cmake"
exports_sources = [
"src/main/c/*",
"include/*.h",
"CMakeLists.txt",
"cmake/*.cmake",
"src/test/c/*.c",
"src/test/c/*.h",
"src/test/c/CMakeLists.txt",
]
def requirements(self):
location = "astro-informatics/stable" if self.in_local_cache else "user/testing"
self.requires(f"ssht/1.3.7@{location}")
def configure(self):
if self.settings.compiler == "Visual Studio":
del self.options.fPIC
self.options["ssht"].fPIC = self.options.fPIC
del self.settings.compiler.libcxx
@property
def cmake(self):
if not hasattr(self, "_cmake"):
self._cmake = CMake(self)
self._cmake.definitions["tests"] = True
self._cmake.definitions["conan_deps"] = True
self._cmake.definitions["fPIC"] = self.options.fPIC
self._cmake.configure(build_folder="build")
return self._cmake
def build(self):
from pathlib import Path
path = Path(self.source_folder)
build = Path(self.source_folder) / "build"
build.mkdir(exist_ok=True)
(path / "conanbuildinfo.cmake").rename(path / "build" / "conanbuildinfo.cmake")
self.cmake.build()
self.cmake.test()
def package(self):
self.cmake.install()
def package_info(self):
self.cpp_info.libs = ["flag"]