mirror of
https://github.com/wgh136/flutter_qjs.git
synced 2025-09-27 21:37:24 +00:00
(WIP) macos ffi
This commit is contained in:
31
cxx/ffi.cpp
31
cxx/ffi.cpp
@@ -5,20 +5,13 @@
|
|||||||
* @LastEditors: ekibun
|
* @LastEditors: ekibun
|
||||||
* @LastEditTime: 2020-09-24 00:28:11
|
* @LastEditTime: 2020-09-24 00:28:11
|
||||||
*/
|
*/
|
||||||
#include "quickjs/quickjs.h"
|
#include "ffi.h"
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <future>
|
#include <future>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#define DLLEXPORT __declspec(dllexport)
|
|
||||||
#else
|
|
||||||
#define DLLEXPORT __attribute__((visibility("default"))) __attribute__((used))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
typedef void *JSChannel(JSContext *ctx, const char *method, void *argv);
|
|
||||||
|
|
||||||
DLLEXPORT JSValue *jsThrowInternalError(JSContext *ctx, char *message)
|
DLLEXPORT JSValue *jsThrowInternalError(JSContext *ctx, char *message)
|
||||||
{
|
{
|
||||||
@@ -58,7 +51,7 @@ extern "C"
|
|||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
JSValue js_channel(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
|
JSValue js_channel(JSContext *ctx, JSValueConst this_val, int32_t argc, JSValueConst *argv)
|
||||||
{
|
{
|
||||||
JSRuntime *rt = JS_GetRuntime(ctx);
|
JSRuntime *rt = JS_GetRuntime(ctx);
|
||||||
JSChannel *channel = (JSChannel *)JS_GetRuntimeOpaque(rt);
|
JSChannel *channel = (JSChannel *)JS_GetRuntimeOpaque(rt);
|
||||||
@@ -105,7 +98,7 @@ extern "C"
|
|||||||
return JS_GetRuntime(ctx);
|
return JS_GetRuntime(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
DLLEXPORT JSValue *jsEval(JSContext *ctx, const char *input, size_t input_len, const char *filename, int eval_flags)
|
DLLEXPORT JSValue *jsEval(JSContext *ctx, const char *input, size_t input_len, const char *filename, int32_t eval_flags)
|
||||||
{
|
{
|
||||||
return new JSValue(JS_Eval(ctx, input, input_len, filename, eval_flags));
|
return new JSValue(JS_Eval(ctx, input, input_len, filename, eval_flags));
|
||||||
}
|
}
|
||||||
@@ -125,7 +118,7 @@ extern "C"
|
|||||||
return JS_TAG_IS_FLOAT64(tag);
|
return JS_TAG_IS_FLOAT64(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
DLLEXPORT JSValue *jsNewBool(JSContext *ctx, int val)
|
DLLEXPORT JSValue *jsNewBool(JSContext *ctx, int32_t val)
|
||||||
{
|
{
|
||||||
return new JSValue(JS_NewBool(ctx, val));
|
return new JSValue(JS_NewBool(ctx, val));
|
||||||
}
|
}
|
||||||
@@ -235,8 +228,8 @@ extern "C"
|
|||||||
return new JSValue(JS_GetProperty(ctx, *this_obj, prop));
|
return new JSValue(JS_GetProperty(ctx, *this_obj, prop));
|
||||||
}
|
}
|
||||||
|
|
||||||
DLLEXPORT int jsDefinePropertyValue(JSContext *ctx, JSValueConst *this_obj,
|
DLLEXPORT int32_t jsDefinePropertyValue(JSContext *ctx, JSValueConst *this_obj,
|
||||||
JSAtom prop, JSValue *val, int flags)
|
JSAtom prop, JSValue *val, int32_t flags)
|
||||||
{
|
{
|
||||||
return JS_DefinePropertyValue(ctx, *this_obj, prop, *val, flags);
|
return JS_DefinePropertyValue(ctx, *this_obj, prop, *val, flags);
|
||||||
}
|
}
|
||||||
@@ -256,13 +249,13 @@ extern "C"
|
|||||||
return new JSValue(JS_AtomToValue(ctx, val));
|
return new JSValue(JS_AtomToValue(ctx, val));
|
||||||
}
|
}
|
||||||
|
|
||||||
DLLEXPORT int jsGetOwnPropertyNames(JSContext *ctx, JSPropertyEnum **ptab,
|
DLLEXPORT int32_t jsGetOwnPropertyNames(JSContext *ctx, JSPropertyEnum **ptab,
|
||||||
uint32_t *plen, JSValueConst *obj, int flags)
|
uint32_t *plen, JSValueConst *obj, int32_t flags)
|
||||||
{
|
{
|
||||||
return JS_GetOwnPropertyNames(ctx, ptab, plen, *obj, flags);
|
return JS_GetOwnPropertyNames(ctx, ptab, plen, *obj, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
DLLEXPORT JSAtom jsPropertyEnumGetAtom(JSPropertyEnum *ptab, int i)
|
DLLEXPORT JSAtom jsPropertyEnumGetAtom(JSPropertyEnum *ptab, int32_t i)
|
||||||
{
|
{
|
||||||
return ptab[i].atom;
|
return ptab[i].atom;
|
||||||
}
|
}
|
||||||
@@ -278,12 +271,12 @@ extern "C"
|
|||||||
}
|
}
|
||||||
|
|
||||||
DLLEXPORT JSValue *jsCall(JSContext *ctx, JSValueConst *func_obj, JSValueConst *this_obj,
|
DLLEXPORT JSValue *jsCall(JSContext *ctx, JSValueConst *func_obj, JSValueConst *this_obj,
|
||||||
int argc, JSValueConst *argv)
|
int32_t argc, JSValueConst *argv)
|
||||||
{
|
{
|
||||||
return new JSValue(JS_Call(ctx, *func_obj, *this_obj, argc, argv));
|
return new JSValue(JS_Call(ctx, *func_obj, *this_obj, argc, argv));
|
||||||
}
|
}
|
||||||
|
|
||||||
DLLEXPORT int jsIsException(JSValueConst *val)
|
DLLEXPORT int32_t jsIsException(JSValueConst *val)
|
||||||
{
|
{
|
||||||
return JS_IsException(*val);
|
return JS_IsException(*val);
|
||||||
}
|
}
|
||||||
@@ -293,7 +286,7 @@ extern "C"
|
|||||||
return new JSValue(JS_GetException(ctx));
|
return new JSValue(JS_GetException(ctx));
|
||||||
}
|
}
|
||||||
|
|
||||||
DLLEXPORT int jsExecutePendingJob(JSRuntime *rt)
|
DLLEXPORT int32_t jsExecutePendingJob(JSRuntime *rt)
|
||||||
{
|
{
|
||||||
JSContext *ctx;
|
JSContext *ctx;
|
||||||
return JS_ExecutePendingJob(rt, &ctx);
|
return JS_ExecutePendingJob(rt, &ctx);
|
||||||
|
112
cxx/ffi.h
Normal file
112
cxx/ffi.h
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
#include "quickjs/quickjs.h"
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#define DLLEXPORT __declspec(dllexport)
|
||||||
|
#else
|
||||||
|
#define DLLEXPORT __attribute__((visibility("default"))) __attribute__((used))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
|
||||||
|
typedef void *JSChannel(JSContext *ctx, const char *method, void *argv);
|
||||||
|
|
||||||
|
JSValue *jsThrowInternalError(JSContext *ctx, char *message);
|
||||||
|
|
||||||
|
JSValue *jsEXCEPTION();
|
||||||
|
|
||||||
|
JSValue *jsUNDEFINED();
|
||||||
|
|
||||||
|
JSValue *jsNULL();
|
||||||
|
|
||||||
|
JSRuntime *jsNewRuntime(JSChannel channel);
|
||||||
|
|
||||||
|
void jsFreeRuntime(JSRuntime *rt);
|
||||||
|
|
||||||
|
JSContext *jsNewContext(JSRuntime *rt);
|
||||||
|
|
||||||
|
void jsFreeContext(JSContext *ctx);
|
||||||
|
|
||||||
|
JSRuntime *jsGetRuntime(JSContext *ctx);
|
||||||
|
|
||||||
|
JSValue *jsEval(JSContext *ctx, const char *input, size_t input_len, const char *filename, int32_t eval_flags);
|
||||||
|
|
||||||
|
int32_t jsValueGetTag(JSValue *val);
|
||||||
|
|
||||||
|
void *jsValueGetPtr(JSValue *val);
|
||||||
|
|
||||||
|
int32_t jsTagIsFloat64(int32_t tag);
|
||||||
|
|
||||||
|
JSValue *jsNewBool(JSContext *ctx, int32_t val);
|
||||||
|
|
||||||
|
JSValue *jsNewInt64(JSContext *ctx, int64_t val);
|
||||||
|
|
||||||
|
JSValue *jsNewFloat64(JSContext *ctx, double val);
|
||||||
|
|
||||||
|
JSValue *jsNewString(JSContext *ctx, const char *str);
|
||||||
|
|
||||||
|
JSValue *jsNewArrayBufferCopy(JSContext *ctx, const uint8_t *buf, size_t len);
|
||||||
|
|
||||||
|
JSValue *jsNewArray(JSContext *ctx);
|
||||||
|
|
||||||
|
JSValue *jsNewObject(JSContext *ctx);
|
||||||
|
|
||||||
|
void jsFreeValue(JSContext *ctx, JSValue *v);
|
||||||
|
|
||||||
|
void jsFreeValueRT(JSRuntime *rt, JSValue *v);
|
||||||
|
|
||||||
|
JSValue *jsDupValue(JSContext *ctx, JSValueConst *v);
|
||||||
|
|
||||||
|
JSValue *jsDupValueRT(JSRuntime *rt, JSValue *v);
|
||||||
|
|
||||||
|
int32_t jsToBool(JSContext *ctx, JSValueConst *val);
|
||||||
|
|
||||||
|
int64_t jsToInt64(JSContext *ctx, JSValueConst *val);
|
||||||
|
|
||||||
|
double jsToFloat64(JSContext *ctx, JSValueConst *val);
|
||||||
|
|
||||||
|
const char *jsToCString(JSContext *ctx, JSValueConst *val);
|
||||||
|
|
||||||
|
void jsFreeCString(JSContext *ctx, const char *ptr);
|
||||||
|
|
||||||
|
uint8_t *jsGetArrayBuffer(JSContext *ctx, size_t *psize, JSValueConst *obj);
|
||||||
|
|
||||||
|
int32_t jsIsFunction(JSContext *ctx, JSValueConst *val);
|
||||||
|
|
||||||
|
int32_t jsIsArray(JSContext *ctx, JSValueConst *val);
|
||||||
|
|
||||||
|
void deleteJSValue(JSValueConst *val);
|
||||||
|
|
||||||
|
JSValue *jsGetProperty(JSContext *ctx, JSValueConst *this_obj,
|
||||||
|
JSAtom prop);
|
||||||
|
|
||||||
|
int32_t jsDefinePropertyValue(JSContext *ctx, JSValueConst *this_obj,
|
||||||
|
JSAtom prop, JSValue *val, int32_t flags);
|
||||||
|
|
||||||
|
void jsFreeAtom(JSContext *ctx, JSAtom v);
|
||||||
|
|
||||||
|
JSAtom jsValueToAtom(JSContext *ctx, JSValueConst *val);
|
||||||
|
|
||||||
|
JSValue *jsAtomToValue(JSContext *ctx, JSAtom val);
|
||||||
|
|
||||||
|
int32_t jsGetOwnPropertyNames(JSContext *ctx, JSPropertyEnum **ptab,
|
||||||
|
uint32_t *plen, JSValueConst *obj, int32_t flags);
|
||||||
|
|
||||||
|
JSAtom jsPropertyEnumGetAtom(JSPropertyEnum *ptab, int32_t i);
|
||||||
|
|
||||||
|
uint32_t sizeOfJSValue();
|
||||||
|
|
||||||
|
void setJSValueList(JSValue *list, uint32_t i, JSValue *val);
|
||||||
|
|
||||||
|
JSValue *jsCall(JSContext *ctx, JSValueConst *func_obj, JSValueConst *this_obj,
|
||||||
|
int32_t argc, JSValueConst *argv);
|
||||||
|
|
||||||
|
int32_t jsIsException(JSValueConst *val);
|
||||||
|
|
||||||
|
JSValue *jsGetException(JSContext *ctx);
|
||||||
|
|
||||||
|
int32_t jsExecutePendingJob(JSRuntime *rt);
|
||||||
|
|
||||||
|
JSValue *jsNewPromiseCapability(JSContext *ctx, JSValue *resolving_funcs);
|
||||||
|
|
||||||
|
}
|
@@ -1 +1,2 @@
|
|||||||
|
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
|
||||||
#include "Generated.xcconfig"
|
#include "Generated.xcconfig"
|
||||||
|
@@ -1 +1,2 @@
|
|||||||
|
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
|
||||||
#include "Generated.xcconfig"
|
#include "Generated.xcconfig"
|
||||||
|
41
example/ios/Podfile
Normal file
41
example/ios/Podfile
Normal file
@@ -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
|
@@ -5,6 +5,8 @@
|
|||||||
import FlutterMacOS
|
import FlutterMacOS
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
import flutter_qjs
|
||||||
|
|
||||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||||
|
FlutterQjsPlugin.register(with: registry.registrar(forPlugin: "FlutterQjsPlugin"))
|
||||||
}
|
}
|
||||||
|
22
example/macos/Podfile.lock
Normal file
22
example/macos/Podfile.lock
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
PODS:
|
||||||
|
- flutter_qjs (0.0.1):
|
||||||
|
- FlutterMacOS
|
||||||
|
- FlutterMacOS (1.0.0)
|
||||||
|
|
||||||
|
DEPENDENCIES:
|
||||||
|
- flutter_qjs (from `Flutter/ephemeral/.symlinks/plugins/flutter_qjs/macos`)
|
||||||
|
- FlutterMacOS (from `Flutter/ephemeral/.symlinks/flutter/darwin-x64`)
|
||||||
|
|
||||||
|
EXTERNAL SOURCES:
|
||||||
|
flutter_qjs:
|
||||||
|
:path: Flutter/ephemeral/.symlinks/plugins/flutter_qjs/macos
|
||||||
|
FlutterMacOS:
|
||||||
|
:path: Flutter/ephemeral/.symlinks/flutter/darwin-x64
|
||||||
|
|
||||||
|
SPEC CHECKSUMS:
|
||||||
|
flutter_qjs: df517bcb1e7a68d630e4fe9454db7ab15bfdf425
|
||||||
|
FlutterMacOS: 15bea8a44d2fa024068daa0140371c020b4b6ff9
|
||||||
|
|
||||||
|
PODFILE CHECKSUM: d8ba9b3e9e93c62c74a660b46c6fcb09f03991a7
|
||||||
|
|
||||||
|
COCOAPODS: 1.9.3
|
@@ -28,6 +28,7 @@
|
|||||||
33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; };
|
33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; };
|
||||||
33D1A10422148B71006C7A3E /* FlutterMacOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 33D1A10322148B71006C7A3E /* FlutterMacOS.framework */; };
|
33D1A10422148B71006C7A3E /* FlutterMacOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 33D1A10322148B71006C7A3E /* FlutterMacOS.framework */; };
|
||||||
33D1A10522148B93006C7A3E /* FlutterMacOS.framework in Bundle Framework */ = {isa = PBXBuildFile; fileRef = 33D1A10322148B71006C7A3E /* FlutterMacOS.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
33D1A10522148B93006C7A3E /* FlutterMacOS.framework in Bundle Framework */ = {isa = PBXBuildFile; fileRef = 33D1A10322148B71006C7A3E /* FlutterMacOS.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||||
|
8A0E1E523547DDE6AEEAA187 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E845184DF4416AE932BDD596 /* Pods_Runner.framework */; };
|
||||||
D73912F022F37F9E000D13A0 /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D73912EF22F37F9E000D13A0 /* App.framework */; };
|
D73912F022F37F9E000D13A0 /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D73912EF22F37F9E000D13A0 /* App.framework */; };
|
||||||
D73912F222F3801D000D13A0 /* App.framework in Bundle Framework */ = {isa = PBXBuildFile; fileRef = D73912EF22F37F9E000D13A0 /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
D73912F222F3801D000D13A0 /* App.framework in Bundle Framework */ = {isa = PBXBuildFile; fileRef = D73912EF22F37F9E000D13A0 /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
@@ -60,7 +61,7 @@
|
|||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = "<group>"; };
|
333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = "<group>"; };
|
||||||
335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = "<group>"; };
|
335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = "<group>"; };
|
||||||
33CC10ED2044A3C60003C045 /* flutter_qjs_example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "flutter_qjs_example.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
33CC10ED2044A3C60003C045 /* flutter_qjs_example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = flutter_qjs_example.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||||
33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = "<group>"; };
|
33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = "<group>"; };
|
||||||
33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
|
33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
|
||||||
@@ -73,9 +74,13 @@
|
|||||||
33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = "<group>"; };
|
33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = "<group>"; };
|
||||||
33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = "<group>"; };
|
33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = "<group>"; };
|
||||||
33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = "<group>"; };
|
33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = "<group>"; };
|
||||||
|
64B57AD34D7E83EE511DDCCF /* 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 = "<group>"; };
|
||||||
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
|
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
|
||||||
|
7E8A42D81EE399E35D3B1C49 /* 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 = "<group>"; };
|
||||||
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
|
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
|
||||||
D73912EF22F37F9E000D13A0 /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/ephemeral/App.framework; sourceTree = SOURCE_ROOT; };
|
D73912EF22F37F9E000D13A0 /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/ephemeral/App.framework; sourceTree = SOURCE_ROOT; };
|
||||||
|
E845184DF4416AE932BDD596 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
|
ED16B55A7814C4FA5051DC2C /* 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 = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
@@ -85,6 +90,7 @@
|
|||||||
files = (
|
files = (
|
||||||
D73912F022F37F9E000D13A0 /* App.framework in Frameworks */,
|
D73912F022F37F9E000D13A0 /* App.framework in Frameworks */,
|
||||||
33D1A10422148B71006C7A3E /* FlutterMacOS.framework in Frameworks */,
|
33D1A10422148B71006C7A3E /* FlutterMacOS.framework in Frameworks */,
|
||||||
|
8A0E1E523547DDE6AEEAA187 /* Pods_Runner.framework in Frameworks */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@@ -109,6 +115,7 @@
|
|||||||
33CEB47122A05771004F2AC0 /* Flutter */,
|
33CEB47122A05771004F2AC0 /* Flutter */,
|
||||||
33CC10EE2044A3C60003C045 /* Products */,
|
33CC10EE2044A3C60003C045 /* Products */,
|
||||||
D73912EC22F37F3D000D13A0 /* Frameworks */,
|
D73912EC22F37F3D000D13A0 /* Frameworks */,
|
||||||
|
F7F2688E6097307B6E7FBB0A /* Pods */,
|
||||||
);
|
);
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
@@ -160,10 +167,22 @@
|
|||||||
D73912EC22F37F3D000D13A0 /* Frameworks */ = {
|
D73912EC22F37F3D000D13A0 /* Frameworks */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
E845184DF4416AE932BDD596 /* Pods_Runner.framework */,
|
||||||
);
|
);
|
||||||
name = Frameworks;
|
name = Frameworks;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
F7F2688E6097307B6E7FBB0A /* Pods */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
7E8A42D81EE399E35D3B1C49 /* Pods-Runner.debug.xcconfig */,
|
||||||
|
64B57AD34D7E83EE511DDCCF /* Pods-Runner.release.xcconfig */,
|
||||||
|
ED16B55A7814C4FA5051DC2C /* Pods-Runner.profile.xcconfig */,
|
||||||
|
);
|
||||||
|
name = Pods;
|
||||||
|
path = Pods;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
/* End PBXGroup section */
|
/* End PBXGroup section */
|
||||||
|
|
||||||
/* Begin PBXNativeTarget section */
|
/* Begin PBXNativeTarget section */
|
||||||
@@ -171,11 +190,13 @@
|
|||||||
isa = PBXNativeTarget;
|
isa = PBXNativeTarget;
|
||||||
buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */;
|
buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */;
|
||||||
buildPhases = (
|
buildPhases = (
|
||||||
|
1BC6EABFB22C790B61CFD12A /* [CP] Check Pods Manifest.lock */,
|
||||||
33CC10E92044A3C60003C045 /* Sources */,
|
33CC10E92044A3C60003C045 /* Sources */,
|
||||||
33CC10EA2044A3C60003C045 /* Frameworks */,
|
33CC10EA2044A3C60003C045 /* Frameworks */,
|
||||||
33CC10EB2044A3C60003C045 /* Resources */,
|
33CC10EB2044A3C60003C045 /* Resources */,
|
||||||
33CC110E2044A8840003C045 /* Bundle Framework */,
|
33CC110E2044A8840003C045 /* Bundle Framework */,
|
||||||
3399D490228B24CF009A79C7 /* ShellScript */,
|
3399D490228B24CF009A79C7 /* ShellScript */,
|
||||||
|
E193D3629E4189A7A2FB86DD /* [CP] Embed Pods Frameworks */,
|
||||||
);
|
);
|
||||||
buildRules = (
|
buildRules = (
|
||||||
);
|
);
|
||||||
@@ -245,6 +266,28 @@
|
|||||||
/* End PBXResourcesBuildPhase section */
|
/* End PBXResourcesBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXShellScriptBuildPhase section */
|
/* Begin PBXShellScriptBuildPhase section */
|
||||||
|
1BC6EABFB22C790B61CFD12A /* [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;
|
||||||
|
};
|
||||||
3399D490228B24CF009A79C7 /* ShellScript */ = {
|
3399D490228B24CF009A79C7 /* ShellScript */ = {
|
||||||
isa = PBXShellScriptBuildPhase;
|
isa = PBXShellScriptBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
@@ -282,6 +325,21 @@
|
|||||||
shellPath = /bin/sh;
|
shellPath = /bin/sh;
|
||||||
shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire";
|
shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire";
|
||||||
};
|
};
|
||||||
|
E193D3629E4189A7A2FB86DD /* [CP] Embed Pods Frameworks */ = {
|
||||||
|
isa = PBXShellScriptBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
inputFileListPaths = (
|
||||||
|
);
|
||||||
|
name = "[CP] Embed Pods Frameworks";
|
||||||
|
outputFileListPaths = (
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
shellPath = /bin/sh;
|
||||||
|
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
|
||||||
|
showEnvVarsInLog = 0;
|
||||||
|
};
|
||||||
/* End PBXShellScriptBuildPhase section */
|
/* End PBXShellScriptBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXSourcesBuildPhase section */
|
/* Begin PBXSourcesBuildPhase section */
|
||||||
|
@@ -4,4 +4,7 @@
|
|||||||
<FileRef
|
<FileRef
|
||||||
location = "group:Runner.xcodeproj">
|
location = "group:Runner.xcodeproj">
|
||||||
</FileRef>
|
</FileRef>
|
||||||
|
<FileRef
|
||||||
|
location = "group:Pods/Pods.xcodeproj">
|
||||||
|
</FileRef>
|
||||||
</Workspace>
|
</Workspace>
|
||||||
|
@@ -57,6 +57,8 @@ final DynamicLibrary qjsLib = Platform.environment['FLUTTER_TEST'] == 'true'
|
|||||||
? DynamicLibrary.open("flutter_qjs_plugin.dll")
|
? DynamicLibrary.open("flutter_qjs_plugin.dll")
|
||||||
: Platform.isAndroid
|
: Platform.isAndroid
|
||||||
? DynamicLibrary.open("libqjs.so")
|
? DynamicLibrary.open("libqjs.so")
|
||||||
|
: Platform.isIOS || Platform.isMacOS
|
||||||
|
? DynamicLibrary.open("flutterqjs.framework/flutterqjs")
|
||||||
: DynamicLibrary.process());
|
: DynamicLibrary.process());
|
||||||
|
|
||||||
/// JSValue *jsThrowInternalError(JSContext *ctx, char *message)
|
/// JSValue *jsThrowInternalError(JSContext *ctx, char *message)
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
cmake_minimum_required(VERSION 3.7 FATAL_ERROR)
|
cmake_minimum_required(VERSION 3.7 FATAL_ERROR)
|
||||||
project(flutter_qjs LANGUAGES CXX)
|
project(flutterqjs LANGUAGES CXX)
|
||||||
set(CXX_LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../cxx)
|
set(CXX_LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../cxx)
|
||||||
|
|
||||||
add_library(flutter_qjs SHARED ${CXX_LIB_DIR}/ffi.cpp)
|
add_library(flutterqjs SHARED ${CXX_LIB_DIR}/ffi.cpp)
|
||||||
|
|
||||||
# quickjs
|
# quickjs
|
||||||
set(QUICK_JS_LIB_DIR ${CXX_LIB_DIR}/quickjs)
|
set(QUICK_JS_LIB_DIR ${CXX_LIB_DIR}/quickjs)
|
||||||
@@ -22,18 +22,18 @@ set(CMAKE_CXX_STANDARD 17)
|
|||||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/output/$ENV{ABI})
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/output/$ENV{ABI})
|
||||||
set(CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM "6SA4A2R2GU" CACHE INTERNAL "")
|
set(CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM "6SA4A2R2GU" CACHE INTERNAL "")
|
||||||
|
|
||||||
target_link_libraries(flutter_qjs PRIVATE quickjs)
|
target_link_libraries(flutterqjs PRIVATE quickjs)
|
||||||
|
|
||||||
set_target_properties(flutter_qjs PROPERTIES
|
set_target_properties(flutterqjs PROPERTIES
|
||||||
FRAMEWORK TRUE
|
FRAMEWORK TRUE
|
||||||
FRAMEWORK_VERSION A
|
FRAMEWORK_VERSION A
|
||||||
MACOSX_FRAMEWORK_IDENTIFIER soko.ekibun.flutter_qjs
|
MACOSX_FRAMEWORK_IDENTIFIER soko.ekibun.flutterqjs
|
||||||
# MACOSX_FRAMEWORK_INFO_PLIST Info.plist
|
# MACOSX_FRAMEWORK_INFO_PLIST Info.plist
|
||||||
# "current version" in semantic format in Mach-O binary file
|
# "current version" in semantic format in Mach-O binary file
|
||||||
VERSION 1.0.0
|
VERSION 1.0.0
|
||||||
# "compatibility version" in semantic format in Mach-O binary file
|
# "compatibility version" in semantic format in Mach-O binary file
|
||||||
SOVERSION 1.0.0
|
SOVERSION 1.0.0
|
||||||
PUBLIC_HEADER ffi.cpp
|
PUBLIC_HEADER ffi.h
|
||||||
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "Apple Development"
|
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "Apple Development"
|
||||||
# RESOURCE "${RESOURCE_FILES}"
|
# RESOURCE "${RESOURCE_FILES}"
|
||||||
)
|
)
|
@@ -18,7 +18,7 @@ A new flutter plugin project.
|
|||||||
|
|
||||||
s.platform = :osx, '10.11'
|
s.platform = :osx, '10.11'
|
||||||
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
|
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
|
||||||
s.vendored_frameworks = 'build/release-iphoneos/flutter_qjs.framework'
|
s.vendored_frameworks = 'build/Release/flutterqjs.framework'
|
||||||
s.static_framework = false
|
s.static_framework = false
|
||||||
s.swift_version = '5.0'
|
s.swift_version = '5.0'
|
||||||
end
|
end
|
||||||
|
@@ -7,5 +7,5 @@
|
|||||||
###
|
###
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake .. -G Xcode -DCMAKE_TOOLCHAIN_FILE=../ios.toolchain.cmake -DPLATFORM=OS64COMBINED
|
cmake .. -G Xcode -DCMAKE_OSX_ARCHITECTURES=x86_64
|
||||||
cmake --build . --config Release
|
cmake --build . --config Release
|
||||||
|
Reference in New Issue
Block a user