Skip to content

Commit 9f14078

Browse files
committed
added instructions
1 parent 3eeee5c commit 9f14078

File tree

2 files changed

+27
-10
lines changed

2 files changed

+27
-10
lines changed

CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ project(
77
HOMEPAGE_URL "https://soblin.github.io/matplotlibcpp17/"
88
)
99

10-
find_package(Python3 COMPONENTS Interpreter Development NumPy)
10+
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
1111
find_package(pybind11 REQUIRED)
1212

1313
set(matplotlibcpp17_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/include")
1414

1515
# gallery
1616
if(NOT DEFINED USE_GUI)
17-
set(USE_GUI 0)
17+
set(USE_GUI 1)
1818
endif()
1919
if(NOT DEFINED ADD_DEMO)
20-
set(ADD_DEMO ON)
20+
set(ADD_DEMO 1)
2121
endif()
2222

2323
function(add_demo name path)
@@ -31,6 +31,7 @@ function(add_demo name path)
3131
endfunction()
3232

3333
if(${ADD_DEMO})
34+
find_package(Python3 COMPONENTS NumPy REQUIRED)
3435
find_package(xtensor REQUIRED)
3536
set(CMAKE_CXX_STANDARD 17)
3637
set(CMAKE_CXX_FLAGS "-Wall -g -DUSE_GUI=${USE_GUI}")
@@ -45,6 +46,7 @@ endif()
4546

4647

4748
# test
49+
enable_testing()
4850
if(NOT DEFINED DO_TEST)
4951
set(DO_TEST ON)
5052
endif()

README.md

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,25 @@ It is supposed to provide the user with almost full access to matplotlib feature
1111
## Dependencies
1212

1313
- [pybind11](https://github.com/pybind/pybind11) >= 2.4.3
14-
- `sudo apt install pybind11-dev`
14+
- `sudo apt install pybind11-dev` (on Ubuntu20.04)
15+
- or manual install
1516
- compatible with [matplotlib](https://matplotlib.org/stable/index.html) == 3.5.1
1617
- numpy for `mplot3d`
17-
- [xtensor](https://github.com/xtensor-stack/xtensor) == 0.24.0 (+ [xtl](https://github.com/xtensor-stack/xtl), for `gallery` demos)
18+
- ([xtensor](https://github.com/xtensor-stack/xtensor) == 0.24.0 + [xtl](https://github.com/xtensor-stack/xtl), only for `gallery` demos)
1819

19-
## Usage
20+
## Installation
2021

21-
Just add include path to `include` directory of this project.
22+
```bash
23+
$ mdkir build; cd build;
24+
$ cmake .. -DADD_DEMO=0 (-DCMAKE_INSTALL_PREFIX=<custom path>)
25+
$ make -j
26+
$ make install
27+
$ (make uninstall)
28+
```
29+
30+
For using matplotlibcpp17 from CMakeLists.txt, see [hello_world](https://github.com/soblin/matplotlibcpp17/tree/master/hello_world) example.
31+
32+
Or you could just add include path to `include` directory and compile your codes as descibed in [minimal example](#minimal-example).
2233

2334
## Syntax
2435

@@ -148,13 +159,17 @@ From [gallery/artist_animation/random_walk.cpp](https://github.com/soblin/matplo
148159
149160
### build
150161
162+
If you do not need to build the demos, use `-DADD_DEMO=0` (by default it is `1`).
163+
151164
```bash
152-
mkdir build; cd build; cmake .. ; make -j
165+
$ mkdir build; cd build
166+
$ cmake .. -DADD_DEMO={0, 1} -DUSE_GUI={0, 1}
167+
$ make -j
153168
```
154169

155-
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.
170+
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.
156171

157-
`make <gallery directory name>` runs all executables under that directory.
172+
`make <gallery directory name>` runs all the executables under that directory.
158173

159174
```bash
160175
make lines_bars_and_markers

0 commit comments

Comments
 (0)