-
Notifications
You must be signed in to change notification settings - Fork 0
/
conanfile.py
52 lines (43 loc) · 1.79 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
from conans import ConanFile, CMake, tools
from conan.errors import ConanInvalidConfiguration
import os
class LibulzConan(ConanFile):
name = "libulz"
version = "2d4ec7e"
description = "A collection of useful functions and data structures to create C apps"
url = "https://github.com/bincrafters/conan-libulz"
homepage = "https://github.com/rofl0r/libulz"
license = "LGPL-2.1"
exports_sources = ["CMakeLists.txt"]
generators = "cmake"
settings = "os", "arch", "compiler", "build_type"
options = {"shared": [True, False], "fPIC": [True, False]}
default_options = {'shared': False, 'fPIC': True}
_source_subfolder = "source_subfolder"
_build_subfolder = "build_subfolder"
def config_options(self):
if self.settings.os == 'Windows':
self.options.remove("fPIC")
def configure(self):
if self.settings.os == "Windows":
raise ConanInvalidConfiguration("libulz is not supported on Windows")
del self.settings.compiler.libcxx
del self.settings.compiler.cppstd
def source(self):
full_version = self.version + "adf6cf6f6ea594340fd94de706fb979ca"
tools.get("{0}/archive/{1}.zip".format(self.homepage, self.version))
extracted_dir = self.name + "-" + full_version
os.rename(extracted_dir, self._source_subfolder)
def _configure_cmake(self):
cmake = CMake(self)
cmake.configure(build_folder=self._build_subfolder)
return cmake
def build(self):
cmake = self._configure_cmake()
cmake.build()
def package(self):
self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder)
cmake = self._configure_cmake()
cmake.install()
def package_info(self):
self.cpp_info.libs = tools.collect_libs(self)