• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Radar issues (Re: How to file a radar)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Radar issues (Re: How to file a radar)


  • Subject: Re: Radar issues (Re: How to file a radar)
  • From: Mike Jackson <email@hidden>
  • Date: Thu, 20 Jul 2006 00:33:46 -0400




On Jul 19, 2006, at 11:15 PM, Marshall Clow wrote:

At 9:52 PM -0400 7/19/06, Mike Jackson wrote:
On Jul 19, 2006, at 8:41 PM, Marshall Clow wrote:

At 5:15 PM -0700 7/19/06, Chris Hanson wrote:
On Jul 19, 2006, at 12:58 PM, Ben Weiss wrote:

The lack of support for separate debug/release libraries is another major headache. I worked with some Apple engineers to hack around this at the last WWDC, and I'm surprised it hasn't been addressed yet...

What do you mean by "separate debug/release libraries"?

Well, what _I_ mean is to have two static libraries - a debug and a release version
and have the release version of my app link against the release version of the library,
and the debug version link against the debug version.


Usually, the libraries are named "SomeLibrary.a" and "SomeLibrary Debug.a",
but that's not a hard and fast rule.


Also, I have source files/libraries that I want included in the debug version, and not at all in the release version.

I tried to follow this thread so I am sure I am just missing something BUT if you don't fight Xcode then you can very easily have Debug and Release builds without a lot of work. In fact it is very little work.


Suppose I have a project that has a base library called "libBase.a", and an executable that depends on that library.

With you so far - except that I have _several_ executables that depend on that library.


So setup an Xcode project to build the Library.

So far so good....

Now in the same Xcode project, create a new Target that will be your executable.

Um, which project? App #1? App #2? App #3? All of them?

Have your executable link against the library that was built in your first target. Set the executable target to have a dependancy on the Library. Now, when you set the build type to "Debug" then Xcode will make sure that Library is built with the Debug settings and place the built library in {XcodeBuildLocation}/Debug/ libBase.a and place the executable in {XcodeBuildLocation}/Debug/ MyApp.exe

When you are ready for a Release version simply change the build type to "Release" and build. The base lib will be built in release mode, the executable will be built in Release mode, and both will be place in {XcodeBuildLocation}/Release/.

How much simpler can this possibly be. On other systems you have to do weird things like naming each built product with "_debug.a" or some other weird things. Xcode will do the right thing with release and Debug. You just have to make the project dependancies for it to work.

That sounds perfectly reasonable, except for the idea that there's one library and one application.
[ The situation is moderately complicated; there are currently 3 apps and 4 libraries ]
--
-- Marshall


Marshall Clow     Idio Software   <mailto:email@hidden>

It is by caffeine alone I set my mind in motion.
It is by the beans of Java that thoughts acquire speed,
the hands acquire shaking, the shaking becomes a warning.
It is by caffeine alone I set my mind in motion.

I have something like 27 Libs, and about 5 or 6 executables that depend on some or all of them.


There are a number of different ways to set this up. I chose to describe the simplest approach. If you have a project for _each_ of the libs and executables, then that will work fine also.

Lets start off with the first library. I will assume you have a project for it. Good. Lets move on to the next _project_ that depends on the first. Doesn't matter if it is another lib or an executable. In that _second_ project, open the "Project" menu and select "Add to Project". Find and select the Xcode project file for the _first_ project. When the sheet pops down to add it to a target be sure you select a target. Click OK.
Now that generally sets up the link between the second Project and the first but we need to go one step further. Open the "Targets" icon in the left pane of the _second_ project (assuming all-in-one layout). Double click on whatever target is in there (I am assuming a single target, otherwise pick the target that you want to setup the dependancy for). After you Double click on a target a new window should open up. Select the "General" tab. Look toward the bottom of the window. There you should see a "+" and "-" buttons. Click the "+" button. A Sheet appears that lists all the targets from the current Project AND targets from the project that you included earlier (the _first_ project). Select the Target from the _first_ project that this second Target depends on. Click OK. You are good to go.


Also, in the Left Pane the First Project will have a little triangle next to it. If you disclose the triangle you will see your Library from the first project. Drag that library down to the target that depends on the library to the "Link Binary With Libraries" build phase. This will ensure that Xcode links against the proper Library. You now no longer need to worry about Library_Path as Xcode figures that out and will add it to the linker invocation.

So now what happens is that when you build the Second Project, Xcode will check the first project to make sure it is up to date, then start building the second project. If you select "Release" in the Second Project, Xcode will build the "Release" version of the First project.

At this point it is generally nice to have a shared build location so that all your build products end up in the same place.

You can select the "Preferences" from the Xcode Menu (The one next to the Apple Menu). In the Preferences window select the "Building" icon (Should be third from the left). Select a customized location for both the Build Products and Intermediate Build files. So in my case I have the following:

Build Products:
 /Users/mjackson/XcodeBuild
Intermediate Files:
 /Users/Shared/XcodeIntermediates

Doing this affords me a few things. When I _really_ want to be sure my projects are "clean" I can just nuke the contents of those folders. Kinda like hitting it with a sledgehammer but does the trick.

Next, I go into the Spotlight Prefs (in the regular system preferences panel) and tell Spotlight to ignore the intermediates location.

When Xcode Builds it will create "Debug" and "Release" folders in the Build Products location. And guess what will go into each folder.. you guessed either the Debug or the Release builds of your code. No more freaky Naming. No more Guessing. It just works.

The last word of caution is that when you tell Xcode to "Clean" a project it will ask you (at least in Xcode 2.3) if you want to also clean dependancies. Pick what you want there.. just a word of caution as I have blown away all my built stuff when I cleaned a top level project. oops.

I hope this helps clear up how to have both debug and release builds in Xcode. If you have any more questions, this is the best place to ask.

Cheers
--------
Mike Jackson
imikejackson <at> gmail <dot> com

_______________________________________________
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


  • Follow-Ups:
    • Re: Radar issues (Re: How to file a radar)
      • From: "James Larcombe" <email@hidden>
References: 
 >Re: [ANN] Xcode + Leopard at WWDC this year (From: "Andy O'Meara" <email@hidden>)
 >Re: [ANN] Xcode + Leopard at WWDC this year (From: Laurence Harris <email@hidden>)
 >Re: [ANN] Xcode + Leopard at WWDC this year (From: Adrian Hoe 贺文耀 <email@hidden>)
 >OT: How to file a radar WAS Re: [ANN] Xcode + Leopard at WWDC this year (From: Chris Forsythe <email@hidden>)
 >Re: OT: How to file a radar WAS Re: [ANN] Xcode + Leopard at WWDC this year (From: Adrian Hoe 贺文耀 <email@hidden>)
 >Re: OT: How to file a radar WAS Re: [ANN] Xcode + Leopard at WWDC this year (From: Syd Polk <email@hidden>)
 >Re: OT: How to file a radar WAS Re: [ANN] Xcode + Leopard at WWDC this year (From: Adrian Hoe 贺文耀 <email@hidden>)
 >Re: OT: How to file a radar WAS Re: [ANN] Xcode + Leopard at WWDC this year (From: Chris Espinosa <email@hidden>)
 >Re: OT: How to file a radar (From: Markus Hitter <email@hidden>)
 >Re: OT: How to file a radar (From: "Finlay Dobbie" <email@hidden>)
 >Re: Radar issues (Re: How to file a radar) (From: Laurence Harris <email@hidden>)
 >Re: Radar issues (Re: How to file a radar) (From: Ben Weiss <email@hidden>)
 >Re: Radar issues (Re: How to file a radar) (From: Chris Hanson <email@hidden>)
 >Re: Radar issues (Re: How to file a radar) (From: Marshall Clow <email@hidden>)
 >Re: Radar issues (Re: How to file a radar) (From: Mike Jackson <email@hidden>)
 >Re: Radar issues (Re: How to file a radar) (From: Marshall Clow <email@hidden>)

  • Prev by Date: Re: Version Inquiry...
  • Next by Date: Re: Per-configuration target membership and expectations
  • Previous by thread: Re: Radar issues (Re: How to file a radar)
  • Next by thread: Re: Radar issues (Re: How to file a radar)
  • Index(es):
    • Date
    • Thread