diff options
| author | Oskari Timperi <oskari.timperi@iki.fi> | 2018-04-11 21:44:57 +0300 |
|---|---|---|
| committer | Oskari Timperi <oskari.timperi@iki.fi> | 2018-04-11 21:44:57 +0300 |
| commit | 1e7e3f6b331c2030e908c6aed515ca4d407559f7 (patch) | |
| tree | c881802fbe1942b16735d95e0dc327ad42449716 | |
| parent | c872f7d65b74f5f46a85a8df927af86c5178ad8a (diff) | |
| download | nimpb_protoc-1e7e3f6b331c2030e908c6aed515ca4d407559f7.tar.gz nimpb_protoc-1e7e3f6b331c2030e908c6aed515ca4d407559f7.zip | |
Update README.md
| -rw-r--r-- | README.md | 55 |
1 files changed, 5 insertions, 50 deletions
@@ -1,58 +1,13 @@ -# nimpb_build +# nimpb_protoc -**NOTE** nimpb_build is still experimental :-) +This repo contains protoc binaries for most common platforms, for easy usage +with [nimpb](https://github.com/oswjk/nimpb). The actual code generation is +in nimpb. -A tool for generating suitable Nim code for -[nimpb](https://github.com/oswjk/nimpb). It uses a prebuilt and bundled protoc -compiler. This tool supports the following platforms: +The following platforms are supported: - Linux x86_32 - Linux x86_64 - Linux aarch_64 - OSX x86_64 - Windows - -nimpb_build is modeled somewhat after [prost-build](https://github.com/danburkert/prost). - -# Install with Nimble - - $ nimble install https://github.com/oswjk/nimpb_build - -# Usage - -## As a binary - -Using the tool is simple: - - $ nimpb_build -I. --out=. my.proto - -It's almost like using protoc directly. In fact, the arguments are basically -passed along to protoc. - -You can specify nimpb_build as a dependency for your project in your .nimble -file and create a task for generating code: - - requires "nimpb_build" - - task proto, "Process .proto files": - exec "nimpb_build -I. --out=. my.proto" - -## As a library - -It's also possible to use nimpb_build as a library: - -```nim -import nimpb_build - -let protos = @["my.proto"] -let incdirs = @["."] -let outdir = "." - -compileProtos(protos, incdirs, outdir) -``` - -# How it works - -nimpb_build invokes the protoc compiler with `--descriptor_set_out` parameter, -which makes protoc output a `FileDescriptorSet` (defined [here](src/nimpb_buildpkg/protobuf/include/google/protobuf/descriptor.proto)) into a file. nimpb_build then reads and parses the file, -and generates Nim code from the parsed definitions. |
