forked from rwengine/openrw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conanfile.py
91 lines (79 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
84
85
86
87
88
89
90
91
from conans import ConanFile, CMake
class OpenrwConan(ConanFile):
name = 'openrw'
version = 'master'
license = 'GPL3'
url = 'https://github.com/rwengine/openrw'
description = "OpenRW 'Open ReWrite' is an un-official open source recreation of the classic Grand Theft Auto III game executable"
settings = 'os', 'compiler', 'build_type', 'arch'
options = {
'viewer': [True, False],
'tools': [True, False],
'profiling': [True, False],
}
default_options = {
'viewer': True,
'tools': True,
'profiling': True,
'bullet3:shared': False,
'sdl2:sdl2main': False,
}
generators = 'cmake',
exports_sources = 'CMakeLists.txt', 'cmake_configure.cmake', 'cmake_options.cmake', 'CMakeCPack.cmake', 'COPYING', \
'cmake/modules/*', 'benchmarks', 'rwcore/*', 'rwengine/*', 'rwgame/*', 'rwviewer/*', \
'rwtools/*', 'tests/*', 'external/*'
_rw_dependencies = {
'game': (
'openal/1.19.0@bincrafters/stable',
'bullet3/2.87@bincrafters/stable',
'glm/0.9.9.1@g-truc/stable',
'ffmpeg/4.0.2@bincrafters/stable',
'sdl2/2.0.9@bincrafters/stable',
'boost/1.68.0@conan/stable',
'bzip2/1.0.8@conan/stable',
),
'viewer': (
'qt/5.12.0@bincrafters/stable',
),
'tools': (
'freetype/2.9.0@bincrafters/stable',
),
}
def configure(self):
if self.options.viewer:
self.options['qt'].opengl = 'desktop'
def requirements(self):
for dep in self._rw_dependencies['game']:
self.requires(dep)
if self.options.viewer:
for dep in self._rw_dependencies['viewer']:
self.requires(dep)
if self.options.tools:
for dep in self._rw_dependencies['tools']:
self.requires(dep)
def _configure_cmake(self):
cmake = CMake(self)
defs = {
'BUILD_SHARED_LIBS': False,
'CMAKE_BUILD_TYPE': self.settings.build_type,
'BUILD_TESTS': True,
'BUILD_VIEWER': self.options.viewer,
'BUILD_TOOLS': self.options.tools,
'ENABLE_PROFILING': self.options.profiling,
'USE_CONAN': True,
'BOOST_STATIC': not self.options['boost'].shared,
}
cmake.configure(defs=defs)
return cmake
def build(self):
cmake = self._configure_cmake()
cmake.build()
def package(self):
if self.options.viewer:
# FIXME: https://github.com/osechet/conan-qt/issues/6 and https://github.com/conan-io/conan/issues/2619
self.copy('qt.conf', dst='bin', src='rwviewer')
cmake = self._configure_cmake()
cmake.install()
def package_info(self):
self.cpp_info.libs = ['rwengine', 'rwlib']
self.cpp_info.stdcpp = 14