-
Notifications
You must be signed in to change notification settings - Fork 0
/
conanfile.py
56 lines (48 loc) · 2 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
from conans import ConanFile, CMake
from conans.errors import ConanInvalidConfiguration
class ReplayConan(ConanFile):
name = "replay"
version = "2.7"
license = "MIT"
author = "Marius Elvert [email protected]"
url = "https://github.com/ltjax/replay"
description = "Lean library to observe file changes in a specific directory path."
topics = ("games", "math")
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False], "use_stb": [True, False], "use_libpng": [True, False]}
generators = "cmake"
exports_sources = "source/*", "test/*", "include/*", "CMakeLists.txt", "replay.natvis"
requires = "boost/1.75.0",
build_requires = "catch2/2.13.4",
default_options = {
"shared": False,
"use_stb": True,
"use_libpng": False,
"boost:header_only": True,
}
def _configured_cmake(self):
cmake = CMake(self)
cmake.configure(source_folder=".", defs={
'Replay_USE_CONAN': True,
'Replay_ENABLE_INSTALL': True,
'Replay_USE_STBIMAGE': self.options.use_stb,
'Replay_USE_STBIMAGE_WRITE': self.options.use_stb,
'Replay_USE_STBIMAGE_FROM_CONAN': self.options.use_stb,
'Replay_USE_LIBPNG': self.options.use_libpng})
return cmake
def configure(self):
if self.options.use_libpng and self.options.use_stb:
raise ConanInvalidConfiguration("Cannot use both stb and libpng")
def requirements(self):
if self.options.use_stb:
self.requires("stb/20190512@conan/stable")
if self.options.use_libpng:
self.requires("libpng/1.6.37@bincrafters/stable")
def build(self):
self._configured_cmake().build()
def package(self):
self._configured_cmake().install()
def package_info(self):
self.cpp_info.libs = ["replay"]
if self.options.use_stb:
self.cpp_info.defines.extend(["REPLAY_USE_STBIMAGE", "REPLAY_USE_STBIMAGE_WRITE"])