Page MenuHome
Paste P603

(An Untitled Masterwork)
ActivePublic

Authored by LazyDodo (LazyDodo) on Feb 4 2018, 5:24 PM.
CMakeLists.txt | 4 ++++
build_files/cmake/platform/platform_win32.cmake | 20 ++++++++++++++++++++
source/blender/blenkernel/intern/appdir.c | 8 ++++----
source/creator/CMakeLists.txt | 19 +++++++++++++++++++
4 files changed, 47 insertions(+), 4 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5c4ce5030ac..1a52c6342d1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -547,6 +547,10 @@ if(WIN32)
option(WINDOWS_USE_VISUAL_STUDIO_FOLDERS "Organize the visual studio project according to source folders." ON)
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()
# avoid using again
diff --git a/build_files/cmake/platform/platform_win32.cmake b/build_files/cmake/platform/platform_win32.cmake
index ef3ef7b6517..2c7edd344d7 100644
--- a/build_files/cmake/platform/platform_win32.cmake
+++ b/build_files/cmake/platform/platform_win32.cmake
@@ -581,3 +581,23 @@ if(WITH_CYCLES_OSL)
set(WITH_CYCLES_OSL OFF)
endif()
endif()
+
+if (WINDOWS_PYTHON_DEBUG)
+ FILE(GLOB_RECURSE inFiles "${CMAKE_SOURCE_DIR}/release/scripts/*.*" )
+ ADD_CUSTOM_TARGET(blender_python_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()
+
+ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/blender.Cpp.user.props" "<?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>
+ <LocalDebuggerEnvironment>BLENDER_SYSTEM_SCRIPTS=${CMAKE_SOURCE_DIR}/release/scripts</LocalDebuggerEnvironment>
+ </PropertyGroup>
+</Project>")
+endif()
+
diff --git a/source/blender/blenkernel/intern/appdir.c b/source/blender/blenkernel/intern/appdir.c
index 8d4776dca0e..c72fd69b450 100644
--- a/source/blender/blenkernel/intern/appdir.c
+++ b/source/blender/blenkernel/intern/appdir.c
@@ -399,8 +399,8 @@ const char *BKE_appdir_folder_id_ex(
switch (folder_id) {
case BLENDER_DATAFILES: /* general case */
if (get_path_user(path, path_len, "datafiles", subfolder, "BLENDER_USER_DATAFILES", ver)) break;
- if (get_path_local(path, path_len, "datafiles", subfolder, ver)) break;
if (get_path_system(path, path_len, "datafiles", subfolder, "BLENDER_SYSTEM_DATAFILES", ver)) break;
+ if (get_path_local(path, path_len, "datafiles", subfolder, ver)) break;
return NULL;
case BLENDER_USER_DATAFILES:
@@ -408,8 +408,8 @@ const char *BKE_appdir_folder_id_ex(
return NULL;
case BLENDER_SYSTEM_DATAFILES:
- if (get_path_local(path, path_len, "datafiles", subfolder, ver)) break;
if (get_path_system(path, path_len, "datafiles", subfolder, "BLENDER_SYSTEM_DATAFILES", ver)) break;
+ if (get_path_local(path, path_len, "datafiles", subfolder, ver)) break;
return NULL;
case BLENDER_USER_AUTOSAVE:
@@ -425,13 +425,13 @@ const char *BKE_appdir_folder_id_ex(
return NULL;
case BLENDER_SYSTEM_SCRIPTS:
- if (get_path_local(path, path_len, "scripts", subfolder, ver)) break;
if (get_path_system(path, path_len, "scripts", subfolder, "BLENDER_SYSTEM_SCRIPTS", ver)) break;
+ if (get_path_local(path, path_len, "scripts", subfolder, ver)) break;
return NULL;
case BLENDER_SYSTEM_PYTHON:
- if (get_path_local(path, path_len, "python", subfolder, ver)) break;
if (get_path_system(path, path_len, "python", subfolder, "BLENDER_SYSTEM_PYTHON", ver)) break;
+ if (get_path_local(path, path_len, "python", subfolder, ver)) break;
return NULL;
default:
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index bcb0a7a7d1d..22af92ab0a7 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -653,6 +653,20 @@ elseif(WIN32)
DESTINATION "."
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()
if(WITH_PYTHON_INSTALL)
@@ -1024,4 +1038,9 @@ if(WIN32 AND NOT WITH_PYTHON_MODULE)
COMPONENT Blender
DESTINATION "."
)
+ set_target_properties(
+ blender
+ PROPERTIES
+ VS_USER_PROPS "blender.Cpp.user.props"
+ )
endif()