├── .gitignore ├── LICENSE ├── README.md ├── hello.rs ├── iOSHostApp ├── RustBasedFramework │ ├── RustBasedFramework.xcodeproj │ │ └── project.pbxproj │ ├── RustBasedFramework │ │ ├── Info.plist │ │ ├── LinkerDontOptimizeOut.swift │ │ ├── MyExportTEsts.h │ │ └── RustBasedFramework.h │ ├── RustBasedFrameworkTests │ │ ├── Info.plist │ │ └── RustBasedFrameworkTests.swift │ ├── exported_symbols.txt │ └── unexported_symbols.txt ├── iOSHostApp.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── iOSHostApp │ ├── AppDelegate.swift │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ ├── ViewController.swift │ ├── cbench.c │ ├── cbench.h │ └── iOSHostApp-Bridging-Header.h └── iOSHostAppTests │ ├── Info.plist │ └── iOSHostAppTests.swift ├── libhello-a64.a ├── libhello-a7.a ├── libhello-a7s.a ├── libhello-x32.a ├── libhello-x64.a ├── libhello.a └── make.sh /.gitignore: -------------------------------------------------------------------------------- 1 | *xcuserdata* 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Drew Crawford 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Rust-based iOS framework 2 | 3 | This is a proof-of-concept for writing an iOS framework in Rust. 4 | 5 | This might be interesting if you want to use a Rust library in your iOS application, or as part of your iOS Framework. For example to have cross-platform Linux/iOS code, but you don't want to use C/C++. 6 | 7 | In general, 8 | 9 | 1. Define your externally-visible rust functions with 10 | 1. pub 11 | 2. extern 12 | 3. #[no_mangle] 13 | 2. build with make.sh. Todo: convert this to a real build system 14 | 3. link the built libhello.a into a framework 15 | 4. You need one header file with "Public" visibility (`MyExportTEsts.h` in this project, cause I have shift key issues) 16 | 5. Into this header you write prototypes for your Rust functions. Todo: write a tool that generates this 17 | 6. You need the special "export symbols" file. See below. 18 | 7. Import the header file from the master framework header file 19 | 8. Framework can then be linked into project 20 | 21 | In this project, iOSHostApp runs "Hello world" function inside the rust library. There's also a benchmark() function. 22 | 23 | # The case of the missing symbols. 24 | 25 | What seems to happen is Xcode strips some symbols from a framework when it's built. So if you have libhello.a inside a framework, and the framework doesn't call anything inside libhello.a, all of libhello.a is striped. If you only call one function, the others are stripped etc. 26 | 27 | So what you have to do is declare an exported_symbols.txt like 28 | 29 | ``` 30 | _hello 31 | _benchmark 32 | ``` 33 | 34 | And then set that file as the framework's `Exported Symbols File` in the framework's build settings. 35 | 36 | I tried doing it the other way, having a blank file and setting that as "Unexported symbols", which in theory should export everything. But it doesn't work. 37 | 38 | # FAQ 39 | 40 | ## Why do this? 41 | 42 | Rust seems interesting. Swift isn't cross-platform to Linux, so if you have problems that require writing the same code on two platforms it's hard. C/C++ would work, but who wants to use that? 43 | 44 | ## How big is it? 45 | 46 | The actual fully-loaded contribution of a "hello world" rust function seems to be 500-600kb. The addition of some random benchmark I found on the web did not appreciably change this size. 47 | 48 | The fat library is 22MB, but A) simulator slices get stripped during archive and B) Xcode seems to be quite agressive about eliminating unused symbols from the build. It's hard to say what the damage is for a library that uses more Rust features--it could be as high as 13MB I guess, but I don't have much evidence of that. 49 | 50 | ## How fast is it? 51 | 52 | That's a good question. To answer it, I grabbed a random benchmark from the benchmarks game that built for both Rust and Clang. 53 | 54 | With clang -Os, I got these timings: 55 | 56 | ``` 57 | 2.23557704687119, 2.23559999465942, 2.26020604372025, 2.24301099777222, 2.23816096782684, 2.22583699226379, 2.23869597911835, 2.23592603206635, 2.22462803125381 58 | ``` 59 | 60 | For a 95% confidence interval between 2.231s and 2.244s. 61 | 62 | On the Rust side, I got these timings: 63 | 64 | ``` 65 | 7.64557099342346, 6.85503703355789, 7.723208963871, 6.32498902082443, 10.3305470347404, 5.84855103492737, 8.71086305379868, 6.51861500740051, 5.52227300405502 66 | ``` 67 | 68 | For a 95% confidence interval between 6.282 and 8.269. Overall this is vaguely around 2.8-3.6x performance hit vs C in this benchmark. 69 | 70 | I got similar results on the x64 simulator, suggesting that the x64 and arm64 stories are similar. This runs against what I expected, as I thought that Rust's a64 would not be a focus area, but perhaps LLVM is doing the heavy lifting here. 71 | 72 | This "about 3X" performance hit compares similarly to e.g. Mono and V8, but at considerably less memory overhead, [something like 1/6th for this particular benchmark.](http://benchmarksgame.alioth.debian.org/u32/performance.php?test=fasta) 73 | 74 | So the result is, if you need a reasonably-fast cross-platform language, Rust isn't a bad choice, especially if you have memory problems. -------------------------------------------------------------------------------- /hello.rs: -------------------------------------------------------------------------------- 1 | #[no_mangle] 2 | pub extern fn hello() { 3 | // The statements here will be executed when the compiled binary is called 4 | 5 | // Print text to the console 6 | println!("Hello World!"); 7 | } 8 | 9 | // The Computer Language Benchmarks Game 10 | // http://benchmarksgame.alioth.debian.org/ 11 | // 12 | // contributed by the Rust Project Developers 13 | // contributed by TeXitoi 14 | 15 | use std::cmp::min; 16 | use std::io::{BufferedWriter, File}; 17 | use std::io; 18 | use std::num::Float; 19 | use std::os; 20 | 21 | const LINE_LENGTH: usize = 60; 22 | const IM: u32 = 139968; 23 | 24 | struct MyRandom { 25 | last: u32 26 | } 27 | impl MyRandom { 28 | fn new() -> MyRandom { MyRandom { last: 42 } } 29 | fn normalize(p: f32) -> u32 {(p * IM as f32).floor() as u32} 30 | fn gen(&mut self) -> u32 { 31 | self.last = (self.last * 3877 + 29573) % IM; 32 | self.last 33 | } 34 | } 35 | 36 | struct AAGen<'a> { 37 | rng: &'a mut MyRandom, 38 | data: Vec<(u32, u8)> 39 | } 40 | impl<'a> AAGen<'a> { 41 | fn new<'b>(rng: &'b mut MyRandom, aa: &[(char, f32)]) -> AAGen<'b> { 42 | let mut cum = 0.; 43 | let data = aa.iter() 44 | .map(|&(ch, p)| { cum += p; (MyRandom::normalize(cum), ch as u8) }) 45 | .collect(); 46 | AAGen { rng: rng, data: data } 47 | } 48 | } 49 | impl<'a> Iterator for AAGen<'a> { 50 | type Item = u8; 51 | 52 | fn next(&mut self) -> Option { 53 | let r = self.rng.gen(); 54 | self.data.iter() 55 | .skip_while(|pc| pc.0 < r) 56 | .map(|&(_, c)| c) 57 | .next() 58 | } 59 | } 60 | 61 | fn make_fasta>( 62 | wr: &mut W, header: &str, mut it: I, mut n: usize) 63 | -> std::io::IoResult<()> 64 | { 65 | //try!(wr.write(header.as_bytes())); 66 | let mut line = [0u8; LINE_LENGTH + 1]; 67 | while n > 0 { 68 | let nb = min(LINE_LENGTH, n); 69 | for i in (0..nb) { 70 | line[i] = it.next().unwrap(); 71 | } 72 | n -= nb; 73 | line[nb] = '\n' as u8; 74 | //try!(wr.write(&line[..(nb+1)])); 75 | } 76 | Ok(()) 77 | } 78 | 79 | fn run(writer: &mut W) -> std::io::IoResult<()> { 80 | let n = 25000000; 81 | 82 | let rng = &mut MyRandom::new(); 83 | let alu = 84 | "GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG\ 85 | GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA\ 86 | CCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAAT\ 87 | ACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCA\ 88 | GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG\ 89 | AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC\ 90 | AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA"; 91 | let iub = &[('a', 0.27), ('c', 0.12), ('g', 0.12), 92 | ('t', 0.27), ('B', 0.02), ('D', 0.02), 93 | ('H', 0.02), ('K', 0.02), ('M', 0.02), 94 | ('N', 0.02), ('R', 0.02), ('S', 0.02), 95 | ('V', 0.02), ('W', 0.02), ('Y', 0.02)]; 96 | let homosapiens = &[('a', 0.3029549426680), 97 | ('c', 0.1979883004921), 98 | ('g', 0.1975473066391), 99 | ('t', 0.3015094502008)]; 100 | 101 | try!(make_fasta(writer, ">ONE Homo sapiens alu\n", 102 | alu.as_bytes().iter().cycle().map(|c| *c), n * 2)); 103 | try!(make_fasta(writer, ">TWO IUB ambiguity codes\n", 104 | AAGen::new(rng, iub), n * 3)); 105 | try!(make_fasta(writer, ">THREE Homo sapiens frequency\n", 106 | AAGen::new(rng, homosapiens), n * 5)); 107 | 108 | writer.flush() 109 | } 110 | 111 | #[no_mangle] 112 | pub extern fn benchmark() { 113 | run(&mut io::stdout()).unwrap() 114 | } -------------------------------------------------------------------------------- /iOSHostApp/RustBasedFramework/RustBasedFramework.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 3AECE88A1A76A96D00BFFEDF /* RustBasedFramework.h in Headers */ = {isa = PBXBuildFile; fileRef = 3AECE8891A76A96D00BFFEDF /* RustBasedFramework.h */; settings = {ATTRIBUTES = (Public, ); }; }; 11 | 3AECE8901A76A96D00BFFEDF /* RustBasedFramework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3AECE8841A76A96D00BFFEDF /* RustBasedFramework.framework */; }; 12 | 3AECE8971A76A96D00BFFEDF /* RustBasedFrameworkTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AECE8961A76A96D00BFFEDF /* RustBasedFrameworkTests.swift */; }; 13 | 3AECE8AA1A76A97B00BFFEDF /* libhello.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3AECE8A91A76A97B00BFFEDF /* libhello.a */; }; 14 | 3AECE8B11A76AAE300BFFEDF /* LinkerDontOptimizeOut.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AECE8B01A76AAE300BFFEDF /* LinkerDontOptimizeOut.swift */; }; 15 | 3AECE8B31A76B17800BFFEDF /* MyExportTEsts.h in Headers */ = {isa = PBXBuildFile; fileRef = 3AECE8B21A76B15500BFFEDF /* MyExportTEsts.h */; settings = {ATTRIBUTES = (Public, ); }; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXContainerItemProxy section */ 19 | 3AECE8911A76A96D00BFFEDF /* PBXContainerItemProxy */ = { 20 | isa = PBXContainerItemProxy; 21 | containerPortal = 3AECE87B1A76A96D00BFFEDF /* Project object */; 22 | proxyType = 1; 23 | remoteGlobalIDString = 3AECE8831A76A96D00BFFEDF; 24 | remoteInfo = RustBasedFramework; 25 | }; 26 | /* End PBXContainerItemProxy section */ 27 | 28 | /* Begin PBXFileReference section */ 29 | 3AECE8841A76A96D00BFFEDF /* RustBasedFramework.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = RustBasedFramework.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 30 | 3AECE8881A76A96D00BFFEDF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 31 | 3AECE8891A76A96D00BFFEDF /* RustBasedFramework.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RustBasedFramework.h; sourceTree = ""; }; 32 | 3AECE88F1A76A96D00BFFEDF /* RustBasedFrameworkTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RustBasedFrameworkTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 33 | 3AECE8951A76A96D00BFFEDF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 34 | 3AECE8961A76A96D00BFFEDF /* RustBasedFrameworkTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RustBasedFrameworkTests.swift; sourceTree = ""; }; 35 | 3AECE8A91A76A97B00BFFEDF /* libhello.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libhello.a; path = ../../libhello.a; sourceTree = ""; }; 36 | 3AECE8B01A76AAE300BFFEDF /* LinkerDontOptimizeOut.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LinkerDontOptimizeOut.swift; sourceTree = ""; }; 37 | 3AECE8B21A76B15500BFFEDF /* MyExportTEsts.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MyExportTEsts.h; sourceTree = ""; }; 38 | /* End PBXFileReference section */ 39 | 40 | /* Begin PBXFrameworksBuildPhase section */ 41 | 3AECE8801A76A96D00BFFEDF /* Frameworks */ = { 42 | isa = PBXFrameworksBuildPhase; 43 | buildActionMask = 2147483647; 44 | files = ( 45 | 3AECE8AA1A76A97B00BFFEDF /* libhello.a in Frameworks */, 46 | ); 47 | runOnlyForDeploymentPostprocessing = 0; 48 | }; 49 | 3AECE88C1A76A96D00BFFEDF /* Frameworks */ = { 50 | isa = PBXFrameworksBuildPhase; 51 | buildActionMask = 2147483647; 52 | files = ( 53 | 3AECE8901A76A96D00BFFEDF /* RustBasedFramework.framework in Frameworks */, 54 | ); 55 | runOnlyForDeploymentPostprocessing = 0; 56 | }; 57 | /* End PBXFrameworksBuildPhase section */ 58 | 59 | /* Begin PBXGroup section */ 60 | 3AECE87A1A76A96D00BFFEDF = { 61 | isa = PBXGroup; 62 | children = ( 63 | 3AECE8A91A76A97B00BFFEDF /* libhello.a */, 64 | 3AECE8861A76A96D00BFFEDF /* RustBasedFramework */, 65 | 3AECE8931A76A96D00BFFEDF /* RustBasedFrameworkTests */, 66 | 3AECE8851A76A96D00BFFEDF /* Products */, 67 | ); 68 | sourceTree = ""; 69 | }; 70 | 3AECE8851A76A96D00BFFEDF /* Products */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | 3AECE8841A76A96D00BFFEDF /* RustBasedFramework.framework */, 74 | 3AECE88F1A76A96D00BFFEDF /* RustBasedFrameworkTests.xctest */, 75 | ); 76 | name = Products; 77 | sourceTree = ""; 78 | }; 79 | 3AECE8861A76A96D00BFFEDF /* RustBasedFramework */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | 3AECE8891A76A96D00BFFEDF /* RustBasedFramework.h */, 83 | 3AECE8871A76A96D00BFFEDF /* Supporting Files */, 84 | 3AECE8B01A76AAE300BFFEDF /* LinkerDontOptimizeOut.swift */, 85 | 3AECE8B21A76B15500BFFEDF /* MyExportTEsts.h */, 86 | ); 87 | path = RustBasedFramework; 88 | sourceTree = ""; 89 | }; 90 | 3AECE8871A76A96D00BFFEDF /* Supporting Files */ = { 91 | isa = PBXGroup; 92 | children = ( 93 | 3AECE8881A76A96D00BFFEDF /* Info.plist */, 94 | ); 95 | name = "Supporting Files"; 96 | sourceTree = ""; 97 | }; 98 | 3AECE8931A76A96D00BFFEDF /* RustBasedFrameworkTests */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | 3AECE8961A76A96D00BFFEDF /* RustBasedFrameworkTests.swift */, 102 | 3AECE8941A76A96D00BFFEDF /* Supporting Files */, 103 | ); 104 | path = RustBasedFrameworkTests; 105 | sourceTree = ""; 106 | }; 107 | 3AECE8941A76A96D00BFFEDF /* Supporting Files */ = { 108 | isa = PBXGroup; 109 | children = ( 110 | 3AECE8951A76A96D00BFFEDF /* Info.plist */, 111 | ); 112 | name = "Supporting Files"; 113 | sourceTree = ""; 114 | }; 115 | /* End PBXGroup section */ 116 | 117 | /* Begin PBXHeadersBuildPhase section */ 118 | 3AECE8811A76A96D00BFFEDF /* Headers */ = { 119 | isa = PBXHeadersBuildPhase; 120 | buildActionMask = 2147483647; 121 | files = ( 122 | 3AECE8B31A76B17800BFFEDF /* MyExportTEsts.h in Headers */, 123 | 3AECE88A1A76A96D00BFFEDF /* RustBasedFramework.h in Headers */, 124 | ); 125 | runOnlyForDeploymentPostprocessing = 0; 126 | }; 127 | /* End PBXHeadersBuildPhase section */ 128 | 129 | /* Begin PBXNativeTarget section */ 130 | 3AECE8831A76A96D00BFFEDF /* RustBasedFramework */ = { 131 | isa = PBXNativeTarget; 132 | buildConfigurationList = 3AECE89A1A76A96D00BFFEDF /* Build configuration list for PBXNativeTarget "RustBasedFramework" */; 133 | buildPhases = ( 134 | 3AECE87F1A76A96D00BFFEDF /* Sources */, 135 | 3AECE8801A76A96D00BFFEDF /* Frameworks */, 136 | 3AECE8811A76A96D00BFFEDF /* Headers */, 137 | 3AECE8821A76A96D00BFFEDF /* Resources */, 138 | ); 139 | buildRules = ( 140 | ); 141 | dependencies = ( 142 | ); 143 | name = RustBasedFramework; 144 | productName = RustBasedFramework; 145 | productReference = 3AECE8841A76A96D00BFFEDF /* RustBasedFramework.framework */; 146 | productType = "com.apple.product-type.framework"; 147 | }; 148 | 3AECE88E1A76A96D00BFFEDF /* RustBasedFrameworkTests */ = { 149 | isa = PBXNativeTarget; 150 | buildConfigurationList = 3AECE89D1A76A96D00BFFEDF /* Build configuration list for PBXNativeTarget "RustBasedFrameworkTests" */; 151 | buildPhases = ( 152 | 3AECE88B1A76A96D00BFFEDF /* Sources */, 153 | 3AECE88C1A76A96D00BFFEDF /* Frameworks */, 154 | 3AECE88D1A76A96D00BFFEDF /* Resources */, 155 | ); 156 | buildRules = ( 157 | ); 158 | dependencies = ( 159 | 3AECE8921A76A96D00BFFEDF /* PBXTargetDependency */, 160 | ); 161 | name = RustBasedFrameworkTests; 162 | productName = RustBasedFrameworkTests; 163 | productReference = 3AECE88F1A76A96D00BFFEDF /* RustBasedFrameworkTests.xctest */; 164 | productType = "com.apple.product-type.bundle.unit-test"; 165 | }; 166 | /* End PBXNativeTarget section */ 167 | 168 | /* Begin PBXProject section */ 169 | 3AECE87B1A76A96D00BFFEDF /* Project object */ = { 170 | isa = PBXProject; 171 | attributes = { 172 | LastUpgradeCheck = 0610; 173 | ORGANIZATIONNAME = DrewCrawfordApps; 174 | TargetAttributes = { 175 | 3AECE8831A76A96D00BFFEDF = { 176 | CreatedOnToolsVersion = 6.1.1; 177 | }; 178 | 3AECE88E1A76A96D00BFFEDF = { 179 | CreatedOnToolsVersion = 6.1.1; 180 | }; 181 | }; 182 | }; 183 | buildConfigurationList = 3AECE87E1A76A96D00BFFEDF /* Build configuration list for PBXProject "RustBasedFramework" */; 184 | compatibilityVersion = "Xcode 3.2"; 185 | developmentRegion = English; 186 | hasScannedForEncodings = 0; 187 | knownRegions = ( 188 | en, 189 | ); 190 | mainGroup = 3AECE87A1A76A96D00BFFEDF; 191 | productRefGroup = 3AECE8851A76A96D00BFFEDF /* Products */; 192 | projectDirPath = ""; 193 | projectRoot = ""; 194 | targets = ( 195 | 3AECE8831A76A96D00BFFEDF /* RustBasedFramework */, 196 | 3AECE88E1A76A96D00BFFEDF /* RustBasedFrameworkTests */, 197 | ); 198 | }; 199 | /* End PBXProject section */ 200 | 201 | /* Begin PBXResourcesBuildPhase section */ 202 | 3AECE8821A76A96D00BFFEDF /* Resources */ = { 203 | isa = PBXResourcesBuildPhase; 204 | buildActionMask = 2147483647; 205 | files = ( 206 | ); 207 | runOnlyForDeploymentPostprocessing = 0; 208 | }; 209 | 3AECE88D1A76A96D00BFFEDF /* Resources */ = { 210 | isa = PBXResourcesBuildPhase; 211 | buildActionMask = 2147483647; 212 | files = ( 213 | ); 214 | runOnlyForDeploymentPostprocessing = 0; 215 | }; 216 | /* End PBXResourcesBuildPhase section */ 217 | 218 | /* Begin PBXSourcesBuildPhase section */ 219 | 3AECE87F1A76A96D00BFFEDF /* Sources */ = { 220 | isa = PBXSourcesBuildPhase; 221 | buildActionMask = 2147483647; 222 | files = ( 223 | 3AECE8B11A76AAE300BFFEDF /* LinkerDontOptimizeOut.swift in Sources */, 224 | ); 225 | runOnlyForDeploymentPostprocessing = 0; 226 | }; 227 | 3AECE88B1A76A96D00BFFEDF /* Sources */ = { 228 | isa = PBXSourcesBuildPhase; 229 | buildActionMask = 2147483647; 230 | files = ( 231 | 3AECE8971A76A96D00BFFEDF /* RustBasedFrameworkTests.swift in Sources */, 232 | ); 233 | runOnlyForDeploymentPostprocessing = 0; 234 | }; 235 | /* End PBXSourcesBuildPhase section */ 236 | 237 | /* Begin PBXTargetDependency section */ 238 | 3AECE8921A76A96D00BFFEDF /* PBXTargetDependency */ = { 239 | isa = PBXTargetDependency; 240 | target = 3AECE8831A76A96D00BFFEDF /* RustBasedFramework */; 241 | targetProxy = 3AECE8911A76A96D00BFFEDF /* PBXContainerItemProxy */; 242 | }; 243 | /* End PBXTargetDependency section */ 244 | 245 | /* Begin XCBuildConfiguration section */ 246 | 3AECE8981A76A96D00BFFEDF /* Debug */ = { 247 | isa = XCBuildConfiguration; 248 | buildSettings = { 249 | ALWAYS_SEARCH_USER_PATHS = NO; 250 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 251 | CLANG_CXX_LIBRARY = "libc++"; 252 | CLANG_ENABLE_MODULES = YES; 253 | CLANG_ENABLE_OBJC_ARC = YES; 254 | CLANG_WARN_BOOL_CONVERSION = YES; 255 | CLANG_WARN_CONSTANT_CONVERSION = YES; 256 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 257 | CLANG_WARN_EMPTY_BODY = YES; 258 | CLANG_WARN_ENUM_CONVERSION = YES; 259 | CLANG_WARN_INT_CONVERSION = YES; 260 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 261 | CLANG_WARN_UNREACHABLE_CODE = YES; 262 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 263 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 264 | COPY_PHASE_STRIP = NO; 265 | CURRENT_PROJECT_VERSION = 1; 266 | ENABLE_STRICT_OBJC_MSGSEND = YES; 267 | EXPORTED_SYMBOLS_FILE = "$(PROJECT_DIR)/exported_symbols.txt"; 268 | GCC_C_LANGUAGE_STANDARD = gnu99; 269 | GCC_DYNAMIC_NO_PIC = NO; 270 | GCC_OPTIMIZATION_LEVEL = 0; 271 | GCC_PREPROCESSOR_DEFINITIONS = ( 272 | "DEBUG=1", 273 | "$(inherited)", 274 | ); 275 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 276 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 277 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 278 | GCC_WARN_UNDECLARED_SELECTOR = YES; 279 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 280 | GCC_WARN_UNUSED_FUNCTION = YES; 281 | GCC_WARN_UNUSED_VARIABLE = YES; 282 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 283 | MTL_ENABLE_DEBUG_INFO = YES; 284 | ONLY_ACTIVE_ARCH = YES; 285 | SDKROOT = iphoneos; 286 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 287 | TARGETED_DEVICE_FAMILY = "1,2"; 288 | VERSIONING_SYSTEM = "apple-generic"; 289 | VERSION_INFO_PREFIX = ""; 290 | }; 291 | name = Debug; 292 | }; 293 | 3AECE8991A76A96D00BFFEDF /* Release */ = { 294 | isa = XCBuildConfiguration; 295 | buildSettings = { 296 | ALWAYS_SEARCH_USER_PATHS = NO; 297 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 298 | CLANG_CXX_LIBRARY = "libc++"; 299 | CLANG_ENABLE_MODULES = YES; 300 | CLANG_ENABLE_OBJC_ARC = YES; 301 | CLANG_WARN_BOOL_CONVERSION = YES; 302 | CLANG_WARN_CONSTANT_CONVERSION = YES; 303 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 304 | CLANG_WARN_EMPTY_BODY = YES; 305 | CLANG_WARN_ENUM_CONVERSION = YES; 306 | CLANG_WARN_INT_CONVERSION = YES; 307 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 308 | CLANG_WARN_UNREACHABLE_CODE = YES; 309 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 310 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 311 | COPY_PHASE_STRIP = YES; 312 | CURRENT_PROJECT_VERSION = 1; 313 | ENABLE_NS_ASSERTIONS = NO; 314 | ENABLE_STRICT_OBJC_MSGSEND = YES; 315 | EXPORTED_SYMBOLS_FILE = "$(PROJECT_DIR)/exported_symbols.txt"; 316 | GCC_C_LANGUAGE_STANDARD = gnu99; 317 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 318 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 319 | GCC_WARN_UNDECLARED_SELECTOR = YES; 320 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 321 | GCC_WARN_UNUSED_FUNCTION = YES; 322 | GCC_WARN_UNUSED_VARIABLE = YES; 323 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 324 | MTL_ENABLE_DEBUG_INFO = NO; 325 | SDKROOT = iphoneos; 326 | TARGETED_DEVICE_FAMILY = "1,2"; 327 | VALIDATE_PRODUCT = YES; 328 | VERSIONING_SYSTEM = "apple-generic"; 329 | VERSION_INFO_PREFIX = ""; 330 | }; 331 | name = Release; 332 | }; 333 | 3AECE89B1A76A96D00BFFEDF /* Debug */ = { 334 | isa = XCBuildConfiguration; 335 | buildSettings = { 336 | CLANG_ENABLE_MODULES = YES; 337 | DEFINES_MODULE = YES; 338 | DYLIB_COMPATIBILITY_VERSION = 1; 339 | DYLIB_CURRENT_VERSION = 1; 340 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 341 | INFOPLIST_FILE = RustBasedFramework/Info.plist; 342 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 343 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 344 | LIBRARY_SEARCH_PATHS = ( 345 | "$(inherited)", 346 | "$(PROJECT_DIR)/../../", 347 | ); 348 | PRODUCT_NAME = "$(TARGET_NAME)"; 349 | SKIP_INSTALL = YES; 350 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 351 | }; 352 | name = Debug; 353 | }; 354 | 3AECE89C1A76A96D00BFFEDF /* Release */ = { 355 | isa = XCBuildConfiguration; 356 | buildSettings = { 357 | CLANG_ENABLE_MODULES = YES; 358 | DEFINES_MODULE = YES; 359 | DYLIB_COMPATIBILITY_VERSION = 1; 360 | DYLIB_CURRENT_VERSION = 1; 361 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 362 | INFOPLIST_FILE = RustBasedFramework/Info.plist; 363 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 364 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 365 | LIBRARY_SEARCH_PATHS = ( 366 | "$(inherited)", 367 | "$(PROJECT_DIR)/../../", 368 | ); 369 | PRODUCT_NAME = "$(TARGET_NAME)"; 370 | SKIP_INSTALL = YES; 371 | }; 372 | name = Release; 373 | }; 374 | 3AECE89E1A76A96D00BFFEDF /* Debug */ = { 375 | isa = XCBuildConfiguration; 376 | buildSettings = { 377 | FRAMEWORK_SEARCH_PATHS = ( 378 | "$(SDKROOT)/Developer/Library/Frameworks", 379 | "$(inherited)", 380 | ); 381 | GCC_PREPROCESSOR_DEFINITIONS = ( 382 | "DEBUG=1", 383 | "$(inherited)", 384 | ); 385 | INFOPLIST_FILE = RustBasedFrameworkTests/Info.plist; 386 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 387 | PRODUCT_NAME = "$(TARGET_NAME)"; 388 | }; 389 | name = Debug; 390 | }; 391 | 3AECE89F1A76A96D00BFFEDF /* Release */ = { 392 | isa = XCBuildConfiguration; 393 | buildSettings = { 394 | FRAMEWORK_SEARCH_PATHS = ( 395 | "$(SDKROOT)/Developer/Library/Frameworks", 396 | "$(inherited)", 397 | ); 398 | INFOPLIST_FILE = RustBasedFrameworkTests/Info.plist; 399 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 400 | PRODUCT_NAME = "$(TARGET_NAME)"; 401 | }; 402 | name = Release; 403 | }; 404 | /* End XCBuildConfiguration section */ 405 | 406 | /* Begin XCConfigurationList section */ 407 | 3AECE87E1A76A96D00BFFEDF /* Build configuration list for PBXProject "RustBasedFramework" */ = { 408 | isa = XCConfigurationList; 409 | buildConfigurations = ( 410 | 3AECE8981A76A96D00BFFEDF /* Debug */, 411 | 3AECE8991A76A96D00BFFEDF /* Release */, 412 | ); 413 | defaultConfigurationIsVisible = 0; 414 | defaultConfigurationName = Release; 415 | }; 416 | 3AECE89A1A76A96D00BFFEDF /* Build configuration list for PBXNativeTarget "RustBasedFramework" */ = { 417 | isa = XCConfigurationList; 418 | buildConfigurations = ( 419 | 3AECE89B1A76A96D00BFFEDF /* Debug */, 420 | 3AECE89C1A76A96D00BFFEDF /* Release */, 421 | ); 422 | defaultConfigurationIsVisible = 0; 423 | defaultConfigurationName = Release; 424 | }; 425 | 3AECE89D1A76A96D00BFFEDF /* Build configuration list for PBXNativeTarget "RustBasedFrameworkTests" */ = { 426 | isa = XCConfigurationList; 427 | buildConfigurations = ( 428 | 3AECE89E1A76A96D00BFFEDF /* Debug */, 429 | 3AECE89F1A76A96D00BFFEDF /* Release */, 430 | ); 431 | defaultConfigurationIsVisible = 0; 432 | defaultConfigurationName = Release; 433 | }; 434 | /* End XCConfigurationList section */ 435 | }; 436 | rootObject = 3AECE87B1A76A96D00BFFEDF /* Project object */; 437 | } 438 | -------------------------------------------------------------------------------- /iOSHostApp/RustBasedFramework/RustBasedFramework/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.dca.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /iOSHostApp/RustBasedFramework/RustBasedFramework/LinkerDontOptimizeOut.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LinkerDontOptimizeOut.swift 3 | // RustBasedFramework 4 | // 5 | // Created by Drew Crawford on 1/26/15. 6 | // Copyright (c) 2015 DrewCrawfordApps. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | -------------------------------------------------------------------------------- /iOSHostApp/RustBasedFramework/RustBasedFramework/MyExportTEsts.h: -------------------------------------------------------------------------------- 1 | // 2 | // MyExportTEsts.h 3 | // RustBasedFramework 4 | // 5 | // Created by Drew Crawford on 1/26/15. 6 | // Copyright (c) 2015 DrewCrawfordApps. All rights reserved. 7 | // 8 | 9 | #ifndef RustBasedFramework_MyExportTEsts_h 10 | #define RustBasedFramework_MyExportTEsts_h 11 | 12 | void hello(); 13 | void benchmark(); 14 | #endif 15 | -------------------------------------------------------------------------------- /iOSHostApp/RustBasedFramework/RustBasedFramework/RustBasedFramework.h: -------------------------------------------------------------------------------- 1 | // 2 | // RustBasedFramework.h 3 | // RustBasedFramework 4 | // 5 | // Created by Drew Crawford on 1/26/15. 6 | // Copyright (c) 2015 DrewCrawfordApps. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for RustBasedFramework. 12 | FOUNDATION_EXPORT double RustBasedFrameworkVersionNumber; 13 | 14 | //! Project version string for RustBasedFramework. 15 | FOUNDATION_EXPORT const unsigned char RustBasedFrameworkVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | #import -------------------------------------------------------------------------------- /iOSHostApp/RustBasedFramework/RustBasedFrameworkTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.dca.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /iOSHostApp/RustBasedFramework/RustBasedFrameworkTests/RustBasedFrameworkTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RustBasedFrameworkTests.swift 3 | // RustBasedFrameworkTests 4 | // 5 | // Created by Drew Crawford on 1/26/15. 6 | // Copyright (c) 2015 DrewCrawfordApps. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import XCTest 11 | 12 | class RustBasedFrameworkTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | XCTAssert(true, "Pass") 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measureBlock() { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /iOSHostApp/RustBasedFramework/exported_symbols.txt: -------------------------------------------------------------------------------- 1 | _hello 2 | _benchmark 3 | -------------------------------------------------------------------------------- /iOSHostApp/RustBasedFramework/unexported_symbols.txt: -------------------------------------------------------------------------------- 1 | _InitCocoaFW 2 | -------------------------------------------------------------------------------- /iOSHostApp/iOSHostApp.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 3A55D20E1A76B760009F32C0 /* cbench.c in Sources */ = {isa = PBXBuildFile; fileRef = 3A55D20C1A76B760009F32C0 /* cbench.c */; }; 11 | 3ABAAD261A76A2B4006938AB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ABAAD251A76A2B4006938AB /* AppDelegate.swift */; }; 12 | 3ABAAD281A76A2B4006938AB /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ABAAD271A76A2B4006938AB /* ViewController.swift */; }; 13 | 3ABAAD2B1A76A2B4006938AB /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3ABAAD291A76A2B4006938AB /* Main.storyboard */; }; 14 | 3ABAAD2D1A76A2B4006938AB /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3ABAAD2C1A76A2B4006938AB /* Images.xcassets */; }; 15 | 3ABAAD301A76A2B4006938AB /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3ABAAD2E1A76A2B4006938AB /* LaunchScreen.xib */; }; 16 | 3ABAAD3C1A76A2B4006938AB /* iOSHostAppTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ABAAD3B1A76A2B4006938AB /* iOSHostAppTests.swift */; }; 17 | 3AECE8AB1A76A98C00BFFEDF /* RustBasedFramework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3AECE8A61A76A96E00BFFEDF /* RustBasedFramework.framework */; }; 18 | 3AECE8AC1A76A98C00BFFEDF /* RustBasedFramework.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3AECE8A61A76A96E00BFFEDF /* RustBasedFramework.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXContainerItemProxy section */ 22 | 3ABAAD361A76A2B4006938AB /* PBXContainerItemProxy */ = { 23 | isa = PBXContainerItemProxy; 24 | containerPortal = 3ABAAD181A76A2B4006938AB /* Project object */; 25 | proxyType = 1; 26 | remoteGlobalIDString = 3ABAAD1F1A76A2B4006938AB; 27 | remoteInfo = iOSHostApp; 28 | }; 29 | 3AECE8A51A76A96E00BFFEDF /* PBXContainerItemProxy */ = { 30 | isa = PBXContainerItemProxy; 31 | containerPortal = 3AECE8A01A76A96D00BFFEDF /* RustBasedFramework.xcodeproj */; 32 | proxyType = 2; 33 | remoteGlobalIDString = 3AECE8841A76A96D00BFFEDF; 34 | remoteInfo = RustBasedFramework; 35 | }; 36 | 3AECE8A71A76A96E00BFFEDF /* PBXContainerItemProxy */ = { 37 | isa = PBXContainerItemProxy; 38 | containerPortal = 3AECE8A01A76A96D00BFFEDF /* RustBasedFramework.xcodeproj */; 39 | proxyType = 2; 40 | remoteGlobalIDString = 3AECE88F1A76A96D00BFFEDF; 41 | remoteInfo = RustBasedFrameworkTests; 42 | }; 43 | 3AECE8AD1A76A98C00BFFEDF /* PBXContainerItemProxy */ = { 44 | isa = PBXContainerItemProxy; 45 | containerPortal = 3AECE8A01A76A96D00BFFEDF /* RustBasedFramework.xcodeproj */; 46 | proxyType = 1; 47 | remoteGlobalIDString = 3AECE8831A76A96D00BFFEDF; 48 | remoteInfo = RustBasedFramework; 49 | }; 50 | /* End PBXContainerItemProxy section */ 51 | 52 | /* Begin PBXCopyFilesBuildPhase section */ 53 | 3AECE8AF1A76A98C00BFFEDF /* Embed Frameworks */ = { 54 | isa = PBXCopyFilesBuildPhase; 55 | buildActionMask = 2147483647; 56 | dstPath = ""; 57 | dstSubfolderSpec = 10; 58 | files = ( 59 | 3AECE8AC1A76A98C00BFFEDF /* RustBasedFramework.framework in Embed Frameworks */, 60 | ); 61 | name = "Embed Frameworks"; 62 | runOnlyForDeploymentPostprocessing = 0; 63 | }; 64 | /* End PBXCopyFilesBuildPhase section */ 65 | 66 | /* Begin PBXFileReference section */ 67 | 3A55D2071A76B6B4009F32C0 /* iOSHostApp-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "iOSHostApp-Bridging-Header.h"; sourceTree = ""; }; 68 | 3A55D20C1A76B760009F32C0 /* cbench.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cbench.c; sourceTree = ""; }; 69 | 3A55D20D1A76B760009F32C0 /* cbench.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cbench.h; sourceTree = ""; }; 70 | 3ABAAD201A76A2B4006938AB /* iOSHostApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iOSHostApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; 71 | 3ABAAD241A76A2B4006938AB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 72 | 3ABAAD251A76A2B4006938AB /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 73 | 3ABAAD271A76A2B4006938AB /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 74 | 3ABAAD2A1A76A2B4006938AB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 75 | 3ABAAD2C1A76A2B4006938AB /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 76 | 3ABAAD2F1A76A2B4006938AB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 77 | 3ABAAD351A76A2B4006938AB /* iOSHostAppTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = iOSHostAppTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 78 | 3ABAAD3A1A76A2B4006938AB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 79 | 3ABAAD3B1A76A2B4006938AB /* iOSHostAppTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSHostAppTests.swift; sourceTree = ""; }; 80 | 3AECE8A01A76A96D00BFFEDF /* RustBasedFramework.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RustBasedFramework.xcodeproj; path = RustBasedFramework/RustBasedFramework.xcodeproj; sourceTree = ""; }; 81 | /* End PBXFileReference section */ 82 | 83 | /* Begin PBXFrameworksBuildPhase section */ 84 | 3ABAAD1D1A76A2B4006938AB /* Frameworks */ = { 85 | isa = PBXFrameworksBuildPhase; 86 | buildActionMask = 2147483647; 87 | files = ( 88 | 3AECE8AB1A76A98C00BFFEDF /* RustBasedFramework.framework in Frameworks */, 89 | ); 90 | runOnlyForDeploymentPostprocessing = 0; 91 | }; 92 | 3ABAAD321A76A2B4006938AB /* Frameworks */ = { 93 | isa = PBXFrameworksBuildPhase; 94 | buildActionMask = 2147483647; 95 | files = ( 96 | ); 97 | runOnlyForDeploymentPostprocessing = 0; 98 | }; 99 | /* End PBXFrameworksBuildPhase section */ 100 | 101 | /* Begin PBXGroup section */ 102 | 3ABAAD171A76A2B4006938AB = { 103 | isa = PBXGroup; 104 | children = ( 105 | 3AECE8A01A76A96D00BFFEDF /* RustBasedFramework.xcodeproj */, 106 | 3ABAAD221A76A2B4006938AB /* iOSHostApp */, 107 | 3ABAAD381A76A2B4006938AB /* iOSHostAppTests */, 108 | 3ABAAD211A76A2B4006938AB /* Products */, 109 | ); 110 | sourceTree = ""; 111 | }; 112 | 3ABAAD211A76A2B4006938AB /* Products */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | 3ABAAD201A76A2B4006938AB /* iOSHostApp.app */, 116 | 3ABAAD351A76A2B4006938AB /* iOSHostAppTests.xctest */, 117 | ); 118 | name = Products; 119 | sourceTree = ""; 120 | }; 121 | 3ABAAD221A76A2B4006938AB /* iOSHostApp */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | 3ABAAD251A76A2B4006938AB /* AppDelegate.swift */, 125 | 3ABAAD271A76A2B4006938AB /* ViewController.swift */, 126 | 3ABAAD291A76A2B4006938AB /* Main.storyboard */, 127 | 3ABAAD2C1A76A2B4006938AB /* Images.xcassets */, 128 | 3ABAAD2E1A76A2B4006938AB /* LaunchScreen.xib */, 129 | 3ABAAD231A76A2B4006938AB /* Supporting Files */, 130 | 3A55D2071A76B6B4009F32C0 /* iOSHostApp-Bridging-Header.h */, 131 | 3A55D20C1A76B760009F32C0 /* cbench.c */, 132 | 3A55D20D1A76B760009F32C0 /* cbench.h */, 133 | ); 134 | path = iOSHostApp; 135 | sourceTree = ""; 136 | }; 137 | 3ABAAD231A76A2B4006938AB /* Supporting Files */ = { 138 | isa = PBXGroup; 139 | children = ( 140 | 3ABAAD241A76A2B4006938AB /* Info.plist */, 141 | ); 142 | name = "Supporting Files"; 143 | sourceTree = ""; 144 | }; 145 | 3ABAAD381A76A2B4006938AB /* iOSHostAppTests */ = { 146 | isa = PBXGroup; 147 | children = ( 148 | 3ABAAD3B1A76A2B4006938AB /* iOSHostAppTests.swift */, 149 | 3ABAAD391A76A2B4006938AB /* Supporting Files */, 150 | ); 151 | path = iOSHostAppTests; 152 | sourceTree = ""; 153 | }; 154 | 3ABAAD391A76A2B4006938AB /* Supporting Files */ = { 155 | isa = PBXGroup; 156 | children = ( 157 | 3ABAAD3A1A76A2B4006938AB /* Info.plist */, 158 | ); 159 | name = "Supporting Files"; 160 | sourceTree = ""; 161 | }; 162 | 3AECE8A11A76A96D00BFFEDF /* Products */ = { 163 | isa = PBXGroup; 164 | children = ( 165 | 3AECE8A61A76A96E00BFFEDF /* RustBasedFramework.framework */, 166 | 3AECE8A81A76A96E00BFFEDF /* RustBasedFrameworkTests.xctest */, 167 | ); 168 | name = Products; 169 | sourceTree = ""; 170 | }; 171 | /* End PBXGroup section */ 172 | 173 | /* Begin PBXNativeTarget section */ 174 | 3ABAAD1F1A76A2B4006938AB /* iOSHostApp */ = { 175 | isa = PBXNativeTarget; 176 | buildConfigurationList = 3ABAAD3F1A76A2B4006938AB /* Build configuration list for PBXNativeTarget "iOSHostApp" */; 177 | buildPhases = ( 178 | 3ABAAD1C1A76A2B4006938AB /* Sources */, 179 | 3ABAAD1D1A76A2B4006938AB /* Frameworks */, 180 | 3ABAAD1E1A76A2B4006938AB /* Resources */, 181 | 3AECE8AF1A76A98C00BFFEDF /* Embed Frameworks */, 182 | ); 183 | buildRules = ( 184 | ); 185 | dependencies = ( 186 | 3AECE8AE1A76A98C00BFFEDF /* PBXTargetDependency */, 187 | ); 188 | name = iOSHostApp; 189 | productName = iOSHostApp; 190 | productReference = 3ABAAD201A76A2B4006938AB /* iOSHostApp.app */; 191 | productType = "com.apple.product-type.application"; 192 | }; 193 | 3ABAAD341A76A2B4006938AB /* iOSHostAppTests */ = { 194 | isa = PBXNativeTarget; 195 | buildConfigurationList = 3ABAAD421A76A2B4006938AB /* Build configuration list for PBXNativeTarget "iOSHostAppTests" */; 196 | buildPhases = ( 197 | 3ABAAD311A76A2B4006938AB /* Sources */, 198 | 3ABAAD321A76A2B4006938AB /* Frameworks */, 199 | 3ABAAD331A76A2B4006938AB /* Resources */, 200 | ); 201 | buildRules = ( 202 | ); 203 | dependencies = ( 204 | 3ABAAD371A76A2B4006938AB /* PBXTargetDependency */, 205 | ); 206 | name = iOSHostAppTests; 207 | productName = iOSHostAppTests; 208 | productReference = 3ABAAD351A76A2B4006938AB /* iOSHostAppTests.xctest */; 209 | productType = "com.apple.product-type.bundle.unit-test"; 210 | }; 211 | /* End PBXNativeTarget section */ 212 | 213 | /* Begin PBXProject section */ 214 | 3ABAAD181A76A2B4006938AB /* Project object */ = { 215 | isa = PBXProject; 216 | attributes = { 217 | LastUpgradeCheck = 0610; 218 | ORGANIZATIONNAME = DrewCrawfordApps; 219 | TargetAttributes = { 220 | 3ABAAD1F1A76A2B4006938AB = { 221 | CreatedOnToolsVersion = 6.1.1; 222 | }; 223 | 3ABAAD341A76A2B4006938AB = { 224 | CreatedOnToolsVersion = 6.1.1; 225 | TestTargetID = 3ABAAD1F1A76A2B4006938AB; 226 | }; 227 | }; 228 | }; 229 | buildConfigurationList = 3ABAAD1B1A76A2B4006938AB /* Build configuration list for PBXProject "iOSHostApp" */; 230 | compatibilityVersion = "Xcode 3.2"; 231 | developmentRegion = English; 232 | hasScannedForEncodings = 0; 233 | knownRegions = ( 234 | en, 235 | Base, 236 | ); 237 | mainGroup = 3ABAAD171A76A2B4006938AB; 238 | productRefGroup = 3ABAAD211A76A2B4006938AB /* Products */; 239 | projectDirPath = ""; 240 | projectReferences = ( 241 | { 242 | ProductGroup = 3AECE8A11A76A96D00BFFEDF /* Products */; 243 | ProjectRef = 3AECE8A01A76A96D00BFFEDF /* RustBasedFramework.xcodeproj */; 244 | }, 245 | ); 246 | projectRoot = ""; 247 | targets = ( 248 | 3ABAAD1F1A76A2B4006938AB /* iOSHostApp */, 249 | 3ABAAD341A76A2B4006938AB /* iOSHostAppTests */, 250 | ); 251 | }; 252 | /* End PBXProject section */ 253 | 254 | /* Begin PBXReferenceProxy section */ 255 | 3AECE8A61A76A96E00BFFEDF /* RustBasedFramework.framework */ = { 256 | isa = PBXReferenceProxy; 257 | fileType = wrapper.framework; 258 | path = RustBasedFramework.framework; 259 | remoteRef = 3AECE8A51A76A96E00BFFEDF /* PBXContainerItemProxy */; 260 | sourceTree = BUILT_PRODUCTS_DIR; 261 | }; 262 | 3AECE8A81A76A96E00BFFEDF /* RustBasedFrameworkTests.xctest */ = { 263 | isa = PBXReferenceProxy; 264 | fileType = wrapper.cfbundle; 265 | path = RustBasedFrameworkTests.xctest; 266 | remoteRef = 3AECE8A71A76A96E00BFFEDF /* PBXContainerItemProxy */; 267 | sourceTree = BUILT_PRODUCTS_DIR; 268 | }; 269 | /* End PBXReferenceProxy section */ 270 | 271 | /* Begin PBXResourcesBuildPhase section */ 272 | 3ABAAD1E1A76A2B4006938AB /* Resources */ = { 273 | isa = PBXResourcesBuildPhase; 274 | buildActionMask = 2147483647; 275 | files = ( 276 | 3ABAAD2B1A76A2B4006938AB /* Main.storyboard in Resources */, 277 | 3ABAAD301A76A2B4006938AB /* LaunchScreen.xib in Resources */, 278 | 3ABAAD2D1A76A2B4006938AB /* Images.xcassets in Resources */, 279 | ); 280 | runOnlyForDeploymentPostprocessing = 0; 281 | }; 282 | 3ABAAD331A76A2B4006938AB /* Resources */ = { 283 | isa = PBXResourcesBuildPhase; 284 | buildActionMask = 2147483647; 285 | files = ( 286 | ); 287 | runOnlyForDeploymentPostprocessing = 0; 288 | }; 289 | /* End PBXResourcesBuildPhase section */ 290 | 291 | /* Begin PBXSourcesBuildPhase section */ 292 | 3ABAAD1C1A76A2B4006938AB /* Sources */ = { 293 | isa = PBXSourcesBuildPhase; 294 | buildActionMask = 2147483647; 295 | files = ( 296 | 3A55D20E1A76B760009F32C0 /* cbench.c in Sources */, 297 | 3ABAAD281A76A2B4006938AB /* ViewController.swift in Sources */, 298 | 3ABAAD261A76A2B4006938AB /* AppDelegate.swift in Sources */, 299 | ); 300 | runOnlyForDeploymentPostprocessing = 0; 301 | }; 302 | 3ABAAD311A76A2B4006938AB /* Sources */ = { 303 | isa = PBXSourcesBuildPhase; 304 | buildActionMask = 2147483647; 305 | files = ( 306 | 3ABAAD3C1A76A2B4006938AB /* iOSHostAppTests.swift in Sources */, 307 | ); 308 | runOnlyForDeploymentPostprocessing = 0; 309 | }; 310 | /* End PBXSourcesBuildPhase section */ 311 | 312 | /* Begin PBXTargetDependency section */ 313 | 3ABAAD371A76A2B4006938AB /* PBXTargetDependency */ = { 314 | isa = PBXTargetDependency; 315 | target = 3ABAAD1F1A76A2B4006938AB /* iOSHostApp */; 316 | targetProxy = 3ABAAD361A76A2B4006938AB /* PBXContainerItemProxy */; 317 | }; 318 | 3AECE8AE1A76A98C00BFFEDF /* PBXTargetDependency */ = { 319 | isa = PBXTargetDependency; 320 | name = RustBasedFramework; 321 | targetProxy = 3AECE8AD1A76A98C00BFFEDF /* PBXContainerItemProxy */; 322 | }; 323 | /* End PBXTargetDependency section */ 324 | 325 | /* Begin PBXVariantGroup section */ 326 | 3ABAAD291A76A2B4006938AB /* Main.storyboard */ = { 327 | isa = PBXVariantGroup; 328 | children = ( 329 | 3ABAAD2A1A76A2B4006938AB /* Base */, 330 | ); 331 | name = Main.storyboard; 332 | sourceTree = ""; 333 | }; 334 | 3ABAAD2E1A76A2B4006938AB /* LaunchScreen.xib */ = { 335 | isa = PBXVariantGroup; 336 | children = ( 337 | 3ABAAD2F1A76A2B4006938AB /* Base */, 338 | ); 339 | name = LaunchScreen.xib; 340 | sourceTree = ""; 341 | }; 342 | /* End PBXVariantGroup section */ 343 | 344 | /* Begin XCBuildConfiguration section */ 345 | 3ABAAD3D1A76A2B4006938AB /* Debug */ = { 346 | isa = XCBuildConfiguration; 347 | buildSettings = { 348 | ALWAYS_SEARCH_USER_PATHS = NO; 349 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 350 | CLANG_CXX_LIBRARY = "libc++"; 351 | CLANG_ENABLE_MODULES = YES; 352 | CLANG_ENABLE_OBJC_ARC = YES; 353 | CLANG_WARN_BOOL_CONVERSION = YES; 354 | CLANG_WARN_CONSTANT_CONVERSION = YES; 355 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 356 | CLANG_WARN_EMPTY_BODY = YES; 357 | CLANG_WARN_ENUM_CONVERSION = YES; 358 | CLANG_WARN_INT_CONVERSION = YES; 359 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 360 | CLANG_WARN_UNREACHABLE_CODE = YES; 361 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 362 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 363 | COPY_PHASE_STRIP = NO; 364 | ENABLE_STRICT_OBJC_MSGSEND = YES; 365 | GCC_C_LANGUAGE_STANDARD = gnu99; 366 | GCC_DYNAMIC_NO_PIC = NO; 367 | GCC_OPTIMIZATION_LEVEL = 0; 368 | GCC_PREPROCESSOR_DEFINITIONS = ( 369 | "DEBUG=1", 370 | "$(inherited)", 371 | ); 372 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 373 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 374 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 375 | GCC_WARN_UNDECLARED_SELECTOR = YES; 376 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 377 | GCC_WARN_UNUSED_FUNCTION = YES; 378 | GCC_WARN_UNUSED_VARIABLE = YES; 379 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 380 | MTL_ENABLE_DEBUG_INFO = YES; 381 | ONLY_ACTIVE_ARCH = YES; 382 | SDKROOT = iphoneos; 383 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 384 | }; 385 | name = Debug; 386 | }; 387 | 3ABAAD3E1A76A2B4006938AB /* Release */ = { 388 | isa = XCBuildConfiguration; 389 | buildSettings = { 390 | ALWAYS_SEARCH_USER_PATHS = NO; 391 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 392 | CLANG_CXX_LIBRARY = "libc++"; 393 | CLANG_ENABLE_MODULES = YES; 394 | CLANG_ENABLE_OBJC_ARC = YES; 395 | CLANG_WARN_BOOL_CONVERSION = YES; 396 | CLANG_WARN_CONSTANT_CONVERSION = YES; 397 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 398 | CLANG_WARN_EMPTY_BODY = YES; 399 | CLANG_WARN_ENUM_CONVERSION = YES; 400 | CLANG_WARN_INT_CONVERSION = YES; 401 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 402 | CLANG_WARN_UNREACHABLE_CODE = YES; 403 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 404 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 405 | COPY_PHASE_STRIP = YES; 406 | ENABLE_NS_ASSERTIONS = NO; 407 | ENABLE_STRICT_OBJC_MSGSEND = YES; 408 | GCC_C_LANGUAGE_STANDARD = gnu99; 409 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 410 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 411 | GCC_WARN_UNDECLARED_SELECTOR = YES; 412 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 413 | GCC_WARN_UNUSED_FUNCTION = YES; 414 | GCC_WARN_UNUSED_VARIABLE = YES; 415 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 416 | MTL_ENABLE_DEBUG_INFO = NO; 417 | SDKROOT = iphoneos; 418 | VALIDATE_PRODUCT = YES; 419 | }; 420 | name = Release; 421 | }; 422 | 3ABAAD401A76A2B4006938AB /* Debug */ = { 423 | isa = XCBuildConfiguration; 424 | buildSettings = { 425 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 426 | CLANG_ENABLE_MODULES = YES; 427 | INFOPLIST_FILE = iOSHostApp/Info.plist; 428 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 429 | PRODUCT_NAME = "$(TARGET_NAME)"; 430 | SWIFT_OBJC_BRIDGING_HEADER = "iOSHostApp/iOSHostApp-Bridging-Header.h"; 431 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 432 | }; 433 | name = Debug; 434 | }; 435 | 3ABAAD411A76A2B4006938AB /* Release */ = { 436 | isa = XCBuildConfiguration; 437 | buildSettings = { 438 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 439 | CLANG_ENABLE_MODULES = YES; 440 | INFOPLIST_FILE = iOSHostApp/Info.plist; 441 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 442 | PRODUCT_NAME = "$(TARGET_NAME)"; 443 | SWIFT_OBJC_BRIDGING_HEADER = "iOSHostApp/iOSHostApp-Bridging-Header.h"; 444 | }; 445 | name = Release; 446 | }; 447 | 3ABAAD431A76A2B4006938AB /* Debug */ = { 448 | isa = XCBuildConfiguration; 449 | buildSettings = { 450 | BUNDLE_LOADER = "$(TEST_HOST)"; 451 | FRAMEWORK_SEARCH_PATHS = ( 452 | "$(SDKROOT)/Developer/Library/Frameworks", 453 | "$(inherited)", 454 | ); 455 | GCC_PREPROCESSOR_DEFINITIONS = ( 456 | "DEBUG=1", 457 | "$(inherited)", 458 | ); 459 | INFOPLIST_FILE = iOSHostAppTests/Info.plist; 460 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 461 | PRODUCT_NAME = "$(TARGET_NAME)"; 462 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/iOSHostApp.app/iOSHostApp"; 463 | }; 464 | name = Debug; 465 | }; 466 | 3ABAAD441A76A2B4006938AB /* Release */ = { 467 | isa = XCBuildConfiguration; 468 | buildSettings = { 469 | BUNDLE_LOADER = "$(TEST_HOST)"; 470 | FRAMEWORK_SEARCH_PATHS = ( 471 | "$(SDKROOT)/Developer/Library/Frameworks", 472 | "$(inherited)", 473 | ); 474 | INFOPLIST_FILE = iOSHostAppTests/Info.plist; 475 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 476 | PRODUCT_NAME = "$(TARGET_NAME)"; 477 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/iOSHostApp.app/iOSHostApp"; 478 | }; 479 | name = Release; 480 | }; 481 | /* End XCBuildConfiguration section */ 482 | 483 | /* Begin XCConfigurationList section */ 484 | 3ABAAD1B1A76A2B4006938AB /* Build configuration list for PBXProject "iOSHostApp" */ = { 485 | isa = XCConfigurationList; 486 | buildConfigurations = ( 487 | 3ABAAD3D1A76A2B4006938AB /* Debug */, 488 | 3ABAAD3E1A76A2B4006938AB /* Release */, 489 | ); 490 | defaultConfigurationIsVisible = 0; 491 | defaultConfigurationName = Release; 492 | }; 493 | 3ABAAD3F1A76A2B4006938AB /* Build configuration list for PBXNativeTarget "iOSHostApp" */ = { 494 | isa = XCConfigurationList; 495 | buildConfigurations = ( 496 | 3ABAAD401A76A2B4006938AB /* Debug */, 497 | 3ABAAD411A76A2B4006938AB /* Release */, 498 | ); 499 | defaultConfigurationIsVisible = 0; 500 | defaultConfigurationName = Release; 501 | }; 502 | 3ABAAD421A76A2B4006938AB /* Build configuration list for PBXNativeTarget "iOSHostAppTests" */ = { 503 | isa = XCConfigurationList; 504 | buildConfigurations = ( 505 | 3ABAAD431A76A2B4006938AB /* Debug */, 506 | 3ABAAD441A76A2B4006938AB /* Release */, 507 | ); 508 | defaultConfigurationIsVisible = 0; 509 | defaultConfigurationName = Release; 510 | }; 511 | /* End XCConfigurationList section */ 512 | }; 513 | rootObject = 3ABAAD181A76A2B4006938AB /* Project object */; 514 | } 515 | -------------------------------------------------------------------------------- /iOSHostApp/iOSHostApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /iOSHostApp/iOSHostApp/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // iOSHostApp 4 | // 5 | // Created by Drew Crawford on 1/26/15. 6 | // Copyright (c) 2015 DrewCrawfordApps. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /iOSHostApp/iOSHostApp/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /iOSHostApp/iOSHostApp/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /iOSHostApp/iOSHostApp/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /iOSHostApp/iOSHostApp/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.dca.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /iOSHostApp/iOSHostApp/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // iOSHostApp 4 | // 5 | // Created by Drew Crawford on 1/26/15. 6 | // Copyright (c) 2015 DrewCrawfordApps. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import RustBasedFramework 11 | 12 | class ViewController: UIViewController { 13 | 14 | override func viewDidLoad() { 15 | super.viewDidLoad() 16 | println("Spinning up C") 17 | let cStartTime = NSDate() 18 | cbench() 19 | let cEndTime = NSDate() 20 | println("C version took \(cEndTime.timeIntervalSinceDate(cStartTime))") 21 | 22 | println("Spinning up Rust") 23 | let startTime = NSDate() 24 | RustBasedFramework.benchmark() 25 | let endTime = NSDate() 26 | println("Rust version took \(endTime.timeIntervalSinceDate(startTime))") 27 | 28 | 29 | // Do any additional setup after loading the view, typically from a nib. 30 | } 31 | 32 | override func didReceiveMemoryWarning() { 33 | super.didReceiveMemoryWarning() 34 | // Dispose of any resources that can be recreated. 35 | } 36 | 37 | 38 | } 39 | 40 | -------------------------------------------------------------------------------- /iOSHostApp/iOSHostApp/cbench.c: -------------------------------------------------------------------------------- 1 | // 2 | // cbench.c 3 | // iOSHostApp 4 | // 5 | // Created by Drew Crawford on 1/26/15. 6 | // Copyright (c) 2015 DrewCrawfordApps. All rights reserved. 7 | // 8 | 9 | #include "cbench.h" 10 | // The Computer Language Benchmarks Game 11 | // http://benchmarksgame.alioth.debian.org/ 12 | // 13 | // Contributed by Jeremy Zerfas 14 | 15 | // This controls the width of lines that are output by this program. 16 | #define MAXIMUM_LINE_WIDTH 60 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | // intptr_t should be the native integer type on most sane systems. 24 | typedef intptr_t intnative_t; 25 | 26 | typedef struct{ 27 | char letter; 28 | float probability; 29 | } nucleotide_info; 30 | 31 | 32 | // Repeatedly print string_To_Repeat until it has printed 33 | // number_Of_Characters_To_Create. The output is also wrapped to 34 | // MAXIMUM_LINE_WIDTH columns. 35 | static void repeat_And_Wrap_String(const char string_To_Repeat[], 36 | const intnative_t number_Of_Characters_To_Create){ 37 | const intnative_t string_To_Repeat_Length=strlen(string_To_Repeat); 38 | 39 | // Create an extended_String_To_Repeat which is a copy of string_To_Repeat 40 | // but extended with another copy of the first MAXIMUM_LINE_WIDTH characters 41 | // of string_To_Repeat appended to the end. Later on this allows us to 42 | // generate a line of output just by doing simple memory copies using an 43 | // appropriate offset into extended_String_To_Repeat. 44 | char extended_String_To_Repeat[string_To_Repeat_Length+MAXIMUM_LINE_WIDTH]; 45 | for(intnative_t column=0; column0;){ 57 | // Figure out the length of the line we need to write. If it's less than 58 | // MAXIMUM_LINE_WIDTH then we also need to add a line feed in the right 59 | // spot too. 60 | intnative_t line_Length=MAXIMUM_LINE_WIDTH; 61 | if(current_Number_Of_Characters_To_Createstring_To_Repeat_Length) 72 | offset-=string_To_Repeat_Length; 73 | 74 | // Output the line to stdout and update the 75 | // current_Number_Of_Characters_To_Create. 76 | //fwrite(line, line_Length+1, 1, stdout); 77 | current_Number_Of_Characters_To_Create-=line_Length; 78 | } 79 | } 80 | 81 | 82 | // Generate a floating point pseudorandom number from 0.0 to max using a linear 83 | // congruential generator. 84 | #define IM 139968 85 | #define IA 3877 86 | #define IC 29573 87 | #define SEED 42 88 | static inline float get_LCG_Pseudorandom_Number(const float max){ 89 | static uint32_t seed=SEED; 90 | seed=(seed*IA + IC)%IM; 91 | return max/IM*seed; 92 | } 93 | 94 | 95 | // Print a pseudorandom DNA sequence that is number_Of_Characters_To_Create 96 | // characters long and made up of the nucleotides specified in 97 | // nucleotides_Information and occurring at the frequencies specified in 98 | // nucleotides_Information. The output is also wrapped to MAXIMUM_LINE_WIDTH 99 | // columns. 100 | static void generate_And_Wrap_Pseudorandom_DNA_Sequence( 101 | const nucleotide_info nucleotides_Information[], 102 | const intnative_t number_Of_Nucleotides, 103 | const intnative_t number_Of_Characters_To_Create){ 104 | 105 | // Cumulate the probabilities. Note that the probability is being multiplied 106 | // by IM because later on we'll also be calling the random number generator 107 | // with a value that is multiplied by IM. Since the random number generator 108 | // does a division by IM this allows the compiler to cancel out the 109 | // multiplication and division by IM with each other without requiring any 110 | // changes to the random number generator code whose code was explicitly 111 | // defined in the rules. 112 | float cumulative_Probabilities[number_Of_Nucleotides], 113 | cumulative_Probability=0.0; 114 | for(intnative_t i=0; i0;){ 125 | // Figure out the length of the line we need to write. If it's less than 126 | // MAXIMUM_LINE_WIDTH then we also need to add a line feed in the right 127 | // spot too. 128 | intnative_t line_Length=MAXIMUM_LINE_WIDTH; 129 | if(current_Number_Of_Characters_To_CreateONE Homo sapiens alu\n", stdout); 170 | const char homo_Sapiens_Alu[]= 171 | "GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTC" 172 | "AGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCG" 173 | "TGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGG" 174 | "AGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA"; 175 | repeat_And_Wrap_String(homo_Sapiens_Alu, 2*n); 176 | 177 | //fputs(">TWO IUB ambiguity codes\n", stdout); 178 | nucleotide_info iub_Nucleotides_Information[]={ 179 | {'a', 0.27}, {'c', 0.12}, {'g', 0.12}, {'t', 0.27}, {'B', 0.02}, 180 | {'D', 0.02}, {'H', 0.02}, {'K', 0.02}, {'M', 0.02}, {'N', 0.02}, 181 | {'R', 0.02}, {'S', 0.02}, {'V', 0.02}, {'W', 0.02}, {'Y', 0.02}}; 182 | generate_And_Wrap_Pseudorandom_DNA_Sequence(iub_Nucleotides_Information, 183 | sizeof(iub_Nucleotides_Information)/sizeof(nucleotide_info), 3*n); 184 | 185 | //fputs(">THREE Homo sapiens frequency\n", stdout); 186 | nucleotide_info homo_Sapien_Nucleotides_Information[]={ 187 | {'a', 0.3029549426680}, {'c', 0.1979883004921}, 188 | {'g', 0.1975473066391}, {'t', 0.3015094502008}}; 189 | generate_And_Wrap_Pseudorandom_DNA_Sequence( 190 | homo_Sapien_Nucleotides_Information, 191 | sizeof(homo_Sapien_Nucleotides_Information)/sizeof(nucleotide_info), 5*n); 192 | 193 | return 0; 194 | } -------------------------------------------------------------------------------- /iOSHostApp/iOSHostApp/cbench.h: -------------------------------------------------------------------------------- 1 | // 2 | // cbench.h 3 | // iOSHostApp 4 | // 5 | // Created by Drew Crawford on 1/26/15. 6 | // Copyright (c) 2015 DrewCrawfordApps. All rights reserved. 7 | // 8 | 9 | #ifndef __iOSHostApp__cbench__ 10 | #define __iOSHostApp__cbench__ 11 | 12 | #include 13 | 14 | #endif /* defined(__iOSHostApp__cbench__) */ 15 | -------------------------------------------------------------------------------- /iOSHostApp/iOSHostApp/iOSHostApp-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | int cbench(); -------------------------------------------------------------------------------- /iOSHostApp/iOSHostAppTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.dca.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /iOSHostApp/iOSHostAppTests/iOSHostAppTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // iOSHostAppTests.swift 3 | // iOSHostAppTests 4 | // 5 | // Created by Drew Crawford on 1/26/15. 6 | // Copyright (c) 2015 DrewCrawfordApps. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import XCTest 11 | 12 | class iOSHostAppTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | XCTAssert(true, "Pass") 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measureBlock() { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /libhello-a64.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drewcrawford/Rust-iOS-Example/c30bce3c2ecb92d34829e0f07f7ce30c77892ea6/libhello-a64.a -------------------------------------------------------------------------------- /libhello-a7.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drewcrawford/Rust-iOS-Example/c30bce3c2ecb92d34829e0f07f7ce30c77892ea6/libhello-a7.a -------------------------------------------------------------------------------- /libhello-a7s.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drewcrawford/Rust-iOS-Example/c30bce3c2ecb92d34829e0f07f7ce30c77892ea6/libhello-a7s.a -------------------------------------------------------------------------------- /libhello-x32.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drewcrawford/Rust-iOS-Example/c30bce3c2ecb92d34829e0f07f7ce30c77892ea6/libhello-x32.a -------------------------------------------------------------------------------- /libhello-x64.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drewcrawford/Rust-iOS-Example/c30bce3c2ecb92d34829e0f07f7ce30c77892ea6/libhello-x64.a -------------------------------------------------------------------------------- /libhello.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drewcrawford/Rust-iOS-Example/c30bce3c2ecb92d34829e0f07f7ce30c77892ea6/libhello.a -------------------------------------------------------------------------------- /make.sh: -------------------------------------------------------------------------------- 1 | rustc --target=x86_64-apple-ios hello.rs --crate-type=staticlib -O -o libhello-x64.a 2 | rustc --target=i386-apple-ios hello.rs --crate-type=staticlib -O -o libhello-x32.a 3 | rustc --target=aarch64-apple-ios hello.rs --crate-type=staticlib -O -o libhello-a64.a 4 | rustc --target=armv7s-apple-ios hello.rs --crate-type=staticlib -O -o libhello-a7s.a 5 | rustc --target=armv7-apple-ios hello.rs --crate-type=staticlib -O -o libhello-a7.a 6 | 7 | lipo -create libhello-x64.a libhello-x32.a libhello-a64.a libhello-a7s.a libhello-a7.a -o libhello.a --------------------------------------------------------------------------------