changeset 27:57371c29ef73 default tip

ObjcWrap is now automatically mixed in. Added support for building as a dylib with DMD.
author Jacob Carlborg <doob@me.com>
date Fri, 09 Apr 2010 23:00:22 +0200
parents 6825fcc47e39
children
files dsss.conf dstep/objc/bridge/Bridge.d dstep/objc/bridge/Wrapper.d
diffstat 3 files changed, 22 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/dsss.conf	Tue Apr 06 11:38:08 2010 +0200
+++ b/dsss.conf	Fri Apr 09 23:00:22 2010 +0200
@@ -1,5 +1,4 @@
 [dstep]
-#target = cocoa-d-test
 
 version (GNU){
 	buildflags += -framework Foundation -framework ApplicationServices -framework CoreFoundation -framework CoreServices -framework DiskArbitration -framework Security -framework QuartzCore -framework QTKit -framework AppKit -framework CoreData
@@ -24,7 +23,7 @@
 			postbuild += -lgtango 
 		}
 		
-		postbuild += -o ../../DStep.framework/Versions/Current/DStep -install_name @loader_path/../Frameworks/DStep.framework/Versions/A/DStep -framework Cocoa -framework QTKit -framework QuartzCore -framework Security -framework DiskArbitration -framework CoreServices -framework CoreFoundation -framework ApplicationServices;
+		postbuild += -o ../../DStep.framework/Versions/Current/DStep -install_name @rpath/DStep.framework/Versions/A/DStep -framework Cocoa -framework QTKit -framework QuartzCore -framework Security -framework DiskArbitration -framework CoreServices -framework CoreFoundation -framework ApplicationServices;
 		postbuild += cd ../../;
 		postbuild += cp -R dstep DStep.framework/Headers/;
 	}
@@ -36,11 +35,21 @@
 
 version (DigitalMars) {
 	buildflags += -L-framework -LFoundation -L-framework -LApplicationServices -L-framework -LCoreFoundation -L-framework -LCoreServices -L-framework -LDiskArbitration -L-framework -LSecurity -L-framework -LQuartzCore -L-framework -LQTKit -L-framework -LAppKit -L-framework -LCoreData
+	pathToStdLib = /usr/local/dmd/lib/libtango.a
 	
 	version (dylib) {
 		postbuild = cd dsss_objs/D ; \
 					gcc -framework Foundation -framework ApplicationServices -framework CoreFoundation -framework CoreServices -framework DiskArbitration -framework Security -framework QuartzCore -framework QTKit -framework AppKit -framework CoreData \
-					-dynamiclib *.o /usr/local/dmd/lib/libtango.dylib -o ../../libDD-dstep.dylib -install_name ~/d/lib/libDD-dstep.dylib
+					-dynamiclib *.o -o ../../libDD-dstep.dylib -install_name @rpath/libDD-dstep.dylib /usr/local/dmd/lib/libtango-s.a
+	}
+	
+	version (framework) {
+		postbuild = cd dsss_objs/D ; \
+					gcc *.o -dynamiclib $pathToStdLib
+		
+		postbuild += -o ../../DStep.framework/Versions/Current/DStep -L-install_name -L@rpath/DStep.framework/Versions/A/DStep -framework Foundation -framework ApplicationServices -framework CoreFoundation -framework CoreServices -framework DiskArbitration -framework Security -framework QuartzCore -framework QTKit -framework AppKit -framework CoreData;
+		postbuild += cd ../../;
+		postbuild += cp -R dstep DStep.framework/Headers/;
 	}
 }
 
--- a/dstep/objc/bridge/Bridge.d	Tue Apr 06 11:38:08 2010 +0200
+++ b/dstep/objc/bridge/Bridge.d	Fri Apr 09 23:00:22 2010 +0200
@@ -319,6 +319,8 @@
  * This will create a receiver method which will forward the call to $(D_PARAM method),
  * decapsulating arguments and encapsulating the return value as appropriate.
  * 
+ * Mixes in: ObjcWrap
+ * 
  * Examples:
  * ---
  * class AppController : NSObject
@@ -392,6 +394,9 @@
 		
 		/// The Objective-C method declaration for the binded method
 		ObjcMethodDeclaration!(__forwardVirtualCall, R, selector, ARGS) __objcMethodDeclaration;
+		
+		static if (!is(typeof(this.__objcClass)))
+			mixin ObjcWrap;
 	}
 }
 
@@ -516,6 +521,9 @@
 		
 		/// The Objective-C method declaration for the binded method
 		ObjcMethodDeclaration!(__forwardStaticCall, R, selector, ARGS) __objcClassMethodDeclaration;
+		
+		static if (is(typeof(this.__objcClass)))
+			mixin ObjcWrap;
 	}
 }
 
--- a/dstep/objc/bridge/Wrapper.d	Tue Apr 06 11:38:08 2010 +0200
+++ b/dstep/objc/bridge/Wrapper.d	Fri Apr 09 23:00:22 2010 +0200
@@ -20,6 +20,8 @@
 	
 	private id objcObject_;
 	private objc_super* objcSuper_;
+	
+	this () {}
 		
 	/// Initializes object from an Objective-C object instance to wrap.
 	this (id object)