[lldb] Change dwim-print to default to disabled persistent results
[llvm-project.git] / lldb / bindings / lua / CMakeLists.txt
blob1a739a9805ec8ab51e4b5bf9fbd21bd61b47ed3f
1 add_custom_command(
2   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapLua.cpp
3   DEPENDS ${SWIG_SOURCES}
4   DEPENDS ${SWIG_INTERFACES}
5   DEPENDS ${SWIG_HEADERS}
6   COMMAND ${SWIG_EXECUTABLE}
7       ${SWIG_COMMON_FLAGS}
8       -I${CMAKE_CURRENT_SOURCE_DIR}
9       -lua
10       -w503
11       -outdir ${CMAKE_CURRENT_BINARY_DIR}
12       -o ${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapLua.cpp
13       ${CMAKE_CURRENT_SOURCE_DIR}/lua.swig
14   VERBATIM
15   COMMENT "Building LLDB Lua wrapper")
17 add_custom_target(swig_wrapper_lua ALL DEPENDS
18   ${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapLua.cpp
21 function(create_lua_package swig_target working_dir pkg_dir)
22   cmake_parse_arguments(ARG "NOINIT" "" "FILES" ${ARGN})
23   add_custom_command(TARGET ${swig_target} POST_BUILD VERBATIM
24     COMMAND ${CMAKE_COMMAND} -E make_directory ${pkg_dir}
25     WORKING_DIRECTORY ${working_dir})
26 endfunction()
28 function(finish_swig_lua swig_target lldb_lua_bindings_dir lldb_lua_target_dir)
29   add_custom_target(${swig_target} ALL VERBATIM
30     COMMAND ${CMAKE_COMMAND} -E make_directory ${lldb_lua_target_dir}
31     DEPENDS swig_wrapper_lua
32     COMMENT "LLDB Lua API")
33   if(LLDB_BUILD_FRAMEWORK)
34     set(LIBLLDB_SYMLINK_DEST "${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}/LLDB.framework/LLDB")
35   else()
36     set(LIBLLDB_SYMLINK_DEST "${LLVM_SHLIB_OUTPUT_INTDIR}/liblldb${CMAKE_SHARED_LIBRARY_SUFFIX}")
37   endif()
38   if(WIN32)
39     if(CMAKE_BUILD_TYPE STREQUAL Debug)
40       set(LIBLLDB_SYMLINK_OUTPUT_FILE "_lldb_d.pyd")
41     else()
42       set(LIBLLDB_SYMLINK_OUTPUT_FILE "_lldb.pyd")
43     endif()
44   else()
45     set(LIBLLDB_SYMLINK_OUTPUT_FILE "lldb.so")
46   endif()
47   create_relative_symlink(${swig_target} ${LIBLLDB_SYMLINK_DEST}
48                           ${lldb_lua_target_dir} ${LIBLLDB_SYMLINK_OUTPUT_FILE})
49   set(lldb_lua_library_target "${swig_target}-library")
50   add_custom_target(${lldb_lua_library_target})
51   add_dependencies(${lldb_lua_library_target} ${swig_target})
53   # Ensure we do the Lua post-build step when building lldb.
54   add_dependencies(lldb ${swig_target})
56   if(LLDB_BUILD_FRAMEWORK)
57     set(LLDB_LUA_INSTALL_PATH ${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Resources/Python)
58   else()
59     set(LLDB_LUA_INSTALL_PATH ${LLDB_LUA_RELATIVE_PATH})
60   endif()
61   install(DIRECTORY ${lldb_lua_target_dir}/
62           DESTINATION ${LLDB_LUA_INSTALL_PATH}
63           COMPONENT ${lldb_lua_library_target})
65   set(lldb_lua_library_install_target "install-${lldb_lua_library_target}")
66   if (NOT LLVM_ENABLE_IDE)
67     add_llvm_install_targets(${lldb_lua_library_install_target}
68                             COMPONENT ${lldb_lua_library_target}
69                             DEPENDS ${lldb_lua_library_target})
70   endif()
71 endfunction()