fix cmake build

This commit is contained in:
ekibun
2021-01-21 19:50:16 -08:00
parent 2d7156ffb2
commit 9bbb68441f
13 changed files with 25 additions and 73 deletions

1
.gitignore vendored
View File

@@ -9,3 +9,4 @@ build/
.vscode/settings.json .vscode/settings.json
ios/cxx ios/cxx
macos/cxx

View File

@@ -15,7 +15,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS: SPEC CHECKSUMS:
Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c
flutter_qjs: 9bb46bb262be81b7c50e4a1a117d5a602d69691f flutter_qjs: 00a5691bdef3079061466f6fd88cd7d6986fb8b6
PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c

View File

@@ -1,22 +1,23 @@
PODS: PODS:
- flutter_qjs (0.0.1): - flutter_qjs (0.0.1):
- FlutterMacOS - FlutterMacOS
- FlutterMacOS (1.0.0) - FlutterMacOS (1.22.4)
DEPENDENCIES: DEPENDENCIES:
- flutter_qjs (from `Flutter/ephemeral/.symlinks/plugins/flutter_qjs/macos`) - flutter_qjs (from `Flutter/ephemeral/.symlinks/plugins/flutter_qjs/macos`)
- FlutterMacOS (from `Flutter/ephemeral/.symlinks/flutter/darwin-x64`)
SPEC REPOS:
trunk:
- FlutterMacOS
EXTERNAL SOURCES: EXTERNAL SOURCES:
flutter_qjs: flutter_qjs:
:path: Flutter/ephemeral/.symlinks/plugins/flutter_qjs/macos :path: Flutter/ephemeral/.symlinks/plugins/flutter_qjs/macos
FlutterMacOS:
:path: Flutter/ephemeral/.symlinks/flutter/darwin-x64
SPEC CHECKSUMS: SPEC CHECKSUMS:
flutter_qjs: f88ea7f9672fdb5fa0ad0aa2aadc4da8c0308880 flutter_qjs: 1a3a4a23a9bb18d0583b5ee44d09ed9383a36e9f
FlutterMacOS: 15bea8a44d2fa024068daa0140371c020b4b6ff9 FlutterMacOS: ac210ef71944b3f04789076d70d4c72c7ec0c619
PODFILE CHECKSUM: d8ba9b3e9e93c62c74a660b46c6fcb09f03991a7 PODFILE CHECKSUM: d8ba9b3e9e93c62c74a660b46c6fcb09f03991a7
COCOAPODS: 1.9.3 COCOAPODS: 1.10.1

View File

@@ -26,11 +26,7 @@
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; };
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; };
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 */; };
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 */; }; 8A0E1E523547DDE6AEEAA187 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E845184DF4416AE932BDD596 /* Pods_Runner.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, ); }; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */ /* Begin PBXContainerItemProxy section */
@@ -50,8 +46,6 @@
dstPath = ""; dstPath = "";
dstSubfolderSpec = 10; dstSubfolderSpec = 10;
files = ( files = (
D73912F222F3801D000D13A0 /* App.framework in Bundle Framework */,
33D1A10522148B93006C7A3E /* FlutterMacOS.framework in Bundle Framework */,
); );
name = "Bundle Framework"; name = "Bundle Framework";
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
@@ -70,7 +64,6 @@
33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = "<group>"; }; 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = "<group>"; };
33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = "<group>"; }; 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = "<group>"; };
33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = "<group>"; }; 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = "<group>"; };
33D1A10322148B71006C7A3E /* FlutterMacOS.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FlutterMacOS.framework; path = Flutter/ephemeral/FlutterMacOS.framework; sourceTree = SOURCE_ROOT; };
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>"; };
@@ -78,7 +71,6 @@
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>"; }; 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; };
E845184DF4416AE932BDD596 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 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>"; }; 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 */
@@ -88,8 +80,6 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
D73912F022F37F9E000D13A0 /* App.framework in Frameworks */,
33D1A10422148B71006C7A3E /* FlutterMacOS.framework in Frameworks */,
8A0E1E523547DDE6AEEAA187 /* Pods_Runner.framework in Frameworks */, 8A0E1E523547DDE6AEEAA187 /* Pods_Runner.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
@@ -145,8 +135,6 @@
33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */, 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */,
33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */, 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */,
33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */, 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */,
D73912EF22F37F9E000D13A0 /* App.framework */,
33D1A10322148B71006C7A3E /* FlutterMacOS.framework */,
); );
path = Flutter; path = Flutter;
sourceTree = "<group>"; sourceTree = "<group>";
@@ -303,7 +291,7 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename\n"; shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n";
}; };
33CC111E2044C6BF0003C045 /* ShellScript */ = { 33CC111E2044C6BF0003C045 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
@@ -330,10 +318,10 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
); );
inputFileListPaths = ( inputPaths = (
); );
name = "[CP] Embed Pods Frameworks"; name = "[CP] Embed Pods Frameworks";
outputFileListPaths = ( outputPaths = (
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; shellPath = /bin/sh;

View File

@@ -14,13 +14,12 @@ This plugin is a simple js engine for flutter using the `quickjs` project. Plugi
s.author = { 'ekibun' => 'soekibun@gmail.com' } s.author = { 'ekibun' => 'soekibun@gmail.com' }
s.source = { :path => '.' } s.source = { :path => '.' }
s.compiler_flags = '-DDUMP_LEAKS' s.compiler_flags = '-DDUMP_LEAKS'
s.source_files = ['Classes/**/*', 'cxx/*'] s.source_files = ['Classes/**/*', 'cxx/*.{c,cpp}']
s.public_header_files = 'Classes/**/*.h'
s.dependency 'Flutter' s.dependency 'Flutter'
s.platform = :ios, '8.0' s.platform = :ios, '8.0'
# Flutter.framework does not contain a i386 slice. # Flutter.framework does not contain a i386 slice.
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' } s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
s.prepare_command = 'sh pre.sh' s.prepare_command = 'sh ../cxx/prebuild.sh'
s.swift_version = '5.0' s.swift_version = '5.0'
end end

View File

@@ -53,7 +53,7 @@ final DynamicLibrary qjsLib = Platform.environment['FLUTTER_TEST'] == 'true'
? (Platform.isWindows ? (Platform.isWindows
? DynamicLibrary.open("test/build/Debug/ffiquickjs.dll") ? DynamicLibrary.open("test/build/Debug/ffiquickjs.dll")
: Platform.isMacOS : Platform.isMacOS
? DynamicLibrary.open("test/build/Debug/libffiquickjs.dylib") ? DynamicLibrary.open("test/build/libffiquickjs.dylib")
: DynamicLibrary.process()) : DynamicLibrary.process())
: (Platform.isWindows : (Platform.isWindows
? DynamicLibrary.open("flutter_qjs_plugin.dll") ? DynamicLibrary.open("flutter_qjs_plugin.dll")

View File

@@ -1,7 +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)

View File

@@ -13,12 +13,13 @@ This plugin is a simple js engine for flutter using the `quickjs` project. Plugi
s.license = { :file => '../LICENSE' } s.license = { :file => '../LICENSE' }
s.author = { 'ekibun' => 'soekibun@gmail.com' } s.author = { 'ekibun' => 'soekibun@gmail.com' }
s.source = { :path => '.' } s.source = { :path => '.' }
s.source_files = 'Classes/**/*' s.compiler_flags = '-DDUMP_LEAKS'
s.source_files = ['Classes/**/*', 'cxx/*.{c,cpp}']
s.dependency 'FlutterMacOS' s.dependency 'FlutterMacOS'
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_libraries = 'build/Debug/libffiquickjs.dylib' s.vendored_libraries = 'build/Debug/libffiquickjs.dylib'
s.prepare_command = 'sh make.sh' s.prepare_command = 'sh ../cxx/prebuild.sh'
s.swift_version = '5.0' s.swift_version = '5.0'
end end

View File

@@ -1,12 +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_OSX_ARCHITECTURES=x86_64
cmake --build . --config Debug
cd ..

View File

@@ -4,4 +4,5 @@ project(ffiquickjs LANGUAGES CXX)
include("${CMAKE_CURRENT_SOURCE_DIR}/../cxx/quickjs.cmake") include("${CMAKE_CURRENT_SOURCE_DIR}/../cxx/quickjs.cmake")
add_library(ffiquickjs SHARED ${CXX_LIB_DIR}/ffi.cpp) add_library(ffiquickjs SHARED ${CXX_LIB_DIR}/ffi.cpp)
target_compile_features(ffiquickjs PUBLIC cxx_std_17)
target_link_libraries(ffiquickjs PRIVATE quickjs) target_link_libraries(ffiquickjs PRIVATE quickjs)

View File

@@ -43,10 +43,11 @@ Future testEvaluate(qjs) async {
} }
void main() async { void main() async {
test('make.windows', () async { test('make', () async {
final utf8Encoding = Encoding.getByName('utf-8'); final utf8Encoding = Encoding.getByName('utf-8');
final cmakePath = final cmakePath = Platform.isWindows
"C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin/cmake.exe"; ? "C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin/cmake.exe"
: "cmake";
final buildDir = "./build"; final buildDir = "./build";
var result = Process.runSync( var result = Process.runSync(
cmakePath, cmakePath,
@@ -69,17 +70,7 @@ void main() async {
stdout.write(result.stdout); stdout.write(result.stdout);
stderr.write(result.stderr); stderr.write(result.stderr);
expect(result.exitCode, 0); expect(result.exitCode, 0);
}, testOn: 'windows'); });
test('make.macos', () async {
var result = Process.runSync(
"sh",
['./make.sh'],
workingDirectory: 'macos',
);
stdout.write(result.stdout);
stderr.write(result.stderr);
expect(result.exitCode, 0);
}, testOn: 'mac-os');
test('module', () async { test('module', () async {
final qjs = FlutterQjs( final qjs = FlutterQjs(
moduleHandler: (name) { moduleHandler: (name) {

View File

@@ -1,11 +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_OSX_ARCHITECTURES=x86_64
cmake --build . --config Debug