Skip to content
Permalink
Browse files

Merge commit '24e096d9f0f424c22b616b43957a5fd310f4ee83' as 'cereal'

  • Loading branch information...
Vehicle Researcher
Vehicle Researcher committed Jun 28, 2019
2 parents f64c4df + 24e096d commit 6651d50c81f902c2ac7e2580f69dd2620781fb7b
Showing with 2,408 additions and 0 deletions.
  1. +6 −0 cereal/.gitignore
  2. +62 −0 cereal/Makefile
  3. +8 −0 cereal/__init__.py
  4. +387 −0 cereal/car.capnp
  5. +26 −0 cereal/generate_javascript.sh
  6. +26 −0 cereal/include/c++.capnp
  7. +28 −0 cereal/include/java.capnp
  8. +39 −0 cereal/install_capnp.sh
  9. +1,773 −0 cereal/log.capnp
  10. +53 −0 cereal/maptile.capnp
@@ -0,0 +1,6 @@
gen
node_modules
package-lock.json
*.pyc
__pycache__

@@ -0,0 +1,62 @@
PWD := $(shell pwd)

SRCS := log.capnp car.capnp

GENS := gen/cpp/car.capnp.c++ gen/cpp/log.capnp.c++
JS := gen/js/car.capnp.js gen/js/log.capnp.js

UNAME_M ?= $(shell uname -m)

GENS += gen/c/car.capnp.c gen/c/log.capnp.c gen/c/include/c++.capnp.h gen/c/include/java.capnp.h

ifeq ($(UNAME_M),x86_64)

ifneq (, $(shell which capnpc-java))
GENS += gen/java/Car.java gen/java/Log.java
else
$(warning capnpc-java not found, skipping java build)
endif

endif


ifeq ($(UNAME_M),aarch64)
CAPNPC=PATH=$(PWD)/../phonelibs/capnp-cpp/aarch64/bin/:$$PATH capnpc
else
CAPNPC=capnpc
endif

.PHONY: all
all: $(GENS)
js: $(JS)

.PHONY: clean
clean:
rm -rf gen
rm -rf node_modules
rm -rf package-lock.json

gen/c/%.capnp.c: %.capnp
@echo "[ CAPNPC C ] $@"
mkdir -p gen/c/
$(CAPNPC) '$<' -o c:gen/c/

gen/js/%.capnp.js: %.capnp
@echo "[ CAPNPC JavaScript ] $@"
mkdir -p gen/js/
sh ./generate_javascript.sh

gen/cpp/%.capnp.c++: %.capnp
@echo "[ CAPNPC C++ ] $@"
mkdir -p gen/cpp/
$(CAPNPC) '$<' -o c++:gen/cpp/

gen/java/Car.java gen/java/Log.java: $(SRCS)
@echo "[ CAPNPC java ] $@"
mkdir -p gen/java/
$(CAPNPC) $^ -o java:gen/java

# c-capnproto needs some empty headers
gen/c/include/c++.capnp.h gen/c/include/java.capnp.h:
mkdir -p gen/c/include
touch '$@'
@@ -0,0 +1,8 @@
import os
import capnp

CEREAL_PATH = os.path.dirname(os.path.abspath(__file__))
capnp.remove_import_hook()

log = capnp.load(os.path.join(CEREAL_PATH, "log.capnp"))
car = capnp.load(os.path.join(CEREAL_PATH, "car.capnp"))

0 comments on commit 6651d50

Please sign in to comment.
You can’t perform that action at this time.