diff --git a/README_VS_WIN.md b/README_VS_WIN.md new file mode 100644 index 00000000..7a7808f9 --- /dev/null +++ b/README_VS_WIN.md @@ -0,0 +1,15 @@ +Steps to setup the matplotlib-cpp for VS2022 (should also work VS2019, VS2017) for WIN + +1) clone the this repo +2) install the latest python (https://www.python.org/downloads/), for example, here is the patch for my installation C:\Users\yudan\AppData\Local\Programs\Python\Python310\ +3) install numpy => pip install numpy +4) add python and numpy path to your VS project + +C:\Users\yudan\AppData\Local\Programs\Python\Python310\Lib\site-packages\numpy\core\include;C:\Users\yudan\AppData\Local\Programs\Python\Python310\include; + +5) add python310.lib in the path and dependencies, note this only works for release build, need to find the python310_d.lib for debug version + +6) build the project + +You can just modify the matplotlib-cpp.vcxproj in the examples folder + diff --git a/examples/matplotlib-cpp.sln b/examples/matplotlib-cpp.sln new file mode 100644 index 00000000..48365fde --- /dev/null +++ b/examples/matplotlib-cpp.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32319.34 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "matplotlib-cpp", "matplotlib-cpp.vcxproj", "{0721A463-993A-458F-BD76-3E6A768FE5D8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0721A463-993A-458F-BD76-3E6A768FE5D8}.Debug|x64.ActiveCfg = Debug|x64 + {0721A463-993A-458F-BD76-3E6A768FE5D8}.Debug|x64.Build.0 = Debug|x64 + {0721A463-993A-458F-BD76-3E6A768FE5D8}.Debug|x86.ActiveCfg = Debug|Win32 + {0721A463-993A-458F-BD76-3E6A768FE5D8}.Debug|x86.Build.0 = Debug|Win32 + {0721A463-993A-458F-BD76-3E6A768FE5D8}.Release|x64.ActiveCfg = Release|x64 + {0721A463-993A-458F-BD76-3E6A768FE5D8}.Release|x64.Build.0 = Release|x64 + {0721A463-993A-458F-BD76-3E6A768FE5D8}.Release|x86.ActiveCfg = Release|Win32 + {0721A463-993A-458F-BD76-3E6A768FE5D8}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3EB9E829-F1AE-409E-878B-8B6565A07F2C} + EndGlobalSection +EndGlobal diff --git a/examples/matplotlib-cpp.vcxproj b/examples/matplotlib-cpp.vcxproj new file mode 100644 index 00000000..4458efe1 --- /dev/null +++ b/examples/matplotlib-cpp.vcxproj @@ -0,0 +1,181 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + + + + + + 16.0 + {0721A463-993A-458F-BD76-3E6A768FE5D8} + Win32Proj + test + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + C:\Users\yudan\AppData\Local\Programs\Python\Python310\Lib\site-packages\numpy\core\include;C:\Users\yudan\AppData\Local\Programs\Python\Python310\include;$(IncludePath) + $(SourcePath) + + + true + C:\Users\yudan\AppData\Local\Programs\Python\Python310\Lib\site-packages\numpy\core\include;C:\Users\yudan\AppData\Local\Programs\Python\Python310\include;$(IncludePath) + $(SourcePath) + + + false + C:\Users\yudan\AppData\Local\Programs\Python\Python310\Lib\site-packages\numpy\core\include;C:\Users\yudan\AppData\Local\Programs\Python\Python310\include;$(IncludePath) + $(SourcePath) + + + false + C:\Users\yudan\AppData\Local\Programs\Python\Python310\Lib\site-packages\numpy\core\include;C:\Users\yudan\AppData\Local\Programs\Python\Python310\include;$(IncludePath) + $(SourcePath) + + + + + + Level3 + true + _CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + + + Console + true + python310.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + C:\Users\yudan\AppData\Local\Programs\Python\Python310\libs + + + + + + + Level3 + true + _CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + + + Console + true + python310.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + C:\Users\yudan\AppData\Local\Programs\Python\Python310\libs + + + + + + + Level3 + true + true + true + _CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + + + Console + true + true + true + python310.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + C:\Users\yudan\AppData\Local\Programs\Python\Python310\libs + + + + + + + Level3 + true + true + true + _CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + + + Console + true + true + true + python310.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + C:\Users\yudan\AppData\Local\Programs\Python\Python310\libs + + + + + + \ No newline at end of file diff --git a/matplotlibcpp.h b/matplotlibcpp.h index d95d46ad..7ce4cc94 100644 --- a/matplotlibcpp.h +++ b/matplotlibcpp.h @@ -348,13 +348,14 @@ template <> struct select_npy_type { const static NPY_TYPES type = NPY template <> struct select_npy_type { const static NPY_TYPES type = NPY_ULONG; }; template <> struct select_npy_type { const static NPY_TYPES type = NPY_UINT64; }; +#ifndef _WIN32 // Sanity checks; comment them out or change the numpy type below if you're compiling on // a platform where they don't apply static_assert(sizeof(long long) == 8); template <> struct select_npy_type { const static NPY_TYPES type = NPY_INT64; }; static_assert(sizeof(unsigned long long) == 8); template <> struct select_npy_type { const static NPY_TYPES type = NPY_UINT64; }; - +#endif template PyObject* get_array(const std::vector& v) {