Skip to content

Commit 4436ce8

Browse files
committed
Installation instructions
1 parent c938cc5 commit 4436ce8

File tree

1 file changed

+83
-73
lines changed

1 file changed

+83
-73
lines changed

README.md

Lines changed: 83 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -2020,15 +2020,90 @@ If you are interested in understanding how the library works, you can read the d
20202020

20212021
## Integration
20222022

2023-
### CMake (manual download)
2023+
### Dependencies
2024+
2025+
The build script will try to find all these dependencies for you:
2026+
2027+
* C++17
2028+
* CMake 3.14+
2029+
* Required at runtime
2030+
* Gnuplot 5.2.6+
2031+
2032+
It will also look for these *optional* dependencies for manipulating images:
2033+
2034+
* JPEG
2035+
* TIFF
2036+
* ZLIB
2037+
* PNG
2038+
* LAPACK
2039+
* BLAS
2040+
* FFTW
2041+
* OpenCV
2042+
2043+
There are two dependencies in [`source/3rd_party`](source/3rd_party). These dependencies are bundled, so you don't have to worry about them:
2044+
2045+
* olvb/nodesoup
2046+
* dtschump/CImg
2047+
2048+
You can define `WITH_SYSTEM_NODESOUP=ON` or `WITH_SYSTEM_CIMG=ON` in the cmake command line to use a system-provided version of these dependencies.
2049+
2050+
There's an extra target `matplot_opengl` with the experimental OpenGL backend. You need to define `BUILD_EXPERIMENTAL_OPENGL_BACKEND=ON` in the CMake command line to build that target. In that case, the build script will also look for these extra dependencies:
2051+
2052+
* OpenGL
2053+
* GLAD
2054+
* GLFW3
2055+
2056+
You can see all dependencies in [`source/3rd_party/CMakeLists.txt`](source/3rd_party/CMakeLists.txt).
2057+
2058+
### Build the examples
2059+
2060+
```bash
2061+
mkdir build
2062+
cmake -version
2063+
cmake .. -DCMAKE_BUILD_TYPE=Release
2064+
cmake --build . -j 2 --config Release
2065+
```
2066+
2067+
### Installing
2068+
2069+
```bash
2070+
mkdir build
2071+
cmake -version
2072+
cmake .. -DCMAKE_BUILD_TYPE=Release
2073+
cmake --build . -j 2 --config Release
2074+
cmake --install
2075+
```
2076+
2077+
### As a CMake package
2078+
2079+
If you have library installed, you can call
2080+
2081+
```cmake
2082+
find_package(Matplot++)
2083+
```
2084+
2085+
from your CMake build script. When creating your executable, link the library to the targets you want:
2086+
2087+
```
2088+
add_executable(my_target main.cpp)
2089+
target_link_libraries(my_target PUBLIC matplot)
2090+
```
2091+
2092+
Add this header to your source files:
2093+
2094+
```cpp
2095+
#include <matplot/matplot.h>
2096+
```
2097+
2098+
### As a CMake subdirectory
20242099

20252100
Check if you have [Cmake](http://cmake.org) 3.14+ installed:
20262101

20272102
```bash
20282103
cmake -version
20292104
```
20302105

2031-
Download the whole project and add the subdirectory to your Cmake project:
2106+
Download the whole project and add the subdirectory to your CMake project:
20322107

20332108
```cmake
20342109
add_subdirectory(matplotplusplus)
@@ -2047,7 +2122,7 @@ Add this header to your source files:
20472122
#include <matplot/matplot.h>
20482123
```
20492124

2050-
### CMake (automatic download)
2125+
### CMake with Automatic Download
20512126

20522127
Check if you have [Cmake](http://cmake.org) 3.14+ installed:
20532128

@@ -2073,43 +2148,18 @@ Then add this header to your source files:
20732148
#include <matplot/matplot.h>
20742149
```
20752150

2076-
### Other build systems
2151+
### Other build systems
20772152

2078-
Right now, it really doesn't have support for anything other than CMake. If you really want to use it in another build system you pretty much have to rewrite the entire build script.
2153+
If you want to use it in another build system you can either install the library (Section [*Installing*](#installing)) or you have to rewrite the build script.
20792154

2080-
If you're not using Cmake, your project needs to include the headers and compile all source files in the [`source`](source) directory. You also need to link with the dependencies described in [`source/3rd_party/CMakeLists.txt`](source/3rd_party/CMakeLists.txt).
2155+
Your project needs to 1) include the headers and compile all source files in the [`source`](source) directory, and 2) link with the dependencies described in [`source/3rd_party/CMakeLists.txt`](source/3rd_party/CMakeLists.txt).
20812156

20822157
Then add this header to your source files:
20832158

20842159
```cpp
20852160
#include <matplot/matplot.h>
20862161
```
20872162

2088-
### Dependencies
2089-
2090-
This project requires C++17. You can see other dependencies in [`source/3rd_party/CMakeLists.txt`](source/3rd_party/CMakeLists.txt). CMake will try to solve everything for you.
2091-
2092-
* Required
2093-
* olvb/nodesoup (bundled; but you can define `WITH_SYSTEM_NODESOUP=ON` in the cmake command line to use a system-provided version of nodesoup)
2094-
* dtschump/CImg (bundled; but you can define `WITH_SYSTEM_CIMG=ON` in the cmake command line to use a system-provided version of CImg)
2095-
* Required (at Runtime)
2096-
* Gnuplot 5.2.6+
2097-
* Optional (for images)
2098-
* JPEG
2099-
* TIFF
2100-
* ZLIB
2101-
* PNG
2102-
* LAPACK
2103-
* BLAS
2104-
* FFTW
2105-
* OpenCV
2106-
* Optional (for OpenGL backend)
2107-
* OpenGL
2108-
* GLAD
2109-
* GLFW3
2110-
2111-
There's an extra target `matplot_opengl` that exemplifies how an OpenGL backend **could** be implemented. It's not a complete backend. If you want to test it, only then there are some extra dependencies.
2112-
21132163
### Backends
21142164

21152165
Coming up with new backends is a continuous process. See the complete [article](documentation/README.md) for a description of the [backend interface](source/matplot/backend/backend_interface.h), a description of the current default backend ([Gnuplot pipe](source/matplot/backend/gnuplot.h)), and what's involved in possible [new backends](documentation/README.md#backends). See the directory [`source/matplot/backend`](source/matplot/backend) for some examples. Also, have a look at this example [`test/backends/main.cpp`](test/backends/ogl_main.cpp).
@@ -2130,7 +2180,7 @@ If you're in a hurry, here is a summary of the backends we have and the backends
21302180
* Pros: Great for vector graphics
21312181
* Cons: Unmaintained, 2D only, and non-interactive by itself <sup>see [1](https://github.com/ghaerr/agg-2.6#roadmap), [2](https://github.com/mapnik/mapnik/wiki/MapnikRenderers), [3](http://www.antigrain.com/) </sup>
21322182

2133-
### Contributing
2183+
## Contributing
21342184

21352185
There are many ways in which you can contribute to this library:
21362186

@@ -2163,7 +2213,7 @@ There are many ways in which you can contribute to this library:
21632213
<a href="https://github.com/lacc97">
21642214
<img src="https://avatars1.githubusercontent.com/u/23489037?v=4" width="100;" alt="lacc97"/>
21652215
<br />
2166-
<sub><b>Luis CC!ceres</b></sub>
2216+
<sub><b>Luis Cáceres</b></sub>
21672217
</a>
21682218
</td>
21692219
<td align="center">
@@ -2293,43 +2343,3 @@ There are many ways in which you can contribute to this library:
22932343
* Zaitsev S (2020). Webview. URL: [https://github.com/zserge/webview](https://github.com/zserge/webview).
22942344

22952345
* Zakai A (2011). "Emscripten: an LLVM-to-JavaScript compiler." In Proceedings of the ACM international conference companion on Object oriented programming systems languages and applications companion, pp. 301-312.
2296-
## Contributors :sparkles:
2297-
<table>
2298-
<tr>
2299-
<td align="center">
2300-
<a href="https://github.com/alandefreitas">
2301-
<img src="https://avatars0.githubusercontent.com/u/5369819?v=4" width="100;" alt="alandefreitas"/>
2302-
<br />
2303-
<sub><b>Alan De Freitas</b></sub>
2304-
</a>
2305-
</td>
2306-
<td align="center">
2307-
<a href="https://github.com/mrexodia">
2308-
<img src="https://avatars2.githubusercontent.com/u/2458265?v=4" width="100;" alt="mrexodia"/>
2309-
<br />
2310-
<sub><b>Duncan Ogilvie</b></sub>
2311-
</a>
2312-
</td>
2313-
<td align="center">
2314-
<a href="https://github.com/lacc97">
2315-
<img src="https://avatars1.githubusercontent.com/u/23489037?v=4" width="100;" alt="lacc97"/>
2316-
<br />
2317-
<sub><b>Luis Cáceres</b></sub>
2318-
</a>
2319-
</td>
2320-
<td align="center">
2321-
<a href="https://github.com/sammi">
2322-
<img src="https://avatars0.githubusercontent.com/u/189128?v=4" width="100;" alt="sammi"/>
2323-
<br />
2324-
<sub><b>Sammi</b></sub>
2325-
</a>
2326-
</td>
2327-
<td align="center">
2328-
<a href="https://github.com/dimztimz">
2329-
<img src="https://avatars0.githubusercontent.com/u/6236568?v=4" width="100;" alt="dimztimz"/>
2330-
<br />
2331-
<sub><b>Dimitrij Mijoski</b></sub>
2332-
</a>
2333-
</td></tr>
2334-
</table>
2335-

0 commit comments

Comments
 (0)