summary history branches tags files
commit:7119cea65468100ae312b6eb5ac4bf81d46dd697
author:Trevor Bentley
committer:Trevor Bentley
date:Wed Jul 26 09:57:37 2017 +0200
parents:629c4cf5304a80f7421e60c6749d6e043c4bb215
Don't try to call xcode-select on non-OSX platforms
diff --git a/README.md b/README.md
line changes: +10/-0
index 4805006..bd45fa5
--- a/README.md
+++ b/README.md
@@ -34,12 +34,22 @@ To communicate with the Touch Bar service, apps using Rubrail *must* be executed
 
 The included example comes with a bundling script (examples/example.sh) and a launcher (examples/example_launcher.rs) to move itself into an app bundle and execute.
 
+
 ### Limitations
 
 There is no support for changing the UI of an existing bar.  To change the UI layout, you must create a new bar and completely replace the old one.  Scrubbers are an exception: their contents are managed by callbacks, but they do not live-refresh when the bar is visible.  The user must close and re-open the bar to see scrubber content changes.
 
 The Touch Bar API supports doing just about anything with custom views.  Rubrail does not.  Only a very limited set of UI options are exposed.
 
+#### Linking
+
+Rubrail links against the private Apple framework `DFRFoundation.framework`.  This is handled by adding the private framework path in `build.rs`.  Applications that _use_ Rubrail do not need to link against it themselves, but should be aware that a dependency does.
+
+Linking requires an XCode version high enough to support the Touch Bar and the private framework.  The only tested version of XCode is version 8.3.  Applications that use Rubrail **must** build with a new enough XCode version.  If using Travis-CI, this means adding a line like this to your `.travis.yml`:
+
+`osx_image: xcode8.3`
+
+
 ### Known Bugs
 
 Memory leaks!  Memory leaks as far as the eye can see.

diff --git a/build.rs b/build.rs
line changes: +7/-2
index 4a31dd4..430cd11
--- a/build.rs
+++ b/build.rs
@@ -1,4 +1,5 @@
-fn main() {
+#[allow(dead_code)]
+fn add_xcode_private_framework_path() {
     // PrivateFramework dir:
     // `xcode-select -p`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/PrivateFrameworks/
     let xcode_dir = std::process::Command::new("xcode-select")
@@ -11,7 +12,11 @@ fn main() {
                                 xcode_dir);
     println!("XCode PrivateFramework dir: {}", framework_dir);
 
+    println!("cargo:rustc-link-search=framework={}", framework_dir);
+}
+
+fn main() {
     #[cfg(target_os = "macos")]
     #[cfg(feature = "private_api")]
-    println!("cargo:rustc-link-search=framework={}", framework_dir);
+    add_xcode_private_framework_path();
 }