LIBYUV compilation (each platform)

Source: Internet
Author: User
Tags mkdir svn centos git clone

Recently used video format transcoding, found that Google's Open Source Library libyuv very useful, so record the compilation process

The compiling process of direct website

Https://chromium.googlesource.com/libyuv/libyuv/+/master/docs/getting_started.md

But I have to spit it out, I just want to compile a libyuv, you have to let me check the Chrome project is a few meaning .... If it's not wrong, it's supposed to be several G Getting Started

How to get and build the LIBYUV code. pre-requisites

You'll need to having depot tools Installed:https://www.chromium.org/developers/how-tos/install-depot-tools Refer to Chromium instructions for each platform to other prerequisites.

Note: Rely on tools, Google this set of things is still relatively good, first to install depottools this is not much to say, the command line on the line, the most important thing is after the download is done to have

Export path= ' pwd '/depot_tools: ' $PATH ' command enable this tool Getting the Code

Create A working directory, enter it, and run:

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

Description: Set up and synchronize the code, the inside of the script, about how the code is synchronized without concern.


Then you'll get a. gclient file like:

Solutions = [
  {"Name"        : "Libyuv",
    "url"         : "Https://chromium.googlesource.com/libyuv/libyuv",
    " Deps_file "   :" Deps ",
    " managed "     : True,
    " Custom_deps ": {
    },
    " Safesync_url ":" ",
  },
];

for iOS add; target_os=[' iOS ']; To your OSX gclient and run gyp_defines= "Os=ios" Gclient sync.

Browse the Git reprository:https://chromium.googlesource.com/libyuv/libyuv/+/master Android

For Android add; target_os=[' Android ']; To your Linux. gclient

Solutions = [
  {"Name"        : "Libyuv",
    "url"         : "Https://chromium.googlesource.com/libyuv/libyuv",
    " Deps_file "   :" Deps ",
    " managed "     : True,
    " Custom_deps ": {
    },
    " Safesync_url ":" ",
  },
];
Target_os = ["Android", "Unix"];

Then run:

Export gyp_defines= "os=android"
gclient Sync

Caveat:theres an error with Google Play services updates. If you get the error ' Your version of the Google Play Services library is ' not ' up to date ', run the FOLLOWING:CD chromium/ src./build/android/play_services/update.py Download CD. /..

For Windows The Gclient sync must is done from a Administrator command prompt.

The sync would generate native build files for your environment using GYP (windows:visual Studio, Osx:xcode, Linux:make) . This generation can also is forced manually:gclient runhooks

To get just the source (not buildable): Git clone https://chromium.googlesource.com/libyuv/libyuv Building the Librar Y and unittests Windows

Set Gyp_defines=target_arch=ia32 call
python gyp_libyuv-fninja-g msvs_version=2013
ninja-j7-c out\release< C4/>ninja-j7-c Out\debug

Set gyp_defines=target_arch=x64 call
python gyp_libyuv-fninja-g msvs_version=2013< C7/>ninja-c out\debug_x64
ninja-c out\release_x64
Building with CLANGCL
Set gyp_defines=clang=1 target_arch=ia32 libyuv_enable_svn=1
set llvm_repo_url=svn://svn.chromium.org/ Llvm-project call
python tools\clang\scripts\update.py call
python gyp_libyuv-fninja libyuv_test.gyp
Ninja-c out\debug
ninja-c out\release
OSX

Clang the shown bit. Remove clang=1 for GCC and change x64 to IA32 for.

gyp_defines= "Clang=1 target_arch=x64"./gyp_libyuv
ninja-j7-c out/debug
ninja-j7-c out/release

GYP_ defines= "Clang=1 target_arch=ia32"./gyp_libyuv
ninja-j7-c out/debug
ninja-j7-c out/release
IOS

Http://www.chromium.org/developers/how-tos/build-instructions-ios

Add to. Gclient last line:target_os=[' iOS '];

ARMv7

gyp_defines= "Os=ios target_arch=armv7 target_subarch=arm32" gyp_crosscompile=1 gyp_generator_flags= "output_dir=out _ios "./gyp_libyuv
ninja-j7-c out_ios/debug-iphoneos libyuv_unittest
ninja-j7-c Out_ios/release-iphoneos Libyuv_unittest

Arm64

gyp_defines= "Os=ios target_arch=arm64 target_subarch=arm64" gyp_crosscompile=1 gyp_generator_flags= "output_dir=out _ios "./gyp_libyuv
ninja-j7-c out_ios/debug-iphoneos libyuv_unittest
ninja-j7-c Out_ios/release-iphoneos Libyuv_unittest

Both ARMv7 and arm64 (FAT)

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/debug-iphoneos libyuv_unittest
ninja-j7-c Out_ios/release-iphoneos Libyuv_unittest

Simulator

gyp_defines= "Os=ios target_arch=ia32 target_subarch=arm32" gyp_crosscompile=1 gyp_generator_flags= "Output_dir=out_ Sim "./gyp_libyuv
ninja-j7-c out_sim/debug-iphonesimulator libyuv_unittest
ninja-j7-c out_sim/ Release-iphonesimulator Libyuv_unittest
Android

Https://code.google.com/p/chromium/wiki/AndroidBuildInstructions

Add to. Gclient last line:target_os=[' Android ';

ARMv7

Gyp_defines= "Os=android" gyp_crosscompile=1./gyp_libyuv
ninja-j7-c out/debug libyuv_unittest_apk
ninja-j7 -C Out/release libyuv_unittest_apk

Arm64

gyp_defines= "Os=android target_arch=arm64 target_subarch=arm64" gyp_crosscompile=1./GYP_LIBYUV ninja-j7-c out/
Debug libyuv_unittest_apk
ninja-j7-c out/release libyuv_unittest_apk

Ia32

gyp_defines= "Os=android target_arch=ia32" gyp_crosscompile=1./gyp_libyuv
ninja-j7-c out/Debug libyuv_unittest_ APK
ninja-j7-c out/release libyuv_unittest_apk

gyp_defines= "Os=android target_arch=ia32 android_full_debug =1 "gyp_crosscompile=1./gyp_libyuv
ninja-j7-c out/debug libyuv_unittest_apk

Mipsel

gyp_defines= "Os=android Target_arch=mipsel" gyp_crosscompile=1./gyp_libyuv
ninja-j7-c out/Debug libyuv_ unittest_apk
ninja-j7-c out/release libyuv_unittest_apk

Arm32 Disassembly:

third_party/android_tools/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/ Arm-linux-androideabi-objdump-d OUT/RELEASE/OBJ/SOURCE/LIBYUV.ROW_NEON.O

Arm64 Disassembly:

third_party/android_tools/ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/ Aarch64-linux-android-objdump-d OUT/RELEASE/OBJ/SOURCE/LIBYUV.ROW_NEON64.O

Running Tests:

util/android/test_runner.py gtest-s libyuv_unittest-t 7200--verbose--release--gtest_filter=*

Running Test as Benchmark:

util/android/test_runner.py gtest-s libyuv_unittest-t 7200--verbose--release--gtest_filter=*-a "--libyuv_width= --libyuv_height=720--libyuv_repeat=999--libyuv_flags=-1 "

Running Test with C code:

util/android/test_runner.py gtest-s libyuv_unittest-t 7200--verbose--release--gtest_filter=*-a "--libyuv_width= --libyuv_height=720--libyuv_repeat=999--libyuv_flags=1--libyuv_cpu_info=1 "
Building with GN
GN Gen Out/release "--args=is_debug=false target_cpu=\" x86\ "
gn Gen Out/debug"--args=is_debug=true target_cpu=\ " X86\ ""
ninja-c out/release
ninja-c out/debug
Building offical with GN
GN Gen Out/official "--args=is_debug=false is_official_build=true is_chrome_branded=true"
ninja-c out/Official
Linux
Gyp_defines= "target_arch=x64"./gyp_libyuv
ninja-j7-c out/debug ninja-j7-c out/release

GYP_DEFINES= " Target_arch=ia32 "./gyp_libyuv
ninja-j7-c out/debug
ninja-j7-c out/release
CentOS

On CentOS + bit the following work around allows a sync:

Export gyp_defines= "Host_arch=ia32"
gclient Sync
Windows Shared Library

Modify libyuv.gyp from ' static_library ' to ' shared_library ', and add ' libyuv_building_shared_library ' to ' defines '.

Gclient Runhooks

After this command follow the building the library instructions above.

If you get a compile error for atlthunk.lib on Windows, read http://www.chromium.org/developers/how-tos/build-instruction S-windows Build targets

Ninja-c out/debug libyuv
ninja-c out/debug libyuv_unittest
ninja-c out/debug compare ninja-c
out/Debug con Vert
ninja-c out/debug psnr
ninja-c out/debug cpuid
Building the Library with make Linux
MAKE-J7 v=1-f linux.mk
make-j7 v=1-f linux.mk clean make-j7 v=1-f linux.mk cxx=clang++

Building the Library with CMake

Install cmake:http://www.cmake.org/

Default Debug Build:

mkdir out
cd
cmake.
CMake--build.

Release Build/install

mkdir out
cd
cmake-dcmake_install_prefix= "/usr/lib"-dcmake_build_type= "Release"
. CMake--build. --config release
sudo cmake--build.--target Install--config Release
Windows 8 Phone

Pre-requisite:install Visual Studio and ARM to your environment.

Then:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.