-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconanfile.py
86 lines (67 loc) · 2.39 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
from conan.tools.microsoft import msvc_runtime_flag
from conans import ConanFile, CMake, tools
import functools
import os
import re
import shutil
import stat
required_conan_version = ">=1.36.0"
class TheoraConan(ConanFile):
name = "theora"
description = "Theora is a free and open video compression format from the Xiph.org Foundation"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/xiph/theora"
topics = ("theora", "video", "video-compressor", "video-format")
license = "BSD-3-Clause"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
}
generators = "cmake"
_cmake = None
@property
def _source_subfolder(self):
return "source_subfolder"
@property
def _build_subfolder(self):
return "build_subfolder"
def export_sources(self):
self.copy("CMakeLists.txt")
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
def configure(self):
if self.options.shared:
del self.options.fPIC
del self.settings.compiler.libcxx
del self.settings.compiler.cppstd
def requirements(self):
self.requires("ogg/1.3.5")
def source(self):
tools.get(**self.conan_data["sources"][self.version][0], strip_root=True, destination=self._source_subfolder)
source = self.conan_data["sources"][self.version][1]
url = source["url"]
filename = url[url.rfind("/") + 1:]
tools.download(url, filename)
tools.check_sha256(filename, source["sha256"])
shutil.move(filename, os.path.join(self._source_subfolder, "lib", filename))
def _configure_cmake(self):
if self._cmake:
return self._cmake
self._cmake = CMake(self)
self._cmake.configure(build_folder=self._build_subfolder)
return self._cmake
def build(self):
cmake = self._configure_cmake()
cmake.build()
def package(self):
self.copy("include/theora/*.h", dst="include/theora", src=self._source_subfolder, keep_path=False)
self.copy("*.a", dst="lib", keep_path=False)
self.copy("*.lib", dst="lib", keep_path=False)
def package_info(self):
self.cpp_info.libs = ["theora"]