@@ -640,8 +640,11 @@ function(_compile_swift_files
640
640
if (SWIFT_ENABLE_MODULE_INTERFACES )
641
641
set (interface_file "${module_base} .swiftinterface" )
642
642
set (interface_file_static "${module_base_static} .swiftinterface" )
643
+ set (private_interface_file "${module_base} .private.swiftinterface" )
644
+ set (private_interface_file_static "${module_base_static} .private.swiftinterface" )
643
645
list (APPEND swift_module_flags
644
- "-emit-module-interface-path" "${interface_file} " )
646
+ "-emit-module-interface-path" "${interface_file} "
647
+ "-emit-private-module-interface-path" "${private_interface_file} " )
645
648
endif ()
646
649
647
650
if (NOT SWIFTFILE_IS_STDLIB_CORE )
@@ -652,7 +655,7 @@ function(_compile_swift_files
652
655
set (module_outputs "${module_file} " "${module_doc_file} " )
653
656
654
657
if (interface_file )
655
- list (APPEND module_outputs "${interface_file} " )
658
+ list (APPEND module_outputs "${interface_file} " " ${private_interface_file} " )
656
659
endif ()
657
660
658
661
set (optional_arg )
@@ -695,9 +698,11 @@ function(_compile_swift_files
695
698
696
699
if (SWIFT_ENABLE_MODULE_INTERFACES )
697
700
set (maccatalyst_interface_file "${maccatalyst_module_base} .swiftinterface" )
698
- list (APPEND maccatalyst_module_outputs "${maccatalyst_interface_file} " )
701
+ set (maccatalyst_private_interface_file "${maccatalyst_module_base} .private.swiftinterface" )
702
+ list (APPEND maccatalyst_module_outputs "${maccatalyst_interface_file} " "${maccatalyst_private_interface_file} " )
699
703
else ()
700
704
set (maccatalyst_interface_file )
705
+ set (maccatalyst_private_interface_file )
701
706
endif ()
702
707
703
708
swift_install_in_component (DIRECTORY ${maccatalyst_specific_module_dir}
@@ -720,8 +725,8 @@ function(_compile_swift_files
720
725
set (module_outputs "${module_file} " "${module_doc_file} " )
721
726
set (module_outputs_static "${module_file_static} " "${module_doc_file_static} " )
722
727
if (interface_file )
723
- list (APPEND module_outputs "${interface_file} " )
724
- list (APPEND module_outputs_static "${interface_file_static} " )
728
+ list (APPEND module_outputs "${interface_file} " " ${private_interface_file} " )
729
+ list (APPEND module_outputs_static "${interface_file_static} " " ${private_interface_file_static} " )
725
730
endif ()
726
731
727
732
swift_install_in_component (DIRECTORY "${specific_module_dir} "
@@ -821,13 +826,23 @@ function(_compile_swift_files
821
826
list (APPEND maccatalyst_swift_flags
822
827
"-I" "${lib_dir} /${maccatalyst_library_subdir} " )
823
828
set (maccatalyst_swift_module_flags ${swift_module_flags} )
829
+
830
+ # Remove original interface file
824
831
list (FIND maccatalyst_swift_module_flags "${interface_file} " interface_file_index )
825
832
if (NOT interface_file_index EQUAL -1 )
826
833
list (INSERT maccatalyst_swift_module_flags ${interface_file_index} "${maccatalyst_interface_file} " )
827
834
math (EXPR old_interface_file_index "${interface_file_index} + 1" )
828
835
list (REMOVE_AT maccatalyst_swift_module_flags ${old_interface_file_index} )
829
836
endif ()
830
837
838
+ # Remove original private interface
839
+ list (FIND maccatalyst_swift_module_flags "${private_interface_file} " private_interface_file_index )
840
+ if (NOT private_interface_file_index EQUAL -1 )
841
+ list (INSERT maccatalyst_swift_module_flags ${private_interface_file_index} "${maccatalyst_private_interface_file} " )
842
+ math (EXPR old_interface_file_index "${private_interface_file_index} + 1" )
843
+ list (REMOVE_AT maccatalyst_swift_module_flags ${old_interface_file_index} )
844
+ endif ()
845
+
831
846
# We still need to change the main swift flags
832
847
# so we can use the correct modules
833
848
# when building for macOS
0 commit comments