8000 WIP: install target · lava/matplotlib-cpp@e1fad58 · GitHub
[go: up one dir, main page]

Skip to content

Commit e1fad58

Browse files
committed
WIP: install target
1 parent f23347f commit e1fad58

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

Makefile

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,28 @@
11
# Use C++11
2-
CXXFLAGS += -std=c++11
2+
MATPLOTLIBCPP_CXXFLAGS = -std=c++11
33

44
# Default to using system's default version of python
5-
PYTHON_BIN ?= python
6-
PYTHON_CONFIG := $(PYTHON_BIN)-config
7-
PYTHON_INCLUDE ?= $(shell $(PYTHON_CONFIG) --includes)
8-
CXXFLAGS += $(PYTHON_INCLUDE)
9-
LDFLAGS += $(shell $(PYTHON_CONFIG) --libs)
5+
PYTHON_BIN := python
6+
PYTHON_CONFIG := $(PYTHON_BIN)-config
7+
PYTHON_INCLUDE ?= $(shell $(PYTHON_CONFIG) --includes)
8+
MATPLOTLIBCPP_CXXFLAGS += $(PYTHON_INCLUDE)
9+
MATPLOTLIBCPP_LDFLAGS += $(shell $(PYTHON_CONFIG) --libs)
10+
11+
# If these checks have false positives, please remove this check and file a github issue.
12+
$(if $(PYTHON_INCLUDE),,$(error \
13+
Could not auto-detect python development headers. \
14+
Please install python-dev or similar, or manually \
15+
specify PYTHON_INCLUDE=...))
16+
17+
# If we have to add 1-2 more of these checks, I'll probably eventually bite the
18+
# bullet and switch to cmake/autoconf.
19+
test_matplotlib != $(PYTHON_BIN) -c 'import matplotlib'
20+
WITH_MATPLOTLIB = $(.SHELLSTATUS)
21+
$(ifeq $(WITH
1022

1123
# Either finds numpy or set -DWITHOUT_NUMPY
12-
CXXFLAGS += $(shell $(PYTHON_BIN) $(CURDIR)/numpy_flags.py)
13-
WITHOUT_NUMPY := $(findstring $(CXXFLAGS), WITHOUT_NUMPY)
24+
MATPLOTLIBCPP_CXXFLAGS += $(shell $(PYTHON_BIN) $(CURDIR)/numpy_flags.py)
25+
WITHOUT_NUMPY := $(findstring $(CXXFLAGS), WITHOUT_NUMPY)
1426

1527
# Examples requiring numpy support to compile
1628
EXAMPLES_NUMPY := surface
@@ -27,7 +39,10 @@ examples: $(EXAMPLE_TARGETS)
2739
# Assume every *.cpp file is a separate example
2840
$(EXAMPLE_TARGETS): examples/build/%: examples/%.cpp
2941
mkdir -p examples/build
30-
$(CXX) -o $@ $< $(CXXFLAGS) $(LDFLAGS)
42+
$(CXX) -o $@ $< $(MATPLOTLIBCPP_CXXFLAGS) $(CXXFLAGS) $(LDFLAGS) $(MATPLOTLIBCPP_LDFLAGS)
3143

3244
clean:
489A
3345
rm -f ${EXAMPLE_TARGETS}
46+
47+
install:
48+
cp matplotlibcpp.h $(DESTDIR)$(PREFIX)/include/matplotlibcpp.h

0 commit comments

Comments
 (0)
0