• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: CMake
2
3on: [push, pull_request]
4
5jobs:
6  CMakeVersionTest:
7    name: Test build with CMake 3.1.0
8    runs-on: ubuntu-20.04
9    steps:
10      - uses: actions/checkout@v3
11        with:
12          fetch-depth: 0
13      - name: Download models
14        run: ./autogen.sh
15      - name: Install CMake 3.1
16        run: |
17          curl -sL https://github.com/Kitware/CMake/releases/download/v3.1.0/cmake-3.1.0-Linux-x86_64.sh -o cmakeinstall.sh
18          chmod +x cmakeinstall.sh
19          sudo ./cmakeinstall.sh --prefix=/usr/local --exclude-subdir
20          rm cmakeinstall.sh
21          sudo apt-get install libidn11
22      - name: Create Work Dir
23        run: mkdir build
24      - name: Configure
25        working-directory: ./build
26        run: cmake .. -DOPUS_BUILD_PROGRAMS=ON -DBUILD_TESTING=ON
27      - name: Build
28        working-directory: ./build
29        run: make -j 2 -s
30      - name: Test
31        working-directory: ./build
32        run: ctest -j 2
33
34  CMakeMINGW:
35    name: CMake MINGW
36    runs-on: ubuntu-latest
37    steps:
38      - uses: actions/checkout@v3
39        with:
40          fetch-depth: 0
41      - name: Download models
42        run: ./autogen.sh
43      - name: Install MINGW
44        run: sudo apt-get install -y mingw-w64
45      - name: Create Work Dir
46        run: mkdir build
47      - name: Configure
48        working-directory: ./build
49        run: cmake .. -DOPUS_BUILD_PROGRAMS=ON -DBUILD_TESTING=ON -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc
50      - name: Build
51        working-directory: ./build
52        run: cmake --build . -j 2 --config Release --target package
53
54  CMakeBuild:
55    name: CMake/${{ matrix.config.name }}
56    runs-on: ${{ matrix.config.os }}
57    strategy:
58      fail-fast: false
59      matrix:
60        config:
61        - {
62            name: "Android/So/ARMv8/Release",
63            os: ubuntu-latest,
64            config: Release,
65            args: "-DCMAKE_TOOLCHAIN_FILE=${ANDROID_HOME}/ndk/25.2.9519653/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a -DBUILD_SHARED_LIBS=ON"
66          }
67        # TODO: Android ARMv7
68        # - {
69        #     name: "Android/So/ARMv7/Release",
70        #     os: ubuntu-latest,
71        #     config: Release,
72        #     args: "-DCMAKE_TOOLCHAIN_FILE=${ANDROID_HOME}/ndk/25.2.9519653/build/cmake/android.toolchain.cmake -DANDROID_ABI=armeabi-v7a -DBUILD_SHARED_LIBS=ON"
73        #   }
74        - {
75            name: "Android/So/X86/Release",
76            os: ubuntu-latest,
77            config: Release,
78            args: "-DCMAKE_TOOLCHAIN_FILE=${ANDROID_HOME}/ndk/25.2.9519653/build/cmake/android.toolchain.cmake -DANDROID_ABI=x86 -DBUILD_SHARED_LIBS=ON"
79          }
80        - {
81            name: "Android/So/X64/Release",
82            os: ubuntu-latest,
83            config: Release,
84            args: "-DCMAKE_TOOLCHAIN_FILE=${ANDROID_HOME}/ndk/25.2.9519653/build/cmake/android.toolchain.cmake -DANDROID_ABI=x86_64 -DBUILD_SHARED_LIBS=ON"
85          }
86        - {
87            name: "Windows/Dll/X86/Release",
88            os: windows-latest,
89            config: Release,
90            args: -G "Visual Studio 17 2022" -A Win32 -DBUILD_SHARED_LIBS=ON
91          }
92        - {
93            name: "Windows/Dll/X64/Release",
94            os: windows-latest,
95            config: Release,
96            args: -G "Visual Studio 17 2022" -A Win32 -DBUILD_SHARED_LIBS=ON
97          }
98        - {
99            name: "Windows/Dll/ARMv8/Release",
100            os: windows-latest,
101            config: Release,
102            args: -G "Visual Studio 17 2022" -A ARM64 -DBUILD_SHARED_LIBS=ON
103          }
104        - {
105            name: "Linux/So/X64/Release",
106            os: ubuntu-latest,
107            config: Release,
108            args: -DBUILD_SHARED_LIBS=ON
109          }
110        - {
111            name: "MacOSX/So/X64/Release",
112            os: macos-latest,
113            config: Release,
114            args: -DBUILD_SHARED_LIBS=ON
115          }
116        - {
117            name: "MacOSX/Framework/X64/Release",
118            os: macos-latest,
119            config: Release,
120            args: -DBUILD_FRAMEWORK=ON -DCMAKE_INSTALL_PREFIX=install
121          }
122          # use unix makefiles for iOS to avoid Xcode to complain about signing.
123        - {
124            name: "iOS/Dll/arm64/Release",
125            os: macos-latest,
126            config: Release,
127            args: -G "Unix Makefiles" -DBUILD_SHARED_LIBS=ON -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_ARCHITECTURES=arm64
128          }
129          # use unix makefiles for iOS to avoid Xcode to complain about signing.
130        - {
131            name: "iOS/Framework/arm64/Release",
132            os: macos-latest,
133            config: Release,
134            args: -G "Unix Makefiles" -DBUILD_FRAMEWORK=ON -DCMAKE_INSTALL_PREFIX=install -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_ARCHITECTURES=arm64
135          }
136        - {
137            name: "Windows/Lib/X86/Release",
138            os: windows-latest,
139            config: Release,
140            args: -G "Visual Studio 17 2022" -A Win32
141          }
142        - {
143            name: "Windows/Lib/X64/Release",
144            os: windows-latest,
145            config: Release,
146            args: -G "Visual Studio 17 2022" -A Win32
147          }
148        - {
149            name: "Windows/Lib/armv8/Release",
150            os: windows-latest,
151            config: Release,
152            args: -G "Visual Studio 17 2022" -A ARM64
153          }
154        - {
155            name: "Linux/Lib/X64/Release",
156            os: ubuntu-latest,
157            config: Release,
158            args: ""
159          }
160        - {
161            name: "MacOSX/Lib/X64/Release",
162            os: macos-latest,
163            config: Release,
164            args: ""
165          }
166          # use unix makefiles for iOS to avoid Xcode to complain about signing.
167        - {
168            name: "iOS/Lib/arm64/Release",
169            os: macos-latest,
170            config: Release,
171            args: -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_ARCHITECTURES=arm64
172          }
173        - {
174            name: "Android/Lib/ARMv8/Release",
175            os: ubuntu-latest,
176            config: Release,
177            args: "-DCMAKE_TOOLCHAIN_FILE=${ANDROID_HOME}/ndk/25.2.9519653/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a"
178          }
179        # TODO: Android ARMv7
180        # - {
181        #     name: "Android/Lib/ARMv7/Release",
182        #     os: ubuntu-latest,
183        #     config: Release,
184        #     args: "-DCMAKE_TOOLCHAIN_FILE=${ANDROID_HOME}/ndk/25.2.9519653/build/cmake/android.toolchain.cmake -DANDROID_ABI=armeabi-v7a"
185        #   }
186        - {
187            name: "Android/Lib/X86/Release",
188            os: ubuntu-latest,
189            config: Release,
190            args: "-DCMAKE_TOOLCHAIN_FILE=${ANDROID_HOME}/ndk/25.2.9519653/build/cmake/android.toolchain.cmake -DANDROID_ABI=x86"
191          }
192        - {
193            name: "Android/Lib/X64/Release",
194            os: ubuntu-latest,
195            config: Release,
196            args: "-DCMAKE_TOOLCHAIN_FILE=${ANDROID_HOME}/ndk/25.2.9519653/build/cmake/android.toolchain.cmake -DANDROID_ABI=x86_64"
197          }
198        - {
199            name: "CustomModes/Linux/Lib/X64/Release",
200            os: ubuntu-latest,
201            config: Release,
202            args: "-DOPUS_CUSTOM_MODES=ON"
203          }
204        - {
205            name: "AssertionsFuzz/Windows/Lib/X64/Release",
206            os: windows-latest,
207            config: Release,
208            args: -G "Visual Studio 17 2022" -A Win32 -DOPUS_ASSERTIONS=ON -DOPUS_FUZZING=ON
209          }
210        - {
211            name: "AssertionsFuzz/Linux/Lib/X64/Release",
212            os: ubuntu-latest,
213            config: Release,
214            args: -DOPUS_ASSERTIONS=ON -DOPUS_FUZZING=ON
215          }
216        - {
217            name: "AssertionsFuzz/MacOSX/Lib/X64/Release",
218            os: macos-latest,
219            config: Release,
220            args: -DOPUS_ASSERTIONS=ON -DOPUS_FUZZING=ON
221          }
222
223    steps:
224      - uses: actions/checkout@v3
225        with:
226          fetch-depth: 0
227      - name: Install AutoConf, AutoMake and LibTool # Needed for autogen.sh
228        if: matrix.config.os == 'macos-latest'
229        run: brew install autoconf automake libtool
230      - name: Download models Windows
231        if: contains(matrix.config.name, 'Windows')
232        run: .\autogen.bat
233      - name: Download models
234        if: contains(matrix.config.name, 'MacOSX') ||
235            contains(matrix.config.name, 'Linux') ||
236            contains(matrix.config.name, 'Android') ||
237            contains(matrix.config.name, 'iOS')
238        run: ./autogen.sh
239      - name: Create Work Dir
240        run: mkdir build
241      - name: Configure
242        working-directory: ./build
243        run: cmake .. ${{ matrix.config.args }} -DCMAKE_BUILD_TYPE=${{ matrix.config.config }} -DOPUS_BUILD_PROGRAMS=ON -DBUILD_TESTING=ON
244      - name: Build
245        working-directory: ./build
246        run: cmake --build . -j 2 --config ${{ matrix.config.config }} --target package
247      - name: Test
248        if: contains(matrix.config.name, 'Windows') && !contains(matrix.config.name, 'ARM') && !contains(matrix.config.name, 'Dll') ||
249            contains(matrix.config.name, 'MacOSX') && !contains(matrix.config.name, 'ARM') && !contains(matrix.config.name, 'Dll') ||
250            contains(matrix.config.name, 'Linux') && !contains(matrix.config.name, 'ARM') && !contains(matrix.config.name, 'Dll')
251        working-directory: ./build
252        run: ctest -j 2 -C ${{ matrix.config.config }} --output-on-failure
253