GithubHelp home page GithubHelp logo

build-protobuf's Introduction

Google Protobuf - Mac OS X and iOS Support

The script in this gist will help you buid the Google Protobuf library for use with Mac OS X and iOS. Other methods (such as homebrew or direct compilation) have issues that prevent their use. The libraries built by this script are universal and support all iOS device architectures including the simluator.

Get the Script

The easiest way to use this script is to simply clone the gist onto your machine using the following command:

$ git clone https://gist.github.com/9487468ae3375d0db0cc.git build-protobuf

Performing the Build

The script will automatically download the tarball from Google Code, so all you need to do is run the script. This will build the 2.6.1 version of Protobuf. The script understands a few command-line options too.

$ cd build-protobuf
$ ./build-protobuf.sh

Add --interactive to the above script if you would like the script to stop after each major operation. This makes it easier to inspect the output from the various steps for potential errors.

Add --master if you would prefer to build from the master branch in the Google Protobuf git repo.

Results

Build results are found in a folder called protobuf-{version}, where {version} will be either 2.6.1 or master. This folder contains bin, include and lib folders.

Integration with Xcode

Create a build rule in your Xcode project with the following settings.

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

cd ${INPUT_FILE_DIR}
${SRCROOT}/Google/protobuf/bin/protoc --proto_path=${INPUT_FILE_DIR} ${INPUT_FILE_PATH} --cpp_out=${DERIVED_FILE_DIR}

Output Files
$(DERIVED_FILE_DIR)/$(INPUT_FILE_BASE).pb.cc
$(DERIVED_FILE_DIR)/$(INPUT_FILE_BASE).pb.h

Depending on where you choose to install the protobuf build, you will need to adjust the path to protoc.

FAQ

Can Protobuf be built using libstdc++?

Unfortunately, the protobuf C++ code is not compatible with libstdc++ at the moment. You must use libc++ instead.

Can you provide a similar script for Android?

No

Why am I gettings all the implicit conversion looses integer precision warnings?

Unfortunately, the code generated by protoc is not 64-bit clean. In practice I have not experienced any issues as a result of this. It would be better if the generated code was reworked for better 64-bit support. This may come with the 3.0 version they are working on now.

build-protobuf's People

Contributors

bennettsmith avatar gubarev avatar jquepi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.