-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconanfile.py
63 lines (49 loc) · 2.11 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
from conan import ConanFile
from conan.tools.cmake import CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.files import copy
import os
required_conan_version = ">=1.63.0"
class Sauerbraten(ConanFile):
name = "sauerbraten"
version = "r5692"
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False], "fPIC": [True, False]}
default_options = {"shared": True, "fPIC": True}
def requirements(self):
self.requires("enet/1.3.17")
self.requires("sdl/2.28.5")
self.requires("sdl_image/2.6.3")
self.requires("sdl_mixer/2.0.4")
self.requires("zlib/1.3")
def tool_requirements(self):
self.requires("cmake/3.28.1")
def layout(self):
cmake_layout(self)
def configure(self):
self.options["enet"].shared = True
self.options["sdl"].shared = True
self.options["sdl_image"].shared = True
# "sdl2_image:jpg": "libjpeg",
self.options["sdl_mixer"].shared = True
self.options["zlib"].shared = True
def generate(self):
tc = CMakeToolchain(self)
tc.generate()
cdeps = CMakeDeps(self)
cdeps.generate()
target_dir = "bin_unix"
if self.settings.os == "Windows":
if self.settings.arch == "x86_64":
target_dir = "bin64"
else:
target_dir = "bin"
target_licenses_root = os.path.join(self.source_folder, target_dir, "licenses")
for dep in self.dependencies.values():
copy(self, "*.dylib", dep.cpp_info.libdirs[0], os.path.join(self.source_folder, target_dir))
copy(self, "*.dll", dep.cpp_info.libdirs[0], os.path.join(self.source_folder, target_dir))
copy(self, "*.dll", dep.cpp_info.bindirs[0], os.path.join(self.source_folder, target_dir))
target_licenses = os.path.join(target_licenses_root, dep.ref.name)
copy(self, "*", os.path.join(dep.package_folder, "licenses"), target_licenses)
fo = open(os.path.join(self.source_folder, "version.txt"), "w")
fo.write(self.version[1:])
fo.close()