-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
133 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
sources: | ||
"2.5.1": | ||
url: "https://github.com/dbus-cxx/dbus-cxx/archive/refs/tags/2.5.1.tar.gz" | ||
sha256: "848467b14db37710ac3ad31cc6474b2d65b9b24e6cdcbb7e88c7637c0ad7b388" | ||
"2.4.0": | ||
url: "https://github.com/dbus-cxx/dbus-cxx/archive/refs/tags/2.4.0.tar.gz" | ||
sha256: "c38456ed70023d93e6e689087e4bbe030f1650bbda9de7c035d6f4ebac788379" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
from conan import ConanFile | ||
from conan.errors import ConanInvalidConfiguration | ||
from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain | ||
from conan.tools.scm import Version | ||
import conan.tools.files | ||
|
||
class DbusCXX(ConanFile): | ||
name = "dbus-cxx" | ||
license = "LGPL-3.0-only, BSD-3-Clause" | ||
url = "https://github.com/dbus-cxx/dbus-cxx" | ||
homepage = "http://dbus-cxx.github.io" | ||
description = "DBus-cxx provides an object-oriented interface to DBus" | ||
topics = "bus", "interprocess", "message" | ||
package_type = "static-library" | ||
settings = "os", "compiler", "build_type", "arch" | ||
|
||
options = { | ||
"fPIC": [True, False], | ||
"glib_support": [True, False], | ||
"qt_support": [True, False], | ||
"uv_support": [True, False], | ||
} | ||
|
||
# Default to a relocatable static library with only the default | ||
# standalone dispatcher | ||
default_options = { | ||
"fPIC": True, | ||
"glib_support": False, | ||
"qt_support": False, | ||
"uv_support": False, | ||
} | ||
|
||
def config_options(self): | ||
if self.settings.os == "Windows": | ||
del self.options.fPIC | ||
|
||
def validate(self): | ||
if self.options.uv_support and Version(self.version) < "2.5.0": | ||
raise ConanInvalidConfiguration("UV support requires verion >= 2.5.0") | ||
|
||
def requirements(self): | ||
self.requires("libsigcpp/[^3.0.7]", transitive_headers=True) | ||
self.requires("expat/[^2.5.0]") | ||
|
||
if self.options.uv_support: | ||
self.requires("libuv/[>=1.0 <2.0]") | ||
|
||
def source(self): | ||
conan.tools.files.get(self, **self.conan_data["sources"][self.version], strip_root=True) | ||
|
||
def layout(self): | ||
cmake_layout(self, src_folder="src") | ||
|
||
generators = "PkgConfigDeps" | ||
|
||
def generate(self): | ||
tc = CMakeToolchain(self) | ||
tc.cache_variables["ENABLE_GLIB_SUPPORT"] = self.options.glib_support | ||
tc.cache_variables["ENABLE_QT_SUPPORT"] = self.options.qt_support | ||
if Version(self.version) >= "2.5.0": | ||
tc.cache_variables["ENABLE_UV_SUPPORT"] = self.options.uv_support | ||
tc.generate() | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def package(self): | ||
cmake = CMake(self) | ||
cmake.install() | ||
|
||
def package_info(self): | ||
if self.options.glib_support: | ||
self.cpp_info.libs.append("dbus-cxx-glib") | ||
if self.options.qt_support: | ||
self.cpp_info.libs.append("dbus-cxx-qt") | ||
if self.options.uv_support: | ||
self.cpp_info.libs.append("dbus-cxx-uv") | ||
|
||
self.cpp_info.libs.append("dbus-cxx") | ||
self.cpp_info.includedirs = ['include/dbus-cxx-2.0'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
cmake_minimum_required (VERSION 3.16) | ||
project (dbus_cxx_package_test CXX) | ||
|
||
find_package (dbus-cxx REQUIRED CONFIG) | ||
|
||
add_executable (test test.cpp) | ||
target_link_libraries (test dbus-cxx::dbus-cxx) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import os | ||
|
||
from conan import ConanFile | ||
from conan.tools.cmake import CMake, cmake_layout | ||
from conan.tools.build import can_run | ||
|
||
class DbusCXXTest(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
generators = "CMakeToolchain", "CMakeDeps" | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def test(self): | ||
if can_run(self): | ||
cmd = os.path.join(self.cpp.build.bindir, "test") | ||
self.run(cmd, env="conanrun") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include <dbus-cxx.h> | ||
|
||
int main() | ||
{ | ||
auto connection = DBus::Connection::create( DBus::BusType::SESSION ); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
versions: | ||
"2.4.0": | ||
folder: 2.x.x |