mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 15:10:19 +00:00
Meta+LibGfx: Exclude Metal and Vulkan headers from Clang module map
These headers are platform-specific, and shouldn't need to be used by Swift code anyway.
This commit is contained in:
parent
c998f22f9e
commit
9812fac2c3
Notes:
github-actions[bot]
2024-11-15 17:56:43 +00:00
Author: https://github.com/ADKaster Commit: https://github.com/LadybirdBrowser/ladybird/commit/9812fac2c3e Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2350
3 changed files with 16 additions and 8 deletions
|
@ -70,6 +70,11 @@ set(SOURCES
|
||||||
SkiaBackendContext.cpp
|
SkiaBackendContext.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set(SWIFT_EXCLUDE_HEADERS
|
||||||
|
MetalContext.h
|
||||||
|
VulkanContext.h
|
||||||
|
)
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
list(APPEND SOURCES MetalContext.mm)
|
list(APPEND SOURCES MetalContext.mm)
|
||||||
endif()
|
endif()
|
||||||
|
@ -130,7 +135,7 @@ else()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (ENABLE_SWIFT)
|
if (ENABLE_SWIFT)
|
||||||
generate_clang_module_map(LibGfx GENERATED_FILES ${generated_headers})
|
generate_clang_module_map(LibGfx GENERATED_FILES ${generated_headers} EXCLUDE_FILES ${SWIFT_EXCLUDE_HEADERS})
|
||||||
target_sources(LibGfx PRIVATE
|
target_sources(LibGfx PRIVATE
|
||||||
Color.swift
|
Color.swift
|
||||||
)
|
)
|
||||||
|
|
|
@ -24,7 +24,7 @@ function(embed_as_string name source_file output source_variable_name)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(generate_clang_module_map target_name)
|
function(generate_clang_module_map target_name)
|
||||||
cmake_parse_arguments(PARSE_ARGV 1 MODULE_MAP "" "DIRECTORY" "GENERATED_FILES")
|
cmake_parse_arguments(PARSE_ARGV 1 MODULE_MAP "" "DIRECTORY" "GENERATED_FILES;EXCLUDE_FILES")
|
||||||
if (NOT MODULE_MAP_DIRECTORY)
|
if (NOT MODULE_MAP_DIRECTORY)
|
||||||
set(MODULE_MAP_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
|
set(MODULE_MAP_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||||
endif()
|
endif()
|
||||||
|
@ -44,7 +44,8 @@ function(generate_clang_module_map target_name)
|
||||||
--module-name "${module_name}"
|
--module-name "${module_name}"
|
||||||
--module-map "${module_map_file}"
|
--module-map "${module_map_file}"
|
||||||
--vfs-map ${vfs_overlay_file}
|
--vfs-map ${vfs_overlay_file}
|
||||||
${MODULE_MAP_GENERATED_FILES}
|
--exclude-files ${MODULE_MAP_EXCLUDE_FILES}
|
||||||
|
--generated-files ${MODULE_MAP_GENERATED_FILES}
|
||||||
VERBATIM
|
VERBATIM
|
||||||
DEPENDS "${SerenityOS_SOURCE_DIR}/Meta/generate_clang_module_map.py"
|
DEPENDS "${SerenityOS_SOURCE_DIR}/Meta/generate_clang_module_map.py"
|
||||||
)
|
)
|
||||||
|
|
|
@ -26,10 +26,11 @@ def main():
|
||||||
epilog=__doc__,
|
epilog=__doc__,
|
||||||
formatter_class=argparse.RawDescriptionHelpFormatter)
|
formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||||
parser.add_argument('directory', help='source directory to generate module map for')
|
parser.add_argument('directory', help='source directory to generate module map for')
|
||||||
parser.add_argument('generated_files', nargs='+', help='extra files to include in the module map')
|
parser.add_argument('--module-name', help='top-level module name')
|
||||||
parser.add_argument('-n', '--module-name', help='top-level module name')
|
parser.add_argument('--module-map', required=True, help='output module map file')
|
||||||
parser.add_argument('-m', '--module-map', required=True, help='output module map file')
|
parser.add_argument('--vfs-map', required=True, help='output VFS map file')
|
||||||
parser.add_argument('-v', '--vfs-map', required=True, help='output VFS map file')
|
parser.add_argument('--exclude-files', nargs='*', required=False, help='files to exclude in the module map')
|
||||||
|
parser.add_argument('--generated-files', nargs='*', help='extra files to include in the module map')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
root = pathlib.Path(args.directory)
|
root = pathlib.Path(args.directory)
|
||||||
|
@ -38,8 +39,9 @@ def main():
|
||||||
return 1
|
return 1
|
||||||
pathlib.Path(args.module_map).parent.mkdir(parents=True, exist_ok=True)
|
pathlib.Path(args.module_map).parent.mkdir(parents=True, exist_ok=True)
|
||||||
pathlib.Path(args.vfs_map).parent.mkdir(parents=True, exist_ok=True)
|
pathlib.Path(args.vfs_map).parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
exclude_files = set(args.exclude_files) if args.exclude_files else set()
|
||||||
|
|
||||||
header_files = [f for f in root.rglob('**/*.h') if f.is_file()]
|
header_files = [f for f in root.rglob('**/*.h') if f.is_file() and f.name not in exclude_files]
|
||||||
module_name = args.module_name if args.module_name else root.name
|
module_name = args.module_name if args.module_name else root.name
|
||||||
|
|
||||||
module_map = f"module {module_name} {{\n"
|
module_map = f"module {module_name} {{\n"
|
||||||
|
|
Loading…
Reference in a new issue