2018-06-07 02:19:53 +02:00
|
|
|
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],
|
2018-08-03 02:20:33 +02:00
|
|
|
'tools': [True, False],
|
2018-12-19 19:32:05 +01:00
|
|
|
'profiling': [True, False],
|
2018-06-07 02:19:53 +02:00
|
|
|
}
|
|
|
|
|
2018-12-19 19:32:05 +01:00
|
|
|
default_options = {
|
|
|
|
'viewer': True,
|
|
|
|
'tools': True,
|
|
|
|
'profiling': True,
|
|
|
|
'bullet3:shared': False,
|
|
|
|
'sdl2:sdl2main': False,
|
|
|
|
}
|
2018-06-07 02:19:53 +02:00
|
|
|
|
|
|
|
generators = 'cmake',
|
2018-12-19 19:32:05 +01:00
|
|
|
exports_sources = 'CMakeLists.txt', 'cmake_configure.cmake', 'cmake_options.cmake', 'CMakeCPack.cmake', 'COPYING', \
|
|
|
|
'cmake/modules/*', 'benchmarks', 'rwcore/*', 'rwengine/*', 'rwgame/*', 'rwviewer/*', \
|
|
|
|
'rwtools/*', 'tests/*', 'external/*'
|
2018-06-07 02:19:53 +02:00
|
|
|
|
|
|
|
_rw_dependencies = {
|
|
|
|
'game': (
|
2018-12-19 03:59:22 +01:00
|
|
|
'openal/1.19.0@bincrafters/stable',
|
|
|
|
'bullet3/2.87@bincrafters/stable',
|
2018-10-16 10:30:11 +02:00
|
|
|
'glm/0.9.9.1@g-truc/stable',
|
2018-12-19 03:59:22 +01:00
|
|
|
'ffmpeg/4.0.2@bincrafters/stable',
|
|
|
|
'sdl2/2.0.9@bincrafters/stable',
|
|
|
|
'boost/1.68.0@conan/stable',
|
2018-06-07 02:19:53 +02:00
|
|
|
),
|
|
|
|
'viewer': (
|
2018-12-19 03:59:22 +01:00
|
|
|
'qt/5.12.0@bincrafters/stable',
|
2018-08-03 02:20:33 +02:00
|
|
|
),
|
|
|
|
'tools': (
|
|
|
|
'freetype/2.9.0@bincrafters/stable',
|
|
|
|
),
|
2018-06-07 02:19:53 +02:00
|
|
|
}
|
|
|
|
|
2018-07-06 02:25:48 +02:00
|
|
|
def configure(self):
|
|
|
|
if self.options.viewer:
|
2018-12-19 03:59:22 +01:00
|
|
|
self.options['qt'].opengl = 'desktop'
|
2018-07-06 02:25:48 +02:00
|
|
|
|
2018-06-07 02:19:53 +02:00
|
|
|
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)
|
2018-08-03 02:20:33 +02:00
|
|
|
if self.options.tools:
|
|
|
|
for dep in self._rw_dependencies['tools']:
|
|
|
|
self.requires(dep)
|
2018-06-07 02:19:53 +02:00
|
|
|
|
|
|
|
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,
|
2018-08-03 02:20:33 +02:00
|
|
|
'BUILD_TOOLS': self.options.tools,
|
2018-12-19 19:32:05 +01:00
|
|
|
'ENABLE_PROFILING': self.options.profiling,
|
2018-06-07 02:19:53 +02:00
|
|
|
'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
|