|  | 
|  | 1 | +package("dbus-cxx") | 
|  | 2 | +    set_homepage("https://dbus-cxx.github.io/") | 
|  | 3 | +    set_description("DBus-cxx provides an object-oriented interface to DBus") | 
|  | 4 | +    set_license("LGPL-3.0-or-later AND BSD-3-Clause") | 
|  | 5 | + | 
|  | 6 | +    add_urls("https://github.com/dbus-cxx/dbus-cxx/archive/refs/tags/$(version).tar.gz", | 
|  | 7 | +             "https://github.com/dbus-cxx/dbus-cxx.git") | 
|  | 8 | + | 
|  | 9 | +    add_versions("2.6.0", "ca22380ec04a1f10154fca76d41e8ce4a8a6351ce86546b297bda5f7eefbc108") | 
|  | 10 | + | 
|  | 11 | +    add_configs("shared", {description = "Build shared library.", default = true, type = "boolean", readonly = true}) | 
|  | 12 | +    add_configs("glib", {description = "Build dbus-cxx with GLib module.", default = true, type = "boolean"}) | 
|  | 13 | +    add_configs("libuv", {description = "Build dbus-cxx with libuv module.", default = true, type = "boolean"}) | 
|  | 14 | +    add_configs("qt5", {description = "Build dbus-cxx with QT5 module.", default = true, type = "boolean"}) | 
|  | 15 | + | 
|  | 16 | +    add_includedirs("include", "include/dbus-cxx-2.0") | 
|  | 17 | + | 
|  | 18 | +    add_deps("cmake") | 
|  | 19 | +    add_deps("libsigcplusplus") | 
|  | 20 | + | 
|  | 21 | +    on_load(function (package) | 
|  | 22 | +        if package:is_plat("linux") and package:is_arch("arm64") and package:config("qt5") then | 
|  | 23 | +            package:config_set("qt5", false) | 
|  | 24 | +            wprint("Disabling qt5, since Linux arm64 AQT does not support QT5, but supports QT6 (6.7.0 -> 6.10.0).") | 
|  | 25 | +        end | 
|  | 26 | +        if package:config("glib") then | 
|  | 27 | +            package:add("deps", "glib") | 
|  | 28 | +            package:add("includedirs", "include/dbus-cxx-glib-2.0") | 
|  | 29 | +        end | 
|  | 30 | +        if package:config("libuv") then | 
|  | 31 | +            package:add("deps", "libuv") | 
|  | 32 | +            package:add("includedirs", "include/dbus-cxx-uv-2.0") | 
|  | 33 | +        end | 
|  | 34 | +        if package:config("qt5") then | 
|  | 35 | +            package:add("deps", "qt5core") | 
|  | 36 | +            package:add("includedirs", "include/dbus-cxx-qt-2.0") | 
|  | 37 | +        end | 
|  | 38 | +    end) | 
|  | 39 | + | 
|  | 40 | +    on_install("linux", function (package) | 
|  | 41 | +        local configs = { | 
|  | 42 | +            "-DBUILD_TESTING=OFF", "-DENABLE_CODE_COVERAGE_REPORT=OFF", | 
|  | 43 | +            "-DENABLE_EXAMPLES=OFF", "-DENABLE_TOOLS=OFF", "-DBUILD_SITE=OFF", "-DUV_STATIC=OFF" | 
|  | 44 | +        } | 
|  | 45 | +        table.insert(configs, "-DENABLE_GLIB_SUPPORT=" .. (package:config("glib") and "ON" or "OFF")) | 
|  | 46 | +        table.insert(configs, "-DENABLE_UV_SUPPORT=" .. (package:config("libuv") and "ON" or "OFF")) | 
|  | 47 | +        table.insert(configs, "-DENABLE_QT_SUPPORT=" .. (package:config("qt5") and "ON" or "OFF")) | 
|  | 48 | +        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release")) | 
|  | 49 | +        table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) | 
|  | 50 | +        import("package.tools.cmake").install(package, configs) | 
|  | 51 | +    end) | 
|  | 52 | + | 
|  | 53 | +    on_test(function (package) | 
|  | 54 | +        assert(package:check_cxxsnippets({test = [[ | 
|  | 55 | +            #include <dbus-cxx.h> | 
|  | 56 | +            void test() { | 
|  | 57 | +                auto connection = DBus::Connection::create(DBus::BusType::SESSION); | 
|  | 58 | +            } | 
|  | 59 | +        ]]}, {configs = {languages = "c++17"}})) | 
|  | 60 | +    end) | 
0 commit comments