[Lldb-commits] [lldb] r213306 - Create an _d suffixed symlink when doing a debug Windows build.

Zachary Turner zturner at google.com
Thu Jul 17 13:36:14 PDT 2014


Author: zturner
Date: Thu Jul 17 15:36:14 2014
New Revision: 213306

URL: http://llvm.org/viewvc/llvm-project?rev=213306&view=rev
Log:
Create an _d suffixed symlink when doing a debug Windows build.

_lldb is built as an extension module on Windows.  Normally to load
an extension module named 'foo', Python would look for the file
'foo.pyd'.  However, when a debug interpreter is used, Python will
look for the file 'foo_d.pyd'.  This change checks the build
configuration and creates the correct symlink name based on the
build configuration.

Modified:
    lldb/trunk/scripts/CMakeLists.txt
    lldb/trunk/scripts/Python/finishSwigPythonLLDB.py
    lldb/trunk/scripts/finishSwigWrapperClasses.py
    lldb/trunk/source/CMakeLists.txt

Modified: lldb/trunk/scripts/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/CMakeLists.txt?rev=213306&r1=213305&r2=213306&view=diff
==============================================================================
--- lldb/trunk/scripts/CMakeLists.txt (original)
+++ lldb/trunk/scripts/CMakeLists.txt Thu Jul 17 15:36:14 2014
@@ -18,14 +18,6 @@ if ( LLDB_ENABLE_PYTHON_SCRIPTS_SWIG_API
 
 	# Install the LLDB python module on all operating systems
 	install(SCRIPT lldb_python_module.cmake -DCMAKE_INSTALL_PREFIX=\"${CMAKE_INSTALL_PREFIX}\" -DCMAKE_BUILD_DIR=\"${CMAKE_BUILD_DIR}\")
-
-	# Add a Post-Build Event to copy over Python files and create the symlink to liblldb.so for the Python API(hardlink on Windows)
-	add_custom_command( TARGET liblldb
-	  POST_BUILD
-	  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/finishSwigWrapperClasses.py
-	  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/Python/finishSwigPythonLLDB.py
-	  COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/finishSwigWrapperClasses.py -d "--srcRoot=${LLDB_SOURCE_DIR}" "--targetDir=${CMAKE_CURRENT_BINARY_DIR}" "--cfgBldDir=${CMAKE_CURRENT_BINARY_DIR}" "--prefix=${CMAKE_BINARY_DIR}" "--cmakeBuildConfiguration=${CMAKE_CFG_INTDIR}" -m
-	  COMMENT "Python script sym-linking LLDB Python API")
 else ()
 	add_custom_command(
 	  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapPython.cpp

Modified: lldb/trunk/scripts/Python/finishSwigPythonLLDB.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/finishSwigPythonLLDB.py?rev=213306&r1=213305&r2=213306&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/finishSwigPythonLLDB.py (original)
+++ lldb/trunk/scripts/Python/finishSwigPythonLLDB.py Thu Jul 17 15:36:14 2014
@@ -235,7 +235,13 @@ def make_symlink_windows( vDictArgs, vst
 	strMsg = "";
 
 	bDbg = vDictArgs.has_key( "-d" );
-	strTarget = vstrDllName + ".pyd";
+	strTarget = vstrDllName;
+	# When importing an extension module using a debug version of python, you
+	# write, for example, "import foo", but the interpreter searches for
+	# "foo_d.pyd"
+	if vDictArgs["--buildConfig"].lower() == "debug":
+		strTarget += "_d";
+	strTarget += ".pyd";
 	strDLLPath = "%s\\%s" % (vstrFrameworkPythonDir, strTarget);
 	strTarget = os.path.normcase( strDLLPath );
 	strSrc = "";
@@ -525,6 +531,7 @@ def get_framework_python_dir( vDictArgs
 			-m (optional) 	Specify called from Makefile system. If given locate
 							the LLDBWrapPython.cpp in --srcRoot/source folder 
 							else in the	--targetDir folder.
+			--buildConfig	The LLDB build configuration (e.g. debug/release).
 			--srcRoot		The root of the lldb source tree.
 			--targetDir 	Where the lldb framework/shared library gets put.
 			--cfgBlddir 	Where the buildSwigPythonLLDB.py program will 

Modified: lldb/trunk/scripts/finishSwigWrapperClasses.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/finishSwigWrapperClasses.py?rev=213306&r1=213305&r2=213306&view=diff
==============================================================================
--- lldb/trunk/scripts/finishSwigWrapperClasses.py (original)
+++ lldb/trunk/scripts/finishSwigWrapperClasses.py Thu Jul 17 15:36:14 2014
@@ -165,13 +165,14 @@ def validate_arguments( vArgv ):
 	nResult = 0;
 	strListArgs = "hdm"; # Format "hiox:" = -h -i -o -x <arg>
 	listLongArgs = ["srcRoot=", "targetDir=", "cfgBldDir=", "prefix=", "cmakeBuildConfiguration=",
-					"argsFile"];
+					"argsFile", "buildConfig="];
 	dictArgReq = {	"-h": "o",			# o = optional, m = mandatory
 					"-d": "o",
 					"-m": "o",
 					"--srcRoot": "m",
 					"--targetDir": "m",
 					"--cfgBldDir": "o",
+					"--buildConfig": "m",
 					"--prefix": "o",
 					"--cmakeBuildConfiguration": "o",
 					"--argsFile": "o" };

Modified: lldb/trunk/source/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/CMakeLists.txt?rev=213306&r1=213305&r2=213306&view=diff
==============================================================================
--- lldb/trunk/source/CMakeLists.txt (original)
+++ lldb/trunk/source/CMakeLists.txt Thu Jul 17 15:36:14 2014
@@ -335,7 +335,7 @@ if ( LLDB_ENABLE_PYTHON_SCRIPTS_SWIG_API
 	    add_custom_command( TARGET liblldb
 	        POST_BUILD
             DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/finishSwigWrapperClasses.py
-	        COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/finishSwigWrapperClasses.py "--srcRoot=${LLDB_SOURCE_DIR}" "--targetDir=${CMAKE_CURRENT_BINARY_DIR}/../scripts" "--cfgBldDir=${CMAKE_CURRENT_BINARY_DIR}/../scripts" "--prefix=${CMAKE_BINARY_DIR}" "--cmakeBuildConfiguration=${CMAKE_CFG_INTDIR}" -m
+	        COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/finishSwigWrapperClasses.py --buildConfig=${CMAKE_BUILD_TYPE} "--srcRoot=${LLDB_SOURCE_DIR}" "--targetDir=${CMAKE_CURRENT_BINARY_DIR}/../scripts" "--cfgBldDir=${CMAKE_CURRENT_BINARY_DIR}/../scripts" "--prefix=${CMAKE_BINARY_DIR}" "--cmakeBuildConfiguration=${CMAKE_CFG_INTDIR}" -m
 	        COMMENT "Python script sym-linking LLDB Python API")
 	endif ()
 endif ()





More information about the lldb-commits mailing list