On Nov 22, 2006, at 2:50 PM, Jeff Ray wrote: I'm new to xcode, so please forgive me if this has an obvious solution.
I have a large, cross-platform application, which I am currently building via makefiles. I am attempting to move it to xcode, and am having trouble translating the notion of creating a source file via a script.
I can create a Run Script target, and make it execute a script that creates a source file (timestamp.cpp). I've even managed to get it to create this file as $DERIVED_FILE_DIR/timestamp.cpp, which the docs seem to suggest is where xcode expects to find such things.
What I can't figure out is how to add a "compile source" build rule, nor how to tell the rull to compile this particular source, nor how to express the dependency to other targets' "link" rules.
Clue for the clueless?
Xcode doesn't have a good mechanism for specifying "this file that doesn't exist yet, but will." So you have to build this up in stages:
1) Write your Run Script build phase 2) Build the project, producing your .cpp output files. 3) Find those output files and add them to your project. Don't check the "Copy into project folder" box. Select the target that's supposed to build them. 4) Build the project. The output library will be linked. 5) Add the produced library to the other target. 6) Build the second target. This should link to the first target library.
To set up the dependencies: 1) In the Run Script build phase, add the names of the input files to the Input Files list and the output files to the Output Files list. This ensures the Run Script build phase gets triggered and that it triggers a recompile of the generated sources. 2) Open the second target, click its Dependencies tab, and drag the first target in. That forces the first target to be brought up to date whenever the second is built.
Chris |