@@ -70,33 +70,6 @@ endif()
70
70
71
71
find_program (unifdef_EXECUTABLE unifdef )
72
72
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} )
79
-
80
- get_filename_component (basename ${header} NAME )
81
- set (staged_header ${lldb_framework_header_staging} /${basename} )
82
-
83
- if (unifdef_EXECUTABLE )
84
- # unifdef returns 0 when the file is unchanged and 1 if something was changed.
85
- # That means if we successfully remove SWIG code, the build system believes
86
- # that the command has failed and stops. This is undesirable.
87
- set (copy_command ${unifdef_EXECUTABLE} -USWIG -o ${staged_header} ${header} || (exit 0 ))
88
- else ()
89
- set (copy_command ${CMAKE_COMMAND} -E copy ${header} ${staged_header} )
90
- endif ()
91
-
92
- add_custom_command (
93
- DEPENDS ${header} OUTPUT ${staged_header}
94
- COMMAND ${copy_command}
95
- COMMENT "LLDB.framework: collect framework header and remove SWIG macros" )
96
-
97
- list (APPEND lldb_staged_headers ${staged_header} )
98
- endforeach ()
99
-
100
73
# Wrap output in a target, so lldb-framework can depend on it.
101
74
add_custom_target (liblldb-resource-headers DEPENDS lldb-sbapi-dwarf-enums ${lldb_staged_headers} )
102
75
set_target_properties (liblldb-resource-headers PROPERTIES FOLDER "LLDB/Resources" )
@@ -105,18 +78,32 @@ set_target_properties(liblldb-resource-headers PROPERTIES FOLDER "LLDB/Resources
105
78
add_dependencies (liblldb-resource-headers liblldb-header-staging )
106
79
add_dependencies (liblldb liblldb-resource-headers )
107
80
108
- # Take the headers from the staging directory and fix up their includes for the framework.
109
- # Then write them to the output directory.
81
+ # Glob all necessary header files from source and place them into a list.
82
+ file (GLOB public_headers ${LLDB_SOURCE_DIR} /include/lldb/API/*.h )
83
+ set (generated_public_headers ${LLDB_OBJ_DIR} /include/lldb/API/SBLanguages.h )
84
+ file (GLOB root_public_headers ${LLDB_SOURCE_DIR} /include/lldb/lldb-*.h )
85
+ file (GLOB root_private_headers ${LLDB_SOURCE_DIR} /include/lldb/lldb-private*.h )
86
+ list (REMOVE_ITEM root_public_headers ${root_private_headers} )
87
+ set (lldb_framework_header_list ${public_headers} ${generated_public_headers} ${root_public_headers} )
88
+
89
+ add_custom_target (lldb-framework-fixup-all-headers )
90
+ add_dependencies (lldb-framework-fixup-all-headers liblldb-header-staging )
91
+ add_dependencies (liblldb lldb-framework-fixup-all-headers )
92
+
93
+ # Go through the header basenames from source and fix up their includes for the framework.
94
+ # Then write them to the framework itself.
110
95
# 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} )
96
+ foreach (header ${lldb_framework_header_list} )
113
97
114
- set ( input_header ${header} )
115
- get_filename_component ( header_basename ${input_header} NAME )
98
+ get_filename_component ( header_basename ${header} NAME )
99
+ set ( input_header ${CMAKE_BINARY_DIR} /include/lldb/${header_basename} )
116
100
set (output_header $< TARGET_FILE_DIR:liblldb> /Headers/${header_basename} )
117
101
118
- 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
102
+ add_custom_target (lldb-framework-fixup-header-${header_basename} DEPENDS ${input_header} )
103
+ add_dependencies (lldb-framework-fixup-all-headers lldb-framework-fixup-header-${header_basename} )
104
+
105
+ add_custom_command (TARGET lldb-framework-fixup-header-${header_basename} POST_BUILD
106
+ COMMAND "${Python3_EXECUTABLE} " ${LLDB_SOURCE_DIR} /scripts/framework-header-fix.py -f lldb_main -i ${input_header} -o ${output_header} -p ${unifdef_EXECUTABLE} USWIG
120
107
COMMENT "LLDB.framework: Fix up and copy framework headers"
121
108
)
122
109
endforeach ()
0 commit comments