• 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: How do I include source files according to processor?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do I include source files according to processor?


  • Subject: Re: How do I include source files according to processor?
  • From: Steve Baxter <email@hidden>
  • Date: Tue, 31 Oct 2006 22:09:18 +0000

What you could consider is to #include the right file based on the target, e.g. in a file called machPatches.cpp you have:

#if defined( __ppc__ )
	#include "machPatchesPPC.cpp"
#elif defined( __i386__ )
	#include "machPatchesx86.cpp"
#else
	#error Unknown processor type
#endif

This is a bit cleaner than #ifs around the whole file. Not tried it but it should work!

Cheers,

Steve

On 31 Oct 2006, at 12:01, Steve Checkoway wrote:


On Oct 30, 2006, at 4:19 PM, Doug McLean wrote:

Hi experts. Suppose I am building a universal binary target. In the PPC build, I want machPatchesPPC.cpp included in the build, while for intel, I want machPatchesx86.cpp (a processor-specific implementation of the same functions).

I know I can bracket each file with a processor-specific conditional, but prefer not to. Is there a cleaner way to bind a file to the compilation for a specific processor? Maybe some kind of per-file compiler flag?

Last time I asked about this, there wasn't. I forget how long ago that was but I really don't think it's changed in the latest (public) version of Xcode.


What I ended up doing was creating a ppc target and an i386 target and then lipoing the results together in a shell script build phase for the i386 target which depended on the ppc target. I also had to change the install name of the i386 target. That was because it was a framework in my case.

--
Steve Checkoway



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40improvision.com


This email sent to email@hidden

Steve Baxter Software Development Manager Improvision +44-2476-692229

_______________________________________________
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


References: 
 >How do I include source files according to processor? (From: Doug McLean <email@hidden>)
 >Re: How do I include source files according to processor? (From: Steve Checkoway <email@hidden>)

  • Prev by Date: Re: Scrolling in Xcode editor
  • Next by Date: Extending the Editor (was Apple's Tools Strategy)
  • Previous by thread: Re: How do I include source files according to processor?
  • Next by thread: Configure Xcode project to create a folder as Product or target
  • Index(es):
    • Date
    • Thread