Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions .ci/build-windows-clang-cl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
#!/bin/sh -e

echo "Starting RPCS3 build (Bash script)"

# Automatically find clang_rt.builtins-x86_64.lib
echo "Searching for clang_rt.builtins-x86_64.lib ..."
clangBuiltinsLibPath=$(find "C:\Program Files\LLVM\lib\clang" -name "clang_rt.builtins-x86_64.lib" | sed 's|Program Files|PROGRA~1|g')

if [ -z "$clangBuiltinsLibPath" ]; then
echo "ERROR: Could not find clang_rt.builtins-x86_64.lib in LLVM installation."
exit 1
fi

clangBuiltinsDir=$(dirname "$clangBuiltinsLibPath")
clangBuiltinsLib=$(basename "$clangBuiltinsLibPath")
# shellcheck disable=SC2028
clangPath=$(echo "C:\Program Files\LLVM\bin" | sed 's|Program Files|PROGRA~1|g')

echo "Found Clang builtins library: $clangBuiltinsLib in $clangBuiltinsDir"
echo "Found Clang Path: $clangPath"

# Search for mt.exe in SDK bin directories
echo "Searching for llvm-mt.exe ..."
mtPath=$(find "$clangPath" -name "llvm-mt.exe")

if [ -z "$mtPath" ]; then
echo "ERROR: Could not find llvm-mt.exe in SDK directories."
exit 1
fi

echo "Found llvm-mt.exe at: $mtPath"

VcpkgRoot="$VCPKG_ROOT"
VcpkgBuildRoot="$GITHUB_WORKSPACE/build"
VcpkgTriplet="$VCPKG_TRIPLET"
VcpkgInstall="$VcpkgBuildRoot/vcpkg_installed/$VcpkgTriplet"
VcpkgInclude="$VcpkgInstall/include"
VcpkgLib="$VcpkgInstall/lib"

# Configure git safe directory
echo "Configuring git safe directory"
git config --global --add safe.directory '*'

# Initialize submodules except certain ones
echo "Initializing submodules"
set -x
# shellcheck disable=SC2046
git submodule -q update --init $(awk '/path/ && !/llvm/ && !/opencv/ && !/FAudio/ && !/libpng/ && !/zlib/ && !/feralinteractive/ { print $3 }' .gitmodules)
set +x

# Create and enter build directory
echo "Creating build directory"
mkdir -p build
cd build || exit
echo "Changed directory to: $(pwd)"

# Run CMake with Ninja generator and required flags
echo "Running CMake configuration"
cmake .. \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER="${clangPath}/clang-cl.exe" \
-DCMAKE_CXX_COMPILER="${clangPath}/clang-cl.exe" \
-DCMAKE_LINKER="${clangPath}/lld-link.exe" \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_TOOLCHAIN_FILE="$VcpkgRoot/scripts/buildsystems/vcpkg.cmake" \
-DCMAKE_EXE_LINKER_FLAGS="/LIBPATH:${clangBuiltinsDir} /defaultlib:${clangBuiltinsLib}" \
-DCMAKE_MT="${mtPath}" \
-DUSE_NATIVE_INSTRUCTIONS=OFF \
-DUSE_PRECOMPILED_HEADERS=OFF \
-DVCPKG_TARGET_TRIPLET="$VcpkgTriplet" \
-DFFMPEG_INCLUDE_DIR="$VcpkgInclude" \
-DFFMPEG_LIBAVCODEC="$VcpkgLib/avcodec.lib" \
-DFFMPEG_LIBAVFORMAT="$VcpkgLib/avformat.lib" \
-DFFMPEG_LIBAVUTIL="$VcpkgLib/avutil.lib" \
-DFFMPEG_LIBSWSCALE="$VcpkgLib/swscale.lib" \
-DFFMPEG_LIBSWRESAMPLE="$VcpkgLib/swresample.lib" \
-DUSE_SYSTEM_CURL=OFF \
-DUSE_FAUDIO=OFF \
-DUSE_SDL=ON \
-DUSE_SYSTEM_SDL=OFF \
-DUSE_SYSTEM_FFMPEG=ON \
-DUSE_SYSTEM_OPENCV=ON \
-DUSE_SYSTEM_OPENAL=OFF \
-DUSE_SYSTEM_LIBPNG=ON \
-DUSE_DISCORD_RPC=ON \
-DUSE_SYSTEM_ZSTD=ON \
-DWITH_LLVM=ON \
-DSTATIC_LINK_LLVM=ON \
-DBUILD_RPCS3_TESTS=OFF

echo "CMake configuration complete"

# Build with ninja
echo "Starting build with Ninja..."
ninja

echo "Build succeeded"

# Go back to root directory
cd ..
echo "Returned to root directory: $(pwd)"
2 changes: 1 addition & 1 deletion .ci/build-windows-clang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ cd ..

# If it compiled succesfully let's deploy.
if [ "$build_status" -eq 0 ]; then
.ci/deploy-windows-clang.sh "x86_64"
echo "Build succeeded"
fi
42 changes: 42 additions & 0 deletions .ci/deploy-windows-clang-cl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/sh -ex

# source ci-vars.env
# shellcheck disable=SC1091
. .ci/ci-vars.env

cd build || exit 1

CPU_ARCH="${1:-x86_64}"

echo "Deploying rpcs3 windows clang-cl $CPU_ARCH"

# First let's print some info about our caches
C:/Strawberry/c/bin/ccache.exe --show-stats -v

# BUILD_blablabla is CI specific, so we wrap it for portability
ARTIFACT_DIR="$BUILD_ARTIFACTSTAGINGDIRECTORY"

# Remove unecessary files
rm -f ./bin/vulkan-1.dll

# Prepare compatibility and SDL database for packaging
mkdir ./bin/config
mkdir ./bin/config/input_configs
curl -fsSL 'https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt' 1> ./bin/config/input_configs/gamecontrollerdb.txt
curl -fsSL 'https://rpcs3.net/compatibility?api=v1&export' | iconv -t UTF-8 1> ./bin/GuiConfigs/compat_database.dat

# Download SSL certificate (not needed with CURLSSLOPT_NATIVE_CA)
#curl -fsSL 'https://curl.haxx.se/ca/cacert.pem' 1> ./bin/cacert.pem

# Package artifacts
7z a -m0=LZMA2 -mx9 "$BUILD" ./bin/*

# 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
mkdir "$ARTIFACT_DIR"
cp -- "$BUILD" "$ARTIFACT_DIR"
cp -- "$BUILD.sha256" "$ARTIFACT_DIR"
88 changes: 85 additions & 3 deletions .github/workflows/rpcs3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -328,16 +328,25 @@ jobs:
Windows_Build_Clang:
# Only run push event on master branch of main repo, but run all PRs
if: github.event_name != 'push' || (github.repository == 'RPCS3/rpcs3' && github.ref_name == 'master')
name: RPCS3 Windows Clang
runs-on: windows-2025
strategy:
fail-fast: false
matrix:
include:
- msys2: clang64
compiler: clang
arch: win64
- compiler: clang-cl
llvmver: 19.1.7
arch: win64

env:
CCACHE_DIR: 'C:\ccache'
VCPKG_TRIPLET: x64-windows
VCPKG_BUILD_TYPE: release
VCPKG_ROOT: "${{github.workspace}}/vcpkg"
VCPKG_BINARY_SOURCES: 'clear;nuget,GitHub,readwrite'
name: RPCS3 Windows ${{ matrix.compiler }}
steps:
- name: Checkout repository
uses: actions/checkout@main
Expand All @@ -346,6 +355,7 @@ jobs:

- name: Setup msys2
uses: msys2/setup-msys2@v2
if: ${{ matrix.compiler == 'clang' }}
with:
msystem: ${{ matrix.msys2 }}
update: true
Expand Down Expand Up @@ -373,6 +383,61 @@ jobs:
git
p7zip

- name: Clone and bootstrap vcpkg
if: ${{ matrix.compiler == 'clang-cl' }}
shell: pwsh
run: |
git clone https://github.com/microsoft/vcpkg.git
.\vcpkg\bootstrap-vcpkg.bat

- name: 'Setup NuGet Credentials for vcpkg'
if: ${{ matrix.compiler == 'clang-cl' }}
shell: 'bash'
run: |
`./vcpkg/vcpkg fetch nuget | tail -n 1` \
sources add \
-source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \
-storepasswordincleartext \
-name "GitHub" \
-username "${{ github.repository_owner }}" \
-password "${{ secrets.GITHUB_TOKEN }}"
`./vcpkg/vcpkg fetch nuget | tail -n 1` \
setapikey "${{ secrets.GITHUB_TOKEN }}" \
-source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"

- name: Restore LLVM Cache
if: ${{ matrix.compiler == 'clang-cl' }}
uses: actions/cache/restore@main
id: llvm-cache
with:
path: ./llvm-${{ matrix.llvmver }}
key: ${{ runner.os }}-llvm-dl-cache-${{ hashFiles('**/llvm-${{ matrix.llvmver }}') }}
restore-keys: ${{ runner.os }}-clang-dl-cache-

- name: Add LLVM
if: ${{ matrix.compiler == 'clang-cl' }}
shell: pwsh
run: |
if (!(Test-Path -Path D:\a\rpcs3\rpcs3\llvm-${{ matrix.llvmver }}\)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing comment for this section

rm -r llvm-*
curl -fsSLO https://github.com/vovkos/llvm-package-windows/releases/download/llvm-${{ matrix.llvmver }}/llvm-${{ matrix.llvmver }}-windows-amd64-msvc17-msvcrt.7z
curl -fsSLO https://github.com/vovkos/llvm-package-windows/releases/download/clang-${{ matrix.llvmver }}/clang-${{ matrix.llvmver }}-windows-amd64-msvc17-msvcrt.7z
7z x llvm-*.7z
mv llvm* llvm-${{ matrix.llvmver }}
rm llvm-*.7z
7z x clang-*.7z
Copy-Item -Path "D:\a\rpcs3\rpcs3\clang*\*" -Destination "D:\a\rpcs3\rpcs3\llvm-${{ matrix.llvmver }}" -Recurse -Force
rm -r clang*
}
Add-Content -Path $env:GITHUB_PATH -Value "D:\a\rpcs3\rpcs3\llvm-${{ matrix.llvmver }}\bin"

- name: Save LLVM Cache
if: ${{ github.ref == 'refs/heads/master' && matrix.compiler == 'clang-cl' }}
uses: actions/cache/save@main
with:
path: ./llvm-${{ matrix.llvmver }}
key: ${{ steps.llvm-cache.outputs.cache-primary-key }}

- name: Restore build Ccache
uses: actions/cache/restore@main
id: restore-build-ccache
Expand All @@ -382,12 +447,29 @@ jobs:
restore-keys: ${{ runner.os }}-ccache-${{ matrix.compiler }}-${{ runner.arch }}-

- name: Build RPCS3
if: ${{ matrix.compiler == 'clang' }}
shell: msys2 {0}
run: |
export CCACHE_DIR=$(cygpath -u "$CCACHE_DIR")
echo "CCACHE_DIR=$CCACHE_DIR"
.ci/setup-windows-ci-vars.sh ${{ matrix.arch }} ${{ matrix.compiler }}
.ci/build-windows-clang.sh
.ci/setup-windows-ci-vars.sh ${{ matrix.arch }} ${{ matrix.compiler }}
.ci/deploy-windows-${{ matrix.compiler }}.sh

- name: install DIA SDK
if: ${{ matrix.compiler == 'clang-cl' }}
run: |
mkdir -p "C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional" || true
cp -r "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/DIA SDK" "C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/DIA SDK"
"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64

- name: Build RPCS3
if: ${{ matrix.compiler == 'clang-cl' }}
shell: bash
run: |
.ci/build-windows-clang-cl.sh
.ci/setup-windows-ci-vars.sh ${{ matrix.arch }} ${{ matrix.compiler }}
.ci/deploy-windows-${{ matrix.compiler }}.sh

- name: Save build Ccache
if: github.ref == 'refs/heads/master'
Expand All @@ -405,7 +487,7 @@ jobs:
if-no-files-found: error

FreeBSD_Build:
# Only run push event on master branch of main repo, but run all PRs
# Only run push event on master branch of main repo, but run all PRs
if: github.event_name != 'push' || (github.repository == 'RPCS3/rpcs3' && github.ref_name == 'master')
name: RPCS3 FreeBSD
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions 3rdparty/OpenAL/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ if(USE_SYSTEM_OPENAL)
else()
option(ALSOFT_UTILS "Build utility programs" OFF)
option(ALSOFT_EXAMPLES "Build example programs" OFF)
option(ALSOFT_ENABLE_MODULES "Enable use of C++20 modules when supported" OFF)
set(LIBTYPE "STATIC")
add_subdirectory(openal-soft EXCLUDE_FROM_ALL)
add_library(3rdparty_openal INTERFACE)
target_link_libraries(3rdparty_openal INTERFACE OpenAL::OpenAL)
target_compile_options(3rdparty_openal INTERFACE -Wno-deprecated-literal-operator)
endif()
4 changes: 2 additions & 2 deletions 3rdparty/OpenAL/openal-soft.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@
<PropertyGroup Label="UserMacros">
<CmakeReleaseCLI>call vsdevcmd.bat -arch=amd64
cd "$(SolutionDir)build\tmp\$(ProjectName)-$(Configuration)-$(Platform)"
cmake -G Ninja -DCMAKE_CXX_COMPILER="cl.exe" -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_INSTALL_PREFIX="./Release" -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DCMAKE_SYSTEM_VERSION=10.0 -DLIBTYPE=STATIC -DFORCE_STATIC_VCRT=true -DALSOFT_UTILS=false -DALSOFT_EXAMPLES=false -DALSOFT_INSTALL=false -DALSOFT_INSTALL_CONFIG=false -DALSOFT_INSTALL_HRTF_DATA=false -DALSOFT_INSTALL_AMBDEC_PRESETS=false -DALSOFT_INSTALL_EXAMPLES=false -DALSOFT_INSTALL_UTILS=false "$(SolutionDir)3rdparty\OpenAL\openal-soft"
cmake -G Ninja -DCMAKE_CXX_COMPILER="cl.exe" -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DCMAKE_INSTALL_PREFIX="./Release" -DCMAKE_SYSTEM_VERSION=10.0 -DLIBTYPE=STATIC -DFORCE_STATIC_VCRT=true -DALSOFT_UTILS=false -DALSOFT_EXAMPLES=false -DALSOFT_INSTALL=false -DALSOFT_INSTALL_CONFIG=false -DALSOFT_INSTALL_HRTF_DATA=false -DALSOFT_INSTALL_AMBDEC_PRESETS=false -DALSOFT_INSTALL_EXAMPLES=false -DALSOFT_INSTALL_UTILS=false "$(SolutionDir)3rdparty\OpenAL\openal-soft"
</CmakeReleaseCLI>
<CmakeDebugCLI>call vsdevcmd.bat -arch=amd64
cd "$(SolutionDir)build\tmp\$(ProjectName)-$(Configuration)-$(Platform)"
cmake -G Ninja -DCMAKE_CXX_COMPILER="cl.exe" -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_INSTALL_PREFIX="./Debug" -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebug -DCMAKE_SYSTEM_VERSION=10.0 -DLIBTYPE=STATIC -DALSOFT_UTILS=false -DALSOFT_EXAMPLES=false -DALSOFT_INSTALL=false -DALSOFT_INSTALL_CONFIG=false -DALSOFT_INSTALL_HRTF_DATA=false -DALSOFT_INSTALL_AMBDEC_PRESETS=false -DALSOFT_INSTALL_EXAMPLES=false -DALSOFT_INSTALL_UTILS=false "$(SolutionDir)3rdparty\OpenAL\openal-soft"
cmake -G Ninja -DCMAKE_CXX_COMPILER="cl.exe" -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebug -DCMAKE_INSTALL_PREFIX="./Debug" -DCMAKE_SYSTEM_VERSION=10.0 -DLIBTYPE=STATIC -DALSOFT_UTILS=false -DALSOFT_EXAMPLES=false -DALSOFT_INSTALL=false -DALSOFT_INSTALL_CONFIG=false -DALSOFT_INSTALL_HRTF_DATA=false -DALSOFT_INSTALL_AMBDEC_PRESETS=false -DALSOFT_INSTALL_EXAMPLES=false -DALSOFT_INSTALL_UTILS=false "$(SolutionDir)3rdparty\OpenAL\openal-soft"
</CmakeDebugCLI>
<CmakeCopyCLI>
echo Copying..
Expand Down
1 change: 1 addition & 0 deletions 3rdparty/asmjit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ include("${ASMJIT_DIR}/CMakeLists.txt")
add_library(asmjit ${ASMJIT_SRC})
target_include_directories(asmjit PUBLIC ${ASMJIT_DIR}/src)
target_link_libraries(asmjit PRIVATE ${ASMJIT_DEPS})
target_compile_options(asmjit PRIVATE -Wno-nontrivial-memcall -Wno-deprecated-anon-enum-enum-conversion)

# ASMJIT should have a option for disabling installing and this wouldnt
# be required to avoid installing ASMJIT...
Expand Down
5 changes: 5 additions & 0 deletions 3rdparty/cubeb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ set(USE_SANITIZERS FALSE CACHE BOOL "Dont't use sanitizers")

add_subdirectory(cubeb EXCLUDE_FROM_ALL)
add_library(3rdparty::cubeb ALIAS cubeb)
target_compile_options(cubeb PRIVATE
-Wno-int-to-void-pointer-cast
-Wno-deprecated-declarations
-Wno-implicit-const-int-float-conversion
)

if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm|ARM|aarch64|AArch64|Aarch64)")
target_compile_definitions(speex PUBLIC
Expand Down
7 changes: 7 additions & 0 deletions 3rdparty/libusb/config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ if (${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
)
elseif(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
if (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
append_compiler_flags(
-Wno-unused-value
-Wno-pragma-pack
${ADDITIONAL_CC_FLAGS}
)
endif()
endif()

check_include_files(sys/timerfd.h USBI_TIMERFD_AVAILABLE)
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/llvm/llvm_build_clang_cl.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
16 changes: 14 additions & 2 deletions 3rdparty/wolfssl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,17 @@ else()

add_subdirectory(wolfssl EXCLUDE_FROM_ALL)

target_compile_definitions(wolfssl PUBLIC WOLFSSL_DES_ECB HAVE_WRITE_DUP FP_MAX_BITS=8192 WOLFSSL_NO_OPTIONS_H)
endif()
target_compile_definitions(wolfssl PUBLIC WOLFSSL_DES_ECB HAVE_WRITE_DUP WOLFSSL_NO_OPTIONS_H)

if(MSVC AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# Disable 128-bit Math
set(WOLFSSL_ASM ON CACHE BOOL "" FORCE)
set(WOLFSSL_FAST_MATH OFF CACHE BOOL "" FORCE)
target_compile_definitions(wolfssl PUBLIC WOLFSSL_SP_NO_128BIT FP_MAX_BITS=4096)

# Disable warnings
target_compile_options(wolfssl PRIVATE /w)
else()
target_compile_definitions(wolfssl PUBLIC FP_MAX_BITS=8192)
endif()
endif()
1 change: 1 addition & 0 deletions 3rdparty/yaml-cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ set(YAML_CPP_BUILD_TESTS OFF CACHE BOOL "Enable testing" FORCE)
set(YAML_CPP_BUILD_TOOLS OFF CACHE BOOL "Enable parse tools" FORCE)
set(YAML_CPP_BUILD_CONTRIB OFF CACHE BOOL "Enable contrib stuff in library" FORCE)
add_subdirectory(yaml-cpp EXCLUDE_FROM_ALL)
target_compile_options(yaml-cpp PRIVATE -Wno-ignored-attributes -Wno-unused-value)

set(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX_OLD})
1 change: 0 additions & 1 deletion 3rdparty/zstd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ else()
option(ZSTD_BUILD_SHARED "BUILD SHARED LIBRARIES" OFF)
option(ZSTD_BUILD_STATIC "BUILD STATIC LIBRARIES" ON)
option(ZSTD_BUILD_TESTS "BUILD TESTS" OFF)

add_subdirectory(zstd/build/cmake EXLUDE_FROM_ALL)
add_library(3rdparty_zstd INTERFACE)
target_link_libraries(3rdparty_zstd INTERFACE libzstd_static)
Expand Down
Loading
Loading