1. Integracja C++ i Python w Visual Studio 2019
1.1 pobrać wersję Python 3.10.1, installer 64-bit
1.2 custom installation -> next
1.3 check 'Download debug binaries (req VS 2017) -> install
1.4 w ścieżce projektu dodać foldery i pliki
C:\Users\*user*\source\repos\*project*\*project*\external\python
inlcude, libs, dlls
dlls -> python3.dll, python3_d.dll, python310.dll, python310_d.dll
C:\Users\*user*\source\repos\*project*\*project*\python_modules
my_module.py
1.5 w projekcie VS dodać plik python_modules do plików źródłowych do filtru python_modules
2. Opcje projektu
2.1 VC++ Directories -> All Configurations -> All Platforms -> Include Directories:
$(ProjectDir)external\python\include
2.2 VC++ Directories -> All Configurations -> All Platforms -> Library Directories:
$(ProjectDir)external\python\libs
2.3 Build Events -> Post-Build Event -> All Configurations -> All Platforms -> Description:
Copy necessary runtime files
2.4 Build Events -> Post-Build Event -> All Configurations -> All Platforms -> Command Line:
xcopy /y /d "$(ProjectDir)external\python\dlls\*.dll" "$(OutDir)"
xcopy /y /d /I "$(ProjectDir)python_modules\*.py" "$(OutDir)python_modules"