This commit is contained in:
qurious-pixel 2026-03-10 09:31:30 +03:00 committed by GitHub
commit 7f0284cf40
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 427 additions and 38 deletions

102
.ci/build-windows-clang-cl.sh Executable file
View file

@ -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)"

View file

@ -0,0 +1,61 @@
#!/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
# Set Qt plugin & translation path
cp D:/a/rpcs3/rpcs3/rpcs3/qt/etc/qt.conf ./bin/qt.conf
# Download translations
mkdir -p ./bin/qt6/translations
ZIP_URL=$(curl -fsSL "https://api.github.com/repos/RPCS3/rpcs3_translations/releases/latest" \
| grep "browser_download_url" \
| grep "RPCS3-languages.zip" \
| cut -d '"' -f 4)
if [ -z "$ZIP_URL" ]; then
echo "Failed to find RPCS3-languages.zip in the latest release. Continuing without translations."
else
echo "Downloading translations from: $ZIP_URL"
curl -L -o translations.zip "$ZIP_URL" || {
echo "Failed to download translations.zip. Continuing without translations."
exit 0
}
7z x translations.zip -o"./bin/qt6/translations" >/dev/null 2>&1 || \
echo "Failed to extract translations.zip. Continuing without translations."
rm -f translations.zip
fi
# 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"

View file

@ -10,6 +10,9 @@ on:
pull_request:
workflow_dispatch:
permissions:
packages: write
concurrency:
group: ${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true
@ -326,7 +329,8 @@ jobs:
path: ${{ env.DEPS_CACHE_DIR }}
key: ${{ steps.restore-dependencies-cache.outputs.cache-primary-key }}
Windows_Build_Clang:
Windows_Build_MSYS2:
# 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')
strategy:
@ -435,8 +439,124 @@ jobs:
compression-level: 0
if-no-files-found: error
Windows_Build_CLANG-CL:
# 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')
runs-on: windows-2025
strategy:
fail-fast: false
matrix:
include:
- 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,https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json,readwrite'
X_VCPKG_NUGET_ID: "GitHub"
X_VCPKG_NUGET_USER: "${{ github.actor }}"
X_VCPKG_NUGET_PASSWORD: "${{ secrets.GITHUB_TOKEN }}"
NUGET_CREDENTIALPROVIDERS_AUTODETECT: 'false'
VCPKG_MAX_CONCURRENCY: '1'
name: RPCS3 Windows Clang (Clang-CL)
steps:
- name: Checkout repository
uses: actions/checkout@main
with:
fetch-depth: 0
- name: Clone and bootstrap vcpkg
shell: pwsh
run: |
git clone https://github.com/microsoft/vcpkg.git
.\vcpkg\bootstrap-vcpkg.bat
- name: 'Setup NuGet Credentials for vcpkg'
shell: pwsh
run: |
dotnet nuget locals all --clear
$configPath = "${{ github.workspace }}\nuget.config"
dotnet new nugetconfig --force --output "${{ github.workspace }}"
dotnet nuget add source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" `
--name "GitHub" `
--username "${{ github.actor }}" `
--password "${{ secrets.GITHUB_TOKEN }}" `
--store-password-in-clear-text `
--configfile "$configPath"
echo "VCPKG_NUGET_CONFIG=$configPath" >> $env:GITHUB_ENV
- name: Restore LLVM Cache
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
shell: pwsh
run: |
if (!(Test-Path -Path D:\a\rpcs3\rpcs3\llvm-${{ matrix.llvmver }}\)) {
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' }}
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
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ runner.os }}-ccache-${{ matrix.compiler }}-${{ runner.arch }}-${{ github.run_id }}
restore-keys: ${{ runner.os }}-ccache-${{ matrix.compiler }}-${{ runner.arch }}-
- name: install DIA SDK
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
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'
uses: actions/cache/save@main
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ steps.restore-build-ccache.outputs.cache-primary-key }}
- name: Upload artifacts
uses: actions/upload-artifact@main
with:
name: RPCS3 for Windows (${{ runner.arch }}, ${{ matrix.compiler }})
path: ${{ env.BUILD_ARTIFACTSTAGINGDIRECTORY }}
compression-level: 0
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

View file

@ -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()

View file

@ -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..

View file

@ -11,6 +11,7 @@ include("${ASMJIT_DIR}/CMakeLists.txt")
add_library(asmjit ${ASMJIT_SRC})
target_include_directories(asmjit SYSTEM 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...

View file

@ -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

View file

@ -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)

View file

@ -106,4 +106,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View file

@ -20,7 +20,10 @@ else()
option(protobuf_DISABLE_RTTI "Remove runtime type information in the binaries" OFF)
option(protobuf_FORCE_FETCH_DEPENDENCIES "Force all dependencies to be downloaded from GitHub. Local installations will be ignored." OFF)
option(protobuf_LOCAL_DEPENDENCIES_ONLY "Prevent downloading any dependencies from GitHub. If this option is set, the dependency must be available locally as an installed package." OFF)
if(VCPKG_TOOLCHAIN)
set(protobuf_BUILD_SHARED_LIBS ON CACHE BOOL "" FORCE)
message(STATUS "VCPKG detected: Building Protobuf as a shared library")
endif()
add_subdirectory(protobuf EXCLUDE_FROM_ALL)
target_include_directories(3rdparty_protobuf SYSTEM INTERFACE protobuf/src)
target_link_libraries(3rdparty_protobuf INTERFACE libprotobuf)

View file

@ -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()

View file

@ -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})

View file

@ -129,7 +129,9 @@ if(MSVC)
message(AUTHOR_WARNING "Debug build currently can not work with static CRT.")
endif()
endif()
add_compile_options(/MP)
if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_compile_options(/MP)
endif()
endif()
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)

View file

@ -526,7 +526,7 @@ void fmt_class_string<u128>::format(std::string& out, u64 arg)
return;
}
#ifdef _MSC_VER
#if defined(_MSC_VER) && !defined(__clang__)
fmt::append(out, "0x%016llx%016llx", num.hi, num.lo);
#else
fmt::append(out, "0x%016llx%016llx", static_cast<u64>(num >> 64), static_cast<u64>(num));

View file

@ -1,7 +1,18 @@
# Check and configure compiler options for RPCS3
if(MSVC)
add_compile_options(/Zc:throwingNew- /constexpr:steps16777216)
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
check_cxx_compiler_flag("-msse -msse2 -mcx16" COMPILER_X86)
check_cxx_compiler_flag("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
if (COMPILER_X86)
add_compile_options(-msse -msse2 -mcx16)
endif()
if(COMPILER_SUPPORTS_MARCH_NATIVE)
add_compile_options(-march=native)
endif()
else()
add_compile_options(/Zc:throwingNew- /constexpr:steps16777216)
endif()
add_compile_definitions(
_CRT_SECURE_NO_DEPRECATE=1 _CRT_NON_CONFORMING_SWPRINTFS=1 _SCL_SECURE_NO_WARNINGS=1
NOMINMAX _ENABLE_EXTENDED_ALIGNED_STORAGE=1 _HAS_EXCEPTIONS=0)

View file

@ -147,11 +147,16 @@ if (NOT ANDROID)
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/bin/Icons $<TARGET_FILE_DIR:rpcs3>/Icons
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/bin/GuiConfigs $<TARGET_FILE_DIR:rpcs3>/GuiConfigs
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/bin/test $<TARGET_FILE_DIR:rpcs3>/test
COMMAND "${WINDEPLOYQT_EXECUTABLE}" --no-compiler-runtime --no-opengl-sw --no-patchqt
)
get_target_property(WINDEPLOYQT_EXECUTABLE Qt6::windeployqt IMPORTED_LOCATION)
add_custom_command(TARGET rpcs3 POST_BUILD
COMMAND ${WINDEPLOYQT_EXECUTABLE} --no-compiler-runtime --no-opengl-sw --no-patchqt
--no-system-d3d-compiler --no-system-dxc-compiler --no-quick-import
--plugindir "$<IF:$<CXX_COMPILER_ID:MSVC>,$<TARGET_FILE_DIR:rpcs3>/plugins,$<TARGET_FILE_DIR:rpcs3>/share/qt6/plugins>"
--translationdir "$<IF:$<CXX_COMPILER_ID:MSVC>,$<TARGET_FILE_DIR:rpcs3>/translations,$<TARGET_FILE_DIR:rpcs3>/share/qt6/translations>"
--verbose 0 "$<TARGET_FILE:rpcs3>")
--plugindir "$<IF:$<CXX_COMPILER_FRONTEND_VARIANT:MSVC>,$<TARGET_FILE_DIR:rpcs3>/qt6/plugins,$<TARGET_FILE_DIR:rpcs3>/share/qt6/plugins>"
--translationdir "$<IF:$<CXX_COMPILER_FRONTEND_VARIANT:MSVC>,$<TARGET_FILE_DIR:rpcs3>/qt6/translations,$<TARGET_FILE_DIR:rpcs3>/share/qt6/translations>"
--verbose 0
$<TARGET_FILE:rpcs3>
)
endif()
# Unix installation

View file

@ -35,6 +35,9 @@
#if defined(_MSC_VER) && defined(_M_X64)
#define POLARSSL_HAVE_MSVC_X64_INTRINSICS
#include <intrin.h>
#ifdef __clang__
#include <immintrin.h>
#endif
#endif
/*
@ -197,6 +200,21 @@ void aesni_gcm_mult( unsigned char c[16],
const unsigned char b[16] )
{
#if defined(POLARSSL_HAVE_MSVC_X64_INTRINSICS)
#ifdef __clang__
__m128i xa, xb, m0, m1, x10, x32, r;
xa[1] = _byteswap_uint64( *((unsigned __int64*)a + 0) );
xa[0] = _byteswap_uint64( *((unsigned __int64*)a + 1) );
xb[1] = _byteswap_uint64( *((unsigned __int64*)b + 0) );
xb[0] = _byteswap_uint64( *((unsigned __int64*)b + 1) );
clmul256( xa, xb, &m0, &m1 );
sll256( m0, m1, &x10, &x32 );
r = reducemod128( x10, x32 );
*((unsigned __int64*)c + 0) = _byteswap_uint64( r[1] );
*((unsigned __int64*)c + 1) = _byteswap_uint64( r[0] );
#else
__m128i xa, xb, m0, m1, x10, x32, r;
xa.m128i_u64[1] = _byteswap_uint64( *((unsigned __int64*)a + 0) );
@ -210,6 +228,7 @@ void aesni_gcm_mult( unsigned char c[16],
*((unsigned __int64*)c + 0) = _byteswap_uint64( r.m128i_u64[1] );
*((unsigned __int64*)c + 1) = _byteswap_uint64( r.m128i_u64[0] );
#endif
#else
unsigned char aa[16], bb[16], cc[16];
size_t i;

View file

@ -81,6 +81,7 @@ target_sources(rpcs3_emu PRIVATE
../../Utilities/Thread.cpp
../../Utilities/version.cpp
)
if(APPLE)
target_sources(rpcs3_emu PRIVATE
../../darwin/util/sysinfo_darwin.mm
@ -90,12 +91,12 @@ endif()
target_include_directories(rpcs3_emu PUBLIC "${CMAKE_SOURCE_DIR}")
set_source_files_properties("../../Utilities/JITLLVM.cpp" "../../Utilities/JITASM.cpp" PROPERTIES
COMPILE_FLAGS "$<IF:$<CXX_COMPILER_ID:MSVC>,/GR-,-fno-rtti>"
COMPILE_FLAGS "$<IF:$<CXX_COMPILER_ID:MSVC>,$<IF:$<CXX_COMPILER_ID:Clang>,/GR-,>,-fno-rtti>"
SKIP_PRECOMPILE_HEADERS ON
)
set_source_files_properties("../util/yaml.cpp" PROPERTIES
COMPILE_FLAGS "$<IF:$<CXX_COMPILER_ID:MSVC>,/EHsc,-fexceptions>"
COMPILE_FLAGS "$<IF:$<CXX_COMPILER_ID:MSVC>,$<IF:$<CXX_COMPILER_ID:Clang>,/EHsc,>,-fexceptions>"
SKIP_PRECOMPILE_HEADERS ON
)

View file

@ -452,7 +452,7 @@ extern void mov_rdata_nt(spu_rdata_t& _dst, const spu_rdata_t& _src)
#endif
}
#if defined(_MSC_VER)
#if defined(_MSC_VER) && !defined(__clang__)
#define mwaitx_func
#define waitpkg_func
#else

View file

@ -2063,7 +2063,7 @@ void lv2_obj::set_yield_frequency(u64 freq, u64 max_allowed_tsc)
g_lv2_preempts_taken.release(0);
}
#if defined(_MSC_VER)
#if defined(_MSC_VER) && !defined(__clang__)
#define mwaitx_func
#define waitpkg_func
#else

View file

@ -19,7 +19,7 @@
#include "Emu/CPU/sse2neon.h"
#endif
#if defined(_MSC_VER) || !defined(__SSE2__)
#if defined(_MSC_VER) && !defined(__clang__) || !defined(__SSE2__)
#define SSE4_1_FUNC
#define AVX2_FUNC
#define AVX3_FUNC

View file

@ -24,7 +24,7 @@
#endif
#endif
#ifdef _MSC_VER
#if defined(_MSC_VER) && !defined(__clang__)
#define AVX512_ICL_FUNC
#else
#define AVX512_ICL_FUNC __attribute__((__target__("avx512f,avx512bw,avx512dq,avx512cd,avx512vl,avx512bitalg,avx512ifma,avx512vbmi,avx512vbmi2,avx512vnni,avx512vpopcntdq")))

View file

@ -6,7 +6,7 @@
#include <functional>
#ifdef ARCH_X64
#ifdef _MSC_VER
#if defined(_MSC_VER) && !defined(__clang__)
#include <intrin.h>
#else
#include <immintrin.h>
@ -66,10 +66,12 @@ namespace utils
constexpr u32 popcnt128(const u128& v)
{
#ifdef _MSC_VER
#if defined(_MSC_VER) && !defined(__clang__)
return std::popcount(v.lo) + std::popcount(v.hi);
#else
return std::popcount(v);
const u64 lo = static_cast<u64>(v);
const u64 hi = static_cast<u64>(v >> 64);
return static_cast<u32>(std::popcount(lo) + std::popcount(hi));
#endif
}
@ -98,7 +100,7 @@ namespace utils
inline s64 div128(s64 high, s64 low, s64 divisor, s64* remainder = nullptr)
{
#ifdef _MSC_VER
#if defined(_MSC_VER) && !defined(__clang__)
s64 rem = 0;
s64 r = _div128(high, low, divisor, &rem);
@ -120,7 +122,7 @@ namespace utils
inline u64 udiv128(u64 high, u64 low, u64 divisor, u64* remainder = nullptr)
{
#ifdef _MSC_VER
#if defined(_MSC_VER) && !defined(__clang__)
u64 rem = 0;
u64 r = _udiv128(high, low, divisor, &rem);
@ -140,7 +142,7 @@ namespace utils
return r;
}
#ifdef _MSC_VER
#if defined(_MSC_VER) && !defined(__clang__)
inline u128 operator/(u128 lhs, u64 rhs)
{
u64 rem = 0;
@ -150,25 +152,33 @@ namespace utils
constexpr u32 ctz128(u128 arg)
{
#ifdef _MSC_VER
#if defined(_MSC_VER) && !defined(__clang__)
if (!arg.lo)
return std::countr_zero(arg.hi) + 64u;
else
return std::countr_zero(arg.lo);
#else
return std::countr_zero(arg);
const u64 hi = static_cast<u64>(arg >> 64);
if (hi != 0)
return static_cast<u32>(std::countr_zero(hi));
const u64 lo = static_cast<u64>(arg);
return static_cast<u32>(std::countr_zero(lo) + 64u);
#endif
}
constexpr u32 clz128(u128 arg)
{
#ifdef _MSC_VER
#if defined(_MSC_VER) && !defined(__clang__)
if (arg.hi)
return std::countl_zero(arg.hi);
else
return std::countl_zero(arg.lo) + 64;
#else
return std::countl_zero(arg);
const u64 hi = static_cast<u64>(arg >> 64);
if (hi != 0)
return static_cast<u32>(std::countl_zero(hi));
const u64 lo = static_cast<u64>(arg);
return static_cast<u32>(std::countl_zero(lo) + 64u);
#endif
}
@ -304,6 +314,6 @@ namespace utils
using utils::busy_wait;
#ifdef _MSC_VER
#if defined(_MSC_VER) && !defined(__clang__)
using utils::operator/;
#endif

View file

@ -52,7 +52,7 @@ static inline std::array<u32, 4> get_cpuid(u32 func, u32 subfunc)
static inline u64 get_xgetbv(u32 xcr)
{
#ifdef _MSC_VER
#if defined(_MSC_VER) && !defined(__clang__)
return _xgetbv(xcr);
#else
u32 eax, edx;

View file

@ -250,13 +250,13 @@ public:
}
};
#if defined(ARCH_X64) && !defined(_MSC_VER)
#if defined(ARCH_X64) && !defined(_MSC_VER) && !defined(__m128)
using __m128i = long long __attribute__((vector_size(16)));
using __m128d = double __attribute__((vector_size(16)));
using __m128 = float __attribute__((vector_size(16)));
#endif
#ifndef _MSC_VER
#if !defined(_MSC_VER) || defined(__clang__)
using u128 = __uint128_t;
using s128 = __int128_t;
#else
@ -267,8 +267,8 @@ extern "C"
union __m128i;
struct __m128d;
uchar _addcarry_u64(uchar, u64, u64, u64*);
uchar _subborrow_u64(uchar, u64, u64, u64*);
constexpr uchar _addcarry_u64(uchar, u64, u64, u64*);
constexpr uchar _subborrow_u64(uchar, u64, u64, u64*);
u64 __shiftleft128(u64, u64, uchar);
u64 __shiftright128(u64, u64, uchar);
u64 _umul128(u64, u64, u64*);
@ -580,7 +580,7 @@ struct s128 : u128
// Optimization for u64*u64=u128
constexpr u128 u128_from_mul(u64 a, u64 b)
{
#ifdef _MSC_VER
#if defined(_MSC_VER) && !defined(__clang__)
if (!std::is_constant_evaluated())
{
u64 hi;

27
vcpkg.json Normal file
View file

@ -0,0 +1,27 @@
{
"name": "rpcs3",
"version-string": "1.0",
"builtin-baseline": "7c45dcccbe6463539a6b92c264258043d267c8f6",
"dependencies": [
"curl",
{
"name": "ffmpeg",
"features": [
"avcodec",
"avformat",
"swscale",
"swresample"
]
},
"libpng",
"opencv",
"protobuf",
"qtbase",
"qtmultimedia",
"qtsvg",
"qttools",
"qttranslations",
"vulkan",
"zlib"
]
}