diff --git a/.ci/deploy-llvm.sh b/.ci/deploy-llvm.sh new file mode 100644 index 0000000000..35e5d780af --- /dev/null +++ b/.ci/deploy-llvm.sh @@ -0,0 +1,20 @@ +#!/bin/sh -ex + +# First let's print some info about our caches +"$(cygpath -u "$CCACHE_BIN_DIR")"/ccache.exe --show-stats -v + +# BUILD_blablabla is Azure specific, so we wrap it for portability +ARTIFACT_DIR="$BUILD_ARTIFACTSTAGINGDIRECTORY" +BUILD="llvmlibs_mt.7z" + +# Package artifacts +7z a -m0=LZMA2 -mx9 "$BUILD" ./build/lib/Release-x64/llvm_build + +# Generate sha256 hashes +# Write to file for GitHub releases +sha256sum "$BUILD" | awk '{ print $1 }' | tee "$BUILD.sha256" +echo "$(cat "$BUILD.sha256");$(stat -c %s "$BUILD")B" > GitHubReleaseMessage.txt + +# Move files to publishing directory +cp -- "$BUILD" "$ARTIFACT_DIR" +cp -- "$BUILD.sha256" "$ARTIFACT_DIR" diff --git a/.ci/deploy-windows.sh b/.ci/deploy-windows.sh index bb1212f586..8ffaf578cf 100755 --- a/.ci/deploy-windows.sh +++ b/.ci/deploy-windows.sh @@ -1,6 +1,6 @@ #!/bin/sh -ex -# First let's see print some info about our caches +# First let's print some info about our caches "$(cygpath -u "$CCACHE_BIN_DIR")"/ccache.exe --show-stats -v # BUILD_blablabla is Azure specific, so we wrap it for portability diff --git a/.ci/setup-llvm.sh b/.ci/setup-llvm.sh new file mode 100644 index 0000000000..a54901309e --- /dev/null +++ b/.ci/setup-llvm.sh @@ -0,0 +1,63 @@ +#!/bin/sh -ex + +# Resource/dependency URLs +CCACHE_URL="https://github.com/ccache/ccache/releases/download/v4.11.2/ccache-4.11.2-windows-x86_64.zip" + +DEP_URLS=" \ + $CCACHE_URL" + +# CI doesn't make a cache dir if it doesn't exist, so we do it manually +[ -d "$DEPS_CACHE_DIR" ] || mkdir "$DEPS_CACHE_DIR" + +# Pull the llvm submodule +# shellcheck disable=SC2046 +git submodule -q update --init --depth=1 -- 3rdparty/llvm + +# Git bash doesn't have rev, so here it is +rev() +{ + echo "$1" | awk '{ for(i = length($0); i != 0; --i) { a = a substr($0, i, 1); } } END { print a }' +} + +# Usage: download_and_verify url checksum algo file +# Check to see if a file is already cached, and the checksum matches. If not, download it. +# Tries up to 3 times +download_and_verify() +{ + url="$1" + correctChecksum="$2" + algo="$3" + fileName="$4" + + for _ in 1 2 3; do + [ -e "$DEPS_CACHE_DIR/$fileName" ] || curl -fLo "$DEPS_CACHE_DIR/$fileName" "$url" + fileChecksum=$("${algo}sum" "$DEPS_CACHE_DIR/$fileName" | awk '{ print $1 }') + [ "$fileChecksum" = "$correctChecksum" ] && return 0 + done + + return 1; +} + +# Some dependencies install here +[ -d "./build/lib_ext/Release-x64" ] || mkdir -p "./build/lib_ext/Release-x64" + +for url in $DEP_URLS; do + # Get the filename from the URL and remove query strings (?arg=something). + fileName="$(rev "$(rev "$url" | cut -d'/' -f1)" | cut -d'?' -f1)" + [ -z "$fileName" ] && echo "Unable to parse url: $url" && exit 1 + + # shellcheck disable=SC1003 + case "$url" in + *ccache*) checksum=$CCACHE_SHA; algo="sha256"; outDir="$CCACHE_BIN_DIR" ;; + *) echo "Unknown url resource: $url"; exit 1 ;; + esac + + download_and_verify "$url" "$checksum" "$algo" "$fileName" + 7z x -y "$DEPS_CACHE_DIR/$fileName" -aos -o"$outDir" +done + +# Setup ccache tool +[ -d "$CCACHE_DIR" ] || mkdir -p "$(cygpath -u "$CCACHE_DIR")" +CCACHE_SH_DIR=$(cygpath -u "$CCACHE_BIN_DIR") +mv "$CCACHE_SH_DIR"/ccache-*/* "$CCACHE_SH_DIR" +cp "$CCACHE_SH_DIR"/ccache.exe "$CCACHE_SH_DIR"/cl.exe diff --git a/.github/workflows/llvm.yml b/.github/workflows/llvm.yml new file mode 100644 index 0000000000..e3e3e76c50 --- /dev/null +++ b/.github/workflows/llvm.yml @@ -0,0 +1,72 @@ +name: Build LLVM + +defaults: + run: + shell: bash +on: + workflow_dispatch: + +concurrency: + group: ${{ github.ref }}-${{ github.event_name }} + cancel-in-progress: true + +env: + BUILD_ARTIFACTSTAGINGDIRECTORY: ${{ github.workspace }}/artifacts/ + +jobs: + Windows_Build: + if: github.event_name == 'workflow_dispatch' + name: LLVM Windows (MSVC) + runs-on: windows-2025 + env: + COMPILER: msvc + CCACHE_SHA: '1f39f3ad5aae3fe915e99ad1302633bc8f6718e58fa7c0de2b0ba7e080f0f08c' + CCACHE_BIN_DIR: 'C:\ccache_bin' + CCACHE_DIR: 'C:\ccache' + CCACHE_INODECACHE: 'true' + CCACHE_SLOPPINESS: 'time_macros' + DEPS_CACHE_DIR: ./dependency_cache + steps: + + - name: Checkout repository + uses: actions/checkout@main + with: + fetch-depth: 0 + + - name: Restore Dependencies Cache + uses: actions/cache/restore@main + id: restore-dependencies-cache + with: + path: ${{ env.DEPS_CACHE_DIR }} + key: "${{ runner.os }}-${{ env.COMPILER }}-llvm-${{ env.CCACHE_SHA }}" + restore-keys: ${{ runner.os }}-${{ env.COMPILER }}-llvm + + - name: Download and unpack dependencies + run: .ci/setup-llvm.sh + + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@main + + - name: Compile LLVM + shell: pwsh + run: msbuild 3rdparty\llvm\llvm_build.vcxproj /p:SolutionDir="$(pwd)/" /p:Configuration=Release /v:minimal /p:Platform=x64 /p:PreferredToolArchitecture=x64 /p:CLToolPath=${{ env.CCACHE_BIN_DIR }} /p:UseMultiToolTask=true /p:CustomAfterMicrosoftCommonTargets="${{ github.workspace }}\buildfiles\msvc\ci_only.targets" + + - name: Pack up build artifacts + run: | + mkdir -p "${{ env.BUILD_ARTIFACTSTAGINGDIRECTORY }}" + .ci/deploy-llvm.sh + + - name: Upload artifacts (7z) + uses: actions/upload-artifact@main + with: + name: LLVM for Windows (MSVC) + path: ${{ env.BUILD_ARTIFACTSTAGINGDIRECTORY }} + compression-level: 0 + if-no-files-found: error + + - name: Save Dependencies Cache + if: github.ref == 'refs/heads/master' + uses: actions/cache/save@main + with: + path: ${{ env.DEPS_CACHE_DIR }} + key: ${{ steps.restore-dependencies-cache.outputs.cache-primary-key }} diff --git a/rpcs3/rpcs3.vcxproj b/rpcs3/rpcs3.vcxproj index 7bf3c9933a..c4dd12bb7a 100644 --- a/rpcs3/rpcs3.vcxproj +++ b/rpcs3/rpcs3.vcxproj @@ -2125,15 +2125,20 @@ + + + + + diff --git a/rpcs3/rpcs3.vcxproj.filters b/rpcs3/rpcs3.vcxproj.filters index 5874f2a6d8..d5f365b5ae 100644 --- a/rpcs3/rpcs3.vcxproj.filters +++ b/rpcs3/rpcs3.vcxproj.filters @@ -1893,6 +1893,21 @@ CI + + CI + + + CI + + + CI + + + CI + + + CI + @@ -1902,4 +1917,4 @@ buildfiles\cmake - + \ No newline at end of file