mirror of
https://github.com/wgh136/flutter_qjs.git
synced 2025-09-27 13:27:24 +00:00
ffi ios
This commit is contained in:
37
ios/.gitignore
vendored
Normal file
37
ios/.gitignore
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
.idea/
|
||||
.vagrant/
|
||||
.sconsign.dblite
|
||||
.svn/
|
||||
|
||||
.DS_Store
|
||||
*.swp
|
||||
profile
|
||||
|
||||
DerivedData/
|
||||
build/
|
||||
GeneratedPluginRegistrant.h
|
||||
GeneratedPluginRegistrant.m
|
||||
|
||||
.generated/
|
||||
|
||||
*.pbxuser
|
||||
*.mode1v3
|
||||
*.mode2v3
|
||||
*.perspectivev3
|
||||
|
||||
!default.pbxuser
|
||||
!default.mode1v3
|
||||
!default.mode2v3
|
||||
!default.perspectivev3
|
||||
|
||||
xcuserdata
|
||||
|
||||
*.moved-aside
|
||||
|
||||
*.pyc
|
||||
*sync/
|
||||
Icon?
|
||||
.tags*
|
||||
|
||||
/Flutter/Generated.xcconfig
|
||||
/Flutter/flutter_export_environment.sh
|
0
ios/Assets/.gitkeep
Normal file
0
ios/Assets/.gitkeep
Normal file
39
ios/CMakeLists.txt
Normal file
39
ios/CMakeLists.txt
Normal file
@@ -0,0 +1,39 @@
|
||||
cmake_minimum_required(VERSION 3.7 FATAL_ERROR)
|
||||
project(flutter_qjs LANGUAGES CXX)
|
||||
set(CXX_LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../cxx)
|
||||
|
||||
add_library(flutter_qjs SHARED ${CXX_LIB_DIR}/ffi.cpp)
|
||||
|
||||
# quickjs
|
||||
set(QUICK_JS_LIB_DIR ${CXX_LIB_DIR}/quickjs)
|
||||
file (STRINGS "${QUICK_JS_LIB_DIR}/VERSION" QUICKJS_VERSION)
|
||||
add_library(quickjs STATIC
|
||||
${QUICK_JS_LIB_DIR}/cutils.c
|
||||
${QUICK_JS_LIB_DIR}/libregexp.c
|
||||
${QUICK_JS_LIB_DIR}/libunicode.c
|
||||
${QUICK_JS_LIB_DIR}/quickjs.c
|
||||
)
|
||||
|
||||
project(quickjs LANGUAGES C)
|
||||
target_compile_options(quickjs PRIVATE "-DCONFIG_VERSION=\"${QUICKJS_VERSION}\"")
|
||||
target_compile_options(quickjs PRIVATE "-DDUMP_LEAKS")
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/output/$ENV{ABI})
|
||||
set(CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM "6SA4A2R2GU" CACHE INTERNAL "")
|
||||
|
||||
target_link_libraries(flutter_qjs PRIVATE quickjs)
|
||||
|
||||
set_target_properties(flutter_qjs PROPERTIES
|
||||
FRAMEWORK TRUE
|
||||
FRAMEWORK_VERSION A
|
||||
MACOSX_FRAMEWORK_IDENTIFIER soko.ekibun.flutter_qjs
|
||||
# MACOSX_FRAMEWORK_INFO_PLIST Info.plist
|
||||
# "current version" in semantic format in Mach-O binary file
|
||||
VERSION 1.0.0
|
||||
# "compatibility version" in semantic format in Mach-O binary file
|
||||
SOVERSION 1.0.0
|
||||
PUBLIC_HEADER ffi.cpp
|
||||
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "Apple Development"
|
||||
# RESOURCE "${RESOURCE_FILES}"
|
||||
)
|
4
ios/Classes/FlutterQjsPlugin.h
Normal file
4
ios/Classes/FlutterQjsPlugin.h
Normal file
@@ -0,0 +1,4 @@
|
||||
#import <Flutter/Flutter.h>
|
||||
|
||||
@interface FlutterQjsPlugin : NSObject<FlutterPlugin>
|
||||
@end
|
15
ios/Classes/FlutterQjsPlugin.m
Normal file
15
ios/Classes/FlutterQjsPlugin.m
Normal file
@@ -0,0 +1,15 @@
|
||||
#import "FlutterQjsPlugin.h"
|
||||
#if __has_include(<flutter_qjs/flutter_qjs-Swift.h>)
|
||||
#import <flutter_qjs/flutter_qjs-Swift.h>
|
||||
#else
|
||||
// Support project import fallback if the generated compatibility header
|
||||
// is not copied when this plugin is created as a library.
|
||||
// https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816
|
||||
#import "flutter_qjs-Swift.h"
|
||||
#endif
|
||||
|
||||
@implementation FlutterQjsPlugin
|
||||
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
|
||||
[SwiftFlutterQjsPlugin registerWithRegistrar:registrar];
|
||||
}
|
||||
@end
|
14
ios/Classes/SwiftFlutterQjsPlugin.swift
Normal file
14
ios/Classes/SwiftFlutterQjsPlugin.swift
Normal file
@@ -0,0 +1,14 @@
|
||||
import Flutter
|
||||
import UIKit
|
||||
|
||||
public class SwiftFlutterQjsPlugin: NSObject, FlutterPlugin {
|
||||
public static func register(with registrar: FlutterPluginRegistrar) {
|
||||
let channel = FlutterMethodChannel(name: "flutter_qjs", binaryMessenger: registrar.messenger())
|
||||
let instance = SwiftFlutterQjsPlugin()
|
||||
registrar.addMethodCallDelegate(instance, channel: channel)
|
||||
}
|
||||
|
||||
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
|
||||
result("iOS " + UIDevice.current.systemVersion)
|
||||
}
|
||||
}
|
25
ios/flutter_qjs.podspec
Normal file
25
ios/flutter_qjs.podspec
Normal file
@@ -0,0 +1,25 @@
|
||||
#
|
||||
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
|
||||
# Run `pod lib lint flutter_qjs.podspec' to validate before publishing.
|
||||
#
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'flutter_qjs'
|
||||
s.version = '0.0.1'
|
||||
s.summary = 'A new flutter plugin project.'
|
||||
s.description = <<-DESC
|
||||
A new flutter plugin project.
|
||||
DESC
|
||||
s.homepage = 'http://example.com'
|
||||
s.license = { :file => '../LICENSE' }
|
||||
s.author = { 'Your Company' => 'email@example.com' }
|
||||
s.source = { :path => '.' }
|
||||
s.source_files = 'Classes/**/*'
|
||||
s.dependency 'Flutter'
|
||||
s.platform = :ios, '8.0'
|
||||
|
||||
# Flutter.framework does not contain a i386 slice.
|
||||
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
|
||||
s.vendored_frameworks = 'build/release-iphoneos/flutter_qjs.framework'
|
||||
s.static_framework = false
|
||||
s.swift_version = '5.0'
|
||||
end
|
11
ios/make.sh
Normal file
11
ios/make.sh
Normal file
@@ -0,0 +1,11 @@
|
||||
###
|
||||
# @Description:
|
||||
# @Author: ekibun
|
||||
# @Date: 2020-09-24 00:50:13
|
||||
# @LastEditors: ekibun
|
||||
# @LastEditTime: 2020-09-24 00:51:43
|
||||
###
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -G Xcode -DCMAKE_TOOLCHAIN_FILE=../ios.toolchain.cmake -DPLATFORM=OS64COMBINED
|
||||
cmake --build . --config Release
|
Reference in New Issue
Block a user