Skip to content

Commit

Permalink
qt-advanced-docking-system: Modernize to Conan V2 and add new versions
Browse files Browse the repository at this point in the history
  • Loading branch information
leha-bot committed Apr 17, 2024
1 parent b938d85 commit 3c63d1e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 24 deletions.
6 changes: 6 additions & 0 deletions recipes/qt-advanced-docking-system/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
sources:
"4.1.1":
url: "https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/archive/refs/tags/4.1.1.tar.gz"
sha256: "bc029feaa9939e1cb639b4e1a085579450be68ca7fb8221f032b0e6499abbc1d"
"3.8.4":
url: "https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/archive/refs/tags/3.8.3.tar.gz"
sha256: "bd5a9469b755bedf33baefd0b3dda6d167b7917a2888e2794eed5abee7d78f74"
"3.8.3":
url: "https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/archive/refs/tags/3.8.3.tar.gz"
sha256: "bd5a9469b755bedf33baefd0b3dda6d167b7917a2888e2794eed5abee7d78f74"
Expand Down
42 changes: 18 additions & 24 deletions recipes/qt-advanced-docking-system/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from conan import ConanFile
from conan.tools.files import copy, get, apply_conandata_patches, export_conandata_patches, replace_in_file, rmdir
from conans import CMake
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
import os

required_conan_version = ">=1.52.0"
Expand All @@ -26,14 +26,12 @@ class QtADS(ConanFile):
"shared": False,
"fPIC": True,
}
generators = "cmake", "cmake_find_package", "cmake_find_package_multi"
generators = "CMakeDeps"

_cmake = None
_qt_version = "5.15.6"
_qt_version = "5.15.10"

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

def export_sources(self):
copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder)
Expand All @@ -52,38 +50,34 @@ def requirements(self):

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

def _configure_cmake(self):
if self._cmake:
return self._cmake

self._cmake = CMake(self)
self._cmake.definitions["ADS_VERSION"] = self.version
self._cmake.definitions["BUILD_EXAMPLES"] = "OFF"
self._cmake.definitions["BUILD_STATIC"] = not self.options.shared

self._cmake.configure()
return self._cmake
destination=self.source_folder)

def _patch_sources(self):
apply_conandata_patches(self)

replace_in_file(self,
f"{self.source_folder}/{self._source_subfolder}/src/ads_globals.cpp",
f"{self.source_folder}/src/ads_globals.cpp",
"#include <qpa/qplatformnativeinterface.h>",
f"#include <{self._qt_version}/QtGui/qpa/qplatformnativeinterface.h>"
)

def generate(self):
tc = CMakeToolchain(self)
tc.cache_variables["ADS_VERSION"] = self.version
tc.cache_variables["BUILD_EXAMPLES"] = False
tc.cache_variables["BUILD_STATIC"] = not self.options.shared
tc.generate()

def build(self):
self._patch_sources()
cmake = self._configure_cmake()
cmake = CMake(self)
cmake.configure()
cmake.build()

def package(self):
cmake = self._configure_cmake()
cmake = CMake(self)
cmake.install()
self.copy("LICENSE", dst="licenses", src=self._source_subfolder)
copy(self, "LICENSE", dst="licenses", src=self.source_folder)
rmdir(self, os.path.join(self.package_folder, "license"))
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))

Expand Down
4 changes: 4 additions & 0 deletions recipes/qt-advanced-docking-system/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
versions:
"4.1.1":
folder: "all"
"3.8.4":
folder: "all"
"3.8.3":
folder: "all"
"3.8.2":
Expand Down

0 comments on commit 3c63d1e

Please sign in to comment.