-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconanfile.py
78 lines (63 loc) · 2.67 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
from conans import ConanFile, MSBuild, tools
from shutil import copyfile
import os
class Box2dConan(ConanFile):
name = "box2d"
license = "https://github.com/erincatto/box2d/blob/master/LICENSE"
description = "Box2D is a 2D physics engine for games."
url = "https://github.com/erincatto/box2d"
# Setting and options
settings = "os", "compiler", "arch", "build_type"
options = {
"fPIC":[True, False],
"custom_allocator_extension":[True, False],
"undefined_user_symbols": [True, False]
}
default_options = {
"fPIC":True,
"custom_allocator_extension": False,
"undefined_user_symbols": False
}
# Additional files to export
exports_sources = ["patches/*"]
# Iceshard conan tools
python_requires = "conan-iceshard-tools/0.7.1@iceshard/stable"
python_requires_extend = "conan-iceshard-tools.IceTools"
def init(self):
self.ice_init("cmake")
self.build_requires = self._ice.build_requires
def ice_source_key(self, version):
if self.options.custom_allocator_extension == True:
return "{}-alloc".format(version)
elif self.options.undefined_user_symbols == True:
return "{}-usersym".format(version)
else:
return version
def configure(self):
if self.settings.compiler == 'Visual Studio':
del self.options.fPIC
def ice_build(self):
self.ice_apply_patches()
definitions = { }
if self.settings.compiler != 'Visual Studio':
definitions['CMAKE_POSITION_INDEPENDENT_CODE'] = self.options.fPIC
definitions['BOX2D_BUILD_DOCS'] = False
definitions['BOX2D_BUILD_TESTBED'] = False
definitions['BOX2D_BUILD_UNIT_TESTS'] = False
definitions['BOX2D_USER_SETTINGS'] = False
definitions['B2_USER_SYMBOLS'] = True
self.ice_run_cmake(definitions)
def package(self):
self.copy("LICENSE", src=self._ice.source_dir, dst="LICENSE")
self.copy("*.h", "include/", src="{}/include".format(self._ice.source_dir), keep_path=True)
build_dir = self._ice.build_dir
if self.settings.os == "Windows":
self.copy("*.lib", dst="lib", src="{}/bin".format(build_dir), keep_path=False)
self.copy("*.pdb", dst="lib", src="{}/bin".format(build_dir), keep_path=False)
if self.settings.os == "Linux":
self.copy("*.a", dst="lib", src="{}/bin".format(build_dir), keep_path=False)
def package_info(self):
self.cpp_info.libdirs = ["lib"]
self.cpp_info.libs = ["box2d"]
if self.options.undefined_user_symbols == True:
self.cpp_info.defines = ["B2_USER_SYMBOLS"]