Skip to content

Commit

Permalink
Try #1112: --target *android*
Browse files Browse the repository at this point in the history
  • Loading branch information
bors[bot] authored Nov 4, 2022
2 parents 35a1e17 + 6abdfec commit 54b782b
Show file tree
Hide file tree
Showing 8 changed files with 176 additions and 96 deletions.
16 changes: 16 additions & 0 deletions ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,22 @@ main() {

rm -rf "${td}"
fi

# tst cmake support
td="$(mkcargotemp -d)"

git clone --depth 1 https://github.com/cross-rs/rust-cmake-hello-world "${td}"

pushd "${td}"
retry cargo fetch
if (( ${RUN:-0} )); then
cross_run --target "${TARGET}"
else
"${CROSS[@]}" build --target "${TARGET}" ${CROSS_FLAGS}
fi
popd

rm -rf "${td}"
}

cross_run() {
Expand Down
38 changes: 22 additions & 16 deletions docker/Dockerfile.aarch64-linux-android
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,34 @@ COPY android $PYTHON_TMPDIR
RUN /android-system.sh arm64

ENV CROSS_SYSROOT=/android-ndk/sysroot
ENV CROSS_ANDROID_SDK=$ANDROID_SDK
ENV CROSS_ANDROID_ARCH=aarch64
ENV CROSS_ANDROID_TARGET=aarch64-linux-android
COPY android-symlink.sh /
RUN /android-symlink.sh aarch64 aarch64-linux-android
RUN /android-symlink.sh $CROSS_ANDROID_ARCH $CROSS_ANDROID_TARGET

COPY android-runner /

COPY android.cmake /opt/android.cmake
ENV CMAKE_TOOLCHAIN_FILE=/opt/android.cmake

# Libz is distributed in the android ndk, but for some unknown reason it is not
# found in the build process of some crates, so we explicit set the DEP_Z_ROOT
ENV CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=aarch64-linux-android-gcc \
CARGO_TARGET_AARCH64_LINUX_ANDROID_RUNNER="/android-runner aarch64" \
AR_aarch64_linux_android=aarch64-linux-android-ar \
AS_aarch64_linux_android=aarch64-linux-android-as \
CC_aarch64_linux_android=aarch64-linux-android-gcc \
CXX_aarch64_linux_android=aarch64-linux-android-g++ \
LD_aarch64_linux_android=aarch64-linux-android-ld \
NM_aarch64_linux_android=aarch64-linux-android-nm \
OBJCOPY_aarch64_linux_android=aarch64-linux-android-objcopy \
OBJDUMP_aarch64_linux_android=aarch64-linux-android-objdump \
RANLIB_aarch64_linux_android=aarch64-linux-android-ranlib \
READELF_aarch64_linux_android=aarch64-linux-android-readelf \
SIZE_aarch64_linux_android=aarch64-linux-android-size \
STRINGS_aarch64_linux_android=aarch64-linux-android-strings \
STRIP_aarch64_linux_android=aarch64-linux-android-strip \
ENV CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="$CROSS_ANDROID_TARGET-gcc" \
CARGO_TARGET_AARCH64_LINUX_ANDROID_RUNNER="/android-runner $CROSS_ANDROID_ARCH" \
AR_aarch64_linux_android="$CROSS_ANDROID_TARGET-ar" \
AS_aarch64_linux_android="$CROSS_ANDROID_TARGET-as" \
CC_aarch64_linux_android="$CROSS_ANDROID_TARGET-gcc" \
CXX_aarch64_linux_android="$CROSS_ANDROID_TARGET-g++" \
LD_aarch64_linux_android="$CROSS_ANDROID_TARGET-ld" \
NM_aarch64_linux_android="$CROSS_ANDROID_TARGET-nm" \
OBJCOPY_aarch64_linux_android="$CROSS_ANDROID_TARGET-objcopy" \
OBJDUMP_aarch64_linux_android="$CROSS_ANDROID_TARGET-objdump" \
RANLIB_aarch64_linux_android="$CROSS_ANDROID_TARGET-ranlib" \
READELF_aarch64_linux_android="$CROSS_ANDROID_TARGET-readelf" \
SIZE_aarch64_linux_android="$CROSS_ANDROID_TARGET-size" \
STRINGS_aarch64_linux_android="$CROSS_ANDROID_TARGET-strings" \
STRIP_aarch64_linux_android="$CROSS_ANDROID_TARGET-strip" \
BINDGEN_EXTRA_CLANG_ARGS_aarch64_linux_android="--sysroot=$CROSS_SYSROOT" \
DEP_Z_INCLUDE="$CROSS_SYSROOT/usr/include"/ \
RUST_TEST_THREADS=1 \
Expand Down
38 changes: 22 additions & 16 deletions docker/Dockerfile.arm-linux-androideabi
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,34 @@ COPY android $PYTHON_TMPDIR
RUN /android-system.sh arm

ENV CROSS_SYSROOT=/android-ndk/sysroot
ENV CROSS_ANDROID_SDK=$ANDROID_SDK
ENV CROSS_ANDROID_ARCH=arm
ENV CROSS_ANDROID_TARGET=arm-linux-androideabi
COPY android-symlink.sh /
RUN /android-symlink.sh arm arm-linux-androideabi
RUN /android-symlink.sh $CROSS_ANDROID_ARCH $CROSS_ANDROID_TARGET

COPY android-runner /

COPY android.cmake /opt/android.cmake
ENV CMAKE_TOOLCHAIN_FILE=/opt/android.cmake

# Libz is distributed in the android ndk, but for some unknown reason it is not
# found in the build process of some crates, so we explicit set the DEP_Z_ROOT
ENV CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER=arm-linux-androideabi-gcc \
CARGO_TARGET_ARM_LINUX_ANDROIDEABI_RUNNER="/android-runner arm" \
AR_arm_linux_androideabi=arm-linux-androideabi-ar \
AS_arm_linux_androideabi=arm-linux-androideabi-as \
CC_arm_linux_androideabi=arm-linux-androideabi-gcc \
CXX_arm_linux_androideabi=arm-linux-androideabi-g++ \
LD_arm_linux_androideabi=arm-linux-androideabi-ld \
NM_arm_linux_androideabi=arm-linux-androideabi-nm \
OBJCOPY_arm_linux_androideabi=arm-linux-androideabi-objcopy \
OBJDUMP_arm_linux_androideabi=arm-linux-androideabi-objdump \
RANLIB_arm_linux_androideabi=arm-linux-androideabi-ranlib \
READELF_arm_linux_androideabi=arm-linux-androideabi-readelf \
SIZE_arm_linux_androideabi=arm-linux-androideabi-size \
STRINGS_arm_linux_androideabi=arm-linux-androideabi-strings \
STRIP_arm_linux_androideabi=arm-linux-androideabi-strip \
ENV CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER="$CROSS_ANDROID_TARGET-gcc" \
CARGO_TARGET_ARM_LINUX_ANDROIDEABI_RUNNER="/android-runner $CROSS_ANDROID_ARCH" \
AR_arm_linux_androideabi="$CROSS_ANDROID_TARGET-ar" \
AS_arm_linux_androideabi="$CROSS_ANDROID_TARGET-as" \
CC_arm_linux_androideabi="$CROSS_ANDROID_TARGET-gcc" \
CXX_arm_linux_androideabi="$CROSS_ANDROID_TARGET-g++" \
LD_arm_linux_androideabi="$CROSS_ANDROID_TARGET-ld" \
NM_arm_linux_androideabi="$CROSS_ANDROID_TARGET-nm" \
OBJCOPY_arm_linux_androideabi="$CROSS_ANDROID_TARGET-objcopy" \
OBJDUMP_arm_linux_androideabi="$CROSS_ANDROID_TARGET-objdump" \
RANLIB_arm_linux_androideabi="$CROSS_ANDROID_TARGET-ranlib" \
READELF_arm_linux_androideabi="$CROSS_ANDROID_TARGET-readelf" \
SIZE_arm_linux_androideabi="$CROSS_ANDROID_TARGET-size" \
STRINGS_arm_linux_androideabi="$CROSS_ANDROID_TARGET-strings" \
STRIP_arm_linux_androideabi="$CROSS_ANDROID_TARGET-strip" \
BINDGEN_EXTRA_CLANG_ARGS_arm_linux_androideabi="--sysroot=$CROSS_SYSROOT" \
DEP_Z_INCLUDE="$CROSS_SYSROOT/usr/include/" \
RUST_TEST_THREADS=1 \
Expand Down
38 changes: 22 additions & 16 deletions docker/Dockerfile.armv7-linux-androideabi
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,34 @@ COPY android $PYTHON_TMPDIR
RUN /android-system.sh arm

ENV CROSS_SYSROOT=/android-ndk/sysroot
ENV CROSS_ANDROID_SDK=$ANDROID_SDK
ENV CROSS_ANDROID_ARCH=arm
ENV CROSS_ANDROID_TARGET=arm-linux-androideabi
COPY android-symlink.sh /
RUN /android-symlink.sh arm arm-linux-androideabi
RUN /android-symlink.sh $CROSS_ANDROID_ARCH $CROSS_ANDROID_TARGET

COPY android-runner /

COPY android.cmake /opt/android.cmake
ENV CMAKE_TOOLCHAIN_FILE=/opt/android.cmake

# Libz is distributed in the android ndk, but for some unknown reason it is not
# found in the build process of some crates, so we explicit set the DEP_Z_ROOT
ENV CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER=arm-linux-androideabi-gcc \
CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_RUNNER="/android-runner arm" \
AR_armv7_linux_androideabi=arm-linux-androideabi-ar \
AS_armv7_linux_androideabi=arm-linux-androideabi-as \
CC_armv7_linux_androideabi=arm-linux-androideabi-gcc \
CXX_armv7_linux_androideabi=arm-linux-androideabi-g++ \
LD_armv7_linux_androideabi=arm-linux-androideabi-ld \
NM_armv7_linux_androideabi=arm-linux-androideabi-nm \
OBJCOPY_armv7_linux_androideabi=arm-linux-androideabi-objcopy \
OBJDUMP_armv7_linux_androideabi=arm-linux-androideabi-objdump \
RANLIB_armv7_linux_androideabi=arm-linux-androideabi-ranlib \
READELF_armv7_linux_androideabi=arm-linux-androideabi-readelf \
SIZE_armv7_linux_androideabi=arm-linux-androideabi-size \
STRINGS_armv7_linux_androideabi=arm-linux-androideabi-strings \
STRIP_armv7_linux_androideabi=arm-linux-androideabi-strip \
ENV CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER="$CROSS_ANDROID_TARGET-gcc" \
CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_RUNNER="/android-runner $CROSS_ANDROID_ARCH" \
AR_armv7_linux_androideabi="$CROSS_ANDROID_TARGET-ar" \
AS_armv7_linux_androideabi="$CROSS_ANDROID_TARGET-as" \
CC_armv7_linux_androideabi="$CROSS_ANDROID_TARGET-gcc" \
CXX_armv7_linux_androideabi="$CROSS_ANDROID_TARGET-g++" \
LD_armv7_linux_androideabi="$CROSS_ANDROID_TARGET-ld" \
NM_armv7_linux_androideabi="$CROSS_ANDROID_TARGET-nm" \
OBJCOPY_armv7_linux_androideabi="$CROSS_ANDROID_TARGET-objcopy" \
OBJDUMP_armv7_linux_androideabi="$CROSS_ANDROID_TARGET-objdump" \
RANLIB_armv7_linux_androideabi="$CROSS_ANDROID_TARGET-ranlib" \
READELF_armv7_linux_androideabi="$CROSS_ANDROID_TARGET-readelf" \
SIZE_armv7_linux_androideabi="$CROSS_ANDROID_TARGET-size" \
STRINGS_armv7_linux_androideabi="$CROSS_ANDROID_TARGET-strings" \
STRIP_armv7_linux_androideabi="$CROSS_ANDROID_TARGET-strip" \
BINDGEN_EXTRA_CLANG_ARGS_armv7_linux_androideabi="--sysroot=$CROSS_SYSROOT" \
DEP_Z_INCLUDE="$CROSS_SYSROOT/usr/include/" \
RUST_TEST_THREADS=1 \
Expand Down
38 changes: 22 additions & 16 deletions docker/Dockerfile.i686-linux-android
Original file line number Diff line number Diff line change
Expand Up @@ -41,28 +41,34 @@ COPY android $PYTHON_TMPDIR
RUN /android-system.sh x86

ENV CROSS_SYSROOT=/android-ndk/sysroot
ENV CROSS_ANDROID_SDK=$ANDROID_SDK
ENV CROSS_ANDROID_ARCH=i686
ENV CROSS_ANDROID_TARGET=i686-linux-android
COPY android-symlink.sh /
RUN /android-symlink.sh i386 i686-linux-android
RUN /android-symlink.sh i386 $CROSS_ANDROID_TARGET

COPY android-runner /

COPY android.cmake /opt/android.cmake
ENV CMAKE_TOOLCHAIN_FILE=/opt/android.cmake

# Libz is distributed in the android ndk, but for some unknown reason it is not
# found in the build process of some crates, so we explicit set the DEP_Z_ROOT
ENV CARGO_TARGET_I686_LINUX_ANDROID_LINKER=i686-linux-android-gcc \
CARGO_TARGET_I686_LINUX_ANDROID_RUNNER="/android-runner i686" \
AR_i686_linux_android=i686-linux-android-ar \
AS_i686_linux_android=i686-linux-android-as \
CC_i686_linux_android=i686-linux-android-gcc \
CXX_i686_linux_android=i686-linux-android-g++ \
LD_i686_linux_android=i686-linux-android-ld \
NM_i686_linux_android=i686-linux-android-nm \
OBJCOPY_i686_linux_android=i686-linux-android-objcopy \
OBJDUMP_i686_linux_android=i686-linux-android-objdump \
RANLIB_i686_linux_android=i686-linux-android-ranlib \
READELF_i686_linux_android=i686-linux-android-readelf \
SIZE_i686_linux_android=i686-linux-android-size \
STRINGS_i686_linux_android=i686-linux-android-strings \
STRIP_i686_linux_android=i686-linux-android-strip \
ENV CARGO_TARGET_I686_LINUX_ANDROID_LINKER="$CROSS_ANDROID_TARGET-gcc" \
CARGO_TARGET_I686_LINUX_ANDROID_RUNNER="/android-runner $CROSS_ANDROID_ARCH" \
AR_i686_linux_android="$CROSS_ANDROID_TARGET-ar" \
AS_i686_linux_android="$CROSS_ANDROID_TARGET-as" \
CC_i686_linux_android="$CROSS_ANDROID_TARGET-gcc" \
CXX_i686_linux_android="$CROSS_ANDROID_TARGET-g++" \
LD_i686_linux_android="$CROSS_ANDROID_TARGET-ld" \
NM_i686_linux_android="$CROSS_ANDROID_TARGET-nm" \
OBJCOPY_i686_linux_android="$CROSS_ANDROID_TARGET-objcopy" \
OBJDUMP_i686_linux_android="$CROSS_ANDROID_TARGET-objdump" \
RANLIB_i686_linux_android="$CROSS_ANDROID_TARGET-ranlib" \
READELF_i686_linux_android="$CROSS_ANDROID_TARGET-readelf" \
SIZE_i686_linux_android="$CROSS_ANDROID_TARGET-size" \
STRINGS_i686_linux_android="$CROSS_ANDROID_TARGET-strings" \
STRIP_i686_linux_android="$CROSS_ANDROID_TARGET-strip" \
BINDGEN_EXTRA_CLANG_ARGS_i686_linux_android="--sysroot=$CROSS_SYSROOT" \
DEP_Z_INCLUDE="$CROSS_SYSROOT/usr/include/" \
LIBZ_SYS_STATIC=1 \
Expand Down
38 changes: 22 additions & 16 deletions docker/Dockerfile.thumbv7neon-linux-androideabi
Original file line number Diff line number Diff line change
Expand Up @@ -33,31 +33,37 @@ COPY android $PYTHON_TMPDIR
RUN /android-system.sh arm

ENV CROSS_SYSROOT=/android-ndk/sysroot
ENV CROSS_ANDROID_SDK=$ANDROID_SDK
ENV CROSS_ANDROID_ARCH=arm
ENV CROSS_ANDROID_TARGET=arm-linux-androideabi
COPY android-symlink.sh /
RUN /android-symlink.sh arm arm-linux-androideabi
RUN /android-symlink.sh $CROSS_ANDROID_ARCH $CROSS_ANDROID_TARGET

COPY android-runner /

COPY android.cmake /opt/android.cmake
ENV CMAKE_TOOLCHAIN_FILE=/opt/android.cmake

# Libz is distributed in the android ndk, but for some unknown reason it is not
# found in the build process of some crates, so we explicit set the DEP_Z_ROOT
# likewise, the toolchains expect the prefix `thumbv7neon-linux-androideabi`,
# which we don't have, so just export every possible variable, such as AR.
# Also export all target binutils just in case required.
ENV CARGO_TARGET_THUMBV7NEON_LINUX_ANDROIDEABI_LINKER=arm-linux-androideabi-gcc \
CARGO_TARGET_THUMBV7NEON_LINUX_ANDROIDEABI_RUNNER="/android-runner arm" \
AR_thumbv7neon_linux_androideabi=arm-linux-androideabi-ar \
AS_thumbv7neon_linux_androideabi=arm-linux-androideabi-as \
CC_thumbv7neon_linux_androideabi=arm-linux-androideabi-gcc \
CXX_thumbv7neon_linux_androideabi=arm-linux-androideabi-g++ \
LD_thumbv7neon_linux_androideabi=arm-linux-androideabi-ld \
NM_thumbv7neon_linux_androideabi=arm-linux-androideabi-nm \
OBJCOPY_thumbv7neon_linux_androideabi=arm-linux-androideabi-objcopy \
OBJDUMP_thumbv7neon_linux_androideabi=arm-linux-androideabi-objdump \
RANLIB_thumbv7neon_linux_androideabi=arm-linux-androideabi-ranlib \
READELF_thumbv7neon_linux_androideabi=arm-linux-androideabi-readelf \
SIZE_thumbv7neon_linux_androideabi=arm-linux-androideabi-size \
STRINGS_thumbv7neon_linux_androideabi=arm-linux-androideabi-strings \
STRIP_thumbv7neon_linux_androideabi=arm-linux-androideabi-strip \
ENV CARGO_TARGET_THUMBV7NEON_LINUX_ANDROIDEABI_LINKER="$CROSS_ANDROID_TARGET-gcc" \
CARGO_TARGET_THUMBV7NEON_LINUX_ANDROIDEABI_RUNNER="/android-runner $CROSS_ANDROID_ARCH" \
AR_thumbv7neon_linux_androideabi="$CROSS_ANDROID_TARGET-ar" \
AS_thumbv7neon_linux_androideabi="$CROSS_ANDROID_TARGET-as" \
CC_thumbv7neon_linux_androideabi="$CROSS_ANDROID_TARGET-gcc" \
CXX_thumbv7neon_linux_androideabi="$CROSS_ANDROID_TARGET-g++" \
LD_thumbv7neon_linux_androideabi="$CROSS_ANDROID_TARGET-ld" \
NM_thumbv7neon_linux_androideabi="$CROSS_ANDROID_TARGET-nm" \
OBJCOPY_thumbv7neon_linux_androideabi="$CROSS_ANDROID_TARGET-objcopy" \
OBJDUMP_thumbv7neon_linux_androideabi="$CROSS_ANDROID_TARGET-objdump" \
RANLIB_thumbv7neon_linux_androideabi="$CROSS_ANDROID_TARGET-ranlib" \
READELF_thumbv7neon_linux_androideabi="$CROSS_ANDROID_TARGET-readelf" \
SIZE_thumbv7neon_linux_androideabi="$CROSS_ANDROID_TARGET-size" \
STRINGS_thumbv7neon_linux_androideabi="$CROSS_ANDROID_TARGET-strings" \
STRIP_thumbv7neon_linux_androideabi="$CROSS_ANDROID_TARGET-strip" \
BINDGEN_EXTRA_CLANG_ARGS_thumbv7neon_linux_androideabi="--sysroot=$CROSS_SYSROOT" \
DEP_Z_INCLUDE="$CROSS_SYSROOT/usr/include/" \
RUST_TEST_THREADS=1 \
Expand Down
38 changes: 22 additions & 16 deletions docker/Dockerfile.x86_64-linux-android
Original file line number Diff line number Diff line change
Expand Up @@ -34,28 +34,34 @@ COPY android $PYTHON_TMPDIR
RUN /android-system.sh x86_64

ENV CROSS_SYSROOT=/android-ndk/sysroot
ENV CROSS_ANDROID_SDK=$ANDROID_SDK
ENV CROSS_ANDROID_ARCH=x86_64
ENV CROSS_ANDROID_TARGET=x86_64-linux-android
COPY android-symlink.sh /
RUN /android-symlink.sh x86_64 x86_64-linux-android
RUN /android-symlink.sh $CROSS_ANDROID_ARCH $CROSS_ANDROID_TARGET

COPY android-runner /

COPY android.cmake /opt/android.cmake
ENV CMAKE_TOOLCHAIN_FILE=/opt/android.cmake

# Libz is distributed in the android ndk, but for some unknown reason it is not
# found in the build process of some crates, so we explicit set the DEP_Z_ROOT
ENV CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER=x86_64-linux-android-gcc \
CARGO_TARGET_X86_64_LINUX_ANDROID_RUNNER="/android-runner x86_64" \
AR_x86_64_linux_android=x86_64-linux-android-ar \
AS_x86_64_linux_android=x86_64-linux-android-as \
CC_x86_64_linux_android=x86_64-linux-android-gcc \
CXX_x86_64_linux_android=x86_64-linux-android-g++ \
LD_x86_64_linux_android=x86_64-linux-android-ld \
NM_x86_64_linux_android=x86_64-linux-android-nm \
OBJCOPY_x86_64_linux_android=x86_64-linux-android-objcopy \
OBJDUMP_x86_64_linux_android=x86_64-linux-android-objdump \
RANLIB_x86_64_linux_android=x86_64-linux-android-ranlib \
READELF_x86_64_linux_android=x86_64-linux-android-readelf \
SIZE_x86_64_linux_android=x86_64-linux-android-size \
STRINGS_x86_64_linux_android=x86_64-linux-android-strings \
STRIP_x86_64_linux_android=x86_64-linux-android-strip \
ENV CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER="$CROSS_ANDROID_TARGET-gcc" \
CARGO_TARGET_X86_64_LINUX_ANDROID_RUNNER="/android-runner $CROSS_ANDROID_ARCH" \
AR_x86_64_linux_android="$CROSS_ANDROID_TARGET-ar" \
AS_x86_64_linux_android="$CROSS_ANDROID_TARGET-as" \
CC_x86_64_linux_android="$CROSS_ANDROID_TARGET-gcc" \
CXX_x86_64_linux_android="$CROSS_ANDROID_TARGET-g++" \
LD_x86_64_linux_android="$CROSS_ANDROID_TARGET-ld" \
NM_x86_64_linux_android="$CROSS_ANDROID_TARGET-nm" \
OBJCOPY_x86_64_linux_android="$CROSS_ANDROID_TARGET-objcopy" \
OBJDUMP_x86_64_linux_android="$CROSS_ANDROID_TARGET-objdump" \
RANLIB_x86_64_linux_android="$CROSS_ANDROID_TARGET-ranlib" \
READELF_x86_64_linux_android="$CROSS_ANDROID_TARGET-readelf" \
SIZE_x86_64_linux_android="$CROSS_ANDROID_TARGET-size" \
STRINGS_x86_64_linux_android="$CROSS_ANDROID_TARGET-strings" \
STRIP_x86_64_linux_android="$CROSS_ANDROID_TARGET-strip" \
BINDGEN_EXTRA_CLANG_ARGS_x86_64_linux_android="--sysroot=$CROSS_SYSROOT" \
DEP_Z_INCLUDE="$CROSS_SYSROOT/usr/include/" \
RUST_TEST_THREADS=1 \
Expand Down
28 changes: 28 additions & 0 deletions docker/android.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# toolchain file for android targets, see #1110

set(CMAKE_SYSTEM_NAME Android)
set(CMAKE_SYSTEM_PROCESSOR "$ENV{CROSS_ANDROID_ARCH}")
set(CMAKE_ANDROID_STANDALONE_TOOLCHAIN /android-ndk)
set(CMAKE_ANDROID_API "$ENV{CROSS_ANDROID_SDK}")

# not all of these are standard, however, they're common enough
# that it's good practice to define them.
set(prefix "$ENV{CROSS_ANDROID_TARGET}")
set(CMAKE_C_COMPILER "/android-ndk/bin/${prefix}-gcc")
set(CMAKE_ASM_COMPILER "/android-ndk/bin/${prefix}-gcc")
set(CMAKE_CXX_COMPILER "/android-ndk/bin/${prefix}-g++")
set(CMAKE_AR "/android-ndk/bin/${prefix}-ar")
set(CMAKE_LINKER "/android-ndk/bin/${prefix}-ld")
set(CMAKE_NM "/android-ndk/bin/${prefix}-nm")
set(CMAKE_OBJCOPY "/android-ndk/bin/${prefix}-objcopy")
set(CMAKE_OBJDUMP "/android-ndk/bin/${prefix}-objdump")
set(CMAKE_RANLIB "/android-ndk/bin/${prefix}-ranlib")
set(CMAKE_STRIP "/android-ndk/bin/${prefix}-strip")

# required because otherwise it tries to detect compiler features
# from `/android-ndk/bin/clang`, which fails. these macros are
# technically deprecated, but required for proper function
include(CMakeForceCompiler)
set(CMAKE_WARN_DEPRECATED FALSE)
CMAKE_FORCE_C_COMPILER("${CMAKE_C_COMPILER}" GNU)
CMAKE_FORCE_CXX_COMPILER("${CMAKE_CXX_COMPILER}" GNU)

0 comments on commit 54b782b

Please sign in to comment.