From 58867c9f5442aefd415a2e68a965c7ff8558c99f Mon Sep 17 00:00:00 2001 From: Florian Berchtold Date: Mon, 11 Jan 2021 09:54:25 +0100 Subject: [PATCH 1/8] matplotlib-cpp/cci.20210111 --- recipes/matplotlib-cpp/all/conandata.yml | 6 ++++ recipes/matplotlib-cpp/all/conanfile.py | 33 +++++++++++++++++++ .../all/test_package/CMakeLists.txt | 13 ++++++++ .../all/test_package/conanfile.py | 17 ++++++++++ .../all/test_package/test_package.cpp | 6 ++++ recipes/matplotlib-cpp/config.yml | 3 ++ 6 files changed, 78 insertions(+) create mode 100644 recipes/matplotlib-cpp/all/conandata.yml create mode 100644 recipes/matplotlib-cpp/all/conanfile.py create mode 100644 recipes/matplotlib-cpp/all/test_package/CMakeLists.txt create mode 100644 recipes/matplotlib-cpp/all/test_package/conanfile.py create mode 100644 recipes/matplotlib-cpp/all/test_package/test_package.cpp create mode 100644 recipes/matplotlib-cpp/config.yml diff --git a/recipes/matplotlib-cpp/all/conandata.yml b/recipes/matplotlib-cpp/all/conandata.yml new file mode 100644 index 0000000000000..fef6467e4b1c1 --- /dev/null +++ b/recipes/matplotlib-cpp/all/conandata.yml @@ -0,0 +1,6 @@ +sources: + cci.20210111: + - url: https://raw.githubusercontent.com/lava/matplotlib-cpp/70d508fcb7febc66535ba923eac1b1a4e571e4d1/matplotlibcpp.h + sha256: 8fbc9e3613cfce3dd76b3c854d9c6ccb1229ec639e34052948f1209939b97a1f + - url: https://raw.githubusercontent.com/lava/matplotlib-cpp/70d508fcb7febc66535ba923eac1b1a4e571e4d1/LICENSE + sha256: d0dc4eae3be039d576e127912d16f78a7ba4e0e6205cd75103efd1a45b89a4ba diff --git a/recipes/matplotlib-cpp/all/conanfile.py b/recipes/matplotlib-cpp/all/conanfile.py new file mode 100644 index 0000000000000..a717f1fb80691 --- /dev/null +++ b/recipes/matplotlib-cpp/all/conanfile.py @@ -0,0 +1,33 @@ +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 + + @property + def _source_subfolder(self): + return "source_subfolder" + + def source(self): + for url_sha in self.conan_data["sources"][self.version]: + tools.download(url_sha["url"], os.path.basename(url_sha["url"])) + tools.check_sha256(os.path.basename(url_sha["url"]), url_sha["sha256"]) + + def package(self): + self.copy(pattern="LICENSE", dst="licenses" ) + self.copy(pattern="matplotlibcpp.h", 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" diff --git a/recipes/matplotlib-cpp/all/test_package/CMakeLists.txt b/recipes/matplotlib-cpp/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..7c235c0606e2f --- /dev/null +++ b/recipes/matplotlib-cpp/all/test_package/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.10) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +find_package(matplotlib-cpp REQUIRED) +find_package(PythonInterp 3 REQUIRED) +find_package(PythonLibs 3 REQUIRED) + +add_executable(test_package test_package.cpp) +target_link_libraries(test_package PRIVATE matplotlib-cpp::matplotlib-cpp ${PYTHON_LIBRARIES}) +target_include_directories(test_package PRIVATE ${PYTHON_INCLUDE_DIRS}) diff --git a/recipes/matplotlib-cpp/all/test_package/conanfile.py b/recipes/matplotlib-cpp/all/test_package/conanfile.py new file mode 100644 index 0000000000000..1d0bdd3779793 --- /dev/null +++ b/recipes/matplotlib-cpp/all/test_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package" + + def build(self): + 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) diff --git a/recipes/matplotlib-cpp/all/test_package/test_package.cpp b/recipes/matplotlib-cpp/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..4cb7c4cadfa56 --- /dev/null +++ b/recipes/matplotlib-cpp/all/test_package/test_package.cpp @@ -0,0 +1,6 @@ +#include + +int main() +{ + matplotlibcpp::plot({1, 3, 2, 4}); +} diff --git a/recipes/matplotlib-cpp/config.yml b/recipes/matplotlib-cpp/config.yml new file mode 100644 index 0000000000000..a1a4e1898e5be --- /dev/null +++ b/recipes/matplotlib-cpp/config.yml @@ -0,0 +1,3 @@ +versions: + cci.20210111: + folder: "all" From 2d890847326e104935f58c0a030d33da7184f3ec Mon Sep 17 00:00:00 2001 From: Florian Berchtold Date: Mon, 11 Jan 2021 11:14:57 +0100 Subject: [PATCH 2/8] older version that runs on c++11 (not c++17) --- recipes/matplotlib-cpp/all/conandata.yml | 8 ++++---- recipes/matplotlib-cpp/all/conanfile.py | 6 +++--- recipes/matplotlib-cpp/all/test_package/CMakeLists.txt | 2 ++ recipes/matplotlib-cpp/config.yml | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/recipes/matplotlib-cpp/all/conandata.yml b/recipes/matplotlib-cpp/all/conandata.yml index fef6467e4b1c1..1cba1e831e248 100644 --- a/recipes/matplotlib-cpp/all/conandata.yml +++ b/recipes/matplotlib-cpp/all/conandata.yml @@ -1,6 +1,6 @@ sources: - cci.20210111: - - url: https://raw.githubusercontent.com/lava/matplotlib-cpp/70d508fcb7febc66535ba923eac1b1a4e571e4d1/matplotlibcpp.h - sha256: 8fbc9e3613cfce3dd76b3c854d9c6ccb1229ec639e34052948f1209939b97a1f - - url: https://raw.githubusercontent.com/lava/matplotlib-cpp/70d508fcb7febc66535ba923eac1b1a4e571e4d1/LICENSE + cci.20200422: + - url: https://raw.githubusercontent.com/lava/matplotlib-cpp/d74105036a82e6ccede3fa1a7d872ac1677b00ab/matplotlibcpp.h + sha256: 913638b1d03ccfe28f58f327a8c1247aec943f88f19c37648fd01e239420fb90 + - url: https://raw.githubusercontent.com/lava/matplotlib-cpp/d74105036a82e6ccede3fa1a7d872ac1677b00ab/LICENSE sha256: d0dc4eae3be039d576e127912d16f78a7ba4e0e6205cd75103efd1a45b89a4ba diff --git a/recipes/matplotlib-cpp/all/conanfile.py b/recipes/matplotlib-cpp/all/conanfile.py index a717f1fb80691..5f77a3b066d0e 100644 --- a/recipes/matplotlib-cpp/all/conanfile.py +++ b/recipes/matplotlib-cpp/all/conanfile.py @@ -21,9 +21,9 @@ def source(self): tools.download(url_sha["url"], os.path.basename(url_sha["url"])) tools.check_sha256(os.path.basename(url_sha["url"]), url_sha["sha256"]) - def package(self): - self.copy(pattern="LICENSE", dst="licenses" ) - self.copy(pattern="matplotlibcpp.h", dst="include" ) + def package(self): + self.copy(pattern="LICENSE", dst="licenses") + self.copy(pattern="matplotlibcpp.h", dst="include") def package_id(self): self.info.header_only() diff --git a/recipes/matplotlib-cpp/all/test_package/CMakeLists.txt b/recipes/matplotlib-cpp/all/test_package/CMakeLists.txt index 7c235c0606e2f..c3b0956d9febe 100644 --- a/recipes/matplotlib-cpp/all/test_package/CMakeLists.txt +++ b/recipes/matplotlib-cpp/all/test_package/CMakeLists.txt @@ -1,6 +1,8 @@ cmake_minimum_required(VERSION 3.10) project(test_package) +set(CMAKE_CXX_STANDARD 11) + include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup() diff --git a/recipes/matplotlib-cpp/config.yml b/recipes/matplotlib-cpp/config.yml index a1a4e1898e5be..2036fe6e1ac09 100644 --- a/recipes/matplotlib-cpp/config.yml +++ b/recipes/matplotlib-cpp/config.yml @@ -1,3 +1,3 @@ versions: - cci.20210111: + cci.20200422: folder: "all" From 9286d1ad4e6d5d60e2eaf8dbb58a212aeed343b0 Mon Sep 17 00:00:00 2001 From: Florian Berchtold Date: Mon, 11 Jan 2021 11:34:51 +0100 Subject: [PATCH 3/8] py2 --- recipes/matplotlib-cpp/all/test_package/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/matplotlib-cpp/all/test_package/CMakeLists.txt b/recipes/matplotlib-cpp/all/test_package/CMakeLists.txt index c3b0956d9febe..356d6580761c5 100644 --- a/recipes/matplotlib-cpp/all/test_package/CMakeLists.txt +++ b/recipes/matplotlib-cpp/all/test_package/CMakeLists.txt @@ -7,8 +7,8 @@ include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup() find_package(matplotlib-cpp REQUIRED) -find_package(PythonInterp 3 REQUIRED) -find_package(PythonLibs 3 REQUIRED) +find_package(PythonInterp REQUIRED) +find_package(PythonLibs REQUIRED) add_executable(test_package test_package.cpp) target_link_libraries(test_package PRIVATE matplotlib-cpp::matplotlib-cpp ${PYTHON_LIBRARIES}) From 664e104a4b5219453c0a6c16a5cb2e61a461e33a Mon Sep 17 00:00:00 2001 From: Florian Berchtold Date: Mon, 11 Jan 2021 11:43:52 +0100 Subject: [PATCH 4/8] possible CCI illegal way to get numpy \.O_O./ --- .../matplotlib-cpp/all/test_package/conanfile.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/recipes/matplotlib-cpp/all/test_package/conanfile.py b/recipes/matplotlib-cpp/all/test_package/conanfile.py index 1d0bdd3779793..9eb1c95d39ce2 100644 --- a/recipes/matplotlib-cpp/all/test_package/conanfile.py +++ b/recipes/matplotlib-cpp/all/test_package/conanfile.py @@ -11,7 +11,21 @@ def build(self): cmake.configure() cmake.build() + 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 + 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) From b9dec5444909212157c0114a60b61419773ba0ea Mon Sep 17 00:00:00 2001 From: Florian Berchtold Date: Mon, 11 Jan 2021 11:59:23 +0100 Subject: [PATCH 5/8] use archive 8-) --- recipes/matplotlib-cpp/all/conandata.yml | 6 ++---- recipes/matplotlib-cpp/all/conanfile.py | 10 +++++----- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/recipes/matplotlib-cpp/all/conandata.yml b/recipes/matplotlib-cpp/all/conandata.yml index 1cba1e831e248..1d65c8f6573ea 100644 --- a/recipes/matplotlib-cpp/all/conandata.yml +++ b/recipes/matplotlib-cpp/all/conandata.yml @@ -1,6 +1,4 @@ sources: cci.20200422: - - url: https://raw.githubusercontent.com/lava/matplotlib-cpp/d74105036a82e6ccede3fa1a7d872ac1677b00ab/matplotlibcpp.h - sha256: 913638b1d03ccfe28f58f327a8c1247aec943f88f19c37648fd01e239420fb90 - - url: https://raw.githubusercontent.com/lava/matplotlib-cpp/d74105036a82e6ccede3fa1a7d872ac1677b00ab/LICENSE - sha256: d0dc4eae3be039d576e127912d16f78a7ba4e0e6205cd75103efd1a45b89a4ba + url: https://github.com/lava/matplotlib-cpp/archive/d74105036a82e6ccede3fa1a7d872ac1677b00ab.zip + sha256: e26ce88c2f2b2574a32b03a8caf215645b4dcf054ee7e5e2e0cd4d77d7c6ad65 diff --git a/recipes/matplotlib-cpp/all/conanfile.py b/recipes/matplotlib-cpp/all/conanfile.py index 5f77a3b066d0e..81ac43d1ad51c 100644 --- a/recipes/matplotlib-cpp/all/conanfile.py +++ b/recipes/matplotlib-cpp/all/conanfile.py @@ -17,13 +17,13 @@ def _source_subfolder(self): return "source_subfolder" def source(self): - for url_sha in self.conan_data["sources"][self.version]: - tools.download(url_sha["url"], os.path.basename(url_sha["url"])) - tools.check_sha256(os.path.basename(url_sha["url"]), url_sha["sha256"]) + 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", dst="licenses") - self.copy(pattern="matplotlibcpp.h", dst="include") + 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() From cf248871b8e5da426cb4a0e4eeb0ae1c4585e293 Mon Sep 17 00:00:00 2001 From: Florian Berchtold Date: Mon, 11 Jan 2021 12:05:43 +0100 Subject: [PATCH 6/8] fix numpy install --- .../all/test_package/conanfile.py | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/recipes/matplotlib-cpp/all/test_package/conanfile.py b/recipes/matplotlib-cpp/all/test_package/conanfile.py index 9eb1c95d39ce2..ff92727a98355 100644 --- a/recipes/matplotlib-cpp/all/test_package/conanfile.py +++ b/recipes/matplotlib-cpp/all/test_package/conanfile.py @@ -2,30 +2,32 @@ 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 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 - 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) From ee1756d37d6bcc6881cf45aacbf4304e7d707185 Mon Sep 17 00:00:00 2001 From: Florian Berchtold Date: Wed, 2 Jun 2021 12:13:53 +0200 Subject: [PATCH 7/8] remove numpy --- recipes/matplotlib-cpp/all/conandata.yml | 6 +++--- recipes/matplotlib-cpp/all/conanfile.py | 6 ++++++ recipes/matplotlib-cpp/all/test_package/CMakeLists.txt | 8 ++------ recipes/matplotlib-cpp/config.yml | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/recipes/matplotlib-cpp/all/conandata.yml b/recipes/matplotlib-cpp/all/conandata.yml index 1d65c8f6573ea..2688cdabd5c1c 100644 --- a/recipes/matplotlib-cpp/all/conandata.yml +++ b/recipes/matplotlib-cpp/all/conandata.yml @@ -1,4 +1,4 @@ sources: - cci.20200422: - url: https://github.com/lava/matplotlib-cpp/archive/d74105036a82e6ccede3fa1a7d872ac1677b00ab.zip - sha256: e26ce88c2f2b2574a32b03a8caf215645b4dcf054ee7e5e2e0cd4d77d7c6ad65 + cci.20210601: + url: https://github.com/lava/matplotlib-cpp/archive/ef0383f1315d32e0156335e10b82e90b334f6d9f.zip + sha256: d061c56d53cc2355e1543198a3899a361495f5c8a72b938204a5307614ca883f diff --git a/recipes/matplotlib-cpp/all/conanfile.py b/recipes/matplotlib-cpp/all/conanfile.py index 81ac43d1ad51c..4da4312ab4fd2 100644 --- a/recipes/matplotlib-cpp/all/conanfile.py +++ b/recipes/matplotlib-cpp/all/conanfile.py @@ -12,6 +12,9 @@ class MatplotlibCppConan(ConanFile): license = "MIT" no_copy_source = True + options = {"with_numpy": [True, False]} + default_options = {"with_numpy": False} + @property def _source_subfolder(self): return "source_subfolder" @@ -31,3 +34,6 @@ def package_id(self): 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"] diff --git a/recipes/matplotlib-cpp/all/test_package/CMakeLists.txt b/recipes/matplotlib-cpp/all/test_package/CMakeLists.txt index 356d6580761c5..dec558f3cdffa 100644 --- a/recipes/matplotlib-cpp/all/test_package/CMakeLists.txt +++ b/recipes/matplotlib-cpp/all/test_package/CMakeLists.txt @@ -1,15 +1,11 @@ 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(PythonInterp REQUIRED) -find_package(PythonLibs 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 ${PYTHON_LIBRARIES}) -target_include_directories(test_package PRIVATE ${PYTHON_INCLUDE_DIRS}) +target_link_libraries(test_package PRIVATE matplotlib-cpp::matplotlib-cpp Python3::Python) diff --git a/recipes/matplotlib-cpp/config.yml b/recipes/matplotlib-cpp/config.yml index 2036fe6e1ac09..9039fe187d530 100644 --- a/recipes/matplotlib-cpp/config.yml +++ b/recipes/matplotlib-cpp/config.yml @@ -1,3 +1,3 @@ versions: - cci.20200422: + cci.20210601: folder: "all" From 45185a84907529755259052bc9a3d0ea7b7de7c2 Mon Sep 17 00:00:00 2001 From: Florian Berchtold Date: Wed, 2 Jun 2021 13:21:14 +0200 Subject: [PATCH 8/8] cxx11 --- recipes/matplotlib-cpp/all/test_package/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/matplotlib-cpp/all/test_package/CMakeLists.txt b/recipes/matplotlib-cpp/all/test_package/CMakeLists.txt index dec558f3cdffa..745507e10fe60 100644 --- a/recipes/matplotlib-cpp/all/test_package/CMakeLists.txt +++ b/recipes/matplotlib-cpp/all/test_package/CMakeLists.txt @@ -1,6 +1,8 @@ cmake_minimum_required(VERSION 3.10) project(test_package) +set(CMAKE_CXX_STANDARD 11) + include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup()