Instead of linking binary blobs, build everything ourselves.
Unified · Split
| @@ -13,28 +13,60 @@ if (-not (Test-Path "$subprojects/packagefiles/ffmpeg")) { · 12 unmodified lines | |||
| 13 | Invoke-WebRequest -Uri "https://github.com/FFmpeg/FFmpeg/commit/e06ce6d2b45edac4a2df04f304e18d4727417d24.patch" ` | 13 | Invoke-WebRequest -Uri "https://github.com/FFmpeg/FFmpeg/commit/e06ce6d2b45edac4a2df04f304e18d4727417d24.patch" ` |
| 14 | -OutFile "$subprojects/packagefiles/ffmpeg/e06ce6d2b45edac4a2df04f304e18d4727417d24.patch" | 14 | -OutFile "$subprojects/packagefiles/ffmpeg/e06ce6d2b45edac4a2df04f304e18d4727417d24.patch" |
| 15 | 15 | ||
| 16 | # Download pre-built shaderc, it is quite big to build each time | 16 | # Wrap shaderc to run git-sync-deps and patch unsupported generator expression |
| 17 | # For download link see https://github.com/google/shaderc/blob/main/downloads.md | 17 | if (-not (Test-Path "$subprojects/shaderc_cmake")) { |
| 18 | $url = "https://storage.googleapis.com/shaderc/badges/build_link_windows_vs2019_release.html" | 18 | git clone https://github.com/google/shaderc --depth 1 $subprojects/shaderc_cmake |
| 19 | $shaderc = "shaderc.zip" | 19 | Set-Content -Path "$subprojects/shaderc_cmake/p.diff" -Value @' |
| 20 | $resp = Invoke-WebRequest -Uri $url | 20 | diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt |
| 21 | if ($resp.Content -match '<meta http-equiv="refresh" content="\d+; url=(?<url>[^"]+)"') { | 21 | index d44f62a..54d4719 100644 |
| 22 | $url = $matches['url'] | 22 | --- a/third_party/CMakeLists.txt |
| 23 | +++ b/third_party/CMakeLists.txt | ||
| 24 | @@ -87,7 +87,11 @@ if (NOT TARGET glslang) | ||
| 25 | # Glslang tests are off by default. Turn them on if testing Shaderc. | ||
| 26 | set(GLSLANG_TESTS ON) | ||
| 27 | endif() | ||
| 28 | - set(GLSLANG_ENABLE_INSTALL $<NOT:${SKIP_GLSLANG_INSTALL}>) | ||
| 29 | + if (SKIP_GLSLANG_INSTALL) | ||
| 30 | + set(GLSLANG_ENABLE_INSTALL OFF) | ||
| 31 | + else() | ||
| 32 | + set(GLSLANG_ENABLE_INSTALL ON) | ||
| 33 | + endif() | ||
| 34 | add_subdirectory(${SHADERC_GLSLANG_DIR} glslang) | ||
| 35 | endif() | ||
| 36 | if (NOT TARGET glslang) | ||
| 37 | '@ | ||
| 38 | git -C $subprojects/shaderc_cmake apply --ignore-whitespace p.diff | ||
| 23 | } | 39 | } |
| 24 | Invoke-WebRequest -Uri $url -OutFile $shaderc | 40 | if (-not (Test-Path "$subprojects/shaderc")) { |
| 25 | if (Test-Path "$subprojects/shaderc") { | 41 | New-Item -Path "$subprojects/shaderc" -ItemType Directory | Out-Null |
| 26 | Remove-Item -LiteralPath "$subprojects/shaderc" -Force -Recurse | ||
| 27 | } | 42 | } |
| 28 | Expand-Archive -Path $shaderc -DestinationPath "$subprojects/shaderc" | ||
| 29 | Move-Item -Path "$subprojects/shaderc/install/*" -Destination "$subprojects/shaderc" | ||
| 30 | |||
| 31 | Set-Content -Path "$subprojects/shaderc/meson.build" -Value @" | 43 | Set-Content -Path "$subprojects/shaderc/meson.build" -Value @" |
| 32 | project('shaderc', 'c', version: '2024.1') | 44 | project('shaderc', 'cpp', version: '2024.1') |
| 33 | cc = meson.get_compiler('c') | 45 | |
| 34 | shaderc_dep = declare_dependency( | 46 | python = find_program('python3') |
| 35 | dependencies: cc.find_library('shaderc_combined', dirs: meson.current_source_dir() / 'lib'), | 47 | run_command(python, '../shaderc_cmake/utils/git-sync-deps', check: true) |
| 36 | include_directories: include_directories('include') | 48 | |
| 37 | ) | 49 | cmake = import('cmake') |
| 50 | opts = cmake.subproject_options() | ||
| 51 | opts.add_cmake_defines({ | ||
| 52 | 'CMAKE_MSVC_RUNTIME_LIBRARY': 'MultiThreaded', | ||
| 53 | 'CMAKE_POLICY_DEFAULT_CMP0091': 'NEW', | ||
| 54 | 'SHADERC_SKIP_INSTALL': 'ON', | ||
| 55 | 'SHADERC_SKIP_TESTS': 'ON', | ||
| 56 | 'SHADERC_SKIP_EXAMPLES': 'ON', | ||
| 57 | 'SHADERC_SKIP_COPYRIGHT_CHECK': 'ON' | ||
| 58 | }) | ||
| 59 | shaderc_proj = cmake.subproject('shaderc_cmake', options: opts) | ||
| 60 | shaderc_dep = declare_dependency(dependencies: [ | ||
| 61 | shaderc_proj.dependency('shaderc'), | ||
| 62 | shaderc_proj.dependency('shaderc_util'), | ||
| 63 | shaderc_proj.dependency('SPIRV'), | ||
| 64 | shaderc_proj.dependency('SPIRV-Tools-static'), | ||
| 65 | shaderc_proj.dependency('SPIRV-Tools-opt'), | ||
| 66 | shaderc_proj.dependency('glslang'), | ||
| 67 | shaderc_proj.dependency('GenericCodeGen'), | ||
| 68 | shaderc_proj.dependency('MachineIndependent'), | ||
| 69 | ]) | ||
| 38 | meson.override_dependency('shaderc', shaderc_dep) | 70 | meson.override_dependency('shaderc', shaderc_dep) |
| 39 | "@ | 71 | "@ |
| 40 | 72 | ||