Merge chfl4gs/dev to unicorn/dev

This commit is contained in:
mio 2021-10-16 20:37:16 +02:00
commit 5b67b34d65
No known key found for this signature in database
GPG Key ID: DFF27E34A47CB873
3 changed files with 154 additions and 44 deletions

View File

@ -3,7 +3,6 @@ name: PyPI 📦 Distribution
on:
push:
paths-ignore:
- ".github/**"
- ".gitignore"
- "docs/**"
- "README"

View File

@ -1,10 +1,10 @@
name: Build UC2
on:
push:
tags-ignore:
- "*"
paths-ignore:
- ".github/**"
- ".gitignore"
- "docs/**"
- "README"
@ -16,13 +16,14 @@ on:
- "COPYING"
pull_request:
env:
CI: true
jobs:
Windows:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.name }} - ${{ matrix.compiler }}
name: ${{ matrix.config.name }}
strategy:
fail-fast: false
matrix:
@ -65,15 +66,22 @@ jobs:
archiver: '7z a',
generators: 'Visual Studio 16 2019'
}
- {
os: windows-latest,
arch: x86,
python-arch: x86,
python-ver: '3.8',
name: 'windows-x86 MSVC 32bit',
msvc-arch: x86,
artifact: 'windows_msvc32.7z',
build_type: 'Debug',
archiver: '7z a',
generators: 'Visual Studio 16 2019'
}
compiler: [ gcc ]
steps:
- uses: actions/checkout@v2
# - name: '🛠️ Python setup'
# uses: actions/setup-python@v2
# with:
# python-version: ${{ matrix.config.python-ver }}
- name: '🛠️ Win MINGW setup'
if: contains(matrix.config.mingw, 'MINGW')
uses: msys2/setup-msys2@v2
@ -87,12 +95,12 @@ jobs:
mingw-w64-${{ matrix.config.mingw-arch }}-${{ matrix.compiler }}
mingw-w64-${{ matrix.config.mingw-arch }}-toolchain
- name: '🛠️ Win MSVC setup'
if: contains(matrix.config.name, 'MSVC')
- name: '🛠️ Win MSVC 64 setup'
if: contains(matrix.config.name, 'MSVC 64')
uses: microsoft/setup-msbuild@v1
- name: '🚧 Win MSVC build'
if: contains(matrix.config.name, 'MSVC')
- name: '🚧 Win MSVC 64 build'
if: contains(matrix.config.name, 'MSVC 64')
shell: bash
run: |
choco install ninja cmake
@ -110,6 +118,32 @@ jobs:
ctest -C ${{ matrix.config.build_type }}
mv Debug instdir
- name: '🛠️ Win MSVC 32 setup'
if: contains(matrix.config.name, 'MSVC 32')
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x86
- name: '🚧 Win MSVC 32 build'
if: contains(matrix.config.name, 'MSVC 32')
shell: bash
run: |
choco install ninja cmake
ninja --version
cmake --version
mkdir build
cmake \
-S . \
-B . \
-A "win32" \
-DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \
-G "${{ matrix.config.generators }}" \
-DCMAKE_INSTALL_PREFIX:PATH=instdir
cmake --build . --config ${{ matrix.config.build_type }}
cmake --install . --strip --config ${{ matrix.config.build_type }}
ctest -C ${{ matrix.config.build_type }}
mv Debug instdir
- name: '🚧 Win MINGW build'
if: contains(matrix.config.mingw, 'MINGW')
shell: msys2 {0}
@ -167,6 +201,17 @@ jobs:
archiver: '7za a',
generators: 'Ninja'
}
- {
os: macos-11,
arch: x86_64,
python-arch: x86_64,
python-ver: '3.8',
name: 'android cmake',
artifact: 'Android-x86_64.7z',
build_type: 'Debug',
archiver: '7za a',
generators: 'Ninja'
}
compiler: [ gcc ]
steps:
- uses: actions/checkout@v2
@ -177,24 +222,81 @@ jobs:
# python-version: ${{ matrix.config.python-ver }}
- name: '🚧 Mac build'
if: contains(matrix.config.os, 'macos')
if: contains(matrix.config.name, 'macos-x64')
shell: bash
run: |
brew install p7zip cmake ninja
ninja --version
cmake --version
mkdir build
mkdir instdir
cmake \
-S . \
-B . \
-DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \
-G "${{ matrix.config.generators }}" \
-DCMAKE_INSTALL_PREFIX:PATH=instdir
cmake --build . --config ${{ matrix.config.build_type }}
cmake --install . --strip
ctest -C ${{ matrix.config.build_type }}
brew install p7zip cmake ninja
ninja --version
cmake --version
mkdir build
mkdir instdir
cmake \
-S . \
-B . \
-DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \
-G "${{ matrix.config.generators }}" \
-DCMAKE_INSTALL_PREFIX:PATH=instdir
cmake --build . --config ${{ matrix.config.build_type }}
cmake --install . --strip
ctest -C ${{ matrix.config.build_type }}
- name: '🚧 Android x86_64 build'
if: contains(matrix.config.name, 'android')
shell: bash
run: |
brew install p7zip cmake ninja
mkdir build
mkdir instdir
cmake . -DCMAKE_TOOLCHAIN_FILE="$ANDROID_HOME/ndk/21.4.7075529/build/cmake/android.toolchain.cmake" \
-DANDROID_PLATFORM=android-28 \
-DANDROID_NDK="$ANDROID_HOME/ndk/21.4.7075529" \
-DANDROID_ABI=${{ matrix.config.arch }} \
-DOLP_SDK_ENABLE_TESTING=NO \
-DOLP_SDK_BUILD_EXAMPLES=ON \
-S . \
-B . \
-DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \
-G "${{ matrix.config.generators }}" \
-DCMAKE_INSTALL_PREFIX:PATH=instdir
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: bash ./adb.sh
- name: '📦 Pack artifact'
shell: bash
working-directory: instdir
@ -331,4 +433,4 @@ jobs:
uses: actions/upload-artifact@v1
with:
path: ./${{ matrix.config.artifact }}
name: ${{ matrix.config.artifact }}
name: ${{ matrix.config.artifact }}

View File

@ -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}
@ -1159,22 +1163,27 @@ if(UNICORN_FUZZ)
endforeach()
else()
foreach(SAMPLE_FILE ${UNICORN_SAMPLE_FILE})
add_executable(${SAMPLE_FILE}
${CMAKE_CURRENT_SOURCE_DIR}/samples/${SAMPLE_FILE}.c
)
target_link_libraries(${SAMPLE_FILE}
${SAMPLES_LIB}
)
endforeach(SAMPLE_FILE)
add_executable(${SAMPLE_FILE}
${CMAKE_CURRENT_SOURCE_DIR}/samples/${SAMPLE_FILE}.c
)
target_link_libraries(${SAMPLE_FILE}
${SAMPLES_LIB}
)
endforeach(SAMPLE_FILE)
foreach(TEST_FILE ${UNICORN_TEST_FILE})
add_executable(${TEST_FILE}
${CMAKE_CURRENT_SOURCE_DIR}/tests/unit/${TEST_FILE}.c
)
target_link_libraries(${TEST_FILE}
${SAMPLES_LIB}
)
add_test(${TEST_FILE} ${TEST_FILE})
foreach(TEST_FILE ${UNICORN_TEST_FILE})
add_executable(${TEST_FILE}
${CMAKE_CURRENT_SOURCE_DIR}/tests/unit/${TEST_FILE}.c
)
target_link_libraries(${TEST_FILE}
${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()