diff --git a/.ci/build-windows-clang-cl.sh b/.ci/build-windows-clang-cl.sh index a24d8f8361..f6feea350b 100755 --- a/.ci/build-windows-clang-cl.sh +++ b/.ci/build-windows-clang-cl.sh @@ -30,9 +30,10 @@ fi echo "Found llvm-mt.exe at: $mtPath" -VcpkgRoot="$(pwd)/vcpkg" +VcpkgRoot="$VCPKG_ROOT" +VcpkgBuildRoot="$GITHUB_WORKSPACE/build" VcpkgTriplet="$VCPKG_TRIPLET" -VcpkgInstall="$VcpkgRoot/installed/$VcpkgTriplet" +VcpkgInstall="$VcpkgBuildRoot/vcpkg_installed/$VcpkgTriplet" VcpkgInclude="$VcpkgInstall/include" VcpkgLib="$VcpkgInstall/lib" @@ -42,8 +43,10 @@ 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" diff --git a/.github/workflows/rpcs3.yml b/.github/workflows/rpcs3.yml index cc50e17208..04b52250f0 100644 --- a/.github/workflows/rpcs3.yml +++ b/.github/workflows/rpcs3.yml @@ -344,12 +344,15 @@ jobs: 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 with: fetch-depth: 0 + - name: Setup msys2 uses: msys2/setup-msys2@v2 if: ${{ matrix.compiler == 'clang' }} @@ -386,42 +389,21 @@ jobs: run: | git clone https://github.com/microsoft/vcpkg.git .\vcpkg\bootstrap-vcpkg.bat - - name: Restore vcpkg cache - if: ${{ matrix.compiler == 'clang-cl' }} - uses: actions/cache/restore@main - id: restore-vcpkg-cache - with: - path: | - vcpkg/installed - vcpkg/buildtrees - key: vcpkg-${{ runner.os }}-${{ matrix.compiler }}-${{ runner.arch }}-${{ hashFiles('**/vcpkg') }} - restore-keys: vcpkg-${{ runner.os }}-${{ matrix.compiler }}-${{ runner.arch }}- - - name: Install dependencies with vcpkg + - name: 'Setup NuGet Credentials for vcpkg' if: ${{ matrix.compiler == 'clang-cl' }} - shell: pwsh - run: >- - .\vcpkg\vcpkg.exe install - ffmpeg[avcodec,avformat,swscale,swresample] - libpng - opencv - qtbase - qtmultimedia - qtsvg - qttools - vulkan - zlib - --triplet $env:VCPKG_TRIPLET - --clean-after-build - - - name: Save vcpkg cache - if: ${{ github.ref == 'refs/heads/master' && matrix.compiler == 'clang-cl' }} - uses: actions/cache/save@main - with: - path: | - vcpkg/installed - vcpkg/buildtrees - key: ${{ steps.restore-vcpkg-cache.outputs.cache-primary-key }} + 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' }} @@ -431,6 +413,7 @@ jobs: 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 @@ -447,14 +430,14 @@ jobs: rm -r clang* } Add-Content -Path $env:GITHUB_PATH -Value "D:\a\rpcs3\rpcs3\llvm-${{ matrix.llvmver }}\bin" - C:\PROGRA~1\LLVM\bin\clang-cl.exe --version + - 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 @@ -472,7 +455,7 @@ jobs: .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: | diff --git a/3rdparty/OpenAL/openal-soft b/3rdparty/OpenAL/openal-soft index 9c50193236..0e5e98e4ac 160000 --- a/3rdparty/OpenAL/openal-soft +++ b/3rdparty/OpenAL/openal-soft @@ -1 +1 @@ -Subproject commit 9c50193236ad4d8c68f390a3151f8253709baabd +Subproject commit 0e5e98e4ac8adae92e4f7653dd6eee17aa9c8791 diff --git a/3rdparty/asmjit/CMakeLists.txt b/3rdparty/asmjit/CMakeLists.txt index ae88ce2fe8..dbbf85f362 100644 --- a/3rdparty/asmjit/CMakeLists.txt +++ b/3rdparty/asmjit/CMakeLists.txt @@ -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... diff --git a/3rdparty/cubeb/CMakeLists.txt b/3rdparty/cubeb/CMakeLists.txt index 6d1f231f0b..427bb0eff5 100644 --- a/3rdparty/cubeb/CMakeLists.txt +++ b/3rdparty/cubeb/CMakeLists.txt @@ -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 diff --git a/3rdparty/libusb/config.cmake b/3rdparty/libusb/config.cmake index 1a9833eb9b..4349b86262 100644 --- a/3rdparty/libusb/config.cmake +++ b/3rdparty/libusb/config.cmake @@ -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) diff --git a/3rdparty/yaml-cpp/CMakeLists.txt b/3rdparty/yaml-cpp/CMakeLists.txt index 0c123a37b8..41fdf4173c 100644 --- a/3rdparty/yaml-cpp/CMakeLists.txt +++ b/3rdparty/yaml-cpp/CMakeLists.txt @@ -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}) diff --git a/buildfiles/cmake/ConfigureCompiler.cmake b/buildfiles/cmake/ConfigureCompiler.cmake index 5fa1c589a1..1c1ba7139a 100644 --- a/buildfiles/cmake/ConfigureCompiler.cmake +++ b/buildfiles/cmake/ConfigureCompiler.cmake @@ -5,8 +5,7 @@ if(MSVC) 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 -mavx512f -mavx512vbmi -mavx512vl -mavx512dq -mavx512vpopcntdq -mavx -mavx2 -maes -mrtm -mpclmul -mmwaitx -mwaitpkg) - add_compile_options(-maes -mrtm -mpclmul -mmwaitx -mwaitpkg) + add_compile_options(-msse -msse2 -mcx16) endif() if(COMPILER_SUPPORTS_MARCH_NATIVE) add_compile_options(-march=native) diff --git a/rpcs3/Crypto/aesni.cpp b/rpcs3/Crypto/aesni.cpp index cb09b22378..e75333c249 100644 --- a/rpcs3/Crypto/aesni.cpp +++ b/rpcs3/Crypto/aesni.cpp @@ -35,6 +35,9 @@ #if defined(_MSC_VER) && defined(_M_X64) #define POLARSSL_HAVE_MSVC_X64_INTRINSICS #include +#ifdef __clang__ +#include +#endif #endif /* diff --git a/rpcs3/Emu/Memory/vm_reservation.h b/rpcs3/Emu/Memory/vm_reservation.h index 6ff9aa2376..61c3745d72 100644 --- a/rpcs3/Emu/Memory/vm_reservation.h +++ b/rpcs3/Emu/Memory/vm_reservation.h @@ -171,7 +171,7 @@ namespace vm auto stamp0 = utils::get_tsc(), stamp1 = stamp0, stamp2 = stamp0; -#ifndef _MSC_VER +#if !defined(_MSC_VER) || (defined(__clang__) && defined(_MSC_VER)) __asm__ goto ("xbegin %l[stage2];" ::: "memory" : stage2); #else status = _xbegin(); @@ -180,7 +180,7 @@ namespace vm { if (res & rsrv_unique_lock) { -#ifndef _MSC_VER +#if !defined(_MSC_VER) || (defined(__clang__) && defined(_MSC_VER)) __asm__ volatile ("xend; mov $-1, %%eax;" ::: "memory"); #else _xend(); @@ -192,7 +192,7 @@ namespace vm { std::invoke(op, *sptr); const u64 old_time = res.fetch_add(128); -#ifndef _MSC_VER +#if !defined(_MSC_VER) || (defined(__clang__) && defined(_MSC_VER)) __asm__ volatile ("xend;" ::: "memory"); #else _xend(); @@ -206,7 +206,7 @@ namespace vm if (auto result = std::invoke(op, *sptr)) { const u64 old_time = res.fetch_add(128); -#ifndef _MSC_VER +#if !defined(_MSC_VER) || (defined(__clang__) && defined(_MSC_VER)) __asm__ volatile ("xend;" ::: "memory"); #else _xend(); @@ -247,7 +247,7 @@ namespace vm break; } -#ifndef _MSC_VER +#if !defined(_MSC_VER) || (defined(__clang__) && defined(_MSC_VER)) __asm__ goto ("xbegin %l[retry];" ::: "memory" : retry); #else status = _xbegin(); @@ -260,7 +260,7 @@ namespace vm if constexpr (std::is_void_v>) { std::invoke(op, *sptr); -#ifndef _MSC_VER +#if !defined(_MSC_VER) || (defined(__clang__) && defined(_MSC_VER)) __asm__ volatile ("xend;" ::: "memory"); #else _xend(); @@ -274,7 +274,7 @@ namespace vm { if (auto result = std::invoke(op, *sptr)) { -#ifndef _MSC_VER +#if !defined(_MSC_VER) || (defined(__clang__) && defined(_MSC_VER)) __asm__ volatile ("xend;" ::: "memory"); #else _xend(); @@ -286,7 +286,7 @@ namespace vm } else { -#ifndef _MSC_VER +#if !defined(_MSC_VER) || (defined(__clang__) && defined(_MSC_VER)) __asm__ volatile ("xend;" ::: "memory"); #else _xend(); diff --git a/rpcs3/Emu/RSX/Common/BufferUtils.cpp b/rpcs3/Emu/RSX/Common/BufferUtils.cpp index d6ee2349d2..d0704e5ad6 100644 --- a/rpcs3/Emu/RSX/Common/BufferUtils.cpp +++ b/rpcs3/Emu/RSX/Common/BufferUtils.cpp @@ -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 diff --git a/rpcs3/Emu/RSX/Program/ProgramStateCache.cpp b/rpcs3/Emu/RSX/Program/ProgramStateCache.cpp index 5694ebf52f..32476dc62c 100644 --- a/rpcs3/Emu/RSX/Program/ProgramStateCache.cpp +++ b/rpcs3/Emu/RSX/Program/ProgramStateCache.cpp @@ -23,7 +23,6 @@ #endif #endif -//#ifdef _MSC_VER #if defined(_MSC_VER) && !defined(__clang__) #define AVX512_ICL_FUNC #else @@ -33,8 +32,7 @@ using namespace program_hash_util; -//#ifdef ARCH_X64 -#if defined(ARCH_X64) && !(defined(__clang__) && defined(_MSC_VER)) +#ifdef ARCH_X64 AVX512_ICL_FUNC usz get_vertex_program_ucode_hash_512(const RSXVertexProgram &program) { // Load all elements of the instruction_mask bitset @@ -426,8 +424,7 @@ vertex_program_utils::vertex_program_metadata vertex_program_utils::analyse_vert usz vertex_program_storage_hash::operator()(const RSXVertexProgram &program) const { -//#ifdef ARCH_X64 -#if defined(ARCH_X64) && !(defined(__clang__) && defined(_MSC_VER)) +#ifdef ARCH_X64 usz ucode_hash; if (utils::has_avx512_icl()) @@ -452,8 +449,7 @@ usz vertex_program_storage_hash::operator()(const RSXVertexProgram &program) con return rpcs3::hash64(ucode_hash, metadata_hash); } -//#ifdef ARCH_X64 -#if defined(ARCH_X64) && !(defined(__clang__) && defined(_MSC_VER)) +#ifdef ARCH_X64 AVX512_ICL_FUNC bool vertex_program_compare_512(const RSXVertexProgram &binary1, const RSXVertexProgram &binary2) { // Load all elements of the instruction_mask bitset @@ -544,8 +540,7 @@ bool vertex_program_compare::operator()(const RSXVertexProgram &binary1, const R return false; } -//#ifdef ARCH_X64 -#if defined(ARCH_X64) && !(defined(__clang__) && defined(_MSC_VER)) +#ifdef ARCH_X64 if (utils::has_avx512_icl()) { return vertex_program_compare_512(binary1, binary2); diff --git a/rpcs3/util/asm.hpp b/rpcs3/util/asm.hpp index 80d65cffc5..959df17e53 100644 --- a/rpcs3/util/asm.hpp +++ b/rpcs3/util/asm.hpp @@ -46,7 +46,7 @@ namespace utils for (auto stamp0 = get_tsc(), stamp1 = stamp0; g_use_rtm && stamp1 - stamp0 <= g_rtm_tx_limit1; stamp1 = get_tsc()) { -#ifndef _MSC_VER +#if !defined(_MSC_VER) || (defined(__clang__) && defined(_MSC_VER)) __asm__ goto ("xbegin %l[retry];" ::: "memory" : retry); #else status = _xbegin(); @@ -60,7 +60,7 @@ namespace utils if constexpr (std::is_void_v) { std::invoke(op); -#ifndef _MSC_VER +#if !defined(_MSC_VER) || (defined(__clang__) && defined(_MSC_VER)) __asm__ volatile ("xend;" ::: "memory"); #else _xend(); @@ -70,7 +70,7 @@ namespace utils else { auto result = std::invoke(op); -#ifndef _MSC_VER +#if !defined(_MSC_VER) || (defined(__clang__) && defined(_MSC_VER)) __asm__ volatile ("xend;" ::: "memory"); #else _xend(); diff --git a/rpcs3/util/sysinfo.cpp b/rpcs3/util/sysinfo.cpp index 52bb6f27b0..f7cb7b00cf 100755 --- a/rpcs3/util/sysinfo.cpp +++ b/rpcs3/util/sysinfo.cpp @@ -46,7 +46,7 @@ static inline std::array 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; diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 0000000000..9b5d53aaae --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,24 @@ +{ + "name": "rpcs3", + "version-string": "1.0", + "builtin-baseline": "b94ab47c998b93fe72b0f501eaac70f96328019e", + "dependencies": [ + { + "name": "ffmpeg", + "features": [ + "avcodec", + "avformat", + "swscale", + "swresample" + ] + }, + "libpng", + "opencv", + "qtbase", + "qtmultimedia", + "qtsvg", + "qttools", + "vulkan", + "zlib" + ] +}