Skip to content

Instantly share code, notes, and snippets.

@umegaya
Created August 30, 2016 02:59
Show Gist options
  • Save umegaya/3f693c7c484e5b8dd2ec56a34d73efd7 to your computer and use it in GitHub Desktop.
Save umegaya/3f693c7c484e5b8dd2ec56a34d73efd7 to your computer and use it in GitHub Desktop.
odb/protobuf docker example
define call_protoc
docker run --rm -v `pwd`:/mgo umegaya/protobuf bash -c "cd /mgo && protoc $1"
endef
define call_odb
docker run --rm -v `pwd`:/mgo umegaya/odb bash -c "cd /mgo && odb -I/usr/include/odb -d $1 -o $(MODEL_OUT_PATH) --generate-query --generate-schema $2"
endef
cproto:
$(call call_protoc,--cpp_out=$(OUT_PATH) $(PROTO_FILE))
$(call call_protoc,--grpc_out=$(OUT_PATH) --plugin=protoc-gen-grpc=`which $(GRPC_CPP_PLUGIN)` $(PROTO_FILE))
sproto:
$(call call_protoc,--cpp_out=$(SV_OUT_PATH) $(PROTO_FILE))
$(call call_protoc,--grpc_out=$(SV_OUT_PATH) --plugin=protoc-gen-grpc=`which $(GRPC_CPP_PLUGIN)` $(PROTO_FILE))
cmodel:
$(call call_odb,sqlite,$(MODEL_PATH)/User.h)
smodel:
$(call call_odb,mysql,$(MODEL_PATH)/User.h)
.PHONY: proto
proto: cproto sproto
model: cmodel smodel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment