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

qxmpp: modernize #9363

Merged
merged 3 commits into from
Feb 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion recipes/qxmpp/all/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.4)
project(cmake_wrapper)

include(conanbuildinfo.cmake)
conan_basic_setup(TARGETS)
conan_basic_setup(TARGETS KEEP_RPATHS)

set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)

Expand Down
36 changes: 22 additions & 14 deletions recipes/qxmpp/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from conan.tools.files import rename
from conans import ConanFile, CMake, tools
import functools
import os

required_conan_version = ">=1.33.0"
required_conan_version = ">=1.43.0"


class QxmppConan(ConanFile):
name = "qxmpp"
Expand All @@ -11,6 +13,7 @@ class QxmppConan(ConanFile):
url = "https://github.com/conan-io/conan-center-index"
description = "Cross-platform C++ XMPP client and server library. It is written in C++ and uses Qt framework."
topics = "qt", "qt6", "xmpp", "xmpp-library", "xmpp-server", "xmpp-client"

settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
Expand All @@ -23,18 +26,16 @@ class QxmppConan(ConanFile):
"with_gstreamer": False,
}

exports_sources = ["patches/*", "CMakeLists.txt"]
generators = "cmake", "cmake_find_package_multi"

@property
def _source_subfolder(self):
return "source_subfolder"

def requirements(self):
self.requires("qt/6.1.2")
if self.options.with_gstreamer:
self.requires("gstreamer/1.19.1")
self.requires("glib/2.70.0")
def export_sources(self):
self.copy("CMakeLists.txt")
for patch in self.conan_data.get("patches", {}).get(self.version, []):
self.copy(patch["patch_file"])

def config_options(self):
if self.settings.os == "Windows":
Expand All @@ -44,6 +45,12 @@ def configure(self):
if self.options.shared:
del self.options.fPIC

def requirements(self):
self.requires("qt/6.2.3")
if self.options.with_gstreamer:
self.requires("gstreamer/1.19.2")
self.requires("glib/2.70.1")

def source(self):
tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder)

Expand All @@ -59,7 +66,7 @@ def _configure_cmake(self):
return cmake

def build(self):
for patch in self.conan_data["patches"][self.version]:
for patch in self.conan_data.get("patches", {}).get(self.version, []):
tools.patch(**patch)
cmake = self._configure_cmake()
cmake.build()
Expand All @@ -73,16 +80,17 @@ def package(self):

if self.options.shared and self.settings.os == "Windows":
tools.mkdir(os.path.join(self.package_folder, "bin"))
tools.rename(os.path.join(self.package_folder, "lib", "qxmpp.dll"),
rename(self, os.path.join(self.package_folder, "lib", "qxmpp.dll"),
os.path.join(self.package_folder, "bin", "qxmpp.dll"))

def package_info(self):
self.cpp_info.set_property("cmake_file_name", "QXmpp")
self.cpp_info.set_property("cmake_target_name", "QXmpp::QXmpp")
self.cpp_info.set_property("pkg_config_name", "qxmpp")
self.cpp_info.libs = ["qxmpp"]
self.cpp_info.includedirs.append(os.path.join("include", "qxmpp"))
self.cpp_info.filenames["cmake_find_package"] = "QXmpp"
self.cpp_info.filenames["cmake_find_package_multi"] = "QXmpp"
self.cpp_info.names["cmake_find_package"] = "QXmpp"
self.cpp_info.names["cmake_find_package_multi"] = "QXmpp"
self.cpp_info.names["pkg_config"] = "qxmpp"
self.cpp_info.requires = ["qt::qtCore", "qt::qtNetwork", "qt::qtXml"]

# TODO: to remove in conan v2 once cmake_find_package* generators removed
self.cpp_info.names["cmake_find_package"] = "QXmpp"
self.cpp_info.names["cmake_find_package_multi"] = "QXmpp"