diff --git a/.github/workflows/scripts/windows/build-dependencies.bat b/.github/workflows/scripts/windows/build-dependencies.bat new file mode 100644 index 0000000000..6690dbbfaf --- /dev/null +++ b/.github/workflows/scripts/windows/build-dependencies.bat @@ -0,0 +1,162 @@ +@echo off +setlocal enabledelayedexpansion + +echo Setting environment... +if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" ( + call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" +) else if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" ( + call "%ProgramFiles%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" +) else ( + echo Visual Studio 2022 not found. + goto error +) + +set SEVENZIP="C:\Program Files\7-Zip\7z.exe" + +if defined DEBUG ( + echo DEBUG=%DEBUG% +) else ( + set DEBUG=1 +) + +pushd %~dp0 +set "SCRIPTDIR=%CD%" +cd ..\..\..\.. +mkdir deps-build +cd deps-build || goto error +set "BUILDDIR=%CD%" +cd .. +mkdir deps +cd deps || goto error +set "INSTALLDIR=%CD%" +popd + +echo SCRIPTDIR=%SCRIPTDIR% +echo BUILDDIR=%BUILDDIR% +echo INSTALLDIR=%INSTALLDIR% + +cd "%BUILDDIR%" + +set QT=6.5.2 +set QTMINOR=6.5 +set SDL=SDL2-2.28.2 + +call :downloadfile "%SDL%.zip" "https://libsdl.org/release/%SDL%.zip" 22383a6b242bac072f949d2b3854cf04c6856cae7a87eaa78c60dd733b71e41e || goto error +call :downloadfile "qtbase-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qtbase-everywhere-src-%QT%.zip" f770a087e350d688441880d08ad2791465e5e3b9a0f8fc2cfbeb5dd305a11d50 || goto error +call :downloadfile "qtimageformats-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qtimageformats-everywhere-src-%QT%.zip" 9757899b00eea4e6b65f81f922c0215c70969661567398d91da6639a50a788e7 || goto error +call :downloadfile "qtsvg-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qtsvg-everywhere-src-%QT%.zip" 0546a6aa19f5e0188d1ba4a0e0a1423d22b7dc55ce8a614cc4aa65bfac506f74 || goto error +call :downloadfile "qttools-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qttools-everywhere-src-%QT%.zip" 3148f4f263bf9930d89107eb44bc452481a5f8c6178459e26ecbf3c8dca3b5c7 || goto error +call :downloadfile "qttranslations-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qttranslations-everywhere-src-%QT%.zip" 8b99046b54c40106d4e310be63b41331b717cfd8b42da4b4fc1c9169604be7fc || goto error + +if %DEBUG%==1 ( + echo Building debug and release libraries... +) else ( + echo Building release libraries... +) + +echo Building SDL... +rmdir /S /Q "%SDL%" +%SEVENZIP% x "%SDL%.zip" || goto error +cd "%SDL%" || goto error +if %DEBUG%==1 ( + cmake -B build-debug -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DBUILD_SHARED_LIBS=ON -DSDL_SHARED=ON -DSDL_STATIC=OFF -G Ninja || goto error + cmake --build build-debug --parallel || goto error + ninja -C build-debug install || goto error +) +cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DBUILD_SHARED_LIBS=ON -DSDL_SHARED=ON -DSDL_STATIC=OFF -G Ninja || goto error +cmake --build build --parallel || goto error +ninja -C build install || goto error +cd .. || goto error + +if %DEBUG%==1 ( + set QTBUILDSPEC=-DCMAKE_CONFIGURATION_TYPES="Release;Debug" -G "Ninja Multi-Config" +) else ( + set QTBUILDSPEC=-DCMAKE_BUILD_TYPE=Release -G Ninja +) + +echo Building Qt base... +rmdir /S /Q "qtbase-everywhere-src-%QT%" +%SEVENZIP% x "qtbase-everywhere-src-%QT%.zip" || goto error +cd "qtbase-everywhere-src-%QT%" || goto error +cmake -B build -DFEATURE_sql=OFF -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DINPUT_gui=yes -DINPUT_widgets=yes -DINPUT_ssl=yes -DINPUT_openssl=no -DINPUT_schannel=yes %QTBUILDSPEC% || goto error +cmake --build build --parallel || goto error +ninja -C build install || goto error +cd .. || goto error + +echo Building Qt SVG... +rmdir /S /Q "qtsvg-everywhere-src-%QT%" +%SEVENZIP% x "qtsvg-everywhere-src-%QT%.zip" || goto error +cd "qtsvg-everywhere-src-%QT%" || goto error +mkdir build || goto error +cd build || goto error +call "%INSTALLDIR%\bin\qt-configure-module.bat" .. || goto error +cmake --build . --parallel || goto error +ninja install || goto error +cd ..\.. || goto error + +echo Building Qt Image Formats... +rmdir /S /Q "qtimageformats-everywhere-src-%QT%" +%SEVENZIP% x "qtimageformats-everywhere-src-%QT%.zip" || goto error +cd "qtimageformats-everywhere-src-%QT%" || goto error +mkdir build || goto error +cd build || goto error +call "%INSTALLDIR%\bin\qt-configure-module.bat" .. || goto error +cmake --build . --parallel || goto error +ninja install || goto error +cd ..\.. || goto error + +echo Building Qt Tools... +rmdir /S /Q "qtimageformats-everywhere-src-%QT%" +%SEVENZIP% x "qttools-everywhere-src-%QT%.zip" || goto error +cd "qttools-everywhere-src-%QT%" || goto error +mkdir build || goto error +cd build || goto error +call "%INSTALLDIR%\bin\qt-configure-module.bat" .. -- -DFEATURE_assistant=OFF -DFEATURE_clang=OFF -DFEATURE_designer=OFF -DFEATURE_kmap2qmap=OFF -DFEATURE_pixeltool=OFF -DFEATURE_pkg_config=OFF -DFEATURE_qev=OFF -DFEATURE_qtattributionsscanner=OFF -DFEATURE_qtdiag=OFF -DFEATURE_qtplugininfo=OFF || goto error +cmake --build . --parallel || goto error +ninja install || goto error +cd ..\.. || goto error + +echo Building Qt Translations... +rmdir /S /Q "qttranslations-everywhere-src-%QT%" +%SEVENZIP% x "qttranslations-everywhere-src-%QT%.zip" || goto error +cd "qttranslations-everywhere-src-%QT%" || goto error +mkdir build || goto error +cd build || goto error +call "%INSTALLDIR%\bin\qt-configure-module.bat" .. || goto error +cmake --build . --parallel || goto error +ninja install || goto error +cd ..\.. || goto error + +echo Cleaning up... +cd .. +rd /S /Q deps-build + +echo Exiting with success. +exit 0 + +:error +echo Failed with error #%errorlevel%. +pause +exit %errorlevel% + +:downloadfile +if not exist "%~1" ( + echo Downloading %~1 from %~2... + curl -L -o "%~1" "%~2" || goto error +) + +rem based on https://gist.github.com/gsscoder/e22daefaff9b5d8ac16afb070f1a7971 +set idx=0 +for /f %%F in ('certutil -hashfile "%~1" SHA256') do ( + set "out!idx!=%%F" + set /a idx += 1 +) +set filechecksum=%out1% + +if /i %~3==%filechecksum% ( + echo Validated %~1. + exit /B 0 +) else ( + echo Expected %~3 got %filechecksum%. + exit /B 1 +) diff --git a/.github/workflows/windows_build_qt.yml b/.github/workflows/windows_build_qt.yml index 5267ea7428..e94ac2188f 100644 --- a/.github/workflows/windows_build_qt.yml +++ b/.github/workflows/windows_build_qt.yml @@ -29,14 +29,6 @@ on: required: false type: string default: "" - qt_binary_url: - required: false - type: string - default: https://github.com/PCSX2/pcsx2-windows-dependencies/releases/download/2023-04-25/qt-6.5.0-x64.7z - qt_dir: - required: false - type: string - default: 3rdparty\qt\6.5.0\msvc2022_64 patchesUrl: required: false type: string @@ -51,7 +43,7 @@ jobs: name: ${{ inputs.jobName }} runs-on: ${{ inputs.os }} # Set some sort of timeout in the event of run-away builds. We are limited on concurrent jobs so, get rid of them. - timeout-minutes: 60 + timeout-minutes: 90 env: POWERSHELL_TELEMETRY_OPTOUT: 1 @@ -84,27 +76,32 @@ jobs: if: inputs.configuration != 'CMake' uses: microsoft/setup-msbuild@v1 - - name: Download Qt build files - shell: cmd - run: | - cd 3rdparty\qt - aria2c ${{ inputs.qt_binary_url }} - 7z x qt-*-x64.7z - del qt-*-x64.7z - - name: Download patches shell: cmd run: | cd bin/resources aria2c -Z "${{ inputs.patchesUrl }}/patches.zip" + - name: Cache Dependencies + id: cache-deps + uses: actions/cache@v3 + with: + path: deps + key: ${{ inputs.os }} ${{ inputs.platform }} deps ${{ hashFiles('.github/workflows/scripts/windows/build-dependencies.bat') }} + + - name: Build Dependencies + if: steps.cache-deps.outputs.cache-hit != 'true' + env: + DEBUG: 0 + run: .github/workflows/scripts/windows/build-dependencies.bat + - name: Generate CMake if: inputs.configuration == 'CMake' id: cmake shell: cmd run: | call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" - cmake . -B build ${{ inputs.cmakeFlags }} "-DCMAKE_PREFIX_PATH=%cd%\${{ inputs.qt_dir }}" -DQT_BUILD=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -DDISABLE_ADVANCE_SIMD=ON -G Ninja + cmake . -B build ${{ inputs.cmakeFlags }} "-DCMAKE_PREFIX_PATH=%cd%\deps" -DQT_BUILD=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -DDISABLE_ADVANCE_SIMD=ON -G Ninja - name: Build PCSX2 shell: cmd diff --git a/PCSX2_qt.sln b/PCSX2_qt.sln index b065371cf1..7b2867110b 100644 --- a/PCSX2_qt.sln +++ b/PCSX2_qt.sln @@ -39,8 +39,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ryml", "3rdparty\rapidyaml\ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "glslang", "3rdparty\glslang\glslang.vcxproj", "{EF6834A9-11F3-4331-BC34-21B325ABB180}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL", "3rdparty\sdl2\SDL.vcxproj", "{812B4434-FD6B-4CB2-8865-5FD8EB34B046}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libzip", "3rdparty\libzip\libzip.vcxproj", "{20B2E9FE-F020-42A0-B324-956F5B06EA68}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zstd", "3rdparty\zstd\zstd.vcxproj", "{52244028-937A-44E9-A76B-2BEA18FD239A}" @@ -489,30 +487,6 @@ Global {EF6834A9-11F3-4331-BC34-21B325ABB180}.Release Clang|x64.Build.0 = Release Clang|x64 {EF6834A9-11F3-4331-BC34-21B325ABB180}.Release|x64.ActiveCfg = Release|x64 {EF6834A9-11F3-4331-BC34-21B325ABB180}.Release|x64.Build.0 = Release|x64 - {812B4434-FD6B-4CB2-8865-5FD8EB34B046}.Debug AVX2|x64.ActiveCfg = Debug|x64 - {812B4434-FD6B-4CB2-8865-5FD8EB34B046}.Debug AVX2|x64.Build.0 = Debug|x64 - {812B4434-FD6B-4CB2-8865-5FD8EB34B046}.Debug Clang AVX2|x64.ActiveCfg = Debug Clang|x64 - {812B4434-FD6B-4CB2-8865-5FD8EB34B046}.Debug Clang AVX2|x64.Build.0 = Debug Clang|x64 - {812B4434-FD6B-4CB2-8865-5FD8EB34B046}.Debug Clang|x64.ActiveCfg = Debug Clang|x64 - {812B4434-FD6B-4CB2-8865-5FD8EB34B046}.Debug Clang|x64.Build.0 = Debug Clang|x64 - {812B4434-FD6B-4CB2-8865-5FD8EB34B046}.Debug|x64.ActiveCfg = Debug|x64 - {812B4434-FD6B-4CB2-8865-5FD8EB34B046}.Debug|x64.Build.0 = Debug|x64 - {812B4434-FD6B-4CB2-8865-5FD8EB34B046}.Devel AVX2|x64.ActiveCfg = Devel|x64 - {812B4434-FD6B-4CB2-8865-5FD8EB34B046}.Devel AVX2|x64.Build.0 = Devel|x64 - {812B4434-FD6B-4CB2-8865-5FD8EB34B046}.Devel Clang AVX2|x64.ActiveCfg = Devel Clang|x64 - {812B4434-FD6B-4CB2-8865-5FD8EB34B046}.Devel Clang AVX2|x64.Build.0 = Devel Clang|x64 - {812B4434-FD6B-4CB2-8865-5FD8EB34B046}.Devel Clang|x64.ActiveCfg = Devel Clang|x64 - {812B4434-FD6B-4CB2-8865-5FD8EB34B046}.Devel Clang|x64.Build.0 = Devel Clang|x64 - {812B4434-FD6B-4CB2-8865-5FD8EB34B046}.Devel|x64.ActiveCfg = Devel|x64 - {812B4434-FD6B-4CB2-8865-5FD8EB34B046}.Devel|x64.Build.0 = Devel|x64 - {812B4434-FD6B-4CB2-8865-5FD8EB34B046}.Release AVX2|x64.ActiveCfg = Release|x64 - {812B4434-FD6B-4CB2-8865-5FD8EB34B046}.Release AVX2|x64.Build.0 = Release|x64 - {812B4434-FD6B-4CB2-8865-5FD8EB34B046}.Release Clang AVX2|x64.ActiveCfg = Release Clang|x64 - {812B4434-FD6B-4CB2-8865-5FD8EB34B046}.Release Clang AVX2|x64.Build.0 = Release Clang|x64 - {812B4434-FD6B-4CB2-8865-5FD8EB34B046}.Release Clang|x64.ActiveCfg = Release Clang|x64 - {812B4434-FD6B-4CB2-8865-5FD8EB34B046}.Release Clang|x64.Build.0 = Release Clang|x64 - {812B4434-FD6B-4CB2-8865-5FD8EB34B046}.Release|x64.ActiveCfg = Release|x64 - {812B4434-FD6B-4CB2-8865-5FD8EB34B046}.Release|x64.Build.0 = Release|x64 {20B2E9FE-F020-42A0-B324-956F5B06EA68}.Debug AVX2|x64.ActiveCfg = Debug|x64 {20B2E9FE-F020-42A0-B324-956F5B06EA68}.Debug AVX2|x64.Build.0 = Debug|x64 {20B2E9FE-F020-42A0-B324-956F5B06EA68}.Debug Clang AVX2|x64.ActiveCfg = Debug Clang|x64 @@ -808,7 +782,6 @@ Global {BF74C473-DC04-44B3-92E8-4145F4E77342} = {78EBE642-7A4D-4EA7-86BE-5639C6646C38} {DE9653B6-17DD-356A-9EE0-28A731772587} = {78EBE642-7A4D-4EA7-86BE-5639C6646C38} {EF6834A9-11F3-4331-BC34-21B325ABB180} = {78EBE642-7A4D-4EA7-86BE-5639C6646C38} - {812B4434-FD6B-4CB2-8865-5FD8EB34B046} = {78EBE642-7A4D-4EA7-86BE-5639C6646C38} {20B2E9FE-F020-42A0-B324-956F5B06EA68} = {78EBE642-7A4D-4EA7-86BE-5639C6646C38} {52244028-937A-44E9-A76B-2BEA18FD239A} = {78EBE642-7A4D-4EA7-86BE-5639C6646C38} {D45CEC7A-3171-40DD-975D-E1544CF16139} = {78EBE642-7A4D-4EA7-86BE-5639C6646C38} diff --git a/common/vsprops/QtCompile.props b/common/vsprops/QtCompile.props index 954f2028bc..6e220d2df4 100644 --- a/common/vsprops/QtCompile.props +++ b/common/vsprops/QtCompile.props @@ -1,12 +1,12 @@ - $(SolutionDir)bin\ - $(SolutionDir)3rdparty\qt\6.5.0\msvc2022_64\ - $(SolutionDir)3rdparty\qt\6.5.0\msvc2022_arm64\ + $(SolutionDir)bin\ + $(SolutionDir)deps\ + $(SolutionDir)deps-arm64\ $(PCSX2QTDIRDefault) $(PCSX2QTDIR)\ - $(SolutionDir)3rdparty\qt\6.5.0\msvc2022_64\ + $(SolutionDir)deps\ false true $(PCSX2QTDIR)include\ @@ -17,7 +17,7 @@ $(PCSX2QTDIR)translations\ $(IntDir) $(QtToolOutDir)moc_ - $(BinaryOutputDir)translations\ + $(QtBinaryOutputDir)translations\ d $(QtDebugSuffix) QtPlugins @@ -85,11 +85,11 @@ BeforeTargets="ClCompile" Condition="'@(QtMoc)'!=''" Inputs="%(QtMoc.Identity);%(QtMoc.AdditionalDependencies);$(MSBuildProjectFile)" - Outputs="$(QtToolOutDir)moc_%(QtMoc.Filename).cpp"> - + Outputs="$(QtToolOutDir)%(QtMoc.RelativeDir)moc_%(QtMoc.Filename).cpp"> + - - + + @@ -124,22 +124,22 @@ - + - + - $(BinaryOutputDir)qt.conf + $(QtBinaryOutputDir)qt.conf + Outputs="@(QtDlls -> '$(QtBinaryOutputDir)%(RecursiveDir)%(Filename)%(Extension)');@(QtPluginsDest);@(QtTLSDllsDest)"> + + + $(SolutionDir)bin\ + $(SolutionDir)deps\ + $(SolutionDir)deps-arm64\ + + d + + + + $(SDL2Dir)include\SDL2;%(AdditionalIncludeDirectories) + + + $(SDL2Dir)lib;%(AdditionalLibraryDirectories) + SDL2$(SDL2LibSuffix).lib;%(AdditionalDependencies) + + + $(SDL2Dir)lib;%(AdditionalLibraryDirectories) + SDL2$(SDL2LibSuffix).lib;%(AdditionalDependencies) + + + + + + + + + + + + diff --git a/pcsx2-qt/pcsx2-qt.vcxproj b/pcsx2-qt/pcsx2-qt.vcxproj index 9c036502e3..e4542a59b5 100644 --- a/pcsx2-qt/pcsx2-qt.vcxproj +++ b/pcsx2-qt/pcsx2-qt.vcxproj @@ -23,6 +23,7 @@ + @@ -418,4 +419,4 @@ - \ No newline at end of file + diff --git a/pcsx2/pcsx2.vcxproj b/pcsx2/pcsx2.vcxproj index b7b5da67a4..6a97b323ea 100644 --- a/pcsx2/pcsx2.vcxproj +++ b/pcsx2/pcsx2.vcxproj @@ -21,6 +21,7 @@ + @@ -864,9 +865,6 @@ {6d5b5ad9-1525-459b-939f-a5e1082af6b3} - - {812b4434-fd6b-4cb2-8865-5fd8eb34b046} - {4639972e-424e-4e13-8b07-ca403c481346}