GeezerVison is showing github.com — Windows Compile Command · lava/matplotlib-cpp@b815a43
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: .gitignore +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
30 | 30 | # Logfiles |
31 | 31 | *.tlog |
32 | 32 | *.log |
| 33 | + |
| 34 | +# Build |
| 35 | +/examples/build/* |
Collapse file
Copy file name to clipboardExpand all lines: README.md +3Lines changed: 3 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -138,3 +138,6 @@ Todo/Issues/Wishlist |
138 | 138 | be easy to add. |
139 | 139 |
|
140 | 140 | * A lot of copying could be avoided if we generate numpy arrays directly instead of python lists |
| 141 | + |
| 142 | +* If you use Anaconda on Windows, you might need to set PYTHONHOME to Anaconda home directory and QT_QPA_PLATFORM_PLUGIN_PATH to %PYTHONHOME%Library/plugins/platforms. The latter is for especially when you get the error which says 'This application failed to start because it could not find or load the Qt platform plugin "windows" |
| 143 | +in "".' |
Collapse file
Copy file name to clipboard +21Lines changed: 21 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +cmake_minimum_required(VERSION 3.1) |
| 2 | +project (MatplotlibCPP_Test) |
| 3 | + |
| 4 | +set(CMAKE_CXX_STANDARD 11) |
| 5 | +set(CMAKE_CXX_STANDARD_REQUIRED ON) |
| 6 | + |
| 7 | +include_directories(${PYTHONHOME}/include) |
| 8 | +link_directories(${PYTHONHOME}/libs) |
| 9 | + |
| 10 | +add_definitions(-DPY_INCLUDE) |
| 11 | + |
| 12 | +# message(STATUS "*** dump start cmake variables ***") |
| 13 | +# get_cmake_property(_variableNames VARIABLES) |
| 14 | +# foreach(_variableName ${_variableNames}) |
| 15 | + # message(STATUS "${_variableName}=${${_variableName}}") |
| 16 | +# endforeach() |
| 17 | +# message(STATUS "*** dump end ***") |
| 18 | + |
| 19 | +add_executable(minimal ${CMAKE_CURRENT_SOURCE_DIR}/../examples/minimal.cpp) |
| 20 | +add_executable(basic ${CMAKE_CURRENT_SOURCE_DIR}/../examples/basic.cpp) |
| 21 | +add_executable(modern ${CMAKE_CURRENT_SOURCE_DIR}/../examples/modern.cpp) |
Collapse file
Copy file name to clipboard +8Lines changed: 8 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +### Configuring and Building Samples |
| 2 | + |
| 3 | +```cmd |
| 4 | +> cd Win |
| 5 | +> Win\build_win.cmd |
| 6 | +``` |
| 7 | + |
| 8 | +The `build_win.cmd` will set up temporal ENV variables and build binaries in (matplotlib root)/examples with the Release configuration. |
Collapse file
Copy file name to clipboard +46Lines changed: 46 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +@echo off |
| 2 | +@setlocal EnableDelayedExpansion |
| 3 | + |
| 4 | +if NOT DEFINED MSVC_VERSION set MSVC_VERSION=14 |
| 5 | +if NOT DEFINED CMAKE_CONFIG set CMAKE_CONFIG=Release |
| 6 | +if NOT DEFINED PYTHONHOME set PYTHONHOME=C:/Users/%username%/Anaconda3 |
| 7 | + |
| 8 | +if "%MSVC_VERSION%"=="14" ( |
| 9 | + if "%processor_architecture%" == "AMD64" ( |
| 10 | + set CMAKE_GENERATOR=Visual Studio 14 2015 Win64 |
| 11 | + ) else ( |
| 12 | + set CMAKE_GENERATOR=Visual Studio 14 2015 |
| 13 | + ) |
| 14 | +) else if "%MSVC_VERSION%"=="12" ( |
| 15 | + if "%processor_architecture%" == "AMD64" ( |
| 16 | + set CMAKE_GENERATOR=Visual Studio 12 2013 Win64 |
| 17 | + |
| 18 | + ) else ( |
| 19 | + set CMAKE_GENERATOR=Visual Studio 12 2013 |
| 20 | + ) |
| 21 | +) |
| 22 | + |
| 23 | +set batch_file=!VS%MSVC_VERSION%0COMNTOOLS!..\..\VC\vcvarsall.bat |
| 24 | +call "%batch_file%" %processor_architecture% |
| 25 | + |
| 26 | +pushd .. |
| 27 | +pushd examples |
| 28 | +if NOT EXIST build mkdir build |
| 29 | +pushd build |
| 30 | + |
| 31 | +cmake -G"!CMAKE_GENERATOR!" ^ |
| 32 | + -DPYTHONHOME:STRING=%PYTHONHOME%^ |
| 33 | + -DCMAKE_BUILD_TYPE:STRING=%CMAKE_CONFIG% ^ |
| 34 | + ../../Win/ |
| 35 | +cmake --build . --config %CMAKE_CONFIG% |
| 36 | + |
| 37 | +pushd %CMAKE_CONFIG% |
| 38 | +if not EXIST platforms mkdir platforms |
| 39 | +if EXIST %PYTHONHOME%/Library/plugins/platforms/qwindows.dll ^ |
| 40 | +cp %PYTHONHOME%/Library/plugins/platforms/qwindows.dll ./platforms/ |
| 41 | +popd |
| 42 | +move ./%CMAKE_CONFIG% ../ |
| 43 | +popd |
| 44 | +popd |
| 45 | +popd |
| 46 | +@endlocal |
Collapse file
Copy file name to clipboardExpand all lines: examples/basic.cpp +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
1 | | -#include "../matplotlibcpp.h" |
2 | | - |
| 1 | +#define _USE_MATH_DEFINES |
3 | 2 | #include <cmath> |
| 3 | +#include "../matplotlibcpp.h" |
4 | 4 |
|
5 | 5 | namespace plt = matplotlibcpp; |
6 | 6 |
|
|
Collapse file
Copy file name to clipboardExpand all lines: examples/modern.cpp +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
1 | | -#include "../matplotlibcpp.h" |
2 | | - |
| 1 | +#define _USE_MATH_DEFINES |
3 | 2 | #include <cmath> |
| 3 | +#include "../matplotlibcpp.h" |
4 | 4 |
|
5 | 5 | using namespace std; |
6 | 6 | namespace plt = matplotlibcpp; |
|
Collapse file
Copy file name to clipboardExpand all lines: matplotlibcpp.h +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
6 | 6 | #include <stdexcept> |
7 | 7 | #include <iostream> |
8 | 8 |
|
9 | | -#if __cplusplus > 199711L |
| 9 | +#if __cplusplus > 199711L || _MSC_VER > 1800 |
10 | 10 | #include <functional> |
11 | 11 | #endif |
12 | 12 |
|
@@ -583,7 +583,7 @@ namespace matplotlibcpp { |
583 | 583 | Py_DECREF(res); |
584 | 584 | } |
585 | 585 |
|
586 | | -#if __cplusplus > 199711L |
| 586 | +#if __cplusplus > 199711L || _MSC_VER > 1800 |
587 | 587 | // C++11-exclusive content starts here (variadic plot() and initializer list support) |
588 | 588 |
|
589 | 589 | namespace detail { |
|