Skip to content

Commit

Permalink
customize dbus-cxx recipe for NI
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikHons committed Jul 26, 2024
1 parent fb11b38 commit 4324da1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ni_upload_to_jfrog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
- run: conan export recipes/ninja/all --version 1.11.1
- run: conan export recipes/nlohmann_json/all --version 3.11.3
- run: conan export recipes/spdlog/all --version 1.14.1
- run: conan export recipes/dbus-cxx/2.x.x --version 2.4.0
# upload everthing
- run: conan upload -r rnd-conan-ci -c "*"

7 changes: 2 additions & 5 deletions recipes/dbus-cxx/2.x.x/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
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"
url: "https://github.com/ni/dbus-cxx"
sha: "b25fe20ab60e27c954f6e1217a007fbb9e612b29"
24 changes: 16 additions & 8 deletions recipes/dbus-cxx/2.x.x/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain
from conan.tools.scm import Version
from conan.tools.scm import Git, Version
import conan.tools.files

class DbusCXX(ConanFile):
Expand Down Expand Up @@ -35,8 +35,9 @@ def config_options(self):
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")
# Our branch added libuv support in 2.4.0 so this check must
# be removed
pass

def requirements(self):
self.requires("libsigcpp/[^3.0.7]", transitive_headers=True)
Expand All @@ -46,19 +47,24 @@ def requirements(self):
self.requires("libuv/[>=1.0 <2.0]")

def source(self):
conan.tools.files.get(self, **self.conan_data["sources"][self.version], strip_root=True)
git = Git(self)
git.clone(url=self.conan_data["sources"][self.version]["url"], target=".")
git.checkout(commit=self.conan_data["sources"][self.version]["sha"])

def layout(self):
cmake_layout(self)

generators = "PkgConfigDeps"
# Our branch changed to find_package(). We should change back
# and drop this customization
generators = "CMakeDeps"

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
# Our branch add libuv support in 2.4.0 so this cmake variable
# must be created
tc.cache_variables["ENABLE_UV_SUPPORT"] = self.options.uv_support
tc.generate()

def build(self):
Expand All @@ -79,4 +85,6 @@ def package_info(self):
self.cpp_info.libs.append("dbus-cxx-uv")

self.cpp_info.libs.append("dbus-cxx")
self.cpp_info.includedirs = ['include/dbus-cxx-2.0']

# Our branch drops the versioned include path. We should
# restore that and drop this customization

0 comments on commit 4324da1

Please sign in to comment.