aboutsummaryrefslogtreecommitdiff
path: root/conanfile.py
blob: 262fd55d61d9b5f74411f2b91790127931ccf924 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import os

from conan import ConanFile
from conan.tools.build import check_min_cppstd
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout


class Wanda(ConanFile):
    name = "wanda"
    version = "2.0.0"
    url = "https://github.com/fmorgner/wanda"
    license = "BSD 3-clause"
    description = "A simple wallpaper changer for Linux desktops"
    test_requires = ("catch2/[>=3.4]",)
    tool_requires = (
        "cmake/[>=3.27]",
        "ninja/[>=1.12]",
    )
    options = {
        "shared": [True, False],
    }
    default_options = {
        "shared": False,
        "boost/*:asio_no_deprecated": True,
        "boost/*:header_only": True,
        "boost/*:system_no_deprecated": True,
        "spdlog/*:header_only": True,
    }
    generators = ("CMakeDeps",)
    settings = (
        "os",
        "arch",
        "compiler",
        "build_type",
    )
    exports_sources = ("source/*",)

    def build(self):
        cmake = CMake(self)
        cmake.configure()
        cmake.build()
        cmake.test(env="CTEST_OUTPUT_ON_FAILURE=1")

    def generate(self):
        toolchain = CMakeToolchain(self)
        toolchain.variables["CMAKE_EXPORT_COMPILE_COMMANDS"] = True
        toolchain.variables["WANDA_DESCRIPTION"] = self.description
        toolchain.variables["WANDA_HOMEPAGE_URL"] = self.url
        toolchain.variables["WANDA_VERSION"] = self.version
        toolchain.generate()

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

    def package(self):
        cmake = CMake(self)
        cmake.install()

    def package_info(self):
        self.cpp_info.libs = ["wanda"]
        self.cpp_info.system_libs = [
            "gio-2.0",
            "glib-2.0",
            "gobject-2.0",
            "magic",
        ]
        self.runenv_info.prepend_path("PATH", os.path.join(self.package_folder, "bin"))

    def requirements(self):
        self.requires("boost/[~1.85]", transitive_headers=True)
        self.requires("libjpeg-turbo/[~3.0]", transitive_libs=True)
        self.requires("libpng/[~1.6]", transitive_libs=True)
        self.requires("lyra/[~1.6]", transitive_libs=True)
        self.requires("spdlog/[~1.14]", transitive_headers=True)

    def validate(self):
        check_min_cppstd(self, "20")