aboutsummaryrefslogtreecommitdiff
path: root/conanfile.py
blob: f03b07fed534236b527211005187d6b83617cf3d (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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
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 = "1.0.0"
    url = "https://github.com/fmorgner/wanda"
    license = "BSD 3-clause"
    description = "A wallpaper changer for the GNOME"
    scm = {
        "type": "git",
        "url": "auto",
        "revision": "auto",
    }
    generators = ("CMakeDeps",)
    options = {"shared": [True, False]}
    default_options = {"shared": False}
    settings = (
        "os",
        "arch",
        "compiler",
        "build_type",
    )
    exports_sources = ("source/*",)
    requires = (
        "asio/[~1.28]",
        "boost/[~1.83]",
        "libjpeg-turbo/[~3.0]",
        "libpng/[~1.6]",
        "lyra/[~1.6]",
        "spdlog/[~1.12]",
    )
    test_requires = ("catch2/[>=3.4]",)
    tool_requires = ("cmake/[>=3.27]",)

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

    def configure(self):
        self.options["boost"].header_only = True
        self.options["fmt"].header_only = True
        self.options["spdlog"].header_only = True

    def generate(self):
        toolchain = CMakeToolchain(self)
        toolchain.variables["CMAKE_EXPORT_COMPILE_COMMANDS"] = True
        toolchain.generate()

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

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

    def package_info(self):
        self.runenv_info.prepend_path("PATH", os.path.join(self.package_folder, "bin"))

        self.cpp_info.components["control"].libs = ["wanda-control"]
        self.cpp_info.components["control"].requires = [
            "meta",
            "proto",
            "std_ext",
            "system",
            # requires
            "asio::asio",
            "spdlog::spdlog",
        ]

        self.cpp_info.components["meta"].libs = []

        self.cpp_info.components["proto"].libs = ["wanda-proto"]
        self.cpp_info.components["proto"].requires = ["fmt::fmt"]

        self.cpp_info.components["std_ext"].libs = []

        self.cpp_info.components["system"].libs = ["wanda-system"]
        self.cpp_info.components["system"].requires = [
            "meta",
            "std_ext",
            # requires
            "boost::boost",
            "fmt::fmt",
            "libjpeg-turbo::jpeg",
            "libpng::libpng",
            "spdlog::spdlog",
        ]

        self.cpp_info.components["wandac"].libs = []
        self.cpp_info.components["wandac"].requires = [
            "control",
            "proto",
            "system",
            # requires
            "asio::asio",
            "lyra::lyra",
            "spdlog::spdlog",
        ]
        self.cpp_info.components["wandac"].bindirs = [
            os.path.join(self.package_folder, "bin")
        ]

        self.cpp_info.components["wandad"].libs = []
        self.cpp_info.components["wandad"].requires = [
            "control",
            "proto",
            "std_ext",
            "system",
            # requires
            "asio::asio",
            "lyra::lyra",
            "spdlog::spdlog",
        ]
        self.cpp_info.components["wandad"].bindirs = [
            os.path.join(self.package_folder, "bin")
        ]

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