diff --git a/.gitignore b/.gitignore index 59d1dcb..0bbb9c2 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,5 @@ build/ .flutter-plugins-dependencies android/src/main/jniLibs/ + +macos/frostdart.dylib diff --git a/README.md b/README.md index 834c8f5..af38f88 100644 --- a/README.md +++ b/README.md @@ -11,3 +11,7 @@ git submodule update --init --recursive cd scripts/[platform] ./build_all.sh ``` + +or `build_all.bat` for Windows. + +Rust 1.71.0 is required. `[rustup](https://rustup.rs/) toolchain install 1.71.0-x86_64-pc-windows-msvc` for Windows. diff --git a/example/ios/Podfile b/example/ios/Podfile new file mode 100644 index 0000000..fdcc671 --- /dev/null +++ b/example/ios/Podfile @@ -0,0 +1,44 @@ +# Uncomment this line to define a global platform for your project +# platform :ios, '11.0' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_ios_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) + target 'RunnerTests' do + inherit! :search_paths + end +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_ios_build_settings(target) + end +end diff --git a/example/macos/Flutter/Flutter-Debug.xcconfig b/example/macos/Flutter/Flutter-Debug.xcconfig index c2efd0b..4b81f9b 100644 --- a/example/macos/Flutter/Flutter-Debug.xcconfig +++ b/example/macos/Flutter/Flutter-Debug.xcconfig @@ -1 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "ephemeral/Flutter-Generated.xcconfig" diff --git a/example/macos/Flutter/Flutter-Release.xcconfig b/example/macos/Flutter/Flutter-Release.xcconfig index c2efd0b..5caa9d1 100644 --- a/example/macos/Flutter/Flutter-Release.xcconfig +++ b/example/macos/Flutter/Flutter-Release.xcconfig @@ -1 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "ephemeral/Flutter-Generated.xcconfig" diff --git a/example/macos/Podfile b/example/macos/Podfile new file mode 100644 index 0000000..c795730 --- /dev/null +++ b/example/macos/Podfile @@ -0,0 +1,43 @@ +platform :osx, '10.14' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_macos_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) + target 'RunnerTests' do + inherit! :search_paths + end +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_macos_build_settings(target) + end +end diff --git a/example/macos/Podfile.lock b/example/macos/Podfile.lock new file mode 100644 index 0000000..d1ba120 --- /dev/null +++ b/example/macos/Podfile.lock @@ -0,0 +1,22 @@ +PODS: + - FlutterMacOS (1.0.0) + - frostdart (0.0.1): + - FlutterMacOS + +DEPENDENCIES: + - FlutterMacOS (from `Flutter/ephemeral`) + - frostdart (from `Flutter/ephemeral/.symlinks/plugins/frostdart/macos`) + +EXTERNAL SOURCES: + FlutterMacOS: + :path: Flutter/ephemeral + frostdart: + :path: Flutter/ephemeral/.symlinks/plugins/frostdart/macos + +SPEC CHECKSUMS: + FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 + frostdart: e6bf3119527ccfbcec1b8767da6ede5bb4c4f716 + +PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367 + +COCOAPODS: 1.11.3 diff --git a/example/macos/Runner.xcodeproj/project.pbxproj b/example/macos/Runner.xcodeproj/project.pbxproj index 446c27e..0257825 100644 --- a/example/macos/Runner.xcodeproj/project.pbxproj +++ b/example/macos/Runner.xcodeproj/project.pbxproj @@ -27,6 +27,11 @@ 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; + 43DC9B10F6B641C478448273 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3963DE7D96BAFBE9EC455F93 /* Pods_Runner.framework */; }; + 471E685F7127011C557CF566 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1CB8CBA2D04512D07A1F9686 /* Pods_RunnerTests.framework */; }; + 59076DDD2A9FAFF800934543 /* frostdart.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 59076DDC2A9FAFF800934543 /* frostdart.dylib */; settings = {ATTRIBUTES = (Weak, ); }; }; + 59076DDF2A9FB03100934543 /* frostdart.dylib in Resources */ = {isa = PBXBuildFile; fileRef = 59076DDE2A9FB03100934543 /* frostdart.dylib */; }; + 59076DE02A9FB06400934543 /* frostdart.dylib in Bundle Framework */ = {isa = PBXBuildFile; fileRef = 59076DDC2A9FAFF800934543 /* frostdart.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -53,6 +58,7 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( + 59076DE02A9FB06400934543 /* frostdart.dylib in Bundle Framework */, ); name = "Bundle Framework"; runOnlyForDeploymentPostprocessing = 0; @@ -60,11 +66,13 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 0441D6BBF18804CA3A113796 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; + 1CB8CBA2D04512D07A1F9686 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 331C80D5294CF71000263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; - 33CC10ED2044A3C60003C045 /* frostdart_example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "frostdart_example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 33CC10ED2044A3C60003C045 /* frostdart_example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = frostdart_example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; @@ -76,8 +84,16 @@ 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; + 3963DE7D96BAFBE9EC455F93 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 40DB202C94EEEAC860A07890 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; + 59076DDC2A9FAFF800934543 /* frostdart.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = frostdart.dylib; path = ../../macos/frostdart.dylib; sourceTree = ""; }; + 59076DDE2A9FB03100934543 /* frostdart.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = frostdart.dylib; path = ../../macos/frostdart.dylib; sourceTree = ""; }; + 763E46EDEBE2E86AB3138324 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; + AC3D3C6918558EC548778049 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; + AE182DE5FECB3ED150E123DD /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + BAA5B22AF7A01A0E51BEDAB4 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -85,6 +101,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 471E685F7127011C557CF566 /* Pods_RunnerTests.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -92,12 +109,27 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 59076DDD2A9FAFF800934543 /* frostdart.dylib in Frameworks */, + 43DC9B10F6B641C478448273 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 25A9FB963D2D0A9948DAD6C1 /* Pods */ = { + isa = PBXGroup; + children = ( + 763E46EDEBE2E86AB3138324 /* Pods-Runner.debug.xcconfig */, + AE182DE5FECB3ED150E123DD /* Pods-Runner.release.xcconfig */, + BAA5B22AF7A01A0E51BEDAB4 /* Pods-Runner.profile.xcconfig */, + 0441D6BBF18804CA3A113796 /* Pods-RunnerTests.debug.xcconfig */, + AC3D3C6918558EC548778049 /* Pods-RunnerTests.release.xcconfig */, + 40DB202C94EEEAC860A07890 /* Pods-RunnerTests.profile.xcconfig */, + ); + path = Pods; + sourceTree = ""; + }; 331C80D6294CF71000263BE5 /* RunnerTests */ = { isa = PBXGroup; children = ( @@ -120,11 +152,13 @@ 33CC10E42044A3C60003C045 = { isa = PBXGroup; children = ( + 59076DDE2A9FB03100934543 /* frostdart.dylib */, 33FAB671232836740065AC1E /* Runner */, 33CEB47122A05771004F2AC0 /* Flutter */, 331C80D6294CF71000263BE5 /* RunnerTests */, 33CC10EE2044A3C60003C045 /* Products */, D73912EC22F37F3D000D13A0 /* Frameworks */, + 25A9FB963D2D0A9948DAD6C1 /* Pods */, ); sourceTree = ""; }; @@ -175,6 +209,9 @@ D73912EC22F37F3D000D13A0 /* Frameworks */ = { isa = PBXGroup; children = ( + 59076DDC2A9FAFF800934543 /* frostdart.dylib */, + 3963DE7D96BAFBE9EC455F93 /* Pods_Runner.framework */, + 1CB8CBA2D04512D07A1F9686 /* Pods_RunnerTests.framework */, ); name = Frameworks; sourceTree = ""; @@ -186,6 +223,7 @@ isa = PBXNativeTarget; buildConfigurationList = 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; buildPhases = ( + 967901B73314F7D8FCFB8853 /* [CP] Check Pods Manifest.lock */, 331C80D1294CF70F00263BE5 /* Sources */, 331C80D2294CF70F00263BE5 /* Frameworks */, 331C80D3294CF70F00263BE5 /* Resources */, @@ -204,6 +242,7 @@ isa = PBXNativeTarget; buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( + F24E661F86D44E4A0E61EE35 /* [CP] Check Pods Manifest.lock */, 33CC10E92044A3C60003C045 /* Sources */, 33CC10EA2044A3C60003C045 /* Frameworks */, 33CC10EB2044A3C60003C045 /* Resources */, @@ -282,6 +321,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 59076DDF2A9FB03100934543 /* frostdart.dylib in Resources */, 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */, 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */, ); @@ -328,6 +368,50 @@ shellPath = /bin/sh; shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; }; + 967901B73314F7D8FCFB8853 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + F24E661F86D44E4A0E61EE35 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -379,6 +463,7 @@ /* Begin XCBuildConfiguration section */ 331C80DB294CF71000263BE5 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 0441D6BBF18804CA3A113796 /* Pods-RunnerTests.debug.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CURRENT_PROJECT_VERSION = 1; @@ -393,6 +478,7 @@ }; 331C80DC294CF71000263BE5 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = AC3D3C6918558EC548778049 /* Pods-RunnerTests.release.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CURRENT_PROJECT_VERSION = 1; @@ -407,6 +493,7 @@ }; 331C80DD294CF71000263BE5 /* Profile */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 40DB202C94EEEAC860A07890 /* Pods-RunnerTests.profile.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CURRENT_PROJECT_VERSION = 1; @@ -605,6 +692,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); + "LIBRARY_SEARCH_PATHS[arch=*]" = $PROJECT_DIR/../../macos; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; @@ -625,6 +713,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); + "LIBRARY_SEARCH_PATHS[arch=*]" = $PROJECT_DIR/../../macos; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_VERSION = 5.0; }; diff --git a/example/macos/Runner.xcworkspace/contents.xcworkspacedata b/example/macos/Runner.xcworkspace/contents.xcworkspacedata index 1d526a1..21a3cc1 100644 --- a/example/macos/Runner.xcworkspace/contents.xcworkspacedata +++ b/example/macos/Runner.xcworkspace/contents.xcworkspacedata @@ -4,4 +4,7 @@ + + diff --git a/example/pubspec.lock b/example/pubspec.lock index d8c9eef..862fd4f 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -208,5 +208,5 @@ packages: source: hosted version: "2.1.4" sdks: - dart: ">=3.0.6 <4.0.0" + dart: ">=3.0.5 <4.0.0" flutter: ">=3.10.0" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 6502fd5..ceac701 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -19,7 +19,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: '>=3.0.6 <4.0.0' + sdk: '>=3.0.5 <4.0.0' # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions diff --git a/lib/frostdart.dart b/lib/frostdart.dart index cc22e17..066c540 100644 --- a/lib/frostdart.dart +++ b/lib/frostdart.dart @@ -11,8 +11,12 @@ const String _libName = 'frostdart'; /// The dynamic library in which the symbols for [FrostdartBindings] can be found. final ffi.DynamicLibrary _dylib = () { - if (Platform.isMacOS || Platform.isIOS) { - return ffi.DynamicLibrary.open('$_libName.framework/$_libName'); + if (Platform.isIOS) { + return ffi.DynamicLibrary.process(); + // return ffi.DynamicLibrary.open('$_libName.framework/$_libName'); + } + if (Platform.isMacOS) { + return ffi.DynamicLibrary.open('$_libName.dylib'); } if (Platform.isAndroid || Platform.isLinux) { return ffi.DynamicLibrary.open('$_libName.so'); diff --git a/macos/Classes/frostdart.c b/macos/Classes/frostdart.c deleted file mode 100644 index defb6c7..0000000 --- a/macos/Classes/frostdart.c +++ /dev/null @@ -1,3 +0,0 @@ -// Relative import to be able to reuse the C sources. -// See the comment in ../{projectName}}.podspec for more information. -#include "../../src/frostdart.c" diff --git a/macos/frostdart.podspec b/macos/frostdart.podspec index 5c70e92..f5971d6 100644 --- a/macos/frostdart.podspec +++ b/macos/frostdart.podspec @@ -13,12 +13,9 @@ A new Flutter project. s.license = { :file => '../LICENSE' } s.author = { 'Your Company' => 'email@example.com' } - # This will ensure the source files in Classes/ are included in the native - # builds of apps using this FFI plugin. Podspec does not support relative - # paths, so Classes contains a forwarder C file that relatively imports - # `../src/*` so that the C sources can be shared among all target platforms. s.source = { :path => '.' } - s.source_files = 'Classes/**/*' + s.static_framework = true + s.vendored_libraries = "**/*.a" s.dependency 'FlutterMacOS' s.platform = :osx, '10.11' diff --git a/pubspec.yaml b/pubspec.yaml index 163cba7..e5b067e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.0.1 homepage: environment: - sdk: '>=3.0.6 <4.0.0' + sdk: '>=3.0.5 <4.0.0' flutter: ">=3.10.0" dependencies: diff --git a/scripts/ios/build_all.sh b/scripts/ios/build_all.sh new file mode 100755 index 0000000..ddb9a9a --- /dev/null +++ b/scripts/ios/build_all.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +ROOT_DIR="$(pwd)/../.." + +mkdir -p build + +rm -rf "$ROOT_DIR"/src/serai/target + +cd "$ROOT_DIR"/src/serai/hrf || exit + +echo "Building ios frostdart" +cargo lipo --release +cp ../target/universal/release/libhrf_api.a "$ROOT_DIR"/ios/frostdart.a \ No newline at end of file diff --git a/scripts/macos/build_all.sh b/scripts/macos/build_all.sh new file mode 100755 index 0000000..8481475 --- /dev/null +++ b/scripts/macos/build_all.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +ROOT_DIR="$(pwd)/../.." + +export MACOSX_DEPLOYMENT_TARGET=10.14 + +mkdir -p build + +rm -rf "$ROOT_DIR"/src/serai/target + +cd "$ROOT_DIR"/src/serai/hrf || exit + +echo "Building macos frostdart" + +if [[ $(uname -m) == 'arm64' ]]; then + cargo lipo --release --targets aarch64-apple-darwin + cp ../target/aarch64-apple-darwin/release/libhrf_api.dylib "$ROOT_DIR"/macos/frostdart.dylib +else + cargo lipo --release --targets x86_64-apple-darwin + cp ../target/x86_64-apple-darwin/release/libhrf_api.dylib "$ROOT_DIR"/macos/frostdart.dylib +fi \ No newline at end of file diff --git a/scripts/windows/build_all.bat b/scripts/windows/build_all.bat new file mode 100644 index 0000000..5f43870 --- /dev/null +++ b/scripts/windows/build_all.bat @@ -0,0 +1,21 @@ +@echo on + +rem Rust 1.71.0 Windows toolchain required, +rem `rustup toolchain install 1.71.0-x86_64-pc-windows-msvc`. + +set ROOT_DIR=%cd%\..\.. + +mkdir build + +rmdir /s /q "%ROOT_DIR%\src\serai\target" 2>nul + +cd "%ROOT_DIR%\src\serai\hrf" || exit +if "%IS_ARM%"=="true" ( + echo Building arm frostdart + cargo +1.71.0 build --target aarch64-pc-windows-msvc --release --lib + copy "..\target\x86_64-pc-windows-msvc\release\hrf_api.dll" "%ROOT_DIR%\scripts\windows\build\frostdart.dll" +) else ( + echo Building x86_64 frostdart + cargo +1.71.0 build --target x86_64-pc-windows-msvc --release --lib + copy "..\target\x86_64-pc-windows-msvc\release\hrf_api.dll" "%ROOT_DIR%\scripts\windows\build\frostdart.dll" +) diff --git a/scripts/windows/regen_bindings.bat b/scripts/windows/regen_bindings.bat new file mode 100644 index 0000000..5b369ae --- /dev/null +++ b/scripts/windows/regen_bindings.bat @@ -0,0 +1,6 @@ +@echo on + +cd .. +cd .. + +dart run ffigen --config ffigen.yaml diff --git a/windows/CMakeLists.txt b/windows/CMakeLists.txt index 8584956..ced483a 100644 --- a/windows/CMakeLists.txt +++ b/windows/CMakeLists.txt @@ -8,9 +8,13 @@ cmake_minimum_required(VERSION 3.14) set(PROJECT_NAME "frostdart") project(${PROJECT_NAME} LANGUAGES CXX) +set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") + # Invoke the build for native code shared with the other target platforms. # This can be changed to accommodate different builds. -add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../src" "${CMAKE_CURRENT_BINARY_DIR}/shared") +# add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../src" "${CMAKE_CURRENT_BINARY_DIR}/shared") +# Disabled. Library built using script in scripts/windows, re-enable this if +# /when CMakeLists builds are made to work. See also below. # List of absolute paths to libraries that should be bundled with the plugin. # This list could contain prebuilt libraries, or libraries created by an @@ -18,6 +22,9 @@ add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../src" "${CMAKE_CURRENT_BINARY_DI set(frostdart_bundled_libraries # Defined in ../src/CMakeLists.txt. # This can be changed to accommodate different builds. - $ + # $ + # Disabled. Library built using script in scripts/windows, re-enable this if + # /when CMakeLists builds are made to work. See also above. + ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/windows/build/frostdart.dll PARENT_SCOPE )