From 6b6a591afe4dcbb6d727775d09458ce9f614bf14 Mon Sep 17 00:00:00 2001 From: David Renshaw Date: Thu, 15 May 2014 22:50:36 -0400 Subject: [PATCH 1/3] figure out how to run this from the command line --- Makefile | 8 +++++--- README.md | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 528646c..6a9376b 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ -CXX=clang++ -std=c++11 -stdlib=libc++ `pkg-config capnp --cflags --libs` +CXX=clang++ +CXX_FLAGS=-std=c++11 -stdlib=libc++ `pkg-config capnp --cflags --libs` CAPNPC_JAVA_SOURCES=generator/src/main/cpp/compiler/capnpc-java.c++ @@ -11,9 +12,10 @@ clean : sbt clean capnpc-java : $(CAPNPC_JAVA_SOURCES) - $(CXX) -I/usr/local/include -g $(CAPNPC_JAVA_SOURCES) -o capnpc-java + $(CXX) $(CXX_FLAGS) -g $(CAPNPC_JAVA_SOURCES) -o capnpc-java addressbook : capnpc-java PWD=pwd + mkdir examples/src/main/generated capnp compile -I$(PWD)/generator/src/main/cpp/compiler --src-prefix=examples/src/main/schema -o./capnpc-java:examples/src/main/generated examples/src/main/schema/addressbook.capnp - sbt examples/"run read" +# sbt examples/"run read" diff --git a/README.md b/README.md index 34d51d6..8381376 100644 --- a/README.md +++ b/README.md @@ -10,3 +10,6 @@ When you first build the project, try running `sbt update gen-idea`. This will b When running `make`, the supporting Java code will be built, and the sample schema will be run through the code generator as well to produce the Java binding. You can find the generated code in `/examples/src/main/generated/Addressbook.java` +``` +echo '(people = [(id = 123, name = "Alice", email = "alice@example.com", employment = (school = "MIT"))])' | capnp encode examples/src/main/schema/addressbook.capnp AddressBook | java -cp generator/target/scala-2.11/classes:examples/target/scala-2.11/classes/ org.capnproto.examples.AddressbookMain read +``` \ No newline at end of file From 7849bdf44106fb8bfc57c07cfcd9da5ed52c9573 Mon Sep 17 00:00:00 2001 From: David Renshaw Date: Thu, 15 May 2014 22:51:52 -0400 Subject: [PATCH 2/3] fix a few things --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6a9376b..e1dba9e 100644 --- a/Makefile +++ b/Makefile @@ -18,4 +18,4 @@ addressbook : capnpc-java PWD=pwd mkdir examples/src/main/generated capnp compile -I$(PWD)/generator/src/main/cpp/compiler --src-prefix=examples/src/main/schema -o./capnpc-java:examples/src/main/generated examples/src/main/schema/addressbook.capnp -# sbt examples/"run read" + sbt examples/"compile" From aadf0e6d23d5b7f86f12432a7c728ae6a86390b5 Mon Sep 17 00:00:00 2001 From: David Renshaw Date: Thu, 15 May 2014 22:53:49 -0400 Subject: [PATCH 3/3] add make command to README --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8381376..70112a5 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,9 @@ When you first build the project, try running `sbt update gen-idea`. This will b When running `make`, the supporting Java code will be built, and the sample schema will be run through the code generator as well to produce the Java binding. You can find the generated code in `/examples/src/main/generated/Addressbook.java` +Example of building and running from the command line: + ``` -echo '(people = [(id = 123, name = "Alice", email = "alice@example.com", employment = (school = "MIT"))])' | capnp encode examples/src/main/schema/addressbook.capnp AddressBook | java -cp generator/target/scala-2.11/classes:examples/target/scala-2.11/classes/ org.capnproto.examples.AddressbookMain read +$ make CXX_FLAGS="-std=c++11 -I/usr/local/include -L/usr/local/lib -lcapnp -lkj" +$ echo '(people = [(id = 123, name = "Alice", email = "alice@example.com", employment = (school = "MIT"))])' | capnp encode examples/src/main/schema/addressbook.capnp AddressBook | java -cp generator/target/scala-2.11/classes:examples/target/scala-2.11/classes/ org.capnproto.examples.AddressbookMain read ``` \ No newline at end of file