Meta+Libraries+AK: Append Cxx to imported library module names in swift

At the same time, simplify CMakeLists magic for libraries that want to
include Swift code in the library. The Lib-less name of the library is
now always the module name for the library with any Swift additions,
extensions, etc. All vfs overlays now live in a common location to make
finding them easier from CMake functions. A new pattern is needed for
the Lib-less modules to re-export their Cxx counterparts.
This commit is contained in:
Andrew Kaster 2024-08-26 19:04:05 -06:00 committed by Andrew Kaster
parent f27d638e0a
commit c5153cb398
Notes: github-actions[bot] 2024-08-27 23:23:23 +00:00
13 changed files with 68 additions and 80 deletions

View file

@ -29,14 +29,22 @@ function(generate_clang_module_map target_name)
set(MODULE_MAP_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
endif()
string(REPLACE "Lib" "" module_name ${target_name})
set(module_name "${module_name}Cxx")
set(module_map_file "${CMAKE_CURRENT_BINARY_DIR}/module/module.modulemap")
set(vfs_overlay_file "${CMAKE_CURRENT_BINARY_DIR}/vfs_overlay.yaml")
set(vfs_overlay_file "${VFS_OVERLAY_DIRECTORY}/${target_name}_vfs_overlay.yaml")
find_package(Python3 REQUIRED COMPONENTS Interpreter)
# FIXME: Make this depend on the public headers of the target
add_custom_command(
OUTPUT "${module_map_file}"
COMMAND "${Python3_EXECUTABLE}" "${SerenityOS_SOURCE_DIR}/Meta/generate_clang_module_map.py" "${MODULE_MAP_DIRECTORY}" --module-map "${module_map_file}" --vfs-map ${vfs_overlay_file} ${MODULE_MAP_GENERATED_FILES}
COMMAND "${Python3_EXECUTABLE}" "${SerenityOS_SOURCE_DIR}/Meta/generate_clang_module_map.py"
"${MODULE_MAP_DIRECTORY}"
--module-name "${module_name}"
--module-map "${module_map_file}"
--vfs-map ${vfs_overlay_file}
${MODULE_MAP_GENERATED_FILES}
VERBATIM
DEPENDS "${SerenityOS_SOURCE_DIR}/Meta/generate_clang_module_map.py"
)