History

ci/win32: build shaderc

Instead of linking binary blobs, build everything ourselves.

Kacper Michajłow committed 2 years ago

Commit 2b4c64e1 parent 85db6a91 file · +51 −19Browse files

Unified · Split

ci/build-win32.ps1+51−19
@@ -13,28 +13,60 @@ if (-not (Test-Path "$subprojects/packagefiles/ffmpeg")) { · 12 unmodified lines
13Invoke-WebRequest -Uri "https://github.com/FFmpeg/FFmpeg/commit/e06ce6d2b45edac4a2df04f304e18d4727417d24.patch" `13Invoke-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 time16# 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.md17if (-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 $url20diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt
21if ($resp.Content -match '<meta http-equiv="refresh" content="\d+; url=(?<url>[^"]+)"') {21index 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}
24Invoke-WebRequest -Uri $url -OutFile $shaderc40if (-not (Test-Path "$subprojects/shaderc")) {
25if (Test-Path "$subprojects/shaderc") {41 New-Item -Path "$subprojects/shaderc" -ItemType Directory | Out-Null
26 Remove-Item -LiteralPath "$subprojects/shaderc" -Force -Recurse
27}42}
28Expand-Archive -Path $shaderc -DestinationPath "$subprojects/shaderc"
29Move-Item -Path "$subprojects/shaderc/install/*" -Destination "$subprojects/shaderc"
30
31Set-Content -Path "$subprojects/shaderc/meson.build" -Value @"43Set-Content -Path "$subprojects/shaderc/meson.build" -Value @"
32project('shaderc', 'c', version: '2024.1')44project('shaderc', 'cpp', version: '2024.1')
33cc = meson.get_compiler('c')45
34shaderc_dep = declare_dependency(46python = find_program('python3')
35 dependencies: cc.find_library('shaderc_combined', dirs: meson.current_source_dir() / 'lib'),47run_command(python, '../shaderc_cmake/utils/git-sync-deps', check: true)
36 include_directories: include_directories('include')48
37)49cmake = import('cmake')
50opts = cmake.subproject_options()
51opts.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})
59shaderc_proj = cmake.subproject('shaderc_cmake', options: opts)
60shaderc_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])
38meson.override_dependency('shaderc', shaderc_dep)70meson.override_dependency('shaderc', shaderc_dep)
39"@71"@
40 72

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t