2015-03-19 00:56:24 +08:00
|
|
|
function(lldb_link_common_libs name targetkind)
|
|
|
|
if (NOT LLDB_USED_LIBS)
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(${targetkind} MATCHES "SHARED")
|
|
|
|
set(LINK_KEYWORD ${cmake_2_8_12_PUBLIC})
|
|
|
|
endif()
|
2015-07-17 23:26:27 +08:00
|
|
|
|
2015-03-19 00:56:24 +08:00
|
|
|
if(${targetkind} MATCHES "SHARED" OR ${targetkind} MATCHES "EXE")
|
2015-07-17 23:26:27 +08:00
|
|
|
if (LLDB_LINKER_SUPPORTS_GROUPS)
|
2015-03-19 00:56:24 +08:00
|
|
|
target_link_libraries(${name} ${LINK_KEYWORD}
|
|
|
|
-Wl,--start-group ${LLDB_USED_LIBS} -Wl,--end-group)
|
|
|
|
else()
|
|
|
|
target_link_libraries(${name} ${LINK_KEYWORD} ${LLDB_USED_LIBS})
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endfunction(lldb_link_common_libs)
|
|
|
|
|
|
|
|
macro(add_lldb_library name)
|
2015-07-17 23:26:27 +08:00
|
|
|
# only supported parameters to this macro are the optional
|
2015-03-19 00:56:24 +08:00
|
|
|
# MODULE;SHARED;STATIC library type and source files
|
|
|
|
cmake_parse_arguments(PARAM
|
|
|
|
"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)
|
|
|
|
file(GLOB_RECURSE headers
|
|
|
|
../../include/lldb${dir}/*.h)
|
|
|
|
set(srcs ${srcs} ${headers})
|
|
|
|
endif()
|
|
|
|
if (PARAM_MODULE)
|
|
|
|
set(libkind MODULE)
|
|
|
|
elseif (PARAM_SHARED)
|
|
|
|
set(libkind SHARED)
|
|
|
|
elseif (PARAM_OBJECT)
|
|
|
|
set(libkind OBJECT)
|
|
|
|
else ()
|
2015-06-04 11:12:37 +08:00
|
|
|
# PARAM_STATIC or library type unspecified. BUILD_SHARED_LIBS
|
|
|
|
# does not control the kind of libraries created for LLDB,
|
|
|
|
# only whether or not they link to shared/static LLVM/Clang
|
|
|
|
# libraries.
|
|
|
|
set(libkind STATIC)
|
2015-03-19 00:56:24 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
#PIC not needed on Win
|
|
|
|
if (NOT MSVC)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (PARAM_OBJECT)
|
|
|
|
add_library(${name} ${libkind} ${srcs})
|
|
|
|
else()
|
2016-01-27 19:02:02 +08:00
|
|
|
llvm_add_library(${name} ${libkind} DISABLE_LLVM_LINK_LLVM_DYLIB ${srcs})
|
2015-03-19 00:56:24 +08:00
|
|
|
|
|
|
|
lldb_link_common_libs(${name} "${libkind}")
|
|
|
|
|
2015-07-17 23:26:27 +08:00
|
|
|
if (PARAM_SHARED)
|
|
|
|
if (LLDB_LINKER_SUPPORTS_GROUPS)
|
2015-07-07 20:24:33 +08:00
|
|
|
target_link_libraries(${name} ${cmake_2_8_12_PUBLIC}
|
|
|
|
-Wl,--start-group ${CLANG_USED_LIBS} -Wl,--end-group)
|
2015-07-17 23:26:27 +08:00
|
|
|
else()
|
2015-07-07 20:24:33 +08:00
|
|
|
target_link_libraries(${name} ${cmake_2_8_12_PUBLIC} ${CLANG_USED_LIBS})
|
2015-07-17 23:26:27 +08:00
|
|
|
endif()
|
2015-07-07 20:24:33 +08:00
|
|
|
endif()
|
Add support for reading line tables from PDB files.
PDB is Microsoft's debug information format, and although we
cannot yet generate it, we still must be able to consume it.
Reason for this is that debug information for system libraries
(e.g. kernel32, C Runtime Library, etc) only have debug info
in PDB format, so in order to be able to support debugging
of system code, we must support it.
Currently this code should compile on every platform, but on
non-Windows platforms the PDB plugin will return 0 capabilities,
meaning that for now PDB is only supported on Windows. This
may change in the future, but the API is designed in such a way
that this will require few (if any) changes on the LLDB side.
In the future we can just flip a switch and everything will
work.
This patch only adds support for line tables. It does not return
information about functions, types, global variables, or anything
else. This functionality will be added in a followup patch.
Differential Revision: http://reviews.llvm.org/D17363
Reviewed by: Greg Clayton
llvm-svn: 262528
2016-03-03 06:05:52 +08:00
|
|
|
llvm_config(${name} ${LLVM_LINK_COMPONENTS} ${LLVM_PRIVATE_LINK_COMPONENTS})
|
2015-03-19 00:56:24 +08:00
|
|
|
|
2015-06-29 19:03:21 +08:00
|
|
|
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "liblldb")
|
|
|
|
if (PARAM_SHARED)
|
|
|
|
install(TARGETS ${name}
|
|
|
|
RUNTIME DESTINATION bin
|
|
|
|
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
|
|
|
|
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
|
|
|
|
else()
|
|
|
|
install(TARGETS ${name}
|
|
|
|
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
|
|
|
|
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
|
|
|
|
endif()
|
2015-03-19 00:56:24 +08:00
|
|
|
endif()
|
|
|
|
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.
|
|
|
|
add_dependencies(${name} libclang)
|
|
|
|
|
|
|
|
set_target_properties(${name} PROPERTIES FOLDER "lldb libraries")
|
|
|
|
endmacro(add_lldb_library)
|
|
|
|
|
|
|
|
macro(add_lldb_executable name)
|
2016-01-27 19:02:02 +08:00
|
|
|
add_llvm_executable(${name} DISABLE_LLVM_LINK_LLVM_DYLIB ${ARGN})
|
2015-03-19 00:56:24 +08:00
|
|
|
set_target_properties(${name} PROPERTIES FOLDER "lldb executables")
|
|
|
|
endmacro(add_lldb_executable)
|
2015-10-14 22:52:15 +08:00
|
|
|
|
|
|
|
# Support appending linker flags to an existing target.
|
|
|
|
# This will preserve the existing linker flags on the
|
|
|
|
# target, if there are any.
|
|
|
|
function(lldb_append_link_flags target_name new_link_flags)
|
|
|
|
# Retrieve existing linker flags.
|
|
|
|
get_target_property(current_link_flags ${target_name} LINK_FLAGS)
|
|
|
|
|
|
|
|
# If we had any linker flags, include them first in the new linker flags.
|
|
|
|
if(current_link_flags)
|
|
|
|
set(new_link_flags "${current_link_flags} ${new_link_flags}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Now set them onto the target.
|
|
|
|
set_target_properties(${target_name} PROPERTIES LINK_FLAGS ${new_link_flags})
|
|
|
|
endfunction()
|