diff --git a/plugins/flutter/pocketpy/.gitignore b/plugins/flutter/pocketpy/.gitignore index b62aa822..73f586d1 100644 --- a/plugins/flutter/pocketpy/.gitignore +++ b/plugins/flutter/pocketpy/.gitignore @@ -28,4 +28,6 @@ migrate_working_dir/ .dart_tool/ build/ -*.xcframework/ \ No newline at end of file +ios/pocketpy/ +macos/pocketpy/ + diff --git a/plugins/flutter/pocketpy/README.md b/plugins/flutter/pocketpy/README.md index 0ad8d55e..d50910d3 100644 --- a/plugins/flutter/pocketpy/README.md +++ b/plugins/flutter/pocketpy/README.md @@ -2,4 +2,12 @@ Official FFI bindings for pocketpy. -https://github.com/pocketpy/pocketpy \ No newline at end of file +https://github.com/pocketpy/pocketpy + +## Special Notes + +For MacOS and iOS, when you install this plugin, +there is a script that will clone the pocketpy repository and build +necessary binaries. This could take several minutes. + +This plugin only works for iOS real device, not simulator. diff --git a/plugins/flutter/pocketpy/example/ios/Podfile.lock b/plugins/flutter/pocketpy/example/ios/Podfile.lock index 0920556e..d209da6e 100644 --- a/plugins/flutter/pocketpy/example/ios/Podfile.lock +++ b/plugins/flutter/pocketpy/example/ios/Podfile.lock @@ -15,7 +15,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 - pocketpy: dcb5d109e54bc958a4bff38624013094ce193214 + pocketpy: 6bad04d7bd05a4408d335d6ad6813d31d1496124 PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796 diff --git a/plugins/flutter/pocketpy/example/macos/Podfile.lock b/plugins/flutter/pocketpy/example/macos/Podfile.lock index 4af3d1de..363004c3 100644 --- a/plugins/flutter/pocketpy/example/macos/Podfile.lock +++ b/plugins/flutter/pocketpy/example/macos/Podfile.lock @@ -15,7 +15,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 - pocketpy: b4fdf42a775d9d6498ce13a2dde7fc8f462ea034 + pocketpy: 575448ea94df6d7281990c5b6020728e795fd046 PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367 diff --git a/plugins/flutter/pocketpy/ios/Classes/empty.c b/plugins/flutter/pocketpy/ios/Classes/empty.c index 1ee9dbf9..f8377a6d 100644 --- a/plugins/flutter/pocketpy/ios/Classes/empty.c +++ b/plugins/flutter/pocketpy/ios/Classes/empty.c @@ -1,5 +1,5 @@ void py_initialize(); -__attribute__((used)) void ensure_no_tree_shaking() { +__attribute__((used)) void ensure_no_tree_shaking(void) { py_initialize(); } diff --git a/plugins/flutter/pocketpy/ios/Frameworks/.gitkeep b/plugins/flutter/pocketpy/ios/Frameworks/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/plugins/flutter/pocketpy/ios/pocketpy.podspec b/plugins/flutter/pocketpy/ios/pocketpy.podspec index b4639d8a..b65396fb 100644 --- a/plugins/flutter/pocketpy/ios/pocketpy.podspec +++ b/plugins/flutter/pocketpy/ios/pocketpy.podspec @@ -30,6 +30,14 @@ A new Flutter FFI plugin project. s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386', - 'OTHER_LDFLAGS' => '-force_load ' + __dir__ + '/Frameworks/pocketpy.xcframework/ios-arm64/libpocketpy.a', + 'OTHER_LDFLAGS' => '-force_load ' + __dir__ + '/pocketpy/build/pocketpy.xcframework/ios-arm64/libpocketpy.a', } + + s.prepare_command = <<-CMD + rm -rf pocketpy + git clone --branch v2.1.3-patch --depth 1 https://github.com/pocketpy/pocketpy.git + cd pocketpy + git submodule update --init --recursive --depth 1 + bash build_ios_libs.sh +CMD end diff --git a/plugins/flutter/pocketpy/macos/Classes/empty.c b/plugins/flutter/pocketpy/macos/Classes/empty.c index 1ee9dbf9..f8377a6d 100644 --- a/plugins/flutter/pocketpy/macos/Classes/empty.c +++ b/plugins/flutter/pocketpy/macos/Classes/empty.c @@ -1,5 +1,5 @@ void py_initialize(); -__attribute__((used)) void ensure_no_tree_shaking() { +__attribute__((used)) void ensure_no_tree_shaking(void) { py_initialize(); } diff --git a/plugins/flutter/pocketpy/macos/Frameworks/.gitkeep b/plugins/flutter/pocketpy/macos/Frameworks/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/plugins/flutter/pocketpy/macos/pocketpy.podspec b/plugins/flutter/pocketpy/macos/pocketpy.podspec index 66d0bd98..314d12e8 100644 --- a/plugins/flutter/pocketpy/macos/pocketpy.podspec +++ b/plugins/flutter/pocketpy/macos/pocketpy.podspec @@ -27,7 +27,15 @@ A new Flutter FFI plugin project. s.library = 'c' s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', - 'OTHER_LDFLAGS' => '-force_load ' + __dir__ + '/Frameworks/libpocketpy.a', + 'OTHER_LDFLAGS' => '-force_load ' + __dir__ + '/pocketpy/build/libpocketpy.a', } + + s.prepare_command = <<-CMD + rm -rf pocketpy + git clone --branch v2.1.3-patch --depth 1 https://github.com/pocketpy/pocketpy.git + cd pocketpy + git submodule update --init --recursive --depth 1 + bash build_darwin_libs.sh +CMD end diff --git a/plugins/flutter/pocketpy/src/CMakeLists.txt b/plugins/flutter/pocketpy/src/CMakeLists.txt index 8ccd8d3e..f58405c3 100644 --- a/plugins/flutter/pocketpy/src/CMakeLists.txt +++ b/plugins/flutter/pocketpy/src/CMakeLists.txt @@ -14,7 +14,7 @@ include(FetchContent) FetchContent_Declare( pocketpy GIT_REPOSITORY https://github.com/pocketpy/pocketpy.git - GIT_TAG v2.1.3 + GIT_TAG v2.1.3-patch ) set(PK_ENABLE_OS OFF CACHE BOOL "" FORCE)