Skip to main content
Sign in
Snippets Groups Projects
Commit 9f140785 authored by soblin's avatar soblin
Browse files

added instructions

parent 3eeee5c8
Branches
No related tags found
No related merge requests found
......@@ -7,17 +7,17 @@ project(
HOMEPAGE_URL "https://soblin.github.io/matplotlibcpp17/"
)
find_package(Python3 COMPONENTS Interpreter Development NumPy)
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
find_package(pybind11 REQUIRED)
set(matplotlibcpp17_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/include")
# gallery
if(NOT DEFINED USE_GUI)
set(USE_GUI 0)
set(USE_GUI 1)
endif()
if(NOT DEFINED ADD_DEMO)
set(ADD_DEMO ON)
set(ADD_DEMO 1)
endif()
function(add_demo name path)
......@@ -31,6 +31,7 @@ function(add_demo name path)
endfunction()
if(${ADD_DEMO})
find_package(Python3 COMPONENTS NumPy REQUIRED)
find_package(xtensor REQUIRED)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "-Wall -g -DUSE_GUI=${USE_GUI}")
......@@ -45,6 +46,7 @@ endif()
# test
enable_testing()
if(NOT DEFINED DO_TEST)
set(DO_TEST ON)
endif()
......
......
......@@ -11,14 +11,25 @@ It is supposed to provide the user with almost full access to matplotlib feature
## Dependencies
- [pybind11](https://github.com/pybind/pybind11) >= 2.4.3
- `sudo apt install pybind11-dev`
- `sudo apt install pybind11-dev` (on Ubuntu20.04)
- or manual install
- compatible with [matplotlib](https://matplotlib.org/stable/index.html) == 3.5.1
- numpy for `mplot3d`
- [xtensor](https://github.com/xtensor-stack/xtensor) == 0.24.0 (+ [xtl](https://github.com/xtensor-stack/xtl), for `gallery` demos)
- ([xtensor](https://github.com/xtensor-stack/xtensor) == 0.24.0 + [xtl](https://github.com/xtensor-stack/xtl), only for `gallery` demos)
## Usage
## Installation
Just add include path to `include` directory of this project.
```bash
$ mdkir build; cd build;
$ cmake .. -DADD_DEMO=0 (-DCMAKE_INSTALL_PREFIX=<custom path>)
$ make -j
$ make install
$ (make uninstall)
```
For using matplotlibcpp17 from CMakeLists.txt, see [hello_world](https://github.com/soblin/matplotlibcpp17/tree/master/hello_world) example.
Or you could just add include path to `include` directory and compile your codes as descibed in [minimal example](#minimal-example).
## Syntax
......@@ -148,13 +159,17 @@ From [gallery/artist_animation/random_walk.cpp](https://github.com/soblin/matplo
### build
If you do not need to build the demos, use `-DADD_DEMO=0` (by default it is `1`).
```bash
mkdir build; cd build; cmake .. ; make -j
$ mkdir build; cd build
$ cmake .. -DADD_DEMO={0, 1} -DUSE_GUI={0, 1}
$ make -j
```
If you want to see the demo with `plt.show()`, add `-DUSE_GUI=1` (by default it is `0`). Otherwise the executables will `plt.savefig()` to `gallery/images` directory.
If you do not need to see the demo with `plt.show()`, use `-DUSE_GUI=0` (by default it is `1`). Otherwise the executables will `plt.savefig()` to `gallery/images` directory.
`make <gallery directory name>` runs all executables under that directory.
`make <gallery directory name>` runs all the executables under that directory.
```bash
make lines_bars_and_markers
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment