1from conans import ConanFile, CMake, tools
2
3class KArchiveConan(ConanFile):
4    name = "KArchive"
5    version = "5.37.0"
6    license = "LGPL-2.1"
7    url = "https://api.kde.org/frameworks/karchive/html/index.html"
8    settings = "os", "compiler", "build_type", "arch"
9
10    # build this as shared library by default, but static builds are an option
11    options = {"shared": [True, False]}
12    default_options = "shared=True"
13    generators = "cmake"
14    exports_sources = "*"
15
16    def build(self):
17        cmake = CMake(self)
18
19        # change the library install dir to just "lib" as that's what Conan expects in its packages
20        args = ['-DCMAKE_INSTALL_PREFIX="%s"' % self.package_folder,
21                '-DKDE_INSTALL_LIBDIR=lib']
22        self.run('cmake %s %s %s' % (self.source_folder, cmake.command_line, " ".join(args)))
23        self.run("cmake --build . --target install %s" % cmake.build_config)
24
25    def package(self):
26        # ideally nothing here, cmake with install takes care of it
27        pass
28
29    def package_info(self):
30        self.cpp_info.libs = ["KF5Archive"]
31        self.cpp_info.includedirs = ['include/KF5', 'include/KF5/KArchive']
32