Skip to content

Instantly share code, notes, and snippets.

@rektide
Last active December 23, 2015 05:39
Show Gist options
  • Save rektide/6588445 to your computer and use it in GitHub Desktop.
Save rektide/6588445 to your computer and use it in GitHub Desktop.
Cap'n Proto Exploratory Dive Sessions

Cap'n Proto Exploratory Dive Sessions :: I

Hi. We'll be compiling a schema.

Pre-reqs

Only the basics: https://gist.github.com/rektide/6588445#pre-reqs

Compiling schema.capnp

This is the bootstrap schema! The types it encodes are used to define all other types that will ever be made.

In our case, we just want to compile something and see that thing.

Create a working space

mkdir /tmp/dive-i
cd /tmp/dive-i

Add sources

ln -sf $CAPNP_DIR/c++/src/capnp/{schema,c++}.capnp .

Compile

capnp compile -oc++ schema.capnp

Look! Results

ls -l
  lrwxrwxrwx 1 rektide rektide     55 Sep 16 20:31 c++.capnp -> /home/rektide/archive/capnproto/c++/src/capnp/c++.capnp
  lrwxrwxrwx 1 rektide rektide     58 Sep 16 20:35 schema.capnp -> /home/rektide/archive/capnproto/c++/src/capnp/schema.capnp
  -rw-r--r-- 1 rektide rektide 105553 Sep 16 20:36 schema.capnp.c++
  -rw-r--r-- 1 rektide rektide 228700 Sep 16 20:36 schema.capnp.h

These results are available online for viewing, c/o the capn-corpi project. https://github.com/rektide/capn-corpi/tree/master/schema

Cap'n Proto Exploratory Dive Sessions :: Intro

Hi. Welcome. We'll be diving into Cap'n proto.

Pre-reqs

You'll need a checkout, you'll need it compiled, and you'll need an environmental variable.

Checkout

git clone https://github.com/kentonv/capnproto.git
export CAPNP_DIR=`pwd`/capnproto
cd capnproto

Compile

http://kentonv.github.io/capnproto/install.html#building_from_git_with_autotools

cd $CAPNPROTO/c++
./setup-autotools.sh
autoreconf -i
./configure
make -j6 check
sudo make install

Env Variable

Checkout set up an CAPNP_DIR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment