Windows: Enable python debugging in Visual Studio.
see D3817 for technical details, and https://wiki.blender.org/wiki/Tools/Debugging/Python_Visual_Studio for a end user quick-start guide. Differential Revision: https://developer.blender.org/D3817
This commit is contained in:
@@ -577,6 +577,9 @@ if(WIN32)
|
|||||||
|
|
||||||
option(WINDOWS_USE_VISUAL_STUDIO_FOLDERS "Organize the visual studio project according to source folders." ON)
|
option(WINDOWS_USE_VISUAL_STUDIO_FOLDERS "Organize the visual studio project according to source folders." ON)
|
||||||
mark_as_advanced(WINDOWS_USE_VISUAL_STUDIO_FOLDERS)
|
mark_as_advanced(WINDOWS_USE_VISUAL_STUDIO_FOLDERS)
|
||||||
|
|
||||||
|
option(WINDOWS_PYTHON_DEBUG "Include the files needed for debugging python scripts with visual studio 2017+." OFF)
|
||||||
|
mark_as_advanced(WINDOWS_PYTHON_DEBUG)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# avoid using again
|
# avoid using again
|
||||||
|
@@ -1195,7 +1195,11 @@ function(delayed_do_install
|
|||||||
foreach(i RANGE ${n})
|
foreach(i RANGE ${n})
|
||||||
list(GET files ${i} f)
|
list(GET files ${i} f)
|
||||||
list(GET destinations ${i} d)
|
list(GET destinations ${i} d)
|
||||||
install(FILES ${f} DESTINATION ${targetdir}/${d})
|
if(NOT IS_ABSOLUTE ${d})
|
||||||
|
install(FILES ${f} DESTINATION ${targetdir}/${d})
|
||||||
|
else()
|
||||||
|
install(FILES ${f} DESTINATION ${d})
|
||||||
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
@@ -607,3 +607,40 @@ if(WITH_CYCLES_OSL)
|
|||||||
set(WITH_CYCLES_OSL OFF)
|
set(WITH_CYCLES_OSL OFF)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (WINDOWS_PYTHON_DEBUG)
|
||||||
|
# Include the system scripts in the blender_python_system_scripts project.
|
||||||
|
FILE(GLOB_RECURSE inFiles "${CMAKE_SOURCE_DIR}/release/scripts/*.*" )
|
||||||
|
ADD_CUSTOM_TARGET(blender_python_system_scripts SOURCES ${inFiles})
|
||||||
|
foreach(_source IN ITEMS ${inFiles})
|
||||||
|
get_filename_component(_source_path "${_source}" PATH)
|
||||||
|
string(REPLACE "${CMAKE_SOURCE_DIR}/release/scripts/" "" _source_path "${_source_path}")
|
||||||
|
string(REPLACE "/" "\\" _group_path "${_source_path}")
|
||||||
|
source_group("${_group_path}" FILES "${_source}")
|
||||||
|
endforeach()
|
||||||
|
# Include the user scripts from the profile folder in the blender_python_user_scripts project.
|
||||||
|
set(USER_SCRIPTS_ROOT "$ENV{appdata}/blender foundation/blender/${BLENDER_VERSION}")
|
||||||
|
file(TO_CMAKE_PATH ${USER_SCRIPTS_ROOT} USER_SCRIPTS_ROOT)
|
||||||
|
FILE(GLOB_RECURSE inFiles "${USER_SCRIPTS_ROOT}/scripts/*.*" )
|
||||||
|
ADD_CUSTOM_TARGET(blender_python_user_scripts SOURCES ${inFiles})
|
||||||
|
foreach(_source IN ITEMS ${inFiles})
|
||||||
|
get_filename_component(_source_path "${_source}" PATH)
|
||||||
|
string(REPLACE "${USER_SCRIPTS_ROOT}/scripts" "" _source_path "${_source_path}")
|
||||||
|
string(REPLACE "/" "\\" _group_path "${_source_path}")
|
||||||
|
source_group("${_group_path}" FILES "${_source}")
|
||||||
|
endforeach()
|
||||||
|
set_target_properties(blender_python_system_scripts PROPERTIES FOLDER "scripts")
|
||||||
|
set_target_properties(blender_python_user_scripts PROPERTIES FOLDER "scripts")
|
||||||
|
# Set the default debugging options for the project, only write this file once so the user
|
||||||
|
# is free to override them at their own perril.
|
||||||
|
set(USER_PROPS_FILE "${CMAKE_CURRENT_BINARY_DIR}/source/creator/blender.Cpp.user.props")
|
||||||
|
if(NOT EXISTS ${USER_PROPS_FILE})
|
||||||
|
# Layout below is messy, because otherwise the generated file will look messy.
|
||||||
|
file(WRITE ${USER_PROPS_FILE} "<?xml version=\"1.0\" encoding=\"utf-8\"?>
|
||||||
|
<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">
|
||||||
|
<PropertyGroup>
|
||||||
|
<LocalDebuggerCommandArguments>-con --env-system-scripts \"${CMAKE_SOURCE_DIR}/release/scripts\" </LocalDebuggerCommandArguments>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
@@ -19,7 +19,11 @@ if "%WITH_CLANG%"=="1" (
|
|||||||
exit /b 1
|
exit /b 1
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -G "Visual Studio %BUILD_VS_VER% %BUILD_VS_YEAR%%WINDOWS_ARCH%" %TESTS_CMAKE_ARGS% %CLANG_CMAKE_ARGS% %ASAN_CMAKE_ARGS%
|
|
||||||
|
if "%WITH_PYDEBUG%"=="1" (
|
||||||
|
set PYDEBUG_CMAKE_ARGS=-DWINDOWS_PYTHON_DEBUG=On
|
||||||
|
)
|
||||||
|
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -G "Visual Studio %BUILD_VS_VER% %BUILD_VS_YEAR%%WINDOWS_ARCH%" %TESTS_CMAKE_ARGS% %CLANG_CMAKE_ARGS% %ASAN_CMAKE_ARGS% %PYDEBUG_CMAKE_ARGS%
|
||||||
|
|
||||||
if NOT EXIST %BUILD_DIR%\nul (
|
if NOT EXIST %BUILD_DIR%\nul (
|
||||||
mkdir %BUILD_DIR%
|
mkdir %BUILD_DIR%
|
||||||
|
@@ -64,6 +64,8 @@ if NOT "%1" == "" (
|
|||||||
shift /1
|
shift /1
|
||||||
) else if "%1" == "nobuild" (
|
) else if "%1" == "nobuild" (
|
||||||
set NOBUILD=1
|
set NOBUILD=1
|
||||||
|
) else if "%1" == "pydebug" (
|
||||||
|
set WITH_PYDEBUG=1
|
||||||
) else if "%1" == "showhash" (
|
) else if "%1" == "showhash" (
|
||||||
SET BUILD_SHOW_HASHES=1
|
SET BUILD_SHOW_HASHES=1
|
||||||
REM Non-Build Commands
|
REM Non-Build Commands
|
||||||
|
@@ -25,3 +25,5 @@ set WITH_CLANG=
|
|||||||
set WITH_ASAN=
|
set WITH_ASAN=
|
||||||
set CLANG_CMAKE_ARGS=
|
set CLANG_CMAKE_ARGS=
|
||||||
set ASAN_CMAKE_ARGS=
|
set ASAN_CMAKE_ARGS=
|
||||||
|
set WITH_PYDEBUG=
|
||||||
|
set PYDEBUG_CMAKE_ARGS=
|
||||||
|
@@ -3,7 +3,14 @@ if(NOT WITH_BLENDER AND WITH_CYCLES_STANDALONE)
|
|||||||
set(CYCLES_INSTALL_PATH "")
|
set(CYCLES_INSTALL_PATH "")
|
||||||
else()
|
else()
|
||||||
set(WITH_CYCLES_BLENDER ON)
|
set(WITH_CYCLES_BLENDER ON)
|
||||||
set(CYCLES_INSTALL_PATH "scripts/addons/cycles")
|
# WINDOWS_PYTHON_DEBUG needs to write into the user addons folder since it will
|
||||||
|
# be started with --env-system-scripts pointing to the release folder, which will
|
||||||
|
# lack the cycles addon, and we don't want to write into it.
|
||||||
|
if(NOT WINDOWS_PYTHON_DEBUG)
|
||||||
|
set(CYCLES_INSTALL_PATH "scripts/addons/cycles")
|
||||||
|
else()
|
||||||
|
set(CYCLES_INSTALL_PATH "$ENV{appdata}/blender foundation/blender/${BLENDER_VERSION}/scripts/addons/cycles")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# External Libraries
|
# External Libraries
|
||||||
|
@@ -753,6 +753,19 @@ elseif(WIN32)
|
|||||||
DESTINATION ${BLENDER_VERSION}/python/bin
|
DESTINATION ${BLENDER_VERSION}/python/bin
|
||||||
CONFIGURATIONS Debug
|
CONFIGURATIONS Debug
|
||||||
)
|
)
|
||||||
|
if(WINDOWS_PYTHON_DEBUG)
|
||||||
|
install(
|
||||||
|
FILES ${LIBDIR}/python/lib/python${_PYTHON_VERSION_NO_DOTS}.pdb
|
||||||
|
DESTINATION "."
|
||||||
|
CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel
|
||||||
|
)
|
||||||
|
|
||||||
|
install(
|
||||||
|
FILES ${LIBDIR}/python/lib/python${_PYTHON_VERSION_NO_DOTS}_d.pdb
|
||||||
|
DESTINATION "."
|
||||||
|
CONFIGURATIONS Debug
|
||||||
|
)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
unset(_PYTHON_VERSION_NO_DOTS)
|
unset(_PYTHON_VERSION_NO_DOTS)
|
||||||
@@ -1031,4 +1044,9 @@ if(WIN32 AND NOT WITH_PYTHON_MODULE)
|
|||||||
COMPONENT Blender
|
COMPONENT Blender
|
||||||
DESTINATION "."
|
DESTINATION "."
|
||||||
)
|
)
|
||||||
|
set_target_properties(
|
||||||
|
blender
|
||||||
|
PROPERTIES
|
||||||
|
VS_USER_PROPS "blender.Cpp.user.props"
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
Reference in New Issue
Block a user