xref: /aosp_15_r20/external/pytorch/tools/gen_flatbuffers.sh (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1#!/bin/bash
2ROOT=$(pwd)
3FF_LOCATION="$ROOT/third_party/flatbuffers"
4cd "$FF_LOCATION" || exit
5mkdir build
6cd build || exit
7cmake ..
8cmake --build . --target flatc
9mkdir -p "$ROOT/build/torch/csrc/jit/serialization"
10./flatc --cpp --gen-mutable --scoped-enums \
11     -o "$ROOT/torch/csrc/jit/serialization" \
12     -c "$ROOT/torch/csrc/jit/serialization/mobile_bytecode.fbs"
13echo '// @generated' >> "$ROOT/torch/csrc/jit/serialization/mobile_bytecode_generated.h"
14cd "$ROOT" || exit
15exit
16