[Lldb-commits] [lldb] r222262 - Find SWIG with CMake
Ismail Pazarbasi
ismail.pazarbasi at gmail.com
Tue Nov 18 13:46:07 PST 2014
Author: ismailp
Date: Tue Nov 18 15:46:06 2014
New Revision: 222262
URL: http://llvm.org/viewvc/llvm-project?rev=222262&view=rev
Log:
Find SWIG with CMake
SWIG is searched under certain paths within python script. CMake can
detect SWIG with find_package(SWIG). This is used iff user checks
LLDB_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION. If
buildSwigWrapperClasses.py does not receive swigExecutable argument,
then the script will use its current search implementation.
Modified:
lldb/trunk/scripts/CMakeLists.txt
lldb/trunk/scripts/buildSwigWrapperClasses.py
lldb/trunk/scripts/utilsArgsParse.py
Modified: lldb/trunk/scripts/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/CMakeLists.txt?rev=222262&r1=222261&r2=222262&view=diff
==============================================================================
--- lldb/trunk/scripts/CMakeLists.txt (original)
+++ lldb/trunk/scripts/CMakeLists.txt Tue Nov 18 15:46:06 2014
@@ -3,12 +3,13 @@ set(LLVM_NO_RTTI 1)
file(GLOB SWIG_INPUTS Python/interface/*.i)
if ( LLDB_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION )
+ find_package(SWIG REQUIRED)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapPython.cpp
DEPENDS ${LLDB_SOURCE_DIR}/scripts/lldb.swig
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/buildSwigWrapperClasses.py
- DEPENDS ${SWIG_INPUTS}
- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/buildSwigWrapperClasses.py "--srcRoot=${LLDB_SOURCE_DIR}" "--targetDir=${CMAKE_CURRENT_BINARY_DIR}" "--cfgBldDir=${CMAKE_CURRENT_BINARY_DIR}" "--prefix=${CMAKE_BINARY_DIR}" -m
+ DEPENDS ${SWIG_INPUTS}
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/buildSwigWrapperClasses.py "--srcRoot=${LLDB_SOURCE_DIR}" "--targetDir=${CMAKE_CURRENT_BINARY_DIR}" "--cfgBldDir=${CMAKE_CURRENT_BINARY_DIR}" "--prefix=${CMAKE_BINARY_DIR}" "--swigExecutable=${SWIG_EXECUTABLE}" -m
COMMENT "Python script building LLDB Python wrapper")
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapPython.cpp PROPERTIES GENERATED 1)
Modified: lldb/trunk/scripts/buildSwigWrapperClasses.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/buildSwigWrapperClasses.py?rev=222262&r1=222261&r2=222262&view=diff
==============================================================================
--- lldb/trunk/scripts/buildSwigWrapperClasses.py (original)
+++ lldb/trunk/scripts/buildSwigWrapperClasses.py Tue Nov 18 15:46:06 2014
@@ -85,10 +85,11 @@ Args: -h (optional) Print help informat
automatically. Python install directory.\n\
--argsFile= The args are read from a file instead of the\n\
command line. Other command line args are ignored.\n\
+ --swigExecutable= (optional) Full path of swig executable.\n\
\n\
Usage:\n\
buildSwigWrapperClasses.py --srcRoot=ADirPath --targetDir=ADirPath\n\
- --cfgBldDir=ADirPath --prefix=ADirPath -m -d\n\
+ --cfgBldDir=ADirPath --prefix=ADirPath --swigExecutable=ADirPath -m -d\n\
\n\
"; #TAG_PROGRAM_HELP_INFO
strHelpInfoExtraWindows = "\
@@ -425,17 +426,19 @@ def check_lldb_swig_executable_file_exis
dbg = utilsDebug.CDebugFnVerbose( "check_lldb_swig_executable_file_exists()" );
bExeFileFound = False;
strStatusMsg = "";
- from utilsOsType import EnumOsType;
-
- switch = { EnumOsType.Unknown : check_lldb_swig_executable_file_exists_Unknown,
+ if "--swigExecutable" in vDictArgs:
+ vDictArgs["--swigExeName"] = os.path.basename(vDictArgs["--swigExecutable"])
+ vDictArgs["--swigExePath"] = os.path.dirname(vDictArgs["--swigExecutable"])
+ bExeFileFound = True
+ else:
+ from utilsOsType import EnumOsType;
+ switch = { EnumOsType.Unknown : check_lldb_swig_executable_file_exists_Unknown,
EnumOsType.Darwin : check_lldb_swig_executable_file_exists_Darwin,
EnumOsType.FreeBSD : check_lldb_swig_executable_file_exists_FreeBSD,
EnumOsType.Linux : check_lldb_swig_executable_file_exists_Linux,
- EnumOsType.Windows : check_lldb_swig_executable_file_exists_Windows }
- bExeFileFound, strStatusMsg = switch[ veOSType ]( vDictArgs );
-
+ EnumOsType.Windows : check_lldb_swig_executable_file_exists_Windows }
+ bExeFileFound, strStatusMsg = switch[ veOSType ]( vDictArgs );
return (bExeFileFound, strStatusMsg);
-
#++---------------------------------------------------------------------------
# Details: Validate the arguments passed to the program. This function exits
# the program should error with the arguments be found.
@@ -450,14 +453,15 @@ def validate_arguments( vArgv ):
dictArgs = {};
nResult = 0;
strListArgs = "hdmM"; # Format "hiox:" = -h -i -o -x <arg>
- listLongArgs = ["srcRoot=", "targetDir=", "cfgBldDir=", "prefix=",
- "argsFile"];
+ listLongArgs = ["srcRoot=", "targetDir=", "cfgBldDir=", "prefix=",
+ "swigExecutable=", "argsFile"];
dictArgReq = { "-h": "o", # o = optional, m = mandatory
"-d": "o",
"-m": "o",
"-M": "o",
"--srcRoot": "m",
"--targetDir": "m",
+ "--swigExecutable" : "o",
"--cfgBldDir": "o",
"--prefix": "o",
"--argsFile": "o" };
@@ -553,8 +557,8 @@ def main( vArgv ):
--argsFile= The args are read from a file instead of the
command line. Other command line args are ignored.
Usage:
- buildSwigWrapperClasses.py --srcRoot=ADirPath --targetDir=ADirPath
- --cfgBldDir=ADirPath --prefix=ADirPath -m -d
+ buildSwigWrapperClasses.py --srcRoot=ADirPath --targetDir=ADirPath
+ --cfgBldDir=ADirPath --prefix=ADirPath --swigExecutable=ADirPath -m -d
Results: 0 Success
-1 Error - invalid parameters passed.
@@ -579,4 +583,3 @@ if __name__ == "__main__":
main( sys.argv[ 1: ] );
else:
program_exit( -5, strMsgErrorNoMain );
-
\ No newline at end of file
Modified: lldb/trunk/scripts/utilsArgsParse.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/utilsArgsParse.py?rev=222262&r1=222261&r2=222262&view=diff
==============================================================================
--- lldb/trunk/scripts/utilsArgsParse.py (original)
+++ lldb/trunk/scripts/utilsArgsParse.py Tue Nov 18 15:46:06 2014
@@ -67,7 +67,7 @@ def parse( vArgv, vstrListArgs, vListLon
# Validate parameters above and error on not recognised
try:
- dictOptsNeeded, dictArgsLeftOver = getopt.getopt( vArgv,
+ dictOptsNeeded, dictArgsLeftOver = getopt.getopt( vArgv,
vstrListArgs,
vListLongArgs );
except getopt.GetoptError:
@@ -143,4 +143,3 @@ def parse( vArgv, vstrListArgs, vListLon
return (-2, dictDummy, strMsg);
return (0, dictArgs, strDummy);
-
More information about the lldb-commits
mailing list