Skip to content

Commit ed7aef0

Browse files
authored
libde265: Add cmake 4 support and revisions cleanup (#28417)
* Add cmake 4 support * Remove old unused versions * Ready for next verison
1 parent caf1d41 commit ed7aef0

File tree

5 files changed

+8
-82
lines changed

5 files changed

+8
-82
lines changed

recipes/libde265/all/conandata.yml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,3 @@ sources:
55
"1.0.12":
66
url: "https://github.com/strukturag/libde265/releases/download/v1.0.12/libde265-1.0.12.tar.gz"
77
sha256: "62185ea2182e68cf68bba20cc6eb4c287407b509cf0a827d7ddb75614db77b5c"
8-
"1.0.11":
9-
url: "https://github.com/strukturag/libde265/releases/download/v1.0.11/libde265-1.0.11.tar.gz"
10-
sha256: "2f8f12cabbdb15e53532b7c1eb964d4e15d444db1be802505e6ac97a25035bab"
11-
"1.0.9":
12-
url: "https://github.com/strukturag/libde265/releases/download/v1.0.9/libde265-1.0.9.tar.gz"
13-
sha256: "29bc6b64bf658d81a4446a3f98e0e4636fd4fd3d971b072d440cef987d5439de"
14-
"1.0.8":
15-
url: "https://github.com/strukturag/libde265/releases/download/v1.0.8/libde265-1.0.8.tar.gz"
16-
sha256: "24c791dd334fa521762320ff54f0febfd3c09fc978880a8c5fbc40a88f21d905"
17-
patches:
18-
"1.0.9":
19-
- patch_file: "patches/0002-fix-out-of-source-build.patch"
20-
"1.0.8":
21-
- patch_file: "patches/0001-optional-sdl.patch"
22-
- patch_file: "patches/0002-fix-out-of-source-build.patch"

recipes/libde265/all/conanfile.py

Lines changed: 8 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
from conan import ConanFile
22
from conan.tools.build import check_min_cppstd, stdcpp_library
33
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
4-
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir, save
4+
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir
55
from conan.tools.scm import Version
66
import os
7-
import textwrap
87

9-
required_conan_version = ">=1.54.0"
8+
required_conan_version = ">=2"
109

1110

1211
class Libde265Conan(ConanFile):
@@ -46,17 +45,19 @@ def layout(self):
4645
cmake_layout(self, src_folder="src")
4746

4847
def validate(self):
49-
if self.settings.compiler.get_safe("cppstd"):
50-
check_min_cppstd(self, 11)
48+
check_min_cppstd(self, 11)
5149

5250
def source(self):
5351
get(self, **self.conan_data["sources"][self.version], strip_root=True)
52+
self._patch_sources()
5453

5554
def generate(self):
5655
tc = CMakeToolchain(self)
5756
tc.variables["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True)
5857
tc.variables["ENABLE_SDL"] = False
5958
tc.variables["DISABLE_SSE"] = not self.options.get_safe("sse", False)
59+
if Version(self.version) < "1.0.16":
60+
tc.cache_variables["CMAKE_POLICY_VERSION_MINIMUM"] = "3.5" # CMake 4 support
6061
tc.generate()
6162

6263
def _patch_sources(self):
@@ -65,7 +66,6 @@ def _patch_sources(self):
6566
"set(CMAKE_POSITION_INDEPENDENT_CODE ON)", "")
6667

6768
def build(self):
68-
self._patch_sources()
6969
cmake = CMake(self)
7070
cmake.configure()
7171
cmake.build()
@@ -77,37 +77,12 @@ def package(self):
7777
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
7878
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
7979

80-
# TODO: to remove in conan v2 once legacy generators removed
81-
self._create_cmake_module_alias_targets(
82-
os.path.join(self.package_folder, self._module_file_rel_path),
83-
{
84-
"de265": "libde265::libde265",
85-
"libde265": "libde265::libde265",
86-
}
87-
)
88-
89-
def _create_cmake_module_alias_targets(self, module_file, targets):
90-
content = ""
91-
for alias, aliased in targets.items():
92-
content += textwrap.dedent(f"""\
93-
if(TARGET {aliased} AND NOT TARGET {alias})
94-
add_library({alias} INTERFACE IMPORTED)
95-
set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased})
96-
endif()
97-
""")
98-
save(self, module_file, content)
99-
100-
@property
101-
def _module_file_rel_path(self):
102-
return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake")
103-
10480
def package_info(self):
10581
self.cpp_info.set_property("cmake_file_name", "libde265")
10682
self.cpp_info.set_property("cmake_target_name", "de265")
107-
self.cpp_info.set_property("cmake_target_aliases", ["libde265"]) # official imported target before 1.0.10
83+
self.cpp_info.set_property("cmake_target_aliases", ["libde265"]) # official imported target before 1.0.10
10884
self.cpp_info.set_property("pkg_config_name", "libde265")
109-
version = Version(self.version)
110-
prefix = "lib" if (version < "1.0.10" or (version > "1.0.11" and self.settings.os == "Windows" and not self.options.shared)) else ""
85+
prefix = "lib" if self.settings.os == "Windows" and not self.options.shared else ""
11186
self.cpp_info.libs = [f"{prefix}de265"]
11287
if not self.options.shared:
11388
self.cpp_info.defines = ["LIBDE265_STATIC_BUILD"]
@@ -117,8 +92,3 @@ def package_info(self):
11792
libcxx = stdcpp_library(self)
11893
if libcxx:
11994
self.cpp_info.system_libs.append(libcxx)
120-
121-
# TODO: to remove in conan v2 once legacy generators removed
122-
self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path]
123-
self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path]
124-
self.env_info.PATH.append(os.path.join(self.package_folder, "bin"))

recipes/libde265/all/patches/0001-optional-sdl.patch

Lines changed: 0 additions & 13 deletions
This file was deleted.

recipes/libde265/all/patches/0002-fix-out-of-source-build.patch

Lines changed: 0 additions & 10 deletions
This file was deleted.

recipes/libde265/config.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,3 @@ versions:
33
folder: all
44
"1.0.12":
55
folder: all
6-
"1.0.11":
7-
folder: all
8-
"1.0.9":
9-
folder: all
10-
"1.0.8":
11-
folder: all

0 commit comments

Comments
 (0)