mirror of
https://github.com/bevyengine/bevy
synced 2024-11-25 14:10:19 +00:00
An initial xcode setup for using xcode (#539)
An example of bevy using xcode
This commit is contained in:
parent
ef86ce98ed
commit
9cc6368b28
15 changed files with 652 additions and 2 deletions
36
.github/workflows/ios.yml
vendored
Normal file
36
.github/workflows/ios.yml
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
name: iOS cron CI
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: macOS-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
override: true
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
target
|
||||
key: ${{ runner.os }}-cargo-check-test-${{ matrix.toolchain }}-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- uses: actions-rs/install@v0.1
|
||||
with:
|
||||
crate: cargo-lipo
|
||||
version: latest
|
||||
|
||||
- name: Add iOS targets
|
||||
run: rustup target add aarch64-apple-ios x86_64-apple-ios
|
||||
|
||||
- name: Build and install iOS app in iOS Simulator.
|
||||
run: cd examples/ios && make install
|
|
@ -51,7 +51,7 @@ wayland = ["bevy_winit/wayland"]
|
|||
x11 = ["bevy_winit/x11"]
|
||||
|
||||
[workspace]
|
||||
members = ["crates/*", "crates/bevy_ecs/hecs"]
|
||||
members = ["crates/*", "crates/bevy_ecs/hecs", "examples/ios"]
|
||||
exclude = ["benches"]
|
||||
|
||||
[dependencies]
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
[![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/bevyengine/bevy/blob/master/LICENSE)
|
||||
[![Crates.io](https://img.shields.io/crates/d/bevy.svg)](https://crates.io/crates/bevy)
|
||||
[![Rust](https://github.com/bevyengine/bevy/workflows/CI/badge.svg)](https://github.com/bevyengine/bevy/actions)
|
||||
![iOS cron CI](https://github.com/bevyengine/bevy/workflows/iOS%20cron%20CI/badge.svg)
|
||||
|
||||
## What is Bevy?
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ spirv-reflect = "0.2.3"
|
|||
bevy-glsl-to-spirv = "0.1.7"
|
||||
|
||||
[target.'cfg(target_os = "ios")'.dependencies]
|
||||
shaderc = "0.6.2"
|
||||
shaderc = "0.6.3"
|
||||
|
||||
[features]
|
||||
png = ["image/png"]
|
||||
|
|
|
@ -136,3 +136,36 @@ to point to the correct `.js` file.
|
|||
Then serve `examples/wasm` dir to browser. i.e.
|
||||
|
||||
$ basic-http-server examples/wasm
|
||||
|
||||
## iOS
|
||||
|
||||
#### pre-req
|
||||
|
||||
$ rustup target add aarch64-apple-ios x86_64-apple-ios
|
||||
$ cargo install cargo-lipo
|
||||
|
||||
#### build & run
|
||||
|
||||
Using bash:
|
||||
$ cd examples/ios
|
||||
$ make run
|
||||
|
||||
In an ideal world, this will boot up, install and run the app for the first
|
||||
iOS simulator in your `xcrun simctl devices list`. If this fails, you can
|
||||
specify the simulator device UUID via:
|
||||
$ DEVICE_ID=${YOUR_DEVICE_ID} make run
|
||||
|
||||
If you'd like to see xcode do stuff, you can run
|
||||
$ open bevy_ios_example.xcodeproj/
|
||||
|
||||
which will open xcode. You then must push the zoom zoom play button and wait
|
||||
for the magic.
|
||||
|
||||
The Xcode build GUI will by default build the rust library for both
|
||||
`x86_64-apple-ios`, and `aarch64-apple-ios` which may take a while. If you'd
|
||||
like speed this up, you update the `IOS_TARGETS` User-Defined environment
|
||||
variable in the "`cargo_ios` target" to be either `x86_64-apple-ios` or
|
||||
`aarch64-applo-ios` depending on your goal.
|
||||
|
||||
Note: if you update this variable in Xcode, it will also change the default
|
||||
used for the `Makefile`.
|
||||
|
|
1
examples/ios/.gitignore
vendored
Normal file
1
examples/ios/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/build
|
14
examples/ios/Cargo.toml
Normal file
14
examples/ios/Cargo.toml
Normal file
|
@ -0,0 +1,14 @@
|
|||
[package]
|
||||
name = "bevy-ios-example"
|
||||
version = "0.1.0"
|
||||
authors = ["Sebastian Imlay <sebastian.imlay@gmail.com>"]
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
name = "bevy_ios_example"
|
||||
crate-type = ["staticlib"]
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
bevy = { path = "../../", features = [ "bevy_gilrs", "bevy_gltf", "bevy_wgpu", "bevy_winit", "render", "png", "hdr"], default-features = false}
|
25
examples/ios/Makefile
Normal file
25
examples/ios/Makefile
Normal file
|
@ -0,0 +1,25 @@
|
|||
.PHONY: xcodebuild run install boot-sim generate clean
|
||||
|
||||
DEVICE = ${DEVICE_ID}
|
||||
ifndef DEVICE_ID
|
||||
DEVICE=$(shell xcrun simctl list devices 'iOS' | grep -v 'unavailable' | grep -v '^--' | grep -v '==' | head -n 1 | cut -d ' ' -f 7 | sed 's/[()]//g')
|
||||
endif
|
||||
|
||||
run: install
|
||||
xcrun simctl launch --console $(DEVICE) com.rust.bevy-ios-example
|
||||
|
||||
boot-sim:
|
||||
xcrun simctl boot $(DEVICE) || true
|
||||
|
||||
install: xcodebuild-simulator boot-sim
|
||||
xcrun simctl install $(DEVICE) build/Build/Products/Debug-iphonesimulator/bevy_ios_example.app
|
||||
|
||||
xcodebuild-simulator:
|
||||
IOS_TARGETS=x86_64-apple-ios xcodebuild -scheme bevy_ios_example -configuration Debug -derivedDataPath build -destination "id=$(DEVICE)"
|
||||
|
||||
xcodebuild-iphone:
|
||||
IOS_TARGETS=aarch64-apple-ios xcodebuild -scheme bevy_ios_example -configuration Debug -derivedDataPath build -arch arm64
|
||||
|
||||
clean:
|
||||
rm -r build
|
||||
cargo clean
|
2
examples/ios/bevy_ios_example.xcodeproj/.gitignore
vendored
Normal file
2
examples/ios/bevy_ios_example.xcodeproj/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
xcuserdata
|
||||
project.xcworkspace
|
420
examples/ios/bevy_ios_example.xcodeproj/project.pbxproj
Normal file
420
examples/ios/bevy_ios_example.xcodeproj/project.pbxproj
Normal file
|
@ -0,0 +1,420 @@
|
|||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 51;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
134866208A035F8615C99114 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96A1E5B62F48B379829E8A0D /* Metal.framework */; };
|
||||
2604C99FAB5A8322EDCABB9F /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FE71FBCAA714DB4F42459106 /* UIKit.framework */; };
|
||||
442540D056ADB9AE61A0A590 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9F1B41978FA53999AA836D0F /* Security.framework */; };
|
||||
55892F1396056740E1AF9685 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = AF7DE91055EBD05ED77E57F9 /* main.m */; };
|
||||
55B7188F81C3C4183F81D3AE /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = A39528EB2CCB182F5328223A /* libc++.tbd */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
26BF2C4863C966DABAB40DC8 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 8DBF1E2B5C613DA41701F6D9 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = D08AEBE0B1A9C9A7B8C7B33F;
|
||||
remoteInfo = cargo_ios;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
160DB77300A3F1806F024D47 /* bindings.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = bindings.h; sourceTree = "<group>"; };
|
||||
55EAC02897847195D2F44C15 /* bevy_ios_example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = bevy_ios_example.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
8EE7F1E3B0303533925D7E33 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
|
||||
96A1E5B62F48B379829E8A0D /* Metal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Metal.framework; path = System/Library/Frameworks/Metal.framework; sourceTree = SDKROOT; };
|
||||
9F1B41978FA53999AA836D0F /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
|
||||
A39528EB2CCB182F5328223A /* libc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.tbd"; path = "usr/lib/libc++.tbd"; sourceTree = SDKROOT; };
|
||||
AF7DE91055EBD05ED77E57F9 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||
FE71FBCAA714DB4F42459106 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
D5A822CB2D6847BA8800BE4C /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
442540D056ADB9AE61A0A590 /* Security.framework in Frameworks */,
|
||||
134866208A035F8615C99114 /* Metal.framework in Frameworks */,
|
||||
2604C99FAB5A8322EDCABB9F /* UIKit.framework in Frameworks */,
|
||||
55B7188F81C3C4183F81D3AE /* libc++.tbd in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
321F7D6A765B38E746C35105 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
55EAC02897847195D2F44C15 /* bevy_ios_example.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
4F1D6F28B8A5D1927AB0ADED /* ios-src */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
160DB77300A3F1806F024D47 /* bindings.h */,
|
||||
8EE7F1E3B0303533925D7E33 /* Info.plist */,
|
||||
AF7DE91055EBD05ED77E57F9 /* main.m */,
|
||||
);
|
||||
path = "ios-src";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
8F2E3E6040EAD2EC9F3FA530 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4F1D6F28B8A5D1927AB0ADED /* ios-src */,
|
||||
EB028409C2D0655412DA6E44 /* Frameworks */,
|
||||
321F7D6A765B38E746C35105 /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
EB028409C2D0655412DA6E44 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A39528EB2CCB182F5328223A /* libc++.tbd */,
|
||||
96A1E5B62F48B379829E8A0D /* Metal.framework */,
|
||||
9F1B41978FA53999AA836D0F /* Security.framework */,
|
||||
FE71FBCAA714DB4F42459106 /* UIKit.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXLegacyTarget section */
|
||||
D08AEBE0B1A9C9A7B8C7B33F /* cargo_ios */ = {
|
||||
isa = PBXLegacyTarget;
|
||||
buildArgumentsString = build_rust_deps.sh;
|
||||
buildConfigurationList = AA00A0CFDB11F37F2BA3FC2E /* Build configuration list for PBXLegacyTarget "cargo_ios" */;
|
||||
buildPhases = (
|
||||
FE045B3D04D57B713A565FF8 /* Sources */,
|
||||
);
|
||||
buildToolPath = /bin/sh;
|
||||
buildWorkingDirectory = .;
|
||||
dependencies = (
|
||||
);
|
||||
name = cargo_ios;
|
||||
passBuildSettingsInEnvironment = 1;
|
||||
productName = cargo_ios;
|
||||
};
|
||||
/* End PBXLegacyTarget section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
3BDB8152E4962373181B4FE5 /* bevy_ios_example */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = E714A1AEAAE517C348B5BD27 /* Build configuration list for PBXNativeTarget "bevy_ios_example" */;
|
||||
buildPhases = (
|
||||
9F13800790AD9DBC2BC0F116 /* Sources */,
|
||||
D5A822CB2D6847BA8800BE4C /* Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
19D4B9C22ADC6705B5132B4C /* PBXTargetDependency */,
|
||||
);
|
||||
name = bevy_ios_example;
|
||||
productName = bevy_ios_example;
|
||||
productReference = 55EAC02897847195D2F44C15 /* bevy_ios_example.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
8DBF1E2B5C613DA41701F6D9 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 1020;
|
||||
};
|
||||
buildConfigurationList = 9D43D41707A5C30B227B83F9 /* Build configuration list for PBXProject "bevy_ios_example" */;
|
||||
compatibilityVersion = "Xcode 10.0";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
);
|
||||
mainGroup = 8F2E3E6040EAD2EC9F3FA530;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
3BDB8152E4962373181B4FE5 /* bevy_ios_example */,
|
||||
D08AEBE0B1A9C9A7B8C7B33F /* cargo_ios */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
9F13800790AD9DBC2BC0F116 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
55892F1396056740E1AF9685 /* main.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
FE045B3D04D57B713A565FF8 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
19D4B9C22ADC6705B5132B4C /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = D08AEBE0B1A9C9A7B8C7B33F /* cargo_ios */;
|
||||
targetProxy = 26BF2C4863C966DABAB40DC8 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
4AD7BC6FDD56FF18FA6DA7D7 /* 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_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_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 = (
|
||||
"$(inherited)",
|
||||
"DEBUG=1",
|
||||
);
|
||||
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;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
5B14EC4ADC81FBF1F8CF20E9 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "c++11";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
DEVELOPMENT_TEAM = "";
|
||||
ENABLE_BITCODE = NO;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"ios-src/",
|
||||
);
|
||||
INFOPLIST_FILE = "ios-src/Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
../../target/universal/release,
|
||||
);
|
||||
OTHER_LDFLAGS = (
|
||||
"$(inherited)",
|
||||
"-lbevy_ios_example",
|
||||
"-lc++abi",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.rust.bevy-ios-example";
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
79E3C28F06346EA58420A93D /* 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_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_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;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_VERSION = 5.0;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
8265913A25816D964A847F1B /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
IOS_TARGETS = "";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.rust.cargo-ios";
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
A2D5B73DD30D562B6F366526 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "c++11";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
DEVELOPMENT_TEAM = "";
|
||||
ENABLE_BITCODE = NO;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"ios-src/",
|
||||
);
|
||||
INFOPLIST_FILE = "ios-src/Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
../../target/universal/debug,
|
||||
);
|
||||
OTHER_LDFLAGS = (
|
||||
"$(inherited)",
|
||||
"-lbevy_ios_example",
|
||||
"-lc++abi",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.rust.bevy-ios-example";
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
FEA9B18D9236F9F6DC6DF799 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
IOS_TARGETS = "";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.rust.cargo-ios";
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
9D43D41707A5C30B227B83F9 /* Build configuration list for PBXProject "bevy_ios_example" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
4AD7BC6FDD56FF18FA6DA7D7 /* Debug */,
|
||||
79E3C28F06346EA58420A93D /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Debug;
|
||||
};
|
||||
AA00A0CFDB11F37F2BA3FC2E /* Build configuration list for PBXLegacyTarget "cargo_ios" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
8265913A25816D964A847F1B /* Debug */,
|
||||
FEA9B18D9236F9F6DC6DF799 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Debug;
|
||||
};
|
||||
E714A1AEAAE517C348B5BD27 /* Build configuration list for PBXNativeTarget "bevy_ios_example" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
A2D5B73DD30D562B6F366526 /* Debug */,
|
||||
5B14EC4ADC81FBF1F8CF20E9 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Debug;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 8DBF1E2B5C613DA41701F6D9 /* Project object */;
|
||||
}
|
12
examples/ios/build_rust_deps.sh
Executable file
12
examples/ios/build_rust_deps.sh
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
PATH=$PATH:$HOME/.cargo/bin
|
||||
|
||||
# If you want your build to run faster, add a "--targets x86_64-apple-ios" for just using the ios simulator.
|
||||
if [ -n ${IOS_TARGETS} ]; then
|
||||
cargo lipo --targets ${IOS_TARGETS}
|
||||
else
|
||||
cargo lipo
|
||||
fi
|
33
examples/ios/ios-src/Info.plist
Normal file
33
examples/ios/ios-src/Info.plist
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?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>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIRequiresFullScreen</key>
|
||||
<false/>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
1
examples/ios/ios-src/bindings.h
Normal file
1
examples/ios/ios-src/bindings.h
Normal file
|
@ -0,0 +1 @@
|
|||
void main_rs(void);
|
6
examples/ios/ios-src/main.m
Normal file
6
examples/ios/ios-src/main.m
Normal file
|
@ -0,0 +1,6 @@
|
|||
#import "bindings.h"
|
||||
|
||||
int main() {
|
||||
main_rs();
|
||||
return 0;
|
||||
}
|
66
examples/ios/src/lib.rs
Normal file
66
examples/ios/src/lib.rs
Normal file
|
@ -0,0 +1,66 @@
|
|||
use bevy::{
|
||||
prelude::{
|
||||
shape, AddDefaultPlugins, App, Assets, Camera3dComponents, Color, Commands,
|
||||
IntoQuerySystem, LightComponents, Mesh, Msaa, PbrComponents, ResMut, StandardMaterial,
|
||||
Transform, Vec3, WindowDescriptor,
|
||||
},
|
||||
window::WindowMode,
|
||||
};
|
||||
|
||||
#[no_mangle]
|
||||
extern "C" fn main_rs() {
|
||||
App::build()
|
||||
.add_resource(WindowDescriptor {
|
||||
vsync: true,
|
||||
resizable: false,
|
||||
mode: WindowMode::BorderlessFullscreen,
|
||||
..Default::default()
|
||||
})
|
||||
.add_resource(Msaa { samples: 4 })
|
||||
.add_default_plugins()
|
||||
.add_startup_system(setup.system())
|
||||
.run();
|
||||
}
|
||||
/// set up a simple 3D scene
|
||||
fn setup(
|
||||
mut commands: Commands,
|
||||
mut meshes: ResMut<Assets<Mesh>>,
|
||||
mut materials: ResMut<Assets<StandardMaterial>>,
|
||||
) {
|
||||
// add entities to the world
|
||||
commands
|
||||
// plane
|
||||
.spawn(PbrComponents {
|
||||
mesh: meshes.add(Mesh::from(shape::Plane { size: 10.0 })),
|
||||
material: materials.add(Color::rgb(0.1, 0.2, 0.1).into()),
|
||||
..Default::default()
|
||||
})
|
||||
// cube
|
||||
.spawn(PbrComponents {
|
||||
mesh: meshes.add(Mesh::from(shape::Cube { size: 1.0 })),
|
||||
material: materials.add(Color::rgb(0.5, 0.4, 0.3).into()),
|
||||
transform: Transform::from_translation(Vec3::new(0.0, 1.0, 0.0)),
|
||||
..Default::default()
|
||||
})
|
||||
// sphere
|
||||
.spawn(PbrComponents {
|
||||
mesh: meshes.add(Mesh::from(shape::Icosphere {
|
||||
subdivisions: 4,
|
||||
radius: 0.5,
|
||||
})),
|
||||
material: materials.add(Color::rgb(0.1, 0.4, 0.8).into()),
|
||||
transform: Transform::from_translation(Vec3::new(1.5, 1.5, 1.5)),
|
||||
..Default::default()
|
||||
})
|
||||
// light
|
||||
.spawn(LightComponents {
|
||||
transform: Transform::from_translation(Vec3::new(4.0, 8.0, 4.0)),
|
||||
..Default::default()
|
||||
})
|
||||
// camera
|
||||
.spawn(Camera3dComponents {
|
||||
transform: Transform::from_translation(Vec3::new(-3.0, 5.0, 8.0))
|
||||
.looking_at(Vec3::default(), Vec3::unit_y()),
|
||||
..Default::default()
|
||||
});
|
||||
}
|
Loading…
Reference in a new issue