This repository has been archived by the owner on Jan 15, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathconanfile.py
67 lines (53 loc) · 2.6 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
from conans import ConanFile, tools, CMake
import os
import shutil
class OpusConan(ConanFile):
name = "opus"
description = "Opus is a totally open, royalty-free, highly versatile audio codec."
topics = ("conan", "opus", "audio", "decoder", "decoding", "multimedia", "sound")
url = "https://github.com/bincrafters/conan-opus"
homepage = "https://opus-codec.org"
license = "BSD-3-Clause"
exports_sources = ["CMakeLists.txt","FindOPUS.cmake","opus_buildtype.cmake"]
generators = "cmake"
settings = "os", "arch", "compiler", "build_type"
options = {"shared": [True, False], "fPIC": [True, False], "fixed_point": [True, False]}
default_options = {'shared': False, 'fPIC': True, 'fixed_point': False}
_source_subfolder = "source_subfolder"
def configure(self):
del self.settings.compiler.libcxx
del self.settings.compiler.cppstd
if self.settings.os == "Windows" and \
(self.settings.compiler == "Visual Studio" and int(str(self.settings.compiler.version)) < 14):
raise tools.ConanException("On Windows, the opus package can only be built with the "
"Visual Studio 2015 or higher.")
def config_options(self):
if self.settings.os == "Windows":
self.options.remove("fPIC")
def source(self):
tools.get(**self.conan_data["sources"][self.version])
extracted_dir = self.name + "-" + self.version
os.rename(extracted_dir, self._source_subfolder)
# They forgot to package that file into the tarball for 1.3.1
# See https://github.com/xiph/opus/issues/129
os.rename("opus_buildtype.cmake", os.path.join(self._source_subfolder , "opus_buildtype.cmake"))
def _configure_cmake(self):
cmake = CMake(self)
cmake.definitions["OPUS_FIXED_POINT"] = self.options.fixed_point
cmake.configure()
return cmake
def build(self):
cmake = self._configure_cmake()
cmake.build()
def package(self):
self.copy("FindOPUS.cmake", ".", ".")
self.copy("COPYING", dst="licenses", src=self._source_subfolder, keep_path=False)
cmake = self._configure_cmake()
cmake.install()
def package_info(self):
self.cpp_info.libs = tools.collect_libs(self)
if self.settings.os == 'Linux' or self.settings.os == "Android":
self.cpp_info.libs.append('m')
if self.settings.os == "Windows" and self.settings.compiler != "Visual Studio":
self.cpp_info.libs.append("ssp")
self.cpp_info.includedirs.append(os.path.join('include', 'opus'))