LoginSignup
2
1

More than 5 years have passed since last update.

iOS 向けに libyuv をビルドする

Posted at

libyuv をビルドするのに分かりにくかったのでメモ。

セットアップ

libyuv のビルドに chromium のツール(depot tool)が必要です。

depot tool を clone してきてパスを通します。

git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH=`pwd`/depot_tools:"$PATH"

参考:
https://www.chromium.org/developers/how-tos/install-depot-tools

libyuv ソースコードのダウンロード

下記コマンドを実行します。

gclient config https://chromium.googlesource.com/libyuv/libyuv

すると .gclient というファイルができているので.gclient の末尾に target_os=['ios'] を追加。

solutions = [
  { "name"        : "libyuv",
    "url"         : "https://chromium.googlesource.com/libyuv/libyuv",
    "deps_file"   : "DEPS",
    "managed"     : True,
    "custom_deps" : {
    },
    "safesync_url": "",
  },
]
cache_dir = None
target_os=['ios']

その後下記コマンドを実行するとダウンロードできます。

GYP_DEFINES="OS=ios" gclient sync

ビルド

libyuv ディレクトリに入って下記コマンドを実行、テストを走らせます。
#だいたい fat バイナリを使うことが多いと思うので↓を実行。
# armv7 用だけが必要、などの場合はページ下部の参考リンクを参照

GYP_DEFINES="OS=ios target_arch=armv7 target_subarch=both" GYP_CROSSCOMPILE=1 GYP_GENERATOR_FLAGS="output_dir=out_ios" ./gyp_libyuv
ninja -j7 -C out_ios/Release-iphoneos libyuv_unittest

これで libyuv.a ができます。あとは iOS のプロジェクトに D&D して、ヘッダファイルを追加すると API を呼べるようになります。

参考:
https://code.google.com/p/libyuv/wiki/GettingStarted

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1