diff --git a/build-xcframework.sh b/build-xcframework.sh index 2307674..94f47c7 100755 --- a/build-xcframework.sh +++ b/build-xcframework.sh @@ -31,6 +31,13 @@ lipo -create \ -output "$BUILD_DIR/macos/libtext_processing_rs.a" echo "Creating XCFramework..." +# NOTE: headers live in swift/include/CNemoTextProcessing/ so each slice gets +# Headers/CNemoTextProcessing/module.modulemap. Xcode's ProcessXCFramework copies +# each xcframework's Headers/ into the SHARED $BUILT_PRODUCTS_DIR/include, so a +# top-level include/module.modulemap collides with any other xcframework that +# ships one ("Multiple commands produce .../include/module.modulemap"). Clang +# still resolves `import CNemoTextProcessing` because it looks for a module map +# in a subdirectory named after the module. Keep the directory name == module name. xcodebuild -create-xcframework \ -library "$BUILD_DIR/macos/libtext_processing_rs.a" \ -headers swift/include \ diff --git a/swift/include/module.modulemap b/swift/include/CNemoTextProcessing/module.modulemap similarity index 100% rename from swift/include/module.modulemap rename to swift/include/CNemoTextProcessing/module.modulemap diff --git a/swift/include/nemo_text_processing.h b/swift/include/CNemoTextProcessing/nemo_text_processing.h similarity index 100% rename from swift/include/nemo_text_processing.h rename to swift/include/CNemoTextProcessing/nemo_text_processing.h