• 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
2 Questions about custom (script) build rules
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

2 Questions about custom (script) build rules


  • Subject: 2 Questions about custom (script) build rules
  • From: Motti Shneor <email@hidden>
  • Date: Thu, 27 Oct 2016 02:17:23 +0300

Hello everyone.

I have setup a custom build rule for google protobuf (the protoc compiler) on an Xcode target that builds a Mac Framework.

The protoc compiler takes an input file with .proto extension (e.g. foofoo.proto) , and generates a foofoo.pb.cc and foofoo.pb.h source pair, in the Derived sources directory.

The rule looks basically like this: 

Process Source files with names matching: *.proto
Using Custom Script:

#!/bin/bash
proto_dir=${SRCROOT}/protobuf-2.6.1/proto
dllexport_def="__attribute__((visibility (\"default\")))"
cd ${INPUT_FILE_DIR}
/usr/bin/protoc -I${proto_dir} --proto_path=${INPUT_FILE_DIR} --cpp_out=dllexport_decl="${dllexport_def}":${DERIVED_FILE_DIR} ${INPUT_FILE_PATH}

Output files:
$(DERIVED_FILE_DIR)/$(INPUT_FILE_BASE).pb.cc
$(DERIVED_FILE_DIR)/$(INPUT_FILE_BASE).pb.h

Indeed the rule works, sources are generated, and are then automatically compiled (using C++ compiler) into my framework target. 


1. Creating a framework, I would like to make the generated headers (.pb.h files) public - so they’re automatically copied to the framework’s headers directory.  Unfortunately, I only found a way to set the visibility scope of header files (Pritave/Project/Public) via Xcode UI, when they are manually added to the project, and I see their references. Is there a decent way to do this?

2. Is it possible to setup my rule to generate code outside the ${DERIVED_FILE_DIR}?  in such case, will Xcode continue to compile the generated sources? My attempts have failed so far.

Generally, I just can’t find any official documentation of Xcode custom build rules.

Thank you very much
Motti Shneor.
 _______________________________________________
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: 2 Questions about custom (script) build rules
      • From: Chris Hanson <email@hidden>
  • Prev by Date: Re: SQL Syntax coloring?
  • Next by Date: Mass of weird errors
  • Previous by thread: Re: SQL Syntax coloring?
  • Next by thread: Re: 2 Questions about custom (script) build rules
  • Index(es):
    • Date
    • Thread