Skip to content

Commit

Permalink
package/ci: add Android x86 GLES2, GLES3 and Vulkan builds on CircleCI.
Browse files Browse the repository at this point in the history
This apparently can test even the GPU! Let's C.
  • Loading branch information
mosra committed Feb 11, 2022
1 parent 8554f39 commit eaa95dd
Show file tree
Hide file tree
Showing 3 changed files with 246 additions and 0 deletions.
86 changes: 86 additions & 0 deletions package/ci/android-x86-gles.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#!/bin/bash
set -ev

git submodule update --init

# Corrade
git clone --depth 1 https://github.com/mosra/corrade.git
cd corrade

# Build native corrade-rc
mkdir build && cd build
cmake .. \
-DCMAKE_INSTALL_PREFIX=$HOME/deps-native \
-DCMAKE_BUILD_TYPE=Release \
-DWITH_INTERCONNECT=OFF \
-DWITH_PLUGINMANAGER=OFF \
-DWITH_TESTSUITE=OFF \
-DWITH_UTILITY=OFF \
-G Ninja
ninja install
cd ..

# Crosscompile Corrade
mkdir build-android-x86 && cd build-android-x86
cmake .. \
-DCMAKE_SYSTEM_NAME=Android \
-DCMAKE_SYSTEM_VERSION=29 \
-DCMAKE_ANDROID_ARCH_ABI=x86 \
-DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang \
-DCMAKE_ANDROID_STL_TYPE=c++_static \
-DCMAKE_BUILD_TYPE=Release \
-DCORRADE_RC_EXECUTABLE=$HOME/deps-native/bin/corrade-rc \
-DCMAKE_INSTALL_PREFIX=$HOME/deps \
-DWITH_INTERCONNECT=OFF \
-G Ninja
ninja install
cd ..

cd ..

# Generate debug keystore for APK signing
keytool -genkeypair -keystore $HOME/.android/debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -validity 10000 -dname CN=,OU=,O=,L=,S=,C=

# Crosscompile
mkdir build-android-x86 && cd build-android-x86
cmake .. \
-DCMAKE_SYSTEM_NAME=Android \
-DCMAKE_SYSTEM_VERSION=29 \
-DCMAKE_ANDROID_ARCH_ABI=x86 \
-DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang \
-DCMAKE_ANDROID_STL_TYPE=c++_static \
-DCMAKE_FIND_ROOT_PATH="/opt/android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot;$HOME/deps" \
-DCMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX=/i686-linux-android/29 \
-DCORRADE_RC_EXECUTABLE=$HOME/deps-native/bin/corrade-rc \
-DCMAKE_INSTALL_PREFIX=$HOME/deps \
-DCMAKE_PREFIX_PATH=$HOME/deps \
-DCMAKE_BUILD_TYPE=Release \
-DTARGET_GLES2=$TARGET_GLES2 \
-DWITH_AUDIO=OFF \
-DWITH_VK=OFF \
-DWITH_ANDROIDAPPLICATION=ON \
-DWITH_EGLCONTEXT=ON \
-DWITH_ANYAUDIOIMPORTER=OFF \
-DWITH_ANYIMAGECONVERTER=ON \
-DWITH_ANYIMAGEIMPORTER=ON \
-DWITH_ANYSCENECONVERTER=ON \
-DWITH_ANYSCENEIMPORTER=ON \
-DWITH_ANYSHADERCONVERTER=ON \
-DWITH_MAGNUMFONT=ON \
-DWITH_MAGNUMFONTCONVERTER=ON \
-DWITH_OBJIMPORTER=ON \
-DWITH_TGAIMAGECONVERTER=ON \
-DWITH_TGAIMPORTER=ON \
-DWITH_WAVAUDIOIMPORTER=OFF \
-DWITH_GL_INFO=ON \
-DBUILD_TESTS=ON \
-DBUILD_GL_TESTS=ON \
-G Ninja
ninja $NINJA_JOBS

# Wait for emulator to start (done in parallel to build) and run tests
circle-android wait-for-boot
CORRADE_TEST_COLOR=ON ctest -V

# Test install, after running the tests as for them it shouldn't be needed
ninja install
107 changes: 107 additions & 0 deletions package/ci/android-x86-vulkan.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#!/bin/bash
set -ev

git submodule update --init

# Corrade
git clone --depth 1 https://github.com/mosra/corrade.git
cd corrade

# Build native corrade-rc
mkdir build && cd build
cmake .. \
-DCMAKE_INSTALL_PREFIX=$HOME/deps-native \
-DCMAKE_BUILD_TYPE=Release \
-DWITH_INTERCONNECT=OFF \
-DWITH_PLUGINMANAGER=OFF \
-DWITH_TESTSUITE=OFF \
-DWITH_UTILITY=OFF \
-G Ninja
ninja install
cd ..

# Crosscompile Corrade
mkdir build-android-x86 && cd build-android-x86
cmake .. \
-DCMAKE_SYSTEM_NAME=Android \
-DCMAKE_SYSTEM_VERSION=29 \
-DCMAKE_ANDROID_ARCH_ABI=x86 \
-DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang \
-DCMAKE_ANDROID_STL_TYPE=c++_static \
-DCMAKE_BUILD_TYPE=Release \
-DCORRADE_RC_EXECUTABLE=$HOME/deps-native/bin/corrade-rc \
-DCMAKE_INSTALL_PREFIX=$HOME/deps \
-DWITH_INTERCONNECT=OFF \
-G Ninja
ninja install
cd ..

cd ..

# Generate debug keystore for APK signing
keytool -genkeypair -keystore $HOME/.android/debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -validity 10000 -dname CN=,OU=,O=,L=,S=,C=

# Crosscompile. Enabling only stuff that's directly affected by Vulkan (which
# means also parts of Platform, which need Trade for icon import in tests),
# disabling everything else. Should be consistent with unix-desktop-vulkan.sh,
# except for features not available on Android like Sdl2 or GlfwApplication.
mkdir build-android-x86 && cd build-android-x86
cmake .. \
-DCMAKE_SYSTEM_NAME=Android \
-DCMAKE_SYSTEM_VERSION=29 \
-DCMAKE_ANDROID_ARCH_ABI=x86 \
-DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang \
-DCMAKE_ANDROID_STL_TYPE=c++_static \
-DCMAKE_FIND_ROOT_PATH="/opt/android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot;$HOME/deps" \
-DCMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX=/i686-linux-android/29 \
-DCORRADE_RC_EXECUTABLE=$HOME/deps-native/bin/corrade-rc \
-DCMAKE_INSTALL_PREFIX=$HOME/deps \
-DCMAKE_PREFIX_PATH=$HOME/deps \
-DCMAKE_BUILD_TYPE=Release \
-DWITH_AUDIO=OFF \
`# Needed by VkMeshVkTest, together with TgaImporter and AnyImageImporter` \
-DWITH_DEBUGTOOLS=ON \
-DWITH_GL=OFF \
-DWITH_MESHTOOLS=OFF \
-DWITH_PRIMITIVES=OFF \
-DWITH_SCENEGRAPH=OFF \
-DWITH_SCENETOOLS=OFF \
-DWITH_SHADERS=OFF \
-DWITH_TEXT=OFF \
-DWITH_TEXTURETOOLS=OFF \
-DWITH_TRADE=ON \
-DWITH_VK=ON \
-DWITH_AL_INFO=OFF \
-DWITH_VK_INFO=ON \
-DWITH_GL_INFO=OFF \
-DWITH_ANYAUDIOIMPORTER=OFF \
-DWITH_ANYIMAGECONVERTER=OFF \
-DWITH_ANYIMAGEIMPORTER=ON \
-DWITH_ANYSCENECONVERTER=OFF \
-DWITH_ANYSCENEIMPORTER=OFF \
-DWITH_ANYSHADERCONVERTER=OFF \
-DWITH_MAGNUMFONT=OFF \
-DWITH_MAGNUMFONTCONVERTER=OFF \
-DWITH_OBJIMPORTER=OFF \
-DWITH_TGAIMAGECONVERTER=OFF \
-DWITH_TGAIMPORTER=ON \
-DWITH_WAVAUDIOIMPORTER=OFF \
-DWITH_DISTANCEFIELDCONVERTER=OFF \
-DWITH_FONTCONVERTER=OFF \
-DWITH_IMAGECONVERTER=OFF \
-DWITH_SCENECONVERTER=OFF \
-DWITH_SHADERCONVERTER=OFF \
`# TODO: enable back when it can be GL-less` \
-DWITH_ANDROIDAPPLICATION=OFF \
-DBUILD_TESTS=ON \
-DBUILD_GL_TESTS=OFF \
-DBUILD_VK_TESTS=ON \
-G Ninja
ninja $NINJA_JOBS

# Wait for emulator to start (done in parallel to build) and run tests
circle-android wait-for-boot
CORRADE_TEST_COLOR=ON ctest -V

# Test install, after running the tests as for them it shouldn't be needed
ninja install
53 changes: 53 additions & 0 deletions package/ci/circleci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ executors:
# https://github.com/mosra/magnum/issues/413,
# https://github.com/emscripten-core/emscripten/pull/10161
- image: emscripten/emsdk:1.39.6-upstream
android-29:
machine:
image: android:202102-01

commands:
install-base-linux:
Expand Down Expand Up @@ -74,6 +77,26 @@ commands:
if [[ "$CMAKE_CXX_FLAGS" == *"--coverage"* ]]; then export LCOV_PACKAGES="lcov"; fi
HOMEBREW_NO_AUTO_UPDATE=1 brew install cmake ninja $LCOV_PACKAGES << parameters.extra >>
install-base-android:
steps:
- run:
name: Create Android 29 x86 AVD
command: |
SYSTEM_IMAGES="system-images;android-29;default;x86"
sdkmanager "$SYSTEM_IMAGES"
echo "no" | avdmanager --verbose create avd -n test -k "$SYSTEM_IMAGES"
- run:
name: Launch Android emulator
command: |
emulator -avd test -delay-adb -verbose -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim
background: true
- run:
name: Update apt and install base packages
# Compared to Docker images this needs sudo, for some reason
command: |
sudo apt update
sudo apt install -y ninja-build
install-gcc-4_8:
steps:
- run:
Expand Down Expand Up @@ -477,6 +500,33 @@ jobs:
- build:
script: emscripten.sh

android-x86-gles2:
executor: android-29
environment:
# STUPID yml interprets unquoted ON as a boolean
TARGET_GLES2: "ON"
steps:
- install-base-android
- build:
script: android-x86-gles.sh

android-x86-gles3:
executor: android-29
environment:
# STUPID yml interprets unquoted ON as a boolean
TARGET_GLES2: "OFF"
steps:
- install-base-android
- build:
script: android-x86-gles.sh

android-x86-vulkan:
executor: android-29
steps:
- install-base-android
- build:
script: android-x86-vulkan.sh

workflows:
version: 2
build:
Expand All @@ -495,3 +545,6 @@ workflows:
- macos-static
- emscripten-webgl1
- emscripten-webgl2
- android-x86-gles2
- android-x86-gles3
- android-x86-vulkan

0 comments on commit eaa95dd

Please sign in to comment.