-
Notifications
You must be signed in to change notification settings - Fork 12
Android build
Juan David Adarve edited this page May 9, 2019
·
3 revisions
Following instructions prepare the Android NDK for compiling lluvia.
- Install Android NDK r19 or newer.
- Define the
ANDROID_NDKenvironment variable pointing to the root directory of the NDK. - Build the NDKs shaderc library. From Android developer:
cd $ANDROID_NDK/sources/third_party/shaderc
../../../ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=Android.mk \
APP_STL:=c++_shared APP_ABI=all libshaderc_combined
- Copy a compatible
vulkan.hppheader into$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/vulkan/. For NDK r19c, which definesVK_HEADER_VERSION = 82, the compatiblevulkan.hppheader can be copied from the LunarG 1.1.82.1 SDK version. See https://github.com/android-ndk/ndk/issues/945 for more information.
sudo cp $VULKAN_SDK/include/vulkan/vulkan.hpp \
$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/vulkan/
The utility script tools/ll-build-android can be used to compile lluvia for the different supported ABIs:
tools/ll-build-android --type release build_android
This will create a folder build_android/release containing the compiled static libraries for arm64-v8a, armeabi-v7a, x86 and x86_64 ABIs.
- Include the paths to lluvia's include directories in the
CMakeLists.txtof your app:
include_directories(
<path_to_lluvia>/core/include
<path_to_lluvia>/thirdparty
)
- Add the following libraries to your
target_lib_librariescommand:
target_link_libraries( # Specifies the target library.
<your_target_name>
<path_to_lluvia>/build_android/release/${ANDROID_ABI}/lib/liblluvia-core.a
vulkan)
If you compiled lluvia as Debug tools/ll-build-android --type debug build_android, you need to change the path in target_link_libraries accordingly.