Skip to content

Conversation

@JoMinSeo
Copy link

Summary

Adds macOS platform support to ThorVG Flutter with universal binary support for both Apple Silicon (arm64) and Intel (x86_64) architectures.

Changes

  • Platform Support: Added macOS to pubspec.yaml as supported FFI plugin platform
  • Build System: Created lottie/flutter_build.macos.sh script that builds universal binaries
  • Cross-compilation: Added thorvg/cross/macos_arm64.txt and thorvg/cross/macos_x86_64.txt for macOS cross-compilation
  • CocoaPods: Added macos/thorvg.podspec for macOS integration
  • Example App: Complete macOS example application with Xcode project configuration
  • Documentation: Updated README with macOS platform support and build instructions

Build Command:

cd lottie && sh flutter_build.macos.sh

Output: macos/Frameworks/libthorvg.dylib (universal binary)

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds macOS platform support (arm64 + x86_64 universal) for the ThorVG Flutter FFI plugin, including build script, CocoaPods integration, example app, and documentation updates.

  • Adds macOS target declarations (pubspec + podspec) and dynamic library loading branch in Dart.
  • Introduces build script to produce a universal binary (needs adjustments for producing a .dylib properly).
  • Adds full macOS example project, configs, and README instructions.

Reviewed Changes

Copilot reviewed 28 out of 38 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
thorvg Updated submodule commit to newer ThorVG revision supporting macOS build.
pubspec.yaml Declares macOS as an FFI plugin platform.
macos/thorvg.podspec New Podspec for macOS CocoaPods integration.
lottie/flutter_build.macos.sh New macOS universal build script (static/shared build logic).
lib/src/thorvg.dart Adds macOS dynamic library load branch; minor formatting change.
example/macos/RunnerTests/RunnerTests.swift Adds empty XCTest file for macOS example.
example/macos/Runner/Release.entitlements Sandbox entitlements for release.
example/macos/Runner/MainFlutterWindow.swift Main Flutter window implementation.
example/macos/Runner/Info.plist macOS app Info.plist.
example/macos/Runner/DebugProfile.entitlements Debug/profile entitlements.
example/macos/Runner/Configs/Warnings.xcconfig Compiler warning settings.
example/macos/Runner/Configs/Release.xcconfig Release build includes Flutter + warnings.
example/macos/Runner/Configs/Debug.xcconfig Debug build includes Flutter + warnings.
example/macos/Runner/Configs/AppInfo.xcconfig App metadata (name, bundle id, copyright).
example/macos/Runner/Base.lproj/MainMenu.xib Main menu UI definition.
example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json App icon asset definitions.
example/macos/Runner/AppDelegate.swift App delegate overrides for termination & state.
example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist Xcode workspace checks plist.
example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme Xcode build scheme.
example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist Duplicate workspace checks plist.
example/macos/Runner.xcodeproj/project.pbxproj Full Xcode project file for macOS example.
example/macos/Podfile CocoaPods setup for macOS (platform 10.14).
example/macos/Flutter/GeneratedPluginRegistrant.swift Generated plugin registrant (empty).
example/macos/Flutter/Flutter-Release.xcconfig Includes Pods + generated settings (Release).
example/macos/Flutter/Flutter-Debug.xcconfig Includes Pods + generated settings (Debug).
example/macos/.gitignore Ignores Pods/ephemeral/Xcode user data.
example/.gitignore Adds macOS / Swift build artifacts ignores.
README.md Documents macOS support & build steps.
Files not reviewed (1)
  • example/macos/Runner.xcworkspace/contents.xcworkspacedata: Language not supported

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Member

@tinyjin tinyjin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. Please check the comments

@tinyjin
Copy link
Member

tinyjin commented Oct 19, 2025

Also please check comment here:
thorvg/thorvg#3899 (review)

We might need the cross files to support universal binary (currently we combine them in fat binary). However as I commented there, technically we're able to build macOS without cross file. If that is only need for Flutter build system, we better move the cross files into thorvg.flutter repo.

@tinyjin tinyjin self-requested a review November 7, 2025 03:45
Copy link
Member

@tinyjin tinyjin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. Suggesting minor changes

@@ -0,0 +1,23 @@
# build for macOS Apple Silicon
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be better to move cross file to each platform for clarify.

<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
BuildableName = "thorvg_example.app"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

example app's identifier is org.thorvg.example

- Add macOS example app and Xcode configuration
- Configure pubspec.yaml for macOS compatibility
- Create shell script for libthorvg.dylib generation
- Add cross-compilation files and build script for macOS arm64/x86_64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improve features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants