[dasher] Changed font rendering code to use NSFont/CoreGraphics additions to NSString;
- From: Patrick Welche <pwelche src gnome org>
- To: svn-commits-list gnome org
- Subject: [dasher] Changed font rendering code to use NSFont/CoreGraphics additions to NSString;
- Date: Fri, 15 May 2009 12:50:26 -0400 (EDT)
commit 8e5dc87384de9d596a44c76911bb9dcb525cc500
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date: Fri May 15 17:34:42 2009 +0100
Changed font rendering code to use NSFont/CoreGraphics additions to NSString;
framebuffer texture sizes must be powers of 2.
---
ChangeLog | 4 +
Src/MacOSX/AlphabetLetter.h | 20 ++--
Src/MacOSX/AlphabetLetter.m | 169 ---------------------------
Src/MacOSX/Dasher.xcodeproj/project.pbxproj | 22 ++--
Src/MacOSX/DasherViewOpenGL.h | 1 +
Src/MacOSX/DasherViewOpenGL.mm | 31 ++++--
Src/MacOSX/GLUtils.m | 1 -
Src/MacOSX/ReadmeDeveloper.txt | 25 ++--
8 files changed, 62 insertions(+), 211 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index b28cffd..e9de9ac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-05-15 Alan Lawrence <acl33 inf phy cam ac uk>
+
+ * Backport to OS X 10.4 universal binary for PPC
+
2009-05-14 Patrick Welche <prlw1 cam ac uk>
* DasherButtons.cpp: Change box non-uniformity range again.
diff --git a/Src/MacOSX/AlphabetLetter.h b/Src/MacOSX/AlphabetLetter.h
index ae68b54..f8328e9 100755
--- a/Src/MacOSX/AlphabetLetter.h
+++ b/Src/MacOSX/AlphabetLetter.h
@@ -1,9 +1,9 @@
//
// AlphabetLetter.h
-// Alphabet
+// Dasher
//
-// Created by mtrent on Fri Feb 08 2002.
-// Copyright (c) 2002 xxxxx. All rights reserved.
+// Created by Alan Lawrence on 20/03/2009.
+// Copyright 2009 Cavendish Laboratory. All rights reserved.
//
#import <AppKit/AppKit.h>
@@ -11,14 +11,12 @@
@interface AlphabetLetter : NSObject
{
- NSBitmapImageRep *_imageRep;
- GLuint _tex;
+ NSString *string;
+ GLuint texture;
+ GLfloat texcoords[8];
}
-- (id)initWithString:(NSString *)aString small:(BOOL)small;
-
-- (void)drawWithSize:(float)aSize x:(float)x y:(float)y r:(float)r g:(float)g b:(float)b;
-- (NSSize)sizeWithSize:(float)aSize;
-
+- (id)initWithString:(NSString *)string;
+- (void)drawWithSize:(int)aSize x:(int)x y:(int)y r:(float)r g:(float)g b:(float)b;
+- (NSSize)sizeWithSize:(int)aSize;
@end
-
diff --git a/Src/MacOSX/AlphabetLetter.m b/Src/MacOSX/AlphabetLetter.m
deleted file mode 100755
index 03422ad..0000000
--- a/Src/MacOSX/AlphabetLetter.m
+++ /dev/null
@@ -1,169 +0,0 @@
-//
-// AlphabetLetter.m
-// Alphabet
-//
-// Created by mtrent on Fri Feb 08 2002.
-// Copyright (c) 2002 xxxxx. All rights reserved.
-//
-
-#import <ScreenSaver/ScreenSaver.h>
-#import <OpenGL/gl.h>
-#import <OpenGL/glu.h>
-
-#import "AlphabetLetter.h"
-#import "GLUtils.h"
-
- implementation AlphabetLetter
-
-- (id)initWithString:(NSString *)aString small:(BOOL)small
-{
- self = [super init];
-
- if (self) {
- static NSTextFieldCell *cell = NULL;
- NSRect textFrame = NSZeroRect;
- NSRect bigRect = NSZeroRect;
- NSRect drawFrame = NSZeroRect;
- NSImage *image;
- NSBitmapImageRep *upsideDown;
- int bytesPerRow, bitsPerPixel, height;
- BOOL hasAlpha;
-
- if (!cell) {
- cell = [[NSTextFieldCell allocWithZone:[self zone]] initTextCell:aString];
- [cell setBordered:NO];
- [cell setBezeled:NO];
- [cell setDrawsBackground:NO];
- [cell setWraps:NO];
- [cell setTextColor:[NSColor greenColor]];
- [cell setBackgroundColor:[NSColor clearColor]];
- [cell setFont:[NSFont fontWithName:@"Cochin" size:small ? 18.0 : 36.0]];
- textFrame.origin = NSZeroPoint;
- }
-
- [cell setStringValue:aString];
- textFrame.size = [cell cellSize];
-
- // if using textures, remember we have to use powers of two
- bigRect = textFrame;
- bigRect.size.width = (float)P2Ceiling(bigRect.size.width);
- bigRect.size.height = (float)P2Ceiling(bigRect.size.height);
-
- // prepare bitmap image rep
- image = [[NSImage alloc] initWithSize:bigRect.size];
- [image lockFocus];
- drawFrame = SSCenteredRectInRect(textFrame, bigRect);
- [cell drawInteriorWithFrame:drawFrame inView:[NSView focusView]];
- upsideDown = [[NSBitmapImageRep alloc] initWithFocusedViewRect:bigRect];
- [image unlockFocus];
- [image release];
-
- // since OpenGL draws images upside down, we need to flip this image along
- // the y axis. I know a cool trick for doing this when texture mapping,
- // but I want something a little more general for now
- bytesPerRow = [upsideDown bytesPerRow];
- bitsPerPixel = [upsideDown bitsPerPixel];
- hasAlpha = [upsideDown hasAlpha];
- height = (int)bigRect.size.height;
- _imageRep = [[NSBitmapImageRep alloc]
- initWithBitmapDataPlanes:NULL
- pixelsWide:(int)bigRect.size.width
- pixelsHigh:height
- bitsPerSample:[upsideDown bitsPerSample]
- samplesPerPixel:[upsideDown samplesPerPixel]
- hasAlpha:hasAlpha
- isPlanar:[upsideDown isPlanar]
- colorSpaceName:NSCalibratedRGBColorSpace
- bytesPerRow:bytesPerRow
- bitsPerPixel:bitsPerPixel];
-
- // create the texture
-
- GLenum format;
-
- format = hasAlpha ? GL_RGBA : GL_RGB;
- glGenTextures(1, &_tex);
- glBindTexture(GL_TEXTURE_2D, _tex);
- CheckGLError("glBindTexture");
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- CheckGLError("glTexParameteri");
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- glPixelStorei(GL_UNPACK_ROW_LENGTH, bytesPerRow / (bitsPerPixel >> 3));
- CheckGLError("glPixelStorei");
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, bigRect.size.width, bigRect.size.height, 0, format, GL_UNSIGNED_BYTE, [upsideDown bitmapData]);
- CheckGLError("glTexImage2D");
- [upsideDown release];
-
- }
- return self;
-}
-
-- (void)dealloc
-{
- if (_tex) {
- glDeleteTextures(1, &_tex);
- }
- [_imageRep release];
-
- [super dealloc];
-}
-
-- (NSSize)sizeWithSize:(float)aSize {
- // the first size refers to the image size, the second to the text's point size
- // maybe some new nomenclature would be a good idea?
- return [_imageRep size];
-}
-
-- (void)drawWithSize:(float)aSize x:(float)x y:(float)y r:(float)r g:(float)g b:(float)b
-{
- GLenum format;
- NSSize size = [_imageRep size];
-
- // draw our image
- if (_tex) {
- GLfloat l, t, r, b, z;
-
- // load our coordinates
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
-
- // seed initial position
- glTranslatef(x + (size.width / 2), y + (size.height / 2), 0.0);
- glScalef(aSize, aSize, 1.0);
-
- // i'm lazy, so I like to use these simple variables
- l = - (size.width / 2);
- r = + (size.width / 2);
- t = + (size.height / 2);
- b = - (size.height / 2);
- z = 0.0;
-
- // bind and draw
- glBindTexture(GL_TEXTURE_2D, _tex);
- glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
- glBegin(GL_QUADS);
- glColor4f(r, g, b, 1.0);
- glTexCoord2f(0.0,0.0); glVertex3f(l, b, z);
- glTexCoord2f(0.0,1.0); glVertex3f(l, t, z);
- glTexCoord2f(1.0,1.0); glVertex3f(r, t, z);
- glTexCoord2f(1.0,0.0); glVertex3f(r, b, z);
- glEnd();
- glPopMatrix();
- } else {
- // we don't support fade-out effects if we're not using textures
-// format = [_imageRep hasAlpha] ? GL_RGBA : GL_RGB;
-// glPixelTransferf(GL_RED_SCALE, r);
-// glPixelTransferf(GL_GREEN_SCALE, g);
-// glPixelTransferf(GL_BLUE_SCALE, b);
-// glPixelTransferf(GL_ALPHA_SCALE, 1.0);
-// glRasterPos2f(x, y);
-// glDrawPixels(size.width, size.height, format, GL_UNSIGNED_BYTE, [_imageRep bitmapData]);
- }
- CheckGLError("draw");
-}
-
- end
-
diff --git a/Src/MacOSX/Dasher.xcodeproj/project.pbxproj b/Src/MacOSX/Dasher.xcodeproj/project.pbxproj
index 842ebbe..5db1189 100755
--- a/Src/MacOSX/Dasher.xcodeproj/project.pbxproj
+++ b/Src/MacOSX/Dasher.xcodeproj/project.pbxproj
@@ -158,9 +158,9 @@
1948BF3F0C226CFD001DFA32 /* XMLUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 1948BE9B0C226CFD001DFA32 /* XMLUtil.h */; };
19558AD60C3182730054A193 /* DasherViewCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 19558AD50C3182730054A193 /* DasherViewCocoa.h */; };
196874060C2BDC2E00D63879 /* AlphabetLetter.h in Headers */ = {isa = PBXBuildFile; fileRef = 196874000C2BDC2E00D63879 /* AlphabetLetter.h */; };
- 196874070C2BDC2E00D63879 /* AlphabetLetter.m in Sources */ = {isa = PBXBuildFile; fileRef = 196874010C2BDC2E00D63879 /* AlphabetLetter.m */; };
+ 196874070C2BDC2E00D63879 /* AlphabetLetter.mm in Sources */ = {isa = PBXBuildFile; fileRef = 196874010C2BDC2E00D63879 /* AlphabetLetter.mm */; };
1968740A0C2BDC2E00D63879 /* GLUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 196874040C2BDC2E00D63879 /* GLUtils.h */; };
- 1968740B0C2BDC2E00D63879 /* GLUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 196874050C2BDC2E00D63879 /* GLUtils.m */; };
+ 1968740B0C2BDC2E00D63879 /* GLUtils.mm in Sources */ = {isa = PBXBuildFile; fileRef = 196874050C2BDC2E00D63879 /* GLUtils.mm */; };
196874290C2BE12E00D63879 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 196874280C2BE12E00D63879 /* OpenGL.framework */; };
1974FE340714861B00B95DA0 /* DasherApp.h in Headers */ = {isa = PBXBuildFile; fileRef = 19C49619045029A40000000A /* DasherApp.h */; };
1974FE370714861B00B95DA0 /* ZippyCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 1946CAB90481AD440000000A /* ZippyCache.h */; };
@@ -567,9 +567,9 @@
1948BE9B0C226CFD001DFA32 /* XMLUtil.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = XMLUtil.h; sourceTree = "<group>"; };
19558AD50C3182730054A193 /* DasherViewCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DasherViewCocoa.h; sourceTree = "<group>"; };
196874000C2BDC2E00D63879 /* AlphabetLetter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AlphabetLetter.h; sourceTree = "<group>"; };
- 196874010C2BDC2E00D63879 /* AlphabetLetter.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = AlphabetLetter.m; sourceTree = "<group>"; };
+ 196874010C2BDC2E00D63879 /* AlphabetLetter.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = AlphabetLetter.mm; sourceTree = "<group>"; };
196874040C2BDC2E00D63879 /* GLUtils.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = GLUtils.h; sourceTree = "<group>"; };
- 196874050C2BDC2E00D63879 /* GLUtils.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = GLUtils.m; sourceTree = "<group>"; };
+ 196874050C2BDC2E00D63879 /* GLUtils.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = GLUtils.mm; sourceTree = "<group>"; };
196874280C2BE12E00D63879 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; };
196D8784048AA2750000000A /* DasherUtil.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DasherUtil.h; sourceTree = "<group>"; };
196D8785048AA2750000000A /* DasherUtil.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = DasherUtil.mm; sourceTree = "<group>"; };
@@ -846,9 +846,9 @@
19C4961D045029D70000000A /* DasherViewOpenGL.h */,
199DCCD70450B94C0000000A /* DasherViewOpenGL.mm */,
196874000C2BDC2E00D63879 /* AlphabetLetter.h */,
- 196874010C2BDC2E00D63879 /* AlphabetLetter.m */,
+ 196874010C2BDC2E00D63879 /* AlphabetLetter.mm */,
196874040C2BDC2E00D63879 /* GLUtils.h */,
- 196874050C2BDC2E00D63879 /* GLUtils.m */,
+ 196874050C2BDC2E00D63879 /* GLUtils.mm */,
19D4423C04546C410000000A /* PreferencesController.h */,
19D4423D04546C410000000A /* PreferencesController.mm */,
198EC7AE07153D6E00474B38 /* KeyboardEvent.h */,
@@ -1824,8 +1824,8 @@
1948BF370C226CFD001DFA32 /* UserLogParam.cpp in Sources */,
1948BF390C226CFD001DFA32 /* UserLogTrial.cpp in Sources */,
1948BF3E0C226CFD001DFA32 /* XMLUtil.cpp in Sources */,
- 196874070C2BDC2E00D63879 /* AlphabetLetter.m in Sources */,
- 1968740B0C2BDC2E00D63879 /* GLUtils.m in Sources */,
+ 196874070C2BDC2E00D63879 /* AlphabetLetter.mm in Sources */,
+ 1968740B0C2BDC2E00D63879 /* GLUtils.mm in Sources */,
19C190AC0C3267D700979F34 /* DasherViewAqua.mm in Sources */,
1921DB390C7ECAA400E6DAA5 /* OneButtonDynamicFilter.cpp in Sources */,
1921DB400C7ECB4B00E6DAA5 /* DasherGameMode.cpp in Sources */,
@@ -1955,6 +1955,8 @@
198D19FF08965C4800CE3CC9 /* Deployment */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1)";
+ ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1 = "ppc i386";
};
name = Deployment;
};
@@ -1975,7 +1977,7 @@
198D19FC08965C4800CE3CC9 /* Default */,
);
defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Default;
+ defaultConfigurationName = Development;
};
198D19FD08965C4800CE3CC9 /* Build configuration list for PBXProject "Dasher" */ = {
isa = XCConfigurationList;
@@ -1985,7 +1987,7 @@
198D1A0008965C4800CE3CC9 /* Default */,
);
defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Default;
+ defaultConfigurationName = Development;
};
/* End XCConfigurationList section */
};
diff --git a/Src/MacOSX/DasherViewOpenGL.h b/Src/MacOSX/DasherViewOpenGL.h
index f59c79f..19d15aa 100755
--- a/Src/MacOSX/DasherViewOpenGL.h
+++ b/Src/MacOSX/DasherViewOpenGL.h
@@ -44,6 +44,7 @@ typedef struct {
GLuint frameBuffers[2];
GLuint textures[2];
+ GLfloat texcoords[8];
colour_t *colourTable;
diff --git a/Src/MacOSX/DasherViewOpenGL.mm b/Src/MacOSX/DasherViewOpenGL.mm
index 301c573..15d7fd1 100755
--- a/Src/MacOSX/DasherViewOpenGL.mm
+++ b/Src/MacOSX/DasherViewOpenGL.mm
@@ -20,6 +20,7 @@
#import "Chatter.h"
#import "DasherUtil.h"
#import "DasherApp.h"
+#import "GLUtils.h"
#import "COSXDasherScreen.h"
@@ -34,8 +35,17 @@
- (void)sendMarker:(int)iMarker {
[[self openGLContext] makeCurrentContext];
- if (iMarker != -1) glDisable(GL_TEXTURE_2D);
- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, iMarker==-1 ? 0 : frameBuffers[iMarker]);
+ if (iMarker == -1)
+ {
+ glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+ }
+ else
+ {
+ //NSLog(@"SendMarker %i\n",iMarker);
+ glDisable(GL_TEXTURE_2D);
+ glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, frameBuffers[iMarker]);
+ glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, textures[iMarker], 0);
+ }
//glMatrixMode(GL_PROJECTION); glLoadIdentity();
//glOrtho(0, [self boundsWidth], [self boundsHeight], 0, -1.0, 1.0);
//glMatrixMode(GL_MODELVIEW); glLoadIdentity();
@@ -53,7 +63,6 @@
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
GLshort coords[] = {0,0, r.width,0, 0,r.height, r.width,r.height};
glVertexPointer(2, GL_SHORT, 0, coords);
- GLfloat texcoords[] = {0.0,1.0, 1.0,1.0, 0.0,0.0, 1.0,0.0};
glTexCoordPointer(2, GL_FLOAT, 0, texcoords);
for (int i=0; i<2; i++)
@@ -188,7 +197,7 @@
- (AlphabetLetter *)letterForString:(NSString *)aString {
AlphabetLetter *result = [_letterDict objectForKey:aString];
if (result == nil) {
- result = [[AlphabetLetter alloc] initWithString:aString small:YES];
+ result = [[AlphabetLetter alloc] initWithString:aString];
[_letterDict setObject:result forKey:aString];
}
return result;
@@ -205,7 +214,7 @@
AlphabetLetter *letter = [self letterForString:aString];
glEnable(GL_TEXTURE_2D);
// TODO could pass the whole colour_t in and let it deal with splitting out the items
- [letter drawWithSize:/*1.0*/ aSize / 18.0 x:x1 y:y1 r:colourTable[aColorIndex].r g:colourTable[aColorIndex].g b:colourTable[aColorIndex].b];
+ [letter drawWithSize:/*1.0*/ aSize x:x1 y:y1 r:colourTable[aColorIndex].r g:colourTable[aColorIndex].g b:colourTable[aColorIndex].b];
glDisable(GL_TEXTURE_2D);
}
@@ -257,13 +266,13 @@
[self gl_init];
[self flushCaches];
[self setFrameSize:aFrame.size];
- int w = aFrame.size.width, h = aFrame.size.height;
+ int w = P2Ceiling(aFrame.size.width), h = P2Ceiling(aFrame.size.height);
glGenFramebuffersEXT(2, frameBuffers);
glGenTextures(2, textures);
for (int i=0; i<2; i++)
{
- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, frameBuffers[i]);
+ glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, frameBuffers[i]);
glBindTexture(GL_TEXTURE_2D, textures[i]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
@@ -277,8 +286,14 @@
}
glClearColor(1.0, 1.0, 1.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
+
+ GLfloat tc_x = aFrame.size.width/(double)w, tc_y = aFrame.size.height/(double)h;
+ texcoords[0] = 0.0; texcoords[1] = tc_y;
+ texcoords[2] = tc_x; texcoords[3] = tc_y;
+ texcoords[4] = 0.0; texcoords[5] = 0.0;
+ texcoords[6] = tc_x; texcoords[7] = 0.0;
+ _keyboardHelper = new CKeyboardHelper();
}
- _keyboardHelper = new CKeyboardHelper();
return self;
}
diff --git a/Src/MacOSX/GLUtils.m b/Src/MacOSX/GLUtils.m
deleted file mode 100755
index 0e90aa2..0000000
--- a/Src/MacOSX/GLUtils.m
+++ /dev/null
@@ -1 +0,0 @@
-//
// GLUtils.m
// Alphabet
//
// Created by mtrent on Sat Feb 09 2002.
// Copyright (c) 2002 xxxxx. All rights reserved.
//
#import <OpenGL/glu.h>
#import "GLUtils.h"
void CheckGLError(const char *note)
{
GLenum error = glGetError();
if (error) {
NSLog(@"%s: %s (%d)", note, gluErrorString(error), error);
}
}
unsigned int P2Ceiling(unsigned int n)
{
unsigned long i = 1;
while (i < n) i <<= 1;
return i;
}
\ No newline at end of file
diff --git a/Src/MacOSX/ReadmeDeveloper.txt b/Src/MacOSX/ReadmeDeveloper.txt
index f5383a4..725415f 100644
--- a/Src/MacOSX/ReadmeDeveloper.txt
+++ b/Src/MacOSX/ReadmeDeveloper.txt
@@ -1,12 +1,13 @@
-To make a dmg for distribution
-
-- create a folder called Dasher-x.y.z where x.y.z is the version of dasher
-- put the files to be distributed in this folder. The files are normally Dasher.app and Readme.html
-- run Disk Copy (in Applications/Utilities)
-- Drag the Dasher-x.y.z folder onto the Disk Copy window
-- call the created dmg file Dasher-x.y.z.dmg
-- when it is finished, double-click the Dasher-x.y.z.dmg file and make sure it works
-- Dasher-x.y.z.dmg is the file to be distributed
-
-Doug Dickinson --dd
-08 June 2003
\ No newline at end of file
+Building Dasher for PPC
+
+I set up a new "Deployment" configuration in order to build a universal binary, following http://developer.apple.com/documentation/MacOSX/Conceptual/universal_binary/universal_binary_compiling/universal_binary_build.html#//apple_ref/doc/uid/TP40002217-CH206-BCICFABA
+
+If you now select "OS 10.4" as your Active SDK, you should get a choice of i386 and PPC architectures you can build for (however, it seems that choosing either, builds both - perhaps unsurprising, as it's a universal binary!).
+
+A complication is that OS 10.4 doesn't include the expat XML library we're using (whereas 10.5 has it built in - however, 10.5 doesn't run on PPC...). Hence, such users will have to install expat first, from expat-2.0.1-3.dmg (on the Dasher website). However, XCode doesn't think they'll have done this, and AFAICT the only sort of dependency it allows is on another project/target within XCode (this'd require setting up Expat as a Framework to be built by XCode - which seems a bit unnecessary when 10.5 users don't need it). So, I hacked up the "10.4u" (universal) SDK to include the files that expat-2.0.1-3.dmg installs onto the user's machine, as follows...
+
+(On your 10.5 build machine) Mount the expat DMG, and on the resulting volume, right-click expat.pkg and "Show Package Contents". Grab the file Contents/Archive.pax.gz, and copy to somewhere on your harddisk. Then, gunzip it to get Archive.pax. If you double-click this in the Finder, it opens with OS X's inbuilt "Archive Utility", and produces a directory "usr". As root, copy the directory usr/local/include and the file usr/local/lib/libexpat.a into the corresponding locations in /Developer/SDKs/MacOS10.4u.sdk/usr/local. This should persuade XCode to build Dasher using the 10.4 SDK....
+
+and for now, I'm distributing it as a .zip, simply by going to dasher/Src/MacOSX/build/Deployment/, right-clicking Dasher.app and selecting 'Compress "Dasher"'...
+
+--Alan Lawrence, May 2009.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]