from conans import ConanFile, CMake class LsStdConan(ConanFile): name = "ls-std" version = "2021.2.0" license = "MIT" url = "https://vcs.lynarstudios.de/public/ls-standard-library.git" 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], "static": [True, False]} default_options = {"shared": False, "static": True} generators = "cmake" def source(self): self.run("git clone " + self.url + " --branch v" + self.version + " --single-branch") def build(self): cmake = CMake(self) if self.options.shared: cmake.definitions["LS_STD_BUILD_SHARED"] = "ON" cmake.definitions["LS_STD_BUILD_STATIC"] = "OFF" cmake.configure(source_folder="ls-standard-library") self.run("cmake --build . --config Release") def package(self): self.copy("*.hpp", dst="include", src="ls-standard-library/include") self.copy("*.lib", dst="lib", keep_path=False) self.copy("*.dll", dst="lib", 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): if self.options.shared: self.cpp_info.libs = ["ls_std_" + self.version + "_shared"] else: self.cpp_info.libs = ["ls_std_" + self.version + "_static"]