from conans import ConanFile, CMake


class LsStdConan(ConanFile):
    name = "ls-std"
    version = "2021.2.0"
    license = "MIT"
    url = "<Package recipe repository url here, for issues about the package>"
    description = "This library provides standard functionalities like serialization, json, xml, file operations, " \
                  "boxing, state machine, event handling."
    topics = ("serialization", "events", "boxing", "xml", "json", "files", "state machine")
    settings = "os", "compiler", "build_type", "arch"
    options = {"shared": [True, False]}
    default_options = {"shared": False}
    generators = "cmake"

    def source(self):
        self.run("git clone https://vcs.lynarstudios.de/public/ls-standard-library.git --branch v" + self.version +
                 " --single-branch")

    def build(self):
        cmake = CMake(self)
        cmake.configure(source_folder="ls-standard-library")
        cmake.build()

    def package(self):
        self.copy("*.hpp", dst="include", src="ls-standard-library/include")
        self.copy("*ls_std_" + self.version + "_static.lib", dst="lib", keep_path=False)
        self.copy("*.dll", dst="bin", keep_path=False)
        self.copy("*.so", dst="lib", keep_path=False)
        self.copy("*.dylib", dst="lib", keep_path=False)
        self.copy("*.a", dst="lib", keep_path=False)

    def package_info(self):
        self.cpp_info.libs = ["ls_std_" + self.version + "_static"]