From 45c8a378ea8d9d3bb4920aa93185afc072bbc025 Mon Sep 17 00:00:00 2001 From: Craig Edwards Date: Wed, 23 Oct 2024 22:18:11 +0000 Subject: [PATCH] feat: conan the librarian --- CMakeLists.txt | 1 + conanfile.py | 19 ++++++++----------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5be0c19a30..18b54f5d15 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,7 @@ option(DPP_INSTALL "Generate the install target" ON) option(DPP_BUILD_TEST "Build the test program" ON) option(DPP_NO_VCPKG "No VCPKG" OFF) option(DPP_NO_CONAN "No Conan" OFF) +option(CONAN_EXPORTED "Exported via Conan - DO NOT SET MANUALLY" OFF) option(DPP_CORO "Support for C++20 coroutines" OFF) option(DPP_FORMATTERS "Support for C++20 formatters" OFF) option(DPP_USE_EXTERNAL_JSON "Use an external installation of nlohmann::json" OFF) diff --git a/conanfile.py b/conanfile.py index f14d40628d..6137c2dd0c 100644 --- a/conanfile.py +++ b/conanfile.py @@ -1,8 +1,9 @@ import os +import shutil from conan import ConanFile from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps from conan.tools.scm import Git -from conan.tools.files import update_conandata +from conan.tools.files import update_conandata, download, unzip class DPPConan(ConanFile): name = "dpp" @@ -15,7 +16,7 @@ class DPPConan(ConanFile): topics = ("discord") settings = "os", "compiler", "build_type", "arch" options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} + default_options = {"shared": True, "fPIC": True} def requirements(self): self.requires("nlohmann_json/3.11.2") @@ -34,16 +35,12 @@ def configure(self): def layout(self): cmake_layout(self) - def export(self): - git = Git(self, os.path.dirname(self.recipe_folder)) - scm_url, scm_commit = git.get_url_and_commit() - update_conandata(self, {"sources": {"commit": scm_commit, "url": scm_url}}) - def source(self): - git = Git(self) - sources = self.conan_data["sources"] - git.clone(url=sources["url"], target=".") - git.checkout(commit=sources["commit"]) + zip_name = f"DPP.zip" + download(self, f"https://github.com/brainboxdotcc/DPP/archive/refs/tags/v{self.version}.zip", zip_name) + unzip(self, zip_name, '.', False, None, True) + # shutil.move(f"DPP-{self.version}", f"DPP-{self.version}/../") + os.unlink(zip_name) def generate(self): deps = CMakeDeps(self)