Skip to content

Commit

Permalink
update ios toolchain, add visionos ci, update watchos, ncnn target il…
Browse files Browse the repository at this point in the history
…p32 (#5399)
  • Loading branch information
nihui authored Apr 3, 2024
1 parent 824b79a commit fafb897
Show file tree
Hide file tree
Showing 10 changed files with 529 additions and 188 deletions.
73 changes: 0 additions & 73 deletions .github/workflows/tvos-cpu.yml

This file was deleted.

153 changes: 153 additions & 0 deletions .github/workflows/tvos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
name: tvos
on:
push:
branches: [master]
paths:
- '.github/workflows/tvos.yml'
- 'toolchains/ios.toolchain.cmake'
- 'CMakeLists.txt'
- 'cmake/**'
- 'src/*'
- 'src/layer/*'
- 'src/layer/arm/**'
- 'src/layer/x86/**'
pull_request:
branches: [master]
paths:
- '.github/workflows/tvos.yml'
- 'toolchains/ios.toolchain.cmake'
- 'CMakeLists.txt'
- 'cmake/**'
- 'src/*'
- 'src/layer/*'
- 'src/layer/arm/**'
- 'src/layer/x86/**'
concurrency:
group: tvos-${{ github.ref }}
cancel-in-progress: true
env:
DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer
TVOS_DEPLOYMENT_TARGET: '9.0'
ENABLE_BITCODE: OFF
ENABLE_ARC: OFF
ENABLE_VISIBILITY: OFF
permissions:
contents: read

jobs:
build:
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 \
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" \
steps:
- uses: actions/checkout@v4

- name: cache-openmp
id: cache-openmp
uses: actions/cache@v4
with:
path: openmp-install
key: openmp-tvos-install-20240402
- 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: openmp-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
- name: openmp-simulator-x86_64
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
cd openmp-${{ env.OPENMP_VERSION }}.src
mkdir -p build-simulator-x86_64 && cd build-simulator-x86_64
cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_TVOS -DARCHS="x86_64" ..
cmake --build . -j 4
cmake --build . --target install
- name: openmp-simulator-arm64
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
cd openmp-${{ env.OPENMP_VERSION }}.src
mkdir -p build-simulator-arm64 && cd build-simulator-arm64
cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_TVOS -DARCHS="arm64" ..
cmake --build . -j 4
cmake --build . --target install
- name: openmp-merge-fat-library
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
mkdir -p $GITHUB_WORKSPACE/openmp-install
mkdir -p $GITHUB_WORKSPACE/openmp-install/tvos
mkdir -p $GITHUB_WORKSPACE/openmp-install/tvos-simulator
cp -a openmp-${{ env.OPENMP_VERSION }}.src/build-arm64/install/include $GITHUB_WORKSPACE/openmp-install/tvos
mkdir -p $GITHUB_WORKSPACE/openmp-install/tvos/lib
cp openmp-${{ env.OPENMP_VERSION }}.src/build-arm64/install/lib/libomp.a $GITHUB_WORKSPACE/openmp-install/tvos/lib/libomp.a
cp -a openmp-${{ env.OPENMP_VERSION }}.src/build-simulator-x86_64/install/include $GITHUB_WORKSPACE/openmp-install/tvos-simulator
mkdir -p $GITHUB_WORKSPACE/openmp-install/tvos-simulator/lib
lipo -create \
openmp-${{ env.OPENMP_VERSION }}.src/build-simulator-x86_64/install/lib/libomp.a \
openmp-${{ env.OPENMP_VERSION }}.src/build-simulator-arm64/install/lib/libomp.a \
-o $GITHUB_WORKSPACE/openmp-install/tvos-simulator/lib/libomp.a
- name: install-openmp
run: |
sudo cp $GITHUB_WORKSPACE/openmp-install/tvos/include/* $DEVELOPER_DIR/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/usr/include
sudo cp $GITHUB_WORKSPACE/openmp-install/tvos/lib/libomp.a $DEVELOPER_DIR/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/usr/lib
sudo cp $GITHUB_WORKSPACE/openmp-install/tvos-simulator/include/* $DEVELOPER_DIR/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/usr/include
sudo cp $GITHUB_WORKSPACE/openmp-install/tvos-simulator/lib/libomp.a $DEVELOPER_DIR/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/usr/lib
- name: arm64
run: |
mkdir build-arm64 && cd build-arm64
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=TVOS -DARCHS="arm64" ..
cmake --build . -j 4
- name: simulator-x86_64
run: |
mkdir build-simulator-x86_64 && cd build-simulator-x86_64
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_TVOS -DARCHS="x86_64" ..
cmake --build . -j 4
- name: simulator-arm64
run: |
mkdir build-simulator-arm64 && cd build-simulator-arm64
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=SIMULATORARM64_TVOS -DARCHS="arm64" ..
cmake --build . -j 4
153 changes: 153 additions & 0 deletions .github/workflows/visionos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
name: visionos
on:
push:
branches: [master]
paths:
- '.github/workflows/visionos.yml'
- 'toolchains/ios.toolchain.cmake'
- 'CMakeLists.txt'
- 'cmake/**'
- 'src/*'
- 'src/layer/*'
- 'src/layer/arm/**'
- 'src/layer/x86/**'
pull_request:
branches: [master]
paths:
- '.github/workflows/visionos.yml'
- 'toolchains/ios.toolchain.cmake'
- 'CMakeLists.txt'
- 'cmake/**'
- 'src/*'
- 'src/layer/*'
- 'src/layer/arm/**'
- 'src/layer/x86/**'
concurrency:
group: visionos-${{ github.ref }}
cancel-in-progress: true
env:
DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer
VISIONOS_DEPLOYMENT_TARGET: '1.0'
ENABLE_BITCODE: OFF
ENABLE_ARC: OFF
ENABLE_VISIBILITY: OFF
permissions:
contents: read

jobs:
build:
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 \
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" \
steps:
- uses: actions/checkout@v4

- name: cache-openmp
id: cache-openmp
uses: actions/cache@v4
with:
path: openmp-install
key: openmp-visionos-install-20240402
- 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: openmp-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
- name: openmp-simulator-x86_64
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
cd openmp-${{ env.OPENMP_VERSION }}.src
mkdir -p build-simulator-x86_64 && cd build-simulator-x86_64
cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_VISIONOS -DARCHS="x86_64" ..
cmake --build . -j 4
cmake --build . --target install
- name: openmp-simulator-arm64
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
cd openmp-${{ env.OPENMP_VERSION }}.src
mkdir -p build-simulator-arm64 && cd build-simulator-arm64
cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_VISIONOS -DARCHS="arm64" ..
cmake --build . -j 4
cmake --build . --target install
- name: openmp-merge-fat-library
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
mkdir -p $GITHUB_WORKSPACE/openmp-install
mkdir -p $GITHUB_WORKSPACE/openmp-install/visionos
mkdir -p $GITHUB_WORKSPACE/openmp-install/visionos-simulator
cp -a openmp-${{ env.OPENMP_VERSION }}.src/build-arm64/install/include $GITHUB_WORKSPACE/openmp-install/visionos
mkdir -p $GITHUB_WORKSPACE/openmp-install/visionos/lib
cp openmp-${{ env.OPENMP_VERSION }}.src/build-arm64/install/lib/libomp.a $GITHUB_WORKSPACE/openmp-install/visionos/lib/libomp.a
cp -a openmp-${{ env.OPENMP_VERSION }}.src/build-simulator-x86_64/install/include $GITHUB_WORKSPACE/openmp-install/visionos-simulator
mkdir -p $GITHUB_WORKSPACE/openmp-install/visionos-simulator/lib
lipo -create \
openmp-${{ env.OPENMP_VERSION }}.src/build-simulator-x86_64/install/lib/libomp.a \
openmp-${{ env.OPENMP_VERSION }}.src/build-simulator-arm64/install/lib/libomp.a \
-o $GITHUB_WORKSPACE/openmp-install/visionos-simulator/lib/libomp.a
- name: install-openmp
run: |
sudo cp $GITHUB_WORKSPACE/openmp-install/visionos/include/* $DEVELOPER_DIR/Platforms/XROS.platform/Developer/SDKs/XROS.sdk/usr/include
sudo cp $GITHUB_WORKSPACE/openmp-install/visionos/lib/libomp.a $DEVELOPER_DIR/Platforms/XROS.platform/Developer/SDKs/XROS.sdk/usr/lib
sudo cp $GITHUB_WORKSPACE/openmp-install/visionos-simulator/include/* $DEVELOPER_DIR/Platforms/XRSimulator.platform/Developer/SDKs/XRSimulator.sdk/usr/include
sudo cp $GITHUB_WORKSPACE/openmp-install/visionos-simulator/lib/libomp.a $DEVELOPER_DIR/Platforms/XRSimulator.platform/Developer/SDKs/XRSimulator.sdk/usr/lib
- name: arm64
run: |
mkdir build-arm64 && cd build-arm64
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=VISIONOS -DARCHS="arm64" ..
cmake --build . -j 4
- name: simulator-x86_64
run: |
mkdir build-simulator-x86_64 && cd build-simulator-x86_64
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_VISIONOS -DARCHS="x86_64" ..
cmake --build . -j 4
- name: simulator-arm64
run: |
mkdir build-simulator-arm64 && cd build-simulator-arm64
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_VISIONOS -DARCHS="arm64" ..
cmake --build . -j 4
Loading

0 comments on commit fafb897

Please sign in to comment.