matplotlib-cpp icon indicating copy to clipboard operation
matplotlib-cpp copied to clipboard

M1 Mac, Monterey, Python 3.10 and XCode Notes

Open cyberabi opened this issue 3 years ago • 0 comments

These can be documentation updates and / or code updates based on what you think.

Python and MatPlotLib Install:

  • Installed Python 3.10 from python.org rather than using brew
  • numpy and development header installation was included as part of this install

CMake / Make:

  • To get a clean build I had to comment out both template lines in the sanity checks in matplotlibcpp.h @353-356
  • To get rid of a C++17 warning I had to modify both static_assert lines in the sanity checks to include a text message in matplotlibcpp.h @353-356
  • With these changes the build completed fine, and examples ran fine on the M1 Mac, Montery, Python 3.10 and XCode

XCode Integration:

  • Under the Signing & Capabilities tab, Signing -> Signing Certificate, select Development
  • Under the Signing & Capabilities tab, Hardened Runtime -> Runtime Exceptions, check Disable Library Validation
  • Under the Build Settings tab, Search Paths -> Header Search Paths, add a path to your matplotlib-cpp install, e.g. $(PROJECT_DIR)/../matplotlib-cpp/
  • Under the Build Settings tab, Search Paths -> Library Search Paths, add a path to your Python install, e.g. $(LOCAL_LIBRARY_DIR)/Frameworks/Python.framework/Versions/3.10/lib
  • Under the Build Settings tab, Search Paths -> System Header Search Paths, add paths to your Python and numpy installs, e.g. /Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 and /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/core/include
  • Under the Build Phases tab, Link Binary with Libraries, add the Python library based on its install path, e.g. /Library/Frameworks/Python.framework/Versions/3.10/Python
  • With these changes I was able to copy/paste the code from minimal.cpp into my XCode project and build / run it

cyberabi avatar Jul 31 '22 07:07 cyberabi