This article describes how to build modules with the Intel C++ Compiler for Android* (ICC) and integrate them into an Android Open Source Project (AOSP) build. A module is typically a shared library or application that will be part of the Android image on the device. Examples are audio/video codecs and multimedia applications.
Building a separate module outside the AOSP build process
Building an Android module with the Intel® C++ Compiler for Android* is similar to building it with the GCC toolchain. Please follow the Getting Started guide to compile the module using the NDK build system or a standalone toolchain.
Copying the prebuilt module into the AOSP image during the build process
Once the module is compiled and linked it can be integrated into the AOSP build process as prebuild library.It will be included into the Android system image.
Create an Android.mk file below the root of the AOSP tree with the following content:
LOCAL_MODULE := <library_name>
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
LOCAL_SRC_FILES := <library_file_name>
The two placeholders <library_name> and <library_file_name> must be filled with the library file name on the host and on the target. Usually they are the same.
Building a module as part of the AOSP build process
Intel provided versions of the AOSP source tree should be already prepared to use ICC as part of the build process. You can determine if you have an ICC enabled source tree by checking if the file <AOSP_ROOT>build/core/icc_config.mk exists.
Configuration of the build environment
Before using the compiler you need to setup the path to the compiler in the file <AOSP_ROOT>build/core/icc_config.mk. Specify the path to ICC by changing the variable TARGET_ICC_TOOLS_PREFIX. For example:
TARGET_ICC_TOOLS_PREFIX := /opt/intel/cc_android_14.0.1.017/bin/
There are a couple of configuration variables that are useful. All of the mentioned variables can be also specified directly on command line as well.
Forces the specified modules to be compiled with ICC regardless of the default compiler.
Forces the specified modules to be compiled with GCC regardless of the default compiler.
Specifies modules that should be compiled with Interprocedural Optimization (IPO) if the module is compiled with ICC
Specifies modules that are not linked against the standard libraries. More details can be found in the documentation. This option should not be changed.
Building a module
If the module which should be compiled with ICC is already configured in the ICC_MODULES variable there is nothing special to do. Just invoke the compilation as usual using:
source build/envsetup.sh lunch make flashfiles
It's also possible to specify the module which should be compiled with ICC directly on the command line:
source build/envsetup.sh lunch make ICC_MODULES=libskia ICC_STATIC_MODULES=libskia ICC_IPO_MODULES=libskia flashfiles
For compilation of modules which are part of AOSP there might be additional patches required. Please contact your Intel representative if you meet any issues.