diff --git a/docs/python_api/examples/renderdoc_intro.rst b/docs/python_api/examples/renderdoc_intro.rst
index 701e0f044..e37566880 100644
--- a/docs/python_api/examples/renderdoc_intro.rst
+++ b/docs/python_api/examples/renderdoc_intro.rst
@@ -14,7 +14,7 @@ For this section we assume you have built a copy of RenderDoc and have the modul
.. note::
- You must use exactly the same version of python to load the module as was used to build it. On Windows the version of python that comes with the repository and is used by default is python 3.6.
+ You must use exactly the same version of python to load the module as was used to build it. On Windows the version of python that comes with the repository and is used by default is python 3.6. This can be overridden at build time by setting the environment variable `RENDERDOC_PYTHON_PREFIX32` or `RENDERDOC_PYTHON_PREFIX64` to the path of a compatible python install. NOTE that the embedded zip distribution doesn't come with python38.lib which is necessary, so you must regenerate it or get it from the installed python. The installed python folder doesn't come with a python38.zip standard library bundle which you'd need to create or get from the embedded zip distribution.
Once you have the module, either place the module within your python's default library search path, or else insert the location of the python module into the path in your script. You can either set the ``PYTHONPATH`` environment variable or do it at the start of your script:
@@ -25,14 +25,16 @@ Once you have the module, either place the module within your python's default l
sys.path.append('/path/to/renderdoc/module')
-Additionally, the renderdoc python module needs to be able to load the main renderdoc library - the module library it self just contains stubs and python wrappers for the C++ interfaces. You can either place the renderdoc library in the system library paths, or solve it in a platform specific way. For example on windows you can either place ``renderdoc.dll`` in the same directory as the python module, or append to ``PATH``:
+Additionally, the renderdoc python module needs to be able to load the main renderdoc library - the module library it self just contains stubs and python wrappers for the C++ interfaces. You can either place the renderdoc library in the system library paths, or solve it in a platform specific way. For example on windows you can either place ``renderdoc.dll`` in the same directory as the python module, or append to ``PATH``. On Python 3.8 and above ``PATH`` is no longer searched by default so you need to explicitly add the DLL folder:
.. highlight:: python
.. code:: python
- import os
+ import os, sys
os.environ["PATH"] += os.pathsep + os.path.abspath('/path/to/renderdoc/native/library')
+ if sys.platform == 'win32' and sys.version_info[1] >= 8:
+ os.add_dll_directory("/path/to/renderdoc/native/library")
On linux you'd perform a similar modification to ``LD_LIBRARY_PATH``.
diff --git a/docs/python_api/index.rst b/docs/python_api/index.rst
index 45ac58274..659906688 100644
--- a/docs/python_api/index.rst
+++ b/docs/python_api/index.rst
@@ -8,9 +8,9 @@ RenderDoc exposes APIs to python at two different levels:
Within RenderDoc - when either running scripts on the command line, or via the :doc:`../window/python_shell` - both modules are pre-imported and available automatically.
-It is also possible to build the ``renderdoc`` module standalone which can be loaded into python and used for scripting directly without the UI program. Due to the inherent difficulty of distributing C python modules this isn't included by default in distributed builds at the time of writing, but is generated by default in source builds - ``renderdoc.pyd`` on windows or ``renderdoc.so`` elsewhere.
+It is also possible to build the ``renderdoc`` module standalone which can be loaded into python and used for scripting directly without the UI program. Due to the inherent difficulty of distributing C python modules this isn't included by default in distributed builds at the time of writing, but is generated by default in source builds - ``renderdoc.pyd`` on windows or ``renderdoc.so`` elsewhere. Use of this module is strictly a convenience and is not supported.
-You must use exactly the same version of python to load the module as was used to build it. On Windows the version of python that comes with the repository and is used by default is python 3.6.
+You must use exactly the same version of python to load the module as was used to build it. On Windows the version of python that comes with the repository and is used by default is python 3.6. This can be overridden at build time by setting the environment variable `RENDERDOC_PYTHON_PREFIX32` or `RENDERDOC_PYTHON_PREFIX64` to the path of a compatible python install. NOTE that the embedded zip distribution doesn't come with python38.lib which is necessary, so you must regenerate it or get it from the installed python. The installed python folder doesn't come with a python38.zip standard library bundle which you'd need to create or get from the embedded zip distribution.
.. note::
diff --git a/qrenderdoc/Code/pyrenderdoc/pyrenderdoc_module.vcxproj b/qrenderdoc/Code/pyrenderdoc/pyrenderdoc_module.vcxproj
index 6f5ce368b..be3775877 100644
--- a/qrenderdoc/Code/pyrenderdoc/pyrenderdoc_module.vcxproj
+++ b/qrenderdoc/Code/pyrenderdoc/pyrenderdoc_module.vcxproj
@@ -26,6 +26,7 @@
+ DynamicLibraryfalse
@@ -95,13 +96,12 @@
truetrue/wd4100 /wd4512
- $(ProjectDir)..\..\;..\..\3rdparty\python\include;$(SolutionDir)\renderdoc\api\replay
+ $(ProjectDir)..\..\;$(PythonIncludeDir);$(SolutionDir)\renderdoc\api\replayWindowstrue
- ..\..\3rdparty\python\$(Platform);%(AdditionalLibraryDirectories)
- python36.lib;%(AdditionalDependencies)
+ $(PythonImportLib);%(AdditionalDependencies)true
diff --git a/qrenderdoc/Code/pyrenderdoc/python.props b/qrenderdoc/Code/pyrenderdoc/python.props
new file mode 100644
index 000000000..2a7599264
--- /dev/null
+++ b/qrenderdoc/Code/pyrenderdoc/python.props
@@ -0,0 +1,81 @@
+
+
+
+
+ $(SolutionDir)\qrenderdoc\3rdparty\python
+
+ 0
+
+
+ 36
+
+ $(PythonBase)\include
+ $(PythonBase)\$(Platform)\python$(PythonMajorMinor).lib
+ $(PythonBase)\python$(PythonMajorMinor).zip
+ $(PythonBase)\$(Platform)
+ $(PythonBase)\$(Platform)\python$(PythonMajorMinor).dll
+
+
+
+
+
+
+
+
+ $(RENDERDOC_PYTHON_PREFIX32)
+ $(RENDERDOC_PYTHON_PREFIX64)
+
+
+38
+$(PythonMajorMinorTest)
+
+37
+$(PythonMajorMinorTest)
+
+36
+$(PythonMajorMinorTest)
+
+35
+$(PythonMajorMinorTest)
+
+34
+$(PythonMajorMinorTest)
+
+
+ $(PythonOverride)
+
+ $(CustomPythonUsed)
+
+
+ $(PythonBase)\include
+ $(PythonBase)\python$(PythonMajorMinor).zip
+ $(PythonBase)\python$(PythonMajorMinor).dll
+
+
+ $(PythonBase)
+ $(PythonBase)\DLLs
+ $(PythonBase)\python$(PythonMajorMinor).lib
+ $(PythonBase)\libs\python$(PythonMajorMinor).lib
+
+
+
+
+
+
+
diff --git a/qrenderdoc/Code/pyrenderdoc/qrenderdoc_module.vcxproj b/qrenderdoc/Code/pyrenderdoc/qrenderdoc_module.vcxproj
index 8f3d4205f..66107c231 100644
--- a/qrenderdoc/Code/pyrenderdoc/qrenderdoc_module.vcxproj
+++ b/qrenderdoc/Code/pyrenderdoc/qrenderdoc_module.vcxproj
@@ -26,6 +26,7 @@
+ DynamicLibraryfalse
@@ -75,15 +76,14 @@
truetrue/wd4100 /wd4512 /wd4127
- $(ProjectDir)..\..\;..\..\3rdparty\python\include;$(SolutionDir)\renderdoc\api\replay
+ $(ProjectDir)..\..\;$(PythonIncludeDir);$(SolutionDir)\renderdoc\api\replay4714;%(DisableSpecificWarnings)WindowstrueDefault
- ..\..\3rdparty\python\$(Platform);%(AdditionalLibraryDirectories)
- python36.lib;%(AdditionalDependencies)
+ $(PythonImportLib);%(AdditionalDependencies)true
diff --git a/qrenderdoc/qrenderdoc_local.vcxproj b/qrenderdoc/qrenderdoc_local.vcxproj
index 5c604c29c..138fe01af 100644
--- a/qrenderdoc/qrenderdoc_local.vcxproj
+++ b/qrenderdoc/qrenderdoc_local.vcxproj
@@ -34,6 +34,7 @@
+ v140$(SolutionDir)$(Platform)\$(Configuration)\
@@ -103,7 +104,7 @@
ProgramDatabasetruetrue
- $(ProjectDir);3rdparty;$(IntDir)generated\;$(SolutionDir)\renderdoc\api\replay;3rdparty\python\include;3rdparty\pyside\include\PySide2;3rdparty\pyside\include\shiboken2;$(QtIncludeDir);$(QtIncludeDir)\QtWidgets;$(QtIncludeDir)\QtGui;$(QtIncludeDir)\QtCore;$(QtIncludeDir)\QtSvg;$(QtIncludeDir)\QtNetwork;%(AdditionalIncludeDirectories)
+ $(ProjectDir);3rdparty;$(IntDir)generated\;$(SolutionDir)\renderdoc\api\replay;$(PythonIncludeDir);3rdparty\pyside\include\PySide2;3rdparty\pyside\include\shiboken2;$(QtIncludeDir);$(QtIncludeDir)\QtWidgets;$(QtIncludeDir)\QtGui;$(QtIncludeDir)\QtCore;$(QtIncludeDir)\QtSvg;$(QtIncludeDir)\QtNetwork;%(AdditionalIncludeDirectories)/Zc:strictStrings /Zc:throwingNew %(AdditionalOptions)_WINDOWS;UNICODE;WIN32;WIN64;RENDERDOC_PLATFORM_WIN32;SCINTILLA_QT=1;MAKING_LIBRARY=1;SCI_LEXER=1;QT_NO_CAST_FROM_ASCII;QT_NO_CAST_TO_ASCII;QT_WIDGETS_LIB;QT_GUI_LIB;QT_CORE_LIB;QT_SVG_LIB;%(PreprocessorDefinitions)Level4
@@ -116,8 +117,8 @@
Windows
- user32.lib;python36.lib;qtmain.lib;Qt5Widgets.lib;Qt5Gui.lib;Qt5Core.lib;Qt5Svg.lib;Qt5Network.lib;shell32.lib
- 3rdparty\pyside\$(Platform);3rdparty\python\$(Platform);$(QtLibDir);%(AdditionalLibraryDirectories)
+ user32.lib;$(PythonImportLib);qtmain.lib;Qt5Widgets.lib;Qt5Gui.lib;Qt5Core.lib;Qt5Svg.lib;Qt5Network.lib;shell32.lib
+ 3rdparty\pyside\$(Platform);$(QtLibDir);%(AdditionalLibraryDirectories)truetruetrue
@@ -146,7 +147,7 @@
user32.lib;python36.lib;qtmaind.lib;Qt5Widgetsd.lib;Qt5Guid.lib;Qt5Cored.lib;Qt5Svgd.lib;Qt5Networkd.lib;shell32.lib
-
+ PYSIDE2_ENABLED=1;%(PreprocessorDefinitions)
@@ -154,7 +155,7 @@
shiboken2.lib;%(AdditionalDependencies)
-
+ PYSIDE2_ENABLED=0;%(PreprocessorDefinitions)
@@ -1702,18 +1703,18 @@ IF %ERRORLEVEL% NEQ 0 (echo ====================================================
-
- python36.zip
+
+ python$(PythonMajorMinor).zip
PreserveNewestfalse
-
+
_ctypes.pyd
PreserveNewestfalse
-
- python36.dll
+
+ python$(PythonMajorMinor).dll
PreserveNewestfalse
diff --git a/util/test/run_tests.py b/util/test/run_tests.py
index 669496d49..c6da4b2b4 100644
--- a/util/test/run_tests.py
+++ b/util/test/run_tests.py
@@ -44,11 +44,15 @@ args = parser.parse_args()
if args.renderdoc is not None:
if os.path.isfile(args.renderdoc):
- os.environ["PATH"] += os.pathsep + os.path.abspath(os.path.dirname(args.renderdoc))
+ renderdoc_dirpath = os.path.abspath(os.path.dirname(args.renderdoc))
elif os.path.isdir(args.renderdoc):
- os.environ["PATH"] += os.pathsep + os.path.abspath(args.renderdoc)
+ renderdoc_dirpath = os.path.abspath(args.renderdoc)
else:
raise RuntimeError("'{}' is not a valid path to the renderdoc library".format(args.renderdoc))
+ os.environ["PATH"] += os.pathsep + renderdoc_dirpath
+ # Python 3.8 doesn't search PATH so add it to the DLL search path
+ if sys.platform == 'win32' and sys.version_info[1] >= 8:
+ os.add_dll_directory(renderdoc_dirpath)
custom_pyrenderdoc = None