Replies: 2 comments 1 reply
-
In the meanwhile, if you're using CMake anyway, you could try something like: include(FetchContent)
FetchContent_Declare(matplotplusplus
GIT_REPOSITORY https://github.com/alandefreitas/matplotplusplus
GIT_TAG v1.0.1)
FetchContent_GetProperties(matplotplusplus)
if(NOT matplotplusplus_POPULATED)
FetchContent_Populate(matplotplusplus)
add_subdirectory(${matplotplusplus_SOURCE_DIR} ${matplotplusplus_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()
# ... create your target
target_link_libraries(my_target PRIVATE matplot) I haven't tested that yet though. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi, here is a draft for conanfile that so far works for me. It's a work in progress, so I haven't implemented all options/requirements and so on. Because of problems with You can use it by creating a directory with the folliwing conan export . # user/channel if you want to from conans import CMake, ConanFile, tools
from conans.tools import load, SystemPackageTool
class MatplotplusplusConan(ConanFile):
name = "matplotplusplus"
version = "1.0.1"
url = "https://github.com/alandefreitas/matplotplusplus.git"
settings = "os", "compiler", "build_type", "arch"
generators = "cmake_paths"
exports_sources = ["patch"]
options = {
"examples": [False, True],
"tests": [False, True],
"shared": [False, True],
"fpic": [True, False],
}
default_options = {k: v[0] for k, v in options.items()}
def requirements(self):
# self.requires("")
pass
def system_requirements(self):
installer = SystemPackageTool()
run_update = False
with_force = False
self.output.info("Using package manager to fetch system requirements")
#installer.install(['gnuplot'], run_update, with_force)
#installer.install(['libglfw3-dev'], run_update, with_force)
def configure_cmake(self):
import os
cmake = CMake(self)
cmake.definitions["CMAKE_CXX_FLAGS"] = "-O2"
cmake.definitions["BUILD_SHARED_LIBS"] = self.options.shared
cmake.definitions["BUILD_EXAMPLES"] = self.options.examples
cmake.definitions["BUILD_TESTS"] = self.options.tests
if not self.options.shared and self.options.fpic:
cmake.definitions["CMAKE_POSITION_INDEPENDENT_CODE"] = True
cmake.configure(source_folder=self.name)
return cmake
def source(self):
git = tools.Git(folder=self.name)
git.clone(self.url, branch='master') #'v{}'.format(self.version))
self.output.info("Applying patch ...")
tools.patch(patch_file="patch", base_path=self.name)
def build(self):
cmake = self.configure_cmake()
cmake.build()
def package(self):
cmake = self.configure_cmake()
cmake.install()
self.output.success("'{}' installed.".format(self.name))
def package_info(self):
self.cpp_info.libs = tools.collect_libs(self)
self.output.info("{} libraries: ".format(self.name) + str(self.cpp_info.libs)) diff --git a/matplot++-config.cmake.in b/matplot++-config.cmake.in
index 5f0a7ed..c52e79b 100644
--- a/matplot++-config.cmake.in
+++ b/matplot++-config.cmake.in
@@ -6,9 +6,9 @@ if(NOT ${MATPLOT_BUILT_SHARED})
list(APPEND CMAKE_MODULE_PATH ${MATPLOT_CONFIG_INSTALL_DIR})
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
- find_dependency(Filesystem)
+ find_dependency(Filesystem COMPONENTS Experimental Final)
list(POP_BACK CMAKE_MODULE_PATH)
endif()
include("${CMAKE_CURRENT_LIST_DIR}/Matplot++Targets.cmake")
-check_required_components(Matplot++)
\ No newline at end of file
+check_required_components(Matplot++)
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I really enjoy working with matplotplusplus. Thank you for that.
In my workflow, I frequently use Conan, the C/C++ Package Manager to add dependencies to my projects. It would be nice if matplotplusplus was available through Conan. Matplotplusplus is built using modern CMake practices, so I believe it shouldn't be too problematic.
Have you considered this option? Is anyone doing it already? Are you aware of any potential problems that would make it more difficult?
I have never contributed a package to Conan before, but it would make my life more convenient so I might try.
Thank you for your insights.
Beta Was this translation helpful? Give feedback.
All reactions