from conans import ConanFile, CMake, tools


class {project_name}Conan(ConanFile):
  name = "{project_name}"
  version = "1.0.0"
  settings = "os", "compiler", "build_type", "arch"
  requires = ()
  generators = "cmake"
  scm = {
    "type": "git",
    "subfolder": name,
    "url": "auto",
    "revision": "auto"
  }
  options = {
    "shared": [True, False],
  }
  default_options = {
    "shared": True
  }
  
  def build(self):
    cmake = CMake(self)
    cmake.definitions["BUILD_TEST"] = False
    cmake.configure(source_folder=self.name)
    cmake.build()
  
  def imports(self):
    self.copy("*.dll", dst="bin", src="bin", )
    self.copy("*.pdb", dst="bin", src="bin", )
    self.copy("*", dst="bin/assets/resources", src="resources")
    
  def package(self):
    self.copy("*.h", dst="include", src=f"{self.name}/src")
    self.copy("*.dll", dst="bin", src="bin", keep_path=False)
    self.copy("*.so", dst="lib", src="lib", keep_path=False)
    self.copy("*.dylib", dst="lib", src="lib", keep_path=False)
    self.copy("*.a", dst="lib", src="lib", keep_path=False)
    self.copy("*.lib", dst="lib", src="lib", keep_path=False)
    self.copy("*", dst="resources", src=f"{self.name}/assets/resources")
  
  def package_info(self):
    self.cpp_info.libs = tools.collect_libs(self)
