Merge chfl4gs/dev to unicorn/dev
This commit is contained in:
1
.github/workflows/PyPI-publishing.yml
vendored
1
.github/workflows/PyPI-publishing.yml
vendored
@ -3,7 +3,6 @@ name: PyPI 📦 Distribution
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- ".github/**"
|
|
||||||
- ".gitignore"
|
- ".gitignore"
|
||||||
- "docs/**"
|
- "docs/**"
|
||||||
- "README"
|
- "README"
|
||||||
|
158
.github/workflows/build-uc2.yml
vendored
158
.github/workflows/build-uc2.yml
vendored
@ -1,10 +1,10 @@
|
|||||||
name: Build UC2
|
name: Build UC2
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags-ignore:
|
tags-ignore:
|
||||||
- "*"
|
- "*"
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- ".github/**"
|
|
||||||
- ".gitignore"
|
- ".gitignore"
|
||||||
- "docs/**"
|
- "docs/**"
|
||||||
- "README"
|
- "README"
|
||||||
@ -16,13 +16,14 @@ on:
|
|||||||
- "COPYING"
|
- "COPYING"
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
CI: true
|
CI: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Windows:
|
Windows:
|
||||||
runs-on: ${{ matrix.config.os }}
|
runs-on: ${{ matrix.config.os }}
|
||||||
name: ${{ matrix.config.name }} - ${{ matrix.compiler }}
|
name: ${{ matrix.config.name }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@ -65,15 +66,22 @@ jobs:
|
|||||||
archiver: '7z a',
|
archiver: '7z a',
|
||||||
generators: 'Visual Studio 16 2019'
|
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 ]
|
compiler: [ gcc ]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
# - name: '🛠️ Python setup'
|
|
||||||
# uses: actions/setup-python@v2
|
|
||||||
# with:
|
|
||||||
# python-version: ${{ matrix.config.python-ver }}
|
|
||||||
|
|
||||||
- name: '🛠️ Win MINGW setup'
|
- name: '🛠️ Win MINGW setup'
|
||||||
if: contains(matrix.config.mingw, 'MINGW')
|
if: contains(matrix.config.mingw, 'MINGW')
|
||||||
uses: msys2/setup-msys2@v2
|
uses: msys2/setup-msys2@v2
|
||||||
@ -87,12 +95,12 @@ jobs:
|
|||||||
mingw-w64-${{ matrix.config.mingw-arch }}-${{ matrix.compiler }}
|
mingw-w64-${{ matrix.config.mingw-arch }}-${{ matrix.compiler }}
|
||||||
mingw-w64-${{ matrix.config.mingw-arch }}-toolchain
|
mingw-w64-${{ matrix.config.mingw-arch }}-toolchain
|
||||||
|
|
||||||
- name: '🛠️ Win MSVC setup'
|
- name: '🛠️ Win MSVC 64 setup'
|
||||||
if: contains(matrix.config.name, 'MSVC')
|
if: contains(matrix.config.name, 'MSVC 64')
|
||||||
uses: microsoft/setup-msbuild@v1
|
uses: microsoft/setup-msbuild@v1
|
||||||
|
|
||||||
- name: '🚧 Win MSVC build'
|
- name: '🚧 Win MSVC 64 build'
|
||||||
if: contains(matrix.config.name, 'MSVC')
|
if: contains(matrix.config.name, 'MSVC 64')
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
choco install ninja cmake
|
choco install ninja cmake
|
||||||
@ -110,6 +118,32 @@ jobs:
|
|||||||
ctest -C ${{ matrix.config.build_type }}
|
ctest -C ${{ matrix.config.build_type }}
|
||||||
mv Debug instdir
|
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'
|
- name: '🚧 Win MINGW build'
|
||||||
if: contains(matrix.config.mingw, 'MINGW')
|
if: contains(matrix.config.mingw, 'MINGW')
|
||||||
shell: msys2 {0}
|
shell: msys2 {0}
|
||||||
@ -167,6 +201,17 @@ jobs:
|
|||||||
archiver: '7za a',
|
archiver: '7za a',
|
||||||
generators: 'Ninja'
|
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 ]
|
compiler: [ gcc ]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
@ -177,24 +222,81 @@ jobs:
|
|||||||
# python-version: ${{ matrix.config.python-ver }}
|
# python-version: ${{ matrix.config.python-ver }}
|
||||||
|
|
||||||
- name: '🚧 Mac build'
|
- name: '🚧 Mac build'
|
||||||
if: contains(matrix.config.os, 'macos')
|
if: contains(matrix.config.name, 'macos-x64')
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
brew install p7zip cmake ninja
|
brew install p7zip cmake ninja
|
||||||
ninja --version
|
ninja --version
|
||||||
cmake --version
|
cmake --version
|
||||||
mkdir build
|
mkdir build
|
||||||
mkdir instdir
|
mkdir instdir
|
||||||
cmake \
|
cmake \
|
||||||
-S . \
|
-S . \
|
||||||
-B . \
|
-B . \
|
||||||
-DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \
|
-DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \
|
||||||
-G "${{ matrix.config.generators }}" \
|
-G "${{ matrix.config.generators }}" \
|
||||||
-DCMAKE_INSTALL_PREFIX:PATH=instdir
|
-DCMAKE_INSTALL_PREFIX:PATH=instdir
|
||||||
cmake --build . --config ${{ matrix.config.build_type }}
|
cmake --build . --config ${{ matrix.config.build_type }}
|
||||||
cmake --install . --strip
|
cmake --install . --strip
|
||||||
ctest -C ${{ matrix.config.build_type }}
|
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'
|
- name: '📦 Pack artifact'
|
||||||
shell: bash
|
shell: bash
|
||||||
working-directory: instdir
|
working-directory: instdir
|
||||||
@ -331,4 +433,4 @@ jobs:
|
|||||||
uses: actions/upload-artifact@v1
|
uses: actions/upload-artifact@v1
|
||||||
with:
|
with:
|
||||||
path: ./${{ matrix.config.artifact }}
|
path: ./${{ matrix.config.artifact }}
|
||||||
name: ${{ matrix.config.artifact }}
|
name: ${{ matrix.config.artifact }}
|
||||||
|
@ -90,6 +90,7 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
elseif(ANDROID_ABI)
|
elseif(ANDROID_ABI)
|
||||||
string(FIND "${ANDROID_ABI}" "arm64" UC_RET)
|
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")
|
if (${UC_RET} GREATER_EQUAL "0")
|
||||||
set(UNICORN_TARGET_ARCH "aarch64")
|
set(UNICORN_TARGET_ARCH "aarch64")
|
||||||
@ -1023,6 +1024,9 @@ if (UNICORN_BUILD_SHARED)
|
|||||||
add_library(unicorn SHARED
|
add_library(unicorn SHARED
|
||||||
${UNICORN_SRCS}
|
${UNICORN_SRCS}
|
||||||
)
|
)
|
||||||
|
if (ANDROID_ABI)
|
||||||
|
file(APPEND ${CMAKE_BINARY_DIR}/adb.sh "adb push ./libunicorn.so /data/local/tmp/build/\n")
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
add_library(unicorn STATIC
|
add_library(unicorn STATIC
|
||||||
${UNICORN_SRCS}
|
${UNICORN_SRCS}
|
||||||
@ -1159,22 +1163,27 @@ if(UNICORN_FUZZ)
|
|||||||
endforeach()
|
endforeach()
|
||||||
else()
|
else()
|
||||||
foreach(SAMPLE_FILE ${UNICORN_SAMPLE_FILE})
|
foreach(SAMPLE_FILE ${UNICORN_SAMPLE_FILE})
|
||||||
add_executable(${SAMPLE_FILE}
|
add_executable(${SAMPLE_FILE}
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/samples/${SAMPLE_FILE}.c
|
${CMAKE_CURRENT_SOURCE_DIR}/samples/${SAMPLE_FILE}.c
|
||||||
)
|
)
|
||||||
target_link_libraries(${SAMPLE_FILE}
|
target_link_libraries(${SAMPLE_FILE}
|
||||||
${SAMPLES_LIB}
|
${SAMPLES_LIB}
|
||||||
)
|
)
|
||||||
endforeach(SAMPLE_FILE)
|
endforeach(SAMPLE_FILE)
|
||||||
|
|
||||||
foreach(TEST_FILE ${UNICORN_TEST_FILE})
|
foreach(TEST_FILE ${UNICORN_TEST_FILE})
|
||||||
add_executable(${TEST_FILE}
|
add_executable(${TEST_FILE}
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/tests/unit/${TEST_FILE}.c
|
${CMAKE_CURRENT_SOURCE_DIR}/tests/unit/${TEST_FILE}.c
|
||||||
)
|
)
|
||||||
target_link_libraries(${TEST_FILE}
|
target_link_libraries(${TEST_FILE}
|
||||||
${SAMPLES_LIB}
|
${SAMPLES_LIB}
|
||||||
)
|
)
|
||||||
add_test(${TEST_FILE} ${TEST_FILE})
|
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)
|
endforeach(TEST_FILE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user