kostub / iosMath

Beautiful math equation rendering on iOS and MacOS
MIT License
1.36k stars 234 forks source link

Add support for Swift Package Manager #173

Open maitbayev opened 2 years ago

maitbayev commented 2 years ago

Almost all tests from iosMathTests pass with swift test command, except there are some numerical differences in MTTypesetterTest, probably coming from iOS/MacOS platform changes and unrelated to SPM.

The following things were added to satisfy the Swift Package Manager requirements:

  1. Adds include folder under iosMath with symlinked headers. SPM will automatically create module.modulemap from these headers for interoperability with Swift and Objective-C @import.
  2. Symlinks fonts folder under iosMath so that the folder is packaged into a module bundle. Pointing to ../fonts in Package.swift didn't work. Maybe it is cleaner to just move the fonts folder instead of symlinking?
  3. Use the SWIFTPM_MODULE_BUNDLE preprocessor to access the module bundle. See: https://github.com/apple/swift-evolution/blob/master/proposals/0271-package-manager-resources.md
maitbayev commented 2 years ago

cc @kostub