Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Add Conan package #276

Open
redradist opened this issue Nov 29, 2023 · 2 comments
Open

[Feature Request] Add Conan package #276

redradist opened this issue Nov 29, 2023 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@redradist
Copy link

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

@hassandraga
Copy link
Member

Good idea 👍

@hassandraga
Copy link
Member

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 hassandraga added the help wanted Extra attention is needed label Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants