From a133b3192c1e984e353c036a9c4bb10abeba6fc2 Mon Sep 17 00:00:00 2001
From: Christopher Stawarz <cstawarz@mit.edu>
Date: Mon, 24 Oct 2016 11:47:28 -0400
Subject: [PATCH] Added Xcode project for OpenEphysHDF5Lib, which builds a
 shared library (libOpenEphysHDF5.dylib) and installs it in
 open-ephys.app/Contents/Frameworks.  On macOS, the KWIKFormat plugin now
 links against libOpenEphysHDF5.dylib.

---
 .../contents.xcworkspacedata                  |   7 +
 .../OpenEphysHDF5.xcodeproj/project.pbxproj   | 229 ++++++++++++++++++
 Builds/MacOSX/Plugins/Config/Plugin.xcconfig  |   2 +-
 .../KWIKFormat.xcodeproj/project.pbxproj      |  38 +--
 4 files changed, 259 insertions(+), 17 deletions(-)
 create mode 100644 Builds/MacOSX/Plugins/CommonLibs/OpenEphysHDF5/OpenEphysHDF5.xcodeproj/project.pbxproj

diff --git a/Builds/MacOSX/OpenEphys.xcworkspace/contents.xcworkspacedata b/Builds/MacOSX/OpenEphys.xcworkspace/contents.xcworkspacedata
index 6d2a199cf..9ff01afaa 100644
--- a/Builds/MacOSX/OpenEphys.xcworkspace/contents.xcworkspacedata
+++ b/Builds/MacOSX/OpenEphys.xcworkspace/contents.xcworkspacedata
@@ -22,6 +22,13 @@
       <FileRef
          location = "group:ChannelMappingNode/ChannelMappingNode.xcodeproj">
       </FileRef>
+      <Group
+         location = "group:CommonLibs"
+         name = "CommonLibs">
+         <FileRef
+            location = "group:OpenEphysHDF5/OpenEphysHDF5.xcodeproj">
+         </FileRef>
+      </Group>
       <FileRef
          location = "group:EventBroadcaster/EventBroadcaster.xcodeproj">
       </FileRef>
diff --git a/Builds/MacOSX/Plugins/CommonLibs/OpenEphysHDF5/OpenEphysHDF5.xcodeproj/project.pbxproj b/Builds/MacOSX/Plugins/CommonLibs/OpenEphysHDF5/OpenEphysHDF5.xcodeproj/project.pbxproj
new file mode 100644
index 000000000..c9f7a5955
--- /dev/null
+++ b/Builds/MacOSX/Plugins/CommonLibs/OpenEphysHDF5/OpenEphysHDF5.xcodeproj/project.pbxproj
@@ -0,0 +1,229 @@
+// !$*UTF8*$!
+{
+	archiveVersion = 1;
+	classes = {
+	};
+	objectVersion = 46;
+	objects = {
+
+/* Begin PBXBuildFile section */
+		E1F91DD11DBE59EC00FF13EA /* HDF5FileFormat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1F91DCF1DBE59EC00FF13EA /* HDF5FileFormat.cpp */; };
+		E1F91DD21DBE59EC00FF13EA /* HDF5FileFormat.h in Headers */ = {isa = PBXBuildFile; fileRef = E1F91DD01DBE59EC00FF13EA /* HDF5FileFormat.h */; };
+		E1F91DDA1DBE619900FF13EA /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = E1F91DD91DBE619900FF13EA /* libz.tbd */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+		E1F91DBD1DBE588500FF13EA /* libOpenEphysHDF5.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libOpenEphysHDF5.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+		E1F91DCC1DBE58C000FF13EA /* Library_Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Library_Debug.xcconfig; sourceTree = "<group>"; };
+		E1F91DCD1DBE58C000FF13EA /* Library_Release.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Library_Release.xcconfig; sourceTree = "<group>"; };
+		E1F91DCF1DBE59EC00FF13EA /* HDF5FileFormat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HDF5FileFormat.cpp; sourceTree = "<group>"; };
+		E1F91DD01DBE59EC00FF13EA /* HDF5FileFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDF5FileFormat.h; sourceTree = "<group>"; };
+		E1F91DD91DBE619900FF13EA /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+		E1F91DBA1DBE588500FF13EA /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				E1F91DDA1DBE619900FF13EA /* libz.tbd in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+		E1F91DB41DBE588500FF13EA = {
+			isa = PBXGroup;
+			children = (
+				E1F91DCB1DBE58A100FF13EA /* Config */,
+				E1F91DBF1DBE588500FF13EA /* OpenEphysHDF5 */,
+				E1F91DD81DBE619900FF13EA /* Frameworks */,
+				E1F91DBE1DBE588500FF13EA /* Products */,
+			);
+			sourceTree = "<group>";
+		};
+		E1F91DBE1DBE588500FF13EA /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				E1F91DBD1DBE588500FF13EA /* libOpenEphysHDF5.dylib */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+		E1F91DBF1DBE588500FF13EA /* OpenEphysHDF5 */ = {
+			isa = PBXGroup;
+			children = (
+				E1F91DD01DBE59EC00FF13EA /* HDF5FileFormat.h */,
+				E1F91DCF1DBE59EC00FF13EA /* HDF5FileFormat.cpp */,
+			);
+			name = OpenEphysHDF5;
+			path = ../../../../../Source/Plugins/CommonLibs/OpenEphysHDF5Lib;
+			sourceTree = "<group>";
+		};
+		E1F91DCB1DBE58A100FF13EA /* Config */ = {
+			isa = PBXGroup;
+			children = (
+				E1F91DCC1DBE58C000FF13EA /* Library_Debug.xcconfig */,
+				E1F91DCD1DBE58C000FF13EA /* Library_Release.xcconfig */,
+			);
+			name = Config;
+			path = ../../Config;
+			sourceTree = "<group>";
+		};
+		E1F91DD81DBE619900FF13EA /* Frameworks */ = {
+			isa = PBXGroup;
+			children = (
+				E1F91DD91DBE619900FF13EA /* libz.tbd */,
+			);
+			name = Frameworks;
+			sourceTree = "<group>";
+		};
+/* End PBXGroup section */
+
+/* Begin PBXHeadersBuildPhase section */
+		E1F91DBB1DBE588500FF13EA /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				E1F91DD21DBE59EC00FF13EA /* HDF5FileFormat.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXHeadersBuildPhase section */
+
+/* Begin PBXNativeTarget section */
+		E1F91DBC1DBE588500FF13EA /* OpenEphysHDF5 */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = E1F91DC81DBE588500FF13EA /* Build configuration list for PBXNativeTarget "OpenEphysHDF5" */;
+			buildPhases = (
+				E1F91DB91DBE588500FF13EA /* Sources */,
+				E1F91DBA1DBE588500FF13EA /* Frameworks */,
+				E1F91DBB1DBE588500FF13EA /* Headers */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = OpenEphysHDF5;
+			productName = OpenEphysHDF5;
+			productReference = E1F91DBD1DBE588500FF13EA /* libOpenEphysHDF5.dylib */;
+			productType = "com.apple.product-type.library.dynamic";
+		};
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+		E1F91DB51DBE588500FF13EA /* Project object */ = {
+			isa = PBXProject;
+			attributes = {
+				LastUpgradeCheck = 0800;
+				ORGANIZATIONNAME = "Open Ephys";
+				TargetAttributes = {
+					E1F91DBC1DBE588500FF13EA = {
+						CreatedOnToolsVersion = 8.0;
+						ProvisioningStyle = Automatic;
+					};
+				};
+			};
+			buildConfigurationList = E1F91DB81DBE588500FF13EA /* Build configuration list for PBXProject "OpenEphysHDF5" */;
+			compatibilityVersion = "Xcode 3.2";
+			developmentRegion = English;
+			hasScannedForEncodings = 0;
+			knownRegions = (
+				en,
+			);
+			mainGroup = E1F91DB41DBE588500FF13EA;
+			productRefGroup = E1F91DBE1DBE588500FF13EA /* Products */;
+			projectDirPath = "";
+			projectRoot = "";
+			targets = (
+				E1F91DBC1DBE588500FF13EA /* OpenEphysHDF5 */,
+			);
+		};
+/* End PBXProject section */
+
+/* Begin PBXSourcesBuildPhase section */
+		E1F91DB91DBE588500FF13EA /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				E1F91DD11DBE59EC00FF13EA /* HDF5FileFormat.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+		E1F91DC61DBE588500FF13EA /* Debug */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = E1F91DCC1DBE58C000FF13EA /* Library_Debug.xcconfig */;
+			buildSettings = {
+			};
+			name = Debug;
+		};
+		E1F91DC71DBE588500FF13EA /* Release */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = E1F91DCD1DBE58C000FF13EA /* Library_Release.xcconfig */;
+			buildSettings = {
+			};
+			name = Release;
+		};
+		E1F91DC91DBE588500FF13EA /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				HEADER_SEARCH_PATHS = (
+					"$(inherited)",
+					"$(MAC_PACKAGE_DIR)/include",
+				);
+				OTHER_LDFLAGS = (
+					"$(inherited)",
+					"-Wl,-force_load,$(MAC_PACKAGE_DIR)/lib/libsz.a",
+					"-Wl,-force_load,$(MAC_PACKAGE_DIR)/lib/libhdf5.a",
+					"-Wl,-force_load,$(MAC_PACKAGE_DIR)/lib/libhdf5_cpp.a",
+				);
+				PRODUCT_NAME = "$(TARGET_NAME)";
+			};
+			name = Debug;
+		};
+		E1F91DCA1DBE588500FF13EA /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				HEADER_SEARCH_PATHS = (
+					"$(inherited)",
+					"$(MAC_PACKAGE_DIR)/include",
+				);
+				OTHER_LDFLAGS = (
+					"$(inherited)",
+					"-Wl,-force_load,$(MAC_PACKAGE_DIR)/lib/libsz.a",
+					"-Wl,-force_load,$(MAC_PACKAGE_DIR)/lib/libhdf5.a",
+					"-Wl,-force_load,$(MAC_PACKAGE_DIR)/lib/libhdf5_cpp.a",
+				);
+				PRODUCT_NAME = "$(TARGET_NAME)";
+			};
+			name = Release;
+		};
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+		E1F91DB81DBE588500FF13EA /* Build configuration list for PBXProject "OpenEphysHDF5" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				E1F91DC61DBE588500FF13EA /* Debug */,
+				E1F91DC71DBE588500FF13EA /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		E1F91DC81DBE588500FF13EA /* Build configuration list for PBXNativeTarget "OpenEphysHDF5" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				E1F91DC91DBE588500FF13EA /* Debug */,
+				E1F91DCA1DBE588500FF13EA /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+/* End XCConfigurationList section */
+	};
+	rootObject = E1F91DB51DBE588500FF13EA /* Project object */;
+}
diff --git a/Builds/MacOSX/Plugins/Config/Plugin.xcconfig b/Builds/MacOSX/Plugins/Config/Plugin.xcconfig
index 262c430c1..cdf718b90 100644
--- a/Builds/MacOSX/Plugins/Config/Plugin.xcconfig
+++ b/Builds/MacOSX/Plugins/Config/Plugin.xcconfig
@@ -1,6 +1,6 @@
 #include "Base.xcconfig"
 
 CONFIGURATION_BUILD_DIR = $(PROJECT_DIR)/../../build/$(CONFIGURATION)/open-ephys.app/Contents/PlugIns
-HEADER_SEARCH_PATHS = ../../../../JuceLibraryCode ../../../../JuceLibraryCode/modules ../../../../Source/Plugins/Headers $(inherited)
+HEADER_SEARCH_PATHS = ../../../../JuceLibraryCode ../../../../JuceLibraryCode/modules ../../../../Source/Plugins/Headers ../../../../Source/Plugins/CommonLibs $(inherited)
 INSTALL_PATH = $(HOME)/Applications/open-ephys.app/Contents/PlugIns
 WRAPPER_EXTENSION = bundle
diff --git a/Builds/MacOSX/Plugins/KWIKFormat/KWIKFormat.xcodeproj/project.pbxproj b/Builds/MacOSX/Plugins/KWIKFormat/KWIKFormat.xcodeproj/project.pbxproj
index c0bf8bcee..85bdb247c 100644
--- a/Builds/MacOSX/Plugins/KWIKFormat/KWIKFormat.xcodeproj/project.pbxproj
+++ b/Builds/MacOSX/Plugins/KWIKFormat/KWIKFormat.xcodeproj/project.pbxproj
@@ -9,8 +9,9 @@
 /* Begin PBXBuildFile section */
 		E1F558E81C9B23AB0035F88B /* KwikFileSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1F558DF1C9B23AB0035F88B /* KwikFileSource.cpp */; };
 		E1F558EA1C9B23AB0035F88B /* OpenEphysLib.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1F558E21C9B23AB0035F88B /* OpenEphysLib.cpp */; };
-		E1F558EB1C9B23AB0035F88B /* HDF5FileFormat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1F558E41C9B23AB0035F88B /* HDF5FileFormat.cpp */; };
+		E1F558EB1C9B23AB0035F88B /* KWIKFormat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1F558E41C9B23AB0035F88B /* KWIKFormat.cpp */; };
 		E1F558EC1C9B23AB0035F88B /* HDF5Recording.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1F558E61C9B23AB0035F88B /* HDF5Recording.cpp */; };
+		E1F91DD51DBE5D4900FF13EA /* libOpenEphysHDF5.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = E1F91DD41DBE5D4900FF13EA /* libOpenEphysHDF5.dylib */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXFileReference section */
@@ -21,10 +22,11 @@
 		E1F558DF1C9B23AB0035F88B /* KwikFileSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KwikFileSource.cpp; sourceTree = "<group>"; };
 		E1F558E01C9B23AB0035F88B /* KwikFileSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KwikFileSource.h; sourceTree = "<group>"; };
 		E1F558E21C9B23AB0035F88B /* OpenEphysLib.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OpenEphysLib.cpp; sourceTree = "<group>"; };
-		E1F558E41C9B23AB0035F88B /* HDF5FileFormat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HDF5FileFormat.cpp; sourceTree = "<group>"; };
-		E1F558E51C9B23AB0035F88B /* HDF5FileFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDF5FileFormat.h; sourceTree = "<group>"; };
+		E1F558E41C9B23AB0035F88B /* KWIKFormat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KWIKFormat.cpp; sourceTree = "<group>"; };
+		E1F558E51C9B23AB0035F88B /* KWIKFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWIKFormat.h; sourceTree = "<group>"; };
 		E1F558E61C9B23AB0035F88B /* HDF5Recording.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HDF5Recording.cpp; sourceTree = "<group>"; };
 		E1F558E71C9B23AB0035F88B /* HDF5Recording.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDF5Recording.h; sourceTree = "<group>"; };
+		E1F91DD41DBE5D4900FF13EA /* libOpenEphysHDF5.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libOpenEphysHDF5.dylib; path = ../Frameworks/libOpenEphysHDF5.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -32,6 +34,7 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				E1F91DD51DBE5D4900FF13EA /* libOpenEphysHDF5.dylib in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -43,6 +46,7 @@
 			children = (
 				E1F558D91C9B23830035F88B /* Config */,
 				E1F558D21C9B23370035F88B /* KWIKFormat */,
+				E1F91DD31DBE5D4900FF13EA /* Frameworks */,
 				E1F558D11C9B23370035F88B /* Products */,
 			);
 			sourceTree = "<group>";
@@ -97,14 +101,22 @@
 		E1F558E31C9B23AB0035F88B /* RecordEngine */ = {
 			isa = PBXGroup;
 			children = (
-				E1F558E51C9B23AB0035F88B /* HDF5FileFormat.h */,
-				E1F558E41C9B23AB0035F88B /* HDF5FileFormat.cpp */,
 				E1F558E71C9B23AB0035F88B /* HDF5Recording.h */,
 				E1F558E61C9B23AB0035F88B /* HDF5Recording.cpp */,
+				E1F558E51C9B23AB0035F88B /* KWIKFormat.h */,
+				E1F558E41C9B23AB0035F88B /* KWIKFormat.cpp */,
 			);
 			path = RecordEngine;
 			sourceTree = "<group>";
 		};
+		E1F91DD31DBE5D4900FF13EA /* Frameworks */ = {
+			isa = PBXGroup;
+			children = (
+				E1F91DD41DBE5D4900FF13EA /* libOpenEphysHDF5.dylib */,
+			);
+			name = Frameworks;
+			sourceTree = "<group>";
+		};
 /* End PBXGroup section */
 
 /* Begin PBXNativeTarget section */
@@ -174,7 +186,7 @@
 				E1F558EA1C9B23AB0035F88B /* OpenEphysLib.cpp in Sources */,
 				E1F558EC1C9B23AB0035F88B /* HDF5Recording.cpp in Sources */,
 				E1F558E81C9B23AB0035F88B /* KwikFileSource.cpp in Sources */,
-				E1F558EB1C9B23AB0035F88B /* HDF5FileFormat.cpp in Sources */,
+				E1F558EB1C9B23AB0035F88B /* KWIKFormat.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -203,12 +215,9 @@
 					"$(MAC_PACKAGE_DIR)/include",
 				);
 				INFOPLIST_FILE = KWIKFormat/Info.plist;
-				OTHER_LDFLAGS = (
+				LIBRARY_SEARCH_PATHS = (
+					"$(CONFIGURATION_BUILD_DIR)/../Frameworks",
 					"$(inherited)",
-					"-lz",
-					"$(MAC_PACKAGE_DIR)/lib/libsz.a",
-					"$(MAC_PACKAGE_DIR)/lib/libhdf5.a",
-					"$(MAC_PACKAGE_DIR)/lib/libhdf5_cpp.a",
 				);
 				PRODUCT_BUNDLE_IDENTIFIER = "org.open-ephys.gui.plugin.KWIKFormat";
 				PRODUCT_NAME = "$(TARGET_NAME)";
@@ -223,12 +232,9 @@
 					"$(MAC_PACKAGE_DIR)/include",
 				);
 				INFOPLIST_FILE = KWIKFormat/Info.plist;
-				OTHER_LDFLAGS = (
+				LIBRARY_SEARCH_PATHS = (
+					"$(CONFIGURATION_BUILD_DIR)/../Frameworks",
 					"$(inherited)",
-					"-lz",
-					"$(MAC_PACKAGE_DIR)/lib/libsz.a",
-					"$(MAC_PACKAGE_DIR)/lib/libhdf5.a",
-					"$(MAC_PACKAGE_DIR)/lib/libhdf5_cpp.a",
 				);
 				PRODUCT_BUNDLE_IDENTIFIER = "org.open-ephys.gui.plugin.KWIKFormat";
 				PRODUCT_NAME = "$(TARGET_NAME)";
-- 
GitLab