 
from conans import ConanFile, CMake, tools
import os

class AngelScriptConan(ConanFile):
    name = "AngelScript"
    version = "2.35"
    license = "<Put the package license here>"
    url = "<Package recipe repository url here, for issues about the package>"
    description = "<Description of Hello here>"
    settings = "os", "compiler", "build_type", "arch"
    options = {"shared": [True, False], "link_std_statically": [True, False]}
    default_options = {"shared": False, "link_std_statically": True}
    generators = "cmake"
    exports_sources = "../../*"


    def build(self):
        cmake = CMake(self)
        if (self.options.shared):
            self.output.info("Building shared lib.")
            cmake.definitions["BUILD_SHARED_LIBS"] = 1
        else:
            self.output.info("Building static lib.")
        if (self.options.link_std_statically):
            cmake.definitions["LINK_STD_STATICALLY"] = 1

        cmake.configure(build_dir="./build", source_dir="../projects/cmake")
        cmake.build()

    def package(self):
        os.chdir(os.path.dirname(__file__))
        print(os.getcwd())
        self.copy("include/angelscript.h", dst="include", keep_path=False)
        self.copy("*.dll", dst="bin", keep_path=False)
        self.copy("*.so", 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):
        self.cpp_info.libs = ["angelscript"]