endif()
set(LLDB_DISABLE_PYTHON 0 CACHE BOOL "Disables the Python scripting integration.")
-if (LLDB_DISABLE_PYTHON)
- add_definitions( -DLLDB_DISABLE_PYTHON )
-endif()
if ((NOT MSVC) OR MSVC12)
add_definitions( -DHAVE_ROUND )
endif()
endif()
if (MSVC)
- if (PYTHON_INCLUDE_DIR STREQUAL "" OR PYTHON_LIBRARY STREQUAL "")
- message(FATAL_ERROR "Building on MSVC requires manual specification of "
- "PYTHON_INCLUDE_DIR and PYTHON_LIBRARY")
+ if ("${PYTHON_INCLUDE_DIR}" STREQUAL "" OR "${PYTHON_LIBRARY}" STREQUAL "")
+ message("-- LLDB Embedded python disabled. Embedding python on Windows requires "
+ "manually specifying PYTHON_INCLUDE_DIR *and* PYTHON_LIBRARY")
+ set(LLDB_DISABLE_PYTHON 1)
else()
message("-- Found PythonLibs: ${PYTHON_LIBRARY}")
include_directories(${PYTHON_INCLUDE_DIR})
endif()
endif()
+if (LLDB_DISABLE_PYTHON)
+ unset(PYTHON_INCLUDE_DIR)
+ unset(PYTHON_LIBRARY)
+ add_definitions( -DLLDB_DISABLE_PYTHON )
+endif()
+
include_directories(../clang/include)
include_directories("${CMAKE_CURRENT_BINARY_DIR}/../clang/include")
# only supported parameters to this macro are the optional
# MODULE;SHARED;STATIC library type and source files
cmake_parse_arguments(PARAM
- "MODULE;SHARED;STATIC"
+ "MODULE;SHARED;STATIC;OBJECT"
""
""
${ARGN})
llvm_process_sources(srcs ${PARAM_UNPARSED_ARGUMENTS})
-
+
if (MSVC_IDE OR XCODE)
string(REGEX MATCHALL "/[^/]+" split_path ${CMAKE_CURRENT_SOURCE_DIR})
list(GET split_path -1 dir)
set(libkind SHARED)
elseif (PARAM_STATIC)
set(libkind STATIC)
+ elseif (PARAM_OBJECT)
+ set(libkind OBJECT)
else ()
# library type unspecified - controlled by BUILD_SHARED_LIBS
unset(libkind)
if (NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
endif()
- llvm_add_library(${name} ${libkind} ${srcs})
- #if (LLVM_COMMON_DEPENDS)
- ##add_dependencies(${name} ${LLVM_COMMON_DEPENDS})
- #endif()
- if ("${libkind}" STREQUAL "STATIC")
- set(lldb_library_keyword ${cmake_2_8_12_INTERFACE})
- else ()
- set(lldb_library_keyword ${cmake_2_8_12_PUBLIC})
- endif ()
-
- if(LLDB_USED_LIBS)
- # The Darwin linker doesn't understand --start-group/--end-group.
- if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
- target_link_libraries(${name} ${lldb_library_keyword}
- -Wl,--start-group ${LLDB_USED_LIBS} -Wl,--end-group)
- else()
- target_link_libraries(${name} ${lldb_library_keyword} ${LLDB_USED_LIBS})
+ if (PARAM_OBJECT)
+ add_library(${name} ${libkind} ${srcs})
+ else()
+ llvm_add_library(${name} ${libkind} ${srcs})
+
+ if (PARAM_STATIC)
+ set(lldb_library_keyword ${cmake_2_8_12_INTERFACE})
+ else ()
+ set(lldb_library_keyword ${cmake_2_8_12_PUBLIC})
+ endif ()
+
+ if(LLDB_USED_LIBS)
+ # The Darwin linker doesn't understand --start-group/--end-group.
+ if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
+ target_link_libraries(${name} ${lldb_library_keyword}
+ -Wl,--start-group ${LLDB_USED_LIBS} -Wl,--end-group)
+ else()
+ target_link_libraries(${name} ${lldb_library_keyword} ${LLDB_USED_LIBS})
+ endif()
endif()
- endif()
- target_link_libraries(${name} ${lldb_library_keyword} ${CLANG_USED_LIBS})
- target_link_libraries(${name} ${lldb_library_keyword} ${LLVM_USED_LIBS})
- llvm_config(${name} ${LLVM_LINK_COMPONENTS})
- target_link_libraries(${name} ${lldb_library_keyword} ${LLVM_COMMON_LIBS})
- if (LLVM_COMMON_DEPENDS)
- add_dependencies(${name} ${LLVM_COMMON_DEPENDS})
+
+ target_link_libraries(${name} ${lldb_library_keyword} ${CLANG_USED_LIBS})
+ target_link_libraries(${name} ${lldb_library_keyword} ${LLVM_USED_LIBS})
+ llvm_config(${name} ${LLVM_LINK_COMPONENTS})
+ target_link_libraries(${name} ${lldb_library_keyword} ${LLVM_COMMON_LIBS})
+
+ install(TARGETS ${name}
+ LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+ ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
endif()
# Hack: only some LLDB libraries depend on the clang autogenerated headers,
# but it is simple enough to make all of LLDB depend on some of those
# headers without negatively impacting much of anything.
- set (LLDB_DEPENDENCIES
- libclang
- )
- add_dependencies(${name} ${LLDB_DEPENDENCIES})
+ add_dependencies(${name} libclang)
- install(TARGETS ${name}
- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
set_target_properties(${name} PROPERTIES FOLDER "lldb libraries")
endmacro(add_lldb_library)
lldbPluginInstrumentationRuntimeAddressSanitizer
)
-# Need to export the API in the liblldb.dll for Windows
-# The lldbAPI source files are added directly in liblldb
-if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows" )
- list(APPEND LLDB_USED_LIBS
- lldbAPI
- )
-endif ()
-
# Windows-only libraries
if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
list(APPEND LLDB_USED_LIBS
set(LLVM_NO_RTTI 1)
if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
-add_definitions( -DEXPORT_LIBLLDB )
+ add_definitions( -DEXPORT_LIBLLDB )
endif()
-add_lldb_library(lldbAPI
+# An OBJECT library is a special type of CMake library that produces
+# no archive, has no link interface, and no link inputs. It is like
+# a regular archive, just without the physical output. To link against
+# an OBJECT library, you reference it in the *source* file list of a
+# library using the special syntax $<TARGET_OBJECTS:lldbAPI>. This will
+# cause every object file to be passed to the linker independently, as
+# opposed to a single archive being passed to the linker.
+#
+# This is *extremely* important on Windows. lldbAPI exports all of the
+# SB classes using __declspec(dllexport). Unfortunately for technical
+# reasons it is not possible (well, extremely difficult) to get the linker
+# to propagate a __declspec(dllexport) attribute from a symbol in an
+# object file in an archive to a DLL that links against that archive.
+# The solution to this is for the DLL to link the object file directly.
+# So lldbAPI must be an OBJECT library.
+add_lldb_library(lldbAPI OBJECT
SBAddress.cpp
SBAttachInfo.cpp
SBBlock.cpp
add_lldb_library(liblldb SHARED
lldb.cpp
lldb-log.cpp
+ $<TARGET_OBJECTS:lldbAPI>
${LLDB_WRAP_PYTHON}
${LLDB_VERS_GENERATED_FILE}
)
+set_target_properties(liblldb
+ PROPERTIES
+ VERSION ${LLDB_VERSION}
+ )
if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
- target_link_libraries(liblldb PRIVATE lldbAPI)
- # Only MSVC has the ABI compatibility and avoids using FindPythonLibs,
+ # Only MSVC has the ABI compatibility problem and avoids using FindPythonLibs,
# so only it needs to explicitly link against ${PYTHON_LIBRARY}
- if (MSVC)
+ if (MSVC AND NOT LLDB_DISABLE_PYTHON)
target_link_libraries(liblldb PRIVATE ${PYTHON_LIBRARY})
endif()
-
- set_target_properties(liblldb
- PROPERTIES
- OUTPUT_NAME liblldb
- VERSION ${LLDB_VERSION}
- )
else()
set_target_properties(liblldb
PROPERTIES
OUTPUT_NAME lldb
- VERSION ${LLDB_VERSION}
)
endif()
)
if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
-add_definitions( -DIMPORT_LIBLLDB )
+ add_definitions( -DIMPORT_LIBLLDB )
endif()
target_link_libraries(lldb liblldb)
set(LLVM_NO_RTTI 1)
if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
-add_lldb_executable(lldb-mi
- Driver.cpp
- ../../source/Host/windows/getopt/GetOptInc.cpp
- MICmdArgContext.cpp
- MICmdArgSet.cpp
- MICmdArgValBase.cpp
- MICmdArgValConsume.cpp
- MICmdArgValFile.cpp
- MICmdArgValListBase.cpp
- MICmdArgValListOfN.cpp
- MICmdArgValNumber.cpp
- MICmdArgValOptionLong.cpp
- MICmdArgValOptionShort.cpp
- MICmdArgValString.cpp
- MICmdArgValThreadGrp.cpp
- MICmdBase.cpp
- MICmdCommands.cpp
- MICmdCmd.cpp
- MICmdCmdBreak.cpp
- MICmdCmdData.cpp
- MICmdCmdEnviro.cpp
- MICmdCmdExec.cpp
- MICmdCmdFile.cpp
- MICmdCmdGdbInfo.cpp
- MICmdCmdGdbSet.cpp
- MICmdCmdGdbThread.cpp
- MICmdCmdMiscellanous.cpp
- MICmdCmdStack.cpp
- MICmdCmdSupportInfo.cpp
- MICmdCmdSupportList.cpp
- MICmdCmdSymbol.cpp
- MICmdCmdTarget.cpp
- MICmdCmdThread.cpp
- MICmdCmdTrace.cpp
- MICmdCmdVar.cpp
- MICmdData.cpp
- MICmdFactory.cpp
- MICmdInterpreter.cpp
- MICmdInvoker.cpp
- MICmdMgr.cpp
- MICmdMgrSetCmdDeleteCallback.cpp
- MICmnBase.cpp
- MICmnLLDBBroadcaster.cpp
- MICmnLLDBDebugger.cpp
- MICmnLLDBDebuggerHandleEvents.cpp
- MICmnLLDBDebugSessionInfo.cpp
- MICmnLLDBDebugSessionInfoVarObj.cpp
- MICmnLLDBProxySBValue.cpp
- MICmnLLDBUtilSBValue.cpp
- MICmnLog.cpp
- MICmnLogMediumFile.cpp
- MICmnMIOutOfBandRecord.cpp
- MICmnMIResultRecord.cpp
- MICmnMIValue.cpp
- MICmnMIValueConst.cpp
- MICmnMIValueList.cpp
- MICmnMIValueResult.cpp
- MICmnMIValueTuple.cpp
- MICmnResources.cpp
- MICmnStreamStderr.cpp
- MICmnStreamStdin.cpp
- MICmnStreamStdout.cpp
- MICmnThreadMgrStd.cpp
- MIDriver.cpp
- MIDriverBase.cpp
- MIDriverMain.cpp
- MIDriverMgr.cpp
- MIUtilDateTimeStd.cpp
- MIUtilDebug.cpp
- MIUtilFileStd.cpp
- MIUtilMapIdToVariant.cpp
- MIUtilString.cpp
- MIUtilSystemLinux.cpp
- MIUtilSystemOsx.cpp
- MIUtilSystemWindows.cpp
- MIUtilTermios.cpp
- MIUtilThreadBaseStd.cpp
- MIUtilVariant.cpp
- Platform.cpp
- )
+ add_definitions( -DIMPORT_LIBLLDB )
+
+ add_lldb_executable(lldb-mi
+ Driver.cpp
+ ../../source/Host/windows/getopt/GetOptInc.cpp
+ MICmdArgContext.cpp
+ MICmdArgSet.cpp
+ MICmdArgValBase.cpp
+ MICmdArgValConsume.cpp
+ MICmdArgValFile.cpp
+ MICmdArgValListBase.cpp
+ MICmdArgValListOfN.cpp
+ MICmdArgValNumber.cpp
+ MICmdArgValOptionLong.cpp
+ MICmdArgValOptionShort.cpp
+ MICmdArgValString.cpp
+ MICmdArgValThreadGrp.cpp
+ MICmdBase.cpp
+ MICmdCommands.cpp
+ MICmdCmd.cpp
+ MICmdCmdBreak.cpp
+ MICmdCmdData.cpp
+ MICmdCmdEnviro.cpp
+ MICmdCmdExec.cpp
+ MICmdCmdFile.cpp
+ MICmdCmdGdbInfo.cpp
+ MICmdCmdGdbSet.cpp
+ MICmdCmdGdbThread.cpp
+ MICmdCmdMiscellanous.cpp
+ MICmdCmdStack.cpp
+ MICmdCmdSupportInfo.cpp
+ MICmdCmdSupportList.cpp
+ MICmdCmdSymbol.cpp
+ MICmdCmdTarget.cpp
+ MICmdCmdThread.cpp
+ MICmdCmdTrace.cpp
+ MICmdCmdVar.cpp
+ MICmdData.cpp
+ MICmdFactory.cpp
+ MICmdInterpreter.cpp
+ MICmdInvoker.cpp
+ MICmdMgr.cpp
+ MICmdMgrSetCmdDeleteCallback.cpp
+ MICmnBase.cpp
+ MICmnLLDBBroadcaster.cpp
+ MICmnLLDBDebugger.cpp
+ MICmnLLDBDebuggerHandleEvents.cpp
+ MICmnLLDBDebugSessionInfo.cpp
+ MICmnLLDBDebugSessionInfoVarObj.cpp
+ MICmnLLDBProxySBValue.cpp
+ MICmnLLDBUtilSBValue.cpp
+ MICmnLog.cpp
+ MICmnLogMediumFile.cpp
+ MICmnMIOutOfBandRecord.cpp
+ MICmnMIResultRecord.cpp
+ MICmnMIValue.cpp
+ MICmnMIValueConst.cpp
+ MICmnMIValueList.cpp
+ MICmnMIValueResult.cpp
+ MICmnMIValueTuple.cpp
+ MICmnResources.cpp
+ MICmnStreamStderr.cpp
+ MICmnStreamStdin.cpp
+ MICmnStreamStdout.cpp
+ MICmnThreadMgrStd.cpp
+ MIDriver.cpp
+ MIDriverBase.cpp
+ MIDriverMain.cpp
+ MIDriverMgr.cpp
+ MIUtilDateTimeStd.cpp
+ MIUtilDebug.cpp
+ MIUtilFileStd.cpp
+ MIUtilMapIdToVariant.cpp
+ MIUtilString.cpp
+ MIUtilSystemLinux.cpp
+ MIUtilSystemOsx.cpp
+ MIUtilSystemWindows.cpp
+ MIUtilTermios.cpp
+ MIUtilThreadBaseStd.cpp
+ MIUtilVariant.cpp
+ Platform.cpp
+ )
else ()
-add_lldb_executable(lldb-mi
- Driver.cpp
- MICmdArgContext.cpp
- MICmdArgSet.cpp
- MICmdArgValBase.cpp
- MICmdArgValConsume.cpp
- MICmdArgValFile.cpp
- MICmdArgValListBase.cpp
- MICmdArgValListOfN.cpp
- MICmdArgValNumber.cpp
- MICmdArgValOptionLong.cpp
- MICmdArgValOptionShort.cpp
- MICmdArgValString.cpp
- MICmdArgValThreadGrp.cpp
- MICmdBase.cpp
- MICmdCommands.cpp
- MICmdCmd.cpp
- MICmdCmdBreak.cpp
- MICmdCmdData.cpp
- MICmdCmdEnviro.cpp
- MICmdCmdExec.cpp
- MICmdCmdFile.cpp
- MICmdCmdGdbInfo.cpp
- MICmdCmdGdbSet.cpp
- MICmdCmdGdbThread.cpp
- MICmdCmdMiscellanous.cpp
- MICmdCmdStack.cpp
- MICmdCmdSupportInfo.cpp
- MICmdCmdSupportList.cpp
- MICmdCmdSymbol.cpp
- MICmdCmdTarget.cpp
- MICmdCmdThread.cpp
- MICmdCmdTrace.cpp
- MICmdCmdVar.cpp
- MICmdData.cpp
- MICmdFactory.cpp
- MICmdInterpreter.cpp
- MICmdInvoker.cpp
- MICmdMgr.cpp
- MICmdMgrSetCmdDeleteCallback.cpp
- MICmnBase.cpp
- MICmnLLDBBroadcaster.cpp
- MICmnLLDBDebugger.cpp
- MICmnLLDBDebuggerHandleEvents.cpp
- MICmnLLDBDebugSessionInfo.cpp
- MICmnLLDBDebugSessionInfoVarObj.cpp
- MICmnLLDBProxySBValue.cpp
- MICmnLLDBUtilSBValue.cpp
- MICmnLog.cpp
- MICmnLogMediumFile.cpp
- MICmnMIOutOfBandRecord.cpp
- MICmnMIResultRecord.cpp
- MICmnMIValue.cpp
- MICmnMIValueConst.cpp
- MICmnMIValueList.cpp
- MICmnMIValueResult.cpp
- MICmnMIValueTuple.cpp
- MICmnResources.cpp
- MICmnStreamStderr.cpp
- MICmnStreamStdin.cpp
- MICmnStreamStdout.cpp
- MICmnThreadMgrStd.cpp
- MIDriver.cpp
- MIDriverBase.cpp
- MIDriverMain.cpp
- MIDriverMgr.cpp
- MIUtilDateTimeStd.cpp
- MIUtilDebug.cpp
- MIUtilFileStd.cpp
- MIUtilMapIdToVariant.cpp
- MIUtilString.cpp
- MIUtilSystemLinux.cpp
- MIUtilSystemOsx.cpp
- MIUtilSystemWindows.cpp
- MIUtilTermios.cpp
- MIUtilThreadBaseStd.cpp
- MIUtilVariant.cpp
- Platform.cpp
- )
+ add_lldb_executable(lldb-mi
+ Driver.cpp
+ MICmdArgContext.cpp
+ MICmdArgSet.cpp
+ MICmdArgValBase.cpp
+ MICmdArgValConsume.cpp
+ MICmdArgValFile.cpp
+ MICmdArgValListBase.cpp
+ MICmdArgValListOfN.cpp
+ MICmdArgValNumber.cpp
+ MICmdArgValOptionLong.cpp
+ MICmdArgValOptionShort.cpp
+ MICmdArgValString.cpp
+ MICmdArgValThreadGrp.cpp
+ MICmdBase.cpp
+ MICmdCommands.cpp
+ MICmdCmd.cpp
+ MICmdCmdBreak.cpp
+ MICmdCmdData.cpp
+ MICmdCmdEnviro.cpp
+ MICmdCmdExec.cpp
+ MICmdCmdFile.cpp
+ MICmdCmdGdbInfo.cpp
+ MICmdCmdGdbSet.cpp
+ MICmdCmdGdbThread.cpp
+ MICmdCmdMiscellanous.cpp
+ MICmdCmdStack.cpp
+ MICmdCmdSupportInfo.cpp
+ MICmdCmdSupportList.cpp
+ MICmdCmdSymbol.cpp
+ MICmdCmdTarget.cpp
+ MICmdCmdThread.cpp
+ MICmdCmdTrace.cpp
+ MICmdCmdVar.cpp
+ MICmdData.cpp
+ MICmdFactory.cpp
+ MICmdInterpreter.cpp
+ MICmdInvoker.cpp
+ MICmdMgr.cpp
+ MICmdMgrSetCmdDeleteCallback.cpp
+ MICmnBase.cpp
+ MICmnLLDBBroadcaster.cpp
+ MICmnLLDBDebugger.cpp
+ MICmnLLDBDebuggerHandleEvents.cpp
+ MICmnLLDBDebugSessionInfo.cpp
+ MICmnLLDBDebugSessionInfoVarObj.cpp
+ MICmnLLDBProxySBValue.cpp
+ MICmnLLDBUtilSBValue.cpp
+ MICmnLog.cpp
+ MICmnLogMediumFile.cpp
+ MICmnMIOutOfBandRecord.cpp
+ MICmnMIResultRecord.cpp
+ MICmnMIValue.cpp
+ MICmnMIValueConst.cpp
+ MICmnMIValueList.cpp
+ MICmnMIValueResult.cpp
+ MICmnMIValueTuple.cpp
+ MICmnResources.cpp
+ MICmnStreamStderr.cpp
+ MICmnStreamStdin.cpp
+ MICmnStreamStdout.cpp
+ MICmnThreadMgrStd.cpp
+ MIDriver.cpp
+ MIDriverBase.cpp
+ MIDriverMain.cpp
+ MIDriverMgr.cpp
+ MIUtilDateTimeStd.cpp
+ MIUtilDebug.cpp
+ MIUtilFileStd.cpp
+ MIUtilMapIdToVariant.cpp
+ MIUtilString.cpp
+ MIUtilSystemLinux.cpp
+ MIUtilSystemOsx.cpp
+ MIUtilSystemWindows.cpp
+ MIUtilTermios.cpp
+ MIUtilThreadBaseStd.cpp
+ MIUtilVariant.cpp
+ Platform.cpp
+ )
endif ()
target_link_libraries(lldb-mi liblldb)