From ca4e86c6aaec128124b96490a01ad79492500acb Mon Sep 17 00:00:00 2001 From: Linus Gasser Date: Tue, 11 May 2021 20:23:15 +0200 Subject: [PATCH 1/3] First try at getting an iOS build ready This is a draft PR! It allows anybody interested to help me debug why I get `no matching architecture in universal wrapper` --- .gitignore | 4 +- ios/Flutter/Debug.xcconfig | 1 + ios/Flutter/Release.xcconfig | 1 + ios/Runner.xcodeproj/project.pbxproj | 120 ++++++++++++++++-- .../contents.xcworkspacedata | 2 +- .../xcshareddata/xcschemes/Runner.xcscheme | 10 +- .../contents.xcworkspacedata | 3 + ios/Runner/Runner-Bridging-Header.h | 1 + lib/cwtch/ffi.dart | 3 + lib/views/messageview.dart | 2 +- pubspec.lock | 32 +++-- 11 files changed, 151 insertions(+), 28 deletions(-) diff --git a/.gitignore b/.gitignore index d513c8e..6cfd76e 100644 --- a/.gitignore +++ b/.gitignore @@ -44,4 +44,6 @@ libCwtch.so android/cwtch/cwtch.aar coverage test/failures -.gradle \ No newline at end of file +.gradle +libcwtch-go +ios/cwtch.a diff --git a/ios/Flutter/Debug.xcconfig b/ios/Flutter/Debug.xcconfig index 592ceee..ec97fc6 100644 --- a/ios/Flutter/Debug.xcconfig +++ b/ios/Flutter/Debug.xcconfig @@ -1 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "Generated.xcconfig" diff --git a/ios/Flutter/Release.xcconfig b/ios/Flutter/Release.xcconfig index 592ceee..c4855bf 100644 --- a/ios/Flutter/Release.xcconfig +++ b/ios/Flutter/Release.xcconfig @@ -1 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "Generated.xcconfig" diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index af3d120..f323d31 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -3,16 +3,19 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 51; objects = { /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 57A4E41C4075DFE2289DBB05 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 261C176807F4755F8CA98C09 /* Pods_Runner.framework */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; + F46DFE5C26487EE800B3B0AF /* cwtch.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F46DFE5B26487EE800B3B0AF /* cwtch.a */; }; + F46DFE5D26487EF000B3B0AF /* cwtch.a in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = F46DFE5B26487EE800B3B0AF /* cwtch.a */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -22,6 +25,7 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( + F46DFE5D26487EF000B3B0AF /* cwtch.a in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -31,10 +35,14 @@ /* Begin PBXFileReference section */ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 261C176807F4755F8CA98C09 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 64918BCEC462F1E92AB7F67B /* 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 = ""; }; + 740C510F980AE42EF566C125 /* 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 = ""; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 7FA189B93C9B7C07B497D28E /* 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 = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -42,6 +50,9 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + F46DFE4E2648741800B3B0AF /* x86_64.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = x86_64.a; path = "../../libcwtch-go/ios/x86_64.a"; sourceTree = ""; }; + F46DFE552648764D00B3B0AF /* cwtch.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = cwtch.h; path = "../../../libcwtch-go/ios/cwtch.h"; sourceTree = ""; }; + F46DFE5B26487EE800B3B0AF /* cwtch.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = cwtch.a; path = "../../libcwtch-go/ios/cwtch.a"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -49,12 +60,24 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 57A4E41C4075DFE2289DBB05 /* Pods_Runner.framework in Frameworks */, + F46DFE5C26487EE800B3B0AF /* cwtch.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 2138F07C93FA9B782F154211 /* Pods */ = { + isa = PBXGroup; + children = ( + 7FA189B93C9B7C07B497D28E /* Pods-Runner.debug.xcconfig */, + 64918BCEC462F1E92AB7F67B /* Pods-Runner.release.xcconfig */, + 740C510F980AE42EF566C125 /* Pods-Runner.profile.xcconfig */, + ); + path = Pods; + sourceTree = ""; + }; 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( @@ -69,9 +92,12 @@ 97C146E51CF9000F007C117D = { isa = PBXGroup; children = ( + F46DFE5B26487EE800B3B0AF /* cwtch.a */, 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, + 2138F07C93FA9B782F154211 /* Pods */, + F100A7439BFD0DC2EBAE6F27 /* Frameworks */, ); sourceTree = ""; }; @@ -86,6 +112,7 @@ 97C146F01CF9000F007C117D /* Runner */ = { isa = PBXGroup; children = ( + F46DFE552648764D00B3B0AF /* cwtch.h */, 97C146FA1CF9000F007C117D /* Main.storyboard */, 97C146FD1CF9000F007C117D /* Assets.xcassets */, 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, @@ -98,6 +125,15 @@ path = Runner; sourceTree = ""; }; + F100A7439BFD0DC2EBAE6F27 /* Frameworks */ = { + isa = PBXGroup; + children = ( + F46DFE4E2648741800B3B0AF /* x86_64.a */, + 261C176807F4755F8CA98C09 /* Pods_Runner.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -105,12 +141,14 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( + E78347C5305EEDBB6E990583 /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + 6A2F1B96AB8B734802E64441 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -127,7 +165,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1020; + LastUpgradeCheck = 1250; ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { @@ -183,6 +221,23 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; + 6A2F1B96AB8B734802E64441 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -197,6 +252,28 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; + E78347C5305EEDBB6E990583 /* [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 */ @@ -254,6 +331,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -272,7 +350,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -285,6 +363,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { + ARCHS = x86_64; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; @@ -294,15 +373,21 @@ "$(PROJECT_DIR)/Flutter", ); INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Flutter", + "$(PROJECT_DIR)", ); PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterApp; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_WORKSPACE = YES; VERSIONING_SYSTEM = "apple-generic"; }; name = Profile; @@ -330,6 +415,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -354,7 +440,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -385,6 +471,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -403,11 +490,12 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; @@ -417,6 +505,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; buildSettings = { + ARCHS = x86_64; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; @@ -426,16 +515,22 @@ "$(PROJECT_DIR)/Flutter", ); INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Flutter", + "$(PROJECT_DIR)", ); PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterApp; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_WORKSPACE = YES; VERSIONING_SYSTEM = "apple-generic"; }; name = Debug; @@ -444,6 +539,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { + ARCHS = x86_64; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; @@ -453,15 +549,21 @@ "$(PROJECT_DIR)/Flutter", ); INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Flutter", + "$(PROJECT_DIR)", ); PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterApp; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_WORKSPACE = YES; VERSIONING_SYSTEM = "apple-generic"; }; name = Release; diff --git a/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 1d526a1..919434a 100644 --- a/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "self:"> diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index a28140c..7785fe3 100644 --- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ - - - - + + - - + + diff --git a/ios/Runner/Runner-Bridging-Header.h b/ios/Runner/Runner-Bridging-Header.h index 308a2a5..94f6987 100644 --- a/ios/Runner/Runner-Bridging-Header.h +++ b/ios/Runner/Runner-Bridging-Header.h @@ -1 +1,2 @@ #import "GeneratedPluginRegistrant.h" +#import "cwtch.h" diff --git a/lib/cwtch/ffi.dart b/lib/cwtch/ffi.dart index 8c16594..d0afc75 100644 --- a/lib/cwtch/ffi.dart +++ b/lib/cwtch/ffi.dart @@ -65,6 +65,9 @@ class CwtchFfi implements Cwtch { library = DynamicLibrary.open("libCwtch.dll"); } else if (Platform.isLinux) { library = DynamicLibrary.open("libCwtch.so"); + } else if (Platform.isIOS) { + print(Platform.environment); + library = DynamicLibrary.open("cwtch.a"); } else { print("OS ${Platform.operatingSystem} not supported by cwtch/ffi"); // emergency, ideally the app stays on splash and just posts the error till user closes diff --git a/lib/views/messageview.dart b/lib/views/messageview.dart index e49a00d..8e24df8 100644 --- a/lib/views/messageview.dart +++ b/lib/views/messageview.dart @@ -113,7 +113,7 @@ class _MessageViewState extends State { child: ElevatedButton( child: Icon(Icons.send, color: Provider.of(context).theme.mainTextColor()), style: ButtonStyle( - fixedSize: MaterialStateProperty.all(Size(86, 40)), + minimumSize: MaterialStateProperty.all(Size(86, 40)), backgroundColor: MaterialStateProperty.all(Provider.of(context).theme.defaultButtonColor()), ), onPressed: _sendMessage, diff --git a/pubspec.lock b/pubspec.lock index 011cd94..6595e35 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,7 +7,14 @@ packages: name: archive url: "https://pub.dartlang.org" source: hosted - version: "3.1.2" + version: "2.0.13" + args: + dependency: transitive + description: + name: args + url: "https://pub.dartlang.org" + source: hosted + version: "1.6.0" async: dependency: transitive description: @@ -50,13 +57,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.15.0" + convert: + dependency: transitive + description: + name: convert + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.1" crypto: dependency: transitive description: name: crypto url: "https://pub.dartlang.org" source: hosted - version: "3.0.1" + version: "2.1.5" cupertino_icons: dependency: "direct main" description: @@ -84,7 +98,7 @@ packages: name: file url: "https://pub.dartlang.org" source: hosted - version: "6.1.0" + version: "6.0.0" flutter: dependency: "direct main" description: flutter @@ -289,7 +303,7 @@ packages: name: process url: "https://pub.dartlang.org" source: hosted - version: "4.2.1" + version: "4.0.0" provider: dependency: "direct main" description: @@ -308,7 +322,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.8.0" stack_trace: dependency: transitive description: @@ -336,7 +350,7 @@ packages: name: sync_http url: "https://pub.dartlang.org" source: hosted - version: "0.3.0" + version: "0.2.0" term_glyph: dependency: transitive description: @@ -350,7 +364,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.3.0" + version: "0.2.19" typed_data: dependency: transitive description: @@ -371,14 +385,14 @@ packages: name: vm_service url: "https://pub.dartlang.org" source: hosted - version: "6.1.0+1" + version: "5.5.0" webdriver: dependency: transitive description: name: webdriver url: "https://pub.dartlang.org" source: hosted - version: "3.0.0" + version: "2.1.2" win32: dependency: transitive description: -- 2.25.1 From d8d59ab73e784f72160ff7023c9cd732f96823a4 Mon Sep 17 00:00:00 2001 From: Linus Gasser Date: Wed, 12 May 2021 20:25:18 +0200 Subject: [PATCH 2/3] dan's comment. Also added Makefile and ios/Podfile* --- Makefile | 9 +++++++++ ios/Podfile | 41 +++++++++++++++++++++++++++++++++++++++++ ios/Podfile.lock | 34 ++++++++++++++++++++++++++++++++++ lib/cwtch/ffi.dart | 1 - pubspec.lock | 32 +++++++++----------------------- 5 files changed, 93 insertions(+), 24 deletions(-) create mode 100644 Makefile create mode 100644 ios/Podfile create mode 100644 ios/Podfile.lock diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..389e2b8 --- /dev/null +++ b/Makefile @@ -0,0 +1,9 @@ +LIB=libcwtch-go + +ios: $(LIB) + cd $(LIB) && \ + make ios + cp $(LIB)/ios/cwtch.a ios + +$(LIB): + git clone -b ios_build https://git.openprivacy.ca/ineiti/libcwtch-go.git diff --git a/ios/Podfile b/ios/Podfile new file mode 100644 index 0000000..1e8c3c9 --- /dev/null +++ b/ios/Podfile @@ -0,0 +1,41 @@ +# Uncomment this line to define a global platform for your project +# platform :ios, '9.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__)) +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_ios_build_settings(target) + end +end diff --git a/ios/Podfile.lock b/ios/Podfile.lock new file mode 100644 index 0000000..d27d398 --- /dev/null +++ b/ios/Podfile.lock @@ -0,0 +1,34 @@ +PODS: + - Flutter (1.0.0) + - integration_test (0.0.1): + - Flutter + - package_info_plus (0.4.5): + - Flutter + - path_provider (0.0.1): + - Flutter + +DEPENDENCIES: + - Flutter (from `Flutter`) + - integration_test (from `.symlinks/plugins/integration_test/ios`) + - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) + - path_provider (from `.symlinks/plugins/path_provider/ios`) + +EXTERNAL SOURCES: + Flutter: + :path: Flutter + integration_test: + :path: ".symlinks/plugins/integration_test/ios" + package_info_plus: + :path: ".symlinks/plugins/package_info_plus/ios" + path_provider: + :path: ".symlinks/plugins/path_provider/ios" + +SPEC CHECKSUMS: + Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c + integration_test: 5ed24a436eb7ec17b6a13046e9bf7ca4a404e59e + package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e + path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c + +PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c + +COCOAPODS: 1.10.1 diff --git a/lib/cwtch/ffi.dart b/lib/cwtch/ffi.dart index d0afc75..73420a6 100644 --- a/lib/cwtch/ffi.dart +++ b/lib/cwtch/ffi.dart @@ -66,7 +66,6 @@ class CwtchFfi implements Cwtch { } else if (Platform.isLinux) { library = DynamicLibrary.open("libCwtch.so"); } else if (Platform.isIOS) { - print(Platform.environment); library = DynamicLibrary.open("cwtch.a"); } else { print("OS ${Platform.operatingSystem} not supported by cwtch/ffi"); diff --git a/pubspec.lock b/pubspec.lock index 6595e35..011cd94 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,14 +7,7 @@ packages: name: archive url: "https://pub.dartlang.org" source: hosted - version: "2.0.13" - args: - dependency: transitive - description: - name: args - url: "https://pub.dartlang.org" - source: hosted - version: "1.6.0" + version: "3.1.2" async: dependency: transitive description: @@ -57,20 +50,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.15.0" - convert: - dependency: transitive - description: - name: convert - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.1" crypto: dependency: transitive description: name: crypto url: "https://pub.dartlang.org" source: hosted - version: "2.1.5" + version: "3.0.1" cupertino_icons: dependency: "direct main" description: @@ -98,7 +84,7 @@ packages: name: file url: "https://pub.dartlang.org" source: hosted - version: "6.0.0" + version: "6.1.0" flutter: dependency: "direct main" description: flutter @@ -303,7 +289,7 @@ packages: name: process url: "https://pub.dartlang.org" source: hosted - version: "4.0.0" + version: "4.2.1" provider: dependency: "direct main" description: @@ -322,7 +308,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.8.1" stack_trace: dependency: transitive description: @@ -350,7 +336,7 @@ packages: name: sync_http url: "https://pub.dartlang.org" source: hosted - version: "0.2.0" + version: "0.3.0" term_glyph: dependency: transitive description: @@ -364,7 +350,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.19" + version: "0.3.0" typed_data: dependency: transitive description: @@ -385,14 +371,14 @@ packages: name: vm_service url: "https://pub.dartlang.org" source: hosted - version: "5.5.0" + version: "6.1.0+1" webdriver: dependency: transitive description: name: webdriver url: "https://pub.dartlang.org" source: hosted - version: "2.1.2" + version: "3.0.0" win32: dependency: transitive description: -- 2.25.1 From da53bb360341c0233bfae097a7e990bf883b500b Mon Sep 17 00:00:00 2001 From: Linus Gasser Date: Fri, 14 May 2021 09:01:41 +0200 Subject: [PATCH 3/3] Thanks @Pleurinae for pointing out it's a static library... And it needs to be included somewhere in a call. --- ios/Runner.xcodeproj/project.pbxproj | 12 ++++++------ ios/Runner/AppDelegate.swift | 6 ++++++ lib/cwtch/ffi.dart | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index f323d31..1a91b1e 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -14,8 +14,8 @@ 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; - F46DFE5C26487EE800B3B0AF /* cwtch.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F46DFE5B26487EE800B3B0AF /* cwtch.a */; }; - F46DFE5D26487EF000B3B0AF /* cwtch.a in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = F46DFE5B26487EE800B3B0AF /* cwtch.a */; }; + F40D366C264E52D500E39EB5 /* cwtch.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F40D366B264E52D500E39EB5 /* cwtch.a */; }; + F40D366D264E52E000E39EB5 /* cwtch.a in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = F40D366B264E52D500E39EB5 /* cwtch.a */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -25,7 +25,7 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - F46DFE5D26487EF000B3B0AF /* cwtch.a in Embed Frameworks */, + F40D366D264E52E000E39EB5 /* cwtch.a in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -50,9 +50,9 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + F40D366B264E52D500E39EB5 /* cwtch.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = cwtch.a; path = "../libcwtch-go/ios/cwtch.a"; sourceTree = ""; }; F46DFE4E2648741800B3B0AF /* x86_64.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = x86_64.a; path = "../../libcwtch-go/ios/x86_64.a"; sourceTree = ""; }; F46DFE552648764D00B3B0AF /* cwtch.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = cwtch.h; path = "../../../libcwtch-go/ios/cwtch.h"; sourceTree = ""; }; - F46DFE5B26487EE800B3B0AF /* cwtch.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = cwtch.a; path = "../../libcwtch-go/ios/cwtch.a"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -61,7 +61,7 @@ buildActionMask = 2147483647; files = ( 57A4E41C4075DFE2289DBB05 /* Pods_Runner.framework in Frameworks */, - F46DFE5C26487EE800B3B0AF /* cwtch.a in Frameworks */, + F40D366C264E52D500E39EB5 /* cwtch.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -92,7 +92,7 @@ 97C146E51CF9000F007C117D = { isa = PBXGroup; children = ( - F46DFE5B26487EE800B3B0AF /* cwtch.a */, + F40D366B264E52D500E39EB5 /* cwtch.a */, 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index 70693e4..48ff83d 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -10,4 +10,10 @@ import Flutter GeneratedPluginRegistrant.register(with: self) return super.application(application, didFinishLaunchingWithOptions: launchOptions) } + + // this is never called, but otherwise Xcode will optimize away the cwtch.a library + // and not include it in the final binary... + public func dummyMethod(){ + c_ACNEvents() + } } diff --git a/lib/cwtch/ffi.dart b/lib/cwtch/ffi.dart index 73420a6..872f83b 100644 --- a/lib/cwtch/ffi.dart +++ b/lib/cwtch/ffi.dart @@ -66,7 +66,7 @@ class CwtchFfi implements Cwtch { } else if (Platform.isLinux) { library = DynamicLibrary.open("libCwtch.so"); } else if (Platform.isIOS) { - library = DynamicLibrary.open("cwtch.a"); + library = DynamicLibrary.process(); } else { print("OS ${Platform.operatingSystem} not supported by cwtch/ffi"); // emergency, ideally the app stays on splash and just posts the error till user closes -- 2.25.1