From b8da976123b96d13183547f06f75ed4b45172d80 Mon Sep 17 00:00:00 2001
From: Marko Kudjerski <marko@highfidelity.io>
Date: Fri, 12 Aug 2016 14:44:46 -0700
Subject: [PATCH] added Info.plist to Components.app so that macdeployqt from
 Qt 5.6 doesn't throw a segfault

---
 cmake/macros/InstallBesideConsole.cmake       |  6 ++++
 ...MacOSXBundleSandboxComponentsInfo.plist.in | 36 +++++++++++++++++++
 2 files changed, 42 insertions(+)
 create mode 100644 cmake/templates/MacOSXBundleSandboxComponentsInfo.plist.in

diff --git a/cmake/macros/InstallBesideConsole.cmake b/cmake/macros/InstallBesideConsole.cmake
index 0eb6025f38..0e1cb3237e 100644
--- a/cmake/macros/InstallBesideConsole.cmake
+++ b/cmake/macros/InstallBesideConsole.cmake
@@ -59,6 +59,12 @@ macro(install_beside_console)
       set(EXECUTABLE_NEEDING_FIXUP "\${CMAKE_INSTALL_PREFIX}/${COMPONENT_INSTALL_DIR}/${TARGET_NAME}")
       string(REPLACE " " "\\ " ESCAPED_EXECUTABLE_NAME ${EXECUTABLE_NEEDING_FIXUP})
 
+      # configure an rc file for the chosen icon
+      set(MACOSX_BUNDLE_EXECUTABLE_NAME "domain-server")
+      set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.highfidelity.server-components")
+      set(MACOSX_BUNDLE_BUNDLE_NAME "Sandbox Components")
+      configure_file("${HF_CMAKE_DIR}/templates/MacOSXBundleSandboxComponentsInfo.plist.in" "${COMPONENTS_BUNDLE_PATH}/Contents/Info.plist")
+
       install(CODE "
         execute_process(COMMAND ${MACDEPLOYQT_COMMAND} ${ESCAPED_BUNDLE_NAME} -verbose=2 -executable=${ESCAPED_EXECUTABLE_NAME})"
         COMPONENT ${SERVER_COMPONENT}
diff --git a/cmake/templates/MacOSXBundleSandboxComponentsInfo.plist.in b/cmake/templates/MacOSXBundleSandboxComponentsInfo.plist.in
new file mode 100644
index 0000000000..a466dc7c4e
--- /dev/null
+++ b/cmake/templates/MacOSXBundleSandboxComponentsInfo.plist.in
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>CFBundleDevelopmentRegion</key>
+	<string>English</string>
+	<key>CFBundleExecutable</key>
+	<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
+	<key>CFBundleGetInfoString</key>
+	<string>${MACOSX_BUNDLE_INFO_STRING}</string>
+	<key>CFBundleIconFile</key>
+	<string>${MACOSX_BUNDLE_ICON_FILE}</string>
+	<key>CFBundleIdentifier</key>
+	<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
+	<key>CFBundleInfoDictionaryVersion</key>
+	<string>6.0</string>
+	<key>CFBundleLongVersionString</key>
+	<string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string>
+	<key>CFBundleName</key>
+	<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
+	<key>CFBundlePackageType</key>
+	<string>APPL</string>
+	<key>CFBundleShortVersionString</key>
+	<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
+	<key>CFBundleSignature</key>
+	<string>????</string>
+	<key>CFBundleVersion</key>
+	<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
+	<key>CSResourcesFileMapped</key>
+	<true/>
+	<key>LSRequiresCarbon</key>
+	<true/>
+	<key>NSHumanReadableCopyright</key>
+	<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
+</dict>
+</plist>