|
1 | 1 | name: CMake CI |
2 | 2 |
|
| 3 | +# Optimized workflow for faster builds |
| 4 | +# Optimizations include: |
| 5 | +# 1. Improved caching strategy with more specific cache keys |
| 6 | +# 2. Optimized ccache/sccache configuration for better performance |
| 7 | +# 3. Minimal Vulkan SDK installation (only necessary components) |
| 8 | +# 4. Parallel builds for all platforms |
| 9 | +# 5. Dynamic chapter detection from CMakeLists.txt for future extensibility |
| 10 | +# 6. Eliminated unnecessary clean steps between builds |
| 11 | +# 7. Optimized build configuration for better performance |
| 12 | +# 8. Linux: Using ccache with clang for faster builds |
| 13 | +# 9. Windows: Using MSVC for better performance and compatibility |
| 14 | + |
3 | 15 | on: |
4 | 16 | push: |
5 | 17 | branches: [ main ] |
@@ -187,7 +199,7 @@ jobs: |
187 | 199 | if: runner.os == 'Linux' |
188 | 200 | run: | |
189 | 201 | sudo apt-get update |
190 | | - sudo apt-get install -y ccache |
| 202 | + sudo apt-get install -y ccache clang clang-18 |
191 | 203 |
|
192 | 204 | # Configure ccache for optimal performance |
193 | 205 | ccache --max-size=4G |
@@ -274,35 +286,25 @@ jobs: |
274 | 286 | with: |
275 | 287 | path: | |
276 | 288 | ${{github.workspace}}/attachments/build |
277 | | - ${{github.workspace}}/attachments/build/.ninja_deps |
278 | | - ${{github.workspace}}/attachments/build/.ninja_log |
279 | | - key: ${{ runner.os }}-build-ninja-${{ hashFiles('**/CMakeLists.txt', 'scripts/install_dependencies_windows.bat') }}-${{ hashFiles('**/*.cpp', '**/*.h', '**/*.hpp') }} |
| 289 | + key: ${{ runner.os }}-build-msvc-${{ hashFiles('**/CMakeLists.txt', 'scripts/install_dependencies_windows.bat') }}-${{ hashFiles('**/*.cpp', '**/*.h', '**/*.hpp') }} |
280 | 290 | restore-keys: | |
281 | | - ${{ runner.os }}-build-ninja-${{ hashFiles('**/CMakeLists.txt', 'scripts/install_dependencies_windows.bat') }}- |
282 | | - ${{ runner.os }}-build-ninja-${{ hashFiles('**/CMakeLists.txt') }}- |
283 | | - ${{ runner.os }}-build-ninja- |
| 291 | + ${{ runner.os }}-build-msvc-${{ hashFiles('**/CMakeLists.txt', 'scripts/install_dependencies_windows.bat') }}- |
| 292 | + ${{ runner.os }}-build-msvc-${{ hashFiles('**/CMakeLists.txt') }}- |
| 293 | + ${{ runner.os }}-build-msvc- |
284 | 294 |
|
285 | | - - name: Install Ninja (Windows) |
286 | | - if: runner.os == 'Windows' |
287 | | - run: | |
288 | | - # Install Ninja build system for faster builds |
289 | | - choco install ninja -y |
290 | | - # Verify installation |
291 | | - ninja --version |
292 | | -
|
293 | | - - name: Configure CMake with Ninja (Windows) |
| 295 | + - name: Configure CMake with MSVC (Windows) |
294 | 296 | working-directory: ${{github.workspace}}/attachments |
295 | 297 | if: runner.os == 'Windows' |
296 | 298 | run: | |
297 | | - # Configure CMake with Ninja generator for faster builds |
298 | | - cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release ` |
| 299 | + # Configure CMake with MSVC generator for faster builds |
| 300 | + cmake -B build -DCMAKE_BUILD_TYPE=Release ` |
299 | 301 | -DVulkan_INCLUDE_DIR="$env:Vulkan_INCLUDE_DIR" ` |
300 | 302 | -DVulkan_LIBRARY="$env:Vulkan_LIBRARY" ` |
301 | 303 | -DCMAKE_PREFIX_PATH="$env:VULKAN_SDK" ` |
302 | 304 | -DCMAKE_TOOLCHAIN_FILE="$env:CMAKE_TOOLCHAIN_FILE" ` |
303 | 305 | -DCMAKE_C_COMPILER_LAUNCHER=sccache ` |
304 | 306 | -DCMAKE_CXX_COMPILER_LAUNCHER=sccache ` |
305 | | - -DCMAKE_CXX_FLAGS="/MP /EHsc /Zi /W3" ` |
| 307 | + -DCMAKE_CXX_FLAGS="/MP /EHsc /Zi /W3 /O2" ` |
306 | 308 | -DCMAKE_SHARED_LINKER_FLAGS="/DEBUG:FASTLINK" ` |
307 | 309 | -DCMAKE_EXE_LINKER_FLAGS="/DEBUG:FASTLINK" |
308 | 310 |
|
@@ -526,6 +528,11 @@ jobs: |
526 | 528 | echo "org.gradle.parallel=true" >> gradle.properties |
527 | 529 | echo "org.gradle.caching=true" >> gradle.properties |
528 | 530 | echo "org.gradle.configureondemand=true" >> gradle.properties |
| 531 | +
|
| 532 | + # Enable AndroidX support (required for androidx.appcompat and other AndroidX dependencies) |
| 533 | + echo "android.useAndroidX=true" >> gradle.properties |
| 534 | + echo "android.enableJetifier=false" >> gradle.properties |
| 535 | +
|
529 | 536 | echo "kotlin.incremental=true" >> gradle.properties |
530 | 537 |
|
531 | 538 | # Create directory for build outputs |
|
0 commit comments