This repository has been archived by the owner on Jan 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conanfile.py
71 lines (56 loc) · 2.97 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
import os, glob
from conans import ConanFile, tools, AutoToolsBuildEnvironment
from conans.errors import ConanException
from conans.model.version import Version
class IlmBaseConan(ConanFile):
name = "ilmbase"
description = "IlmBase is a component of OpenEXR. OpenEXR is a high dynamic-range (HDR) image file format developed by Industrial Light & Magic for use in computer imaging applications."
version = "2.3.0"
license = "BSD"
url = "https://github.com/Mikayex/conan-ilmbase.git"
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False], "namespace_versioning": [True, False], "fPIC": [True, False]}
default_options = "shared=False", "namespace_versioning=True", "fPIC=True"
generators = "cmake"
exports = "FindIlmBase.cmake"
deprecated = True
def config_options(self):
if self.settings.os == "Windows":
self.options.remove("fPIC")
def configure(self):
if "fPIC" in self.options.fields and self.options.shared:
self.options.fPIC = True
if self.settings.compiler == 'gcc' and Version(str(self.settings.compiler.version)) < "5":
raise ConanException("gcc >= 5 is required (support for C++14)")
def source(self):
url = "https://github.com/openexr/openexr/releases/download/v{version}/ilmbase-{version}.tar.gz"
tools.get(url.format(version=self.version))
tools.replace_in_file(os.path.join('ilmbase-{}'.format(self.version), 'CMakeLists.txt'), 'PROJECT ( ilmbase )',
"""PROJECT ( ilmbase )
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
""")
def build(self):
yes_no = {True: "enable", False: "disable"}
args = ["--{}-shared".format(yes_no.get(bool(self.options.shared))),
"--{}-static".format(yes_no.get(not bool(self.options.shared))),
"--{}-namespaceversioning".format(yes_no.get(bool(self.options.namespace_versioning))),
]
autotools = AutoToolsBuildEnvironment(self)
autotools.configure(configure_dir='ilmbase-{}'.format(self.version), args=args)
autotools.make()
tools.replace_prefix_in_pc_file("IlmBase.pc", "${package_root_path_ilmbase}")
def package(self):
autotools = AutoToolsBuildEnvironment(self)
autotools.install()
self.copy("FindIlmBase.cmake", src=".", dst=".")
self.copy("license*", dst="licenses", src="ilmbase-%s" % self.version, ignore_case=True, keep_path=False)
for f in glob.glob(os.path.join(self.package_folder, 'lib', '*.la')):
os.remove(f)
def package_info(self):
self.cpp_info.includedirs = [os.path.join('include', 'OpenEXR'), ]
self.cpp_info.libs = ['Half', 'Iex', 'IexMath', 'IlmThread', 'Imath']
if self.options.shared and self.settings.os == "Windows":
self.cpp_info.defines.append("OPENEXR_DLL")
if not self.settings.os == "Windows":
self.cpp_info.cppflags = ["-pthread"]