# Generate and install swift interface files # TODO: CMake should learn how to model library evolution and generate this # stuff automatically. # Generate a swift interface file for the target if library evolution is enabled function(emit_swift_interface target) # Generate the target-variant binary swift module when performing zippered # build if(${PROJECT_NAME}_VARIANT_MODULE_TRIPLE) set(variant_module_tmp_dir "${CMAKE_CURRENT_BINARY_DIR}/${target}-${${PROJECT_NAME}_VARIANT_MODULE_TRIPLE}") file(MAKE_DIRECTORY "${variant_module_tmp_dir}") target_compile_options(${target} PRIVATE "$<$:SHELL:-emit-variant-module-path ${variant_module_tmp_dir}/${target}.swiftmodule>") endif() # Generate textual swift interfaces is library-evolution is enabled if(${PROJECT_NAME}_ENABLE_LIBRARY_EVOLUTION) target_compile_options(${target} PRIVATE $<$:-emit-module-interface-path$${CMAKE_CURRENT_BINARY_DIR}/$.swiftinterface> $<$:-emit-private-module-interface-path$${CMAKE_CURRENT_BINARY_DIR}/$.private.swiftinterface> $<$:-library-level$api> $<$:-Xfrontend$-require-explicit-availability=ignore>) # Emit catalyst swiftmodules and interfaces if(${PROJECT_NAME}_VARIANT_MODULE_TRIPLE) target_compile_options(${target} PRIVATE "$<$:SHELL:-emit-variant-module-interface-path ${variant_module_tmp_dir}/${target}.swiftinterface>" "$<$:SHELL:-emit-variant-private-module-interface-path ${variant_module_tmp_dir}/${target}.private.swiftinterface>") endif() endif() endfunction()