mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-30 16:17:51 +08:00
55be137d5b
* Android: add docs/examples/vcpkg_android_example_cmake/ * Add docs/users/android.md * Improve Android prefab doc Following additional informations given by @atkawa7 at https://github.com/microsoft/vcpkg/pull/11264 * Link to android.md * Update the prefab usage instructions: "vcpkg install" the 4 archs before exporting a prefab * added --prefab-debug flag * added gradle integration info * reviewed the prefab output directory structure (from a dump of an actual export) * docs/users/triplets.md: link to android.md * docs/index.md: link to android.md * android.md: specify 2 possibiities for android_ndk_home * Added examples/vcpkg_android_example_cmake_script/cmake/vcpkg_android.cmake Usage: 1. Main CMakeLists: if (VCPKG_TARGET_ANDROID) include("cmake/vcpkg_android.cmake") endif() 2. cmake invocation: cmake .. -DVCPKG_TARGET_ANDROID=ON -DANDROID_ABI=armeabi-v7a * trigger pipeline build * trigger pipelines
55 lines
1.1 KiB
Bash
Executable File
55 lines
1.1 KiB
Bash
Executable File
#
|
|
# 1. Check the presence of required environment variables
|
|
#
|
|
if [ -z ${ANDROID_NDK_HOME+x} ]; then
|
|
echo "Please set ANDROID_NDK_HOME"
|
|
exit 1
|
|
fi
|
|
if [ -z ${VCPKG_ROOT+x} ]; then
|
|
echo "Please set VCPKG_ROOT"
|
|
exit 1
|
|
fi
|
|
|
|
#
|
|
# 2. Set the path to the toolchains
|
|
#
|
|
vcpkg_toolchain_file=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake
|
|
android_toolchain_file=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake
|
|
|
|
|
|
#
|
|
# 3. Select a pair "Android abi" / "vcpkg triplet"
|
|
# Uncomment one of the four possibilities below
|
|
#
|
|
|
|
android_abi=armeabi-v7a
|
|
vcpkg_target_triplet=arm-android
|
|
|
|
# android_abi=x86
|
|
# vcpkg_target_triplet=x86-android
|
|
|
|
# android_abi=arm64-v8a
|
|
# vcpkg_target_triplet=arm64-android
|
|
|
|
# android_abi=x86_64
|
|
# vcpkg_target_triplet=x64-android
|
|
|
|
|
|
#
|
|
# 4. Install the library via vcpkg
|
|
#
|
|
$VCPKG_ROOT/vcpkg install jsoncpp:$vcpkg_target_triplet
|
|
|
|
#
|
|
# 5. Test the build
|
|
#
|
|
rm -rf build
|
|
mkdir build
|
|
cd build
|
|
cmake .. \
|
|
-DCMAKE_TOOLCHAIN_FILE=$vcpkg_toolchain_file \
|
|
-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=$android_toolchain_file \
|
|
-DVCPKG_TARGET_TRIPLET=$vcpkg_target_triplet \
|
|
-DANDROID_ABI=$android_abi
|
|
make
|