Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

matplotlib-cpp/cci.20210111 #4212

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions recipes/matplotlib-cpp/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
cci.20210601:
url: https://github.com/lava/matplotlib-cpp/archive/ef0383f1315d32e0156335e10b82e90b334f6d9f.zip
sha256: d061c56d53cc2355e1543198a3899a361495f5c8a72b938204a5307614ca883f
39 changes: 39 additions & 0 deletions recipes/matplotlib-cpp/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
from conans import ConanFile, tools
import os
import glob


class MatplotlibCppConan(ConanFile):
name = "matplotlib-cpp"
description = "Extremely simple yet powerful header-only C++ plotting library built on the popular matplotlib."
topics = ("conan", "matplotlib", "matplotlib-cpp")
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/lava/matplotlib-cpp"
license = "MIT"
no_copy_source = True

options = {"with_numpy": [True, False]}
default_options = {"with_numpy": False}

@property
def _source_subfolder(self):
return "source_subfolder"

def source(self):
tools.get(**self.conan_data["sources"][self.version])
extracted_dir = glob.glob("matplotlib-cpp-*/")[0]
os.rename(extracted_dir, self._source_subfolder)

def package(self):
self.copy(pattern="LICENSE", src=self._source_subfolder, dst="licenses")
self.copy(pattern="matplotlibcpp.h", src=self._source_subfolder, dst="include")

def package_id(self):
self.info.header_only()

def package_info(self):
self.cpp_info.names["cmake_find_package"] = "matplotlib-cpp"
self.cpp_info.names["cmake_find_package_multi"] = "matplotlib-cpp"

if not self.options.with_numpy:
self.cpp_info.defines = ["WITHOUT_NUMPY"]
13 changes: 13 additions & 0 deletions recipes/matplotlib-cpp/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cmake_minimum_required(VERSION 3.10)
project(test_package)

set(CMAKE_CXX_STANDARD 11)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

find_package(matplotlib-cpp REQUIRED)
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)

add_executable(test_package test_package.cpp)
target_link_libraries(test_package PRIVATE matplotlib-cpp::matplotlib-cpp Python3::Python)
33 changes: 33 additions & 0 deletions recipes/matplotlib-cpp/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from conans import ConanFile, CMake, tools
import os


def import_numpy():
try:
import numpy
except ImportError:
import pip

if hasattr(pip, "main"):
pip.main(["install", "numpy"])
else:
pip._internal.main(["install", "numpy"])

import numpy


class TestPackageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake", "cmake_find_package"

def build(self):
import_numpy()

cmake = CMake(self)
cmake.configure()
cmake.build()

def test(self):
if not tools.cross_building(self.settings):
bin_path = os.path.join("bin", "test_package")
self.run(bin_path, run_environment=True)
6 changes: 6 additions & 0 deletions recipes/matplotlib-cpp/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <matplotlibcpp.h>

int main()
{
matplotlibcpp::plot({1, 3, 2, 4});
}
3 changes: 3 additions & 0 deletions recipes/matplotlib-cpp/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
cci.20210601:
folder: "all"