Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cab80f3

Browse files
Benno EversBenno Evers
Benno Evers
authored and
Benno Evers
committed
Remove obsoleted build systems
After the switch to cmake, we don't need the hand-written Makefile nor the contrib/ version of the cmake file.
1 parent 3d3f9da commit cab80f3

File tree

4 files changed

+18
-113
lines changed

4 files changed

+18
-113
lines changed

Makefile

-41
This file was deleted.

README.md

+18-34
Original file line numberDiff line numberDiff line change
@@ -202,39 +202,34 @@ If, for some reason, you're unable to get a working installation of numpy on you
202202
you can define the macro `WITHOUT_NUMPY` before including the header file to erase this
203203
dependency.
204204

205-
The C++-part of the library consists of the single header file `matplotlibcpp.h` which can be placed
206-
anywhere.
205+
The C++-part of the library consists of the single header file `matplotlibcpp.h` which
206+
can be placed anywhere.
207207

208-
Since a python interpreter is opened internally, it is necessary to link against `libpython` in order
209-
to user matplotlib-cpp. Most versions should work, although `libpython2.7` and `libpython3.6` are
210-
probably the most regularly testedr.
208+
Since a python interpreter is opened internally, it is necessary to link
209+
against `libpython` in order to user matplotlib-cpp. Most versions should
210+
work, although python likes to randomly break compatibility from time to time
211+
so some caution is advised when using the bleeding edge.
211212

212213

213214
# CMake
214215

215-
If you prefer to use CMake as build system, you will want to add something like this to your
216-
CMakeLists.txt:
216+
The C++ code is compatible to both python2 and python3. However, the `CMakeLists.txt`
217+
file is currently set up to use python3 by default, so if python2 is required this
218+
has to be changed manually. (a PR that adds a cmake option for this would be highly
219+
welcomed)
217220

218-
**Recommended way (since CMake 3.12):**
221+
**NOTE**: By design (of python), only a single python interpreter can be created per
222+
process. When using this library, *no other* library that is spawning a python
223+
interpreter internally can be used.
219224

220-
It's easy to use cmake official [docs](https://cmake.org/cmake/help/git-stage/module/FindPython2.html#module:FindPython2) to find Python 2(or 3) interpreter, compiler and development environment (include directories and libraries).
225+
To compile the code without using cmake, the compiler invocation should look like
226+
this:
221227

222-
NumPy is optional here, delete it from cmake script, if you don't need it.
228+
g++ example.cpp -I/usr/include/python2.7 -lpython2.7
223229

224-
```cmake
225-
find_package(Python2 COMPONENTS Development NumPy)
226-
target_include_directories(myproject PRIVATE ${Python2_INCLUDE_DIRS} ${Python2_NumPy_INCLUDE_DIRS})
227-
target_link_libraries(myproject Python2::Python Python2::NumPy)
228-
```
229-
230-
**Alternative way (for CMake <= 3.11):**
231-
232-
```cmake
233-
find_package(PythonLibs 2.7)
234-
target_include_directories(myproject PRIVATE ${PYTHON_INCLUDE_DIRS})
235-
target_link_libraries(myproject ${PYTHON_LIBRARIES})
236-
```
230+
This can also be used for linking against a custom build of python
237231

232+
g++ example.cpp -I/usr/local/include/fancy-python4 -L/usr/local/lib -lfancy-python4
238233

239234
# Vcpkg
240235

@@ -258,17 +253,6 @@ Note that support for c++98 was dropped more or less accidentally, so if you hav
258253
with an ancient compiler and still want to enjoy the latest additional features, I'd
259254
probably merge a PR that restores support.
260255

261-
# Python 3
262-
263-
This library supports both python2 and python3 (although the python3 support is probably far less tested,
264-
so it is recommended to prefer python2.7). To switch the used python version, simply change
265-
the compiler flags accordingly.
266-
267-
g++ example.cpp -I/usr/include/python3.6 -lpython3.6
268-
269-
The same technique can be used for linking against a custom build of python
270-
271-
g++ example.cpp -I/usr/local/include/fancy-python4 -L/usr/local/lib -lfancy-python4
272256

273257

274258
Why?

contrib/CMakeLists.txt

-26
This file was deleted.

numpy_flags.py

-12
This file was deleted.

0 commit comments

Comments
 (0)