2013-06-14 00:05:41 +08:00
set ( LLVM_NO_RTTI 1 )
2015-03-14 00:31:58 +08:00
file ( GLOB SWIG_INTERFACES Python/interface/*.i )
file ( GLOB_RECURSE SWIG_SOURCES *.swig )
2014-04-03 23:03:11 +08:00
2014-07-02 01:57:19 +08:00
if ( LLDB_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION )
2015-03-14 11:10:51 +08:00
find_package ( SWIG REQUIRED )
add_custom_command (
O U T P U T $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / L L D B W r a p P y t h o n . c p p
D E P E N D S $ { S W I G _ S O U R C E S }
D E P E N D S $ { S W I G _ I N T E R F A C E S }
D E P E N D S $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / b u i l d S w i g W r a p p e r C l a s s e s . p y
C O M M A N D $ { P Y T H O N _ E X E C U T A B L E } $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / b u i l d S w i g W r a p p e r C l a s s e s . p y " - - s r c R o o t = $ { L L D B _ S O U R C E _ D I R } " " - - t a r g e t D i r = $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } " " - - c f g B l d D i r = $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } " " - - p r e f i x = $ { C M A K E _ B I N A R Y _ D I R } " " - - s w i g E x e c u t a b l e = $ { S W I G _ E X E C U T A B L E } " - m
C O M M E N T " P y t h o n s c r i p t b u i l d i n g L L D B P y t h o n w r a p p e r " )
set_source_files_properties ( ${ CMAKE_CURRENT_BINARY_DIR } /LLDBWrapPython.cpp PROPERTIES GENERATED 1 )
2013-06-14 00:05:41 +08:00
2015-03-14 11:10:51 +08:00
add_custom_target ( swig_wrapper ALL
D E P E N D S $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / L L D B W r a p P y t h o n . c p p
)
2013-06-14 00:05:41 +08:00
2015-03-14 11:10:51 +08:00
# Install the LLDB python module on all operating systems (except Windows)
if ( NOT CMAKE_SYSTEM_NAME MATCHES "Windows" )
install ( DIRECTORY ${ CMAKE_BINARY_DIR } /lib ${ LLVM_LIBDIR_SUFFIX } /python ${ PYTHON_VERSION_MAJOR } . ${ PYTHON_VERSION_MINOR }
D E S T I N A T I O N l i b $ { L L V M _ L I B D I R _ S U F F I X } )
endif ( )
2014-07-02 01:57:19 +08:00
else ( )
2015-03-14 11:10:51 +08:00
add_custom_command (
O U T P U T $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / L L D B W r a p P y t h o n . c p p
D E P E N D S $ { S W I G _ S O U R C E S }
2015-03-14 00:31:58 +08:00
D E P E N D S $ { S W I G _ I N T E R F A C E S }
2015-03-14 11:10:51 +08:00
# swig was directly invoked on Windows (where the Python API is not being generated) but on other platforms, we need to run the *swig-wrapper-classes.sh shell-scripts.
#COMMAND swig -c++ -shadow -python -I${LLDB_SOURCE_DIR}/include -I./. -outdir ${LLDB_SOURCE_DIR}/scripts/Python -o ${LLDB_SOURCE_DIR}/source/LLDBWrapPython.cpp ${LLDB_SOURCE_DIR}/scripts/lldb.swig
C O M M A N D e n v P Y T H O N _ E X E C U T A B L E = $ { P Y T H O N _ E X E C U T A B L E } $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / b u i l d - s w i g - w r a p p e r - c l a s s e s . s h $ { L L D B _ S O U R C E _ D I R } $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } $ { C M A K E _ B I N A R Y _ D I R } - m
C O M M A N D e n v P Y T H O N _ E X E C U T A B L E = $ { P Y T H O N _ E X E C U T A B L E } $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / f i n i s h - s w i g - w r a p p e r - c l a s s e s . s h $ { L L D B _ S O U R C E _ D I R } $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } $ { C M A K E _ B I N A R Y _ D I R } - m
C O M M E N T " B u i l d i n g l l d b p y t h o n w r a p p e r " )
set_source_files_properties ( ${ CMAKE_CURRENT_BINARY_DIR } /LLDBWrapPython.cpp PROPERTIES GENERATED 1 )
2014-07-02 01:57:19 +08:00
2015-03-14 11:10:51 +08:00
add_custom_target ( swig_wrapper ALL
D E P E N D S $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / L L D B W r a p P y t h o n . c p p
)
2014-07-02 01:57:19 +08:00
2015-03-14 11:10:51 +08:00
# Install the LLDB python module on all operating systems (except Windows)
if ( NOT CMAKE_SYSTEM_NAME MATCHES "Windows" )
install ( DIRECTORY ${ CMAKE_BINARY_DIR } /lib ${ LLVM_LIBDIR_SUFFIX } /python ${ PYTHON_VERSION_MAJOR } . ${ PYTHON_VERSION_MINOR }
D E S T I N A T I O N l i b $ { L L V M _ L I B D I R _ S U F F I X } )
endif ( )
2014-07-02 01:57:19 +08:00
endif ( )
2014-02-26 15:39:20 +08:00
# build Python modules
2014-08-26 02:16:22 +08:00
add_subdirectory ( Python/modules )