Using the CMake NDK to compile FDK-AAC in a Windows environment

Source: Internet
Author: User

One, nonsense

In recent studies, the first step is to compile. We need to compile FFMPAG,X264,FDK_AAC, below is x264, many of the online said are hundreds of years ago, I am the perfect available

Still , I am limited in my ability, but I hope that what I have written will make it more acceptable to more people. I was just in touch. Make a record and hope to be good for other people .
Contact me can directly comment, also can add me qq:11635423

second, dry goods

Preparation: 1.fdk_aac source git clone https://android.googlesource.com/platform/external/aac

3. need to download cmake directly inside the cmd can be, before the FFmpeg and x264 are Cygwin inside. Not now. You need to set the CMAKE environment variable to add to the path

4. Compile the script. This script is understood by itself. Me too smattering--script name:CMakeLists.txt

# source Code:git clone https://ANDROID.GOOGLESOURCE.COM/PLATFORM/EXTERNAL/AAC
Cmake_minimum_required (VERSION2.8)

if(Cmake_system_name strequal Android)
if(Not cmake_system_processor)
Set (Cmake_system_processor armeabi-v7a)
endif ()
if(Not cmake_system_version)
Set (cmake_system_version8)
endif ()
if(Not ndk_toolchain_version)
Set (ndk_toolchain_version4.8)
endif ()

Set (Android_ndk_root $ENV {android_ndk_root})

Find_path (Toolchain_root bin PATHS ${android_ndk_root}/toolchains/arm-linux-androideabi-${ndk_toolchain_version}/ prebuilt/*)

Include (Cmakeforcecompiler)

Find_program (Cmake_c_compiler arm-linux-androideabi-gcc PATHS ${toolchain_root}/bin)
Find_program (Cmake_cxx_compiler arm-linux-androideabi-g++ PATHS ${toolchain_root}/bin)
Find_program (Cmake_ar arm-linux-androideabi-ar PATHS ${toolchain_root}/bin)

Cmake_force_c_compiler (${cmake_c_compiler} GNU)
Cmake_force_cxx_compiler (${cmake_cxx_compiler} GNU)

Set (cmake_sysroot ${android_ndk_root}/platforms/android-${cmake_system_version}/arch-arm CACHE PATH "")

Set (Cmake_find_root_path_mode_program only)
Set (Cmake_find_root_path_mode_library only)
Set (Cmake_find_root_path_mode_include only)

endif ()

Project (FDK-AAC)

if (not Include_install_dir)
Set (Include_install_dir INCLUDE)
endif ()

if (not Archive_install_dir)
Set (Archive_install_dir lib/static)
endif ()

if (not is_directory ${fdk_aac_source_dir})
Message (fatal_error "Fdk_aac_source_dir=${fdk_aac_source_dir} is not a DIR")
endif ()

if (cmake_system_name strequal Android)
Add_definitions (
--sysroot=${cmake_sysroot}
-fpic
-march=armv7-a
-mfpu=vfpv3-d16
-dandroid
-mhard-float
-d_ndk_math_no_softfp=1
-lm_hard)
endif ()

Add_definitions (
-fno-rtti
-fno-exceptions)

Set (Source_files)

foreach (subdir
Libaacdec Libaacenc LIBFDK
Libmpegtpdec Libmpegtpenc
Libpcmutils
Libsbrdec Libsbrenc
Libsys)

Set (__inc_dir ${fdk_aac_source_dir}/${subdir}/include)

Include_directories (${__inc_dir})
Install (DIRECTORY ${__inc_dir}/DESTINATION ${include_install_dir}/fdk-aac/)

File (GLOB __src_files
${fdk_aac_source_dir}/${subdir}/src/*.cpp
${FDK_AAC_SOURCE_DIR}/${SUBDIR}/SRC/*.H)
List (APPEND source_files ${__src_files})
Endforeach ()

Add_library (FDK-AAC STATIC
${source_files})

Install (TARGETS FDK-AAC
ARCHIVE DESTINATION ${archive_install_dir})

Third, compile

This compilation is relatively simple, as long as the download cmake. Direct CMake on it.

1. Navigate to the compiled directory

2. Execute cmake command
Cmake-g "MinGW makefiles" -dcmake_system_name=andr
oid-dfdk_aac_source_dir="e:/soft/source/fdk_aac/aac" E:\qupai_code_eclipse\code
\thirdparty\build\fdk-aac-dcmake_make_program=e:\android-ndk-r9c\prebuilt\windo
ws\bin\make. exe

3. CMake--bulid.---J8

Note:dfdk_aac_source_dir= "Your FDK_AAC's source address"

E:\qupai_code_eclipse\code\THIRDPARTY\BUILD\FDK-AAC----This is your CMakeLists.txt . Address

DCMAKE_MAKE_PROGRAM=NDK's Make Address

Related Article

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.