diff --git a/Libraries/LibGfx/CMakeLists.txt b/Libraries/LibGfx/CMakeLists.txt index 86d90285ee6..69b635dedcc 100644 --- a/Libraries/LibGfx/CMakeLists.txt +++ b/Libraries/LibGfx/CMakeLists.txt @@ -70,6 +70,11 @@ set(SOURCES SkiaBackendContext.cpp ) +set(SWIFT_EXCLUDE_HEADERS + MetalContext.h + VulkanContext.h +) + if (APPLE) list(APPEND SOURCES MetalContext.mm) endif() @@ -130,7 +135,7 @@ else() endif() 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 Color.swift ) diff --git a/Meta/CMake/code_generators.cmake b/Meta/CMake/code_generators.cmake index 236efa0c877..1240ca3bb54 100644 --- a/Meta/CMake/code_generators.cmake +++ b/Meta/CMake/code_generators.cmake @@ -24,7 +24,7 @@ function(embed_as_string name source_file output source_variable_name) endfunction() 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) set(MODULE_MAP_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") endif() @@ -44,7 +44,8 @@ function(generate_clang_module_map target_name) --module-name "${module_name}" --module-map "${module_map_file}" --vfs-map ${vfs_overlay_file} - ${MODULE_MAP_GENERATED_FILES} + --exclude-files ${MODULE_MAP_EXCLUDE_FILES} + --generated-files ${MODULE_MAP_GENERATED_FILES} VERBATIM DEPENDS "${SerenityOS_SOURCE_DIR}/Meta/generate_clang_module_map.py" ) diff --git a/Meta/generate_clang_module_map.py b/Meta/generate_clang_module_map.py index 58971ed3801..963463a146b 100644 --- a/Meta/generate_clang_module_map.py +++ b/Meta/generate_clang_module_map.py @@ -26,10 +26,11 @@ def main(): epilog=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) 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('-n', '--module-name', help='top-level module name') - parser.add_argument('-m', '--module-map', required=True, help='output module map file') - parser.add_argument('-v', '--vfs-map', required=True, help='output VFS map file') + parser.add_argument('--module-name', help='top-level module name') + parser.add_argument('--module-map', required=True, help='output module map file') + parser.add_argument('--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() root = pathlib.Path(args.directory) @@ -38,8 +39,9 @@ def main(): return 1 pathlib.Path(args.module_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_map = f"module {module_name} {{\n"