From 204caa420ef67086ec030057e0f96cc31bfeb7bf Mon Sep 17 00:00:00 2001 From: benjaminwan Date: Wed, 14 Feb 2024 23:10:31 +0800 Subject: [PATCH] edit builder v1.17.0 --- .github/old/android-1.15.1.yml | 177 ----------------- .github/old/android-1.16.3.yml | 209 -------------------- .github/old/linux-1.15.1.yml | 180 ----------------- .github/old/linux-1.16.3.yml | 175 ---------------- .github/old/macos-1.15.1.yml | 120 ----------- .github/old/macos-1.16.3.yml | 127 ------------ .github/old/windows-1.15.1.yml | 156 --------------- .github/old/windows-1.16.3.yml | 156 --------------- .github/workflows/android.yml | 6 +- .github/workflows/musl.yml | 7 +- .github/workflows/windows.yml | 9 +- build-onnxruntime-musl.sh | 27 +-- onnxruntime_options-v1.17.0.txt | 81 ++++++++ v1.15.1/build-onnxruntime-1.15.1.bat | 102 ---------- v1.15.1/build-onnxruntime-1.15.1.sh | 64 ------ v1.15.1/build-onnxruntime-android-1.15.1.sh | 92 --------- 16 files changed, 109 insertions(+), 1579 deletions(-) delete mode 100644 .github/old/android-1.15.1.yml delete mode 100644 .github/old/android-1.16.3.yml delete mode 100644 .github/old/linux-1.15.1.yml delete mode 100644 .github/old/linux-1.16.3.yml delete mode 100644 .github/old/macos-1.15.1.yml delete mode 100644 .github/old/macos-1.16.3.yml delete mode 100644 .github/old/windows-1.15.1.yml delete mode 100644 .github/old/windows-1.16.3.yml create mode 100644 onnxruntime_options-v1.17.0.txt delete mode 100644 v1.15.1/build-onnxruntime-1.15.1.bat delete mode 100644 v1.15.1/build-onnxruntime-1.15.1.sh delete mode 100644 v1.15.1/build-onnxruntime-android-1.15.1.sh diff --git a/.github/old/android-1.15.1.yml b/.github/old/android-1.15.1.yml deleted file mode 100644 index 35b3b7f..0000000 --- a/.github/old/android-1.15.1.yml +++ /dev/null @@ -1,177 +0,0 @@ -name: android - -on: - workflow_dispatch: - push: - tags: - - '*' - -jobs: - android: - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - list: - - { arch: armeabi-v7a, min: 19 } - - { arch: arm64-v8a, min: 21 } - - { arch: x86, min: 19 } - - { arch: x86_64 , min: 21 } - - env: - ONNX_VERSION: v1.15.1 - PKG_NAME_PREFIX: onnxruntime-1.15.1-${{ matrix.list.arch }} - BUILD_SCRIPT: build-onnxruntime-android.sh - - steps: - # Setup JDK 11 - - name: Set up JDK 11 - uses: actions/setup-java@v3 - with: - java-version: '11' - distribution: 'adopt' - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.8.18' - - # install ndk - - name: install ndk 22.1.7171670 - run: | - $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --install "ndk;22.1.7171670" - echo "ANDROID_NDK_HOME=$ANDROID_HOME/ndk/22.1.7171670" >> $GITHUB_ENV - - # 删除ndk -g参数 - - name: ndk del -g - run: | - echo $ANDROID_NDK_HOME - sed -i -e '/^ -g$/d' $ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake - - # 检出代码 - - uses: actions/checkout@v3 - - # 检出onnxruntime - - name: checkout onnxruntime - uses: actions/checkout@v3 - with: - repository: microsoft/onnxruntime - path: onnxruntime-${{ env.ONNX_VERSION }} - ref: ${{ env.ONNX_VERSION }} - submodules: recursive - - # 复制编译脚本 - - name: copy build script - run: | - cp ${{ env.BUILD_SCRIPT }} onnxruntime-${{ env.ONNX_VERSION }} - - # 编译 - - name: build - run: | - cd onnxruntime-${{ env.ONNX_VERSION }} - chmod a+x ${{ env.BUILD_SCRIPT }} - ./${{ env.BUILD_SCRIPT }} ${{ matrix.list.arch }} ${{ matrix.list.min }} - - # 7z压缩 - - name: 7zip - run: | - mv onnxruntime-${{ env.ONNX_VERSION }}/build-android-${{ matrix.list.arch }}/Release/install ${{ matrix.list.arch }} - 7z a ${{ env.PKG_NAME_PREFIX }}-shared.7z ${{ matrix.list.arch }} - rm -r -f ${{ matrix.list.arch }} - mv onnxruntime-${{ env.ONNX_VERSION }}/build-android-${{ matrix.list.arch }}/Release/install-static ${{ matrix.list.arch }} - 7z a ${{ env.PKG_NAME_PREFIX }}-static.7z ${{ matrix.list.arch }} - rm -r -f ${{ matrix.list.arch }} - - # 上传artifact - - name: upload - uses: actions/upload-artifact@v3 - with: - name: ${{ env.PKG_NAME_PREFIX }}-shared - path: ${{ env.PKG_NAME_PREFIX }}-shared.7z - - - name: upload - uses: actions/upload-artifact@v3 - with: - name: ${{ env.PKG_NAME_PREFIX }}-static - path: ${{ env.PKG_NAME_PREFIX }}-static.7z - - release: - needs: [ android ] - - runs-on: ubuntu-latest - - env: - ONNX_VERSION: v1.15.1 - PKG_NAME: onnxruntime-1.15.1-android - - steps: - # 检出代码 - - uses: actions/checkout@v3 - - # 获取所有的git log和tag - - name: Unshallow - run: git fetch --prune --unshallow - - # 获取git log 从 previousTag 到 lastTag - - name: Get git log - id: git-log - run: | - previousTag=$(git describe --abbrev=0 --tags `git rev-list --tags --skip=1 --max-count=1`) - lastTag=$(git describe --abbrev=0 --tags) - echo "previousTag:$previousTag ~ lastTag:$lastTag" - log=$(git log $previousTag..$lastTag --pretty=format:'- %cd %an: %s\n' --date=format:'%Y-%m-%d %H:%M:%S') - echo "$log" - echo "log_state="$log"" >> $GITHUB_ENV - - # 创建Changelog文件 triggered by git tag push - - name: Generate Changelog - if: startsWith(github.ref, 'refs/tags/') - run: | - echo -e '${{ env.log_state }}' > release.md - - # 下载artifact - - name: download - uses: actions/download-artifact@v3 - with: - path: artifacts - - # 查看artifact - - name: list artifact - run: | - tree artifacts - - # 合并 - - name: merge - run: | - mkdir onnxruntime-android - mv artifacts/*/*-shared.7z artifacts/ - find artifacts/*-shared.7z -exec 7z x {} -aoa -oonnxruntime-android \; - pushd onnxruntime-android - echo "message(\"OnnxRuntime Path: \${CMAKE_CURRENT_LIST_DIR}/\${ANDROID_ABI}\")" > OnnxRuntimeWrapper.cmake - echo "set(OnnxRuntime_DIR \"\${CMAKE_CURRENT_LIST_DIR}/\${ANDROID_ABI}\")" >> OnnxRuntimeWrapper.cmake - popd - 7z a ${{ env.PKG_NAME }}-shared.7z onnxruntime-android - rm -r -f onnxruntime-android - mkdir onnxruntime-android - mv artifacts/*/*-static.7z artifacts/ - find artifacts/*-static.7z -exec 7z x {} -aoa -oonnxruntime-android \; - pushd onnxruntime-android - echo "message(\"OnnxRuntime Path: \${CMAKE_CURRENT_LIST_DIR}/\${ANDROID_ABI}\")" > OnnxRuntimeWrapper.cmake - echo "set(OnnxRuntime_DIR \"\${CMAKE_CURRENT_LIST_DIR}/\${ANDROID_ABI}\")" >> OnnxRuntimeWrapper.cmake - popd - 7z a ${{ env.PKG_NAME }}-static.7z onnxruntime-android - rm -r -f onnxruntime-android - find artifacts/*-static.7z -exec rm {} \; - - # 创建release 上传release - # https://github.com/marketplace/actions/create-release - - name: Create release and upload-archive - uses: ncipollo/release-action@v1 - with: - prerelease: false - bodyFile: release.md - artifacts: ${{ env.PKG_NAME }}-shared.7z,${{ env.PKG_NAME }}-static.7z - allowUpdates: true - artifactContentType: application/x-7z-compressed - token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/old/android-1.16.3.yml b/.github/old/android-1.16.3.yml deleted file mode 100644 index edeea8a..0000000 --- a/.github/old/android-1.16.3.yml +++ /dev/null @@ -1,209 +0,0 @@ -name: android - -on: - workflow_dispatch: - push: - tags: - - '*' - -jobs: - android: - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - ver: - - { onnx: v1.16.3, ndk: 22.1.7171670 } - list: - - { arch: armeabi-v7a, min: 19 } - - { arch: arm64-v8a, min: 21 } - - { arch: x86, min: 19 } - - { arch: x86_64 , min: 21 } - - env: - SHARED_PKG_NAME: onnxruntime-${{ matrix.ver.onnx }}-${{ matrix.list.arch }}-shared - STATIC_PKG_NAME: onnxruntime-${{ matrix.ver.onnx }}-${{ matrix.list.arch }}-static - JAVA_PKG_NAME: onnxruntime-${{ matrix.ver.onnx }}-${{ matrix.list.arch }}-java - BUILD_SCRIPT: build-onnxruntime-android.sh - - steps: - # Setup JDK 11 - - name: Set up JDK 11 - uses: actions/setup-java@v3 - with: - java-version: '11' - distribution: 'adopt' - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.8.18' - - # install ndk - - name: install ndk - run: | - $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --install "ndk;${{ matrix.ver.ndk }}" - echo "ANDROID_NDK_HOME=$ANDROID_HOME/ndk/${{ matrix.ver.ndk }}" >> $GITHUB_ENV - - # 删除ndk -g参数 - - name: ndk del -g - run: | - echo $ANDROID_NDK_HOME - sed -i -e '/^ -g$/d' $ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake - - # 检出代码 - - uses: actions/checkout@v3 - - # 检出onnxruntime - - name: checkout onnxruntime - uses: actions/checkout@v3 - with: - repository: microsoft/onnxruntime - path: onnxruntime-${{ matrix.ver.onnx }} - ref: ${{ matrix.ver.onnx }} - submodules: recursive - - # 复制编译脚本 - - name: copy build script - run: | - cp ${{ env.BUILD_SCRIPT }} onnxruntime-${{ matrix.ver.onnx }} - - # 编译 - - name: build - run: | - cd onnxruntime-${{ matrix.ver.onnx }} - chmod a+x ${{ env.BUILD_SCRIPT }} - ./${{ env.BUILD_SCRIPT }} ${{ matrix.list.arch }} ${{ matrix.list.min }} - - # 7z压缩 - - name: 7zip - run: | - cp -r onnxruntime-${{ matrix.ver.onnx }}/build-android-${{ matrix.list.arch }}/Release/install ${{ matrix.list.arch }} - 7z a ${{ env.SHARED_PKG_NAME }}.7z ${{ matrix.list.arch }} - rm -r -f ${{ matrix.list.arch }} - cp -r onnxruntime-${{ matrix.ver.onnx }}/build-android-${{ matrix.list.arch }}/Release/install-static ${{ matrix.list.arch }} - 7z a ${{ env.STATIC_PKG_NAME }}.7z ${{ matrix.list.arch }} - rm -r -f ${{ matrix.list.arch }} - cp -r onnxruntime-${{ matrix.ver.onnx }}/build-android-${{ matrix.list.arch }}/Release/java/build/libs ${{ matrix.list.arch }} - 7z a ${{ env.JAVA_PKG_NAME }}.7z ${{ matrix.list.arch }} - - # 上传artifact - - name: upload - uses: actions/upload-artifact@v3 - with: - name: ${{ env.SHARED_PKG_NAME }} - path: ${{ env.SHARED_PKG_NAME }}.7z - - - name: upload - uses: actions/upload-artifact@v3 - with: - name: ${{ env.STATIC_PKG_NAME }} - path: ${{ env.STATIC_PKG_NAME }}.7z - - - name: upload - uses: actions/upload-artifact@v3 - with: - name: ${{ env.JAVA_PKG_NAME }} - path: ${{ env.JAVA_PKG_NAME }}.7z - - release: - needs: [ android ] - - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - ver: - - { onnx: v1.16.3 } - - env: - SHARED_PKG_NAME: onnxruntime-${{ matrix.ver.onnx }}-android-shared - STATIC_PKG_NAME: onnxruntime-${{ matrix.ver.onnx }}-android-static - JAVA_PKG_NAME: onnxruntime-${{ matrix.ver.onnx }}-android-java - - steps: - # 检出代码 - - uses: actions/checkout@v3 - - # 获取所有的git log和tag - - name: Unshallow - run: git fetch --prune --unshallow - - # 获取git log 从 previousTag 到 lastTag - - name: Get git log - id: git-log - run: | - previousTag=$(git describe --abbrev=0 --tags `git rev-list --tags --skip=1 --max-count=1`) - lastTag=$(git describe --abbrev=0 --tags) - echo "previousTag:$previousTag ~ lastTag:$lastTag" - log=$(git log $previousTag..$lastTag --pretty=format:'- %cd %an: %s\n' --date=format:'%Y-%m-%d %H:%M:%S') - echo "$log" - echo "log_state="$log"" >> $GITHUB_ENV - - # 创建Changelog文件 triggered by git tag push - - name: Generate Changelog - if: startsWith(github.ref, 'refs/tags/') - run: | - echo -e '${{ env.log_state }}' > release.md - - # 下载artifact - - name: download - uses: actions/download-artifact@v3 - with: - path: artifacts - - # 查看artifact - - name: list artifact - run: | - tree artifacts - - # 合并 - - name: merge shared - run: | - mkdir onnxruntime-android-shared - mv artifacts/*/*-shared.7z artifacts/ - find artifacts/*-shared.7z -exec 7z x {} -aoa -oonnxruntime-android-shared \; - find artifacts/*-shared.7z -exec rm {} \; - pushd onnxruntime-android-shared - echo "message(\"OnnxRuntime Path: \${CMAKE_CURRENT_LIST_DIR}/\${ANDROID_ABI}\")" > OnnxRuntimeWrapper.cmake - echo "set(OnnxRuntime_DIR \"\${CMAKE_CURRENT_LIST_DIR}/\${ANDROID_ABI}\")" >> OnnxRuntimeWrapper.cmake - popd - 7z a ${{ env.SHARED_PKG_NAME }}.7z onnxruntime-android-shared - rm -r -f onnxruntime-android-shared - - - name: merge static - run: | - mkdir onnxruntime-android-static - mv artifacts/*/*-static.7z artifacts/ - find artifacts/*-static.7z -exec 7z x {} -aoa -oonnxruntime-android-static \; - find artifacts/*-static.7z -exec rm {} \; - pushd onnxruntime-android-static - echo "message(\"OnnxRuntime Path: \${CMAKE_CURRENT_LIST_DIR}/\${ANDROID_ABI}\")" > OnnxRuntimeWrapper.cmake - echo "set(OnnxRuntime_DIR \"\${CMAKE_CURRENT_LIST_DIR}/\${ANDROID_ABI}\")" >> OnnxRuntimeWrapper.cmake - popd - 7z a ${{ env.STATIC_PKG_NAME }}.7z onnxruntime-android-static - rm -r -f onnxruntime-android-static - - - name: merge java - run: | - mkdir onnxruntime-android-java - mv artifacts/*/*-java.7z artifacts/ - find artifacts/*-java.7z -exec 7z x {} -aoa -oonnxruntime-android-java \; - find artifacts/*-java.7z -exec rm {} \; - 7z a ${{ env.JAVA_PKG_NAME }}.7z onnxruntime-android-java - rm -r -f onnxruntime-android-java - - - # 创建release 上传release - # https://github.com/marketplace/actions/create-release - - name: Create release and upload-archive - uses: ncipollo/release-action@v1 - with: - prerelease: false - bodyFile: release.md - artifacts: ${{ env.SHARED_PKG_NAME }}.7z,${{ env.STATIC_PKG_NAME }}.7z,${{ env.JAVA_PKG_NAME }}.7z - allowUpdates: true - artifactContentType: application/x-7z-compressed - token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/old/linux-1.15.1.yml b/.github/old/linux-1.15.1.yml deleted file mode 100644 index 51f75ec..0000000 --- a/.github/old/linux-1.15.1.yml +++ /dev/null @@ -1,180 +0,0 @@ -name: linux - -on: - workflow_dispatch: - push: - tags: - - '*' - -jobs: - linux: - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - os_name: [ubuntu] - list: - - { os_ver: 18.04, os_id: bionic } - - { os_ver: 20.04, os_id: focal } - arch: - [ - amd64, - arm64, - ppc64le, - ] - - name: ${{ matrix.os_name }}-${{ matrix.list.os_ver }}-${{ matrix.arch }} - - env: - CMAKE_VERSION: 3.28.1 - PY_VERSION: 3.8.18 - JDK_VERSION: openjdk-8-jdk - GRADLE_VERSION: 8.5 - ONNX_VERSION: v1.15.1 - BUILD_SCRIPT: build-onnxruntime.sh - SHARED_PKG_NAME: onnxruntime-1.15.1-${{ matrix.os_name }}-${{ matrix.list.os_ver }}-${{ matrix.arch }}-shared - STATIC_PKG_NAME: onnxruntime-1.15.1-${{ matrix.os_name }}-${{ matrix.list.os_ver }}-${{ matrix.arch }}-static - JAVA_PKG_NAME: onnxruntime-1.15.1-${{ matrix.os_name }}-${{ matrix.list.os_ver }}-${{ matrix.arch }}-java - - steps: - # 检出代码 - - uses: actions/checkout@v3 - - # 检出onnxruntime - - name: checkout onnxruntime - uses: actions/checkout@v3 - with: - repository: microsoft/onnxruntime - path: onnxruntime-${{ env.ONNX_VERSION }} - ref: ${{ env.ONNX_VERSION }} - submodules: recursive - - # 复制 - - name: copy - run: | - cp ${{ env.BUILD_SCRIPT }} onnxruntime-${{ env.ONNX_VERSION }} - chmod a+x ${{ env.BUILD_SCRIPT }} - - - name: Host - update - run: sudo apt-get update - - - name: Host - Install host qemu-static - run: sudo apt-get install -y qemu binfmt-support qemu-user-static - - - name: Host - Docker multiarch bootstrap - run: sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes - - - name: deploy cmake - run: | - wget https://github.com/benjaminwan/CmakeBuilder/releases/download/${{ env.CMAKE_VERSION }}/cmake-${{ env.CMAKE_VERSION }}-${{ matrix.os_name }}-${{ matrix.list.os_ver }}-${{ matrix.arch }}.7z -O cmake-${{ env.CMAKE_VERSION }}.7z - 7z x cmake-${{ env.CMAKE_VERSION }}.7z -aoa - - - name: deploy python - run: | - wget https://github.com/benjaminwan/PythonBuilder/releases/download/${{ env.PY_VERSION }}/python-${{ env.PY_VERSION }}-${{ matrix.os_name }}-${{ matrix.list.os_ver }}-${{ matrix.arch }}.7z -O python-${{ env.PY_VERSION }}.7z - 7z x python-${{ env.PY_VERSION }}.7z -aoa - - - name: deploy gradle - run: | - wget https://services.gradle.org/distributions/gradle-${{ env.GRADLE_VERSION }}-bin.zip -O gradle-${{ env.GRADLE_VERSION }}-bin.zip - 7z x gradle-${{ env.GRADLE_VERSION }}-bin.zip -aoa - - - name: Host - Create Docker template env file - run: | - echo "PATH=/root/cmake-${{ env.CMAKE_VERSION }}/bin:/root/python-${{ env.PY_VERSION }}/bin:/root/gradle-${{ env.GRADLE_VERSION }}/bin:/root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" > env.custom - echo "DEBIAN_FRONTEND=noninteractive" >> env.custom - echo "TZ=Etc/UTC" >> env.custom - - - name: Host - Create docker container - run: docker run --name ${{ matrix.os_name }} --env-file env.custom --platform linux/${{ matrix.arch }} -it -d -w /root -v ${{ github.workspace }}:/root ${{ matrix.os_name }}:${{ matrix.list.os_id }} - - - name: Docker - apt-get update - run: docker exec --env-file env.custom -w /root ${{ matrix.os_name }} apt-get update - - - name: Docker - install build deps - run: docker exec --env-file env.custom -w /root ${{ matrix.os_name }} apt-get install -y build-essential git software-properties-common - - - name: Docker - install jdk - run: | - docker exec --env-file env.custom -w /root ${{ matrix.os_name }} add-apt-repository -y ppa:openjdk-r/ppa - docker exec --env-file env.custom -w /root ${{ matrix.os_name }} apt-get update - docker exec --env-file env.custom -w /root ${{ matrix.os_name }} apt-get -y install ${{ env.JDK_VERSION }} - docker exec --env-file env.custom -w /root ${{ matrix.os_name }} java -version - JAVA_DIR=$(docker exec ${{ matrix.os_name }} readlink -f /usr/bin/javac | sed "s:/bin/javac::") - echo "$JAVA_DIR" - echo "JAVA_HOME=$JAVA_DIR" >> env.custom - echo "JAVA_INCLUDE_PATH=$JAVA_DIR/include" >> env.custom - - - name: Docker - build - run: | - docker exec --env-file env.custom -w /root ${{ matrix.os_name }} git config --global --add safe.directory "*" - docker exec --env-file env.custom -w /root/onnxruntime-${{ env.ONNX_VERSION }} ${{ matrix.os_name }} chmod a+x ${{ env.BUILD_SCRIPT }} - docker exec --env-file env.custom -w /root/onnxruntime-${{ env.ONNX_VERSION }} ${{ matrix.os_name }} ./${{ env.BUILD_SCRIPT }} - - # install文件夹改名linux,并使用7z压缩 - - name: 7zip - run: | - cp -r onnxruntime-${{ env.ONNX_VERSION }}/build-Linux/Release/install linux - 7z a ${{ env.SHARED_PKG_NAME }}.7z linux - rm -r -f linux - cp -r onnxruntime-${{ env.ONNX_VERSION }}/build-Linux/Release/install-static linux - 7z a ${{ env.STATIC_PKG_NAME }}.7z linux - rm -r -f linux - cp -r onnxruntime-${{ env.ONNX_VERSION }}/build-Linux/Release/java/build ${{ env.JAVA_PKG_NAME }} - 7z a ${{ env.JAVA_PKG_NAME }}.7z ${{ env.JAVA_PKG_NAME }} - rm -r -f java - - # 上传artifact - - name: upload - uses: actions/upload-artifact@v3 - with: - name: ${{ env.SHARED_PKG_NAME }} - path: ${{ env.SHARED_PKG_NAME }}.7z - - # 上传artifact - - name: upload - uses: actions/upload-artifact@v3 - with: - name: ${{ env.STATIC_PKG_NAME }} - path: ${{ env.STATIC_PKG_NAME }}.7z - - # 上传artifact - - name: upload - uses: actions/upload-artifact@v3 - with: - name: ${{ env.JAVA_PKG_NAME }} - path: ${{ env.JAVA_PKG_NAME }}.7z - - # 获取所有的git log和tag - - name: Unshallow - run: git fetch --prune --unshallow - - # 获取git log 从 previousTag 到 lastTag - - name: Get git log - id: git-log - run: | - previousTag=$(git describe --abbrev=0 --tags `git rev-list --tags --skip=1 --max-count=1`) - lastTag=$(git describe --abbrev=0 --tags) - echo "previousTag:$previousTag ~ lastTag:$lastTag" - log=$(git log $previousTag..$lastTag --pretty=format:'- %cd %an: %s\n' --date=format:'%Y-%m-%d %H:%M:%S') - echo "$log" - echo "log_state="$log"" >> $GITHUB_ENV - - # 创建Changelog文件 triggered by git tag push - - name: Generate Changelog - if: startsWith(github.ref, 'refs/tags/') - run: | - echo -e '${{ env.log_state }}' > release.md - - # 创建release 上传release - # https://github.com/marketplace/actions/create-release - - name: Create release and upload-archive - uses: ncipollo/release-action@v1 - with: - prerelease: false - bodyFile: release.md - artifacts: ${{ env.SHARED_PKG_NAME }}.7z, ${{ env.STATIC_PKG_NAME }}.7z, ${{ env.JAVA_PKG_NAME }}.7z - allowUpdates: true - artifactContentType: application/x-7z-compressed - token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/old/linux-1.16.3.yml b/.github/old/linux-1.16.3.yml deleted file mode 100644 index 0937519..0000000 --- a/.github/old/linux-1.16.3.yml +++ /dev/null @@ -1,175 +0,0 @@ -name: linux - -on: - workflow_dispatch: - push: - tags: - - '*' - -jobs: - linux: - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - os_name: [ubuntu] - ver: - - { onnx: v1.16.3, cmake: 3.28.1, python: 3.8.18, gradle: 8.5, jdk: openjdk-8-jdk } - list: - - { os_ver: 20.04, os_id: focal } - arch: - [ - amd64, - arm64, - ppc64le, - ] - - name: ubuntu-${{ matrix.list.os_ver }}-${{ matrix.arch }} - - env: - BUILD_SCRIPT: build-onnxruntime.sh - SHARED_PKG_NAME: onnxruntime-${{ matrix.ver.onnx }}-ubuntu-${{ matrix.list.os_ver }}-${{ matrix.arch }}-shared - STATIC_PKG_NAME: onnxruntime-${{ matrix.ver.onnx }}-ubuntu-${{ matrix.list.os_ver }}-${{ matrix.arch }}-static - JAVA_PKG_NAME: onnxruntime-${{ matrix.ver.onnx }}-ubuntu-${{ matrix.list.os_ver }}-${{ matrix.arch }}-java - - steps: - # 检出代码 - - uses: actions/checkout@v3 - - # 检出onnxruntime - - name: checkout onnxruntime - uses: actions/checkout@v3 - with: - repository: microsoft/onnxruntime - path: onnxruntime-${{ matrix.ver.onnx }} - ref: ${{ matrix.ver.onnx }} - submodules: recursive - - # 复制 - - name: copy - run: | - cp ${{ env.BUILD_SCRIPT }} onnxruntime-${{ matrix.ver.onnx }} - chmod a+x ${{ env.BUILD_SCRIPT }} - - - name: Host - update - run: sudo apt-get update - - - name: Host - Install host qemu-static - run: sudo apt-get install -y qemu binfmt-support qemu-user-static - - - name: Host - Docker multiarch bootstrap - run: sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes - - - name: deploy cmake - run: | - wget https://github.com/benjaminwan/CmakeBuilder/releases/download/${{ matrix.ver.cmake }}/cmake-${{ matrix.ver.cmake }}-${{ matrix.os_name }}-${{ matrix.list.os_ver }}-${{ matrix.arch }}.7z -O cmake-${{ matrix.ver.cmake }}.7z - 7z x cmake-${{ matrix.ver.cmake }}.7z -aoa - - - name: deploy python - run: | - wget https://github.com/benjaminwan/PythonBuilder/releases/download/${{ matrix.ver.python }}/python-${{ matrix.ver.python }}-${{ matrix.os_name }}-${{ matrix.list.os_ver }}-${{ matrix.arch }}.7z -O python-${{ matrix.ver.python }}.7z - 7z x python-${{ matrix.ver.python }}.7z -aoa - - - name: deploy gradle - run: | - wget https://services.gradle.org/distributions/gradle-${{ matrix.ver.gradle }}-bin.zip -O gradle-${{ matrix.ver.gradle }}-bin.zip - 7z x gradle-${{ matrix.ver.gradle }}-bin.zip -aoa - - - name: Host - Create Docker template env file - run: | - echo "PATH=/root/cmake-${{ matrix.ver.cmake }}/bin:/root/python-${{ matrix.ver.python }}/bin:/root/gradle-${{ matrix.ver.gradle }}/bin:/root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" > env.custom - echo "DEBIAN_FRONTEND=noninteractive" >> env.custom - echo "TZ=Etc/UTC" >> env.custom - - - name: Host - Create docker container - run: docker run --name ${{ matrix.os_name }} --env-file env.custom --platform linux/${{ matrix.arch }} -it -d -w /root -v ${{ github.workspace }}:/root ${{ matrix.os_name }}:${{ matrix.list.os_id }} - - - name: Docker - apt-get update - run: docker exec --env-file env.custom -w /root ${{ matrix.os_name }} apt-get update - - - name: Docker - install build deps - run: docker exec --env-file env.custom -w /root ${{ matrix.os_name }} apt-get install -y build-essential git software-properties-common - - - name: Docker - install jdk - run: | - docker exec --env-file env.custom -w /root ${{ matrix.os_name }} add-apt-repository -y ppa:openjdk-r/ppa - docker exec --env-file env.custom -w /root ${{ matrix.os_name }} apt-get update - docker exec --env-file env.custom -w /root ${{ matrix.os_name }} apt-get -y install ${{ matrix.ver.jdk }} - docker exec --env-file env.custom -w /root ${{ matrix.os_name }} java -version - JAVA_DIR=$(docker exec ${{ matrix.os_name }} readlink -f /usr/bin/javac | sed "s:/bin/javac::") - echo "$JAVA_DIR" - echo "JAVA_HOME=$JAVA_DIR" >> env.custom - echo "JAVA_INCLUDE_PATH=$JAVA_DIR/include" >> env.custom - - - name: Docker - build - run: | - docker exec --env-file env.custom -w /root ${{ matrix.os_name }} git config --global --add safe.directory "*" - docker exec --env-file env.custom -w /root/onnxruntime-${{ matrix.ver.onnx }} ${{ matrix.os_name }} chmod a+x ${{ env.BUILD_SCRIPT }} - docker exec --env-file env.custom -w /root/onnxruntime-${{ matrix.ver.onnx }} ${{ matrix.os_name }} ./${{ env.BUILD_SCRIPT }} - - # install文件夹改名linux,并使用7z压缩 - - name: 7zip - run: | - cp -r onnxruntime-${{ matrix.ver.onnx }}/build-Linux/Release/install linux - 7z a ${{ env.SHARED_PKG_NAME }}.7z linux - rm -r -f linux - cp -r onnxruntime-${{ matrix.ver.onnx }}/build-Linux/Release/install-static linux - 7z a ${{ env.STATIC_PKG_NAME }}.7z linux - rm -r -f linux - cp -r onnxruntime-${{ matrix.ver.onnx }}/build-Linux/Release/java/build/libs ${{ env.JAVA_PKG_NAME }} - 7z a ${{ env.JAVA_PKG_NAME }}.7z ${{ env.JAVA_PKG_NAME }} - - # 上传artifact - - name: upload - uses: actions/upload-artifact@v3 - with: - name: ${{ env.SHARED_PKG_NAME }} - path: ${{ env.SHARED_PKG_NAME }}.7z - - # 上传artifact - - name: upload - uses: actions/upload-artifact@v3 - with: - name: ${{ env.STATIC_PKG_NAME }} - path: ${{ env.STATIC_PKG_NAME }}.7z - - # 上传artifact - - name: upload - uses: actions/upload-artifact@v3 - with: - name: ${{ env.JAVA_PKG_NAME }} - path: ${{ env.JAVA_PKG_NAME }}.7z - - # 获取所有的git log和tag - - name: Unshallow - run: git fetch --prune --unshallow - - # 获取git log 从 previousTag 到 lastTag - - name: Get git log - id: git-log - run: | - previousTag=$(git describe --abbrev=0 --tags `git rev-list --tags --skip=1 --max-count=1`) - lastTag=$(git describe --abbrev=0 --tags) - echo "previousTag:$previousTag ~ lastTag:$lastTag" - log=$(git log $previousTag..$lastTag --pretty=format:'- %cd %an: %s\n' --date=format:'%Y-%m-%d %H:%M:%S') - echo "$log" - echo "log_state="$log"" >> $GITHUB_ENV - - # 创建Changelog文件 triggered by git tag push - - name: Generate Changelog - if: startsWith(github.ref, 'refs/tags/') - run: | - echo -e '${{ env.log_state }}' > release.md - - # 创建release 上传release - # https://github.com/marketplace/actions/create-release - - name: Create release and upload-archive - uses: ncipollo/release-action@v1 - with: - prerelease: false - bodyFile: release.md - artifacts: ${{ env.SHARED_PKG_NAME }}.7z, ${{ env.STATIC_PKG_NAME }}.7z, ${{ env.JAVA_PKG_NAME }}.7z - allowUpdates: true - artifactContentType: application/x-7z-compressed - token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/old/macos-1.15.1.yml b/.github/old/macos-1.15.1.yml deleted file mode 100644 index e0b8f17..0000000 --- a/.github/old/macos-1.15.1.yml +++ /dev/null @@ -1,120 +0,0 @@ -name: macos - -on: - workflow_dispatch: - push: - tags: - - '*' - -jobs: - macos: - runs-on: macos-11 - - env: - ONNX_VERSION: v1.15.1 - BUILD_SCRIPT: build-onnxruntime.sh - SHARED_PKG_NAME: onnxruntime-1.15.1-macos11-shared - STATIC_PKG_NAME: onnxruntime-1.15.1-macos11-static - JAVA_PKG_NAME: onnxruntime-1.15.1-macos11-java - - steps: - # Setup JDK 8 - - name: Set up JDK 8 - uses: actions/setup-java@v3 - with: - java-version: '8' - distribution: 'adopt' - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.8.18' - - # 检出代码 - - uses: actions/checkout@v3 - - # 检出onnxruntime - - name: checkout onnxruntime - uses: actions/checkout@v3 - with: - repository: microsoft/onnxruntime - path: onnxruntime-${{ env.ONNX_VERSION }} - ref: ${{ env.ONNX_VERSION }} - submodules: recursive - - # 复制编译脚本 - - name: copy build script - run: | - cp ${{ env.BUILD_SCRIPT }} onnxruntime-${{ env.ONNX_VERSION }} - - # 编译 - - name: build - run: | - cd onnxruntime-${{ env.ONNX_VERSION }} - chmod a+x ${{ env.BUILD_SCRIPT }} - ./${{ env.BUILD_SCRIPT }} - - # install文件夹改名macos,并使用7z压缩 - - name: 7z - run: | - cp -r onnxruntime-${{ env.ONNX_VERSION }}/build-Darwin/Release/install macos - 7z a ${{ env.SHARED_PKG_NAME }}.7z macos - rm -r -f macos - cp -r onnxruntime-${{ env.ONNX_VERSION }}/build-Darwin/Release/install-static macos - 7z a ${{ env.STATIC_PKG_NAME }}.7z macos - rm -r -f macos - cp -r onnxruntime-${{ env.ONNX_VERSION }}/build-Darwin/Release/java/build ${{ env.JAVA_PKG_NAME }} - 7z a ${{ env.JAVA_PKG_NAME }}.7z ${{ env.JAVA_PKG_NAME }} - rm -r -f java - - # 上传artifact - - name: upload - uses: actions/upload-artifact@v2 - with: - name: ${{ env.SHARED_PKG_NAME }} - path: ${{ env.SHARED_PKG_NAME }}.7z - - - name: upload - uses: actions/upload-artifact@v2 - with: - name: ${{ env.STATIC_PKG_NAME }} - path: ${{ env.STATIC_PKG_NAME }}.7z - - - name: upload - uses: actions/upload-artifact@v2 - with: - name: ${{ env.JAVA_PKG_NAME }} - path: ${{ env.JAVA_PKG_NAME }}.7z - - # 获取所有的git log和tag - - name: Unshallow - run: git fetch --prune --unshallow - - # 获取git log 从 previousTag 到 lastTag - - name: Get git log - id: git-log - run: | - previousTag=$(git describe --abbrev=0 --tags `git rev-list --tags --skip=1 --max-count=1`) - lastTag=$(git describe --abbrev=0 --tags) - echo "previousTag:$previousTag ~ lastTag:$lastTag" - log=$(git log $previousTag..$lastTag --pretty=format:'- %cd %an: %s\n' --date=format:'%Y-%m-%d %H:%M:%S') - echo "$log" - echo "log_state="$log"" >> $GITHUB_ENV - - # 创建Changelog文件 triggered by git tag push - - name: Generate Changelog - if: startsWith(github.ref, 'refs/tags/') - run: | - echo -e '${{ env.log_state }}' > release.md - - # 创建release 上传release - # https://github.com/marketplace/actions/create-release - - name: Create release and upload-archive - uses: ncipollo/release-action@v1 - with: - prerelease: false - bodyFile: release.md - artifacts: ${{ env.SHARED_PKG_NAME }}.7z, ${{ env.STATIC_PKG_NAME }}.7z, ${{ env.JAVA_PKG_NAME }}.7z - allowUpdates: true - artifactContentType: application/x-7z-compressed - token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/old/macos-1.16.3.yml b/.github/old/macos-1.16.3.yml deleted file mode 100644 index b61ee36..0000000 --- a/.github/old/macos-1.16.3.yml +++ /dev/null @@ -1,127 +0,0 @@ -name: macos - -on: - workflow_dispatch: - push: - tags: - - '*' - -jobs: - macos: - - strategy: - fail-fast: false - matrix: - ver: - - { onnx: v1.16.3 } - list: - - { os_ver: 11 } - - runs-on: macos-${{ matrix.list.os_ver }} - - env: - BUILD_SCRIPT: build-onnxruntime.sh - SHARED_PKG_NAME: onnxruntime-${{ matrix.ver.onnx }}-macos-${{ matrix.list.os_ver }}-shared - STATIC_PKG_NAME: onnxruntime-${{ matrix.ver.onnx }}-macos-${{ matrix.list.os_ver }}-static - JAVA_PKG_NAME: onnxruntime-${{ matrix.ver.onnx }}-macos-${{ matrix.list.os_ver }}-java - - steps: - # Setup JDK 8 - - name: Set up JDK 8 - uses: actions/setup-java@v3 - with: - java-version: '8' - distribution: 'adopt' - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.8.18' - - # 检出代码 - - uses: actions/checkout@v3 - - # 检出onnxruntime - - name: checkout onnxruntime - uses: actions/checkout@v3 - with: - repository: microsoft/onnxruntime - path: onnxruntime-${{ matrix.ver.onnx }} - ref: ${{ matrix.ver.onnx }} - submodules: recursive - - # 复制编译脚本 - - name: copy build script - run: | - cp ${{ env.BUILD_SCRIPT }} onnxruntime-${{ matrix.ver.onnx }} - - # 编译 - - name: build - run: | - cd onnxruntime-${{ matrix.ver.onnx }} - chmod a+x ${{ env.BUILD_SCRIPT }} - ./${{ env.BUILD_SCRIPT }} - - # install文件夹改名macos,并使用7z压缩 - - name: 7z - run: | - cp -r onnxruntime-${{ matrix.ver.onnx }}/build-Darwin/Release/install macos - 7z a ${{ env.SHARED_PKG_NAME }}.7z macos - rm -r -f macos - cp -r onnxruntime-${{ matrix.ver.onnx }}/build-Darwin/Release/install-static macos - 7z a ${{ env.STATIC_PKG_NAME }}.7z macos - rm -r -f macos - cp -r onnxruntime-${{ matrix.ver.onnx }}/build-Darwin/Release/java/build/libs ${{ env.JAVA_PKG_NAME }} - 7z a ${{ env.JAVA_PKG_NAME }}.7z ${{ env.JAVA_PKG_NAME }} - - # 上传artifact - - name: upload - uses: actions/upload-artifact@v2 - with: - name: ${{ env.SHARED_PKG_NAME }} - path: ${{ env.SHARED_PKG_NAME }}.7z - - - name: upload - uses: actions/upload-artifact@v2 - with: - name: ${{ env.STATIC_PKG_NAME }} - path: ${{ env.STATIC_PKG_NAME }}.7z - - - name: upload - uses: actions/upload-artifact@v2 - with: - name: ${{ env.JAVA_PKG_NAME }} - path: ${{ env.JAVA_PKG_NAME }}.7z - - # 获取所有的git log和tag - - name: Unshallow - run: git fetch --prune --unshallow - - # 获取git log 从 previousTag 到 lastTag - - name: Get git log - id: git-log - run: | - previousTag=$(git describe --abbrev=0 --tags `git rev-list --tags --skip=1 --max-count=1`) - lastTag=$(git describe --abbrev=0 --tags) - echo "previousTag:$previousTag ~ lastTag:$lastTag" - log=$(git log $previousTag..$lastTag --pretty=format:'- %cd %an: %s\n' --date=format:'%Y-%m-%d %H:%M:%S') - echo "$log" - echo "log_state="$log"" >> $GITHUB_ENV - - # 创建Changelog文件 triggered by git tag push - - name: Generate Changelog - if: startsWith(github.ref, 'refs/tags/') - run: | - echo -e '${{ env.log_state }}' > release.md - - # 创建release 上传release - # https://github.com/marketplace/actions/create-release - - name: Create release and upload-archive - uses: ncipollo/release-action@v1 - with: - prerelease: false - bodyFile: release.md - artifacts: ${{ env.SHARED_PKG_NAME }}.7z, ${{ env.STATIC_PKG_NAME }}.7z, ${{ env.JAVA_PKG_NAME }}.7z - allowUpdates: true - artifactContentType: application/x-7z-compressed - token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/old/windows-1.15.1.yml b/.github/old/windows-1.15.1.yml deleted file mode 100644 index 68116a1..0000000 --- a/.github/old/windows-1.15.1.yml +++ /dev/null @@ -1,156 +0,0 @@ -name: windows - -on: - workflow_dispatch: - push: - tags: - - '*' - -jobs: - windows: - strategy: - fail-fast: false - matrix: - list: - - { win_ver: 2019, vs_name: vs2019, vs_ver: v142 } - - { win_ver: 2022, vs_name: vs2022, vs_ver: v143 } - crt: - [ - md, - mt, - ] - - runs-on: windows-${{ matrix.list.win_ver }} - - name: windows-${{ matrix.list.vs_name }}-${{ matrix.crt }} - - env: - ONNX_VERSION: v1.15.1 - BUILD_SCRIPT: build-onnxruntime.bat - SHARED_PKG_NAME: onnxruntime-1.15.1-windows-${{ matrix.list.vs_name }}-shared-${{ matrix.crt }} - STATIC_PKG_NAME: onnxruntime-1.15.1-windows-${{ matrix.list.vs_name }}-static-${{ matrix.crt }} - JAVA_PKG_NAME: onnxruntime-1.15.1-windows-${{ matrix.list.vs_name }}-java-${{ matrix.crt }} - - steps: - # Setup JDK 8 - - name: Set up JDK 8 - uses: actions/setup-java@v3 - with: - java-version: '8' - distribution: 'adopt' - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.8.10' - - # 检出代码 - - uses: actions/checkout@v3 - - # 检出onnxruntime - - name: checkout onnxruntime - uses: actions/checkout@v3 - with: - repository: microsoft/onnxruntime - path: onnxruntime-${{ env.ONNX_VERSION }} - ref: ${{ env.ONNX_VERSION }} - submodules: recursive - - # 复制编译脚本 - - name: copy build script - run: | - cp ${{ env.BUILD_SCRIPT }} onnxruntime-${{ env.ONNX_VERSION }} - - # 编译 - - name: build - run: | - cd onnxruntime-${{ env.ONNX_VERSION }} - ./${{ env.BUILD_SCRIPT }} ${{ matrix.list.vs_ver }} ${{ matrix.crt }} - - # install文件夹改名,并使用7z压缩 - - name: 7zip - run: | - mv onnxruntime-${{ env.ONNX_VERSION }}/build-x64-${{ matrix.list.vs_ver }}-${{ matrix.crt }}/Release/install windows-x64 - mv onnxruntime-${{ env.ONNX_VERSION }}/build-Win32-${{ matrix.list.vs_ver }}-${{ matrix.crt }}/Release/install windows-x86 - 7z a ${{ env.SHARED_PKG_NAME }}.7z windows-x64 windows-x86 - rm windows-x64 -r -fo - rm windows-x86 -r -fo - mv onnxruntime-${{ env.ONNX_VERSION }}/build-x64-${{ matrix.list.vs_ver }}-${{ matrix.crt }}/Release/install-static windows-x64 - mv onnxruntime-${{ env.ONNX_VERSION }}/build-Win32-${{ matrix.list.vs_ver }}-${{ matrix.crt }}/Release/install-static windows-x86 - 7z a ${{ env.STATIC_PKG_NAME }}.7z windows-x64 windows-x86 - rm windows-x64 -r -fo - rm windows-x86 -r -fo - mv onnxruntime-${{ env.ONNX_VERSION }}/build-x64-${{ matrix.list.vs_ver }}-${{ matrix.crt }}/Release/java/build ${{ env.JAVA_PKG_NAME }} - 7z a ${{ env.JAVA_PKG_NAME }}.7z ${{ env.JAVA_PKG_NAME }} - - # 上传artifact - - name: upload - uses: actions/upload-artifact@v3 - with: - name: ${{ env.SHARED_PKG_NAME }} - path: ${{ env.SHARED_PKG_NAME }}.7z - - - name: upload - uses: actions/upload-artifact@v3 - with: - name: ${{ env.STATIC_PKG_NAME }} - path: ${{ env.STATIC_PKG_NAME }}.7z - - - name: upload - uses: actions/upload-artifact@v3 - with: - name: ${{ env.JAVA_PKG_NAME }} - path: ${{ env.JAVA_PKG_NAME }}.7z - - release: - needs: [ windows ] - - runs-on: ubuntu-latest - - steps: - # 检出代码 - - uses: actions/checkout@v3 - - # 获取所有的git log和tag - - name: Unshallow - run: git fetch --prune --unshallow - - # 获取git log 从 previousTag 到 lastTag - - name: Get git log - id: git-log - run: | - previousTag=$(git describe --abbrev=0 --tags `git rev-list --tags --skip=1 --max-count=1`) - lastTag=$(git describe --abbrev=0 --tags) - echo "previousTag:$previousTag ~ lastTag:$lastTag" - log=$(git log $previousTag..$lastTag --pretty=format:'- %cd %an: %s\n' --date=format:'%Y-%m-%d %H:%M:%S') - echo "$log" - echo "log_state="$log"" >> $GITHUB_ENV - - # 创建Changelog文件 triggered by git tag push - - name: Generate Changelog - if: startsWith(github.ref, 'refs/tags/') - run: | - echo -e '${{ env.log_state }}' > release.md - - # 下载artifact - - name: download - uses: actions/download-artifact@v3 - with: - path: artifacts - - # 查看artifact - - name: list artifact - run: | - tree artifacts - - # 创建release 上传release - # https://github.com/marketplace/actions/create-release - - name: upload-windows - uses: ncipollo/release-action@v1 - with: - prerelease: false - bodyFile: release.md - artifacts: artifacts/*/*.7z - allowUpdates: true - artifactContentType: application/x-7z-compressed - token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/old/windows-1.16.3.yml b/.github/old/windows-1.16.3.yml deleted file mode 100644 index e1c633f..0000000 --- a/.github/old/windows-1.16.3.yml +++ /dev/null @@ -1,156 +0,0 @@ -name: windows - -on: - workflow_dispatch: - push: - tags: - - '*' - -jobs: - windows: - strategy: - fail-fast: false - matrix: - ver: - - { onnx: v1.16.3 } - list: - - { win_ver: 2022, vs_name: vs2022, vs_ver: v143 } - crt: - [ - md, - mt, - ] - - runs-on: windows-${{ matrix.list.win_ver }} - - name: windows-${{ matrix.list.vs_name }}-${{ matrix.crt }} - - env: - BUILD_SCRIPT: build-onnxruntime.bat - SHARED_PKG_NAME: onnxruntime-${{ matrix.ver.onnx }}-windows-${{ matrix.list.vs_name }}-shared-${{ matrix.crt }} - STATIC_PKG_NAME: onnxruntime-${{ matrix.ver.onnx }}-windows-${{ matrix.list.vs_name }}-static-${{ matrix.crt }} - JAVA_PKG_NAME: onnxruntime-${{ matrix.ver.onnx }}-windows-${{ matrix.list.vs_name }}-java-${{ matrix.crt }} - - steps: - # Setup JDK 8 - - name: Set up JDK 8 - uses: actions/setup-java@v3 - with: - java-version: '8' - distribution: 'adopt' - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.8.10' - - # 检出代码 - - uses: actions/checkout@v3 - - # 检出onnxruntime - - name: checkout onnxruntime - uses: actions/checkout@v3 - with: - repository: microsoft/onnxruntime - path: onnxruntime-${{ matrix.ver.onnx }} - ref: ${{ matrix.ver.onnx }} - submodules: recursive - - # 复制编译脚本 - - name: copy build script - run: | - cp ${{ env.BUILD_SCRIPT }} onnxruntime-${{ matrix.ver.onnx }} - - # 编译 - - name: build - run: | - cd onnxruntime-${{ matrix.ver.onnx }} - ./${{ env.BUILD_SCRIPT }} ${{ matrix.list.vs_ver }} ${{ matrix.crt }} - - # install文件夹改名,并使用7z压缩 - - name: 7zip - run: | - mv onnxruntime-${{ matrix.ver.onnx }}/build-x64-${{ matrix.list.vs_ver }}-${{ matrix.crt }}/Release/install windows-x64 - mv onnxruntime-${{ matrix.ver.onnx }}/build-Win32-${{ matrix.list.vs_ver }}-${{ matrix.crt }}/Release/install windows-x86 - 7z a ${{ env.SHARED_PKG_NAME }}.7z windows-x64 windows-x86 - rm windows-x64 -r -fo - rm windows-x86 -r -fo - mv onnxruntime-${{ matrix.ver.onnx }}/build-x64-${{ matrix.list.vs_ver }}-${{ matrix.crt }}/Release/install-static windows-x64 - mv onnxruntime-${{ matrix.ver.onnx }}/build-Win32-${{ matrix.list.vs_ver }}-${{ matrix.crt }}/Release/install-static windows-x86 - 7z a ${{ env.STATIC_PKG_NAME }}.7z windows-x64 windows-x86 - rm windows-x64 -r -fo - rm windows-x86 -r -fo - mv onnxruntime-${{ matrix.ver.onnx }}/build-x64-${{ matrix.list.vs_ver }}-${{ matrix.crt }}/Release/java/build/libs ${{ env.JAVA_PKG_NAME }} - 7z a ${{ env.JAVA_PKG_NAME }}.7z ${{ env.JAVA_PKG_NAME }} - - # 上传artifact - - name: upload - uses: actions/upload-artifact@v3 - with: - name: ${{ env.SHARED_PKG_NAME }} - path: ${{ env.SHARED_PKG_NAME }}.7z - - - name: upload - uses: actions/upload-artifact@v3 - with: - name: ${{ env.STATIC_PKG_NAME }} - path: ${{ env.STATIC_PKG_NAME }}.7z - - - name: upload - uses: actions/upload-artifact@v3 - with: - name: ${{ env.JAVA_PKG_NAME }} - path: ${{ env.JAVA_PKG_NAME }}.7z - - release: - needs: [ windows ] - - runs-on: ubuntu-latest - - steps: - # 检出代码 - - uses: actions/checkout@v3 - - # 获取所有的git log和tag - - name: Unshallow - run: git fetch --prune --unshallow - - # 获取git log 从 previousTag 到 lastTag - - name: Get git log - id: git-log - run: | - previousTag=$(git describe --abbrev=0 --tags `git rev-list --tags --skip=1 --max-count=1`) - lastTag=$(git describe --abbrev=0 --tags) - echo "previousTag:$previousTag ~ lastTag:$lastTag" - log=$(git log $previousTag..$lastTag --pretty=format:'- %cd %an: %s\n' --date=format:'%Y-%m-%d %H:%M:%S') - echo "$log" - echo "log_state="$log"" >> $GITHUB_ENV - - # 创建Changelog文件 triggered by git tag push - - name: Generate Changelog - if: startsWith(github.ref, 'refs/tags/') - run: | - echo -e '${{ env.log_state }}' > release.md - - # 下载artifact - - name: download - uses: actions/download-artifact@v3 - with: - path: artifacts - - # 查看artifact - - name: list artifact - run: | - tree artifacts - - # 创建release 上传release - # https://github.com/marketplace/actions/create-release - - name: upload-windows - uses: ncipollo/release-action@v1 - with: - prerelease: false - bodyFile: release.md - artifacts: artifacts/*/*.7z - allowUpdates: true - artifactContentType: application/x-7z-compressed - token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index ef0450b..5c1e848 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -14,7 +14,7 @@ jobs: fail-fast: false matrix: ver: - - { onnx: v1.17.0, ndk: 26.1.10909125, gradle: 6.5 } + - { onnx: v1.17.0, ndk: 26.1.10909125, gradle: 8.5 } list: - { arch: armeabi-v7a, min: 19 } - { arch: arm64-v8a, min: 21 } @@ -49,8 +49,8 @@ jobs: with: gradle-version: ${{ matrix.ver.gradle }} - # Setup JDK 8 - - name: Set up JDK 8 + # Setup JDK 11 + - name: Set up JDK 11 uses: actions/setup-java@v3 with: java-version: '11' diff --git a/.github/workflows/musl.yml b/.github/workflows/musl.yml index 73b1f78..aae0b8d 100644 --- a/.github/workflows/musl.yml +++ b/.github/workflows/musl.yml @@ -2,9 +2,6 @@ name: musl on: workflow_dispatch: - push: - tags: - - '*' jobs: musl-cross-build: @@ -14,7 +11,7 @@ jobs: fail-fast: false matrix: ver: - - { onnx: v1.17.0, musl: 11.3.1 } + - { onnx: v1.17.0, musl: 12.2.0 } arch: [ aarch64-linux-musl, @@ -74,7 +71,7 @@ jobs: env: BUILD_SCRIPT: build-onnxruntime-musl.sh - BUILD_OPTIONS: onnxruntime_options.txt + BUILD_OPTIONS: onnxruntime_options-${{ matrix.ver.onnx }}.txt SHARED_PKG_NAME: onnxruntime-${{ matrix.ver.onnx }}-${{ matrix.arch }}-shared STATIC_PKG_NAME: onnxruntime-${{ matrix.ver.onnx }}-${{ matrix.arch }}-static diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index c8b7f5c..bb2b461 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -12,7 +12,7 @@ jobs: fail-fast: false matrix: ver: - - { onnx: v1.17.0 } + - { onnx: v1.17.0, gradle: 8.5 } list: - { win_ver: 2022, vs_name: vs2022, vs_ver: v143 } crt: @@ -44,6 +44,13 @@ jobs: java-version: '8' distribution: 'adopt' + - uses: gradle/actions/setup-gradle@v3 + with: + gradle-version: ${{ matrix.ver.gradle }} + + - name: test gradle + run: gradle --version + # 检出代码 - uses: actions/checkout@v3 diff --git a/build-onnxruntime-musl.sh b/build-onnxruntime-musl.sh index f434d5c..8939366 100644 --- a/build-onnxruntime-musl.sh +++ b/build-onnxruntime-musl.sh @@ -41,20 +41,24 @@ function cmakeBuild() { mkdir -p "build-$sysOS" pushd "build-$sysOS" - mkdir -p "host_protoc" - pushd "host_protoc" - cmake -Dprotobuf_BUILD_TESTS=OFF \ - -Dprotobuf_WITH_ZLIB_DEFAULT=OFF \ - -Dprotobuf_BUILD_SHARED_LIBS=OFF \ - ../../cmake/external/protobuf/cmake - cmake --build . -j $NUM_THREADS --config Release --target protoc - popd - BUILD_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +# mkdir -p "host_protoc" +# pushd "host_protoc" +# cmake -Dprotobuf_BUILD_TESTS=OFF \ +# -Dprotobuf_WITH_ZLIB_DEFAULT=OFF \ +# -Dprotobuf_BUILD_SHARED_LIBS=OFF \ +# ../../cmake/external/protobuf/cmake +# cmake --build . -j $NUM_THREADS --config Release --target protoc +# popd +# BUILD_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cmake -DCMAKE_BUILD_TYPE=$1 \ -DCMAKE_TOOLCHAIN_FILE=../musl-cross.toolchain.cmake \ - -DONNX_CUSTOM_PROTOC_EXECUTABLE=$BUILD_DIR/host_protoc/protoc \ -DCMAKE_INSTALL_PREFIX=install \ - $(cat ../onnxruntime_options-v1.6.0.txt) \ + -DCMAKE_C_FLAGS="-DNDEBUG -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -O3 -pipe -fstack-clash-protection -fcf-protection" \ + -DCMAKE_CXX_FLAGS="-DNDEBUG -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -O3 -pipe -fstack-clash-protection -fcf-protection" \ + -DCMAKE_EXE_LINKER_FLAGS_INIT="-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -Wl,--strip-all" \ + -DCMAKE_MODULE_LINKER_FLAGS_INIT="-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -Wl,--strip-all" \ + -DCMAKE_SHARED_LINKER_FLAGS_INIT="-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -Wl,--strip-all" \ + $(cat ../onnxruntime_options-v1.17.0.txt) \ ../cmake cmake --build . -j $NUM_THREADS cmake --build . --target install @@ -90,4 +94,3 @@ fi cmakeBuild "Release" - diff --git a/onnxruntime_options-v1.17.0.txt b/onnxruntime_options-v1.17.0.txt new file mode 100644 index 0000000..9e6a058 --- /dev/null +++ b/onnxruntime_options-v1.17.0.txt @@ -0,0 +1,81 @@ +-Donnxruntime_RUN_ONNX_TESTS=OFF +-Donnxruntime_GENERATE_TEST_REPORTS=OFF +-Donnxruntime_USE_MIMALLOC=OFF +-Donnxruntime_ENABLE_PYTHON=OFF +-Donnxruntime_BUILD_CSHARP=OFF +-Donnxruntime_BUILD_JAVA=OFF +-Donnxruntime_BUILD_NODEJS=OFF +-Donnxruntime_BUILD_OBJC=OFF +-Donnxruntime_BUILD_SHARED_LIB=ON +-Donnxruntime_BUILD_APPLE_FRAMEWORK=OFF +-Donnxruntime_USE_DNNL=OFF +-Donnxruntime_USE_NNAPI_BUILTIN=OFF +-Donnxruntime_USE_RKNPU=OFF +-Donnxruntime_USE_LLVM=OFF +-Donnxruntime_ENABLE_MICROSOFT_INTERNAL=OFF +-Donnxruntime_USE_VITISAI=OFF +-Donnxruntime_USE_TENSORRT=OFF +-Donnxruntime_USE_TENSORRT_BUILTIN_PARSER=ON +-Donnxruntime_USE_TVM=OFF +-Donnxruntime_TVM_CUDA_RUNTIME=OFF +-Donnxruntime_TVM_USE_HASH=OFF +-Donnxruntime_USE_MIGRAPHX=OFF +-Donnxruntime_DISABLE_CONTRIB_OPS=OFF +-Donnxruntime_DISABLE_ML_OPS=OFF +-Donnxruntime_DISABLE_RTTI=OFF +-Donnxruntime_DISABLE_EXCEPTIONS=OFF +-Donnxruntime_MINIMAL_BUILD=OFF +-Donnxruntime_EXTENDED_MINIMAL_BUILD=OFF +-Donnxruntime_MINIMAL_BUILD_CUSTOM_OPS=OFF +-Donnxruntime_REDUCED_OPS_BUILD=OFF +-Donnxruntime_ENABLE_LANGUAGE_INTEROP_OPS=OFF +-Donnxruntime_USE_DML=OFF +-Donnxruntime_USE_WINML=OFF +-Donnxruntime_BUILD_MS_EXPERIMENTAL_OPS=OFF +-Donnxruntime_USE_TELEMETRY=OFF +-Donnxruntime_ENABLE_LTO=OFF +-Donnxruntime_USE_ACL=OFF +-Donnxruntime_USE_ACL_1902=OFF +-Donnxruntime_USE_ACL_1905=OFF +-Donnxruntime_USE_ACL_1908=OFF +-Donnxruntime_USE_ACL_2002=OFF +-Donnxruntime_USE_ACL_2308=OFF +-Donnxruntime_USE_ARMNN=OFF +-Donnxruntime_ARMNN_RELU_USE_CPU=ON +-Donnxruntime_ARMNN_BN_USE_CPU=ON +-Donnxruntime_USE_JSEP=OFF +-Donnxruntime_ENABLE_NVTX_PROFILE=OFF +-Donnxruntime_ENABLE_TRAINING=OFF +-Donnxruntime_ENABLE_TRAINING_OPS=OFF +-Donnxruntime_ENABLE_TRAINING_APIS=OFF +-Donnxruntime_ENABLE_CPU_FP16_OPS=OFF +-Donnxruntime_USE_NCCL=OFF +-Donnxruntime_BUILD_BENCHMARKS=OFF +-Donnxruntime_USE_ROCM=OFF +-DOnnxruntime_GCOV_COVERAGE=OFF +-Donnxruntime_USE_MPI=OFF +-Donnxruntime_ENABLE_MEMORY_PROFILE=OFF +-Donnxruntime_ENABLE_CUDA_LINE_NUMBER_INFO=OFF +-Donnxruntime_USE_CUDA_NHWC_OPS=OFF +-Donnxruntime_BUILD_WEBASSEMBLY_STATIC_LIB=OFF +-Donnxruntime_ENABLE_WEBASSEMBLY_EXCEPTION_CATCHING=ON +-Donnxruntime_ENABLE_WEBASSEMBLY_API_EXCEPTION_CATCHING=OFF +-Donnxruntime_ENABLE_WEBASSEMBLY_EXCEPTION_THROWING=ON +-Donnxruntime_WEBASSEMBLY_RUN_TESTS_IN_BROWSER=OFF +-Donnxruntime_ENABLE_WEBASSEMBLY_THREADS=OFF +-Donnxruntime_ENABLE_WEBASSEMBLY_DEBUG_INFO=OFF +-Donnxruntime_ENABLE_WEBASSEMBLY_PROFILING=OFF +-Donnxruntime_ENABLE_LAZY_TENSOR=OFF +-Donnxruntime_ENABLE_EXTERNAL_CUSTOM_OP_SCHEMAS=OFF +-Donnxruntime_ENABLE_CUDA_PROFILING=OFF +-Donnxruntime_ENABLE_ROCM_PROFILING=OFF +-Donnxruntime_USE_XNNPACK=OFF +-Donnxruntime_USE_WEBNN=OFF +-Donnxruntime_USE_CANN=OFF +-Donnxruntime_USE_TRITON_KERNEL=OFF +-Donnxruntime_DISABLE_FLOAT8_TYPES=OFF +-Donnxruntime_DISABLE_SPARSE_TENSORS=OFF +-Donnxruntime_DISABLE_OPTIONAL_TYPE=OFF +-Donnxruntime_BUILD_UNIT_TESTS=OFF +-DCMAKE_TLS_VERIFY=ON +-DFETCHCONTENT_QUIET=OFF \ No newline at end of file diff --git a/v1.15.1/build-onnxruntime-1.15.1.bat b/v1.15.1/build-onnxruntime-1.15.1.bat deleted file mode 100644 index 9583b02..0000000 --- a/v1.15.1/build-onnxruntime-1.15.1.bat +++ /dev/null @@ -1,102 +0,0 @@ -:: build onnxruntime 1.15.1 for windows by benjaminwan -:: x64 build_java, x86 Java is currently not supported on 32-bit x86 architecture - -@ECHO OFF -chcp 65001 -cls -SETLOCAL EnableDelayedExpansion - -IF "%1"=="" ( - echo input VS_VER none, use v142 - set VS_VER="v142" -)^ -ELSE ( - echo input VS_VER:%1 - set VS_VER="%1" -) - -IF "%2"=="" ( - echo input CRT none, use mt - set CRT="mt" -)^ -ELSE ( - echo input CRT:%2 - set CRT="%2" -) - -call :cmakeParams "x64" %VS_VER% %CRT% -call :cmakeParams "Win32" %VS_VER% %CRT% -GOTO:EOF - -:getFileName -call set "libs=%%libs%% %~n1" -GOTO:EOF - -:getLibsList -set "InFile=onnxruntime.dir\Release\onnxruntime.tlog\link.read.1.tlog" -set "OutFile=libs_list.txt" -set "LikeLine=RELEASE\*.LIB" -powershell -Command "$data = foreach($line in gc %InFile%){ $line.split(" ")} $data | Out-File %OutFile%" -powershell -Command "$data = foreach($line in gc %OutFile%){ if($line -like '*%LikeLine%*') {$line}} $data | Out-File -Encoding ascii %OutFile%" -GOTO:EOF - -:collectLibs -cmake --build . --config Release --target install -del /s/q install\*test*.exe -copy install\include\onnxruntime\core\session\* install\include -rd /S /Q install\include\onnxruntime -echo set(OnnxRuntime_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/include") > install/OnnxRuntimeConfig.cmake -echo include_directories(${OnnxRuntime_INCLUDE_DIRS}) >> install/OnnxRuntimeConfig.cmake -echo link_directories(${CMAKE_CURRENT_LIST_DIR}/lib) >> install/OnnxRuntimeConfig.cmake -echo set(OnnxRuntime_LIBS onnxruntime) >> install/OnnxRuntimeConfig.cmake - -mkdir install-static\lib -xcopy install\include install-static\include /s /y /i -call :getLibsList - -set libs= -for /f "Delims=" %%a in (libs_list.txt) do ( -copy %%a install-static\lib -call :getFileName %%a -) - -echo set(OnnxRuntime_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/include") > install-static\OnnxRuntimeConfig.cmake -echo include_directories(${OnnxRuntime_INCLUDE_DIRS}) >> install-static\OnnxRuntimeConfig.cmake -echo link_directories(${CMAKE_CURRENT_LIST_DIR}/lib) >> install-static\OnnxRuntimeConfig.cmake -echo set(OnnxRuntime_LIBS %libs%) >> install-static\OnnxRuntimeConfig.cmake -copy onnxruntime.dir\Release\onnxruntime.tlog\link.read.1.tlog install-static\link.log -GOTO:EOF - -:cmakeParams -if "%~1" == "Win32" ( - set MACHINE_FLAG="--x86" -)^ -else ( - set MACHINE_FLAG="--build_java" -) -if "%~2" == "v142" ( - set VS_FLAG=--cmake_generator "Visual Studio 16 2019" -)^ -else ( - set VS_FLAG=--cmake_generator "Visual Studio 17 2022" -) -if "%~3" == "mt" ( - set STATIC_CRT_FLAG="--enable_msvc_static_runtime" -)^ -else ( - set STATIC_CRT_FLAG= -) -python %~dp0\tools\ci_build\build.py --build_dir %~dp0\build-%~1-%~2-%~3 ^ - --config Release ^ - --update ^ - --parallel ^ - --skip_tests ^ - --build_shared_lib ^ - %STATIC_CRT_FLAG% ^ - %MACHINE_FLAG% ^ - %VS_FLAG% ^ - --cmake_extra_defines CMAKE_INSTALL_PREFIX=./install onnxruntime_BUILD_UNIT_TESTS=OFF -pushd "build-%~1-%~2-%~3"\Release -call :collectLibs -popd -GOTO:EOF \ No newline at end of file diff --git a/v1.15.1/build-onnxruntime-1.15.1.sh b/v1.15.1/build-onnxruntime-1.15.1.sh deleted file mode 100644 index dcedfd8..0000000 --- a/v1.15.1/build-onnxruntime-1.15.1.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash -# build onnxruntime by benjaminwan -# CMakeFiles/onnxruntime.dir/link.txt/link/lib*.a - -function collectLibs() { - # shared lib - cmake --build . --config Release --target install - rm -r -f install/bin - mv install/include/onnxruntime/core/session/* install/include - rm -rf install/include/onnxruntime - echo "set(OnnxRuntime_INCLUDE_DIRS \"\${CMAKE_CURRENT_LIST_DIR}/include\")" > install/OnnxRuntimeConfig.cmake - echo "include_directories(\${OnnxRuntime_INCLUDE_DIRS})" >> install/OnnxRuntimeConfig.cmake - echo "link_directories(\${CMAKE_CURRENT_LIST_DIR}/lib)" >> install/OnnxRuntimeConfig.cmake - echo "set(OnnxRuntime_LIBS onnxruntime)" >> install/OnnxRuntimeConfig.cmake - - # static lib - mkdir -p install-static/lib - cp -r install/include install-static - all_link=$(cat CMakeFiles/onnxruntime.dir/link.txt) - link=${all_link#*onnxruntime.dir} - regex="lib.*.a$" - libs="" - for var in $link; do - if [[ ${var} =~ ${regex} ]]; then - echo cp ${var} install-static/lib - cp ${var} install-static/lib - name=$(echo $var | grep -E ${regex} -o) - name=${name#lib} - name=${name%.a} - libs="${libs} ${name}" - fi - done - echo "set(OnnxRuntime_INCLUDE_DIRS \"\${CMAKE_CURRENT_LIST_DIR}/include\")" > install-static/OnnxRuntimeConfig.cmake - echo "include_directories(\${OnnxRuntime_INCLUDE_DIRS})" >> install-static/OnnxRuntimeConfig.cmake - echo "link_directories(\${CMAKE_CURRENT_LIST_DIR}/lib)" >> install-static/OnnxRuntimeConfig.cmake - echo "set(OnnxRuntime_LIBS $libs)" >> install-static/OnnxRuntimeConfig.cmake - cp CMakeFiles/onnxruntime.dir/link.txt install-static/link.log -} - -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -sysOS=$(uname -s) - -if [ $sysOS == "Darwin" ]; then - echo "I'm MacOS" -elif [ $sysOS == "Linux" ]; then - echo "I'm Linux" -else - echo "Other OS: $sysOS" - exit 0 -fi - - -python3 $DIR/tools/ci_build/build.py --build_dir $DIR/build-$sysOS \ - --allow_running_as_root \ - --config Release \ - --parallel \ - --skip_tests \ - --build_shared_lib \ - --build_java \ - --cmake_extra_defines CMAKE_INSTALL_PREFIX=./install onnxruntime_BUILD_UNIT_TESTS=OFF - -pushd build-$sysOS/Release -collectLibs -popd diff --git a/v1.15.1/build-onnxruntime-android-1.15.1.sh b/v1.15.1/build-onnxruntime-android-1.15.1.sh deleted file mode 100644 index cf08c43..0000000 --- a/v1.15.1/build-onnxruntime-android-1.15.1.sh +++ /dev/null @@ -1,92 +0,0 @@ -#!/bin/bash -# build onnxruntime by benjaminwan -# CMakeFiles/onnxruntime.dir/link.txt/link/lib*.a -# ANDROID_NDK_HOME=/path/android-sdk/ndk/22.1.7171670 - -function collectLibs() { - # shared lib - cmake --build . --config Release --target install - rm -r -f install/bin - mv install/include/onnxruntime/core/session/* install/include - rm -rf install/include/onnxruntime - echo "set(OnnxRuntime_INCLUDE_DIRS \"\${CMAKE_CURRENT_LIST_DIR}/include\")" > install/OnnxRuntimeConfig.cmake - echo "include_directories(\${OnnxRuntime_INCLUDE_DIRS})" >> install/OnnxRuntimeConfig.cmake - echo "link_directories(\${CMAKE_CURRENT_LIST_DIR}/lib)" >> install/OnnxRuntimeConfig.cmake - echo "set(OnnxRuntime_LIBS onnxruntime)" >> install/OnnxRuntimeConfig.cmake - - # static lib - mkdir -p install-static/lib - cp -r install/include install-static - all_link=$(cat CMakeFiles/onnxruntime.dir/link.txt) - link=${all_link#*onnxruntime.dir} - regex="lib.*.a$" - libs="" - for var in $link; do - if [[ ${var} =~ ${regex} ]]; then - echo cp ${var} install-static/lib - cp ${var} install-static/lib - name=$(echo $var | grep -E ${regex} -o) - name=${name#lib} - name=${name%.a} - libs="${libs} ${name}" - fi - done - echo "set(OnnxRuntime_INCLUDE_DIRS \"\${CMAKE_CURRENT_LIST_DIR}/include\")" > install-static/OnnxRuntimeConfig.cmake - echo "include_directories(\${OnnxRuntime_INCLUDE_DIRS})" >> install-static/OnnxRuntimeConfig.cmake - echo "link_directories(\${CMAKE_CURRENT_LIST_DIR}/lib)" >> install-static/OnnxRuntimeConfig.cmake - echo "set(OnnxRuntime_LIBS $libs)" >> install-static/OnnxRuntimeConfig.cmake - cp CMakeFiles/onnxruntime.dir/link.txt install-static/link.log -} - -function pyBuild() { - echo ANDROID_HOME=$ANDROID_HOME - echo ANDROID_NDK_HOME=$ANDROID_NDK_HOME - python3 $DIR/tools/ci_build/build.py --build_dir $DIR/build-android-$1 \ - --config Release \ - --parallel \ - --skip_tests \ - --build_shared_lib \ - --android \ - --android_abi $1 \ - --android_api $2 \ - --android_sdk_path $ANDROID_HOME \ - --android_ndk_path $ANDROID_NDK_HOME \ - --cmake_extra_defines CMAKE_INSTALL_PREFIX=./install onnxruntime_BUILD_UNIT_TESTS=OFF - - pushd build-android-$1/Release - collectLibs - popd -} - -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -sysOS=$(uname -s) - -if [ $sysOS == "Darwin" ]; then - echo "I'm MacOS" -elif [ $sysOS == "Linux" ]; then - echo "I'm Linux" -else - echo "Other OS: $sysOS" - exit 0 -fi - -if [ "$1" ]; then - echo "set ARCH_TYPE=$1" - ARCH_TYPE="$1" -else - echo "#1 ARCH_TYPE is empty("armeabi-v7a","arm64-v8a","x86","x86_64"), use arm64-v8a" - ARCH_TYPE="arm64-v8a" -fi - -if [ "$2" ]; then - echo "set MIN_SDK=$2" - MIN_SDK="$2" -else - echo "#2 MIN_SDK is empty, use 21" -fi - -pyBuild $1 $2 - -#echo "message(\"OnnxRuntime Path: \${CMAKE_CURRENT_LIST_DIR}/\${ANDROID_ABI}\")" > OnnxRuntimeWrapper.cmake -#echo "set(OnnxRuntime_DIR \"\${CMAKE_CURRENT_LIST_DIR}/\${ANDROID_ABI}\")" >> OnnxRuntimeWrapper.cmake -