Add iOS test

This commit is contained in:
Nathan Horrigan
2021-08-17 21:32:29 +01:00
parent 486b93b8a4
commit 21a8ca3945
33 changed files with 1619 additions and 10 deletions

3
.gitignore vendored
View File

@@ -13,3 +13,6 @@ api-docs-repo/
# Generated by tests on Android # Generated by tests on Android
/avd /avd
/core /core
# Artifacts from iOS tests
tests/integration/ios/**/*.dylib

4
Cargo.lock generated
View File

@@ -2728,6 +2728,10 @@ dependencies = [
"tempfile", "tempfile",
] ]
[[package]]
name = "wasmer-integration-tests-ios"
version = "2.0.0"
[[package]] [[package]]
name = "wasmer-middlewares" name = "wasmer-middlewares"
version = "2.0.0" version = "2.0.0"

View File

@@ -52,6 +52,7 @@ members = [
"tests/lib/wast", "tests/lib/wast",
"tests/lib/compiler-test-derive", "tests/lib/compiler-test-derive",
"tests/integration/cli", "tests/integration/cli",
"tests/integration/ios",
"fuzz", "fuzz",
] ]

View File

@@ -44,11 +44,12 @@ i32.add)
// Create a compiler for iOS // Create a compiler for iOS
let compiler_config = Cranelift::default(); let compiler_config = Cranelift::default();
let triple = Triple::from_str("aarch64-apple-ios") let triple = Triple::from_str("x86_64-apple-ios")
.map_err(|error| RuntimeError::new(error.to_string()))?; .map_err(|error| RuntimeError::new(error.to_string()))?;
// Let's build the target. // Let's build the target.
let mut cpu_feature = CpuFeature::set(); let mut cpu_feature = CpuFeature::set();
cpu_feature.insert(CpuFeature::from_str("sse2")?);
let target = Target::new(triple, cpu_feature); let target = Target::new(triple, cpu_feature);
println!("Chosen target: {:?}", target); println!("Chosen target: {:?}", target);
@@ -67,6 +68,27 @@ i32.add)
let mut dylib_file = Path::new("./sum.dylib"); let mut dylib_file = Path::new("./sum.dylib");
module.serialize_to_file(dylib_file)?; module.serialize_to_file(dylib_file)?;
let module = unsafe { Module::deserialize_from_file(&store, dylib_file) }?;
// Congrats, the Wasm module has been deserialized! Now let's
// execute it for the sake of having a complete example.
// Create an import object. Since our Wasm module didn't declare
// any imports, it's an empty object.
let import_object = imports! {};
println!("Instantiating module...");
// Let's instantiate the Wasm module.
let instance = Instance::new(&module, &import_object)?;
println!("Calling `sum` function...");
// The Wasm module exports a function called `sum`.
let sum = instance.exports.get_function("sum")?;
let results = sum.call(&[Value::I32(1), Value::I32(2)])?;
println!("Results: {:?}", results);
assert_eq!(results.to_vec(), vec![Value::I32(3)]);
Ok(()) Ok(())
} }

View File

@@ -62,18 +62,9 @@
# define DEPRECATED(message) __declspec(deprecated(message)) # define DEPRECATED(message) __declspec(deprecated(message))
#endif #endif
// The `universal` feature has been enabled for this build.
#define WASMER_UNIVERSAL_ENABLED
// The `compiler` feature has been enabled for this build.
#define WASMER_COMPILER_ENABLED
// The `wasi` feature has been enabled for this build. // The `wasi` feature has been enabled for this build.
#define WASMER_WASI_ENABLED #define WASMER_WASI_ENABLED
// The `middlewares` feature has been enabled for this build.
#define WASMER_MIDDLEWARES_ENABLED
// This file corresponds to the following Wasmer version. // This file corresponds to the following Wasmer version.
#define WASMER_VERSION "2.0.0" #define WASMER_VERSION "2.0.0"
#define WASMER_VERSION_MAJOR 2 #define WASMER_VERSION_MAJOR 2
@@ -803,7 +794,9 @@ bool wasmer_features_tail_call(struct wasmer_features_t *features, bool enable);
bool wasmer_features_threads(struct wasmer_features_t *features, bool enable); bool wasmer_features_threads(struct wasmer_features_t *features, bool enable);
#if defined(WASMER_COMPILER_ENABLED)
bool wasmer_is_compiler_available(enum wasmer_compiler_t compiler); bool wasmer_is_compiler_available(enum wasmer_compiler_t compiler);
#endif
bool wasmer_is_engine_available(enum wasmer_engine_t engine); bool wasmer_is_engine_available(enum wasmer_engine_t engine);

View File

@@ -0,0 +1,8 @@
[package]
name = "wasmer-integration-tests-ios"
version = "2.0.0"
authors = ["Wasmer Engineering Team <engineering@wasmer.io>"]
description = "iOS integration tests"
repository = "https://github.com/wasmerio/wasmer"
edition = "2018"
publish = false

View File

@@ -0,0 +1,720 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 54;
objects = {
/* Begin PBXBuildFile section */
6315FBEE26CC45F10059CE47 /* calc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6315FBEC26CC45F10059CE47 /* calc.cpp */; };
63CD62C426C9492100424C7A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63CD62C326C9492100424C7A /* AppDelegate.swift */; };
63CD62C626C9492100424C7A /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63CD62C526C9492100424C7A /* SceneDelegate.swift */; };
63CD62C826C9492100424C7A /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63CD62C726C9492100424C7A /* ViewController.swift */; };
63CD62CB26C9492100424C7A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 63CD62C926C9492100424C7A /* Main.storyboard */; };
63CD62CD26C9492400424C7A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 63CD62CC26C9492400424C7A /* Assets.xcassets */; };
63CD62D026C9492400424C7A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 63CD62CE26C9492400424C7A /* LaunchScreen.storyboard */; };
63CD62DB26C9492400424C7A /* DylibExampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63CD62DA26C9492400424C7A /* DylibExampleTests.swift */; };
63CD62E626C9492400424C7A /* DylibExampleUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63CD62E526C9492400424C7A /* DylibExampleUITests.swift */; };
63CD62FB26C94F4700424C7A /* libwasmer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 63CD62F826C94EB600424C7A /* libwasmer.a */; };
63CD62FF26C952CC00424C7A /* sum.wasm in Resources */ = {isa = PBXBuildFile; fileRef = 63CD62FE26C952CC00424C7A /* sum.wasm */; };
63CD630126C9541E00424C7A /* sum.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 63CD630026C9541E00424C7A /* sum.dylib */; };
63CD630226C9541E00424C7A /* sum.dylib in Embed .dylib in App bundle */ = {isa = PBXBuildFile; fileRef = 63CD630026C9541E00424C7A /* sum.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
63CD62D726C9492400424C7A /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 63CD62B826C9492100424C7A /* Project object */;
proxyType = 1;
remoteGlobalIDString = 63CD62BF26C9492100424C7A;
remoteInfo = DylibExample;
};
63CD62E226C9492400424C7A /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 63CD62B826C9492100424C7A /* Project object */;
proxyType = 1;
remoteGlobalIDString = 63CD62BF26C9492100424C7A;
remoteInfo = DylibExample;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
63CD630326C9541E00424C7A /* Embed .dylib in App bundle */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 12;
dstPath = "";
dstSubfolderSpec = 6;
files = (
63CD630226C9541E00424C7A /* sum.dylib in Embed .dylib in App bundle */,
);
name = "Embed .dylib in App bundle";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
6311890B26CBAD2C007746B2 /* sum.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = sum.dylib; path = DylibExample/sum.dylib; sourceTree = "<group>"; };
6315FBEC26CC45F10059CE47 /* calc.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = calc.cpp; sourceTree = "<group>"; };
6315FBED26CC45F10059CE47 /* calc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = calc.h; sourceTree = "<group>"; };
63CD62C026C9492100424C7A /* DylibExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DylibExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
63CD62C326C9492100424C7A /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
63CD62C526C9492100424C7A /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
63CD62C726C9492100424C7A /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
63CD62CA26C9492100424C7A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
63CD62CC26C9492400424C7A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
63CD62CF26C9492400424C7A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
63CD62D126C9492400424C7A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
63CD62D626C9492400424C7A /* DylibExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DylibExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
63CD62DA26C9492400424C7A /* DylibExampleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DylibExampleTests.swift; sourceTree = "<group>"; };
63CD62DC26C9492400424C7A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
63CD62E126C9492400424C7A /* DylibExampleUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DylibExampleUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
63CD62E526C9492400424C7A /* DylibExampleUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DylibExampleUITests.swift; sourceTree = "<group>"; };
63CD62E726C9492400424C7A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
63CD62F426C94D6000424C7A /* DylibExample-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "DylibExample-Bridging-Header.h"; sourceTree = "<group>"; };
63CD62F826C94EB600424C7A /* libwasmer.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libwasmer.a; path = ../../../../target/universal/release/libwasmer.a; sourceTree = "<group>"; };
63CD62FE26C952CC00424C7A /* sum.wasm */ = {isa = PBXFileReference; lastKnownFileType = text; path = sum.wasm; sourceTree = "<group>"; };
63CD630026C9541E00424C7A /* sum.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = sum.dylib; path = DylibExample/sum.dylib; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
63CD62BD26C9492100424C7A /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
63CD630126C9541E00424C7A /* sum.dylib in Frameworks */,
63CD62FB26C94F4700424C7A /* libwasmer.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
63CD62D326C9492400424C7A /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
63CD62DE26C9492400424C7A /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
63CD62B726C9492100424C7A = {
isa = PBXGroup;
children = (
6311890B26CBAD2C007746B2 /* sum.dylib */,
63CD62F826C94EB600424C7A /* libwasmer.a */,
63CD62C226C9492100424C7A /* DylibExample */,
63CD62D926C9492400424C7A /* DylibExampleTests */,
63CD62E426C9492400424C7A /* DylibExampleUITests */,
63CD62C126C9492100424C7A /* Products */,
63CD62FA26C94F4700424C7A /* Frameworks */,
);
sourceTree = "<group>";
};
63CD62C126C9492100424C7A /* Products */ = {
isa = PBXGroup;
children = (
63CD62C026C9492100424C7A /* DylibExample.app */,
63CD62D626C9492400424C7A /* DylibExampleTests.xctest */,
63CD62E126C9492400424C7A /* DylibExampleUITests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
63CD62C226C9492100424C7A /* DylibExample */ = {
isa = PBXGroup;
children = (
63CD62C326C9492100424C7A /* AppDelegate.swift */,
63CD62C526C9492100424C7A /* SceneDelegate.swift */,
63CD62C726C9492100424C7A /* ViewController.swift */,
63CD62C926C9492100424C7A /* Main.storyboard */,
63CD62CC26C9492400424C7A /* Assets.xcassets */,
63CD62CE26C9492400424C7A /* LaunchScreen.storyboard */,
63CD62D126C9492400424C7A /* Info.plist */,
63CD62F426C94D6000424C7A /* DylibExample-Bridging-Header.h */,
63CD62FE26C952CC00424C7A /* sum.wasm */,
6315FBEC26CC45F10059CE47 /* calc.cpp */,
6315FBED26CC45F10059CE47 /* calc.h */,
);
path = DylibExample;
sourceTree = "<group>";
};
63CD62D926C9492400424C7A /* DylibExampleTests */ = {
isa = PBXGroup;
children = (
63CD62DA26C9492400424C7A /* DylibExampleTests.swift */,
63CD62DC26C9492400424C7A /* Info.plist */,
);
path = DylibExampleTests;
sourceTree = "<group>";
};
63CD62E426C9492400424C7A /* DylibExampleUITests */ = {
isa = PBXGroup;
children = (
63CD62E526C9492400424C7A /* DylibExampleUITests.swift */,
63CD62E726C9492400424C7A /* Info.plist */,
);
path = DylibExampleUITests;
sourceTree = "<group>";
};
63CD62FA26C94F4700424C7A /* Frameworks */ = {
isa = PBXGroup;
children = (
63CD630026C9541E00424C7A /* sum.dylib */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
63CD62BF26C9492100424C7A /* DylibExample */ = {
isa = PBXNativeTarget;
buildConfigurationList = 63CD62EA26C9492400424C7A /* Build configuration list for PBXNativeTarget "DylibExample" */;
buildPhases = (
63CD62F326C94B1D00424C7A /* Build Headless Wasmer */,
63CD62FD26C951EF00424C7A /* Compile .wasm to .dylib */,
63CD62BC26C9492100424C7A /* Sources */,
63CD62BD26C9492100424C7A /* Frameworks */,
63CD62BE26C9492100424C7A /* Resources */,
63CD630326C9541E00424C7A /* Embed .dylib in App bundle */,
);
buildRules = (
);
dependencies = (
);
name = DylibExample;
productName = DylibExample;
productReference = 63CD62C026C9492100424C7A /* DylibExample.app */;
productType = "com.apple.product-type.application";
};
63CD62D526C9492400424C7A /* DylibExampleTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 63CD62ED26C9492400424C7A /* Build configuration list for PBXNativeTarget "DylibExampleTests" */;
buildPhases = (
63CD62D226C9492400424C7A /* Sources */,
63CD62D326C9492400424C7A /* Frameworks */,
63CD62D426C9492400424C7A /* Resources */,
);
buildRules = (
);
dependencies = (
63CD62D826C9492400424C7A /* PBXTargetDependency */,
);
name = DylibExampleTests;
productName = DylibExampleTests;
productReference = 63CD62D626C9492400424C7A /* DylibExampleTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
63CD62E026C9492400424C7A /* DylibExampleUITests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 63CD62F026C9492400424C7A /* Build configuration list for PBXNativeTarget "DylibExampleUITests" */;
buildPhases = (
63CD62DD26C9492400424C7A /* Sources */,
63CD62DE26C9492400424C7A /* Frameworks */,
63CD62DF26C9492400424C7A /* Resources */,
);
buildRules = (
);
dependencies = (
63CD62E326C9492400424C7A /* PBXTargetDependency */,
);
name = DylibExampleUITests;
productName = DylibExampleUITests;
productReference = 63CD62E126C9492400424C7A /* DylibExampleUITests.xctest */;
productType = "com.apple.product-type.bundle.ui-testing";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
63CD62B826C9492100424C7A /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1250;
LastUpgradeCheck = 1250;
TargetAttributes = {
63CD62BF26C9492100424C7A = {
CreatedOnToolsVersion = 12.5;
LastSwiftMigration = 1250;
};
63CD62D526C9492400424C7A = {
CreatedOnToolsVersion = 12.5;
TestTargetID = 63CD62BF26C9492100424C7A;
};
63CD62E026C9492400424C7A = {
CreatedOnToolsVersion = 12.5;
TestTargetID = 63CD62BF26C9492100424C7A;
};
};
};
buildConfigurationList = 63CD62BB26C9492100424C7A /* Build configuration list for PBXProject "DylibExample" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 63CD62B726C9492100424C7A;
productRefGroup = 63CD62C126C9492100424C7A /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
63CD62BF26C9492100424C7A /* DylibExample */,
63CD62D526C9492400424C7A /* DylibExampleTests */,
63CD62E026C9492400424C7A /* DylibExampleUITests */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
63CD62BE26C9492100424C7A /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
63CD62D026C9492400424C7A /* LaunchScreen.storyboard in Resources */,
63CD62CD26C9492400424C7A /* Assets.xcassets in Resources */,
63CD62CB26C9492100424C7A /* Main.storyboard in Resources */,
63CD62FF26C952CC00424C7A /* sum.wasm in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
63CD62D426C9492400424C7A /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
63CD62DF26C9492400424C7A /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
63CD62F326C94B1D00424C7A /* Build Headless Wasmer */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Build Headless Wasmer";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "#!/bin/bash\nexport PATH=$(bash -l -c 'echo $PATH')\ncd ../../../../\nmake build-wasmer\nmake build-capi-headless-ios\n";
};
63CD62FD26C951EF00424C7A /* Compile .wasm to .dylib */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Compile .wasm to .dylib";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/sum.dylib",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "./../../../../target/release/wasmer compile DylibExample/sum.wasm --target x86_64-apple-ios --dylib -o DylibExample/sum.dylib\n";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
63CD62BC26C9492100424C7A /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
63CD62C826C9492100424C7A /* ViewController.swift in Sources */,
6315FBEE26CC45F10059CE47 /* calc.cpp in Sources */,
63CD62C426C9492100424C7A /* AppDelegate.swift in Sources */,
63CD62C626C9492100424C7A /* SceneDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
63CD62D226C9492400424C7A /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
63CD62DB26C9492400424C7A /* DylibExampleTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
63CD62DD26C9492400424C7A /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
63CD62E626C9492400424C7A /* DylibExampleUITests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
63CD62D826C9492400424C7A /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 63CD62BF26C9492100424C7A /* DylibExample */;
targetProxy = 63CD62D726C9492400424C7A /* PBXContainerItemProxy */;
};
63CD62E326C9492400424C7A /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 63CD62BF26C9492100424C7A /* DylibExample */;
targetProxy = 63CD62E226C9492400424C7A /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
63CD62C926C9492100424C7A /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
63CD62CA26C9492100424C7A /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
63CD62CE26C9492400424C7A /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
63CD62CF26C9492400424C7A /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
63CD62E826C9492400424C7A /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 14.5;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
63CD62E926C9492400424C7A /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 14.5;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
63CD62EB26C9492400424C7A /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = "";
HEADER_SEARCH_PATHS = "../../../../lib/**";
INFOPLIST_FILE = DylibExample/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = (
"../../../../target/universal/release/**",
"$(PROJECT_DIR)/DylibExample",
);
PATH = "/Users/nathanhorrigan/.wasmer/bin:/Users/nathanhorrigan/.cargo/bin:/Users/nathanhorrigan/Android/Sdk/tools:/Users/nathanhorrigan/Android/Sdk/tools/bin:/Users/nathanhorrigan/Android/Sdk/platform-tools:/Users/nathanhorrigan/.pyenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/nathanhorrigan/.wasmer/globals/wapm_packages/.bin";
PRODUCT_BUNDLE_IDENTIFIER = io.wasmer.DylibExample;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "DylibExample/DylibExample-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 1;
};
name = Debug;
};
63CD62EC26C9492400424C7A /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = "";
HEADER_SEARCH_PATHS = "../../../../lib/**";
INFOPLIST_FILE = DylibExample/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = (
"../../../../target/universal/release/**",
"$(PROJECT_DIR)/DylibExample",
);
PATH = "/Users/nathanhorrigan/.wasmer/bin:/Users/nathanhorrigan/.cargo/bin:/Users/nathanhorrigan/Android/Sdk/tools:/Users/nathanhorrigan/Android/Sdk/tools/bin:/Users/nathanhorrigan/Android/Sdk/platform-tools:/Users/nathanhorrigan/.pyenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/nathanhorrigan/.wasmer/globals/wapm_packages/.bin";
PRODUCT_BUNDLE_IDENTIFIER = io.wasmer.DylibExample;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "DylibExample/DylibExample-Bridging-Header.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 1;
};
name = Release;
};
63CD62EE26C9492400424C7A /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = "";
HEADER_SEARCH_PATHS = "../../../../lib/c-api/**";
INFOPLIST_FILE = DylibExampleTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.5;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = "../../../../target/universal/release/**";
PRODUCT_BUNDLE_IDENTIFIER = io.wasmer.DylibExampleTests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DylibExample.app/DylibExample";
};
name = Debug;
};
63CD62EF26C9492400424C7A /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = "";
HEADER_SEARCH_PATHS = "../../../../lib/c-api/**";
INFOPLIST_FILE = DylibExampleTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.5;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = "../../../../target/universal/release/**";
PRODUCT_BUNDLE_IDENTIFIER = io.wasmer.DylibExampleTests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DylibExample.app/DylibExample";
};
name = Release;
};
63CD62F126C9492400424C7A /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = DylibExampleUITests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = io.wasmer.DylibExampleUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_TARGET_NAME = DylibExample;
};
name = Debug;
};
63CD62F226C9492400424C7A /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = DylibExampleUITests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = io.wasmer.DylibExampleUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_TARGET_NAME = DylibExample;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
63CD62BB26C9492100424C7A /* Build configuration list for PBXProject "DylibExample" */ = {
isa = XCConfigurationList;
buildConfigurations = (
63CD62E826C9492400424C7A /* Debug */,
63CD62E926C9492400424C7A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
63CD62EA26C9492400424C7A /* Build configuration list for PBXNativeTarget "DylibExample" */ = {
isa = XCConfigurationList;
buildConfigurations = (
63CD62EB26C9492400424C7A /* Debug */,
63CD62EC26C9492400424C7A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
63CD62ED26C9492400424C7A /* Build configuration list for PBXNativeTarget "DylibExampleTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
63CD62EE26C9492400424C7A /* Debug */,
63CD62EF26C9492400424C7A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
63CD62F026C9492400424C7A /* Build configuration list for PBXNativeTarget "DylibExampleUITests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
63CD62F126C9492400424C7A /* Debug */,
63CD62F226C9492400424C7A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 63CD62B826C9492100424C7A /* Project object */;
}

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1250"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "63CD62BF26C9492100424C7A"
BuildableName = "DylibExample.app"
BlueprintName = "DylibExample"
ReferencedContainer = "container:DylibExample.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "63CD62D526C9492400424C7A"
BuildableName = "DylibExampleTests.xctest"
BlueprintName = "DylibExampleTests"
ReferencedContainer = "container:DylibExample.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "63CD62E026C9492400424C7A"
BuildableName = "DylibExampleUITests.xctest"
BlueprintName = "DylibExampleUITests"
ReferencedContainer = "container:DylibExample.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "63CD62BF26C9492100424C7A"
BuildableName = "DylibExample.app"
BlueprintName = "DylibExample"
ReferencedContainer = "container:DylibExample.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "63CD62BF26C9492100424C7A"
BuildableName = "DylibExample.app"
BlueprintName = "DylibExample"
ReferencedContainer = "container:DylibExample.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
uuid = "9ADEF0E0-C0C7-4A3F-B94B-E91000A03074"
type = "1"
version = "2.0">
</Bucket>

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>DylibExample.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>63CD62BF26C9492100424C7A</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>63CD62D526C9492400424C7A</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>63CD62E026C9492400424C7A</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>

View File

@@ -0,0 +1,36 @@
//
// AppDelegate.swift
// DylibExample
//
// Created by Nathan Horrigan on 15/08/2021.
//
import UIKit
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}

View File

@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,98 @@
{
"images" : [
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x60"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "60x60"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "20x20"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "29x29"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "76x76"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "76x76"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "83.5x83.5"
},
{
"idiom" : "ios-marketing",
"scale" : "1x",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>

View File

@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="18122" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModule="DylibExample" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="The sum of 1 + 3 = ?" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Vpr-hH-YMQ">
<rect key="frame" x="99" y="438" width="217" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="Vpr-hH-YMQ" firstAttribute="centerX" secondItem="6Tk-OE-BBY" secondAttribute="centerX" id="Ji2-mk-twz"/>
<constraint firstItem="Vpr-hH-YMQ" firstAttribute="centerY" secondItem="6Tk-OE-BBY" secondAttribute="centerY" id="xFk-LR-xQd"/>
</constraints>
</view>
<connections>
<outlet property="label" destination="Vpr-hH-YMQ" id="l1C-dt-cHd"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="137.68115942028987" y="114.50892857142857"/>
</scene>
</scenes>
<resources>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>

View File

@@ -0,0 +1,4 @@
#include "wasm.h"
#include "wasmer.h"
#include "wasmer_wasm.h"
#include "calc.h"

View File

@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneConfigurationName</key>
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
<key>UISceneStoryboardFile</key>
<string>Main</string>
</dict>
</array>
</dict>
</dict>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>

View File

@@ -0,0 +1,52 @@
//
// SceneDelegate.swift
// DylibExample
//
// Created by Nathan Horrigan on 15/08/2021.
//
import UIKit
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard let _ = (scene as? UIWindowScene) else { return }
}
func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead).
}
func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}
func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}
func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
}
}

View File

@@ -0,0 +1,18 @@
//
// ViewController.swift
// DylibExample
//
// Created by Nathan Horrigan on 15/08/2021.
//
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var label: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
let sum = calculate_sum(1, 3)
label.text = "The sum of 1 + 3 = \(sum)"
}
}

View File

@@ -0,0 +1,130 @@
//
// WASM.cpp
// DylibExample
//
// Created by Nathan Horrigan on 17/08/2021.
//
#include "calc.h"
#include <any>
#include <cstdio>
#include <cstring>
#include <fstream>
#include <iostream>
#include <sstream>
#include <vector>
#include <filesystem>
#include <CoreFoundation/CFBundle.h>
std::string get_resources_dir()
{
CFURLRef resourceURL = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());
char resourcePath[PATH_MAX];
if (CFURLGetFileSystemRepresentation(resourceURL, true,
(UInt8 *)resourcePath,
PATH_MAX))
{
if (resourceURL != NULL)
{
CFRelease(resourceURL);
}
return resourcePath;
}
return "";
}
inline std::vector<uint8_t> read_vector_from_disk(std::string file_path) {
std::ifstream instream(file_path, std::ios::in | std::ios::binary);
std::vector<uint8_t> data((std::istreambuf_iterator<char>(instream)), std::istreambuf_iterator<char>());
return data;
}
int calculate_sum(int a, int b) {
printf("Creating the store...\n");
wasm_engine_t* engine = wasm_engine_new();
wasm_store_t* store = wasm_store_new(engine);
printf("Loading .dylib file...\n");
std::string wasm_path = get_resources_dir() + "/sum.dylib";
std::vector<uint8_t> dylib = read_vector_from_disk(wasm_path.c_str());
uint8_t* wasm_bytes = dylib.data();
wasm_byte_vec_t imported_bytes;
imported_bytes.size = dylib.size();
imported_bytes.data = (wasm_byte_t *) wasm_bytes;
printf("Compiling module...\n");
wasm_module_t* module;
module = wasm_module_deserialize(store, &imported_bytes);
if (!module) {
printf("> Error compiling module!\n");
return 1;
}
printf("Creating imports...\n");
wasm_extern_vec_t import_object = WASM_EMPTY_VEC;
printf("Instantiating module...\n");
wasm_instance_t* instance = wasm_instance_new(store, module, &import_object, NULL);
if (!instance) {
printf("> Error instantiating module!\n");
return 1;
}
printf("Retrieving exports...\n");
wasm_extern_vec_t exports;
wasm_instance_exports(instance, &exports);
if (exports.size == 0) {
printf("> Error accessing exports!\n");
return 1;
}
printf("Retrieving the `sum` function...\n");
wasm_func_t* sum_func = wasm_extern_as_func(exports.data[0]);
if (sum_func == NULL) {
printf("> Failed to get the `sum` function!\n");
return 1;
}
printf("Calling `sum` function...\n");
wasm_val_t args_val[2] = { WASM_I32_VAL(a), WASM_I32_VAL(b) };
wasm_val_t results_val[1] = { WASM_INIT_VAL };
wasm_val_vec_t args = WASM_ARRAY_VEC(args_val);
wasm_val_vec_t results = WASM_ARRAY_VEC(results_val);
if (wasm_func_call(sum_func, &args, &results)) {
printf("> Error calling the `sum` function!\n");
return 1;
}
printf("Results of `sum`: %d\n", results_val[0].of.i32);
return results_val[0].of.i32;
}
// std::vector<uint8_t> buffer;
// {
// std::ifstream in(file_path, std::ios::binary);
// in.seekg(0, std::ios::end);
// size_t size = in.tellg();
// in.seekg(0, std::ios::beg);
// buffer.resize(size);
// in.read(reinterpret_cast<char*>(buffer.data()), size);
// }
//
// return buffer;

View File

@@ -0,0 +1,25 @@
//
// WASM.hpp
// DylibExample
//
// Created by Nathan Horrigan on 17/08/2021.
//
#ifndef calc_h
#define WASM_hpp
#include "wasm.h"
#include "wasmer.h"
#include "wasmer_wasm.h"
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
int calculate_sum(int a, int b);
#ifdef __cplusplus
}
#endif
#endif /* calc_h */

View File

@@ -0,0 +1,8 @@
//
// calcr.c
// DylibExample
//
// Created by Nathan Horrigan on 17/08/2021.
//
#include "calcr.h"

View File

@@ -0,0 +1,13 @@
//
// calcr.h
// DylibExample
//
// Created by Nathan Horrigan on 17/08/2021.
//
#ifndef calcr_h
#define calcr_h
#include <stdio.h>
#endif /* calcr_h */

View File

@@ -0,0 +1,7 @@
(module
(type $sum_t (func (param i32 i32) (result i32)))
(func $sum_f (type $sum_t) (param $x i32) (param $y i32) (result i32)
local.get $x
local.get $y
i32.add)
(export "sum" (func $sum_f)))

View File

@@ -0,0 +1,33 @@
//
// DylibExampleTests.swift
// DylibExampleTests
//
// Created by Nathan Horrigan on 15/08/2021.
//
import XCTest
@testable import DylibExample
class DylibExampleTests: XCTestCase {
override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() throws {
let sum = calculate_sum(5, 2)
assert(sum == 7, "WASM loaded successfully")
}
func testPerformanceExample() throws {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}
}

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

View File

@@ -0,0 +1,42 @@
//
// DylibExampleUITests.swift
// DylibExampleUITests
//
// Created by Nathan Horrigan on 15/08/2021.
//
import XCTest
class DylibExampleUITests: XCTestCase {
override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// In UI tests its important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() throws {
// UI tests must launch the application that they test.
let app = XCUIApplication()
app.launch()
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testLaunchPerformance() throws {
if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) {
// This measures how long it takes to launch your application.
measure(metrics: [XCTApplicationLaunchMetric()]) {
XCUIApplication().launch()
}
}
}
}

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

View File

@@ -0,0 +1,42 @@
#[cfg(test)]
#[cfg(target_os = "macos")]
mod tests {
use std::process::Command;
#[test]
fn test_runtime() {
let (success, stdout) = run_ios_test("DylibExample/DylibExample.xcodeproj", "DylibExample");
if !success {
println!("{}", stdout);
panic!("Dylib iOS Tests failed with the above output!");
}
}
fn run_ios_test(dir: &str, scheme: &str) -> (bool, String) {
let command = Command::new("xcodebuild")
.arg("test")
.arg("-project")
.arg(dir)
.arg("-scheme")
.arg(scheme)
.arg("-destination")
.arg("platform=iOS Simulator,name=iPhone 12 Pro,OS=14.5")
.output()
.expect("Could not run iOS Test");
// Get output from xcodebuild CLI:
let stderr = String::from_utf8(command.stderr).unwrap();
let stdout = String::from_utf8(command.stdout).unwrap();
/*
An iOS Test Result is quite odd, we check stderr for the phrase 'TEST FAILED'
and then return stdout which contains the failure reason;
We also check that the command executed correctly!
*/
let command_success = command.status.success();
let test_success = stderr.contains("** TEST FAILED **") == false;
let success = command_success && test_success;
return (success, stdout);
}
}