From 847623f2b4e10b635528bec5c25f31b169f01506 Mon Sep 17 00:00:00 2001 From: John Smith Date: Sat, 3 Dec 2022 20:10:33 -0500 Subject: [PATCH] flutter --- veilid-flutter/example/macos/Podfile | 27 +++++++------- veilid-flutter/example/macos/Podfile.lock | 2 +- .../macos/Runner.xcodeproj/project.pbxproj | 36 +++++++++++++++++-- veilid-flutter/lib/veilid.dart | 2 +- veilid-flutter/lib/veilid_ffi.dart | 2 +- 5 files changed, 50 insertions(+), 19 deletions(-) diff --git a/veilid-flutter/example/macos/Podfile b/veilid-flutter/example/macos/Podfile index e8d38fb2..2e723704 100644 --- a/veilid-flutter/example/macos/Podfile +++ b/veilid-flutter/example/macos/Podfile @@ -33,26 +33,27 @@ target 'Runner' do flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) end -require 'json' -require 'pathname' -require 'fileutils' -workspace_dir = File.dirname(JSON.parse(`cargo locate-project --workspace`)['root']) -cargo_target_dir = File.join(workspace_dir, 'target') -lipo_dir= File.join(cargo_target_dir, 'lipo-darwin') -veilid_flutter = File.join(lipo_dir, 'libveilid_flutter.dylib') -FileUtils.mkdir_p(lipo_dir) -FileUtils.touch(veilid_flutter) +# require 'json' +# require 'pathname' +# require 'fileutils' +# workspace_dir = File.dirname(JSON.parse(`cargo locate-project --workspace`)['root']) +# cargo_target_dir = File.join(workspace_dir, 'target') +# lipo_dir= File.join(cargo_target_dir, 'lipo-darwin') +# veilid_flutter = File.join(lipo_dir, 'libveilid_flutter.dylib') +# FileUtils.mkdir_p(lipo_dir) +# FileUtils.touch(veilid_flutter) post_install do |installer| project = installer.pods_project - reference = project.add_file_reference(veilid_flutter, project.main_group["Frameworks"]) + # reference = project.add_file_reference(veilid_flutter, project.main_group['Frameworks']) project.targets.each do |target| flutter_additional_macos_build_settings(target) - if (target.is_a? Xcodeproj::Project::Object::PBXNativeTarget) && target.name == "veilid" - target.resources_build_phase.add_file_reference(reference) - end + # if (target.is_a? Xcodeproj::Project::Object::PBXNativeTarget) && target.name == 'veilid' + # buildfile = target.resources_build_phase.add_file_reference(reference) + # buildfile.settings = { 'ATTRIBUTES' => ['CodeSignOnCopy'] } + # end end diff --git a/veilid-flutter/example/macos/Podfile.lock b/veilid-flutter/example/macos/Podfile.lock index 89fa7fcc..5d7ff285 100644 --- a/veilid-flutter/example/macos/Podfile.lock +++ b/veilid-flutter/example/macos/Podfile.lock @@ -23,6 +23,6 @@ SPEC CHECKSUMS: path_provider_macos: 3c0c3b4b0d4a76d2bf989a913c2de869c5641a19 veilid: f2b3b5b3ac8cd93fc5443ab830d5153575dacf36 -PODFILE CHECKSUM: 4ccbce18f83e3892ae919944d8803eb392455cb9 +PODFILE CHECKSUM: 287ef99ea691944b4036c202758453a7b2d63b34 COCOAPODS: 1.11.3 diff --git a/veilid-flutter/example/macos/Runner.xcodeproj/project.pbxproj b/veilid-flutter/example/macos/Runner.xcodeproj/project.pbxproj index 7a30c68c..53d253d5 100644 --- a/veilid-flutter/example/macos/Runner.xcodeproj/project.pbxproj +++ b/veilid-flutter/example/macos/Runner.xcodeproj/project.pbxproj @@ -26,6 +26,8 @@ 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 */; }; + 43B71B4F293C1CC400EF4986 /* libveilid_flutter.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 43B71B4B293C127700EF4986 /* libveilid_flutter.dylib */; settings = {ATTRIBUTES = (Weak, ); }; }; + 43B71B50293C1CC400EF4986 /* libveilid_flutter.dylib in Embed Libraries */ = {isa = PBXBuildFile; fileRef = 43B71B4B293C127700EF4986 /* libveilid_flutter.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 81649851C9DA1DA79054FE06 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52FF39A454BC3E9083B5E1BB /* Pods_Runner.framework */; }; /* End PBXBuildFile section */ @@ -40,14 +42,15 @@ /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ - 33CC110E2044A8840003C045 /* Bundle Framework */ = { + 43B71B51293C1CC400EF4986 /* Embed Libraries */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = ""; dstSubfolderSpec = 10; files = ( + 43B71B50293C1CC400EF4986 /* libveilid_flutter.dylib in Embed Libraries */, ); - name = "Bundle Framework"; + name = "Embed Libraries"; runOnlyForDeploymentPostprocessing = 0; }; /* End PBXCopyFilesBuildPhase section */ @@ -68,6 +71,7 @@ 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 = ""; }; + 43B71B4B293C127700EF4986 /* libveilid_flutter.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libveilid_flutter.dylib; path = "../../../target/lipo-darwin/libveilid_flutter.dylib"; sourceTree = ""; }; 52FF39A454BC3E9083B5E1BB /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 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 = ""; }; @@ -80,6 +84,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 43B71B4F293C1CC400EF4986 /* libveilid_flutter.dylib in Frameworks */, 81649851C9DA1DA79054FE06 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -165,6 +170,7 @@ D73912EC22F37F3D000D13A0 /* Frameworks */ = { isa = PBXGroup; children = ( + 43B71B4B293C127700EF4986 /* libveilid_flutter.dylib */, 52FF39A454BC3E9083B5E1BB /* Pods_Runner.framework */, ); name = Frameworks; @@ -181,9 +187,9 @@ 33CC10E92044A3C60003C045 /* Sources */, 33CC10EA2044A3C60003C045 /* Frameworks */, 33CC10EB2044A3C60003C045 /* Resources */, - 33CC110E2044A8840003C045 /* Bundle Framework */, 3399D490228B24CF009A79C7 /* ShellScript */, 6C9005308B324F4C4A5637A3 /* [CP] Embed Pods Frameworks */, + 43B71B51293C1CC400EF4986 /* Embed Libraries */, ); buildRules = ( ); @@ -418,13 +424,21 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", ); + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\"", + /usr/lib/swift, + "../../../target/lipo-darwin", + ); PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_VERSION = 5.0; }; @@ -544,13 +558,21 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", ); + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\"", + /usr/lib/swift, + "../../../target/lipo-darwin", + ); PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; @@ -564,13 +586,21 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", ); + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\"", + /usr/lib/swift, + "../../../target/lipo-darwin", + ); PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_VERSION = 5.0; }; diff --git a/veilid-flutter/lib/veilid.dart b/veilid-flutter/lib/veilid.dart index c9d83087..e85a9262 100644 --- a/veilid-flutter/lib/veilid.dart +++ b/veilid-flutter/lib/veilid.dart @@ -1454,7 +1454,7 @@ class VeilidStateConfig { }); VeilidStateConfig.fromJson(Map json) - : config = jsonDecode(json['config']); + : config = json['config']; Map get json { return {'config': config}; diff --git a/veilid-flutter/lib/veilid_ffi.dart b/veilid-flutter/lib/veilid_ffi.dart index 994e61e0..c3ef7a4f 100644 --- a/veilid-flutter/lib/veilid_ffi.dart +++ b/veilid-flutter/lib/veilid_ffi.dart @@ -16,7 +16,7 @@ const _base = 'veilid_flutter'; final _path = Platform.isWindows ? '$_base.dll' : Platform.isMacOS - ? 'veilid.framework/Resources/lib$_base.dylib' + ? 'lib$_base.dylib' : 'lib$_base.so'; final _dylib = Platform.isIOS ? DynamicLibrary.process() : DynamicLibrary.open(_path);