libwebp/README.wasm
James Zern a1ab868427 README.wasm: add android build instructions
Change-Id: I819dc373b20b2d0255bf396de5e9b467166bb9c2
2017-07-19 12:48:29 -07:00

85 lines
2.5 KiB
Plaintext

Description:
============
This file describes the compilation of libwebp using portable intrinsics /
WebAssembly (wasm) to native targets using clang and CMake.
Prerequisites:
==============
- cmake 2.8+
- clang 3.9+ for portable intrinsics support; as wasm progresses a tip of tree
build may be necessary.
Building:
=========
- configure the project with CMake using:
$ mkdir -p build && \
cd build && \
cmake -DWEBP_BUILD_DWEBP=1 -DCMAKE_C_COMPILER=clang -DWEBP_ENABLE_WASM=1 ../
- compile dwebp using 'make'.
- Note this currently generates native executables only and is incompatible
with -DWEBP_BUILD_WEBP_JS.
Cross compilation:
==================
- arm toolchains can be obtained from:
http://www.linaro.org/downloads/
- the android ndk can be obtained from:
https://developer.android.com/ndk/downloads/index.html
armv7:
------
Android:
$ ./android-ndk-r15b/build/tools/make_standalone_toolchain.py \
--arch arm --api 24 --stl gnustl --install-dir /opt/android-arm-24
$ mkdir -p build && cd build
$ cmake ../libwebp \
-DWEBP_BUILD_DWEBP=1 \
-DCMAKE_C_COMPILER=/opt/android-arm-24/bin/clang \
-DCMAKE_PREFIX_PATH=/opt/android-arm-24/sysroot/usr/lib \
-DCMAKE_C_FLAGS=-fPIE \
-DCMAKE_EXE_LINKER_FLAGS=-Wl,-pie \
-DCMAKE_BUILD_TYPE=Release \
-DWEBP_ENABLE_WASM=1
Linux:
$ gcc_arm=/opt/gcc-arm; target=arm-linux-gnueabihf
$ mkdir -p build && cd build
$ cmake ../libwebp -DWEBP_BUILD_DWEBP=1 -DWEBP_ENABLE_WASM=1 \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_C_FLAGS="--target=$target --gcc-toolchain=$gcc_arm --sysroot=$gcc_arm/$target/libc -march=armv7-a -mfpu=neon" \
-DCMAKE_PREFIX_PATH=$gcc_arm/$target/libc/usr
aarch64 / arm64:
----------------
Android:
$ ./android-ndk-r15b/build/tools/make_standalone_toolchain.py \
--arch arm64 --api 24 --stl gnustl --install-dir /opt/android-arm64-24
$ mkdir -p build && cd build
$ cmake ../libwebp \
-DWEBP_BUILD_DWEBP=1 \
-DCMAKE_C_COMPILER=/opt/android-arm64-24/bin/clang \
-DCMAKE_PREFIX_PATH=/opt/android-arm64-24/sysroot/usr/lib \
-DCMAKE_C_FLAGS=-fPIE \
-DCMAKE_EXE_LINKER_FLAGS=-Wl,-pie \
-DCMAKE_BUILD_TYPE=Release \
-DWEBP_ENABLE_WASM=1
Linux:
$ gcc_arm=/opt/gcc-aarch64; target=aarch64-linux-gnu
$ mkdir -p build && cd build
$ cmake ../libwebp -DWEBP_BUILD_DWEBP=1 -DWEBP_ENABLE_WASM=1 \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_C_FLAGS="--target=$target --gcc-toolchain=$gcc_arm --sysroot=$gcc_arm/$target/libc" \
-DCMAKE_PREFIX_PATH=$gcc_arm/$target/libc/usr