Skip to content

Commit b3bbd3f

Browse files
JoMinSeotinyjin
authored andcommitted
add macOS platform support
- Add macOS example app and Xcode configuration - Configure pubspec.yaml for macOS compatibility - Create shell script for libthorvg.dylib generation
1 parent 666aff9 commit b3bbd3f

37 files changed

Lines changed: 1563 additions & 2 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ pubspec.lock
3232
# Generated binaries
3333
android/src/main/jniLibs/
3434
ios/Frameworks/
35+
macos/Frameworks/
3536

3637
# Generated android build files(.cxx)
3738
android/app/.cxx

example/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
*.swp
66
.DS_Store
77
.atom/
8+
.build/
89
.buildlog/
910
.history
1011
.svn/
12+
.swiftpm/
1113
migrate_working_dir/
1214

1315
# IntelliJ related

example/macos/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Flutter-related
2+
**/Flutter/ephemeral/
3+
**/Pods/
4+
5+
# Xcode-related
6+
**/dgph
7+
**/xcuserdata/
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2+
#include "ephemeral/Flutter-Generated.xcconfig"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2+
#include "ephemeral/Flutter-Generated.xcconfig"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//
2+
// Generated file. Do not edit.
3+
//
4+
5+
import FlutterMacOS
6+
import Foundation
7+
8+
9+
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
10+
}

example/macos/Podfile

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
platform :osx, '10.14'
2+
3+
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
4+
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
5+
6+
project 'Runner', {
7+
'Debug' => :debug,
8+
'Profile' => :release,
9+
'Release' => :release,
10+
}
11+
12+
def flutter_root
13+
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
14+
unless File.exist?(generated_xcode_build_settings_path)
15+
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
16+
end
17+
18+
File.foreach(generated_xcode_build_settings_path) do |line|
19+
matches = line.match(/FLUTTER_ROOT\=(.*)/)
20+
return matches[1].strip if matches
21+
end
22+
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
23+
end
24+
25+
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
26+
27+
flutter_macos_podfile_setup
28+
29+
target 'Runner' do
30+
use_frameworks!
31+
32+
flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
33+
target 'RunnerTests' do
34+
inherit! :search_paths
35+
end
36+
end
37+
38+
post_install do |installer|
39+
installer.pods_project.targets.each do |target|
40+
flutter_additional_macos_build_settings(target)
41+
end
42+
end

example/macos/Podfile.lock

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
PODS:
2+
- FlutterMacOS (1.0.0)
3+
- thorvg (1.0.0-beta.0):
4+
- FlutterMacOS
5+
6+
DEPENDENCIES:
7+
- FlutterMacOS (from `Flutter/ephemeral`)
8+
- thorvg (from `Flutter/ephemeral/.symlinks/plugins/thorvg/macos`)
9+
10+
EXTERNAL SOURCES:
11+
FlutterMacOS:
12+
:path: Flutter/ephemeral
13+
thorvg:
14+
:path: Flutter/ephemeral/.symlinks/plugins/thorvg/macos
15+
16+
SPEC CHECKSUMS:
17+
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
18+
thorvg: cd85d234f639201c8d58d80ea923e136c6deffd7
19+
20+
PODFILE CHECKSUM: 7eb978b976557c8c1cd717d8185ec483fd090a82
21+
22+
COCOAPODS: 1.16.2

0 commit comments

Comments
 (0)