-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconanfile.py
42 lines (34 loc) · 1.3 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
import os
from conans import ConanFile, CMake, tools
class UniassertConan(ConanFile):
name = "uniassert"
version = "1.0.0"
license = "Zlib"
url = "https://github.com/2gis/uniassert.git"
description = "The uniassert library is a small collection of useful macros. Most of them are designed for assumption checks"
settings = "os", "compiler", "build_type", "arch"
build_requires = ('gtest/1.8.0@bincrafters/stable', )
generators = "cmake"
branch = 'master'
def source(self):
url = 'https://github.com/2gis/uniassert/archive/{}.zip'.format(self.branch)
tools.download(url, self.branch)
tools.unzip(self.branch)
os.remove(self.branch)
def build(self):
cmake = CMake(self)
configure_args = {
'args': ['-DUNIASSERT_TESTS=ON', ] if self.develop else None,
'source_dir': self.source_subdir(),
}
cmake.configure(**configure_args)
cmake.build()
cmake.test()
def package(self):
src = os.path.join(self.source_subdir(), 'include')
self.copy("*.h", dst="include", src=src)
def package_id(self):
self.info.header_only()
def source_subdir(self):
subdir = '{}-{}'.format(self.name, self.branch)
return os.path.join(self.source_folder, subdir)