Skip to content

Commit

Permalink
(#24437) ccache: add version 4.10, refactor cmake logic
Browse files Browse the repository at this point in the history
* ccache: add new 4.10, simplify

* ccache test_package: test built reference

* ccache: xxhash, package type

* ccache windows: invalid armv8 before 4.10

* Fixed test. Empty libdirs.

---------

Co-authored-by: Francisco Ramirez de Anton <[email protected]>
  • Loading branch information
jcar87 and franramirez688 authored Jun 25, 2024
1 parent ba588b6 commit 925cc51
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 144 deletions.
59 changes: 3 additions & 56 deletions recipes/ccache/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,10 @@
sources:
"4.10":
url: "https://github.com/ccache/ccache/releases/download/v4.10/ccache-4.10.tar.gz"
sha256: "16972ba62c8499045edc3ae7d7b8a0b419a961567f5ff0f01bf5a44194204775"
"4.9.1":
url: "https://github.com/ccache/ccache/releases/download/v4.9.1/ccache-4.9.1.tar.xz"
sha256: "4c03bc840699127d16c3f0e6112e3f40ce6a230d5873daa78c60a59c7ef59d25"
"4.9":
url: "https://github.com/ccache/ccache/releases/download/v4.9/ccache-4.9.tar.xz"
sha256: "1ebc72324e3ab52af0b562bf54189d108e85eef6478d6304a345a3c2dc4018e0"
"4.8.3":
url: "https://github.com/ccache/ccache/releases/download/v4.8.3/ccache-4.8.3.tar.xz"
sha256: "e47374c810b248cfca3665ee1d86c7c763ffd68d9944bc422d9c1872611f2b11"
"4.8.2":
url: "https://github.com/ccache/ccache/releases/download/v4.8.2/ccache-4.8.2.tar.xz"
sha256: "3d3fb3f888a5b16c4fa7ee5214cca76348afd6130e8443de5f6f2424f2076a49"
"4.8.1":
url: "https://github.com/ccache/ccache/releases/download/v4.8.1/ccache-4.8.1.tar.xz"
sha256: "87959b6819530b3dcaeb39992f585b9fc2c7120302809741378097774919fb6f"
"4.8":
url: "https://github.com/ccache/ccache/releases/download/v4.8/ccache-4.8.tar.xz"
sha256: "b963ee3bf88d7266b8a0565e4ba685d5666357f0a7e364ed98adb0dc1191fcbb"
"4.7.4":
url: "https://github.com/ccache/ccache/releases/download/v4.7.4/ccache-4.7.4.tar.xz"
sha256: "df0c64d15d3efaf0b4f6837dd6b1467e40eeaaa807db25ce79c3a08a46a84e36"
patches:
"4.9.1":
- patch_file: "patches/4.9-cmake-msvc-runtime.patch"
patch_description: "fixup MSVC runtime"
patch_type: "conan"
"4.9":
- patch_file: "patches/4.9-cmake-msvc-runtime.patch"
patch_description: "fixup MSVC runtime"
patch_type: "conan"
"4.8.3":
- patch_file: "patches/4.8-cmake-msvc-runtime.patch"
patch_description: "fixup MSVC runtime"
patch_type: "conan"
"4.8.2":
- patch_file: "patches/4.8-cmake-msvc-runtime.patch"
patch_description: "fixup MSVC runtime"
patch_type: "conan"
"4.8.1":
- patch_file: "patches/4.8-cmake-msvc-runtime.patch"
patch_description: "fixup MSVC runtime"
patch_type: "conan"
- patch_file: "patches/4.7.4-use-intrinsics-if-msbuild.patch"
patch_description: "fix build issue when using Visual Studio generator"
patch_type: "backport"
patch_source: "https://github.com/ccache/ccache/commit/350787245e7e894c8a472b176545f59a10e9dadb"
"4.8":
- patch_file: "patches/4.8-cmake-msvc-runtime.patch"
patch_description: "fixup MSVC runtime"
patch_type: "conan"
- patch_file: "patches/4.7.4-use-intrinsics-if-msbuild.patch"
patch_description: "fix build issue when using Visual Studio generator"
patch_type: "backport"
patch_source: "https://github.com/ccache/ccache/commit/350787245e7e894c8a472b176545f59a10e9dadb"
"4.7.4":
- patch_file: "patches/4.7.4-cmake-msvc-runtime.patch"
patch_description: "fixup MSVC runtime"
patch_type: "conan"
- patch_file: "patches/4.7.4-use-intrinsics-if-msbuild.patch"
patch_description: "fix build issue when using Visual Studio generator"
patch_type: "backport"
patch_source: "https://github.com/ccache/ccache/commit/350787245e7e894c8a472b176545f59a10e9dadb"
38 changes: 27 additions & 11 deletions recipes/ccache/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from conan import ConanFile
from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain, CMakeDeps
from conan.errors import ConanInvalidConfiguration
from conan.tools.files import copy, get, apply_conandata_patches, export_conandata_patches
from conan.tools.files import copy, get
from conan.tools.build import check_min_cppstd
from conan.tools.scm import Version
from conan.tools.microsoft import check_min_vs, is_msvc
Expand All @@ -12,6 +12,7 @@

class CcacheConan(ConanFile):
name = "ccache"
package_type = "application"
description = (
"Ccache (or “ccache”) is a compiler cache. It speeds up recompilation "
"by caching previous compilations and detecting when the same "
Expand Down Expand Up @@ -41,9 +42,6 @@ def _compilers_minimum_version(self):
"apple-clang": "11",
}

def export_sources(self):
export_conandata_patches(self)

def layout(self):
cmake_layout(self, src_folder="src")

Expand All @@ -52,6 +50,10 @@ def requirements(self):
if self.options.redis_storage_backend:
self.requires("hiredis/1.1.0")

if Version(self.version) >= "4.10":
self.requires("fmt/10.2.1")
self.requires("xxhash/[~0.8]")

def validate(self):
if self.settings.compiler.cppstd:
check_min_cppstd(self, self._min_cppstd)
Expand All @@ -66,12 +68,15 @@ def validate(self):
self.settings.compiler.libcxx == "libstdc++":
raise ConanInvalidConfiguration(f"{self.ref} requires C++ filesystem library, that is not supported by Clang 11 + libstdc++.")

if self.settings.os == "Windows" and self.settings.arch == "armv8" and Version(self.version) < "4.10":
raise ConanInvalidConfiguration("ccache does not support ARMv8 on Windows before version 4.10")

def build_requirements(self):
self.tool_requires("cmake/[>=3.15 <4]")

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

def generate(self):
tc = CMakeToolchain(self)
Expand All @@ -80,17 +85,26 @@ def generate(self):
tc.variables["ZSTD_FROM_INTERNET"] = False
tc.variables["ENABLE_DOCUMENTATION"] = False
tc.variables["ENABLE_TESTING"] = False
tc.variables["STATIC_LINK"] = False # Don't link static runtimes and let Conan handle it
tc.generate()

deps = CMakeDeps(self)
deps.set_property("hiredis", "cmake_target_name", "HIREDIS::HIREDIS")
deps.set_property("hiredis", "cmake_find_mode", "module")
deps.set_property("zstd", "cmake_target_name", "ZSTD::ZSTD")
if Version(self.version) >= "4.10":
deps.set_property("fmt", "cmake_file_name", "Fmt")
deps.set_property("fmt", "cmake_find_mode", "module")
deps.set_property("fmt", "cmake_target_name", "dep_fmt")
deps.set_property("zstd", "cmake_file_name", "Zstd")
deps.set_property("zstd", "cmake_target_name", "dep_zstd")
deps.set_property("hiredis", "cmake_file_name", "Hiredis")
deps.set_property("hiredis", "cmake_target_name", "dep_hiredis")
else:
deps.set_property("hiredis", "cmake_target_name", "HIREDIS::HIREDIS")
deps.set_property("zstd", "cmake_target_name", "ZSTD::ZSTD")
deps.set_property("zstd", "cmake_find_mode", "module")
deps.set_property("hiredis", "cmake_find_mode", "module")
deps.generate()

def build(self):
apply_conandata_patches(self)
cmake = CMake(self)
cmake.configure()
cmake.build()
Expand All @@ -101,7 +115,9 @@ def package(self):
cmake.install()

def package_info(self):
self.cpp_info.libdirs = []
self.cpp_info.includedirs = []

bin_path = os.path.join(self.package_folder, "bin")
self.output.info("Appending PATH environment variable: {}".format(bin_path))
self.env_info.PATH.append(bin_path)
self.cpp_info.includedirs = []
11 changes: 0 additions & 11 deletions recipes/ccache/all/patches/4.7.4-cmake-msvc-runtime.patch

This file was deleted.

34 changes: 0 additions & 34 deletions recipes/ccache/all/patches/4.7.4-use-intrinsics-if-msbuild.patch

This file was deleted.

11 changes: 0 additions & 11 deletions recipes/ccache/all/patches/4.8-cmake-msvc-runtime.patch

This file was deleted.

11 changes: 0 additions & 11 deletions recipes/ccache/all/patches/4.9-cmake-msvc-runtime.patch

This file was deleted.

12 changes: 2 additions & 10 deletions recipes/ccache/config.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
versions:
"4.9.1":
"4.10":
folder: all
"4.9":
"4.9.1":
folder: all
"4.8.3":
folder: all
"4.8.2":
folder: all
"4.8.1":
folder: all
"4.8":
folder: all
"4.7.4":
folder: all

0 comments on commit 925cc51

Please sign in to comment.