mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-03 19:32:35 +00:00
Revert "Stop building liblldb with CMake's framework functionality"
This reverts r338154. This change is actually unnecessary, as the CMake bug I referred to was actually not a bug but a misunderstanding of CMake. Original Differential Revision: https://reviews.llvm.org/D49888 llvm-svn: 338178
This commit is contained in:
parent
d4ff5ba926
commit
2f6a1018e0
@ -51,16 +51,15 @@ if(LLDB_BUILD_FRAMEWORK)
|
||||
message(FATAL_ERROR "LLDB.framework can only be generated when targeting Apple platforms")
|
||||
endif()
|
||||
|
||||
add_custom_target(lldb-framework)
|
||||
set(LLDB_SUITE_TARGET lldb-framework)
|
||||
set(LLDB_FRAMEWORK_DIR
|
||||
${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework)
|
||||
# These are used to fill out LLDB-Info.plist. These are relevant when building
|
||||
# the framework, and must be defined before building liblldb.
|
||||
set(PRODUCT_NAME "LLDB")
|
||||
set(EXECUTABLE_NAME "LLDB")
|
||||
set(CURRENT_PROJECT_VERSION "360.99.0")
|
||||
include(LLDBFramework)
|
||||
set(LLDB_SUITE_TARGET lldb-framework)
|
||||
|
||||
set(LLDB_FRAMEWORK_DIR
|
||||
${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_FRAMEWORK_INSTALL_DIR})
|
||||
endif()
|
||||
|
||||
add_subdirectory(docs)
|
||||
@ -72,7 +71,7 @@ if (NOT LLDB_DISABLE_PYTHON)
|
||||
set(LLDB_PYTHON_TARGET_DIR ${LLDB_BINARY_DIR}/scripts)
|
||||
set(LLDB_WRAP_PYTHON ${LLDB_BINARY_DIR}/scripts/LLDBWrapPython.cpp)
|
||||
if(LLDB_BUILD_FRAMEWORK)
|
||||
set(LLDB_PYTHON_TARGET_DIR "${LLDB_FRAMEWORK_DIR}/..")
|
||||
set(LLDB_PYTHON_TARGET_DIR ${LLDB_FRAMEWORK_DIR})
|
||||
set(LLDB_WRAP_PYTHON ${LLDB_PYTHON_TARGET_DIR}/LLDBWrapPython.cpp)
|
||||
else()
|
||||
# Don't set -m when building the framework.
|
||||
@ -163,6 +162,11 @@ if(LLDB_INCLUDE_TESTS)
|
||||
add_subdirectory(utils/lldb-dotest)
|
||||
endif()
|
||||
|
||||
if (LLDB_BUILD_FRAMEWORK)
|
||||
add_custom_target(lldb-framework)
|
||||
include(LLDBFramework)
|
||||
endif()
|
||||
|
||||
if (NOT LLDB_DISABLE_PYTHON)
|
||||
# Add a Post-Build Event to copy over Python files and create the symlink
|
||||
# to liblldb.so for the Python API(hardlink on Windows)
|
||||
|
@ -52,7 +52,7 @@ function(add_lldb_library name)
|
||||
if (PARAM_SHARED)
|
||||
set(out_dir lib${LLVM_LIBDIR_SUFFIX})
|
||||
if(${name} STREQUAL "liblldb" AND LLDB_BUILD_FRAMEWORK)
|
||||
set(out_dir ${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Versions/${LLDB_FRAMEWORK_VERSION})
|
||||
set(out_dir ${LLDB_FRAMEWORK_INSTALL_DIR})
|
||||
endif()
|
||||
install(TARGETS ${name}
|
||||
COMPONENT ${name}
|
||||
@ -108,7 +108,7 @@ function(add_lldb_executable name)
|
||||
endif()
|
||||
string(REGEX REPLACE "[^/]+" ".." _dots ${LLDB_FRAMEWORK_INSTALL_DIR})
|
||||
set_target_properties(${name} PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${LLDB_FRAMEWORK_DIR}/${LLDB_FRAMEWORK_RESOURCE_DIR}
|
||||
RUNTIME_OUTPUT_DIRECTORY $<TARGET_FILE_DIR:liblldb>${resource_dir}
|
||||
BUILD_WITH_INSTALL_RPATH On
|
||||
INSTALL_RPATH "@loader_path/../../../${resource_dots}${_dots}/${LLDB_FRAMEWORK_INSTALL_DIR}")
|
||||
endif()
|
||||
@ -123,7 +123,7 @@ function(add_lldb_executable name)
|
||||
if(ARG_GENERATE_INSTALL)
|
||||
set(out_dir "bin")
|
||||
if (LLDB_BUILD_FRAMEWORK AND ARG_INCLUDE_IN_SUITE)
|
||||
set(out_dir ${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/${LLDB_FRAMEWORK_RESOURCE_DIR})
|
||||
set(out_dir ${LLDB_FRAMEWORK_INSTALL_DIR}/${LLDB_FRAMEWORK_RESOURCE_DIR})
|
||||
endif()
|
||||
install(TARGETS ${name}
|
||||
COMPONENT ${name}
|
||||
|
@ -326,9 +326,7 @@ if (APPLE)
|
||||
set(LLDB_FRAMEWORK_INSTALL_DIR Library/Frameworks CACHE STRING "Output directory for LLDB.framework")
|
||||
set(LLDB_FRAMEWORK_VERSION A CACHE STRING "LLDB.framework version (default is A)")
|
||||
set(LLDB_FRAMEWORK_RESOURCE_DIR
|
||||
Versions/${LLDB_FRAMEWORK_VERSION}/Resources)
|
||||
set(LLDB_FRAMEWORK_HEADER_DIR
|
||||
Versions/${LLDB_FRAMEWORK_VERSION}/Headers)
|
||||
LLDB.framework/Versions/${LLDB_FRAMEWORK_VERSION}/Resources)
|
||||
|
||||
add_definitions( -DLIBXML2_DEFINED )
|
||||
list(APPEND system_libs xml2
|
||||
|
@ -1,16 +1,3 @@
|
||||
# We intentionally do not use CMake's framework support because of a bug in
|
||||
# CMake. See: https://gitlab.kitware.com/cmake/cmake/issues/18216
|
||||
|
||||
# We set up part of the framework structure first, as some scripts and build
|
||||
# rules assume they exist already.
|
||||
file(MAKE_DIRECTORY ${LLDB_FRAMEWORK_DIR} ${LLDB_FRAMEWORK_DIR}/${LLDB_FRAMEWORK_RESOURCE_DIR})
|
||||
execute_process(
|
||||
COMMAND
|
||||
${CMAKE_COMMAND} -E create_symlink ${LLDB_FRAMEWORK_VERSION} ${LLDB_FRAMEWORK_DIR}/Versions/Current
|
||||
COMMAND
|
||||
${CMAKE_COMMAND} -E create_symlink Versions/Current/Resources ${LLDB_FRAMEWORK_DIR}/Resources
|
||||
)
|
||||
|
||||
file(GLOB public_headers ${LLDB_SOURCE_DIR}/include/lldb/API/*.h)
|
||||
file(GLOB root_public_headers ${LLDB_SOURCE_DIR}/include/lldb/lldb-*.h)
|
||||
file(GLOB root_private_headers ${LLDB_SOURCE_DIR}/include/lldb/lldb-private*.h)
|
||||
@ -29,8 +16,8 @@ endforeach()
|
||||
add_custom_target(lldb-framework-headers DEPENDS ${framework_headers})
|
||||
|
||||
add_custom_command(TARGET lldb-framework POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders ${LLDB_FRAMEWORK_DIR}/${LLDB_FRAMEWORK_HEADER_DIR}
|
||||
COMMAND ${LLDB_SOURCE_DIR}/scripts/framework-header-fix.sh ${LLDB_FRAMEWORK_DIR}/${LLDB_FRAMEWORK_HEADER_DIR} ${LLDB_VERSION}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders $<TARGET_FILE_DIR:liblldb>/Headers
|
||||
COMMAND ${LLDB_SOURCE_DIR}/scripts/framework-header-fix.sh $<TARGET_FILE_DIR:liblldb>/Headers ${LLDB_VERSION}
|
||||
)
|
||||
|
||||
if (NOT IOS)
|
||||
@ -38,20 +25,19 @@ if (NOT IOS)
|
||||
add_dependencies(lldb-framework clang-headers)
|
||||
endif()
|
||||
add_custom_command(TARGET lldb-framework POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink Versions/Current/Headers ${LLDB_FRAMEWORK_DIR}/Headers
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink Versions/Current/LLDB ${LLDB_FRAMEWORK_DIR}/LLDB
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ${LLDB_FRAMEWORK_VERSION} ${LLDB_FRAMEWORK_DIR}/Versions/Current
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/clang/${LLDB_VERSION} ${LLDB_FRAMEWORK_DIR}/${LLDB_FRAMEWORK_RESOURCE_DIR}/Clang
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink Versions/Current/Headers ${LLDB_FRAMEWORK_DIR}/LLDB.framework/Headers
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ${LLDB_FRAMEWORK_VERSION} ${LLDB_FRAMEWORK_DIR}/LLDB.framework/Versions/Current
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/clang/${LLDB_VERSION} $<TARGET_FILE_DIR:liblldb>/Resources/Clang
|
||||
)
|
||||
endif()
|
||||
|
||||
# These are used to fill out LLDB-Info.plist. These are relevant when building
|
||||
# the framework, and must be defined before configuring Info.plist.
|
||||
set(PRODUCT_NAME "LLDB")
|
||||
set(EXECUTABLE_NAME "LLDB")
|
||||
set(CURRENT_PROJECT_VERSION "360.99.0")
|
||||
configure_file(${LLDB_SOURCE_DIR}/resources/LLDB-Info.plist
|
||||
${LLDB_FRAMEWORK_DIR}/${LLDB_FRAMEWORK_RESOURCE_DIR}/Info.plist)
|
||||
set_target_properties(liblldb PROPERTIES
|
||||
OUTPUT_NAME LLDB
|
||||
FRAMEWORK On
|
||||
FRAMEWORK_VERSION ${LLDB_FRAMEWORK_VERSION}
|
||||
MACOSX_FRAMEWORK_INFO_PLIST ${LLDB_SOURCE_DIR}/resources/LLDB-Info.plist
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR}
|
||||
PUBLIC_HEADER "${framework_headers}")
|
||||
|
||||
add_dependencies(lldb-framework
|
||||
lldb-framework-headers
|
||||
|
@ -25,9 +25,9 @@ set(SWIG_INSTALL_DIR lib${LLVM_LIBDIR_SUFFIX})
|
||||
if(LLDB_BUILD_FRAMEWORK)
|
||||
set(framework_arg --framework --target-platform Darwin)
|
||||
set(SWIG_PYTHON_DIR
|
||||
${LLDB_FRAMEWORK_DIR}/${LLDB_FRAMEWORK_RESOURCE_DIR}/Python)
|
||||
${LLDB_PYTHON_TARGET_DIR}/${LLDB_FRAMEWORK_RESOURCE_DIR}/Python)
|
||||
set(SWIG_INSTALL_DIR
|
||||
${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/${LLDB_FRAMEWORK_RESOURCE_DIR})
|
||||
${LLDB_FRAMEWORK_INSTALL_DIR}/${LLDB_FRAMEWORK_RESOURCE_DIR})
|
||||
endif()
|
||||
|
||||
get_filename_component(CFGBLDDIR ${LLDB_WRAP_PYTHON} DIRECTORY)
|
||||
@ -52,7 +52,7 @@ add_custom_command(
|
||||
COMMENT "Python script building LLDB Python wrapper")
|
||||
add_custom_target(swig_wrapper ALL DEPENDS ${LLDB_WRAP_PYTHON})
|
||||
|
||||
set_source_files_properties(${LLDB_PYTHON_TARGET_DIR}/lldb.py PROPERTIES GENERATED 1)
|
||||
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/lldb.py PROPERTIES GENERATED 1)
|
||||
|
||||
|
||||
# Install the LLDB python module
|
||||
|
@ -110,20 +110,10 @@ if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND
|
||||
PROPERTY COMPILE_FLAGS " -Wno-sequence-point -Wno-cast-qual")
|
||||
endif ()
|
||||
|
||||
if (LLDB_BUILD_FRAMEWORK)
|
||||
set_target_properties(liblldb
|
||||
PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY ${LLDB_FRAMEWORK_DIR}/Versions/${LLDB_FRAMEWORK_VERSION}
|
||||
PREFIX ""
|
||||
SUFFIX ""
|
||||
INSTALL_NAME_DIR "@rpath/LLDB.framework"
|
||||
OUTPUT_NAME LLDB)
|
||||
else()
|
||||
set_target_properties(liblldb
|
||||
PROPERTIES
|
||||
VERSION ${LLDB_VERSION}
|
||||
OUTPUT_NAME lldb)
|
||||
endif()
|
||||
set_target_properties(liblldb
|
||||
PROPERTIES
|
||||
VERSION ${LLDB_VERSION}
|
||||
)
|
||||
|
||||
if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
|
||||
if (NOT LLDB_EXPORT_ALL_SYMBOLS)
|
||||
@ -146,6 +136,11 @@ if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
|
||||
if (MSVC AND NOT LLDB_DISABLE_PYTHON)
|
||||
target_link_libraries(liblldb PRIVATE ${PYTHON_LIBRARY})
|
||||
endif()
|
||||
else()
|
||||
set_target_properties(liblldb
|
||||
PROPERTIES
|
||||
OUTPUT_NAME lldb
|
||||
)
|
||||
endif()
|
||||
|
||||
if (LLDB_WRAP_PYTHON)
|
||||
|
Loading…
Reference in New Issue
Block a user