Skip to content

Commit 53d8a15

Browse files
author
soblin
committed
updated usage instruction
Signed-off-by: soblin <hilo.sobli@gmail.com>
1 parent ff0248f commit 53d8a15

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,13 @@ endif()
8282

8383
# for add_subdirectory
8484
add_library(matplotlibcpp17::matplotlibcpp17 INTERFACE IMPORTED GLOBAL)
85-
set_property(TARGET matplotlibcpp17::matplotlibcpp17 PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/include ${Python3_INCLUDE_DIRS})
86-
set_property(TARGET matplotlibcpp17::matplotlibcpp17 PROPERTY INTERFACE_LINK_LIBRARIES ${Python3_LIBRARIES} pybind11::embed)
85+
set_property(
86+
TARGET matplotlibcpp17::matplotlibcpp17
87+
PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/include
88+
${Python3_INCLUDE_DIRS})
89+
set_property(
90+
TARGET matplotlibcpp17::matplotlibcpp17
91+
PROPERTY INTERFACE_LINK_LIBRARIES ${Python3_LIBRARIES} pybind11::embed)
8792

8893
# install https://dominikberner.ch/cmake-interface-lib/
8994
include(GNUInstallDirs)

README.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ It is supposed to provide the user with almost full access to matplotlib feature
1717
- numpy for `mplot3d`
1818
- ([xtensor](https://github.com/xtensor-stack/xtensor) == 0.24.0 + [xtl](https://github.com/xtensor-stack/xtl), only for `gallery` demos)
1919

20-
## Installation
20+
## Usage
21+
22+
### Installation
2123

2224
```bash
2325
$ mdkir build; cd build;
@@ -35,7 +37,17 @@ find_package(matplotlibcpp17)
3537
target_link_libraries(a.out matplotlibcpp17::matplotlibcpp17)
3638
```
3739

38-
Or you could just add include path to `include` directory and compile your codes as descibed in [minimal example](#minimal-example).
40+
### Use by add_subdirectory
41+
42+
```bash
43+
add_subdirectory(path to matplotlibcpp17)
44+
...
45+
target_link_libraries(a.out matplotlibcpp17::matplotlibcpp17)
46+
```
47+
48+
### Include matplotlibcpp17 directly
49+
50+
descibed in [minimal example](#minimal-example).
3951

4052
## Syntax
4153

@@ -165,15 +177,15 @@ From [gallery/artist_animation/random_walk.cpp](https://github.com/soblin/matplo
165177
166178
### build
167179
168-
If you do not need to build the demos, use `-DADD_DEMO=0` (by default it is `1`).
180+
If you want to build the demos, use `-DADD_DEMO=1` (by default it is `0`).
169181
170182
```bash
171183
$ mkdir build; cd build
172184
$ cmake .. -DADD_DEMO={0, 1} -DUSE_GUI={0, 1}
173185
$ make -j
174186
```
175187

176-
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.
188+
If you do not need to see the demo with `plt.show()`, use `-DUSE_GUI=1` (by default it is `0`). Otherwise the executables will `plt.savefig()` to `gallery/images` directory.
177189

178190
`make <gallery directory name>` runs all the executables under that directory.
179191

0 commit comments

Comments
 (0)