-
Notifications
You must be signed in to change notification settings - Fork 0
/
conanfile.py
41 lines (36 loc) · 1.9 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
from conans import ConanFile, CMake, tools
from conans.tools import download, unzip
import os
class RttrConan(ConanFile):
name = "rttr"
version = "0.9.6"
description = "Conan package for rttr."
url = "https://github.com/rttrorg/rttr"
license = "MIT"
settings = "arch", "build_type", "compiler", "os"
generators = "cmake"
options = {"shared": [True, False], "rtti": [True, False]}
default_options = "shared=True", "rtti=True"
def source(self):
zip_name = "v%s.zip" % self.version
download ("%s/archive/%s" % (self.url, zip_name), zip_name, verify=False)
unzip (zip_name)
os.unlink(zip_name)
def build(self):
cmake = CMake(self)
shared_options = "-DBUILD_STATIC=OFF" if self.options.shared else "-DBUILD_STATIC=ON"
rtti_options = "-DBUILD_WITH_RTTI=ON" if self.options.rtti else "-DBUILD_WITH_RTTI=OFF"
self.run("cmake %s-%s %s %s %s" % (self.name, self.version, cmake.command_line, shared_options, rtti_options))
self.run("cmake --build . %s" % cmake.build_config)
def package(self):
include_folder = "%s-%s/src" % (self.name, self.version)
self.copy("*.h" , dst="include", src=include_folder)
self.copy("*.rc" , dst="include", src=include_folder)
self.copy("*.h" , dst="include", src="src")
self.copy("*.rc" , dst="include", src="src")
self.copy("*.a" , dst="lib", keep_path=False)
self.copy("*.so" , dst="lib", keep_path=False)
self.copy("*.lib", dst="lib", keep_path=False)
self.copy("*.dll", dst="bin", keep_path=False)
def package_info(self):
self.cpp_info.libs = ["rttr_core_d"] if self.settings.build_type == "Debug" else ["rttr_core"]