ios build without cmake

This commit is contained in:
ekibun
2021-01-21 06:28:00 -08:00
parent 2ce255bdfc
commit 2d7156ffb2
12 changed files with 57 additions and 87 deletions

0
ios/.gitignore vendored Normal file → Executable file
View File

0
ios/Assets/.gitkeep Normal file → Executable file
View File

View File

@@ -1,24 +0,0 @@
cmake_minimum_required(VERSION 3.7 FATAL_ERROR)
project(ffiquickjs LANGUAGES CXX)
include("${CMAKE_CURRENT_SOURCE_DIR}/../cxx/quickjs.cmake")
add_library(ffiquickjs SHARED ${CXX_LIB_DIR}/ffi.cpp)
target_link_libraries(ffiquickjs PRIVATE quickjs)
set_target_properties(ffiquickjs PROPERTIES
FRAMEWORK TRUE
FRAMEWORK_VERSION A
MACOSX_FRAMEWORK_IDENTIFIER soko.ekibun.ffiquickjs
# 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
MACOSX_FRAMEWORK_BUNDLE_VERSION 100
MACOSX_FRAMEWORK_SHORT_VERSION_STRING 100
XCODE_ATTRIBUTE_DYLIB_INSTALL_NAME_BASE "@rpath"
PUBLIC_HEADER ffi.h
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "Apple Development"
# RESOURCE "${RESOURCE_FILES}"
)

View File

@@ -13,14 +13,14 @@ This plugin is a simple js engine for flutter using the `quickjs` project. Plugi
s.license = { :file => '../LICENSE' }
s.author = { 'ekibun' => 'soekibun@gmail.com' }
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.compiler_flags = '-DDUMP_LEAKS'
s.source_files = ['Classes/**/*', 'cxx/*']
s.public_header_files = 'Classes/**/*.h'
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/ffiquickjs.framework'
s.static_framework = false
s.prepare_command = 'sh make.sh'
s.prepare_command = 'sh pre.sh'
s.swift_version = '5.0'
end

View File

@@ -1,22 +0,0 @@
###
# @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_SYSTEM_NAME=iOS \
-DCMAKE_IOS_INSTALL_COMBINED=true \
-DCMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH=NO
cmake --build . --config Debug -- -arch arm64
cmake --build . --config Debug -- -sdk iphonesimulator -arch x86_64
mkdir ffiquickjs.framework
lipo -create 'Debug-iphoneos/ffiquickjs.framework/ffiquickjs' 'Debug-iphonesimulator/ffiquickjs.framework/ffiquickjs' -output 'ffiquickjs.framework/ffiquickjs'
cp -f 'Debug-iphoneos/ffiquickjs.framework/Info.plist' 'ffiquickjs.framework/Info.plist'
cd ..

33
ios/pre.sh Normal file
View File

@@ -0,0 +1,33 @@
if [ -d "./cxx/" ];then
rm -r ./cxx
fi
mkdir ./cxx
sed 's/\#include \"quickjs\/quickjs.h\"/\#include \"quickjs.h\"/g' ../cxx/ffi.h > ./cxx/ffi.h
cp ../cxx/ffi.cpp ./cxx/ffi.cpp
quickjs_version=$(cat ../cxx/quickjs/VERSION)
sed '1i\
\#define CONFIG_VERSION \"'$quickjs_version'\"\
' ../cxx/quickjs/quickjs.c > ./cxx/quickjs.c
quickjs_src=(
"list.h"
"cutils.c"
"libregexp.c"
"libunicode.c"
"cutils.h"
"libregexp.h"
"libunicode.h"
"quickjs.h"
"quickjs-atom.h"
"quickjs-opcode.h"
"libregexp-opcode.h"
"libunicode-table.h"
)
for item in ${quickjs_src[*]}
do
cp ../cxx/quickjs/$item ./cxx/$item
done