webui icon indicating copy to clipboard operation
webui copied to clipboard

[Feature Request] Add Conan package

Open redradist opened this issue 1 year ago • 2 comments

It would be much easier to use conan in C/C++ environment through package

redradist avatar Nov 29 '23 10:11 redradist

Good idea 👍

hassandraga avatar Nov 29 '23 15:11 hassandraga

I started the package using Conan v1 and I'm not sure if I should migrate to v2... also seems that bintray is now jfrog... I will back to this later then.

conanfile.py

from conans import ConanFile, AutoToolsBuildEnvironment
from conans import tools

class WebuiConan(ConanFile):
    name = "webui"
    version = "2.4.2"
    license = "MIT License"
    url = "<https://github.com/webui-dev/webui, https://github.com/webui-dev/webui/issues>"
    description = "<Use any web browser as GUI, with your preferred language in the backend and HTML5 in the frontend, all in a lightweight portable lib.>"
    settings = "os", "compiler", "build_type", "arch"
    exports_sources = "src/*", "include/*", "bridge/webui_bridge.h", "Makefile", "GNUmakefile"
    generators = "make"

    def build(self):
        autotools = AutoToolsBuildEnvironment(self)
        if self.settings.os == "Windows":
            # `nmake` or `mingw32-make` on Windows
            if self.settings.compiler == "gcc":
                autotools.make(args=["-f", "Makefile"], make_program="mingw32-make")
            elif self.settings.compiler == "Visual Studio":
                autotools.make(args=["-f", "Makefile"], make_program="nmake")
        else:
            # Default to 'make' on Linux and macOS
            autotools.make(args=["-f", "Makefile"])

    def package(self):
        self.copy("*.h", dst="include", src="include")
        self.copy("webui_bridge.h", dst="bridge", src="bridge")
        self.copy("*webui-2*.dll", dst="bin", keep_path=False)
        self.copy("*webui-2*.so", dst="bin", keep_path=False)
        self.copy("*webui-2*.dynlib", dst="bin", keep_path=False)
        self.copy("*webui-2-static.lib", dst="lib", keep_path=False)
        self.copy("*libwebui-2-static.a", dst="lib", keep_path=False)

    def package_info(self):
        self.cpp_info.libs = tools.collect_libs(self)

hassandraga avatar Nov 30 '23 17:11 hassandraga