Skip to content

Instantly share code, notes, and snippets.

@spencersalazar
Created October 30, 2023 01:29
Show Gist options
  • Save spencersalazar/fbb8095b9f093f058696f156b1d1563d to your computer and use it in GitHub Desktop.
Save spencersalazar/fbb8095b9f093f058696f156b1d1563d to your computer and use it in GitHub Desktop.
Xcode custom build rule (.proto file)
#
# Xcode custom build rule (protobuf .proto source file)
#
# add custom build rule to process "Protobuf source files"
# set to this script
# add to Output Files: $(DERIVED_FILE_DIR)/protobuf/$(INPUT_FILE_BASE).pb.cc
#
set -eu
# note: assumes protobuf installed via homebrew
export PATH=/opt/homebrew/bin:$PATH
OUT_DIR="$DERIVED_FILE_DIR/protobuf"
PROTO_PATH=$(dirname "$SCRIPT_INPUT_FILE")
mkdir -p "$OUT_DIR"
protoc "$SCRIPT_INPUT_FILE" --cpp_out="$OUT_DIR" --proto_path="$PROTO_PATH"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment