[Lldb-commits] [lldb] 77a60f0 - [lldb] Record framework build path and use it everywhere
Haibo Huang via lldb-commits
lldb-commits at lists.llvm.org
Wed Nov 6 14:07:46 PST 2019
Author: Haibo Huang
Date: 2019-11-06T14:05:35-08:00
New Revision: 77a60f0df673074a2c9276498f95a9eaadeece56
URL: https://github.com/llvm/llvm-project/commit/77a60f0df673074a2c9276498f95a9eaadeece56
DIFF: https://github.com/llvm/llvm-project/commit/77a60f0df673074a2c9276498f95a9eaadeece56.diff
LOG: [lldb] Record framework build path and use it everywhere
This avoids config time dependencies on liblldb. And enables other refactoring.
Added:
Modified:
lldb/CMakeLists.txt
lldb/cmake/modules/AddLLDB.cmake
lldb/cmake/modules/LLDBConfig.cmake
lldb/cmake/modules/LLDBFramework.cmake
lldb/test/API/CMakeLists.txt
lldb/tools/debugserver/source/CMakeLists.txt
lldb/tools/driver/CMakeLists.txt
lldb/tools/lldb-vscode/CMakeLists.txt
Removed:
################################################################################
diff --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt
index 128130621ba0..81d7dd8123bd 100644
--- a/lldb/CMakeLists.txt
+++ b/lldb/CMakeLists.txt
@@ -93,10 +93,9 @@ endif()
if (NOT LLDB_DISABLE_PYTHON)
get_target_property(lldb_scripts_dir swig_wrapper BINARY_DIR)
- get_target_property(liblldb_build_dir liblldb LIBRARY_OUTPUT_DIRECTORY)
if(LLDB_BUILD_FRAMEWORK)
- set(lldb_python_build_path "${liblldb_build_dir}/LLDB.framework/Resources/Python/lldb")
+ set(lldb_python_build_path "${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}/LLDB.framework/Resources/Python/lldb")
else()
set(lldb_python_build_path "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_PYTHON_RELATIVE_PATH}/lldb")
endif()
@@ -188,7 +187,7 @@ if (NOT LLDB_DISABLE_PYTHON)
endfunction()
if(LLDB_BUILD_FRAMEWORK)
- set(LIBLLDB_SYMLINK_DEST "${liblldb_build_dir}/LLDB.framework/LLDB")
+ set(LIBLLDB_SYMLINK_DEST "${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}/LLDB.framework/LLDB")
else()
set(LIBLLDB_SYMLINK_DEST "${LLVM_SHLIB_OUTPUT_INTDIR}/liblldb${CMAKE_SHARED_LIBRARY_SUFFIX}")
endif()
diff --git a/lldb/cmake/modules/AddLLDB.cmake b/lldb/cmake/modules/AddLLDB.cmake
index b58a62ca7771..6f05be384908 100644
--- a/lldb/cmake/modules/AddLLDB.cmake
+++ b/lldb/cmake/modules/AddLLDB.cmake
@@ -227,8 +227,7 @@ endfunction()
function(lldb_add_to_buildtree_lldb_framework name subdir)
# Destination for the copy in the build-tree. While the framework target may
# not exist yet, it will exist when the generator expression gets expanded.
- get_target_property(framework_build_dir liblldb LIBRARY_OUTPUT_DIRECTORY)
- set(copy_dest "${framework_build_dir}/${subdir}/$<TARGET_FILE_NAME:${name}>")
+ set(copy_dest "${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}/${subdir}/$<TARGET_FILE_NAME:${name}>")
# Copy into the given subdirectory for testing.
add_custom_command(TARGET ${name} POST_BUILD
diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake
index c042cbf1b22e..e9ed2229d6bf 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -68,6 +68,9 @@ if(LLDB_BUILD_FRAMEWORK)
set(LLDB_FRAMEWORK_BUILD_DIR bin CACHE STRING "Output directory for LLDB.framework")
set(LLDB_FRAMEWORK_INSTALL_DIR Library/Frameworks CACHE STRING "Install directory for LLDB.framework")
+ get_filename_component(LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR ${LLDB_FRAMEWORK_BUILD_DIR} ABSOLUTE
+ BASE_DIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR})
+
# Essentially, emit the framework's dSYM outside of the framework directory.
set(LLDB_DEBUGINFO_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin CACHE STRING
"Directory to emit dSYM files stripped from executables and libraries (Darwin Only)")
diff --git a/lldb/cmake/modules/LLDBFramework.cmake b/lldb/cmake/modules/LLDBFramework.cmake
index 249fea30a874..b6488936806a 100644
--- a/lldb/cmake/modules/LLDBFramework.cmake
+++ b/lldb/cmake/modules/LLDBFramework.cmake
@@ -1,10 +1,4 @@
-# Path relative to the root binary directory
-get_filename_component(
- framework_target_dir ${LLDB_FRAMEWORK_BUILD_DIR} ABSOLUTE
- BASE_DIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}
-)
-
-message(STATUS "LLDB.framework: build path is '${framework_target_dir}'")
+message(STATUS "LLDB.framework: build path is '${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}'")
message(STATUS "LLDB.framework: install path is '${LLDB_FRAMEWORK_INSTALL_DIR}'")
message(STATUS "LLDB.framework: resources subdirectory is 'Versions/${LLDB_FRAMEWORK_VERSION}/Resources'")
@@ -15,7 +9,7 @@ set_target_properties(liblldb PROPERTIES
OUTPUT_NAME LLDB
VERSION ${LLDB_VERSION}
- LIBRARY_OUTPUT_DIRECTORY ${framework_target_dir}
+ LIBRARY_OUTPUT_DIRECTORY ${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}
# Compatibility version
SOVERSION "1.0.0"
@@ -29,8 +23,8 @@ set_target_properties(liblldb PROPERTIES
# Used in llvm_add_library() to set default output directories for multi-config
# generators. Overwrite to account for special framework output directory.
set_output_directory(liblldb
- BINARY_DIR ${framework_target_dir}
- LIBRARY_DIR ${framework_target_dir}
+ BINARY_DIR ${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}
+ LIBRARY_DIR ${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}
)
lldb_add_post_install_steps_darwin(liblldb ${LLDB_FRAMEWORK_INSTALL_DIR})
@@ -51,7 +45,7 @@ set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_DOCUMENTATION_COMMENTS "YES")
add_custom_command(TARGET liblldb POST_BUILD
COMMAND ${CMAKE_COMMAND} -E create_symlink
Versions/Current/Headers
- ${framework_target_dir}/LLDB.framework/Headers
+ ${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}/LLDB.framework/Headers
COMMENT "LLDB.framework: create Headers symlink"
)
diff --git a/lldb/test/API/CMakeLists.txt b/lldb/test/API/CMakeLists.txt
index 1866e31be322..9aec808073ec 100644
--- a/lldb/test/API/CMakeLists.txt
+++ b/lldb/test/API/CMakeLists.txt
@@ -107,8 +107,7 @@ endif()
if(CMAKE_HOST_APPLE)
if(LLDB_BUILD_FRAMEWORK)
- get_target_property(framework_build_dir liblldb LIBRARY_OUTPUT_DIRECTORY)
- list(APPEND LLDB_TEST_COMMON_ARGS --framework ${framework_build_dir}/LLDB.framework)
+ list(APPEND LLDB_TEST_COMMON_ARGS --framework ${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}/LLDB.framework)
endif()
# Use the same identity for testing
diff --git a/lldb/tools/debugserver/source/CMakeLists.txt b/lldb/tools/debugserver/source/CMakeLists.txt
index 9c5922155872..a7d789dd9e19 100644
--- a/lldb/tools/debugserver/source/CMakeLists.txt
+++ b/lldb/tools/debugserver/source/CMakeLists.txt
@@ -219,8 +219,7 @@ if (debugserver_codesign_identity AND LLDB_BUILD_FRAMEWORK AND
set(pass_entitlements --entitlements ${entitlements})
endif()
- get_target_property(framework_build_dir liblldb LIBRARY_OUTPUT_DIRECTORY)
- set(copy_location ${framework_build_dir}/LLDB.framework/Versions/${LLDB_FRAMEWORK_VERSION}/Resources/debugserver)
+ set(copy_location ${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}/LLDB.framework/Versions/${LLDB_FRAMEWORK_VERSION}/Resources/debugserver)
add_custom_command(TARGET debugserver POST_BUILD
COMMAND ${CMAKE_COMMAND} -E
diff --git a/lldb/tools/driver/CMakeLists.txt b/lldb/tools/driver/CMakeLists.txt
index 06dc88afdaa0..fc10570f5b69 100644
--- a/lldb/tools/driver/CMakeLists.txt
+++ b/lldb/tools/driver/CMakeLists.txt
@@ -33,10 +33,9 @@ set_target_properties(LLDBOptionsTableGen PROPERTIES FOLDER "lldb misc")
if(LLDB_BUILD_FRAMEWORK)
# In the build-tree, we know the exact path to the framework directory.
# The installed framework can be in
diff erent locations.
- get_target_property(framework_build_dir liblldb LIBRARY_OUTPUT_DIRECTORY)
lldb_setup_rpaths(lldb
BUILD_RPATH
- "${framework_build_dir}"
+ "${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}"
INSTALL_RPATH
"@loader_path/../../../SharedFrameworks"
"@loader_path/../../System/Library/PrivateFrameworks"
diff --git a/lldb/tools/lldb-vscode/CMakeLists.txt b/lldb/tools/lldb-vscode/CMakeLists.txt
index a39a27d7d2e6..32cb55368dc2 100644
--- a/lldb/tools/lldb-vscode/CMakeLists.txt
+++ b/lldb/tools/lldb-vscode/CMakeLists.txt
@@ -33,10 +33,9 @@ add_lldb_tool(lldb-vscode
if(LLDB_BUILD_FRAMEWORK)
# In the build-tree, we know the exact path to the framework directory.
# The installed framework can be in
diff erent locations.
- get_target_property(framework_build_dir liblldb LIBRARY_OUTPUT_DIRECTORY)
lldb_setup_rpaths(lldb-vscode
BUILD_RPATH
- "${framework_build_dir}"
+ "${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}"
INSTALL_RPATH
"@loader_path/../../../SharedFrameworks"
"@loader_path/../../System/Library/PrivateFrameworks"
More information about the lldb-commits
mailing list