PkmnLib/conanfile.py

59 lines
2.2 KiB
Python
Raw Normal View History

2019-12-29 14:29:52 +00:00
from conans import ConanFile, CMake
2020-01-12 17:20:59 +00:00
from conans.errors import ConanInvalidConfiguration
2019-12-29 14:29:52 +00:00
class PkmnLibConan(ConanFile):
name = "PkmnLib"
license = "TODO"
2020-02-08 09:22:18 +00:00
url = "https://git.p-epsilon.com/Deukhoofd/PkmnLib"
description = "An implementation of CreatureLib to handle Pokemon battling."
2020-02-06 15:25:55 +00:00
settings = "os", "compiler", "build_type"
options = {"shared": [True, False], "script_handler": ["angelscript"], "staticC": [True, False]}
default_options = {"shared": True, "script_handler": "angelscript", "staticC": False}
2019-12-29 14:29:52 +00:00
generators = "cmake"
exports_sources = "*"
compiler = "clang"
def build(self):
cmake = CMake(self)
2020-02-08 09:22:18 +00:00
self.output.info("Target OS: %s." % self.settings.os)
if self.settings.os == "Windows":
self.output.warn("Noticed Windows target, setting Cmake WINDOWS=On.")
cmake.definitions["WINDOWS"] = "On"
2020-07-31 15:38:28 +00:00
if self.options.shared:
self.output.info("Building shared library.")
cmake.definitions["SHARED"] = "On"
if self.options.staticC:
cmake.definitions["STATICC"] = "On"
2019-12-29 14:29:52 +00:00
cmake.configure()
cmake.build()
def package(self):
self.copy("*.hpp", dst="include/PkmnLib", src="src")
self.copy("*.hxx", dst="include/PkmnLib", src="src")
2020-02-19 08:59:46 +00:00
self.copy("*.h", dst="include/extern", src="extern")
2019-12-29 14:29:52 +00:00
self.copy("*.dll", dst="bin", keep_path=False)
self.copy("*.so", dst="lib", keep_path=False)
2020-02-08 09:22:18 +00:00
def package_info(self):
self.cpp_info.libs = ["libpkmnLib"]
2020-01-01 18:59:47 +00:00
def imports(self):
2020-02-23 15:02:27 +00:00
if self.settings.os == "Windows":
2020-07-18 12:42:03 +00:00
self.copy("*.dll", "", "bin")
2020-01-12 17:20:59 +00:00
def configure(self):
if self.options.script_handler == "angelscript":
self.options["AngelScript"].shared = True
2020-05-04 16:07:39 +00:00
if self.options.staticC:
2020-01-12 17:20:59 +00:00
self.options["AngelScript"].link_std_statically = True
def requirements(self):
2020-02-27 18:00:22 +00:00
self.requires("Arbutils/latest@epsilon/master")
2020-02-23 15:02:27 +00:00
self.requires("CreatureLib/latest@epsilon/master")
if self.options.script_handler == "angelscript":
2020-12-07 17:01:10 +00:00
self.requires("AngelScript/2.35@AngelScript/Deukhoofd")
2020-02-23 15:02:27 +00:00
else:
raise ConanInvalidConfiguration("Invalid Script Handler was specified: " + self.options.script_handler)