From 05f0b6d3462806843c801e708331323d602faea0 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquenot Date: Sun, 8 Mar 2020 22:34:46 +0100 Subject: [PATCH 1/6] :sparkle: Added a first version of Dockerfile --- Dockerfile | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..850466fb --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +FROM debian:10 AS builder +RUN apt-get update \ + && apt-get install --yes --no-install-recommends \ + g++ \ + libpython3-dev \ + make \ + python3 \ + python3-dev \ + python3-numpy + +ADD Makefile matplotlibcpp.h numpy_flags.py /opt/ +ADD examples/*.cpp /opt/examples/ +RUN cd /opt \ + && make PYTHON_BIN=python3 \ + && ls examples/build + +FROM debian:10 +RUN apt-get update \ + && apt-get install --yes --no-install-recommends \ + libpython3-dev \ + python3-matplotlib \ + python3-numpy + +COPY --from=builder /opt/examples/build /opt/ +RUN cd /opt \ + && ls \ + && ./basic From c1a571d66dde60b8bf47cd9b7b56c580b14a0c3b Mon Sep 17 00:00:00 2001 From: Guillaume Jacquenot Date: Sun, 8 Mar 2020 22:35:12 +0100 Subject: [PATCH 2/6] :sparkle: Added a target to build docker image --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index a4a8a28a..c8c8b89c 100644 --- a/Makefile +++ b/Makefile @@ -32,3 +32,6 @@ $(EXAMPLE_TARGETS): examples/build/%: examples/%.cpp clean: rm -f ${EXAMPLE_TARGETS} + +docker_build: + docker build . -t matplotlibcpp From 1b812af8cdeaacc2fc1ee0ee048c3345a4a07aa8 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquenot Date: Sun, 8 Mar 2020 22:36:08 +0100 Subject: [PATCH 3/6] :sparkle: Added a first CI file --- .travis.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..bacca686 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,6 @@ +language: minimal +dist: trusty +services: + - docker +script: + - make docker_build From c2c2e613ed1149e5935e60fe9b61769c34236639 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquenot Date: Sun, 8 Mar 2020 22:55:46 +0100 Subject: [PATCH 4/6] :pencil: Tiny refactoring of the Makefile --- Makefile | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index c8c8b89c..1d393c91 100644 --- a/Makefile +++ b/Makefile @@ -14,8 +14,20 @@ WITHOUT_NUMPY := $(findstring $(CXXFLAGS), WITHOUT_NUMPY) # Examples requiring numpy support to compile EXAMPLES_NUMPY := surface -EXAMPLES := minimal basic modern animation nonblock xkcd quiver bar \ - fill_inbetween fill update subplot2grid colorbar lines3d \ +EXAMPLES := minimal \ + basic \ + modern \ + animation \ + nonblock \ + xkcd \ + quiver \ + bar \ + fill_inbetween \ + fill \ + update \ + subplot2grid \ + colorbar \ + lines3d \ $(if WITHOUT_NUMPY,,$(EXAMPLES_NUMPY)) # Prefix every example with 'examples/build/' From d866742cba531af2625f96c7664a8051e5b690c5 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquenot Date: Sun, 8 Mar 2020 23:15:27 +0100 Subject: [PATCH 5/6] :pencil: Typo update in Readme.md --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 72bab39f..a1ad7bdf 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ A more comprehensive example: namespace plt = matplotlibcpp; -int main() +int main() { // Prepare data. int n = 5000; @@ -73,26 +73,26 @@ Alternatively, matplotlib-cpp also supports some C++11-powered syntactic sugar: using namespace std; namespace plt = matplotlibcpp; -int main() -{ +int main() +{ // Prepare data. int n = 5000; // number of data points - vector x(n),y(n); + vector x(n),y(n); for(int i=0; i Date: Sat, 28 Mar 2020 09:15:28 +0100 Subject: [PATCH 6/6] :wrench: Moved all elements related to docker build in contrib As requested by maintainer --- .travis.yml | 2 +- Makefile | 3 --- Dockerfile => contrib/Dockerfile | 0 contrib/Makefile | 6 ++++++ 4 files changed, 7 insertions(+), 4 deletions(-) rename Dockerfile => contrib/Dockerfile (100%) create mode 100644 contrib/Makefile diff --git a/.travis.yml b/.travis.yml index bacca686..d6175a21 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,4 +3,4 @@ dist: trusty services: - docker script: - - make docker_build + - make -C contrib docker_build diff --git a/Makefile b/Makefile index 1d393c91..bcd0d8f9 100644 --- a/Makefile +++ b/Makefile @@ -44,6 +44,3 @@ $(EXAMPLE_TARGETS): examples/build/%: examples/%.cpp clean: rm -f ${EXAMPLE_TARGETS} - -docker_build: - docker build . -t matplotlibcpp diff --git a/Dockerfile b/contrib/Dockerfile similarity index 100% rename from Dockerfile rename to contrib/Dockerfile diff --git a/contrib/Makefile b/contrib/Makefile new file mode 100644 index 00000000..f659cd94 --- /dev/null +++ b/contrib/Makefile @@ -0,0 +1,6 @@ +all: docker_build + +docker_build: + cd .. && \ + docker build . -f contrib/Dockerfile -t matplotlibcpp && \ + cd contrib