Skip to content

Commit bca3ee0

Browse files
committed
[lldb][framework] Glob headers from source for framework
When gathering the headers to fix up and place in LLDB.framework, we were previously globbing the header files from a location in the build directory. This commit changes this to glob from the source directory instead, as we were globbing from the build directory without ensuring that the necessary files were actually in that location before globbing.f
1 parent 8f37fb2 commit bca3ee0

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

lldb/cmake/modules/LLDBFramework.cmake

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,21 @@ endif()
7070

7171
find_program(unifdef_EXECUTABLE unifdef)
7272

73-
# All necessary header files will be staged in the include directory in the build directory,
74-
# so just copy the files from there into the framework's staging directory.
75-
set(lldb_build_dir_header_staging "${CMAKE_BINARY_DIR}/include/lldb")
76-
set(lldb_framework_header_staging "${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders")
77-
file(GLOB lldb_build_dir_header_staging_list ${lldb_build_dir_header_staging}/*)
78-
foreach(header ${lldb_build_dir_header_staging_list})
73+
# Glob all necessary header files from source and place them into a list.
74+
# These headers will then be collected for the framework and placed in the
75+
# FrameworkHeaders staging directory.
76+
file(GLOB public_headers ${LLDB_SOURCE_DIR}/include/lldb/API/*.h)
77+
set(generated_public_headers ${LLDB_OBJ_DIR}/include/lldb/API/SBLanguages.h)
78+
file(GLOB root_public_headers ${LLDB_SOURCE_DIR}/include/lldb/lldb-*.h)
79+
file(GLOB root_private_headers ${LLDB_SOURCE_DIR}/include/lldb/lldb-private*.h)
80+
list(REMOVE_ITEM root_public_headers ${root_private_headers})
81+
set(lldb_framework_header_staging_list ${public_headers} ${generated_public_headers} ${root_public_headers})
82+
83+
set(lldb_framework_header_staging_dir ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders)
84+
foreach(header ${lldb_framework_header_staging_list})
7985

8086
get_filename_component(basename ${header} NAME)
81-
set(staged_header ${lldb_framework_header_staging}/${basename})
87+
set(staged_header ${lldb_framework_header_staging_dir}/${basename})
8288

8389
if(unifdef_EXECUTABLE)
8490
# unifdef returns 0 when the file is unchanged and 1 if something was changed.
@@ -106,17 +112,17 @@ add_dependencies(liblldb-resource-headers liblldb-header-staging)
106112
add_dependencies(liblldb liblldb-resource-headers)
107113

108114
# Take the headers from the staging directory and fix up their includes for the framework.
109-
# Then write them to the output directory.
115+
# Then write them to the framework itself.
110116
# Also, run unifdef to remove any specified guards from the header files.
111-
file(GLOB lldb_framework_header_staging_list ${lldb_framework_header_staging}/*)
117+
file(GLOB lldb_framework_staged_headers ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders/*.h)
112118
foreach(header ${lldb_framework_header_staging_list})
113119

114120
set(input_header ${header})
115121
get_filename_component(header_basename ${input_header} NAME)
116122
set(output_header $<TARGET_FILE_DIR:liblldb>/Headers/${header_basename})
117123

118124
add_custom_command(TARGET liblldb POST_BUILD
119-
COMMAND ${LLDB_SOURCE_DIR}/scripts/framework-header-fix.py -f lldb_main -i ${input_header} -o ${output_header} -p ${unifdef_EXECUTABLE} USWIG
125+
COMMAND "${Python3_EXECUTABLE}" ${LLDB_SOURCE_DIR}/scripts/framework-header-fix.py -f lldb_main -i ${input_header} -o ${output_header} -p ${unifdef_EXECUTABLE} USWIG
120126
COMMENT "LLDB.framework: Fix up and copy framework headers"
121127
)
122128
endforeach()

0 commit comments

Comments
 (0)