-
Notifications
You must be signed in to change notification settings - Fork 4.2k
170 lines (160 loc) · 7.21 KB
/
watchos.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
name: watchos
on:
push:
branches: [master]
paths:
- '.github/workflows/watchos.yml'
- 'toolchains/ios.toolchain.cmake'
- 'CMakeLists.txt'
- 'cmake/**'
- 'src/*'
- 'src/layer/*'
- 'src/layer/arm/**'
- 'src/layer/x86/**'
pull_request:
branches: [master]
paths:
- '.github/workflows/watchos.yml'
- 'toolchains/ios.toolchain.cmake'
- 'CMakeLists.txt'
- 'cmake/**'
- 'src/*'
- 'src/layer/*'
- 'src/layer/arm/**'
- 'src/layer/x86/**'
concurrency:
group: watchos-${{ github.ref }}
cancel-in-progress: true
env:
DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer
WATCHOS_DEPLOYMENT_TARGET: '6.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=$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 \
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" \
steps:
- uses: actions/checkout@v4
- name: cache-openmp
id: cache-openmp
uses: actions/cache@v4
with:
path: openmp-install
key: openmp-watchos-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-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
- name: openmp-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
- 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_WATCHOS -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_WATCHOS -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/watchos
mkdir -p $GITHUB_WORKSPACE/openmp-install/watchos-simulator
cp -a openmp-${{ env.OPENMP_VERSION }}.src/build-arm64_32/install/include $GITHUB_WORKSPACE/openmp-install/watchos
mkdir -p $GITHUB_WORKSPACE/openmp-install/watchos/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/watchos/lib/libomp.a
cp -a openmp-${{ env.OPENMP_VERSION }}.src/build-simulator-x86_64/install/include $GITHUB_WORKSPACE/openmp-install/watchos-simulator
mkdir -p $GITHUB_WORKSPACE/openmp-install/watchos-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/watchos-simulator/lib/libomp.a
- name: install-openmp
run: |
sudo cp $GITHUB_WORKSPACE/openmp-install/watchos/include/* $DEVELOPER_DIR/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/usr/include
sudo cp $GITHUB_WORKSPACE/openmp-install/watchos/lib/libomp.a $DEVELOPER_DIR/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/usr/lib
sudo cp $GITHUB_WORKSPACE/openmp-install/watchos-simulator/include/* $DEVELOPER_DIR/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/usr/include
sudo cp $GITHUB_WORKSPACE/openmp-install/watchos-simulator/lib/libomp.a $DEVELOPER_DIR/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/usr/lib
- name: armv7k
run: |
mkdir build-armv7k && cd build-armv7k
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=WATCHOS -DARCHS="armv7k" ..
cmake --build . -j 4
- name: 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
- name: simulator-x86_64
run: |
mkdir build-simulator-x86_64 && cd build-simulator-x86_64
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_WATCHOS -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_WATCHOS -DARCHS="arm64" ..
cmake --build . -j 4