Skip to content
Snippets Groups Projects
conanfile.py 1.94 KiB
Newer Older
bodzsoaa's avatar
bodzsoaa committed
from conans import ConanFile, CMake


class LibmuebConan(ConanFile):
    name = "libmueb"
    version = "4.0"
    description = "Schönherz Mátrix network library written in C++ using Qt"
bodzsoaa's avatar
bodzsoaa committed
    url = "https://git.sch.bme.hu/kszk/schmatrix/libmueb"
bodzsoaa's avatar
bodzsoaa committed
    license = "LGPL-3.0-or-later"
    author = "Zsombor Bodnár (bodzsoaa@sch.bme.hu)"
bodzsoaa's avatar
bodzsoaa committed
    topics = ("C++", "Qt 5", "Schönherz Mátrix")
bodzsoaa's avatar
bodzsoaa committed
    settings = "os", "compiler", "build_type", "arch"
bodzsoaa's avatar
bodzsoaa committed
    options = {"shared": [True, False], "fPIC": [True, False],
               "websocket": [True, False], "tests": [True, False]}
    default_options = {"shared": True, "*:shared": True, "fPIC": True, "websocket": False, "tests": False}
bodzsoaa's avatar
bodzsoaa committed
    requires = "qt/[^5.15.2]"
bodzsoaa's avatar
bodzsoaa committed
    build_requires = "cmake/[^3.17.0]", "ninja/1.10.2"
bodzsoaa's avatar
bodzsoaa committed
    generators = "cmake_find_package", "cmake_paths"
bodzsoaa's avatar
bodzsoaa committed
    exports_sources = "CMakeLists.txt", "!CMakeLists.txt.user", "include/*", "src/*", "websocket/*", "tests/*"
bodzsoaa's avatar
bodzsoaa committed

    def configure(self):
        if self.settings.compiler == "Visual Studio":
            del self.settings.compiler.runtime

bodzsoaa's avatar
bodzsoaa committed
        if self.options.websocket:
            self.options["qt"].qtwebsockets = True

bodzsoaa's avatar
bodzsoaa committed
    def config_options(self):
        if self.settings.os == "Windows":
            del self.options.fPIC

    def build(self):
bodzsoaa's avatar
bodzsoaa committed
        cmake = CMake(self, "Ninja")
        if self.options.websocket:
            cmake.definitions["ENABLE_WEBSOCKET"] = "TRUE"

        if self.options.tests:
            cmake.definitions["ENABLE_TESTS"] = "TRUE"

bodzsoaa's avatar
bodzsoaa committed
        cmake.configure()
        cmake.build()

    def package(self):
        self.copy("*.h", dst="include", src="include")
        self.copy("*.lib", dst="lib", keep_path=False)
        self.copy("*.dll", dst="bin", keep_path=False)
        self.copy("*.dylib*", dst="lib", keep_path=False)
        self.copy("*.so", dst="lib", keep_path=False)
        self.copy("*.a", dst="lib", keep_path=False)

    def package_info(self):
bodzsoaa's avatar
bodzsoaa committed
        self.cpp_info.libs = ["muebreceiver", "muebtransmitter", "mueb"]