-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathconanfile.py
50 lines (40 loc) · 1.76 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
from conans import ConanFile, CMake, tools
class ExpatConan(ConanFile):
""" This recipe requires conan 0.25.1 at least"""
name = "Expat"
version = "2.2.4"
description = "Recipe for Expat library"
license = "MIT/X Consortium license. Check file COPYING of the library"
url = "https://github.com/Pix4D/conan-expat"
source_url = "https://github.com/libexpat/libexpat"
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False]}
default_options = "shared=False"
generators = "cmake"
exports_sources = ['FindExpat.cmake', 'patches/*']
def source(self):
self.run("git clone --depth 1 --branch R_2_2_4 %s" % self.source_url)
def build(self):
tools.patch(base_path = "libexpat", patch_file="patches/useConanFileAndIncreaseCMakeVersion.patch")
cmake = CMake(self, parallel=True)
cmake_args = { "BUILD_doc" : "OFF",
"BUILD_examples" : "OFF",
"BUILD_shared" : self.options.shared,
"BUILD_tests" : "OFF",
"BUILD_tools" : "OFF",
"CMAKE_DEBUG_POSTFIX": "d",
"CMAKE_POSITION_INDEPENDENT_CODE": "ON",
}
cmake.configure(source_dir="../libexpat/expat", build_dir="build", defs=cmake_args)
cmake.build(target="install")
def package(self):
self.copy("FindExpat.cmake", ".", ".")
def package_info(self):
if self.settings.build_type == "Debug":
self.cpp_info.libs = ["expatd"]
else:
self.cpp_info.libs = ["expat"]
if not self.options.shared:
self.cpp_info.defines = ["XML_STATIC"]
def configure(self):
del self.settings.compiler.libcxx