From 655d86c77793493a09daf4d4f732e9dd0a7d29cd Mon Sep 17 00:00:00 2001 From: hrbrmstr Date: Mon, 26 Aug 2019 11:15:21 -0400 Subject: [PATCH] initial commit --- README.md | 32 + rin-bridge-code/rin-test-Bridging-Header.h | 5 + rin-bridge-code/rin-test-main.hpp | 26 + rin-bridge-code/rin-test-main.mm | 32 + rin-swift/AppDelegate.swift | 41 ++ .../AppIcon.appiconset/Contents.json | 58 ++ rin-swift/Assets.xcassets/Contents.json | 6 + rin-swift/Base.lproj/Main.storyboard | 683 +++++++++++++++++++++ rin-swift/ContentView.swift | 23 + rin-swift/Info.plist | 38 ++ .../Preview Assets.xcassets/Contents.json | 6 + rin-swift/rin_test.entitlements | 8 + rin-test.xcodeproj/project.pbxproj | 104 +++- rin-test/AppDelegate.swift | 38 -- .../AppIcon.appiconset/Contents.json | 58 -- rin-test/Assets.xcassets/Contents.json | 6 - rin-test/Base.lproj/Main.storyboard | 683 --------------------- rin-test/ContentView.swift | 23 - rin-test/Info.plist | 36 -- .../Preview Assets.xcassets/Contents.json | 6 - rin-test/rin_test.entitlements | 5 - 21 files changed, 1050 insertions(+), 867 deletions(-) create mode 100644 README.md create mode 100644 rin-bridge-code/rin-test-Bridging-Header.h create mode 100644 rin-bridge-code/rin-test-main.hpp create mode 100644 rin-bridge-code/rin-test-main.mm create mode 100644 rin-swift/AppDelegate.swift create mode 100644 rin-swift/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 rin-swift/Assets.xcassets/Contents.json create mode 100644 rin-swift/Base.lproj/Main.storyboard create mode 100644 rin-swift/ContentView.swift create mode 100644 rin-swift/Info.plist create mode 100644 rin-swift/Preview Content/Preview Assets.xcassets/Contents.json create mode 100644 rin-swift/rin_test.entitlements delete mode 100644 rin-test/AppDelegate.swift delete mode 100644 rin-test/Assets.xcassets/AppIcon.appiconset/Contents.json delete mode 100644 rin-test/Assets.xcassets/Contents.json delete mode 100644 rin-test/Base.lproj/Main.storyboard delete mode 100644 rin-test/ContentView.swift delete mode 100644 rin-test/Info.plist delete mode 100644 rin-test/Preview Content/Preview Assets.xcassets/Contents.json delete mode 100644 rin-test/rin_test.entitlements diff --git a/README.md b/README.md new file mode 100644 index 0000000..e0786d2 --- /dev/null +++ b/README.md @@ -0,0 +1,32 @@ +# Test of RInside with R 3.6, Xcode 11 & Swift 5 on macOS Catalina + +This is a sample Xcode 11 project (a nigh vanilla/default SwiftUI project) which has: + +- R 3.6 +- [RInside](http://dirk.eddelbuettel.com/code/rinside.html) +- [Rcpp](http://www.rcpp.org/) + +all setup including sample bridging code to enable function execution and data exchange between Swift 5 and R. + +A few key things are included/set: + +- Search paths: + - `/Library/Frameworks/R.framework/Headers/` + - `/Library/Frameworks/R.framework/Versions/3.6/Resources/library/RInside/include/` + - `/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include/` +- Frameworks, Libraries and Embedded Content: + - `/Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libR.dylib` + - `/Library/Frameworks/R.framework/Versions/3.6/Resources/library/RInside/lib/libRInside.dylib` + - Hardened Runtime is enabled with an entitlement of "Disable Library Validation" because the RInside and R shared libraries aren't codesigned (see `rin-swift/rin_test.entitlements`) +- one `.mm` file which lets Xcode know we're using Objective-C++. This is where you include things like `R.h`, `Rcpp.h`, and `RInside.h` or other C/C++ libraries +- one ^^ corresponding `.hpp` file that has *no* imports or includes of anything R/Rcpp-ish and defines the functions you're going to expose to Swift +- one bridging header (setup as as an "Objective C Bridging Header" under "Swift Compiler" in the General settings. This should just include ^^ +- R (RInside) is initialized in the `AppDelegate.swift` and an example of calling functions with and without parameters is in `ContentView.swift` + +There are quite a number of post-compilation yellow flags due to the R-ish headers but it builds and runs fine. + +Built on the shoulders of: + +- Brian Hall's old-ish (2015) [example](http://www.brianrhall.net/rss/linkingxcodecandrtocreateplots) of getting R to play nice with Xcode +- Ben Gorman's more recent (March, 2019) [example](https://www.gormanalysis.com/blog/using-rcpp-in-xcode/) of getting R 3.5 & RInside to play nice with Xcode +- Patrick Wardle's [example](https://github.com/objective-see/ProcInfo/) of getting C-ish things to work with Objective C) diff --git a/rin-bridge-code/rin-test-Bridging-Header.h b/rin-bridge-code/rin-test-Bridging-Header.h new file mode 100644 index 0000000..ccf93c3 --- /dev/null +++ b/rin-bridge-code/rin-test-Bridging-Header.h @@ -0,0 +1,5 @@ +// +// Use this file to import your target's public headers that you would like to expose to Swift. +// + +#include "rin-test-main.hpp" diff --git a/rin-bridge-code/rin-test-main.hpp b/rin-bridge-code/rin-test-main.hpp new file mode 100644 index 0000000..48a4c32 --- /dev/null +++ b/rin-bridge-code/rin-test-main.hpp @@ -0,0 +1,26 @@ +// +// rin-test-main.hpp +// rin-test +// +// Created by hrbrmstr on 8/26/19. +// Copyright © 2019 Bob Rudis. All rights reserved. +// + +#ifndef rin_test_main_hpp +#define rin_test_main_hpp + +#import + +#if defined(__cplusplus) +extern "C" { +#endif + +void r_init(); +double rcpp_mean(double one_more_val); +NSString *cpp_hello_world(); + +#if defined(__cplusplus) +} +#endif + +#endif /* rin_test_main_hpp */ diff --git a/rin-bridge-code/rin-test-main.mm b/rin-bridge-code/rin-test-main.mm new file mode 100644 index 0000000..a5eb747 --- /dev/null +++ b/rin-bridge-code/rin-test-main.mm @@ -0,0 +1,32 @@ +// +// rin-test-main.cpp +// rin-test +// +// Created by hrbrmstr on 8/26/19. +// Copyright © 2019 Bob Rudis. All rights reserved. +// + +#include "rin-test-main.hpp" +#include +#include +#include +#include + +void r_init() { + RInside R(0, NULL); +} + +NSString *cpp_hello_world() { + + std::string hw = "Hello, world!"; + + return([NSString stringWithUTF8String:hw.c_str()]); + +} + +double rcpp_mean(double one_more_val) { + + Rcpp::NumericVector x = Rcpp::NumericVector::create(1, 2, 3, one_more_val); + return(Rcpp::mean(x)); + +} diff --git a/rin-swift/AppDelegate.swift b/rin-swift/AppDelegate.swift new file mode 100644 index 0000000..e91139e --- /dev/null +++ b/rin-swift/AppDelegate.swift @@ -0,0 +1,41 @@ +// +// AppDelegate.swift +// rin-test +// +// Created by hrbrmstr on 8/26/19. +// Copyright © 2019 Bob Rudis. All rights reserved. +// + +import Cocoa +import SwiftUI + +@NSApplicationMain +class AppDelegate: NSObject, NSApplicationDelegate { + + var window: NSWindow! + + + func applicationDidFinishLaunching(_ aNotification: Notification) { + // Insert code here to initialize your application + + r_init() // INITIALIZE RInside! + + window = NSWindow( + contentRect: NSRect(x: 0, y: 0, width: 480, height: 300), + styleMask: [.titled, .closable, .miniaturizable, .resizable, .fullSizeContentView], + backing: .buffered, defer: false) + window.center() + window.setFrameAutosaveName("Main Window") + + window.contentView = NSHostingView(rootView: ContentView()) + + window.makeKeyAndOrderFront(nil) + + } + + func applicationWillTerminate(_ aNotification: Notification) { + // Insert code here to tear down your application + } + + +} diff --git a/rin-swift/Assets.xcassets/AppIcon.appiconset/Contents.json b/rin-swift/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..2db2b1c --- /dev/null +++ b/rin-swift/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,58 @@ +{ + "images" : [ + { + "idiom" : "mac", + "size" : "16x16", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "16x16", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "32x32", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "32x32", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "128x128", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "128x128", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "256x256", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "256x256", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "512x512", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "512x512", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/rin-swift/Assets.xcassets/Contents.json b/rin-swift/Assets.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/rin-swift/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/rin-swift/Base.lproj/Main.storyboard b/rin-swift/Base.lproj/Main.storyboard new file mode 100644 index 0000000..98a309b --- /dev/null +++ b/rin-swift/Base.lproj/Main.storyboard @@ -0,0 +1,683 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Default + + + + + + + Left to Right + + + + + + + Right to Left + + + + + + + + + + + Default + + + + + + + Left to Right + + + + + + + Right to Left + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/rin-swift/ContentView.swift b/rin-swift/ContentView.swift new file mode 100644 index 0000000..a149fa1 --- /dev/null +++ b/rin-swift/ContentView.swift @@ -0,0 +1,23 @@ +// +// ContentView.swift +// rin-test +// +// Created by hrbrmstr on 8/26/19. +// Copyright © 2019 Bob Rudis. All rights reserved. +// + +import SwiftUI + +struct ContentView: View { + var body: some View { + Text((cpp_hello_world() as String) + " " + String(rcpp_mean(10.0))) + .frame(maxWidth: .infinity, maxHeight: .infinity) + } +} + + +struct ContentView_Previews: PreviewProvider { + static var previews: some View { + ContentView() + } +} diff --git a/rin-swift/Info.plist b/rin-swift/Info.plist new file mode 100644 index 0000000..9d304f8 --- /dev/null +++ b/rin-swift/Info.plist @@ -0,0 +1,38 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSApplicationCategoryType + public.app-category.developer-tools + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSHumanReadableCopyright + Copyright © 2019 Bob Rudis. All rights reserved. + NSMainStoryboardFile + Main + NSPrincipalClass + NSApplication + NSSupportsAutomaticTermination + + NSSupportsSuddenTermination + + + diff --git a/rin-swift/Preview Content/Preview Assets.xcassets/Contents.json b/rin-swift/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/rin-swift/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/rin-swift/rin_test.entitlements b/rin-swift/rin_test.entitlements new file mode 100644 index 0000000..8cc185a --- /dev/null +++ b/rin-swift/rin_test.entitlements @@ -0,0 +1,8 @@ + + + + + com.apple.security.cs.disable-library-validation + + + diff --git a/rin-test.xcodeproj/project.pbxproj b/rin-test.xcodeproj/project.pbxproj index 3c12dfc..d4dfc06 100644 --- a/rin-test.xcodeproj/project.pbxproj +++ b/rin-test.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 51; objects = { /* Begin PBXBuildFile section */ @@ -12,8 +12,28 @@ 012D7DD2231416110083A67E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 012D7DD1231416110083A67E /* Assets.xcassets */; }; 012D7DD5231416110083A67E /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 012D7DD4231416110083A67E /* Preview Assets.xcassets */; }; 012D7DD8231416110083A67E /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 012D7DD6231416110083A67E /* Main.storyboard */; }; + 012D7DEF2314182D0083A67E /* rin-test-main.mm in Sources */ = {isa = PBXBuildFile; fileRef = 012D7DED2314182D0083A67E /* rin-test-main.mm */; }; + 012D7DF02314188C0083A67E /* libR.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 012D7DE5231417F80083A67E /* libR.dylib */; }; + 012D7DF12314188C0083A67E /* libR.dylib in Embed Libraries */ = {isa = PBXBuildFile; fileRef = 012D7DE5231417F80083A67E /* libR.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 012D7DF32314189A0083A67E /* libRInside.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 012D7DE9231418080083A67E /* libRInside.dylib */; }; + 012D7DF42314189A0083A67E /* libRInside.dylib in Embed Libraries */ = {isa = PBXBuildFile; fileRef = 012D7DE9231418080083A67E /* libRInside.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; /* End PBXBuildFile section */ +/* Begin PBXCopyFilesBuildPhase section */ + 012D7DF22314188C0083A67E /* Embed Libraries */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 012D7DF12314188C0083A67E /* libR.dylib in Embed Libraries */, + 012D7DF42314189A0083A67E /* libRInside.dylib in Embed Libraries */, + ); + name = "Embed Libraries"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + /* Begin PBXFileReference section */ 012D7DCA2314160F0083A67E /* rin-test.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "rin-test.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 012D7DCD2314160F0083A67E /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; @@ -23,6 +43,13 @@ 012D7DD7231416110083A67E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 012D7DD9231416110083A67E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 012D7DDA231416110083A67E /* rin_test.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = rin_test.entitlements; sourceTree = ""; }; + 012D7DE1231417830083A67E /* libR.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libR.dylib; path = ../../../../Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libR.dylib; sourceTree = ""; }; + 012D7DE5231417F80083A67E /* libR.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libR.dylib; path = ../../../../Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libR.dylib; sourceTree = ""; }; + 012D7DE9231418080083A67E /* libRInside.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libRInside.dylib; path = ../../../../Library/Frameworks/R.framework/Versions/3.6/Resources/library/RInside/lib/libRInside.dylib; sourceTree = ""; }; + 012D7DEC2314182D0083A67E /* rin-test-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "rin-test-Bridging-Header.h"; sourceTree = ""; }; + 012D7DED2314182D0083A67E /* rin-test-main.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = "rin-test-main.mm"; sourceTree = ""; }; + 012D7DEE2314182D0083A67E /* rin-test-main.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = "rin-test-main.hpp"; sourceTree = ""; }; + 012D7DF6231426DA0083A67E /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -30,6 +57,8 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 012D7DF02314188C0083A67E /* libR.dylib in Frameworks */, + 012D7DF32314189A0083A67E /* libRInside.dylib in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -39,8 +68,11 @@ 012D7DC12314160F0083A67E = { isa = PBXGroup; children = ( - 012D7DCC2314160F0083A67E /* rin-test */, + 012D7DF6231426DA0083A67E /* README.md */, + 012D7DF5231426700083A67E /* rin-bridge-code */, + 012D7DCC2314160F0083A67E /* rin-swift */, 012D7DCB2314160F0083A67E /* Products */, + 012D7DE0231417830083A67E /* Frameworks */, ); sourceTree = ""; }; @@ -52,18 +84,18 @@ name = Products; sourceTree = ""; }; - 012D7DCC2314160F0083A67E /* rin-test */ = { + 012D7DCC2314160F0083A67E /* rin-swift */ = { isa = PBXGroup; children = ( 012D7DCD2314160F0083A67E /* AppDelegate.swift */, 012D7DCF2314160F0083A67E /* ContentView.swift */, + 012D7DD9231416110083A67E /* Info.plist */, 012D7DD1231416110083A67E /* Assets.xcassets */, 012D7DD6231416110083A67E /* Main.storyboard */, - 012D7DD9231416110083A67E /* Info.plist */, 012D7DDA231416110083A67E /* rin_test.entitlements */, 012D7DD3231416110083A67E /* Preview Content */, ); - path = "rin-test"; + path = "rin-swift"; sourceTree = ""; }; 012D7DD3231416110083A67E /* Preview Content */ = { @@ -74,6 +106,26 @@ path = "Preview Content"; sourceTree = ""; }; + 012D7DE0231417830083A67E /* Frameworks */ = { + isa = PBXGroup; + children = ( + 012D7DE9231418080083A67E /* libRInside.dylib */, + 012D7DE5231417F80083A67E /* libR.dylib */, + 012D7DE1231417830083A67E /* libR.dylib */, + ); + name = Frameworks; + sourceTree = ""; + }; + 012D7DF5231426700083A67E /* rin-bridge-code */ = { + isa = PBXGroup; + children = ( + 012D7DEC2314182D0083A67E /* rin-test-Bridging-Header.h */, + 012D7DEE2314182D0083A67E /* rin-test-main.hpp */, + 012D7DED2314182D0083A67E /* rin-test-main.mm */, + ); + path = "rin-bridge-code"; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -84,6 +136,7 @@ 012D7DC62314160F0083A67E /* Sources */, 012D7DC72314160F0083A67E /* Frameworks */, 012D7DC82314160F0083A67E /* Resources */, + 012D7DF22314188C0083A67E /* Embed Libraries */, ); buildRules = ( ); @@ -106,11 +159,12 @@ TargetAttributes = { 012D7DC92314160F0083A67E = { CreatedOnToolsVersion = 11.0; + LastSwiftMigration = 1100; }; }; }; buildConfigurationList = 012D7DC52314160F0083A67E /* Build configuration list for PBXProject "rin-test" */; - compatibilityVersion = "Xcode 9.3"; + compatibilityVersion = "Xcode 10.0"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( @@ -147,6 +201,7 @@ files = ( 012D7DD02314160F0083A67E /* ContentView.swift in Sources */, 012D7DCE2314160F0083A67E /* AppDelegate.swift in Sources */, + 012D7DEF2314182D0083A67E /* rin-test-main.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -281,21 +336,34 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CODE_SIGN_ENTITLEMENTS = "rin-test/rin_test.entitlements"; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = "rin-swift/rin_test.entitlements"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_ASSET_PATHS = "\"rin-test/Preview Content\""; + DEVELOPMENT_ASSET_PATHS = "\"rin-swift/Preview Content\""; DEVELOPMENT_TEAM = CBY22P58G8; ENABLE_HARDENED_RUNTIME = YES; ENABLE_PREVIEWS = YES; - INFOPLIST_FILE = "rin-test/Info.plist"; + "HEADER_SEARCH_PATHS[arch=*]" = ( + /Library/Frameworks/R.framework/Headers/, + /Library/Frameworks/R.framework/Versions/3.6/Resources/library/RInside/include/, + /Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include/, + ); + INFOPLIST_FILE = "rin-swift/Info.plist"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", ); + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(LOCAL_LIBRARY_DIR)/Frameworks/R.framework/Versions/3.6/Resources/lib", + "$(LOCAL_LIBRARY_DIR)/Frameworks/R.framework/Versions/3.6/Resources/library/RInside/lib", + ); MACOSX_DEPLOYMENT_TARGET = 10.15; PRODUCT_BUNDLE_IDENTIFIER = "is.rud.bob.rin-test"; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "rin-bridge-code/rin-test-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; }; name = Debug; @@ -304,21 +372,33 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CODE_SIGN_ENTITLEMENTS = "rin-test/rin_test.entitlements"; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = "rin-swift/rin_test.entitlements"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_ASSET_PATHS = "\"rin-test/Preview Content\""; + DEVELOPMENT_ASSET_PATHS = "\"rin-swift/Preview Content\""; DEVELOPMENT_TEAM = CBY22P58G8; ENABLE_HARDENED_RUNTIME = YES; ENABLE_PREVIEWS = YES; - INFOPLIST_FILE = "rin-test/Info.plist"; + "HEADER_SEARCH_PATHS[arch=*]" = ( + /Library/Frameworks/R.framework/Headers/, + /Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include/, + /Library/Frameworks/R.framework/Versions/3.6/Resources/library/RInside/include/, + ); + INFOPLIST_FILE = "rin-swift/Info.plist"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", ); + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(LOCAL_LIBRARY_DIR)/Frameworks/R.framework/Versions/3.6/Resources/lib", + "$(LOCAL_LIBRARY_DIR)/Frameworks/R.framework/Versions/3.6/Resources/library/RInside/lib", + ); MACOSX_DEPLOYMENT_TARGET = 10.15; PRODUCT_BUNDLE_IDENTIFIER = "is.rud.bob.rin-test"; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "rin-bridge-code/rin-test-Bridging-Header.h"; SWIFT_VERSION = 5.0; }; name = Release; diff --git a/rin-test/AppDelegate.swift b/rin-test/AppDelegate.swift deleted file mode 100644 index a933fe4..0000000 --- a/rin-test/AppDelegate.swift +++ /dev/null @@ -1,38 +0,0 @@ -// -// AppDelegate.swift -// rin-test -// -// Created by hrbrmstr on 8/26/19. -// Copyright © 2019 Bob Rudis. All rights reserved. -// - -import Cocoa -import SwiftUI - -@NSApplicationMain -class AppDelegate: NSObject, NSApplicationDelegate { - - var window: NSWindow! - - - func applicationDidFinishLaunching(_ aNotification: Notification) { - // Insert code here to initialize your application - window = NSWindow( - contentRect: NSRect(x: 0, y: 0, width: 480, height: 300), - styleMask: [.titled, .closable, .miniaturizable, .resizable, .fullSizeContentView], - backing: .buffered, defer: false) - window.center() - window.setFrameAutosaveName("Main Window") - - window.contentView = NSHostingView(rootView: ContentView()) - - window.makeKeyAndOrderFront(nil) - } - - func applicationWillTerminate(_ aNotification: Notification) { - // Insert code here to tear down your application - } - - -} - diff --git a/rin-test/Assets.xcassets/AppIcon.appiconset/Contents.json b/rin-test/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 2db2b1c..0000000 --- a/rin-test/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "images" : [ - { - "idiom" : "mac", - "size" : "16x16", - "scale" : "1x" - }, - { - "idiom" : "mac", - "size" : "16x16", - "scale" : "2x" - }, - { - "idiom" : "mac", - "size" : "32x32", - "scale" : "1x" - }, - { - "idiom" : "mac", - "size" : "32x32", - "scale" : "2x" - }, - { - "idiom" : "mac", - "size" : "128x128", - "scale" : "1x" - }, - { - "idiom" : "mac", - "size" : "128x128", - "scale" : "2x" - }, - { - "idiom" : "mac", - "size" : "256x256", - "scale" : "1x" - }, - { - "idiom" : "mac", - "size" : "256x256", - "scale" : "2x" - }, - { - "idiom" : "mac", - "size" : "512x512", - "scale" : "1x" - }, - { - "idiom" : "mac", - "size" : "512x512", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/rin-test/Assets.xcassets/Contents.json b/rin-test/Assets.xcassets/Contents.json deleted file mode 100644 index da4a164..0000000 --- a/rin-test/Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/rin-test/Base.lproj/Main.storyboard b/rin-test/Base.lproj/Main.storyboard deleted file mode 100644 index 98a309b..0000000 --- a/rin-test/Base.lproj/Main.storyboard +++ /dev/null @@ -1,683 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Default - - - - - - - Left to Right - - - - - - - Right to Left - - - - - - - - - - - Default - - - - - - - Left to Right - - - - - - - Right to Left - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/rin-test/ContentView.swift b/rin-test/ContentView.swift deleted file mode 100644 index beb7b49..0000000 --- a/rin-test/ContentView.swift +++ /dev/null @@ -1,23 +0,0 @@ -// -// ContentView.swift -// rin-test -// -// Created by hrbrmstr on 8/26/19. -// Copyright © 2019 Bob Rudis. All rights reserved. -// - -import SwiftUI - -struct ContentView: View { - var body: some View { - Text("Hello World") - .frame(maxWidth: .infinity, maxHeight: .infinity) - } -} - - -struct ContentView_Previews: PreviewProvider { - static var previews: some View { - ContentView() - } -} diff --git a/rin-test/Info.plist b/rin-test/Info.plist deleted file mode 100644 index 124aed2..0000000 --- a/rin-test/Info.plist +++ /dev/null @@ -1,36 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIconFile - - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - $(PRODUCT_BUNDLE_PACKAGE_TYPE) - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - LSMinimumSystemVersion - $(MACOSX_DEPLOYMENT_TARGET) - NSHumanReadableCopyright - Copyright © 2019 Bob Rudis. All rights reserved. - NSMainStoryboardFile - Main - NSPrincipalClass - NSApplication - NSSupportsAutomaticTermination - - NSSupportsSuddenTermination - - - diff --git a/rin-test/Preview Content/Preview Assets.xcassets/Contents.json b/rin-test/Preview Content/Preview Assets.xcassets/Contents.json deleted file mode 100644 index da4a164..0000000 --- a/rin-test/Preview Content/Preview Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/rin-test/rin_test.entitlements b/rin-test/rin_test.entitlements deleted file mode 100644 index 6f0a227..0000000 --- a/rin-test/rin_test.entitlements +++ /dev/null @@ -1,5 +0,0 @@ - - - - -