🏗️

tfliteをMacOS用にビルド

2024/11/26に公開

tflite_flutter使っててTFLiteを自分でビルドしないといけなかったのでメモ。

CMakeをインストール

単純に指示にそう
https://cmake.org/download/

前準備

git clone https://github.com/tensorflow/tensorflow.git tensorflow_src
mkdir tflite_build
cd tflite_build
mkdir x86_64
mkdir arm64

ビルド

cd x86_64
cmake ../../tensorflow_src/tensorflow/lite/c -DCMAKE_OSX_ARCHITECTURES="x86_64"
cmake --build . -j

cd ../arm64
cmake ../../tensorflow_src/tensorflow/lite/c -DCMAKE_OSX_ARCHITECTURES="arm64"
cmake --build . -j

#cmake ../tensorflow_src/tensorflow/lite -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"

参考

https://pub.dev/packages/tflite_flutter#macos
https://www.tensorflow.org/lite/guide/build_cmake?hl=ja#build_tensorflow_lite_c_library

Discussion