• 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
Build Rule to Call the Google Protocol Buffer Compiler
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Build Rule to Call the Google Protocol Buffer Compiler


  • Subject: Build Rule to Call the Google Protocol Buffer Compiler
  • From: Thomas Wetmore <email@hidden>
  • Date: Sat, 27 Aug 2011 20:24:03 -0400

I've been struggling trying to get a build rule working on Xcode 4.0.2 today, while awaiting Irene's visit. The documentation and Google have not been much help.

My case is simple. I wish to compile some Google protocol buffer specifications into Objective-C classes and then compile those classes into an application. I have a version of the protocol buffer compiler, protoc, that generates Objective-C code as output, and I have a static protocol buffer library that provides all the infrastructure. I have added a build rule to the project that needs the proto files converted into classes and then compiled. The term compile is over loaded here as the first step is to compile the proto files into Objective-C files, and the second step is to use the compiler we know and love. Here is the rule:

http://bartonstreet.com/buildrule/BuildRule.jpg

This means that I want to run the protoc compiler on all out of date source files with a .proto suffix. The script works correctly. If, for example, there is a file named alpha.proto in the project, this rule will create two files, alpha.pb.m and alpha.pb.h, and place them in the DERIVED_FILES_DIR. This happens correctly. The files are there and exactly right.

My understanding (the documentation is abysmal) is that the files that are listed in the Output Files area, as they are toward the bottom of this grab, should then be treated by Xcode using the proper rules for files with their given suffixes. I have a number of projects with yacc files, and this is how the builtin build rule for yacc seem to work. However, instead of compiling these generated Objective-C classes, Xcode instead moves them to the Resources directory. Here is an example build log that shows this. I didn't expand the custom shell script execution step since it runs correctly, but I did expand one of the two copies of the generated files to the resource directory.

http://bartonstreet.com/buildrule/BuildLog.jpg

Any advice out there? Why is Xcode moving these two files to the resources directory instead of compiling them? I'm guessing that it may be the use of .pb.m and .pb.h, instead of vanilla .m and .h as the file suffixes that might be confusing Xcode. But since the generated .pb.m files have include lines that name the .pb.h files explicitly, I can't just willy nilly change the names of the files.

I am also going to try to implement this requirement as a build phase instead of a build rule, to see if I have any more luck. However, the documentation for creating build phases is just as abysmal.

Hope someone has an idea or two. Has anyone seen a discussion or a technical note that might explain what's going on?

Thanks.

Tom Wetmore, Chief Bottle Washer, DeadEnds Software _______________________________________________
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: Build Rule to Call the Google Protocol Buffer Compiler
      • From: Chris Hanson <email@hidden>
    • Re: Build Rule to Call the Google Protocol Buffer Compiler
      • From: Salman Khilji <email@hidden>
    • Re: Build Rule to Call the Google Protocol Buffer Compiler
      • From: David Frantz <email@hidden>
  • Prev by Date: Re: serious problems in GDB / LLDB debugger
  • Next by Date: Re: Build Rule to Call the Google Protocol Buffer Compiler
  • Previous by thread: Re: Disable repository touching
  • Next by thread: Re: Build Rule to Call the Google Protocol Buffer Compiler
  • Index(es):
    • Date
    • Thread