Fix Android x86_64 build
Note: At this time, both arm32 and arm64 emulation doesn't work on either macOS and Ubuntu so we could only have x86_64
This commit is contained in:
parent
9954763c02
commit
bc5efc9ee5
|
@ -245,16 +245,41 @@ jobs:
|
|||
cmake --build . --config ${{ matrix.config.build_type }}
|
||||
cmake --install . --strip
|
||||
|
||||
- name: '🚧 AVD Cache'
|
||||
if: contains(matrix.config.name, 'android')
|
||||
uses: actions/cache@v2
|
||||
id: avd-cache
|
||||
with:
|
||||
path: |
|
||||
~/.android/avd/*
|
||||
~/.android/adb*
|
||||
key: avd-28
|
||||
|
||||
- name: '🚧 Create x86_64 tests environment'
|
||||
if: contains(matrix.config.name, 'android') && steps.avd-cache.outputs.cache-hit != 'true'
|
||||
uses: reactivecircus/android-emulator-runner@v2
|
||||
with:
|
||||
api-level: 28
|
||||
arch: ${{ matrix.config.arch }}
|
||||
force-avd-creation: false
|
||||
disable-animations: false
|
||||
target: default
|
||||
profile: Nexus 6
|
||||
emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -verbose -show-kernel
|
||||
script: echo "Generated AVD snapshot for caching."
|
||||
|
||||
- name: '🚧 Android x86_64 tests'
|
||||
if: contains(matrix.config.name, 'android')
|
||||
uses: reactivecircus/android-emulator-runner@v2
|
||||
with:
|
||||
api-level: 28
|
||||
force-avd-creation: false
|
||||
disable-animations: true
|
||||
arch: ${{ matrix.config.arch }}
|
||||
target: default
|
||||
profile: Nexus 6
|
||||
emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -verbose -show-kernel
|
||||
script: ctest -C ${{ matrix.config.build_type }}
|
||||
script: bash ./adb.sh
|
||||
|
||||
- name: '📦 Pack artifact'
|
||||
shell: bash
|
||||
|
|
|
@ -90,6 +90,7 @@ else()
|
|||
endif()
|
||||
elseif(ANDROID_ABI)
|
||||
string(FIND "${ANDROID_ABI}" "arm64" UC_RET)
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/adb.sh "#!/bin/bash\n\nadb shell mkdir -p /data/local/tmp/build\n")
|
||||
|
||||
if (${UC_RET} GREATER_EQUAL "0")
|
||||
set(UNICORN_TARGET_ARCH "aarch64")
|
||||
|
@ -1023,6 +1024,9 @@ if (UNICORN_BUILD_SHARED)
|
|||
add_library(unicorn SHARED
|
||||
${UNICORN_SRCS}
|
||||
)
|
||||
if (ANDROID_ABI)
|
||||
file(APPEND ${CMAKE_BINARY_DIR}/adb.sh "adb push ./libunicorn.so /data/local/tmp/build/\n")
|
||||
endif()
|
||||
else()
|
||||
add_library(unicorn STATIC
|
||||
${UNICORN_SRCS}
|
||||
|
@ -1175,6 +1179,11 @@ else()
|
|||
${SAMPLES_LIB}
|
||||
)
|
||||
add_test(${TEST_FILE} ${TEST_FILE})
|
||||
if (ANDROID_ABI)
|
||||
file(APPEND ${CMAKE_BINARY_DIR}/adb.sh "adb push ${TEST_FILE} /data/local/tmp/build/\n")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}/adb.sh "adb shell \"chmod +x /data/local/tmp/build/${TEST_FILE}\"\n")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}/adb.sh "adb shell \'LD_LIBRARY_PATH=/data/local/tmp/build:$LD_LIBRARY_PATH /data/local/tmp/build/${TEST_FILE}\' || exit -1\n")
|
||||
endif()
|
||||
endforeach(TEST_FILE)
|
||||
endif()
|
||||
|
||||
|
|
Loading…
Reference in New Issue