@@ -68,17 +68,24 @@ if(NOT APPLE_EMBEDDED)
6868 )
6969endif ()
7070
71+ # At configuration time, collect headers for the framework bundle and copy them
72+ # into a staging directory. Later we can copy over the entire folder.
73+ file (GLOB public_headers ${LLDB_SOURCE_DIR} /include /lldb/API/*.h)
74+ set (generated_public_headers ${LLDB_OBJ_DIR} /include /lldb/API/SBLanguages.h)
75+ file (GLOB root_public_headers ${LLDB_SOURCE_DIR} /include /lldb/lldb-*.h)
76+ file (GLOB root_private_headers ${LLDB_SOURCE_DIR} /include /lldb/lldb-private *.h)
77+ list (REMOVE_ITEM root_public_headers ${root_private_headers} )
78+
7179find_program (unifdef_EXECUTABLE unifdef)
7280
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} )
81+ set (lldb_header_staging ${CMAKE_CURRENT_BINARY_DIR} /FrameworkHeaders)
82+ foreach (header
83+ ${public_headers}
84+ ${generated_public_headers}
85+ ${root_public_headers} )
7986
8087 get_filename_component (basename ${header} NAME )
81- set (staged_header ${lldb_framework_header_staging } /${basename} )
88+ set (staged_header ${lldb_header_staging } /${basename} )
8289
8390 if (unifdef_EXECUTABLE)
8491 # unifdef returns 0 when the file is unchanged and 1 if something was changed.
@@ -105,20 +112,13 @@ set_target_properties(liblldb-resource-headers PROPERTIES FOLDER "LLDB/Resources
105112add_dependencies (liblldb-resource -headers liblldb-header-staging)
106113add_dependencies (liblldb liblldb-resource -headers)
107114
108- # Take the headers from the staging directory and fix up their includes for the framework.
109- # Then write them to the output directory.
110- # Also, run unifdef to remove any specified guards from the header files.
111- file (GLOB lldb_framework_header_staging_list ${lldb_framework_header_staging} /*)
112- foreach (header ${lldb_framework_header_staging_list} )
113-
114- set (input_header ${header} )
115- set (output_header $<TARGET_FILE_DIR:liblldb>/Headers/${input_header} )
116-
117- add_custom_command (TARGET liblldb POST_BUILD
118- COMMAND ${LLDB_SOURCE_DIR} /scripts/framework -header-fix.py -f lldb_main -i ${input_header} -o ${output_header} -p ${unifdef_EXECUTABLE} USWIG
119- COMMENT "LLDB.framework: Fix up and copy framework headers"
120- )
121- endforeach ()
115+ # At build time, copy the staged headers into the framework bundle (and do
116+ # some post-processing in-place).
117+ add_custom_command (TARGET liblldb POST_BUILD
118+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${lldb_header_staging} $<TARGET_FILE_DIR:liblldb>/Headers
119+ COMMAND ${LLDB_SOURCE_DIR} /scripts/framework -header-fix.sh $<TARGET_FILE_DIR:liblldb>/Headers ${LLDB_VERSION}
120+ COMMENT "LLDB.framework: copy framework headers"
121+ )
122122
123123# Copy vendor-specific headers from clang (without staging).
124124if (NOT APPLE_EMBEDDED)
0 commit comments