Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 4 custom build step before compile

I'm trying to integrate a tool into Xcode 4 that generates a C header from a descriptor file. In Xcode 3 it worked to add a custom build step for files with a specific extension. Those files then get compiled before the .m/.mm/.cpp files that included them. When I try to do this with Xcode 4 it seems like it runs my custom step after compiling the other source. This doesn't work of course. Is there any way to tell Xcode to run the step before?

Here's a simple repro setup:

enter image description here

My main.m contains a:

#include <mytest.h>

and I've added ${DERIVED_FILE_DIR} to the header search path. When I compile this project I get the following:

enter image description here

If I remove the include and build it again I get this:

enter image description here

So the rule is indeed working, but it's executed way too late. Is there any way to change this behavior?

like image 224
user408952 Avatar asked Dec 10 '11 16:12

user408952


1 Answers

I already have my Revival badge, but here goes :)

I just ran into this problem, and the answer is simple ( now I've spent a half a day staring at it).

The build rule is responding to the source file (.abc), and the source file is being processed in the order it is listed in the 'Compile Sources' build step. Simply go into the build rule and drag the .abc to the top of the list.

One small step towards my archeologist badge, I hope.

like image 170
Gordon Dove Avatar answered Sep 20 '22 10:09

Gordon Dove