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")