| 358 | } |
| 359 | |
| 360 | pub fn get_include_sys_headers(deopt: &Deopt) -> &'static Vec<String> { |
| 361 | static SYS_HEADERS: OnceCell<Vec<String>> = OnceCell::new(); |
| 362 | SYS_HEADERS.get_or_init(|| { |
| 363 | let header_trees = get_library_dep_trees(deopt); |
| 364 | let header_strs: Vec<String> = get_independent_headers(header_trees) |
| 365 | .unwrap() |
| 366 | .iter() |
| 367 | .map(|x| x.to_string()) |
| 368 | .collect(); |
| 369 | let mut sys_headers = Vec::new(); |
| 370 | for tree in header_trees { |
| 371 | let name = tree.get_name(); |
| 372 | if header_strs.contains(&name.to_string()) { |
| 373 | let headers = get_included_sys_header(tree); |
| 374 | // remove the prefix of sys headers |
| 375 | for header in headers { |
| 376 | if let Some(idx) = header.rfind("/include/") { |
| 377 | let header = header[idx + "/include/".len()..].to_string(); |
| 378 | if !sys_headers.contains(&header) { |
| 379 | sys_headers.push(header); |
| 380 | } |
| 381 | } |
| 382 | } |
| 383 | } |
| 384 | } |
| 385 | sys_headers |
| 386 | }) |
| 387 | } |
| 388 | |
| 389 | pub fn get_include_sys_headers_str() -> String { |
| 390 | let deopt = Deopt::new(get_library_name()).unwrap(); |