Skip to content

Commit

Permalink
meta: package metadata generator instead of raw script
Browse files Browse the repository at this point in the history
to enable easy use for other projects

Signed-off-by: Wataru Ishida <[email protected]>
  • Loading branch information
ishidawataru committed Feb 1, 2022
1 parent b19b277 commit aff8455
Show file tree
Hide file tree
Showing 7 changed files with 220 additions and 129 deletions.
4 changes: 3 additions & 1 deletion docker/builder.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ apt update && DEBIAN_FRONTEND=noninteractive apt install -qy libgrpc++-dev g++ p

RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 10
RUN update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 10
RUN --mount=type=cache,target=/root/.cache,sharing=private pip install grpcio-tools prompt_toolkit clang jinja2 tabulate grpclib
RUN --mount=type=cache,target=/root/.cache,sharing=private pip install grpcio-tools prompt_toolkit tabulate grpclib

RUN `([ $TARGETARCH = arm64 ] && echo /usr/lib/aarch64-linux-gnu > /tmp/lib ) || ([ $TARGETARCH = amd64 ] && echo /usr/lib/x86_64-linux-gnu > /tmp/lib )`

RUN --mount=type=bind,target=/root,rw cd /root && cd tools/meta-generator && pip install .
RUN --mount=type=bind,target=/root,rw cd /root && make -C meta && cp meta/libmetatai.so `cat /tmp/lib` && cp meta/tai*.h /usr/local/include/
RUN --mount=type=bind,target=/root,rw cd /root && make -C tools/framework/examples/basic && cp tools/framework/examples/basic/libtai.so `cat /tmp/lib`/libtai-basic.so
RUN cd `cat /tmp/lib` && ln -s libtai-basic.so libtai.so
Expand Down
4 changes: 2 additions & 2 deletions meta/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
all: taimetadata.c taimetadata.h taiserialize.c taimetadatautils.c
gcc -g3 -Werror -Wall -shared -fPIC -I ../inc taiserialize.c taimetadatautils.c taimetadata.c cJSON.c -o libmetatai.so

taimetadata.c taimetadata.h: main.py $(TAI_META_CUSTOM_FILES) $(wildcard ../inc/*)
python main.py ../inc/tai.h $(TAI_META_CUSTOM_FILES)
taimetadata.c taimetadata.h: $(TAI_META_CUSTOM_FILES) $(wildcard ../inc/*)
tai_meta_generator ../inc/tai.h $(TAI_META_CUSTOM_FILES)

test:
make -C sample
Expand Down
2 changes: 2 additions & 0 deletions tools/meta-generator/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build
*.egg-info
15 changes: 15 additions & 0 deletions tools/meta-generator/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[metadata]
name = tai_meta_generator
version = 0.1.0
description = TAI meta library generator

[options]
packages = find:
install_requires =
clang
jinja2
zip_safe = False

[options.entry_points]
console_scripts =
tai_meta_generator = tai_meta_generator.main:main
3 changes: 3 additions & 0 deletions tools/meta-generator/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from setuptools import setup

setup()
Empty file.
Loading

0 comments on commit aff8455

Please sign in to comment.