This repository has been archived by the owner on Feb 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconanfile.py
83 lines (76 loc) · 2.91 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
import os
from conans import ConanFile, CMake
class CppUTest(ConanFile):
name = "CppUTest"
version = "master" # "3.8"
description = """C /C++ based unit xUnit test framework for unit testing and for test-driving your code"""
license = "BSD 3-clause \"New\" or \"Revised\" License, https://github.com/cpputest/cpputest/blob/master/COPYING"
url = "https://cpputest.github.io"
settings = "os", "compiler", "arch", "build_type"
source_dir = "{name}-{version}".format(name=name, version=version)
options = {
"shared": [True, False],
"fPIC": [True, False],
"verbose": [True, False],
"use_std_c_lib": ["ON", "OFF"],
"use_std_cpp_lib": ["ON", "OFF"],
"use_cpp11": ["ON", "OFF"],
"detect_mem_leaks": ["ON", "OFF"],
"extensions": ["ON", "OFF"],
"longlong": ["ON", "OFF"],
"coverage": ["ON", "OFF"],
"tests": ["ON", "OFF"]
}
default_options = (
"shared=False",
"fPIC=False",
"verbose=False",
"use_std_c_lib=ON",
"use_std_cpp_lib=ON",
"use_cpp11=ON",
"detect_mem_leaks=ON",
"extensions=ON",
"longlong=ON",
"coverage=OFF",
"tests=ON"
)
scm = {
"type": "git",
"subfolder": source_dir,
"url": "https://github.com/cpputest/cpputest.git",
"revision": "tags/v{version}".format(version=version)
}
if version == "master":
scm["revision"] = "master"
def _my_cmake(self):
cmake = CMake(self, set_cmake_flags=True)
cmake.verbose = self.options.verbose
# Translate our options to CppUTest's cmake options
cmake.definitions["STD_C"] = self.options.use_std_c_lib
cmake.definitions["STD_CPP"] = self.options.use_std_cpp_lib
cmake.definitions["C++11"] = self.options.use_cpp11
cmake.definitions["MEMORY_LEAK_DETECTION"] = self.options.detect_mem_leaks
cmake.definitions["EXTENSIONS"] = self.options.extensions
cmake.definitions["LONGLONG"] = self.options.longlong
cmake.definitions["COVERAGE"] = self.options.coverage
cmake.definitions["TESTS"] = self.options.tests
#self.output.info("definitions={}".format(cmake.definitions))
cmake.configure(source_dir=os.path.join(self.source_folder, self.source_dir))
return cmake
def source(self):
# No need to do anything here, since our scm definition does the work
pass
def build(self):
cmake = self._my_cmake()
cmake.build()
if self.options.tests:
cmake.test()
def package(self):
cmake = self._my_cmake()
cmake.install()
def package_info(self):
self.cpp_info.libs = ["CppUTest"]
if self.options.extensions:
self.cpp_info.libs.append("CppUTestExt")
if self.settings.compiler == "Visual Studio":
self.cpp_info.libs.append("winmm.lib")