Skip to content

Commit

Permalink
feat: conan the librarian
Browse files Browse the repository at this point in the history
  • Loading branch information
braindigitalis committed Oct 23, 2024
1 parent 18f4f2a commit 45c8a37
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
19 changes: 8 additions & 11 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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")
Expand All @@ -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)
Expand Down

0 comments on commit 45c8a37

Please sign in to comment.