From bc24b3dbf6fd95dc03172a61aae1a42e35656502 Mon Sep 17 00:00:00 2001 From: Quinton Miller Date: Mon, 19 May 2025 23:25:55 +0800 Subject: [PATCH 1/4] Drop the static LLVM libraries on Windows CI --- .github/workflows/win.yml | 61 +++++------------------- .github/workflows/win_build_portable.yml | 7 --- 2 files changed, 13 insertions(+), 55 deletions(-) diff --git a/.github/workflows/win.yml b/.github/workflows/win.yml index 5cf959e0894d..a4f7c3a951a9 100644 --- a/.github/workflows/win.yml +++ b/.github/workflows/win.yml @@ -11,6 +11,8 @@ concurrency: env: SPEC_SPLIT_DOTS: 160 CI_LLVM_VERSION: "19.1.7" + CI_LLVM_TARGETS: "X86,AArch64" + CI_LLVM_LDFLAGS: "psapi.lib shell32.lib ole32.lib uuid.lib advapi32.lib ws2_32.lib ntdll.lib" jobs: x86_64-windows-libs: @@ -181,29 +183,6 @@ jobs: if: steps.cache-openssl-dlls.outputs.cache-hit != 'true' run: .\etc\win-ci\build-openssl.ps1 -BuildTree deps\openssl -Version 3.4.1 -Dynamic - x86_64-windows-llvm-libs: - runs-on: windows-2022 - steps: - - name: Enable Developer Command Prompt - uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 - - - name: Cache LLVM - id: cache-llvm-libs - uses: actions/cache@v4 - with: - path: llvm - key: llvm-libs-${{ env.CI_LLVM_VERSION }}-msvc - - - name: Build LLVM - if: steps.cache-llvm-libs.outputs.cache-hit != 'true' - run: | - git clone --config core.autocrlf=false -b llvmorg-${{ env.CI_LLVM_VERSION }} --depth 1 https://github.com/llvm/llvm-project.git - mkdir llvm-build - cd llvm-build - cmake ..\llvm-project\llvm -Thost=x64 -DLLVM_TARGETS_TO_BUILD="X86;AArch64" -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DBUILD_SHARED_LIBS=OFF -DCMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH=OFF -DLLVM_INCLUDE_BENCHMARKS=OFF -DLLVM_INCLUDE_TESTS=OFF -DLLVM_ENABLE_ZSTD=OFF - cmake --build . --config Release - cmake "-DCMAKE_INSTALL_PREFIX=$(pwd)\..\llvm" -P cmake_install.cmake - x86_64-windows-llvm-dlls: runs-on: windows-2022 steps: @@ -228,10 +207,10 @@ jobs: key: llvm-dlls-${{ env.CI_LLVM_VERSION }}-${{ hashFiles('etc/win-ci/build-llvm.ps1') }}-msvc - name: Build LLVM if: steps.cache-llvm-dlls.outputs.cache-hit != 'true' - run: .\etc\win-ci\build-llvm.ps1 -BuildTree deps\llvm -Version ${{ env.CI_LLVM_VERSION }} -TargetsToBuild X86,AArch64 -Dynamic + run: .\etc\win-ci\build-llvm.ps1 -BuildTree deps\llvm -Version ${{ env.CI_LLVM_VERSION }} -TargetsToBuild ${{ env.CI_LLVM_TARGETS }} -Dynamic x86_64-windows-release: - needs: [x86_64-windows-libs, x86_64-windows-dlls, x86_64-windows-llvm-libs, x86_64-windows-llvm-dlls] + needs: [x86_64-windows-libs, x86_64-windows-dlls, x86_64-windows-llvm-dlls] uses: ./.github/workflows/win_build_portable.yml with: release: true @@ -257,18 +236,13 @@ jobs: name: crystal path: build - - name: Restore LLVM - uses: actions/cache/restore@v4 - with: - path: llvm - key: llvm-libs-${{ env.CI_LLVM_VERSION }}-msvc - fail-on-cache-miss: true - - name: Set up environment run: | Add-Content $env:GITHUB_PATH "$(pwd)\build" Add-Content $env:GITHUB_ENV "CRYSTAL_SPEC_COMPILER_BIN=$(pwd)\build\crystal.exe" - Add-Content $env:GITHUB_ENV "LLVM_CONFIG=$(pwd)\llvm\bin\llvm-config.exe" + Add-Content $env:GITHUB_ENV "LLVM_VERSION=${{ env.CI_LLVM_VERSION }}" + Add-Content $env:GITHUB_ENV "LLVM_TARGETS=${{ env.CI_LLVM_TARGETS }}" + Add-Content $env:GITHUB_ENV "LLVM_LDFLAGS=${{ env.CI_LLVM_LDFLAGS }}" - name: Run stdlib specs run: make -f Makefile.win std_spec @@ -302,17 +276,13 @@ jobs: name: crystal path: build - - name: Restore LLVM - uses: actions/cache/restore@v4 - with: - path: llvm - key: llvm-libs-${{ env.CI_LLVM_VERSION }}-msvc - fail-on-cache-miss: true - - name: Set up environment run: | Add-Content $env:GITHUB_PATH "$(pwd)\build" Add-Content $env:GITHUB_ENV "CRYSTAL_SPEC_COMPILER_BIN=$(pwd)\build\crystal.exe" + Add-Content $env:GITHUB_ENV "LLVM_VERSION=${{ env.CI_LLVM_VERSION }}" + Add-Content $env:GITHUB_ENV "LLVM_TARGETS=${{ env.CI_LLVM_TARGETS }}" + Add-Content $env:GITHUB_ENV "LLVM_LDFLAGS=${{ env.CI_LLVM_LDFLAGS }}" - name: Run stdlib specs with interpreter run: bin\crystal i spec\std_spec.cr @@ -338,17 +308,12 @@ jobs: name: crystal path: etc/win-ci/portable - - name: Restore LLVM - uses: actions/cache/restore@v4 - with: - path: llvm - key: llvm-libs-${{ env.CI_LLVM_VERSION }}-msvc - fail-on-cache-miss: true - - name: Set up environment run: | Add-Content $env:GITHUB_PATH "$(pwd)\etc\win-ci\portable" - Add-Content $env:GITHUB_ENV "LLVM_CONFIG=$(pwd)\llvm\bin\llvm-config.exe" + Add-Content $env:GITHUB_ENV "LLVM_VERSION=${{ env.CI_LLVM_VERSION }}" + Add-Content $env:GITHUB_ENV "LLVM_TARGETS=${{ env.CI_LLVM_TARGETS }}" + Add-Content $env:GITHUB_ENV "LLVM_LDFLAGS=${{ env.CI_LLVM_LDFLAGS }}" - name: Build docs run: make -f Makefile.win install_docs prefix=etc\win-ci\portable diff --git a/.github/workflows/win_build_portable.yml b/.github/workflows/win_build_portable.yml index b88bfed625dd..739378794f6b 100644 --- a/.github/workflows/win_build_portable.yml +++ b/.github/workflows/win_build_portable.yml @@ -90,12 +90,6 @@ jobs: dlls/libssl-3-x64.dll key: win-openssl-dlls-3.4.1-${{ hashFiles('etc/win-ci/build-openssl.ps1') }}-msvc fail-on-cache-miss: true - - name: Restore LLVM - uses: actions/cache/restore@v4 - with: - path: llvm - key: llvm-libs-${{ inputs.llvm_version }}-msvc - fail-on-cache-miss: true - name: Restore LLVM DLLs uses: actions/cache/restore@v4 with: @@ -109,7 +103,6 @@ jobs: - name: Set up environment run: | echo "CRYSTAL_LIBRARY_PATH=$(pwd)\libs" >> ${env:GITHUB_ENV} - echo "LLVM_CONFIG=$(pwd)\llvm\bin\llvm-config.exe" >> ${env:GITHUB_ENV} - name: Build LLVM extensions run: make -f Makefile.win deps From 5eff290487e745fcb03844a4dd2cf53b1befb34b Mon Sep 17 00:00:00 2001 From: Quinton Miller Date: Tue, 20 May 2025 00:16:05 +0800 Subject: [PATCH 2/4] missing args --- .github/workflows/win.yml | 2 ++ .github/workflows/win_build_portable.yml | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/win.yml b/.github/workflows/win.yml index a4f7c3a951a9..bfd93412127f 100644 --- a/.github/workflows/win.yml +++ b/.github/workflows/win.yml @@ -215,6 +215,8 @@ jobs: with: release: true llvm_version: "19.1.7" + llvm_targets: "X86,AArch64" + llvm_ldflags: "psapi.lib shell32.lib ole32.lib uuid.lib advapi32.lib ws2_32.lib ntdll.lib" x86_64-windows-test: runs-on: windows-2022 diff --git a/.github/workflows/win_build_portable.yml b/.github/workflows/win_build_portable.yml index 739378794f6b..b57c10d8b7e3 100644 --- a/.github/workflows/win_build_portable.yml +++ b/.github/workflows/win_build_portable.yml @@ -9,6 +9,12 @@ on: llvm_version: required: true type: string + llvm_targets: + required: true + type: string + llvm_ldflags: + required: true + type: string permissions: {} @@ -102,7 +108,10 @@ jobs: - name: Set up environment run: | - echo "CRYSTAL_LIBRARY_PATH=$(pwd)\libs" >> ${env:GITHUB_ENV} + Add-Content $env:GITHUB_ENV "CRYSTAL_LIBRARY_PATH=$(pwd)\libs" + Add-Content $env:GITHUB_ENV "LLVM_VERSION=${{ inputs.llvm_version }}" + Add-Content $env:GITHUB_ENV "LLVM_TARGETS=${{ inputs.llvm_targets }}" + Add-Content $env:GITHUB_ENV "LLVM_LDFLAGS=${{ inputs.llvm_ldflags }}" - name: Build LLVM extensions run: make -f Makefile.win deps From abd3d177a016557c22afd7ac0e05845d7a4a2f97 Mon Sep 17 00:00:00 2001 From: Quinton Miller Date: Tue, 20 May 2025 00:51:38 +0800 Subject: [PATCH 3/4] fixup --- .github/workflows/win.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/win.yml b/.github/workflows/win.yml index bfd93412127f..9b555833c77b 100644 --- a/.github/workflows/win.yml +++ b/.github/workflows/win.yml @@ -11,7 +11,7 @@ concurrency: env: SPEC_SPLIT_DOTS: 160 CI_LLVM_VERSION: "19.1.7" - CI_LLVM_TARGETS: "X86,AArch64" + CI_LLVM_TARGETS: "X86;AArch64" CI_LLVM_LDFLAGS: "psapi.lib shell32.lib ole32.lib uuid.lib advapi32.lib ws2_32.lib ntdll.lib" jobs: @@ -215,7 +215,7 @@ jobs: with: release: true llvm_version: "19.1.7" - llvm_targets: "X86,AArch64" + llvm_targets: "X86;AArch64" llvm_ldflags: "psapi.lib shell32.lib ole32.lib uuid.lib advapi32.lib ws2_32.lib ntdll.lib" x86_64-windows-test: From f2bc6828591af7a8448a86fe49244b74a3de200f Mon Sep 17 00:00:00 2001 From: Quinton Miller Date: Tue, 20 May 2025 00:55:06 +0800 Subject: [PATCH 4/4] more separators --- .github/workflows/win.yml | 4 ++-- src/llvm/lib_llvm.cr | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/win.yml b/.github/workflows/win.yml index 9b555833c77b..bfd93412127f 100644 --- a/.github/workflows/win.yml +++ b/.github/workflows/win.yml @@ -11,7 +11,7 @@ concurrency: env: SPEC_SPLIT_DOTS: 160 CI_LLVM_VERSION: "19.1.7" - CI_LLVM_TARGETS: "X86;AArch64" + CI_LLVM_TARGETS: "X86,AArch64" CI_LLVM_LDFLAGS: "psapi.lib shell32.lib ole32.lib uuid.lib advapi32.lib ws2_32.lib ntdll.lib" jobs: @@ -215,7 +215,7 @@ jobs: with: release: true llvm_version: "19.1.7" - llvm_targets: "X86;AArch64" + llvm_targets: "X86,AArch64" llvm_ldflags: "psapi.lib shell32.lib ole32.lib uuid.lib advapi32.lib ws2_32.lib ntdll.lib" x86_64-windows-test: diff --git a/src/llvm/lib_llvm.cr b/src/llvm/lib_llvm.cr index db82fae25b72..ece5a9740d48 100644 --- a/src/llvm/lib_llvm.cr +++ b/src/llvm/lib_llvm.cr @@ -50,7 +50,7 @@ {% end %} lib LibLLVM VERSION = {{ llvm_version.strip.gsub(/git/, "").gsub(/-?rc.*/, "") }} - BUILT_TARGETS = {{ llvm_targets.strip.downcase.split(' ').map(&.id.symbolize) }} + BUILT_TARGETS = {{ llvm_targets.strip.downcase.gsub(/;|,/, " ").split(' ').map(&.id.symbolize) }} end {% end %}