Skip to content

Merge branch 'personal/reduce_size' of https://github.com/zuckrepo/nc… #4

Merge branch 'personal/reduce_size' of https://github.com/zuckrepo/nc…

Merge branch 'personal/reduce_size' of https://github.com/zuckrepo/nc… #4

Workflow file for this run

name: release
on:
push:
tags:
- '*'
env:
DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer
IOS_DEPLOYMENT_TARGET: '13.0'
MAC_DEPLOYMENT_TARGET: '11.0'
MAC_CATALYST_DEPLOYMENT_TARGET: '13.1'
WATCHOS_DEPLOYMENT_TARGET: '6.0'
TVOS_DEPLOYMENT_TARGET: '11.0'
VISIONOS_DEPLOYMENT_TARGET: '1.0'
ENABLE_BITCODE: OFF
ENABLE_ARC: OFF
ENABLE_VISIBILITY: OFF
EMSCRIPTEN_VERSION: 3.1.28
permissions:
contents: read
jobs:
setup:
permissions:
contents: none
runs-on: ubuntu-latest
outputs:
VERSION: ${{ steps.get_version.outputs.VERSION }}
steps:
- name: get-version
id: get_version
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
full-source:
needs: [setup]
runs-on: ubuntu-latest
env:
PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-full-source
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: package
run: |
rm -rf .git
rm -f /tmp/${{ env.PACKAGENAME }}.zip
zip -9 -y -r /tmp/${{ env.PACKAGENAME }}.zip .
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGENAME }}
path: /tmp/${{ env.PACKAGENAME }}.zip
ubuntu-2004:
needs: [setup]
runs-on: ubuntu-20.04
env:
PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-ubuntu-2004
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: apt
run: |
sudo apt-get install -y libprotobuf-dev protobuf-compiler
- name: build
run: |
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF ..
cmake --build . -j 2
cmake --build . --target install/strip
- name: package
run: |
rm -rf ${{ env.PACKAGENAME }}
mkdir -p ${{ env.PACKAGENAME }}
cp -a build/install/* ${{ env.PACKAGENAME }}
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
ubuntu-2004-shared:
needs: [setup]
runs-on: ubuntu-20.04
env:
PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-ubuntu-2004-shared
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: apt
run: |
sudo apt-get install -y libprotobuf-dev protobuf-compiler
- name: build
run: |
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
cmake --build . -j $(nproc)
cmake --build . --target install/strip
- name: package
run: |
rm -rf ${{ env.PACKAGENAME }}
mkdir -p ${{ env.PACKAGENAME }}
cp -a -P build/install/* ${{ env.PACKAGENAME }}
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
ubuntu-2204:
needs: [setup]
runs-on: ubuntu-22.04
env:
PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-ubuntu-2204
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: apt
run: |
sudo apt-get install -y libprotobuf-dev protobuf-compiler
- name: build
run: |
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF ..
cmake --build . -j $(nproc)
cmake --build . --target install/strip
- name: package
run: |
rm -rf ${{ env.PACKAGENAME }}
mkdir -p ${{ env.PACKAGENAME }}
cp -a build/install/* ${{ env.PACKAGENAME }}
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
ubuntu-2204-shared:
needs: [setup]
runs-on: ubuntu-22.04
env:
PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-ubuntu-2204-shared
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: apt
run: |
sudo apt-get install -y libprotobuf-dev protobuf-compiler
- name: build
run: |
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
cmake --build . -j $(nproc)
cmake --build . --target install/strip
- name: package
run: |
rm -rf ${{ env.PACKAGENAME }}
mkdir -p ${{ env.PACKAGENAME }}
cp -a -P build/install/* ${{ env.PACKAGENAME }}
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
openmp-macos:
runs-on: macos-13
env:
OPENMP_VERSION: '18.1.2'
OPENMP_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$MAC_DEPLOYMENT_TARGET \
-DENABLE_BITCODE=$ENABLE_BITCODE \
-DENABLE_ARC=$ENABLE_ARC \
-DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
-DPERL_EXECUTABLE=/usr/local/bin/perl \
-DLIBOMP_ENABLE_SHARED=OFF \
-DLIBOMP_OMPT_SUPPORT=OFF \
-DLIBOMP_USE_HWLOC=OFF \
steps:
- name: cache-openmp
id: cache-openmp
uses: actions/cache@v4
with:
path: openmp-install
key: openmp-macos-release-18.1.2-20240403
- name: checkout
if: steps.cache-openmp.outputs.cache-hit != 'true'
uses: actions/checkout@v4
- name: openmp
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.OPENMP_VERSION }}/cmake-${{ env.OPENMP_VERSION }}.src.tar.xz
tar -xf cmake-${{ env.OPENMP_VERSION }}.src.tar.xz
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.OPENMP_VERSION }}/openmp-${{ env.OPENMP_VERSION }}.src.tar.xz
tar -xf openmp-${{ env.OPENMP_VERSION }}.src.tar.xz
mv cmake-${{ env.OPENMP_VERSION }}.src/Modules/* openmp-${{ env.OPENMP_VERSION }}.src/cmake/
cd openmp-${{ env.OPENMP_VERSION }}.src
wget https://github.com/nihui/llvm-project/commit/ef8c35bcf5d9cfdb0764ffde6a63c04ec715bc37.patch
patch -p2 -i ef8c35bcf5d9cfdb0764ffde6a63c04ec715bc37.patch
wget https://github.com/nihui/llvm-project/commit/5c12711f9a21f41bea70566bf15a4026804d6b20.patch
patch -p2 -i 5c12711f9a21f41bea70566bf15a4026804d6b20.patch
- name: build-x86_64
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
cd openmp-${{ env.OPENMP_VERSION }}.src
mkdir -p build-x86_64 && cd build-x86_64
cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=MAC -DARCHS="x86_64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: build-arm64
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
cd openmp-${{ env.OPENMP_VERSION }}.src
mkdir -p build-arm64 && cd build-arm64
cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=MAC_ARM64 -DARCHS="arm64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: merge-fat-library
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
rm -rf $GITHUB_WORKSPACE/openmp-install
mkdir -p $GITHUB_WORKSPACE/openmp-install
cp -a openmp-${{ env.OPENMP_VERSION }}.src/build-x86_64/install/include $GITHUB_WORKSPACE/openmp-install
mkdir -p $GITHUB_WORKSPACE/openmp-install/lib
lipo -create \
openmp-${{ env.OPENMP_VERSION }}.src/build-x86_64/install/lib/libomp.a \
openmp-${{ env.OPENMP_VERSION }}.src/build-arm64/install/lib/libomp.a \
-o $GITHUB_WORKSPACE/openmp-install/lib/libomp.a
- name: upload
uses: actions/upload-artifact@v4
with:
name: openmp-macos
path: openmp-install
macos:
needs: [setup, openmp-macos]
runs-on: macos-13
env:
PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-macos
NCNN_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$MAC_DEPLOYMENT_TARGET \
-DENABLE_BITCODE=$ENABLE_BITCODE \
-DENABLE_ARC=$ENABLE_ARC \
-DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
-DOpenMP_C_FLAGS="-Xclang -fopenmp" -DOpenMP_CXX_FLAGS="-Xclang -fopenmp" \
-DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_libomp_LIBRARY="libomp.a" \
-DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DNCNN_BUILD_TOOLS=OFF \
-DNCNN_BUILD_EXAMPLES=OFF \
-DNCNN_BUILD_BENCHMARK=OFF \
-DNCNN_OPENMP=OFF \
-DNCNN_SIMPLEOMP=OFF \
steps:
- uses: actions/checkout@v4
- name: download-openmp-macos
uses: actions/download-artifact@v4
with:
name: openmp-macos
path: openmp-macos
- name: install-openmp
run: |
sudo cp openmp-macos/include/* $DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
sudo cp openmp-macos/lib/libomp.a $DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib
- name: build-x86_64
run: |
mkdir build-x86_64 && cd build-x86_64
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=MAC -DARCHS="x86_64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: build-arm64
run: |
mkdir build-arm64 && cd build-arm64
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=MAC_ARM64 -DARCHS="arm64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: package-openmp
run: |
rm -rf openmp.framework
mkdir -p openmp.framework/Versions/A/Headers
mkdir -p openmp.framework/Versions/A/Resources
ln -s A openmp.framework/Versions/Current
ln -s Versions/Current/Headers openmp.framework/Headers
ln -s Versions/Current/Resources openmp.framework/Resources
ln -s Versions/Current/openmp openmp.framework/openmp
cp openmp-macos/lib/libomp.a openmp.framework/Versions/A/openmp
cp -a openmp-macos/include/* openmp.framework/Versions/A/Headers/
sed -e 's/__NAME__/openmp/g' -e 's/__IDENTIFIER__/org.llvm.openmp/g' -e 's/__VERSION__/18.1/g' Info.plist > openmp.framework/Versions/A/Resources/Info.plist
- name: package
run: |
rm -rf ncnn.framework
mkdir -p ncnn.framework/Versions/A/Headers
mkdir -p ncnn.framework/Versions/A/Resources
ln -s A ncnn.framework/Versions/Current
ln -s Versions/Current/Headers ncnn.framework/Headers
ln -s Versions/Current/Resources ncnn.framework/Resources
ln -s Versions/Current/ncnn ncnn.framework/ncnn
lipo -create build-x86_64/install/lib/libncnn.a build-arm64/install/lib/libncnn.a -o ncnn.framework/Versions/A/ncnn
cp -a build-x86_64/install/include/* ncnn.framework/Versions/A/Headers/
sed -e 's/__NAME__/ncnn/g' -e 's/__IDENTIFIER__/com.tencent.ncnn/g' -e 's/__VERSION__/1.0/g' Info.plist > ncnn.framework/Versions/A/Resources/Info.plist
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.framework ncnn.framework
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
macos-gpu:
needs: [setup, openmp-macos]
runs-on: macos-13
env:
PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-macos-vulkan
NCNN_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$MAC_DEPLOYMENT_TARGET \
-DENABLE_BITCODE=$ENABLE_BITCODE \
-DENABLE_ARC=$ENABLE_ARC \
-DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
-DOpenMP_C_FLAGS="-Xclang -fopenmp" -DOpenMP_CXX_FLAGS="-Xclang -fopenmp" \
-DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_libomp_LIBRARY="libomp.a" \
-DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DNCNN_VULKAN=ON \
-DNCNN_BUILD_TOOLS=OFF \
-DNCNN_BUILD_EXAMPLES=OFF \
-DNCNN_BUILD_BENCHMARK=OFF \
-DNCNN_OPENMP=OFF \
-DNCNN_SIMPLEOMP=OFF \
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: download-openmp-macos
uses: actions/download-artifact@v4
with:
name: openmp-macos
path: openmp-macos
- name: install-openmp
run: |
sudo cp openmp-macos/include/* $DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
sudo cp openmp-macos/lib/libomp.a $DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib
- name: build-x86_64
run: |
mkdir build-x86_64 && cd build-x86_64
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=MAC -DARCHS="x86_64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: build-arm64
run: |
mkdir build-arm64 && cd build-arm64
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=MAC_ARM64 -DARCHS="arm64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: package-openmp
run: |
rm -rf openmp.framework
mkdir -p openmp.framework/Versions/A/Headers
mkdir -p openmp.framework/Versions/A/Resources
ln -s A openmp.framework/Versions/Current
ln -s Versions/Current/Headers openmp.framework/Headers
ln -s Versions/Current/Resources openmp.framework/Resources
ln -s Versions/Current/openmp openmp.framework/openmp
cp openmp-macos/lib/libomp.a openmp.framework/Versions/A/openmp
cp -a openmp-macos/include/* openmp.framework/Versions/A/Headers/
sed -e 's/__NAME__/openmp/g' -e 's/__IDENTIFIER__/org.llvm.openmp/g' -e 's/__VERSION__/18.1/g' Info.plist > openmp.framework/Versions/A/Resources/Info.plist
- name: package-glslang
run: |
rm -rf glslang.framework
mkdir -p glslang.framework/Versions/A/Headers
mkdir -p glslang.framework/Versions/A/Resources
ln -s A glslang.framework/Versions/Current
ln -s Versions/Current/Headers glslang.framework/Headers
ln -s Versions/Current/Resources glslang.framework/Resources
ln -s Versions/Current/glslang glslang.framework/glslang
libtool -static build-x86_64/install/lib/libglslang.a build-x86_64/install/lib/libMachineIndependent.a build-x86_64/install/lib/libGenericCodeGen.a build-x86_64/install/lib/libSPIRV.a build-x86_64/install/lib/libOGLCompiler.a build-x86_64/install/lib/libOSDependent.a -o build-x86_64/install/lib/libglslang_combined.a
libtool -static build-arm64/install/lib/libglslang.a build-arm64/install/lib/libMachineIndependent.a build-arm64/install/lib/libGenericCodeGen.a build-arm64/install/lib/libSPIRV.a build-arm64/install/lib/libOGLCompiler.a build-arm64/install/lib/libOSDependent.a -o build-arm64/install/lib/libglslang_combined.a
lipo -create build-x86_64/install/lib/libglslang_combined.a build-arm64/install/lib/libglslang_combined.a -o glslang.framework/Versions/A/glslang
cp -a build-x86_64/install/include/glslang glslang.framework/Versions/A/Headers/
sed -e 's/__NAME__/glslang/g' -e 's/__IDENTIFIER__/org.khronos.glslang/g' -e 's/__VERSION__/1.0/g' Info.plist > glslang.framework/Versions/A/Resources/Info.plist
- name: package
run: |
rm -rf ncnn.framework
mkdir -p ncnn.framework/Versions/A/Headers
mkdir -p ncnn.framework/Versions/A/Resources
ln -s A ncnn.framework/Versions/Current
ln -s Versions/Current/Headers ncnn.framework/Headers
ln -s Versions/Current/Resources ncnn.framework/Resources
ln -s Versions/Current/ncnn ncnn.framework/ncnn
lipo -create build-x86_64/install/lib/libncnn.a build-arm64/install/lib/libncnn.a -o ncnn.framework/Versions/A/ncnn
cp -a build-x86_64/install/include/ncnn ncnn.framework/Versions/A/Headers/
sed -e 's/__NAME__/ncnn/g' -e 's/__IDENTIFIER__/com.tencent.ncnn/g' -e 's/__VERSION__/1.0/g' Info.plist > ncnn.framework/Versions/A/Resources/Info.plist
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.framework glslang.framework ncnn.framework
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
openmp-ios:
runs-on: macos-13
env:
OPENMP_VERSION: '18.1.2'
OPENMP_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$IOS_DEPLOYMENT_TARGET \
-DENABLE_BITCODE=$ENABLE_BITCODE \
-DENABLE_ARC=$ENABLE_ARC \
-DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
-DPERL_EXECUTABLE=/usr/local/bin/perl \
-DLIBOMP_ENABLE_SHARED=OFF \
-DLIBOMP_OMPT_SUPPORT=OFF \
-DLIBOMP_USE_HWLOC=OFF \
steps:
- name: cache-openmp
id: cache-openmp
uses: actions/cache@v4
with:
path: openmp-install
key: openmp-ios-release-18.1.2-20240403
- name: checkout
if: steps.cache-openmp.outputs.cache-hit != 'true'
uses: actions/checkout@v4
- name: openmp
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.OPENMP_VERSION }}/cmake-${{ env.OPENMP_VERSION }}.src.tar.xz
tar -xf cmake-${{ env.OPENMP_VERSION }}.src.tar.xz
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.OPENMP_VERSION }}/openmp-${{ env.OPENMP_VERSION }}.src.tar.xz
tar -xf openmp-${{ env.OPENMP_VERSION }}.src.tar.xz
mv cmake-${{ env.OPENMP_VERSION }}.src/Modules/* openmp-${{ env.OPENMP_VERSION }}.src/cmake/
cd openmp-${{ env.OPENMP_VERSION }}.src
wget https://github.com/nihui/llvm-project/commit/ef8c35bcf5d9cfdb0764ffde6a63c04ec715bc37.patch
patch -p2 -i ef8c35bcf5d9cfdb0764ffde6a63c04ec715bc37.patch
wget https://github.com/nihui/llvm-project/commit/5c12711f9a21f41bea70566bf15a4026804d6b20.patch
patch -p2 -i 5c12711f9a21f41bea70566bf15a4026804d6b20.patch
- name: build-arm64
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
cd openmp-${{ env.OPENMP_VERSION }}.src
mkdir -p build-arm64 && cd build-arm64
cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=OS64 -DARCHS="arm64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: merge-fat-library
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
rm -rf $GITHUB_WORKSPACE/openmp-install
mkdir -p $GITHUB_WORKSPACE/openmp-install
cp -a openmp-${{ env.OPENMP_VERSION }}.src/build-arm64/install/include $GITHUB_WORKSPACE/openmp-install
mkdir -p $GITHUB_WORKSPACE/openmp-install/lib
cp openmp-${{ env.OPENMP_VERSION }}.src/build-arm64/install/lib/libomp.a $GITHUB_WORKSPACE/openmp-install/lib/libomp.a
- name: upload
uses: actions/upload-artifact@v4
with:
name: openmp-ios
path: openmp-install
ios:
needs: [setup, openmp-ios]
runs-on: macos-13
env:
PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-ios
NCNN_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$IOS_DEPLOYMENT_TARGET \
-DENABLE_BITCODE=$ENABLE_BITCODE \
-DENABLE_ARC=$ENABLE_ARC \
-DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
-DOpenMP_C_FLAGS="-Xclang -fopenmp" -DOpenMP_CXX_FLAGS="-Xclang -fopenmp" \
-DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_libomp_LIBRARY="libomp.a" \
-DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DNCNN_BUILD_BENCHMARK=OFF \
-DNCNN_OPENMP=OFF \
-DNCNN_SIMPLEOMP=OFF \
steps:
- uses: actions/checkout@v4
- name: download-openmp-ios
uses: actions/download-artifact@v4
with:
name: openmp-ios
path: openmp-ios
- name: install-openmp
run: |
sudo cp openmp-ios/include/* $DEVELOPER_DIR/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include
sudo cp openmp-ios/lib/libomp.a $DEVELOPER_DIR/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib
- name: build-arm64
run: |
mkdir build-arm64 && cd build-arm64
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=OS64 -DARCHS="arm64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: package-openmp
run: |
rm -rf openmp.framework
mkdir -p openmp.framework/Versions/A/Headers
mkdir -p openmp.framework/Versions/A/Resources
ln -s A openmp.framework/Versions/Current
ln -s Versions/Current/Headers openmp.framework/Headers
ln -s Versions/Current/Resources openmp.framework/Resources
ln -s Versions/Current/openmp openmp.framework/openmp
cp openmp-ios/lib/libomp.a openmp.framework/Versions/A/openmp
cp -a openmp-ios/include/* openmp.framework/Versions/A/Headers/
sed -e 's/__NAME__/openmp/g' -e 's/__IDENTIFIER__/org.llvm.openmp/g' -e 's/__VERSION__/18.1/g' Info.plist > openmp.framework/Versions/A/Resources/Info.plist
- name: package
run: |
rm -rf ncnn.framework
mkdir -p ncnn.framework/Versions/A/Headers
mkdir -p ncnn.framework/Versions/A/Resources
ln -s A ncnn.framework/Versions/Current
ln -s Versions/Current/Headers ncnn.framework/Headers
ln -s Versions/Current/Resources ncnn.framework/Resources
ln -s Versions/Current/ncnn ncnn.framework/ncnn
cp build-arm64/install/lib/libncnn.a ncnn.framework/Versions/A/ncnn
cp -a build-arm64/install/include/* ncnn.framework/Versions/A/Headers/
sed -e 's/__NAME__/ncnn/g' -e 's/__IDENTIFIER__/com.tencent.ncnn/g' -e 's/__VERSION__/1.0/g' Info.plist > ncnn.framework/Versions/A/Resources/Info.plist
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.framework ncnn.framework
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
ios-gpu:
needs: [setup, openmp-ios]
runs-on: macos-13
env:
PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-ios-vulkan
NCNN_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$IOS_DEPLOYMENT_TARGET \
-DENABLE_BITCODE=$ENABLE_BITCODE \
-DENABLE_ARC=$ENABLE_ARC \
-DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
-DOpenMP_C_FLAGS="-Xclang -fopenmp" -DOpenMP_CXX_FLAGS="-Xclang -fopenmp" \
-DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_libomp_LIBRARY="libomp.a" \
-DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DNCNN_VULKAN=ON \
-DNCNN_BUILD_BENCHMARK=OFF \
-DNCNN_OPENMP=OFF \
-DNCNN_SIMPLEOMP=OFF \
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: download-openmp-ios
uses: actions/download-artifact@v4
with:
name: openmp-ios
path: openmp-ios
- name: install-openmp
run: |
sudo cp openmp-ios/include/* $DEVELOPER_DIR/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include
sudo cp openmp-ios/lib/libomp.a $DEVELOPER_DIR/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib
- name: build-arm64
run: |
mkdir build-arm64 && cd build-arm64
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=OS64 -DARCHS="arm64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: package-openmp
run: |
rm -rf openmp.framework
mkdir -p openmp.framework/Versions/A/Headers
mkdir -p openmp.framework/Versions/A/Resources
ln -s A openmp.framework/Versions/Current
ln -s Versions/Current/Headers openmp.framework/Headers
ln -s Versions/Current/Resources openmp.framework/Resources
ln -s Versions/Current/openmp openmp.framework/openmp
cp openmp-ios/lib/libomp.a openmp.framework/Versions/A/openmp
cp -a openmp-ios/include/* openmp.framework/Versions/A/Headers/
sed -e 's/__NAME__/openmp/g' -e 's/__IDENTIFIER__/org.llvm.openmp/g' -e 's/__VERSION__/18.1/g' Info.plist > openmp.framework/Versions/A/Resources/Info.plist
- name: package-glslang
run: |
rm -rf glslang.framework
mkdir -p glslang.framework/Versions/A/Headers
mkdir -p glslang.framework/Versions/A/Resources
ln -s A glslang.framework/Versions/Current
ln -s Versions/Current/Headers glslang.framework/Headers
ln -s Versions/Current/Resources glslang.framework/Resources
ln -s Versions/Current/glslang glslang.framework/glslang
libtool -static \
build-arm64/install/lib/libglslang.a \
build-arm64/install/lib/libMachineIndependent.a \
build-arm64/install/lib/libGenericCodeGen.a \
build-arm64/install/lib/libSPIRV.a \
build-arm64/install/lib/libOGLCompiler.a \
build-arm64/install/lib/libOSDependent.a \
-o build-arm64/install/lib/libglslang_combined.a
cp build-arm64/install/lib/libglslang_combined.a glslang.framework/Versions/A/glslang
cp -a build-arm64/install/include/glslang glslang.framework/Versions/A/Headers/
sed -e 's/__NAME__/glslang/g' -e 's/__IDENTIFIER__/org.khronos.glslang/g' -e 's/__VERSION__/1.0/g' Info.plist > glslang.framework/Versions/A/Resources/Info.plist
- name: package
run: |
rm -rf ncnn.framework
mkdir -p ncnn.framework/Versions/A/Headers
mkdir -p ncnn.framework/Versions/A/Resources
ln -s A ncnn.framework/Versions/Current
ln -s Versions/Current/Headers ncnn.framework/Headers
ln -s Versions/Current/Resources ncnn.framework/Resources
ln -s Versions/Current/ncnn ncnn.framework/ncnn
cp build-arm64/install/lib/libncnn.a ncnn.framework/Versions/A/ncnn
cp -a build-arm64/install/include/ncnn ncnn.framework/Versions/A/Headers/
sed -e 's/__NAME__/ncnn/g' -e 's/__IDENTIFIER__/com.tencent.ncnn/g' -e 's/__VERSION__/1.0/g' Info.plist > ncnn.framework/Versions/A/Resources/Info.plist
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.framework glslang.framework ncnn.framework
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
openmp-ios-simulator:
runs-on: macos-13
env:
OPENMP_VERSION: '18.1.2'
OPENMP_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$IOS_DEPLOYMENT_TARGET \
-DENABLE_BITCODE=$ENABLE_BITCODE \
-DENABLE_ARC=$ENABLE_ARC \
-DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
-DPERL_EXECUTABLE=/usr/local/bin/perl \
-DLIBOMP_ENABLE_SHARED=OFF \
-DLIBOMP_OMPT_SUPPORT=OFF \
-DLIBOMP_USE_HWLOC=OFF \
steps:
- name: cache-openmp
id: cache-openmp
uses: actions/cache@v4
with:
path: openmp-install
key: openmp-ios-simulator-release-18.1.2-20240403
- name: checkout
if: steps.cache-openmp.outputs.cache-hit != 'true'
uses: actions/checkout@v4
- name: openmp
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.OPENMP_VERSION }}/cmake-${{ env.OPENMP_VERSION }}.src.tar.xz
tar -xf cmake-${{ env.OPENMP_VERSION }}.src.tar.xz
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.OPENMP_VERSION }}/openmp-${{ env.OPENMP_VERSION }}.src.tar.xz
tar -xf openmp-${{ env.OPENMP_VERSION }}.src.tar.xz
mv cmake-${{ env.OPENMP_VERSION }}.src/Modules/* openmp-${{ env.OPENMP_VERSION }}.src/cmake/
cd openmp-${{ env.OPENMP_VERSION }}.src
wget https://github.com/nihui/llvm-project/commit/ef8c35bcf5d9cfdb0764ffde6a63c04ec715bc37.patch
patch -p2 -i ef8c35bcf5d9cfdb0764ffde6a63c04ec715bc37.patch
wget https://github.com/nihui/llvm-project/commit/5c12711f9a21f41bea70566bf15a4026804d6b20.patch
patch -p2 -i 5c12711f9a21f41bea70566bf15a4026804d6b20.patch
- name: build-x86_64
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
cd openmp-${{ env.OPENMP_VERSION }}.src
mkdir -p build-x86_64 && cd build-x86_64
cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR64 -DARCHS="x86_64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: build-arm64
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
cd openmp-${{ env.OPENMP_VERSION }}.src
mkdir -p build-arm64 && cd build-arm64
cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=SIMULATORARM64 -DARCHS="arm64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: merge-fat-library
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
rm -rf $GITHUB_WORKSPACE/openmp-install
mkdir -p $GITHUB_WORKSPACE/openmp-install
cp -a openmp-${{ env.OPENMP_VERSION }}.src/build-x86_64/install/include $GITHUB_WORKSPACE/openmp-install
mkdir -p $GITHUB_WORKSPACE/openmp-install/lib
lipo -create \
openmp-${{ env.OPENMP_VERSION }}.src/build-x86_64/install/lib/libomp.a \
openmp-${{ env.OPENMP_VERSION }}.src/build-arm64/install/lib/libomp.a \
-o $GITHUB_WORKSPACE/openmp-install/lib/libomp.a
- name: upload
uses: actions/upload-artifact@v4
with:
name: openmp-ios-simulator
path: openmp-install
ios-simulator:
needs: [setup, openmp-ios-simulator]
runs-on: macos-13
env:
PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-ios-simulator
NCNN_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$IOS_DEPLOYMENT_TARGET \
-DENABLE_BITCODE=$ENABLE_BITCODE \
-DENABLE_ARC=$ENABLE_ARC \
-DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
-DOpenMP_C_FLAGS="-Xclang -fopenmp" -DOpenMP_CXX_FLAGS="-Xclang -fopenmp" \
-DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_libomp_LIBRARY="libomp.a" \
-DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DNCNN_BUILD_BENCHMARK=OFF \
-DNCNN_OPENMP=OFF \
-DNCNN_SIMPLEOMP=OFF \
steps:
- uses: actions/checkout@v4
- name: download-openmp-ios-simulator
uses: actions/download-artifact@v4
with:
name: openmp-ios-simulator
path: openmp-ios-simulator
- name: install-openmp
run: |
sudo cp openmp-ios-simulator/include/* $DEVELOPER_DIR/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include
sudo cp openmp-ios-simulator/lib/libomp.a $DEVELOPER_DIR/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib
- name: build-x86_64
run: |
mkdir build-x86_64 && cd build-x86_64
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR64 -DARCHS="x86_64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: build-arm64
run: |
mkdir build-arm64 && cd build-arm64
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=SIMULATORARM64 -DARCHS="arm64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: package-openmp
run: |
rm -rf openmp.framework
mkdir -p openmp.framework/Versions/A/Headers
mkdir -p openmp.framework/Versions/A/Resources
ln -s A openmp.framework/Versions/Current
ln -s Versions/Current/Headers openmp.framework/Headers
ln -s Versions/Current/Resources openmp.framework/Resources
ln -s Versions/Current/openmp openmp.framework/openmp
cp openmp-ios-simulator/lib/libomp.a openmp.framework/Versions/A/openmp
cp -a openmp-ios-simulator/include/* openmp.framework/Versions/A/Headers/
sed -e 's/__NAME__/openmp/g' -e 's/__IDENTIFIER__/org.llvm.openmp/g' -e 's/__VERSION__/18.1/g' Info.plist > openmp.framework/Versions/A/Resources/Info.plist
- name: package
run: |
rm -rf ncnn.framework
mkdir -p ncnn.framework/Versions/A/Headers
mkdir -p ncnn.framework/Versions/A/Resources
ln -s A ncnn.framework/Versions/Current
ln -s Versions/Current/Headers ncnn.framework/Headers
ln -s Versions/Current/Resources ncnn.framework/Resources
ln -s Versions/Current/ncnn ncnn.framework/ncnn
lipo -create \
build-x86_64/install/lib/libncnn.a \
build-arm64/install/lib/libncnn.a \
-o ncnn.framework/Versions/A/ncnn
cp -a build-x86_64/install/include/* ncnn.framework/Versions/A/Headers/
sed -e 's/__NAME__/ncnn/g' -e 's/__IDENTIFIER__/com.tencent.ncnn/g' -e 's/__VERSION__/1.0/g' Info.plist > ncnn.framework/Versions/A/Resources/Info.plist
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.framework ncnn.framework
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
ios-simulator-gpu:
needs: [setup, openmp-ios-simulator]
runs-on: macos-13
env:
PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-ios-simulator-vulkan
NCNN_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$IOS_DEPLOYMENT_TARGET \
-DENABLE_BITCODE=$ENABLE_BITCODE \
-DENABLE_ARC=$ENABLE_ARC \
-DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
-DOpenMP_C_FLAGS="-Xclang -fopenmp" -DOpenMP_CXX_FLAGS="-Xclang -fopenmp" \
-DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_libomp_LIBRARY="libomp.a" \
-DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DNCNN_VULKAN=ON \
-DNCNN_BUILD_BENCHMARK=OFF \
-DNCNN_OPENMP=OFF \
-DNCNN_SIMPLEOMP=OFF \
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: download-openmp-ios-simulator
uses: actions/download-artifact@v4
with:
name: openmp-ios-simulator
path: openmp-ios-simulator
- name: install-openmp
run: |
sudo cp openmp-ios-simulator/include/* $DEVELOPER_DIR/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include
sudo cp openmp-ios-simulator/lib/libomp.a $DEVELOPER_DIR/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib
- name: build-x86_64
run: |
mkdir build-x86_64 && cd build-x86_64
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR64 -DARCHS="x86_64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: build-arm64
run: |
mkdir build-arm64 && cd build-arm64
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=SIMULATORARM64 -DARCHS="arm64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: package-openmp
run: |
rm -rf openmp.framework
mkdir -p openmp.framework/Versions/A/Headers
mkdir -p openmp.framework/Versions/A/Resources
ln -s A openmp.framework/Versions/Current
ln -s Versions/Current/Headers openmp.framework/Headers
ln -s Versions/Current/Resources openmp.framework/Resources
ln -s Versions/Current/openmp openmp.framework/openmp
cp openmp-ios-simulator/lib/libomp.a openmp.framework/Versions/A/openmp
cp -a openmp-ios-simulator/include/* openmp.framework/Versions/A/Headers/
sed -e 's/__NAME__/openmp/g' -e 's/__IDENTIFIER__/org.llvm.openmp/g' -e 's/__VERSION__/18.1/g' Info.plist > openmp.framework/Versions/A/Resources/Info.plist
- name: package-glslang
run: |
rm -rf glslang.framework
mkdir -p glslang.framework/Versions/A/Headers
mkdir -p glslang.framework/Versions/A/Resources
ln -s A glslang.framework/Versions/Current
ln -s Versions/Current/Headers glslang.framework/Headers
ln -s Versions/Current/Resources glslang.framework/Resources
ln -s Versions/Current/glslang glslang.framework/glslang
libtool -static \
build-x86_64/install/lib/libglslang.a \
build-x86_64/install/lib/libMachineIndependent.a \
build-x86_64/install/lib/libGenericCodeGen.a \
build-x86_64/install/lib/libSPIRV.a \
build-x86_64/install/lib/libOGLCompiler.a \
build-x86_64/install/lib/libOSDependent.a \
-o build-x86_64/install/lib/libglslang_combined.a
libtool -static \
build-arm64/install/lib/libglslang.a \
build-arm64/install/lib/libMachineIndependent.a \
build-arm64/install/lib/libGenericCodeGen.a \
build-arm64/install/lib/libSPIRV.a \
build-arm64/install/lib/libOGLCompiler.a \
build-arm64/install/lib/libOSDependent.a \
-o build-arm64/install/lib/libglslang_combined.a
lipo -create \
build-x86_64/install/lib/libglslang_combined.a \
build-arm64/install/lib/libglslang_combined.a \
-o glslang.framework/Versions/A/glslang
cp -a build-x86_64/install/include/glslang glslang.framework/Versions/A/Headers/
sed -e 's/__NAME__/glslang/g' -e 's/__IDENTIFIER__/org.khronos.glslang/g' -e 's/__VERSION__/1.0/g' Info.plist > glslang.framework/Versions/A/Resources/Info.plist
- name: package
run: |
rm -rf ncnn.framework
mkdir -p ncnn.framework/Versions/A/Headers
mkdir -p ncnn.framework/Versions/A/Resources
ln -s A ncnn.framework/Versions/Current
ln -s Versions/Current/Headers ncnn.framework/Headers
ln -s Versions/Current/Resources ncnn.framework/Resources
ln -s Versions/Current/ncnn ncnn.framework/ncnn
lipo -create \
build-x86_64/install/lib/libncnn.a \
build-arm64/install/lib/libncnn.a \
-o ncnn.framework/Versions/A/ncnn
cp -a build-x86_64/install/include/ncnn ncnn.framework/Versions/A/Headers/
sed -e 's/__NAME__/ncnn/g' -e 's/__IDENTIFIER__/com.tencent.ncnn/g' -e 's/__VERSION__/1.0/g' Info.plist > ncnn.framework/Versions/A/Resources/Info.plist
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.framework glslang.framework ncnn.framework
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
openmp-mac-catalyst:
runs-on: macos-13
env:
OPENMP_VERSION: '18.1.2'
OPENMP_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$MAC_CATALYST_DEPLOYMENT_TARGET \
-DENABLE_BITCODE=$ENABLE_BITCODE \
-DENABLE_ARC=$ENABLE_ARC \
-DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
-DPERL_EXECUTABLE=/usr/local/bin/perl \
-DLIBOMP_ENABLE_SHARED=OFF \
-DLIBOMP_OMPT_SUPPORT=OFF \
-DLIBOMP_USE_HWLOC=OFF \
steps:
- name: cache-openmp
id: cache-openmp
uses: actions/cache@v4
with:
path: openmp-install
key: openmp-mac-catalyst-release-18.1.2-20240403
- name: checkout
if: steps.cache-openmp.outputs.cache-hit != 'true'
uses: actions/checkout@v4
- name: openmp
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.OPENMP_VERSION }}/cmake-${{ env.OPENMP_VERSION }}.src.tar.xz
tar -xf cmake-${{ env.OPENMP_VERSION }}.src.tar.xz
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.OPENMP_VERSION }}/openmp-${{ env.OPENMP_VERSION }}.src.tar.xz
tar -xf openmp-${{ env.OPENMP_VERSION }}.src.tar.xz
mv cmake-${{ env.OPENMP_VERSION }}.src/Modules/* openmp-${{ env.OPENMP_VERSION }}.src/cmake/
cd openmp-${{ env.OPENMP_VERSION }}.src
wget https://github.com/nihui/llvm-project/commit/ef8c35bcf5d9cfdb0764ffde6a63c04ec715bc37.patch
patch -p2 -i ef8c35bcf5d9cfdb0764ffde6a63c04ec715bc37.patch
wget https://github.com/nihui/llvm-project/commit/5c12711f9a21f41bea70566bf15a4026804d6b20.patch
patch -p2 -i 5c12711f9a21f41bea70566bf15a4026804d6b20.patch
- name: build-x86_64
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
cd openmp-${{ env.OPENMP_VERSION }}.src
mkdir -p build-x86_64 && cd build-x86_64
cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=MAC_CATALYST -DARCHS="x86_64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: build-arm64
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
cd openmp-${{ env.OPENMP_VERSION }}.src
mkdir -p build-arm64 && cd build-arm64
cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=MAC_CATALYST_ARM64 -DARCHS="arm64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: merge-fat-library
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
rm -rf $GITHUB_WORKSPACE/openmp-install
mkdir -p $GITHUB_WORKSPACE/openmp-install
cp -a openmp-${{ env.OPENMP_VERSION }}.src/build-x86_64/install/include $GITHUB_WORKSPACE/openmp-install
mkdir -p $GITHUB_WORKSPACE/openmp-install/lib
lipo -create \
openmp-${{ env.OPENMP_VERSION }}.src/build-x86_64/install/lib/libomp.a \
openmp-${{ env.OPENMP_VERSION }}.src/build-arm64/install/lib/libomp.a \
-o $GITHUB_WORKSPACE/openmp-install/lib/libomp.a
- name: upload
uses: actions/upload-artifact@v4
with:
name: openmp-mac-catalyst
path: openmp-install
mac-catalyst:
needs: [setup, openmp-mac-catalyst]
runs-on: macos-13
env:
PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-mac-catalyst
NCNN_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$MAC_CATALYST_DEPLOYMENT_TARGET \
-DENABLE_BITCODE=$ENABLE_BITCODE \
-DENABLE_ARC=$ENABLE_ARC \
-DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
-DOpenMP_C_FLAGS="-Xclang -fopenmp" -DOpenMP_CXX_FLAGS="-Xclang -fopenmp" \
-DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_libomp_LIBRARY="libomp.a" \
-DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DNCNN_BUILD_BENCHMARK=OFF \
-DNCNN_OPENMP=OFF \
-DNCNN_SIMPLEOMP=OFF \
steps:
- uses: actions/checkout@v4
- name: download-openmp-mac-catalyst
uses: actions/download-artifact@v4
with:
name: openmp-mac-catalyst
path: openmp-mac-catalyst
- name: install-openmp
run: |
sudo cp openmp-mac-catalyst/include/* $DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
sudo cp openmp-mac-catalyst/lib/libomp.a $DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib
- name: build-x86_64
run: |
mkdir build-x86_64 && cd build-x86_64
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=MAC_CATALYST -DARCHS="x86_64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: build-arm64
run: |
mkdir build-arm64 && cd build-arm64
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=MAC_CATALYST -DARCHS="arm64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: package-openmp
run: |
rm -rf openmp.framework
mkdir -p openmp.framework/Versions/A/Headers
mkdir -p openmp.framework/Versions/A/Resources
ln -s A openmp.framework/Versions/Current
ln -s Versions/Current/Headers openmp.framework/Headers
ln -s Versions/Current/Resources openmp.framework/Resources
ln -s Versions/Current/openmp openmp.framework/openmp
cp openmp-mac-catalyst/lib/libomp.a openmp.framework/Versions/A/openmp
cp -a openmp-mac-catalyst/include/* openmp.framework/Versions/A/Headers/
sed -e 's/__NAME__/openmp/g' -e 's/__IDENTIFIER__/org.llvm.openmp/g' -e 's/__VERSION__/18.1/g' Info.plist > openmp.framework/Versions/A/Resources/Info.plist
- name: package
run: |
rm -rf ncnn.framework
mkdir -p ncnn.framework/Versions/A/Headers
mkdir -p ncnn.framework/Versions/A/Resources
ln -s A ncnn.framework/Versions/Current
ln -s Versions/Current/Headers ncnn.framework/Headers
ln -s Versions/Current/Resources ncnn.framework/Resources
ln -s Versions/Current/ncnn ncnn.framework/ncnn
lipo -create \
build-x86_64/install/lib/libncnn.a \
build-arm64/install/lib/libncnn.a \
-o ncnn.framework/Versions/A/ncnn
cp -a build-x86_64/install/include/* ncnn.framework/Versions/A/Headers/
sed -e 's/__NAME__/ncnn/g' -e 's/__IDENTIFIER__/com.tencent.ncnn/g' -e 's/__VERSION__/1.0/g' Info.plist > ncnn.framework/Versions/A/Resources/Info.plist
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.framework ncnn.framework
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
mac-catalyst-gpu:
needs: [setup, openmp-mac-catalyst]
runs-on: macos-13
env:
PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-mac-catalyst-vulkan
NCNN_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$MAC_CATALYST_DEPLOYMENT_TARGET \
-DENABLE_BITCODE=$ENABLE_BITCODE \
-DENABLE_ARC=$ENABLE_ARC \
-DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
-DOpenMP_C_FLAGS="-Xclang -fopenmp" -DOpenMP_CXX_FLAGS="-Xclang -fopenmp" \
-DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_libomp_LIBRARY="libomp.a" \
-DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DNCNN_VULKAN=ON \
-DNCNN_BUILD_BENCHMARK=OFF \
-DNCNN_OPENMP=OFF \
-DNCNN_SIMPLEOMP=OFF \
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: download-openmp-mac-catalyst
uses: actions/download-artifact@v4
with:
name: openmp-mac-catalyst
path: openmp-mac-catalyst
- name: install-openmp
run: |
sudo cp openmp-mac-catalyst/include/* $DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
sudo cp openmp-mac-catalyst/lib/libomp.a $DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib
- name: build-x86_64
run: |
mkdir build-x86_64 && cd build-x86_64
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=MAC_CATALYST -DARCHS="x86_64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: build-arm64
run: |
mkdir build-arm64 && cd build-arm64
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=MAC_CATALYST -DARCHS="arm64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: package-openmp
run: |
rm -rf openmp.framework
mkdir -p openmp.framework/Versions/A/Headers
mkdir -p openmp.framework/Versions/A/Resources
ln -s A openmp.framework/Versions/Current
ln -s Versions/Current/Headers openmp.framework/Headers
ln -s Versions/Current/Resources openmp.framework/Resources
ln -s Versions/Current/openmp openmp.framework/openmp
cp openmp-mac-catalyst/lib/libomp.a openmp.framework/Versions/A/openmp
cp -a openmp-mac-catalyst/include/* openmp.framework/Versions/A/Headers/
sed -e 's/__NAME__/openmp/g' -e 's/__IDENTIFIER__/org.llvm.openmp/g' -e 's/__VERSION__/18.1/g' Info.plist > openmp.framework/Versions/A/Resources/Info.plist
- name: package-glslang
run: |
rm -rf glslang.framework
mkdir -p glslang.framework/Versions/A/Headers
mkdir -p glslang.framework/Versions/A/Resources
ln -s A glslang.framework/Versions/Current
ln -s Versions/Current/Headers glslang.framework/Headers
ln -s Versions/Current/Resources glslang.framework/Resources
ln -s Versions/Current/glslang glslang.framework/glslang
libtool -static \
build-x86_64/install/lib/libglslang.a \
build-x86_64/install/lib/libMachineIndependent.a \
build-x86_64/install/lib/libGenericCodeGen.a \
build-x86_64/install/lib/libSPIRV.a \
build-x86_64/install/lib/libOGLCompiler.a \
build-x86_64/install/lib/libOSDependent.a \
-o build-x86_64/install/lib/libglslang_combined.a
libtool -static \
build-arm64/install/lib/libglslang.a \
build-arm64/install/lib/libMachineIndependent.a \
build-arm64/install/lib/libGenericCodeGen.a \
build-arm64/install/lib/libSPIRV.a \
build-arm64/install/lib/libOGLCompiler.a \
build-arm64/install/lib/libOSDependent.a \
-o build-arm64/install/lib/libglslang_combined.a
lipo -create \
build-x86_64/install/lib/libglslang_combined.a \
build-arm64/install/lib/libglslang_combined.a \
-o glslang.framework/Versions/A/glslang
cp -a build-x86_64/install/include/glslang glslang.framework/Versions/A/Headers/
sed -e 's/__NAME__/glslang/g' -e 's/__IDENTIFIER__/org.khronos.glslang/g' -e 's/__VERSION__/1.0/g' Info.plist > glslang.framework/Versions/A/Resources/Info.plist
- name: package
run: |
rm -rf ncnn.framework
mkdir -p ncnn.framework/Versions/A/Headers
mkdir -p ncnn.framework/Versions/A/Resources
ln -s A ncnn.framework/Versions/Current
ln -s Versions/Current/Headers ncnn.framework/Headers
ln -s Versions/Current/Resources ncnn.framework/Resources
ln -s Versions/Current/ncnn ncnn.framework/ncnn
lipo -create \
build-x86_64/install/lib/libncnn.a \
build-arm64/install/lib/libncnn.a \
-o ncnn.framework/Versions/A/ncnn
cp -a build-x86_64/install/include/ncnn ncnn.framework/Versions/A/Headers/
sed -e 's/__NAME__/ncnn/g' -e 's/__IDENTIFIER__/com.tencent.ncnn/g' -e 's/__VERSION__/1.0/g' Info.plist > ncnn.framework/Versions/A/Resources/Info.plist
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.framework glslang.framework ncnn.framework
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
openmp-watchos:
runs-on: macos-13
env:
OPENMP_VERSION: '18.1.2'
OPENMP_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$WATCHOS_DEPLOYMENT_TARGET \
-DENABLE_BITCODE=$ENABLE_BITCODE \
-DENABLE_ARC=$ENABLE_ARC \
-DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
-DPERL_EXECUTABLE=/usr/local/bin/perl \
-DLIBOMP_ENABLE_SHARED=OFF \
-DLIBOMP_OMPT_SUPPORT=OFF \
-DLIBOMP_USE_HWLOC=OFF \
steps:
- name: cache-openmp
id: cache-openmp
uses: actions/cache@v4
with:
path: openmp-install
key: openmp-watchos-release-18.1.2-20240403
- name: checkout
if: steps.cache-openmp.outputs.cache-hit != 'true'
uses: actions/checkout@v4
- name: openmp
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.OPENMP_VERSION }}/cmake-${{ env.OPENMP_VERSION }}.src.tar.xz
tar -xf cmake-${{ env.OPENMP_VERSION }}.src.tar.xz
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.OPENMP_VERSION }}/openmp-${{ env.OPENMP_VERSION }}.src.tar.xz
tar -xf openmp-${{ env.OPENMP_VERSION }}.src.tar.xz
mv cmake-${{ env.OPENMP_VERSION }}.src/Modules/* openmp-${{ env.OPENMP_VERSION }}.src/cmake/
cd openmp-${{ env.OPENMP_VERSION }}.src
wget https://github.com/nihui/llvm-project/commit/ef8c35bcf5d9cfdb0764ffde6a63c04ec715bc37.patch
patch -p2 -i ef8c35bcf5d9cfdb0764ffde6a63c04ec715bc37.patch
wget https://github.com/nihui/llvm-project/commit/5c12711f9a21f41bea70566bf15a4026804d6b20.patch
patch -p2 -i 5c12711f9a21f41bea70566bf15a4026804d6b20.patch
- name: build-armv7k
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
cd openmp-${{ env.OPENMP_VERSION }}.src
mkdir -p build-armv7k && cd build-armv7k
cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=WATCHOS -DARCHS="armv7k" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: build-arm64_32
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
cd openmp-${{ env.OPENMP_VERSION }}.src
mkdir -p build-arm64_32 && cd build-arm64_32
cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=WATCHOS -DARCHS="arm64_32" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: merge-fat-library
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
rm -rf $GITHUB_WORKSPACE/openmp-install
mkdir -p $GITHUB_WORKSPACE/openmp-install
cp -a openmp-${{ env.OPENMP_VERSION }}.src/build-arm64_32/install/include $GITHUB_WORKSPACE/openmp-install
mkdir -p $GITHUB_WORKSPACE/openmp-install/lib
lipo -create \
openmp-${{ env.OPENMP_VERSION }}.src/build-armv7k/install/lib/libomp.a \
openmp-${{ env.OPENMP_VERSION }}.src/build-arm64_32/install/lib/libomp.a \
-o $GITHUB_WORKSPACE/openmp-install/lib/libomp.a
- name: upload
uses: actions/upload-artifact@v4
with:
name: openmp-watchos
path: openmp-install
watchos:
needs: [setup, openmp-watchos]
runs-on: macos-13
env:
PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-watchos
NCNN_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$WATCHOS_DEPLOYMENT_TARGET \
-DENABLE_BITCODE=$ENABLE_BITCODE \
-DENABLE_ARC=$ENABLE_ARC \
-DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
-DOpenMP_C_FLAGS="-Xclang -fopenmp" -DOpenMP_CXX_FLAGS="-Xclang -fopenmp" \
-DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_libomp_LIBRARY="libomp.a" \
-DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DNCNN_BUILD_BENCHMARK=OFF \
-DNCNN_OPENMP=OFF \
-DNCNN_SIMPLEOMP=OFF \
steps:
- uses: actions/checkout@v4
- name: download-openmp-watchos
uses: actions/download-artifact@v4
with:
name: openmp-watchos
path: openmp-watchos
- name: install-openmp
run: |
sudo cp openmp-watchos/include/* $DEVELOPER_DIR/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/usr/include
sudo cp openmp-watchos/lib/libomp.a $DEVELOPER_DIR/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/usr/lib
- name: build-armv7k
run: |
mkdir build-armv7k && cd build-armv7k
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=WATCHOS -DARCHS="armv7k" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: build-arm64_32
run: |
mkdir build-arm64_32 && cd build-arm64_32
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=WATCHOS -DARCHS="arm64_32" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: package-openmp
run: |
rm -rf openmp.framework
mkdir -p openmp.framework/Versions/A/Headers
mkdir -p openmp.framework/Versions/A/Resources
ln -s A openmp.framework/Versions/Current
ln -s Versions/Current/Headers openmp.framework/Headers
ln -s Versions/Current/Resources openmp.framework/Resources
ln -s Versions/Current/openmp openmp.framework/openmp
cp openmp-watchos/lib/libomp.a openmp.framework/Versions/A/openmp
cp -a openmp-watchos/include/* openmp.framework/Versions/A/Headers/
sed -e 's/__NAME__/openmp/g' -e 's/__IDENTIFIER__/org.llvm.openmp/g' -e 's/__VERSION__/18.1/g' Info.plist > openmp.framework/Versions/A/Resources/Info.plist
- name: package
run: |
rm -rf ncnn.framework
mkdir -p ncnn.framework/Versions/A/Headers
mkdir -p ncnn.framework/Versions/A/Resources
ln -s A ncnn.framework/Versions/Current
ln -s Versions/Current/Headers ncnn.framework/Headers
ln -s Versions/Current/Resources ncnn.framework/Resources
ln -s Versions/Current/ncnn ncnn.framework/ncnn
lipo -create \
build-armv7k/install/lib/libncnn.a \
build-arm64_32/install/lib/libncnn.a \
-o ncnn.framework/Versions/A/ncnn
cp -a build-arm64_32/install/include/* ncnn.framework/Versions/A/Headers/
sed -e 's/__NAME__/ncnn/g' -e 's/__IDENTIFIER__/com.tencent.ncnn/g' -e 's/__VERSION__/1.0/g' Info.plist > ncnn.framework/Versions/A/Resources/Info.plist
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.framework ncnn.framework
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
openmp-watchos-simulator:
runs-on: macos-13
env:
OPENMP_VERSION: '18.1.2'
OPENMP_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$WATCHOS_DEPLOYMENT_TARGET \
-DENABLE_BITCODE=$ENABLE_BITCODE \
-DENABLE_ARC=$ENABLE_ARC \
-DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
-DPERL_EXECUTABLE=/usr/local/bin/perl \
-DLIBOMP_ENABLE_SHARED=OFF \
-DLIBOMP_OMPT_SUPPORT=OFF \
-DLIBOMP_USE_HWLOC=OFF \
steps:
- name: cache-openmp
id: cache-openmp
uses: actions/cache@v4
with:
path: openmp-install
key: openmp-watchos-simulator-release-18.1.2-20240403
- name: checkout
if: steps.cache-openmp.outputs.cache-hit != 'true'
uses: actions/checkout@v4
- name: openmp
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.OPENMP_VERSION }}/cmake-${{ env.OPENMP_VERSION }}.src.tar.xz
tar -xf cmake-${{ env.OPENMP_VERSION }}.src.tar.xz
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.OPENMP_VERSION }}/openmp-${{ env.OPENMP_VERSION }}.src.tar.xz
tar -xf openmp-${{ env.OPENMP_VERSION }}.src.tar.xz
mv cmake-${{ env.OPENMP_VERSION }}.src/Modules/* openmp-${{ env.OPENMP_VERSION }}.src/cmake/
cd openmp-${{ env.OPENMP_VERSION }}.src
wget https://github.com/nihui/llvm-project/commit/ef8c35bcf5d9cfdb0764ffde6a63c04ec715bc37.patch
patch -p2 -i ef8c35bcf5d9cfdb0764ffde6a63c04ec715bc37.patch
wget https://github.com/nihui/llvm-project/commit/5c12711f9a21f41bea70566bf15a4026804d6b20.patch
patch -p2 -i 5c12711f9a21f41bea70566bf15a4026804d6b20.patch
- name: build-x86_64
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
cd openmp-${{ env.OPENMP_VERSION }}.src
mkdir -p build-x86_64 && cd build-x86_64
cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_WATCHOS -DARCHS="x86_64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: build-arm64
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
cd openmp-${{ env.OPENMP_VERSION }}.src
mkdir -p build-arm64 && cd build-arm64
cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_WATCHOS -DARCHS="arm64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: merge-fat-library
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
rm -rf $GITHUB_WORKSPACE/openmp-install
mkdir -p $GITHUB_WORKSPACE/openmp-install
cp -a openmp-${{ env.OPENMP_VERSION }}.src/build-x86_64/install/include $GITHUB_WORKSPACE/openmp-install
mkdir -p $GITHUB_WORKSPACE/openmp-install/lib
lipo -create \
openmp-${{ env.OPENMP_VERSION }}.src/build-x86_64/install/lib/libomp.a \
openmp-${{ env.OPENMP_VERSION }}.src/build-arm64/install/lib/libomp.a \
-o $GITHUB_WORKSPACE/openmp-install/lib/libomp.a
- name: upload
uses: actions/upload-artifact@v4
with:
name: openmp-watchos-simulator
path: openmp-install
watchos-simulator:
needs: [setup, openmp-watchos-simulator]
runs-on: macos-13
env:
PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-watchos-simulator
NCNN_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$WATCHOS_DEPLOYMENT_TARGET \
-DENABLE_BITCODE=$ENABLE_BITCODE \
-DENABLE_ARC=$ENABLE_ARC \
-DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
-DOpenMP_C_FLAGS="-Xclang -fopenmp" -DOpenMP_CXX_FLAGS="-Xclang -fopenmp" \
-DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_libomp_LIBRARY="libomp.a" \
-DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DNCNN_BUILD_BENCHMARK=OFF \
-DNCNN_OPENMP=OFF \
-DNCNN_SIMPLEOMP=OFF \
steps:
- uses: actions/checkout@v4
- name: download-openmp-watchos-simulator
uses: actions/download-artifact@v4
with:
name: openmp-watchos-simulator
path: openmp-watchos-simulator
- name: install-openmp
run: |
sudo cp openmp-watchos-simulator/include/* $DEVELOPER_DIR/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/usr/include
sudo cp openmp-watchos-simulator/lib/libomp.a $DEVELOPER_DIR/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/usr/lib
- name: build-x86_64
run: |
mkdir build-x86_64 && cd build-x86_64
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_WATCHOS -DARCHS="x86_64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: build-arm64
run: |
mkdir build-arm64 && cd build-arm64
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_WATCHOS -DARCHS="arm64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: package-openmp
run: |
rm -rf openmp.framework
mkdir -p openmp.framework/Versions/A/Headers
mkdir -p openmp.framework/Versions/A/Resources
ln -s A openmp.framework/Versions/Current
ln -s Versions/Current/Headers openmp.framework/Headers
ln -s Versions/Current/Resources openmp.framework/Resources
ln -s Versions/Current/openmp openmp.framework/openmp
cp openmp-watchos-simulator/lib/libomp.a openmp.framework/Versions/A/openmp
cp -a openmp-watchos-simulator/include/* openmp.framework/Versions/A/Headers/
sed -e 's/__NAME__/openmp/g' -e 's/__IDENTIFIER__/org.llvm.openmp/g' -e 's/__VERSION__/18.1/g' Info.plist > openmp.framework/Versions/A/Resources/Info.plist
- name: package
run: |
rm -rf ncnn.framework
mkdir -p ncnn.framework/Versions/A/Headers
mkdir -p ncnn.framework/Versions/A/Resources
ln -s A ncnn.framework/Versions/Current
ln -s Versions/Current/Headers ncnn.framework/Headers
ln -s Versions/Current/Resources ncnn.framework/Resources
ln -s Versions/Current/ncnn ncnn.framework/ncnn
lipo -create \
build-x86_64/install/lib/libncnn.a \
build-arm64/install/lib/libncnn.a \
-o ncnn.framework/Versions/A/ncnn
cp -a build-x86_64/install/include/* ncnn.framework/Versions/A/Headers/
sed -e 's/__NAME__/ncnn/g' -e 's/__IDENTIFIER__/com.tencent.ncnn/g' -e 's/__VERSION__/1.0/g' Info.plist > ncnn.framework/Versions/A/Resources/Info.plist
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.framework ncnn.framework
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
openmp-tvos:
runs-on: macos-13
env:
OPENMP_VERSION: '18.1.2'
OPENMP_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$TVOS_DEPLOYMENT_TARGET \
-DENABLE_BITCODE=$ENABLE_BITCODE \
-DENABLE_ARC=$ENABLE_ARC \
-DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
-DPERL_EXECUTABLE=/usr/local/bin/perl \
-DLIBOMP_ENABLE_SHARED=OFF \
-DLIBOMP_OMPT_SUPPORT=OFF \
-DLIBOMP_USE_HWLOC=OFF \
steps:
- name: cache-openmp
id: cache-openmp
uses: actions/cache@v4
with:
path: openmp-install
key: openmp-tvos-release-18.1.2-20240403
- name: checkout
if: steps.cache-openmp.outputs.cache-hit != 'true'
uses: actions/checkout@v4
- name: openmp
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.OPENMP_VERSION }}/cmake-${{ env.OPENMP_VERSION }}.src.tar.xz
tar -xf cmake-${{ env.OPENMP_VERSION }}.src.tar.xz
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.OPENMP_VERSION }}/openmp-${{ env.OPENMP_VERSION }}.src.tar.xz
tar -xf openmp-${{ env.OPENMP_VERSION }}.src.tar.xz
mv cmake-${{ env.OPENMP_VERSION }}.src/Modules/* openmp-${{ env.OPENMP_VERSION }}.src/cmake/
cd openmp-${{ env.OPENMP_VERSION }}.src
wget https://github.com/nihui/llvm-project/commit/ef8c35bcf5d9cfdb0764ffde6a63c04ec715bc37.patch
patch -p2 -i ef8c35bcf5d9cfdb0764ffde6a63c04ec715bc37.patch
wget https://github.com/nihui/llvm-project/commit/5c12711f9a21f41bea70566bf15a4026804d6b20.patch
patch -p2 -i 5c12711f9a21f41bea70566bf15a4026804d6b20.patch
- name: build-arm64
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
cd openmp-${{ env.OPENMP_VERSION }}.src
mkdir -p build-arm64 && cd build-arm64
cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=TVOS -DARCHS="arm64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: build-arm64e
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
cd openmp-${{ env.OPENMP_VERSION }}.src
mkdir -p build-arm64e && cd build-arm64e
cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=TVOS -DARCHS="arm64e" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: merge-fat-library
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
rm -rf $GITHUB_WORKSPACE/openmp-install
mkdir -p $GITHUB_WORKSPACE/openmp-install
cp -a openmp-${{ env.OPENMP_VERSION }}.src/build-arm64/install/include $GITHUB_WORKSPACE/openmp-install
mkdir -p $GITHUB_WORKSPACE/openmp-install/lib
lipo -create \
openmp-${{ env.OPENMP_VERSION }}.src/build-arm64/install/lib/libomp.a \
openmp-${{ env.OPENMP_VERSION }}.src/build-arm64e/install/lib/libomp.a \
-o $GITHUB_WORKSPACE/openmp-install/lib/libomp.a
- name: upload
uses: actions/upload-artifact@v4
with:
name: openmp-tvos
path: openmp-install
tvos:
needs: [setup, openmp-tvos]
runs-on: macos-13
env:
PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-tvos
NCNN_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$TVOS_DEPLOYMENT_TARGET \
-DENABLE_BITCODE=$ENABLE_BITCODE \
-DENABLE_ARC=$ENABLE_ARC \
-DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
-DOpenMP_C_FLAGS="-Xclang -fopenmp" -DOpenMP_CXX_FLAGS="-Xclang -fopenmp" \
-DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_libomp_LIBRARY="libomp.a" \
-DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DNCNN_BUILD_BENCHMARK=OFF \
-DNCNN_OPENMP=OFF \
-DNCNN_SIMPLEOMP=OFF \
steps:
- uses: actions/checkout@v4
- name: download-openmp-tvos
uses: actions/download-artifact@v4
with:
name: openmp-tvos
path: openmp-tvos
- name: install-openmp
run: |
sudo cp openmp-tvos/include/* $DEVELOPER_DIR/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/usr/include
sudo cp openmp-tvos/lib/libomp.a $DEVELOPER_DIR/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/usr/lib
- name: build-arm64
run: |
mkdir build-arm64 && cd build-arm64
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=TVOS -DARCHS="arm64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: build-arm64e
run: |
mkdir build-arm64e && cd build-arm64e
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=TVOS -DARCHS="arm64e" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: package-openmp
run: |
rm -rf openmp.framework
mkdir -p openmp.framework/Versions/A/Headers
mkdir -p openmp.framework/Versions/A/Resources
ln -s A openmp.framework/Versions/Current
ln -s Versions/Current/Headers openmp.framework/Headers
ln -s Versions/Current/Resources openmp.framework/Resources
ln -s Versions/Current/openmp openmp.framework/openmp
cp openmp-tvos/lib/libomp.a openmp.framework/Versions/A/openmp
cp -a openmp-tvos/include/* openmp.framework/Versions/A/Headers/
sed -e 's/__NAME__/openmp/g' -e 's/__IDENTIFIER__/org.llvm.openmp/g' -e 's/__VERSION__/18.1/g' Info.plist > openmp.framework/Versions/A/Resources/Info.plist
- name: package
run: |
rm -rf ncnn.framework
mkdir -p ncnn.framework/Versions/A/Headers
mkdir -p ncnn.framework/Versions/A/Resources
ln -s A ncnn.framework/Versions/Current
ln -s Versions/Current/Headers ncnn.framework/Headers
ln -s Versions/Current/Resources ncnn.framework/Resources
ln -s Versions/Current/ncnn ncnn.framework/ncnn
lipo -create \
build-arm64/install/lib/libncnn.a \
build-arm64e/install/lib/libncnn.a \
-o ncnn.framework/Versions/A/ncnn
cp -a build-arm64/install/include/* ncnn.framework/Versions/A/Headers/
sed -e 's/__NAME__/ncnn/g' -e 's/__IDENTIFIER__/com.tencent.ncnn/g' -e 's/__VERSION__/1.0/g' Info.plist > ncnn.framework/Versions/A/Resources/Info.plist
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.framework ncnn.framework
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
tvos-gpu:
needs: [setup, openmp-tvos]
runs-on: macos-13
env:
PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-tvos-vulkan
NCNN_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$TVOS_DEPLOYMENT_TARGET \
-DENABLE_BITCODE=$ENABLE_BITCODE \
-DENABLE_ARC=$ENABLE_ARC \
-DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
-DOpenMP_C_FLAGS="-Xclang -fopenmp" -DOpenMP_CXX_FLAGS="-Xclang -fopenmp" \
-DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_libomp_LIBRARY="libomp.a" \
-DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DNCNN_VULKAN=ON \
-DNCNN_BUILD_BENCHMARK=OFF \
-DNCNN_OPENMP=OFF \
-DNCNN_SIMPLEOMP=OFF \
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: download-openmp-tvos
uses: actions/download-artifact@v4
with:
name: openmp-tvos
path: openmp-tvos
- name: install-openmp
run: |
sudo cp openmp-tvos/include/* $DEVELOPER_DIR/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/usr/include
sudo cp openmp-tvos/lib/libomp.a $DEVELOPER_DIR/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/usr/lib
- name: build-arm64
run: |
mkdir build-arm64 && cd build-arm64
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=TVOS -DARCHS="arm64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: build-arm64e
run: |
mkdir build-arm64e && cd build-arm64e
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=TVOS -DARCHS="arm64e" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: package-openmp
run: |
rm -rf openmp.framework
mkdir -p openmp.framework/Versions/A/Headers
mkdir -p openmp.framework/Versions/A/Resources
ln -s A openmp.framework/Versions/Current
ln -s Versions/Current/Headers openmp.framework/Headers
ln -s Versions/Current/Resources openmp.framework/Resources
ln -s Versions/Current/openmp openmp.framework/openmp
cp openmp-tvos/lib/libomp.a openmp.framework/Versions/A/openmp
cp -a openmp-tvos/include/* openmp.framework/Versions/A/Headers/
sed -e 's/__NAME__/openmp/g' -e 's/__IDENTIFIER__/org.llvm.openmp/g' -e 's/__VERSION__/18.1/g' Info.plist > openmp.framework/Versions/A/Resources/Info.plist
- name: package-glslang
run: |
rm -rf glslang.framework
mkdir -p glslang.framework/Versions/A/Headers
mkdir -p glslang.framework/Versions/A/Resources
ln -s A glslang.framework/Versions/Current
ln -s Versions/Current/Headers glslang.framework/Headers
ln -s Versions/Current/Resources glslang.framework/Resources
ln -s Versions/Current/glslang glslang.framework/glslang
libtool -static \
build-arm64/install/lib/libglslang.a \
build-arm64/install/lib/libMachineIndependent.a \
build-arm64/install/lib/libGenericCodeGen.a \
build-arm64/install/lib/libSPIRV.a \
build-arm64/install/lib/libOGLCompiler.a \
build-arm64/install/lib/libOSDependent.a \
-o build-arm64/install/lib/libglslang_combined.a
libtool -static \
build-arm64e/install/lib/libglslang.a \
build-arm64e/install/lib/libMachineIndependent.a \
build-arm64e/install/lib/libGenericCodeGen.a \
build-arm64e/install/lib/libSPIRV.a \
build-arm64e/install/lib/libOGLCompiler.a \
build-arm64e/install/lib/libOSDependent.a \
-o build-arm64e/install/lib/libglslang_combined.a
lipo -create \
build-arm64/install/lib/libglslang_combined.a \
build-arm64e/install/lib/libglslang_combined.a \
-o glslang.framework/Versions/A/glslang
cp -a build-arm64/install/include/glslang glslang.framework/Versions/A/Headers/
sed -e 's/__NAME__/glslang/g' -e 's/__IDENTIFIER__/org.khronos.glslang/g' -e 's/__VERSION__/1.0/g' Info.plist > glslang.framework/Versions/A/Resources/Info.plist
- name: package
run: |
rm -rf ncnn.framework
mkdir -p ncnn.framework/Versions/A/Headers
mkdir -p ncnn.framework/Versions/A/Resources
ln -s A ncnn.framework/Versions/Current
ln -s Versions/Current/Headers ncnn.framework/Headers
ln -s Versions/Current/Resources ncnn.framework/Resources
ln -s Versions/Current/ncnn ncnn.framework/ncnn
lipo -create \
build-arm64/install/lib/libncnn.a \
build-arm64e/install/lib/libncnn.a \
-o ncnn.framework/Versions/A/ncnn
cp -a build-arm64/install/include/* ncnn.framework/Versions/A/Headers/
sed -e 's/__NAME__/ncnn/g' -e 's/__IDENTIFIER__/com.tencent.ncnn/g' -e 's/__VERSION__/1.0/g' Info.plist > ncnn.framework/Versions/A/Resources/Info.plist
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.framework glslang.framework ncnn.framework
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
openmp-tvos-simulator:
runs-on: macos-13
env:
OPENMP_VERSION: '18.1.2'
OPENMP_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$TVOS_DEPLOYMENT_TARGET \
-DENABLE_BITCODE=$ENABLE_BITCODE \
-DENABLE_ARC=$ENABLE_ARC \
-DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
-DPERL_EXECUTABLE=/usr/local/bin/perl \
-DLIBOMP_ENABLE_SHARED=OFF \
-DLIBOMP_OMPT_SUPPORT=OFF \
-DLIBOMP_USE_HWLOC=OFF \
steps:
- name: cache-openmp
id: cache-openmp
uses: actions/cache@v4
with:
path: openmp-install
key: openmp-tvos-simulator-release-18.1.2-20240403
- name: checkout
if: steps.cache-openmp.outputs.cache-hit != 'true'
uses: actions/checkout@v4
- name: openmp
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.OPENMP_VERSION }}/cmake-${{ env.OPENMP_VERSION }}.src.tar.xz
tar -xf cmake-${{ env.OPENMP_VERSION }}.src.tar.xz
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.OPENMP_VERSION }}/openmp-${{ env.OPENMP_VERSION }}.src.tar.xz
tar -xf openmp-${{ env.OPENMP_VERSION }}.src.tar.xz
mv cmake-${{ env.OPENMP_VERSION }}.src/Modules/* openmp-${{ env.OPENMP_VERSION }}.src/cmake/
cd openmp-${{ env.OPENMP_VERSION }}.src
wget https://github.com/nihui/llvm-project/commit/ef8c35bcf5d9cfdb0764ffde6a63c04ec715bc37.patch
patch -p2 -i ef8c35bcf5d9cfdb0764ffde6a63c04ec715bc37.patch
wget https://github.com/nihui/llvm-project/commit/5c12711f9a21f41bea70566bf15a4026804d6b20.patch
patch -p2 -i 5c12711f9a21f41bea70566bf15a4026804d6b20.patch
- name: build-x86_64
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
cd openmp-${{ env.OPENMP_VERSION }}.src
mkdir -p build-x86_64 && cd build-x86_64
cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_TVOS -DARCHS="x86_64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: build-arm64
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
cd openmp-${{ env.OPENMP_VERSION }}.src
mkdir -p build-arm64 && cd build-arm64
cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_TVOS -DARCHS="arm64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: merge-fat-library
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
rm -rf $GITHUB_WORKSPACE/openmp-install
mkdir -p $GITHUB_WORKSPACE/openmp-install
cp -a openmp-${{ env.OPENMP_VERSION }}.src/build-x86_64/install/include $GITHUB_WORKSPACE/openmp-install
mkdir -p $GITHUB_WORKSPACE/openmp-install/lib
lipo -create \
openmp-${{ env.OPENMP_VERSION }}.src/build-x86_64/install/lib/libomp.a \
openmp-${{ env.OPENMP_VERSION }}.src/build-arm64/install/lib/libomp.a \
-o $GITHUB_WORKSPACE/openmp-install/lib/libomp.a
- name: upload
uses: actions/upload-artifact@v4
with:
name: openmp-tvos-simulator
path: openmp-install
tvos-simulator:
needs: [setup, openmp-tvos-simulator]
runs-on: macos-13
env:
PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-tvos-simulator
NCNN_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$TVOS_DEPLOYMENT_TARGET \
-DENABLE_BITCODE=$ENABLE_BITCODE \
-DENABLE_ARC=$ENABLE_ARC \
-DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
-DOpenMP_C_FLAGS="-Xclang -fopenmp" -DOpenMP_CXX_FLAGS="-Xclang -fopenmp" \
-DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_libomp_LIBRARY="libomp.a" \
-DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DNCNN_BUILD_BENCHMARK=OFF \
-DNCNN_OPENMP=OFF \
-DNCNN_SIMPLEOMP=OFF \
steps:
- uses: actions/checkout@v4
- name: download-openmp-tvos-simulator
uses: actions/download-artifact@v4
with:
name: openmp-tvos-simulator
path: openmp-tvos-simulator
- name: install-openmp
run: |
sudo cp openmp-tvos-simulator/include/* $DEVELOPER_DIR/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/usr/include
sudo cp openmp-tvos-simulator/lib/libomp.a $DEVELOPER_DIR/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/usr/lib
- name: build-x86_64
run: |
mkdir build-x86_64 && cd build-x86_64
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_TVOS -DARCHS="x86_64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: build-arm64
run: |
mkdir build-arm64 && cd build-arm64
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_TVOS -DARCHS="arm64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: package-openmp
run: |
rm -rf openmp.framework
mkdir -p openmp.framework/Versions/A/Headers
mkdir -p openmp.framework/Versions/A/Resources
ln -s A openmp.framework/Versions/Current
ln -s Versions/Current/Headers openmp.framework/Headers
ln -s Versions/Current/Resources openmp.framework/Resources
ln -s Versions/Current/openmp openmp.framework/openmp
cp openmp-tvos-simulator/lib/libomp.a openmp.framework/Versions/A/openmp
cp -a openmp-tvos-simulator/include/* openmp.framework/Versions/A/Headers/
sed -e 's/__NAME__/openmp/g' -e 's/__IDENTIFIER__/org.llvm.openmp/g' -e 's/__VERSION__/18.1/g' Info.plist > openmp.framework/Versions/A/Resources/Info.plist
- name: package
run: |
rm -rf ncnn.framework
mkdir -p ncnn.framework/Versions/A/Headers
mkdir -p ncnn.framework/Versions/A/Resources
ln -s A ncnn.framework/Versions/Current
ln -s Versions/Current/Headers ncnn.framework/Headers
ln -s Versions/Current/Resources ncnn.framework/Resources
ln -s Versions/Current/ncnn ncnn.framework/ncnn
lipo -create \
build-x86_64/install/lib/libncnn.a \
build-arm64/install/lib/libncnn.a \
-o ncnn.framework/Versions/A/ncnn
cp -a build-x86_64/install/include/* ncnn.framework/Versions/A/Headers/
sed -e 's/__NAME__/ncnn/g' -e 's/__IDENTIFIER__/com.tencent.ncnn/g' -e 's/__VERSION__/1.0/g' Info.plist > ncnn.framework/Versions/A/Resources/Info.plist
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.framework ncnn.framework
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
tvos-simulator-gpu:
needs: [setup, openmp-tvos-simulator]
runs-on: macos-13
env:
PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-tvos-simulator-vulkan
NCNN_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$TVOS_DEPLOYMENT_TARGET \
-DENABLE_BITCODE=$ENABLE_BITCODE \
-DENABLE_ARC=$ENABLE_ARC \
-DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
-DOpenMP_C_FLAGS="-Xclang -fopenmp" -DOpenMP_CXX_FLAGS="-Xclang -fopenmp" \
-DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_libomp_LIBRARY="libomp.a" \
-DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DNCNN_VULKAN=ON \
-DNCNN_BUILD_BENCHMARK=OFF \
-DNCNN_OPENMP=OFF \
-DNCNN_SIMPLEOMP=OFF \
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: download-openmp-tvos-simulator
uses: actions/download-artifact@v4
with:
name: openmp-tvos-simulator
path: openmp-tvos-simulator
- name: install-openmp
run: |
sudo cp openmp-tvos-simulator/include/* $DEVELOPER_DIR/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/usr/include
sudo cp openmp-tvos-simulator/lib/libomp.a $DEVELOPER_DIR/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/usr/lib
- name: build-x86_64
run: |
mkdir build-x86_64 && cd build-x86_64
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_TVOS -DARCHS="x86_64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: build-arm64
run: |
mkdir build-arm64 && cd build-arm64
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_TVOS -DARCHS="arm64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: package-openmp
run: |
rm -rf openmp.framework
mkdir -p openmp.framework/Versions/A/Headers
mkdir -p openmp.framework/Versions/A/Resources
ln -s A openmp.framework/Versions/Current
ln -s Versions/Current/Headers openmp.framework/Headers
ln -s Versions/Current/Resources openmp.framework/Resources
ln -s Versions/Current/openmp openmp.framework/openmp
cp openmp-tvos-simulator/lib/libomp.a openmp.framework/Versions/A/openmp
cp -a openmp-tvos-simulator/include/* openmp.framework/Versions/A/Headers/
sed -e 's/__NAME__/openmp/g' -e 's/__IDENTIFIER__/org.llvm.openmp/g' -e 's/__VERSION__/18.1/g' Info.plist > openmp.framework/Versions/A/Resources/Info.plist
- name: package-glslang
run: |
rm -rf glslang.framework
mkdir -p glslang.framework/Versions/A/Headers
mkdir -p glslang.framework/Versions/A/Resources
ln -s A glslang.framework/Versions/Current
ln -s Versions/Current/Headers glslang.framework/Headers
ln -s Versions/Current/Resources glslang.framework/Resources
ln -s Versions/Current/glslang glslang.framework/glslang
libtool -static \
build-x86_64/install/lib/libglslang.a \
build-x86_64/install/lib/libMachineIndependent.a \
build-x86_64/install/lib/libGenericCodeGen.a \
build-x86_64/install/lib/libSPIRV.a \
build-x86_64/install/lib/libOGLCompiler.a \
build-x86_64/install/lib/libOSDependent.a \
-o build-x86_64/install/lib/libglslang_combined.a
libtool -static \
build-arm64/install/lib/libglslang.a \
build-arm64/install/lib/libMachineIndependent.a \
build-arm64/install/lib/libGenericCodeGen.a \
build-arm64/install/lib/libSPIRV.a \
build-arm64/install/lib/libOGLCompiler.a \
build-arm64/install/lib/libOSDependent.a \
-o build-arm64/install/lib/libglslang_combined.a
lipo -create \
build-x86_64/install/lib/libglslang_combined.a \
build-arm64/install/lib/libglslang_combined.a \
-o glslang.framework/Versions/A/glslang
cp -a build-x86_64/install/include/glslang glslang.framework/Versions/A/Headers/
sed -e 's/__NAME__/glslang/g' -e 's/__IDENTIFIER__/org.khronos.glslang/g' -e 's/__VERSION__/1.0/g' Info.plist > glslang.framework/Versions/A/Resources/Info.plist
- name: package
run: |
rm -rf ncnn.framework
mkdir -p ncnn.framework/Versions/A/Headers
mkdir -p ncnn.framework/Versions/A/Resources
ln -s A ncnn.framework/Versions/Current
ln -s Versions/Current/Headers ncnn.framework/Headers
ln -s Versions/Current/Resources ncnn.framework/Resources
ln -s Versions/Current/ncnn ncnn.framework/ncnn
lipo -create \
build-x86_64/install/lib/libncnn.a \
build-arm64/install/lib/libncnn.a \
-o ncnn.framework/Versions/A/ncnn
cp -a build-x86_64/install/include/* ncnn.framework/Versions/A/Headers/
sed -e 's/__NAME__/ncnn/g' -e 's/__IDENTIFIER__/com.tencent.ncnn/g' -e 's/__VERSION__/1.0/g' Info.plist > ncnn.framework/Versions/A/Resources/Info.plist
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.framework glslang.framework ncnn.framework
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
openmp-visionos:
runs-on: macos-13
env:
OPENMP_VERSION: '18.1.2'
OPENMP_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$VISIONOS_DEPLOYMENT_TARGET \
-DENABLE_BITCODE=$ENABLE_BITCODE \
-DENABLE_ARC=$ENABLE_ARC \
-DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
-DPERL_EXECUTABLE=/usr/local/bin/perl \
-DLIBOMP_ENABLE_SHARED=OFF \
-DLIBOMP_OMPT_SUPPORT=OFF \
-DLIBOMP_USE_HWLOC=OFF \
steps:
- name: cache-openmp
id: cache-openmp
uses: actions/cache@v4
with:
path: openmp-install
key: openmp-visionos-release-18.1.2-20240403
- name: checkout
if: steps.cache-openmp.outputs.cache-hit != 'true'
uses: actions/checkout@v4
- name: openmp
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.OPENMP_VERSION }}/cmake-${{ env.OPENMP_VERSION }}.src.tar.xz
tar -xf cmake-${{ env.OPENMP_VERSION }}.src.tar.xz
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.OPENMP_VERSION }}/openmp-${{ env.OPENMP_VERSION }}.src.tar.xz
tar -xf openmp-${{ env.OPENMP_VERSION }}.src.tar.xz
mv cmake-${{ env.OPENMP_VERSION }}.src/Modules/* openmp-${{ env.OPENMP_VERSION }}.src/cmake/
cd openmp-${{ env.OPENMP_VERSION }}.src
wget https://github.com/nihui/llvm-project/commit/ef8c35bcf5d9cfdb0764ffde6a63c04ec715bc37.patch
patch -p2 -i ef8c35bcf5d9cfdb0764ffde6a63c04ec715bc37.patch
wget https://github.com/nihui/llvm-project/commit/5c12711f9a21f41bea70566bf15a4026804d6b20.patch
patch -p2 -i 5c12711f9a21f41bea70566bf15a4026804d6b20.patch
- name: build-arm64
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
cd openmp-${{ env.OPENMP_VERSION }}.src
mkdir -p build-arm64 && cd build-arm64
cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=VISIONOS -DARCHS="arm64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: merge-fat-library
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
rm -rf $GITHUB_WORKSPACE/openmp-install
mkdir -p $GITHUB_WORKSPACE/openmp-install
cp -a openmp-${{ env.OPENMP_VERSION }}.src/build-arm64/install/include $GITHUB_WORKSPACE/openmp-install
mkdir -p $GITHUB_WORKSPACE/openmp-install/lib
cp openmp-${{ env.OPENMP_VERSION }}.src/build-arm64/install/lib/libomp.a $GITHUB_WORKSPACE/openmp-install/lib/libomp.a
- name: upload
uses: actions/upload-artifact@v4
with:
name: openmp-visionos
path: openmp-install
visionos:
needs: [setup, openmp-visionos]
runs-on: macos-13
env:
PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-visionos
NCNN_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$VISIONOS_DEPLOYMENT_TARGET \
-DENABLE_BITCODE=$ENABLE_BITCODE \
-DENABLE_ARC=$ENABLE_ARC \
-DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
-DOpenMP_C_FLAGS="-Xclang -fopenmp" -DOpenMP_CXX_FLAGS="-Xclang -fopenmp" \
-DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_libomp_LIBRARY="libomp.a" \
-DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DNCNN_BUILD_BENCHMARK=OFF \
-DNCNN_OPENMP=OFF \
-DNCNN_SIMPLEOMP=OFF \
steps:
- uses: actions/checkout@v4
- name: download-openmp-visionos
uses: actions/download-artifact@v4
with:
name: openmp-visionos
path: openmp-visionos
- name: install-openmp
run: |
sudo cp openmp-visionos/include/* $DEVELOPER_DIR/Platforms/XROS.platform/Developer/SDKs/XROS.sdk/usr/include
sudo cp openmp-visionos/lib/libomp.a $DEVELOPER_DIR/Platforms/XROS.platform/Developer/SDKs/XROS.sdk/usr/lib
- name: build-arm64
run: |
mkdir build-arm64 && cd build-arm64
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=VISIONOS -DARCHS="arm64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: package-openmp
run: |
rm -rf openmp.framework
mkdir -p openmp.framework/Versions/A/Headers
mkdir -p openmp.framework/Versions/A/Resources
ln -s A openmp.framework/Versions/Current
ln -s Versions/Current/Headers openmp.framework/Headers
ln -s Versions/Current/Resources openmp.framework/Resources
ln -s Versions/Current/openmp openmp.framework/openmp
cp openmp-visionos/lib/libomp.a openmp.framework/Versions/A/openmp
cp -a openmp-visionos/include/* openmp.framework/Versions/A/Headers/
sed -e 's/__NAME__/openmp/g' -e 's/__IDENTIFIER__/org.llvm.openmp/g' -e 's/__VERSION__/18.1/g' Info.plist > openmp.framework/Versions/A/Resources/Info.plist
- name: package
run: |
rm -rf ncnn.framework
mkdir -p ncnn.framework/Versions/A/Headers
mkdir -p ncnn.framework/Versions/A/Resources
ln -s A ncnn.framework/Versions/Current
ln -s Versions/Current/Headers ncnn.framework/Headers
ln -s Versions/Current/Resources ncnn.framework/Resources
ln -s Versions/Current/ncnn ncnn.framework/ncnn
cp build-arm64/install/lib/libncnn.a ncnn.framework/Versions/A/ncnn
cp -a build-arm64/install/include/* ncnn.framework/Versions/A/Headers/
sed -e 's/__NAME__/ncnn/g' -e 's/__IDENTIFIER__/com.tencent.ncnn/g' -e 's/__VERSION__/1.0/g' Info.plist > ncnn.framework/Versions/A/Resources/Info.plist
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.framework ncnn.framework
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
openmp-visionos-simulator:
runs-on: macos-13
env:
OPENMP_VERSION: '18.1.2'
OPENMP_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$VISIONOS_DEPLOYMENT_TARGET \
-DENABLE_BITCODE=$ENABLE_BITCODE \
-DENABLE_ARC=$ENABLE_ARC \
-DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
-DPERL_EXECUTABLE=/usr/local/bin/perl \
-DLIBOMP_ENABLE_SHARED=OFF \
-DLIBOMP_OMPT_SUPPORT=OFF \
-DLIBOMP_USE_HWLOC=OFF \
steps:
- name: cache-openmp
id: cache-openmp
uses: actions/cache@v4
with:
path: openmp-install
key: openmp-visionos-simulator-release-18.1.2-20240403
- name: checkout
if: steps.cache-openmp.outputs.cache-hit != 'true'
uses: actions/checkout@v4
- name: openmp
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.OPENMP_VERSION }}/cmake-${{ env.OPENMP_VERSION }}.src.tar.xz
tar -xf cmake-${{ env.OPENMP_VERSION }}.src.tar.xz
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.OPENMP_VERSION }}/openmp-${{ env.OPENMP_VERSION }}.src.tar.xz
tar -xf openmp-${{ env.OPENMP_VERSION }}.src.tar.xz
mv cmake-${{ env.OPENMP_VERSION }}.src/Modules/* openmp-${{ env.OPENMP_VERSION }}.src/cmake/
cd openmp-${{ env.OPENMP_VERSION }}.src
wget https://github.com/nihui/llvm-project/commit/ef8c35bcf5d9cfdb0764ffde6a63c04ec715bc37.patch
patch -p2 -i ef8c35bcf5d9cfdb0764ffde6a63c04ec715bc37.patch
wget https://github.com/nihui/llvm-project/commit/5c12711f9a21f41bea70566bf15a4026804d6b20.patch
patch -p2 -i 5c12711f9a21f41bea70566bf15a4026804d6b20.patch
- name: build-x86_64
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
cd openmp-${{ env.OPENMP_VERSION }}.src
mkdir -p build-x86_64 && cd build-x86_64
cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_VISIONOS -DARCHS="x86_64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: build-arm64
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
cd openmp-${{ env.OPENMP_VERSION }}.src
mkdir -p build-arm64 && cd build-arm64
cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_VISIONOS -DARCHS="arm64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: merge-fat-library
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
rm -rf $GITHUB_WORKSPACE/openmp-install
mkdir -p $GITHUB_WORKSPACE/openmp-install
cp -a openmp-${{ env.OPENMP_VERSION }}.src/build-x86_64/install/include $GITHUB_WORKSPACE/openmp-install
mkdir -p $GITHUB_WORKSPACE/openmp-install/lib
lipo -create \
openmp-${{ env.OPENMP_VERSION }}.src/build-x86_64/install/lib/libomp.a \
openmp-${{ env.OPENMP_VERSION }}.src/build-arm64/install/lib/libomp.a \
-o $GITHUB_WORKSPACE/openmp-install/lib/libomp.a
- name: upload
uses: actions/upload-artifact@v4
with:
name: openmp-visionos-simulator
path: openmp-install
visionos-simulator:
needs: [setup, openmp-visionos-simulator]
runs-on: macos-13
env:
PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-visionos-simulator
NCNN_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$VISIONOS_DEPLOYMENT_TARGET \
-DENABLE_BITCODE=$ENABLE_BITCODE \
-DENABLE_ARC=$ENABLE_ARC \
-DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_BUILD_TYPE=Release \
-DOpenMP_C_FLAGS="-Xclang -fopenmp" -DOpenMP_CXX_FLAGS="-Xclang -fopenmp" \
-DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_libomp_LIBRARY="libomp.a" \
-DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DNCNN_BUILD_BENCHMARK=OFF \
-DNCNN_OPENMP=OFF \
-DNCNN_SIMPLEOMP=OFF \
steps:
- uses: actions/checkout@v4
- name: download-openmp-visionos-simulator
uses: actions/download-artifact@v4
with:
name: openmp-visionos-simulator
path: openmp-visionos-simulator
- name: install-openmp
run: |
sudo cp openmp-visionos-simulator/include/* $DEVELOPER_DIR/Platforms/XRSimulator.platform/Developer/SDKs/XRSimulator.sdk/usr/include
sudo cp openmp-visionos-simulator/lib/libomp.a $DEVELOPER_DIR/Platforms/XRSimulator.platform/Developer/SDKs/XRSimulator.sdk/usr/lib
- name: build-x86_64
run: |
mkdir build-x86_64 && cd build-x86_64
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_VISIONOS -DARCHS="x86_64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: build-arm64
run: |
mkdir build-arm64 && cd build-arm64
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_VISIONOS -DARCHS="arm64" ..
cmake --build . -j 4
cmake --build . --target install/strip
- name: package-openmp
run: |
rm -rf openmp.framework
mkdir -p openmp.framework/Versions/A/Headers
mkdir -p openmp.framework/Versions/A/Resources
ln -s A openmp.framework/Versions/Current
ln -s Versions/Current/Headers openmp.framework/Headers
ln -s Versions/Current/Resources openmp.framework/Resources
ln -s Versions/Current/openmp openmp.framework/openmp
cp openmp-visionos-simulator/lib/libomp.a openmp.framework/Versions/A/openmp
cp -a openmp-visionos-simulator/include/* openmp.framework/Versions/A/Headers/
sed -e 's/__NAME__/openmp/g' -e 's/__IDENTIFIER__/org.llvm.openmp/g' -e 's/__VERSION__/18.1/g' Info.plist > openmp.framework/Versions/A/Resources/Info.plist
- name: package
run: |
rm -rf ncnn.framework
mkdir -p ncnn.framework/Versions/A/Headers
mkdir -p ncnn.framework/Versions/A/Resources
ln -s A ncnn.framework/Versions/Current
ln -s Versions/Current/Headers ncnn.framework/Headers
ln -s Versions/Current/Resources ncnn.framework/Resources
ln -s Versions/Current/ncnn ncnn.framework/ncnn
lipo -create \
build-x86_64/install/lib/libncnn.a \
build-arm64/install/lib/libncnn.a \
-o ncnn.framework/Versions/A/ncnn
cp -a build-x86_64/install/include/* ncnn.framework/Versions/A/Headers/
sed -e 's/__NAME__/ncnn/g' -e 's/__IDENTIFIER__/com.tencent.ncnn/g' -e 's/__VERSION__/1.0/g' Info.plist > ncnn.framework/Versions/A/Resources/Info.plist
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.framework ncnn.framework
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
android:
needs: [setup]
runs-on: ubuntu-latest
env:
PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-android
steps:
- uses: actions/checkout@v4
- name: ndk-fix-debug
run: sed -i -e '/^ -g$/d' $ANDROID_NDK_LATEST_HOME/build/cmake/android-legacy.toolchain.cmake
- name: build-armv7
run: |
mkdir build-armv7 && cd build-armv7
cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=False -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DANDROID_ABI="armeabi-v7a" -DANDROID_ARM_NEON=ON -DANDROID_PLATFORM=android-14 \
-DNCNN_BUILD_BENCHMARK=OFF ..
cmake --build . -j $(nproc)
cmake --build . --target install/strip
- name: build-aarch64
run: |
mkdir build-aarch64 && cd build-aarch64
cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=False -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DANDROID_ABI="arm64-v8a" -DANDROID_PLATFORM=android-21 \
-DNCNN_BUILD_BENCHMARK=OFF ..
cmake --build . -j $(nproc)
cmake --build . --target install/strip
- name: build-x86
run: |
mkdir build-x86 && cd build-x86
cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=False -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DANDROID_ABI="x86" -DANDROID_PLATFORM=android-14 \
-DNCNN_BUILD_BENCHMARK=OFF ..
cmake --build . -j $(nproc)
cmake --build . --target install/strip
- name: build-x86_64
run: |
mkdir build-x86_64 && cd build-x86_64
cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=False -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DANDROID_ABI="x86_64" -DANDROID_PLATFORM=android-21 \
-DNCNN_BUILD_BENCHMARK=OFF ..
cmake --build . -j $(nproc)
cmake --build . --target install/strip
- name: package
run: |
rm -rf ${{ env.PACKAGENAME }}
mkdir -p ${{ env.PACKAGENAME }}
cp -a build-armv7/install ${{ env.PACKAGENAME }}/armeabi-v7a
cp -a build-aarch64/install ${{ env.PACKAGENAME }}/arm64-v8a
cp -a build-x86/install ${{ env.PACKAGENAME }}/x86
cp -a build-x86_64/install ${{ env.PACKAGENAME }}/x86_64
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
android-shared:
needs: [setup]
runs-on: ubuntu-latest
env:
PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-android-shared
steps:
- uses: actions/checkout@v4
- name: ndk-fix-debug
run: sed -i -e '/^ -g$/d' $ANDROID_NDK_LATEST_HOME/build/cmake/android-legacy.toolchain.cmake
- name: build-armv7
run: |
mkdir build-armv7 && cd build-armv7
cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=False -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DANDROID_ABI="armeabi-v7a" -DANDROID_ARM_NEON=ON -DANDROID_PLATFORM=android-14 \
-DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
cmake --build . -j $(nproc)
cmake --build . --target install/strip
- name: build-aarch64
run: |
mkdir build-aarch64 && cd build-aarch64
cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=False -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DANDROID_ABI="arm64-v8a" -DANDROID_PLATFORM=android-21 \
-DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
cmake --build . -j $(nproc)
cmake --build . --target install/strip
- name: build-x86
run: |
mkdir build-x86 && cd build-x86
cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=False -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DANDROID_ABI="x86" -DANDROID_PLATFORM=android-14 \
-DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
cmake --build . -j $(nproc)
cmake --build . --target install/strip
- name: build-x86_64
run: |
mkdir build-x86_64 && cd build-x86_64
cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=False -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DANDROID_ABI="x86_64" -DANDROID_PLATFORM=android-21 \
-DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
cmake --build . -j $(nproc)
cmake --build . --target install/strip
- name: package
run: |
rm -rf ${{ env.PACKAGENAME }}
mkdir -p ${{ env.PACKAGENAME }}
cp -a build-armv7/install ${{ env.PACKAGENAME }}/armeabi-v7a
cp -a build-aarch64/install ${{ env.PACKAGENAME }}/arm64-v8a
cp -a build-x86/install ${{ env.PACKAGENAME }}/x86
cp -a build-x86_64/install ${{ env.PACKAGENAME }}/x86_64
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
android-gpu:
needs: [setup]
runs-on: ubuntu-latest
env:
PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-android-vulkan
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: ndk-fix-debug
run: sed -i -e '/^ -g$/d' $ANDROID_NDK_LATEST_HOME/build/cmake/android-legacy.toolchain.cmake
- name: build-armv7
run: |
mkdir build-armv7 && cd build-armv7
cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=False -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DANDROID_ABI="armeabi-v7a" -DANDROID_ARM_NEON=ON -DANDROID_PLATFORM=android-14 \
-DNCNN_VULKAN=ON -DNCNN_BUILD_BENCHMARK=OFF ..
cmake --build . -j $(nproc)
cmake --build . --target install/strip
- name: build-aarch64
run: |
mkdir build-aarch64 && cd build-aarch64
cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=False -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DANDROID_ABI="arm64-v8a" -DANDROID_PLATFORM=android-21 \
-DNCNN_VULKAN=ON -DNCNN_BUILD_BENCHMARK=OFF ..
cmake --build . -j $(nproc)
cmake --build . --target install/strip
- name: build-x86
run: |
mkdir build-x86 && cd build-x86
cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=False -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DANDROID_ABI="x86" -DANDROID_PLATFORM=android-14 \
-DNCNN_VULKAN=ON -DNCNN_BUILD_BENCHMARK=OFF ..
cmake --build . -j $(nproc)
cmake --build . --target install/strip
- name: build-x86_64
run: |
mkdir build-x86_64 && cd build-x86_64
cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=False -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DANDROID_ABI="x86_64" -DANDROID_PLATFORM=android-21 \
-DNCNN_VULKAN=ON -DNCNN_BUILD_BENCHMARK=OFF ..
cmake --build . -j $(nproc)
cmake --build . --target install/strip
- name: package
run: |
rm -rf ${{ env.PACKAGENAME }}
mkdir -p ${{ env.PACKAGENAME }}
cp -a build-armv7/install ${{ env.PACKAGENAME }}/armeabi-v7a
cp -a build-aarch64/install ${{ env.PACKAGENAME }}/arm64-v8a
cp -a build-x86/install ${{ env.PACKAGENAME }}/x86
cp -a build-x86_64/install ${{ env.PACKAGENAME }}/x86_64
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
android-gpu-shared:
needs: [setup]
runs-on: ubuntu-latest
env:
PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-android-vulkan-shared
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: ndk-fix-debug
run: sed -i -e '/^ -g$/d' $ANDROID_NDK_LATEST_HOME/build/cmake/android-legacy.toolchain.cmake
- name: build-armv7
run: |
mkdir build-armv7 && cd build-armv7
cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=False -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DANDROID_ABI="armeabi-v7a" -DANDROID_ARM_NEON=ON -DANDROID_PLATFORM=android-14 \
-DNCNN_VULKAN=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
cmake --build . -j $(nproc)
cmake --build . --target install/strip
- name: build-aarch64
run: |
mkdir build-aarch64 && cd build-aarch64
cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=False -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DANDROID_ABI="arm64-v8a" -DANDROID_PLATFORM=android-21 \
-DNCNN_VULKAN=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
cmake --build . -j $(nproc)
cmake --build . --target install/strip
- name: build-x86
run: |
mkdir build-x86 && cd build-x86
cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=False -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DANDROID_ABI="x86" -DANDROID_PLATFORM=android-14 \
-DNCNN_VULKAN=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
cmake --build . -j $(nproc)
cmake --build . --target install/strip
- name: build-x86_64
run: |
mkdir build-x86_64 && cd build-x86_64
cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=False -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DANDROID_ABI="x86_64" -DANDROID_PLATFORM=android-21 \
-DNCNN_VULKAN=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
cmake --build . -j $(nproc)
cmake --build . --target install/strip
- name: package
run: |
rm -rf ${{ env.PACKAGENAME }}
mkdir -p ${{ env.PACKAGENAME }}
cp -a build-armv7/install ${{ env.PACKAGENAME }}/armeabi-v7a
cp -a build-aarch64/install ${{ env.PACKAGENAME }}/arm64-v8a
cp -a build-x86/install ${{ env.PACKAGENAME }}/x86
cp -a build-x86_64/install ${{ env.PACKAGENAME }}/x86_64
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
webassembly:
needs: [setup]
runs-on: ubuntu-latest
env:
PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-webassembly
steps:
- uses: actions/checkout@v4
- name: emsdk
run: |
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install $EMSCRIPTEN_VERSION
./emsdk activate $EMSCRIPTEN_VERSION
- name: build
run: |
source emsdk/emsdk_env.sh
mkdir build && cd build
cmake -DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DNCNN_THREADS=OFF -DNCNN_OPENMP=OFF -DNCNN_SIMPLEOMP=OFF -DNCNN_SIMPLEOCV=ON -DNCNN_RUNTIME_CPU=OFF -DNCNN_SSE2=OFF -DNCNN_AVX2=OFF -DNCNN_AVX=OFF \
-DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_BENCHMARK=OFF ..
cmake --build . -j $(nproc)
cmake --build . --target install/strip
- name: build-simd
run: |
source emsdk/emsdk_env.sh
mkdir build-simd && cd build-simd
cmake -DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DNCNN_THREADS=OFF -DNCNN_OPENMP=OFF -DNCNN_SIMPLEOMP=OFF -DNCNN_SIMPLEOCV=ON -DNCNN_RUNTIME_CPU=OFF -DNCNN_SSE2=ON -DNCNN_AVX2=OFF -DNCNN_AVX=OFF \
-DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_BENCHMARK=OFF ..
cmake --build . -j $(nproc)
cmake --build . --target install/strip
- name: build-threads
run: |
source emsdk/emsdk_env.sh
mkdir build-threads && cd build-threads
cmake -DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DNCNN_THREADS=ON -DNCNN_OPENMP=ON -DNCNN_SIMPLEOMP=ON -DNCNN_SIMPLEOCV=ON -DNCNN_RUNTIME_CPU=OFF -DNCNN_SSE2=OFF -DNCNN_AVX2=OFF -DNCNN_AVX=OFF \
-DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_BENCHMARK=OFF ..
cmake --build . -j $(nproc)
cmake --build . --target install/strip
- name: build-simd-threads
run: |
source emsdk/emsdk_env.sh
mkdir build-simd-threads && cd build-simd-threads
cmake -DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DNCNN_THREADS=ON -DNCNN_OPENMP=ON -DNCNN_SIMPLEOMP=ON -DNCNN_SIMPLEOCV=ON -DNCNN_RUNTIME_CPU=OFF -DNCNN_SSE2=ON -DNCNN_AVX2=OFF -DNCNN_AVX=OFF \
-DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_BENCHMARK=OFF ..
cmake --build . -j $(nproc)
cmake --build . --target install/strip
- name: package
run: |
rm -rf ${{ env.PACKAGENAME }}
mkdir -p ${{ env.PACKAGENAME }}
cp -a build/install ${{ env.PACKAGENAME }}/basic
cp -a build-simd/install ${{ env.PACKAGENAME }}/simd
cp -a build-threads/install ${{ env.PACKAGENAME }}/threads
cp -a build-simd-threads/install ${{ env.PACKAGENAME }}/simd-threads
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
windows-vs2015:
needs: [setup]
runs-on: windows-2019
env:
PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-windows-vs2015
UseMultiToolTask: true
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: cache-protobuf
id: cache-protobuf
uses: actions/cache@v4
with:
path: "protobuf-install"
key: protobuf-vs2015-x86-x64-install
- name: protobuf
if: steps.cache-protobuf.outputs.cache-hit != 'true'
run: |
Invoke-WebRequest -Uri https://github.com/protocolbuffers/protobuf/archive/v3.11.2.zip -OutFile protobuf-3.11.2.zip
7z x ./protobuf-3.11.2.zip
cd protobuf-3.11.2
mkdir build-x86; cd build-x86;
cmake -T v140,host=x64 -A Win32 -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE\protobuf-install\x86" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
cd ..
mkdir build-x64; cd build-x64;
cmake -T v140,host=x64 -A x64 -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE\protobuf-install\x64" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
- name: build-x86
run: |
mkdir build-x86; cd build-x86
cmake -T v140,host=x64 -A Win32 -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -Dprotobuf_DIR="$env:GITHUB_WORKSPACE\protobuf-install\x86\cmake" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF ..
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
- name: build-x64
run: |
mkdir build-x64; cd build-x64
cmake -T v140,host=x64 -A x64 -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -Dprotobuf_DIR="$env:GITHUB_WORKSPACE\protobuf-install\x64\cmake" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF ..
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
- name: package
run: |
mkdir ${{ env.PACKAGENAME }}
mkdir ${{ env.PACKAGENAME }}/x86
mkdir ${{ env.PACKAGENAME }}/x64
Copy-Item -Verbose -Recurse -Path "build-x86\install\*" -Destination "${{ env.PACKAGENAME }}\x86"
Copy-Item -Verbose -Recurse -Path "build-x64\install\*" -Destination "${{ env.PACKAGENAME }}\x64"
7z a -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
windows-vs2015-shared:
needs: [setup]
runs-on: windows-2019
env:
PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-windows-vs2015-shared
UseMultiToolTask: true
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: cache-protobuf
id: cache-protobuf
uses: actions/cache@v4
with:
path: "protobuf-install"
key: protobuf-vs2015-x86-x64-install
- name: protobuf
if: steps.cache-protobuf.outputs.cache-hit != 'true'
run: |
Invoke-WebRequest -Uri https://github.com/protocolbuffers/protobuf/archive/v3.11.2.zip -OutFile protobuf-3.11.2.zip
7z x ./protobuf-3.11.2.zip
cd protobuf-3.11.2
mkdir build-x86; cd build-x86;
cmake -T v140,host=x64 -A Win32 -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE\protobuf-install\x86" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
cd ..
mkdir build-x64; cd build-x64;
cmake -T v140,host=x64 -A x64 -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE\protobuf-install\x64" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
- name: build-x86
run: |
mkdir build-x86; cd build-x86
cmake -T v140,host=x64 -A Win32 -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -Dprotobuf_DIR="$env:GITHUB_WORKSPACE\protobuf-install\x86\cmake" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
- name: build-x64
run: |
mkdir build-x64; cd build-x64
cmake -T v140,host=x64 -A x64 -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -Dprotobuf_DIR="$env:GITHUB_WORKSPACE\protobuf-install\x64\cmake" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
- name: package
run: |
mkdir ${{ env.PACKAGENAME }}
mkdir ${{ env.PACKAGENAME }}/x86
mkdir ${{ env.PACKAGENAME }}/x64
Copy-Item -Verbose -Recurse -Path "build-x86\install\*" -Destination "${{ env.PACKAGENAME }}\x86"
Copy-Item -Verbose -Recurse -Path "build-x64\install\*" -Destination "${{ env.PACKAGENAME }}\x64"
7z a -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
windows-vs2017:
needs: [setup]
runs-on: windows-2019
env:
PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-windows-vs2017
UseMultiToolTask: true
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: cache-protobuf
id: cache-protobuf
uses: actions/cache@v4
with:
path: "protobuf-install"
key: protobuf-vs2017-x86-x64-install
- name: protobuf
if: steps.cache-protobuf.outputs.cache-hit != 'true'
run: |
Invoke-WebRequest -Uri https://github.com/protocolbuffers/protobuf/archive/v3.11.2.zip -OutFile protobuf-3.11.2.zip
7z x ./protobuf-3.11.2.zip
cd protobuf-3.11.2
mkdir build-x86; cd build-x86;
cmake -T v141,host=x64 -A Win32 -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE\protobuf-install\x86" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
cd ..
mkdir build-x64; cd build-x64;
cmake -T v141,host=x64 -A x64 -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE\protobuf-install\x64" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
- name: build-x86
run: |
mkdir build-x86; cd build-x86
cmake -T v141,host=x64 -A Win32 -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -Dprotobuf_DIR="$env:GITHUB_WORKSPACE\protobuf-install\x86\cmake" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF ..
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
- name: build-x64
run: |
mkdir build-x64; cd build-x64
cmake -T v141,host=x64 -A x64 -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -Dprotobuf_DIR="$env:GITHUB_WORKSPACE\protobuf-install\x64\cmake" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF ..
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
- name: package
run: |
mkdir ${{ env.PACKAGENAME }}
mkdir ${{ env.PACKAGENAME }}/x86
mkdir ${{ env.PACKAGENAME }}/x64
Copy-Item -Verbose -Recurse -Path "build-x86\install\*" -Destination "${{ env.PACKAGENAME }}\x86"
Copy-Item -Verbose -Recurse -Path "build-x64\install\*" -Destination "${{ env.PACKAGENAME }}\x64"
7z a -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
windows-vs2017-shared:
needs: [setup]
runs-on: windows-2019
env:
PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-windows-vs2017-shared
UseMultiToolTask: true
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: cache-protobuf
id: cache-protobuf
uses: actions/cache@v4
with:
path: "protobuf-install"
key: protobuf-vs2017-x86-x64-install
- name: protobuf
if: steps.cache-protobuf.outputs.cache-hit != 'true'
run: |
Invoke-WebRequest -Uri https://github.com/protocolbuffers/protobuf/archive/v3.11.2.zip -OutFile protobuf-3.11.2.zip
7z x ./protobuf-3.11.2.zip
cd protobuf-3.11.2
mkdir build-x86; cd build-x86;
cmake -T v141,host=x64 -A Win32 -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE\protobuf-install\x86" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
cd ..
mkdir build-x64; cd build-x64;
cmake -T v141,host=x64 -A x64 -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE\protobuf-install\x64" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
- name: build-x86
run: |
mkdir build-x86; cd build-x86
cmake -T v141,host=x64 -A Win32 -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -Dprotobuf_DIR="$env:GITHUB_WORKSPACE\protobuf-install\x86\cmake" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
- name: build-x64
run: |
mkdir build-x64; cd build-x64
cmake -T v141,host=x64 -A x64 -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -Dprotobuf_DIR="$env:GITHUB_WORKSPACE\protobuf-install\x64\cmake" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
- name: package
run: |
mkdir ${{ env.PACKAGENAME }}
mkdir ${{ env.PACKAGENAME }}/x86
mkdir ${{ env.PACKAGENAME }}/x64
Copy-Item -Verbose -Recurse -Path "build-x86\install\*" -Destination "${{ env.PACKAGENAME }}\x86"
Copy-Item -Verbose -Recurse -Path "build-x64\install\*" -Destination "${{ env.PACKAGENAME }}\x64"
7z a -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
windows-vs2019:
needs: [setup]
runs-on: windows-latest
env:
PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-windows-vs2019
UseMultiToolTask: true
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: cache-protobuf
id: cache-protobuf
uses: actions/cache@v4
with:
path: "protobuf-install"
key: protobuf-vs2019-x86-x64-install
- name: protobuf
if: steps.cache-protobuf.outputs.cache-hit != 'true'
run: |
Invoke-WebRequest -Uri https://github.com/protocolbuffers/protobuf/archive/v3.11.2.zip -OutFile protobuf-3.11.2.zip
7z x ./protobuf-3.11.2.zip
cd protobuf-3.11.2
mkdir build-x86; cd build-x86;
cmake -T v142,host=x64 -A Win32 -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE\protobuf-install\x86" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
cd ..
mkdir build-x64; cd build-x64;
cmake -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE\protobuf-install\x64" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
- name: build-x86
run: |
mkdir build-x86; cd build-x86
cmake -T v142,host=x64 -A Win32 -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -Dprotobuf_DIR="$env:GITHUB_WORKSPACE\protobuf-install\x86\cmake" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF ..
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
- name: build-x64
run: |
mkdir build-x64; cd build-x64
cmake -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -Dprotobuf_DIR="$env:GITHUB_WORKSPACE\protobuf-install\x64\cmake" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF ..
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
- name: build-arm
run: |
mkdir build-arm; cd build-arm
cmake -T v142,host=x64 -A arm -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF ..
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
- name: build-arm64
run: |
mkdir build-arm64; cd build-arm64
cmake -T v142,host=x64 -A arm64 -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF ..
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
- name: package
run: |
mkdir ${{ env.PACKAGENAME }}
mkdir ${{ env.PACKAGENAME }}/x86
mkdir ${{ env.PACKAGENAME }}/x64
mkdir ${{ env.PACKAGENAME }}/arm
mkdir ${{ env.PACKAGENAME }}/arm64
Copy-Item -Verbose -Recurse -Path "build-x86\install\*" -Destination "${{ env.PACKAGENAME }}\x86"
Copy-Item -Verbose -Recurse -Path "build-x64\install\*" -Destination "${{ env.PACKAGENAME }}\x64"
Copy-Item -Verbose -Recurse -Path "build-arm\install\*" -Destination "${{ env.PACKAGENAME }}\arm"
Copy-Item -Verbose -Recurse -Path "build-arm64\install\*" -Destination "${{ env.PACKAGENAME }}\arm64"
7z a -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
windows-vs2019-shared:
needs: [setup]
runs-on: windows-latest
env:
PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-windows-vs2019-shared
UseMultiToolTask: true
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: cache-protobuf
id: cache-protobuf
uses: actions/cache@v4
with:
path: "protobuf-install"
key: protobuf-vs2019-x86-x64-install
- name: protobuf
if: steps.cache-protobuf.outputs.cache-hit != 'true'
run: |
Invoke-WebRequest -Uri https://github.com/protocolbuffers/protobuf/archive/v3.11.2.zip -OutFile protobuf-3.11.2.zip
7z x ./protobuf-3.11.2.zip
cd protobuf-3.11.2
mkdir build-x86; cd build-x86;
cmake -T v142,host=x64 -A Win32 -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE\protobuf-install\x86" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
cd ..
mkdir build-x64; cd build-x64;
cmake -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE\protobuf-install\x64" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
- name: build-x86
run: |
mkdir build-x86; cd build-x86
cmake -T v142,host=x64 -A Win32 -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -Dprotobuf_DIR="$env:GITHUB_WORKSPACE\protobuf-install\x86\cmake" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
- name: build-x64
run: |
mkdir build-x64; cd build-x64
cmake -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -Dprotobuf_DIR="$env:GITHUB_WORKSPACE\protobuf-install\x64\cmake" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
- name: build-arm
run: |
mkdir build-arm; cd build-arm
cmake -T v142,host=x64 -A arm -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
- name: build-arm64
run: |
mkdir build-arm64; cd build-arm64
cmake -T v142,host=x64 -A arm64 -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
- name: package
run: |
mkdir ${{ env.PACKAGENAME }}
mkdir ${{ env.PACKAGENAME }}/x86
mkdir ${{ env.PACKAGENAME }}/x64
mkdir ${{ env.PACKAGENAME }}/arm
mkdir ${{ env.PACKAGENAME }}/arm64
Copy-Item -Verbose -Recurse -Path "build-x86\install\*" -Destination "${{ env.PACKAGENAME }}\x86"
Copy-Item -Verbose -Recurse -Path "build-x64\install\*" -Destination "${{ env.PACKAGENAME }}\x64"
Copy-Item -Verbose -Recurse -Path "build-arm\install\*" -Destination "${{ env.PACKAGENAME }}\arm"
Copy-Item -Verbose -Recurse -Path "build-arm64\install\*" -Destination "${{ env.PACKAGENAME }}\arm64"
7z a -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
windows-vs2022:
needs: [setup]
runs-on: windows-latest
env:
PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-windows-vs2022
UseMultiToolTask: true
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: cache-protobuf
id: cache-protobuf
uses: actions/cache@v4
with:
path: "protobuf-install"
key: protobuf-vs2022-x86-x64-install
- name: protobuf
if: steps.cache-protobuf.outputs.cache-hit != 'true'
run: |
Invoke-WebRequest -Uri https://github.com/protocolbuffers/protobuf/archive/v3.11.2.zip -OutFile protobuf-3.11.2.zip
7z x ./protobuf-3.11.2.zip
cd protobuf-3.11.2
mkdir build-x86; cd build-x86;
cmake -T v143,host=x64 -A Win32 -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE\protobuf-install\x86" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
cd ..
mkdir build-x64; cd build-x64;
cmake -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE\protobuf-install\x64" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
- name: build-x86
run: |
mkdir build-x86; cd build-x86
cmake -T v143,host=x64 -A Win32 -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -Dprotobuf_DIR="$env:GITHUB_WORKSPACE\protobuf-install\x86\cmake" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF ..
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
- name: build-x64
run: |
mkdir build-x64; cd build-x64
cmake -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -Dprotobuf_DIR="$env:GITHUB_WORKSPACE\protobuf-install\x64\cmake" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF ..
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
- name: build-arm
run: |
mkdir build-arm; cd build-arm
cmake -T v143,host=x64 -A arm -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF ..
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
- name: build-arm64
run: |
mkdir build-arm64; cd build-arm64
cmake -T v143,host=x64 -A arm64 -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF ..
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
- name: package
run: |
mkdir ${{ env.PACKAGENAME }}
mkdir ${{ env.PACKAGENAME }}/x86
mkdir ${{ env.PACKAGENAME }}/x64
mkdir ${{ env.PACKAGENAME }}/arm
mkdir ${{ env.PACKAGENAME }}/arm64
Copy-Item -Verbose -Recurse -Path "build-x86\install\*" -Destination "${{ env.PACKAGENAME }}\x86"
Copy-Item -Verbose -Recurse -Path "build-x64\install\*" -Destination "${{ env.PACKAGENAME }}\x64"
Copy-Item -Verbose -Recurse -Path "build-arm\install\*" -Destination "${{ env.PACKAGENAME }}\arm"
Copy-Item -Verbose -Recurse -Path "build-arm64\install\*" -Destination "${{ env.PACKAGENAME }}\arm64"
7z a -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
windows-vs2022-shared:
needs: [setup]
runs-on: windows-latest
env:
PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-windows-vs2022-shared
UseMultiToolTask: true
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: cache-protobuf
id: cache-protobuf
uses: actions/cache@v4
with:
path: "protobuf-install"
key: protobuf-vs2022-x86-x64-install
- name: protobuf
if: steps.cache-protobuf.outputs.cache-hit != 'true'
run: |
Invoke-WebRequest -Uri https://github.com/protocolbuffers/protobuf/archive/v3.11.2.zip -OutFile protobuf-3.11.2.zip
7z x ./protobuf-3.11.2.zip
cd protobuf-3.11.2
mkdir build-x86; cd build-x86;
cmake -T v143,host=x64 -A Win32 -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE\protobuf-install\x86" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
cd ..
mkdir build-x64; cd build-x64;
cmake -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE\protobuf-install\x64" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
- name: build-x86
run: |
mkdir build-x86; cd build-x86
cmake -T v143,host=x64 -A Win32 -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -Dprotobuf_DIR="$env:GITHUB_WORKSPACE\protobuf-install\x86\cmake" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
- name: build-x64
run: |
mkdir build-x64; cd build-x64
cmake -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -Dprotobuf_DIR="$env:GITHUB_WORKSPACE\protobuf-install\x64\cmake" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
- name: build-arm
run: |
mkdir build-arm; cd build-arm
cmake -T v143,host=x64 -A arm -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
- name: build-arm64
run: |
mkdir build-arm64; cd build-arm64
cmake -T v143,host=x64 -A arm64 -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
cmake --build . --config Release -j 4
cmake --build . --config Release --target install
- name: package
run: |
mkdir ${{ env.PACKAGENAME }}
mkdir ${{ env.PACKAGENAME }}/x86
mkdir ${{ env.PACKAGENAME }}/x64
mkdir ${{ env.PACKAGENAME }}/arm
mkdir ${{ env.PACKAGENAME }}/arm64
Copy-Item -Verbose -Recurse -Path "build-x86\install\*" -Destination "${{ env.PACKAGENAME }}\x86"
Copy-Item -Verbose -Recurse -Path "build-x64\install\*" -Destination "${{ env.PACKAGENAME }}\x64"
Copy-Item -Verbose -Recurse -Path "build-arm\install\*" -Destination "${{ env.PACKAGENAME }}\arm"
Copy-Item -Verbose -Recurse -Path "build-arm64\install\*" -Destination "${{ env.PACKAGENAME }}\arm64"
7z a -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
apple:
needs: [setup, macos, ios, ios-simulator, mac-catalyst, watchos, watchos-simulator, tvos, tvos-simulator, visionos, visionos-simulator]
runs-on: macos-13
env:
PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-apple
steps:
- run: sudo xcode-select --switch /Applications/Xcode_15.2.app
- name: download
uses: actions/download-artifact@v4
with:
path: artifacts
- name: create-xcframwork
run: |
mkdir -p ncnn-macos
mkdir -p ncnn-ios
mkdir -p ncnn-ios-simulator
mkdir -p ncnn-mac-catalyst
mkdir -p ncnn-watchos
mkdir -p ncnn-watchos-simulator
mkdir -p ncnn-tvos
mkdir -p ncnn-tvos-simulator
mkdir -p ncnn-visionos
mkdir -p ncnn-visionos-simulator
unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-macos/ncnn-${{ needs.setup.outputs.VERSION }}-macos.zip -d ncnn-macos
unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-ios/ncnn-${{ needs.setup.outputs.VERSION }}-ios.zip -d ncnn-ios
unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-ios-simulator/ncnn-${{ needs.setup.outputs.VERSION }}-ios-simulator.zip -d ncnn-ios-simulator
unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-mac-catalyst/ncnn-${{ needs.setup.outputs.VERSION }}-mac-catalyst.zip -d ncnn-mac-catalyst
unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-watchos/ncnn-${{ needs.setup.outputs.VERSION }}-watchos.zip -d ncnn-watchos
unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-watchos-simulator/ncnn-${{ needs.setup.outputs.VERSION }}-watchos-simulator.zip -d ncnn-watchos-simulator
unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-tvos/ncnn-${{ needs.setup.outputs.VERSION }}-tvos.zip -d ncnn-tvos
unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-tvos-simulator/ncnn-${{ needs.setup.outputs.VERSION }}-tvos-simulator.zip -d ncnn-tvos-simulator
unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-visionos/ncnn-${{ needs.setup.outputs.VERSION }}-visionos.zip -d ncnn-visionos
unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-visionos-simulator/ncnn-${{ needs.setup.outputs.VERSION }}-visionos-simulator.zip -d ncnn-visionos-simulator
xcodebuild -create-xcframework \
-framework ncnn-macos/openmp.framework \
-framework ncnn-ios/openmp.framework \
-framework ncnn-ios-simulator/openmp.framework \
-framework ncnn-mac-catalyst/openmp.framework \
-framework ncnn-watchos/openmp.framework \
-framework ncnn-watchos-simulator/openmp.framework \
-framework ncnn-tvos/openmp.framework \
-framework ncnn-tvos-simulator/openmp.framework \
-framework ncnn-visionos/openmp.framework \
-framework ncnn-visionos-simulator/openmp.framework \
-output openmp.xcframework
xcodebuild -create-xcframework \
-framework ncnn-macos/ncnn.framework \
-framework ncnn-ios/ncnn.framework \
-framework ncnn-ios-simulator/ncnn.framework \
-framework ncnn-mac-catalyst/ncnn.framework \
-framework ncnn-watchos/ncnn.framework \
-framework ncnn-watchos-simulator/ncnn.framework \
-framework ncnn-tvos/ncnn.framework \
-framework ncnn-tvos-simulator/ncnn.framework \
-framework ncnn-visionos/ncnn.framework \
-framework ncnn-visionos-simulator/ncnn.framework \
-output ncnn.xcframework
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.xcframework ncnn.xcframework
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
apple-gpu:
needs: [setup, macos-gpu, ios-gpu, ios-simulator-gpu, mac-catalyst-gpu, watchos, watchos-simulator, tvos-gpu, tvos-simulator-gpu, visionos, visionos-simulator]
runs-on: macos-13
env:
PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-apple-vulkan
steps:
- run: sudo xcode-select --switch /Applications/Xcode_15.2.app
- name: download
uses: actions/download-artifact@v4
with:
path: artifacts
- name: create-xcframwork
run: |
mkdir -p ncnn-macos-vulkan
mkdir -p ncnn-ios-vulkan
mkdir -p ncnn-ios-simulator-vulkan
mkdir -p ncnn-mac-catalyst-vulkan
mkdir -p ncnn-watchos
mkdir -p ncnn-watchos-simulator
mkdir -p ncnn-tvos-vulkan
mkdir -p ncnn-tvos-simulator-vulkan
mkdir -p ncnn-visionos
mkdir -p ncnn-visionos-simulator
unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-macos-vulkan/ncnn-${{ needs.setup.outputs.VERSION }}-macos-vulkan.zip -d ncnn-macos-vulkan
unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-ios-vulkan/ncnn-${{ needs.setup.outputs.VERSION }}-ios-vulkan.zip -d ncnn-ios-vulkan
unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-ios-simulator-vulkan/ncnn-${{ needs.setup.outputs.VERSION }}-ios-simulator-vulkan.zip -d ncnn-ios-simulator-vulkan
unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-mac-catalyst-vulkan/ncnn-${{ needs.setup.outputs.VERSION }}-mac-catalyst-vulkan.zip -d ncnn-mac-catalyst-vulkan
unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-watchos/ncnn-${{ needs.setup.outputs.VERSION }}-watchos.zip -d ncnn-watchos
unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-watchos-simulator/ncnn-${{ needs.setup.outputs.VERSION }}-watchos-simulator.zip -d ncnn-watchos-simulator
unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-tvos-vulkan/ncnn-${{ needs.setup.outputs.VERSION }}-tvos-vulkan.zip -d ncnn-tvos-vulkan
unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-tvos-simulator-vulkan/ncnn-${{ needs.setup.outputs.VERSION }}-tvos-simulator-vulkan.zip -d ncnn-tvos-simulator-vulkan
unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-visionos/ncnn-${{ needs.setup.outputs.VERSION }}-visionos.zip -d ncnn-visionos
unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-visionos-simulator/ncnn-${{ needs.setup.outputs.VERSION }}-visionos-simulator.zip -d ncnn-visionos-simulator
xcodebuild -create-xcframework \
-framework ncnn-macos-vulkan/openmp.framework \
-framework ncnn-ios-vulkan/openmp.framework \
-framework ncnn-ios-simulator-vulkan/openmp.framework \
-framework ncnn-mac-catalyst-vulkan/openmp.framework \
-framework ncnn-watchos/openmp.framework \
-framework ncnn-watchos-simulator/openmp.framework \
-framework ncnn-tvos-vulkan/openmp.framework \
-framework ncnn-tvos-simulator-vulkan/openmp.framework \
-framework ncnn-visionos/openmp.framework \
-framework ncnn-visionos-simulator/openmp.framework \
-output openmp.xcframework
xcodebuild -create-xcframework \
-framework ncnn-macos-vulkan/glslang.framework \
-framework ncnn-ios-vulkan/glslang.framework \
-framework ncnn-ios-simulator-vulkan/glslang.framework \
-framework ncnn-mac-catalyst-vulkan/glslang.framework \
-framework ncnn-tvos-vulkan/glslang.framework \
-framework ncnn-tvos-simulator-vulkan/glslang.framework \
-output glslang.xcframework
xcodebuild -create-xcframework \
-framework ncnn-macos-vulkan/ncnn.framework \
-framework ncnn-ios-vulkan/ncnn.framework \
-framework ncnn-ios-simulator-vulkan/ncnn.framework \
-framework ncnn-mac-catalyst-vulkan/ncnn.framework \
-framework ncnn-watchos/ncnn.framework \
-framework ncnn-watchos-simulator/ncnn.framework \
-framework ncnn-tvos-vulkan/ncnn.framework \
-framework ncnn-tvos-simulator-vulkan/ncnn.framework \
-framework ncnn-visionos/ncnn.framework \
-framework ncnn-visionos-simulator/ncnn.framework \
-output ncnn.xcframework
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.xcframework glslang.xcframework ncnn.xcframework
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
release:
permissions:
contents: write # for softprops/action-gh-release to create a release
needs: [setup, full-source, ubuntu-2004, ubuntu-2004-shared, ubuntu-2204, ubuntu-2204-shared, macos, macos-gpu, ios, ios-gpu, ios-simulator, ios-simulator-gpu, mac-catalyst, mac-catalyst-gpu, watchos, watchos-simulator, tvos, tvos-simulator, android, android-shared, android-gpu, android-gpu-shared, webassembly, windows-vs2015, windows-vs2015-shared, windows-vs2017, windows-vs2017-shared, windows-vs2019, windows-vs2019-shared, windows-vs2022, windows-vs2022-shared, apple, apple-gpu]
runs-on: ubuntu-latest
steps:
- name: download
uses: actions/download-artifact@v4
with:
path: artifacts
- name: create-release
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ needs.setup.outputs.VERSION }}
name: Release ${{ needs.setup.outputs.VERSION }}
files: artifacts/*/*.zip