XCode Project Portfile Question

Ryan Schmidt ryandesign at macports.org
Thu Jan 28 23:39:31 PST 2010

On Jan 28, 2010, at 14:36, Altoine Barker wrote:

> I'm trying to build a Portfile based off of an xcode project but I
> need to ask a few questions.

So presumably you'd use the xcode portgroup.

> 1. How do you build -alltargets like this command example:
>    xcodebuild -project myProject -alltargets

Reading through the xcode portgroup, it looks like that's accomplished by clearing build.target.

> 2. How do you include cmake commands in a portfile like the following
> example:
>    cmake
> -DPYTHON_INC=/opt/local/Library/Frameworks/Python.framework/Versions/3.1/include/python3.1
> -G Xcode ../myProject

Well, we also have a cmake portgroup, which handles cmake's peculiarities for you. You set your additional -D options in configure.args.

So, this project uses both xcode and cmake? It looks like cmake is firing off the xcode build? If so, then you'll want the cmake portgroup, not the xcode portgroup.

> 3. How do you detect an arch and include it in a Portfile made for an
> xcode project?

I'm not sure what you mean exactly. The xcode portgroup should already know what architectures the user wants to build for (using their settings of build_arch and universal_archs from macports.conf and whether or not the user requested the +universal variant) and do the right thing. The cmake portgroup should do the same. Of course, if you have some parts of a project that need xcodebuild and others that need cmake, this is harder because you'll have to one of them manually.

Perhaps you could consider splitting the project into two ports, one of which uses the xcode portgroup, the other of which uses the cmake portgroup.

> 4. Will this be made further complex by pulling the source from an svn
> source?

That shouldn't cause any problems. We have many ports that fetch from svn, and this process is documented in teh guide. You can look at my pure-devel portfile if you want to see an example.

More information about the macports-dev mailing list