re: Creating Xcode templates
re: Creating Xcode templates
- Subject: re: Creating Xcode templates
- From: George Warner <email@hidden>
- Date: Tue, 10 May 2005 09:47:46 -0700
On Sat, 07 May 2005 19:16:40 -0700, Jan Brittenson <email@hidden>
wrote:
> I was wondering if there's any documentation on creating Xcode templates?
> Any documentation at all.
Not that I'm aware of.
> I'm trying to integrate a gcc-based cross compiler set (gcc 3.4.3, binutils)
> with target-specific header files, libraries, tools, etc and have things
> working from the command line. What are my choices in how to bundle this
> to make it usable from Xcode 2.0?
What you can do is create a project from one of the existing templates that
most like the project that you want and then make all the changes so that it
is exactly the way you want it and then quit out of XCode and compare the
project files against a copy of the template files copying the changes into
the template copies.
Probably the most important thing to know here is to keep all the template
files UTF8 with the possible exception of the strings file which can be
UTF16. (I use BBEdit)
What follows is a brief explanation of how templates work. It's correct to
the best of my understanding however faulty that may be. It should not be
considered official documentation of how our templates work. Also understand
that we may consider making changes at anytime that may break templates
based on my explanation.
If you look in "/Library/Application Support/Apple/Developer Tools/Project
Templates/Application/Carbon Application" you should see the following
files:
Dutch.lproj
Spanish.lproj
main.c
Japanese.lproj
Italian.lproj
Info.plist
IBCarbonApp_Prefix.pch
IBCarbonApp.pbproj
German.lproj
French.lproj
English.lproj
Control-click (contextual menu) the "IBCarbonApp.pbproj" and select the
"Show Package Contents" menu item. This should open a window in the finder
that lists two files:
TemplateInfo.plist
project.pbxproj
You can now open the "TemplateInfo.plist" file in any editor that can handle
UTF8. It's contents should look something like:
{
FilesToRename = {
"IBCarbonApp_Prefix.pch" = "«PROJECTNAME»_Prefix.pch";
};
FilesToMacroExpand = (
"«PROJECTNAME»_Prefix.pch",
"main.c",
"Info.plist",
"English.lproj/InfoPlist.strings",
"English.lproj/main.nib/objects.xib",
);
Description = "This project builds a Carbon application that uses .nib
files for resources.";
}
This should be relatively strait forward; the first section lists the files
to be renamed and the second section lists the files to be macro expanded.
Macro expansion just involves replacing the "«XXX»" strings with the values
of the their corresponding macro definition ("XXX" in this case). The Macro
Definitions are in the XCode preference PBXCustomTemplateMacroDefinitions.
>From the command line you can set them with the command:
defaults write com.apple.Xcode PBXCustomTemplateMacroDefinitions \
'{FULLUSERNAME = "George Warner" ; \
ORGANIZATIONNAME = "Apple Computer, Inc." ; }'
Some of the built-in macros are:
DATE
YEAR
PROJECTNAME
PROJECTNAMEASXML
That's the most of it. If you have any further question please feel free to
contact me.
--
Enjoy,
George Warner,
Schizophrenic Optimization Scientist
Apple Developer Technical Support (DTS)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden