Skip to content

Commit e46c81a

Browse files
committed
Update Docs
1 parent 9982696 commit e46c81a

9 files changed

+40
-26
lines changed

docs/index.md

+1
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ Data visualization can help programmers and scientists identify trends in their
171171
- [Common Utilities](coding-styles/common-utilities.md)
172172
- [Integration](integration.md)
173173
- [Binary Packages](integration/binary-packages.md)
174+
- [Finding the Library](integration/finding-the-library.md)
174175
- [Package managers](integration/package-managers.md)
175176
- [Homebrew](integration/package-managers/homebrew.md)
176177
- [Arch Linux](integration/package-managers/arch-linux.md)

docs/integration.md

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ has_toc: false
99

1010

1111
- [Binary Packages](integration/binary-packages.md)
12+
- [Finding the Library](integration/finding-the-library.md)
1213
- [Package managers](integration/package-managers.md)
1314
- [Homebrew](integration/package-managers/homebrew.md)
1415
- [Arch Linux](integration/package-managers/arch-linux.md)

docs/integration/backends.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
layout: default
33
title: Backends
4-
nav_order: 6
4+
nav_order: 7
55
has_children: false
66
parent: Integration
77
has_toc: false

docs/integration/binary-packages.md

-21
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,6 @@ Get the binary package from the [release section](https://github.com/alandefreit
1212

1313
If you need a more recent version of Matplot++, you can download the [binary packages from the CI artifacts](https://github.com/alandefreitas/matplotplusplus/actions?query=workflow%3AMatplotplusplus+event%3Apush) or build the library [from the source files](build-from-source.md).
1414

15-
Once the package is installed, you can link your C++ program to the library and include the directories where you installed Matplot++. Unless you changed the default options, the library is likely to be in `/usr/local/` (Linux / Mac OS) or `C:/Program Files/` (Windows). The installer will try to find the directory where you usually keep your libraries but that's not always perfect.
16-
17-
If you are using CMake, you can then find Matplot++ with the usual `find_package` command:
18-
19-
```cmake
20-
find_package(Matplot++ REQUIRED)
21-
# ...
22-
target_link_libraries(my_target PUBLIC Matplot++::matplot)
23-
```
24-
25-
You can see a complete example in [`test/integration/CMakeLists.txt`](https://github.com/alandefreitas/matplotplusplus/blob/master/test/integration/CMakeLists.txt).
26-
27-
CMake should be able to locate the `matplot++-config.cmake` script automatically if you installed the library under `/usr/local/` (Linux / Mac OS) or `C:/Program Files/` (Windows). Otherwise, if the library is under another directory, like `C:/Program Files (x86)` or `C:/Program Files (x86)/`, you need to include your installation directory in `CMAKE_MODULE_PATH` first:
28-
29-
```cmake
30-
list(APPEND CMAKE_MODULE_PATH put/your/installation/directory/here)
31-
find_package(Matplot++ REQUIRED)
32-
# ...
33-
target_link_libraries(my_target PUBLIC Matplot++::matplot)
34-
```
35-
3615

3716

3817

docs/integration/build-from-source.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
layout: default
33
title: Build from Source
4-
nav_order: 3
4+
nav_order: 4
55
has_children: true
66
parent: Integration
77
has_toc: false

docs/integration/cmake-targets.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
layout: default
33
title: CMake targets
4-
nav_order: 4
4+
nav_order: 5
55
has_children: true
66
parent: Integration
77
has_toc: false
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
layout: default
3+
title: Finding the Library
4+
nav_order: 2
5+
has_children: false
6+
parent: Integration
7+
has_toc: false
8+
---
9+
# Finding the Library
10+
11+
Once the package is installed, you can link your C++ program to the library and include the directories where you installed Matplot++. Unless you changed the default options, the library is likely to be in `/usr/local/` (Linux / Mac OS) or `C:/Program Files/` (Windows). The installer will try to find the directory where you usually keep your libraries but that's not always perfect.
12+
13+
If you are using CMake, you can then find Matplot++ with the usual `find_package` command:
14+
15+
```cmake
16+
find_package(Matplot++ REQUIRED)
17+
# ...
18+
target_link_libraries(my_target PUBLIC Matplot++::matplot)
19+
```
20+
21+
You can see a complete example in [`test/integration/CMakeLists.txt`](https://github.com/alandefreitas/matplotplusplus/blob/master/test/integration/CMakeLists.txt). CMake should be able to locate the `matplot++-config.cmake` script automatically if you installed the library under `/usr/local/` (Linux / Mac OS).
22+
23+
Unfortunately, CMake does not have a single default directory for packages on Windows like `/usr/local/lib`. If CMake cannot find Matplot++ on Windows or if you installed the library outside the default directory on Linux/Mac OS, there are a few [options](https://stackoverflow.com/questions/21314893/what-is-the-default-search-path-for-find-package-in-windows-using-cmake):
24+
25+
* **Environment Variables**: The most reliable way to set this default directory is through environment variables. You can create an environment variable `MATPLOTPP_DIR` and then add `$ENV{MATPLOTPP_DIR}` to the `HINTS` section of the `find_package` command. This tends to be more convenient than requiring the path on the command line every time. Starting with version 3.12, CMake now implicitly considers the `<PackageName>_Root` environment variable a HINT for every `find_package` call.
26+
* **Package Registry**: CMake offers the [Package Registry](https://cmake.org/cmake/help/v3.5/manual/cmake-packages.7.html#package-registry) as an alternative mechanism for finding package locations. CMake maintains a list of package information in the Windows registry under `HKEY_CURRENT_USER\Software\Kitware\CMake\Packages\`.
27+
* **Append CMAKE_MODULE_PATH**: You can append more directories to [`CMAKE_MODULE_PATH`](https://cmake.org/cmake/help/latest/variable/CMAKE_MODULE_PATH.html) with something like `list(APPEND CMAKE_MODULE_PATH "C:\\Program Files\\matplotplusplus 1.0.1")`. `CMAKE_MODULE_PATH` is a list of search paths for CMake modules to be loaded by the `include()` or `find_package()` commands.
28+
* **Set the DIR variable directly**: Directly set the `Matplot++_DIR` variable with something like `set(Matplot++_DIR "C:\\Program Files\\matplotplusplus 1.0.1\\lib\\cmake\\Matplot++")`. This might be good enough for small local projects but it is hard-coding the directory in your build script. When your library gets out of your local environment, you need to choose one of the other options above (better) or make this variable an option and require the user to provide the directory on the command line every time (worse).
29+
30+
31+
32+
33+
<!-- Generated with mdsplit: https://github.com/alandefreitas/mdsplit -->

docs/integration/other-build-systems.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
layout: default
33
title: Other build systems
4-
nav_order: 5
4+
nav_order: 6
55
has_children: false
66
parent: Integration
77
has_toc: false

docs/integration/package-managers.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
layout: default
33
title: Package managers
4-
nav_order: 2
4+
nav_order: 3
55
has_children: true
66
parent: Integration
77
has_toc: false

0 commit comments

Comments
 (0)