PCSX2 Documentation/Compiling on Windows: Difference between revisions
(Remove "Files Necessary from Build for PCSX2's Execution" Section - That's also been outdated for a while.) |
No edit summary |
||
(7 intermediate revisions by 2 users not shown) | |||
Line 4: | Line 4: | ||
===Downloading the Prerequisites=== | ===Downloading the Prerequisites=== | ||
====Downloading build environment==== | ====Downloading build environment==== | ||
First you have to download a build environment. Microsoft Visual Studio | First you have to download a build environment. Microsoft Visual Studio 2022, 2019 and 2017 are capable of compiling PCSX2. At this time, the recommended build environment is Visual Studio 2019 Community. | ||
*[ | *[https://visualstudio.microsoft.com/downloads/ Visual Studio 2022 - Various Editions] | ||
====Downloading additional prerequisites==== | ====Downloading additional prerequisites==== | ||
*[ | *[https://git-scm.com/downloads Git For Windows] also called Git bash or msysgit (''Recommended but not required - though you will need a Git client'') | ||
A Visual C++ redistributable runtime matching the build environment major release (''Only needed if you're compiling the Installer''): | A Visual C++ redistributable runtime matching the build environment major release (''Only needed if you're compiling the Installer''): | ||
*[ | *[https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads Visual C++ Redistributable Packages for Visual Studio 2022, 2019 and 2017] | ||
===Installing Microsoft Visual Studio=== | ===Installing Microsoft Visual Studio=== | ||
Microsoft Visual Studio | Microsoft Visual Studio 2022, 2019 and 2017 are capable of compiling PCSX2. Depending on whether or not you develop professionally, as well as other factors, you may or may not have access to a copy of Microsoft Visual Studio Professional. This guide will cover the installation and configuration of Visual Studio 2019 Community Windows Desktop. | ||
====Installing Visual Studio Community | ====Installing Visual Studio Community 2022==== | ||
Download Visual Studio Community | Download Visual Studio Community 2022 installer from the link above, and run it. | ||
# | #Run the installer. | ||
# | #Within Workloads tab make sure Desktop development with C++ is checked. | ||
#I recommend keeping the default installation location. Click Install. | #I recommend keeping the default installation location. Click Install. | ||
#The components will be downloaded | #The components will be downloaded and installed on your computer. | ||
#Once the installation has finished, you may be prompted to restart the system. | #Once the installation has finished, you may be prompted to restart the system. | ||
#Click Restart Now or Close depending on your situation. | #Click Restart Now or Close depending on your situation. | ||
==Getting the Source Code== | ==Getting the Source Code== | ||
Line 151: | Line 34: | ||
<source lang="powershell"> | <source lang="powershell"> | ||
cd /dev/projects | cd /dev/projects | ||
git clone https://github.com/PCSX2/pcsx2.git pcsx2 | git clone --recurse-submodules https://github.com/PCSX2/pcsx2.git pcsx2 | ||
</source> | </source> | ||
*enter repository | *enter repository | ||
Line 175: | Line 58: | ||
====Build Target Selection==== | ====Build Target Selection==== | ||
At the top of your screen, you will see a small drop down list which contains what is known as your "Build Target", as shown in the screenshot. | At the top of your screen, you will see a small drop down list which contains what is known as your "Build Target", as shown in the screenshot. | ||
This menu corresponds to the build of PCSX2 that you will be compiling. | This menu corresponds to the build of PCSX2 that you will be compiling. SSE4, AVX2 refer to CPU instruction sets. | ||
Once you have selected the Build Target, it is time to build the solution. You can either select the Build Menu from the top menu, and choose Build Solution, or use the appropriate shortcut key. | Once you have selected the Build Target, it is time to build the solution. You can either select the Build Menu from the top menu, and choose Build Solution, or use the appropriate shortcut key. | ||
This is the moment of truth! If you've followed the instructions properly, this process should finish with 0 errors. Warnings are usually nothing to worry about, so, as long as the solution compiles with 0 errors and you have the output files, you should be good to go. Congratulations! | This is the moment of truth! If you've followed the instructions properly, this process should finish with 0 errors. Warnings are usually nothing to worry about, so, as long as the solution compiles with 0 errors and you have the output files, you should be good to go. Congratulations! | ||
Line 184: | Line 67: | ||
If at first you don't succeed, retry the build, at least once. Visual Studio is notorious for spamming errors about files being in use, access denied, or errors returned from mt.exe. If this happens to you, or frankly in pretty much any other case, make sure to retry the build at least once to ensure you have a reproducible build failure! | If at first you don't succeed, retry the build, at least once. Visual Studio is notorious for spamming errors about files being in use, access denied, or errors returned from mt.exe. If this happens to you, or frankly in pretty much any other case, make sure to retry the build at least once to ensure you have a reproducible build failure! | ||
It is good practice to clean your build environment of Visual Studio build-process temporary files and post-build remnants of the solution if you encounter errors while building. This is a quick and painless process. To begin, open the PCSX2_suite.sln Solution file. Once Visual Studio has opened, select the build of PCSX2 that you are having trouble building from the Build Target dropdown (e.g. | It is good practice to clean your build environment of Visual Studio build-process temporary files and post-build remnants of the solution if you encounter errors while building. This is a quick and painless process. To begin, open the PCSX2_suite.sln Solution file. Once Visual Studio has opened, select the build of PCSX2 that you are having trouble building from the Build Target dropdown (e.g., SSE4, AVX2) Click on the Build menu and select Clean Solution from the list. Try to build again, and see if this solves your problem. | ||
When all else fails, the error log and output screens can be a wealth of information. Even if you're not a developer, you can look at the error log and extrapolate what files are involved in the error you're having. Once you know that, search for the files and see if any of them are in the directories that are supposed to be configured in the search paths -- if so, go verify in your VC++ Directories setting that you have properly entered the dependency directories. Mistyping the directory names, including the wrong directory, or overlooking a directory is one of the most common causes of build failure and can be easily and quickly fixed. If that doesn't work, post about your experiences on the PCSX2 forum under the relevant topic and someone should be able to help you out. | When all else fails, the error log and output screens can be a wealth of information. Even if you're not a developer, you can look at the error log and extrapolate what files are involved in the error you're having. Once you know that, search for the files and see if any of them are in the directories that are supposed to be configured in the search paths -- if so, go verify in your VC++ Directories setting that you have properly entered the dependency directories. Mistyping the directory names, including the wrong directory, or overlooking a directory is one of the most common causes of build failure and can be easily and quickly fixed. If that doesn't work, post about your experiences on the PCSX2 forum under the relevant topic and someone should be able to help you out. | ||
==Running PCSX2 from the Visual Studio Debugger== | ==Running PCSX2 from the Visual Studio Debugger== | ||
It is possible (and quite easy) to run PCSX2 from the Visual Studio Debugger, if you feel so compelled to do so. See below for instructions on how to do it for all supported version of Visual Studio. | It is possible (and quite easy) to run PCSX2 from the Visual Studio Debugger, if you feel so compelled to do so. See below for instructions on how to do it for all supported version of Visual Studio. | ||
Select build target from top, just like you would do to build PCSX2, then press F5 | Select build target from top, just like you would do to build PCSX2, then press F5. | ||
{{PCSX2 Documentation Navbox}} | {{PCSX2 Documentation Navbox}} |
Latest revision as of 16:08, 19 September 2022
Setting up the Build Environment
In order to compile PCSX2 you will need to configure a working build environment based on Microsoft's Visual Studio. There are some things to download, so I've placed links to them at the front of the guide so you can get everything you'll need at the first step.
Downloading the Prerequisites
Downloading build environment
First you have to download a build environment. Microsoft Visual Studio 2022, 2019 and 2017 are capable of compiling PCSX2. At this time, the recommended build environment is Visual Studio 2019 Community.
Downloading additional prerequisites
- Git For Windows also called Git bash or msysgit (Recommended but not required - though you will need a Git client)
A Visual C++ redistributable runtime matching the build environment major release (Only needed if you're compiling the Installer):
Installing Microsoft Visual Studio
Microsoft Visual Studio 2022, 2019 and 2017 are capable of compiling PCSX2. Depending on whether or not you develop professionally, as well as other factors, you may or may not have access to a copy of Microsoft Visual Studio Professional. This guide will cover the installation and configuration of Visual Studio 2019 Community Windows Desktop.
Installing Visual Studio Community 2022
Download Visual Studio Community 2022 installer from the link above, and run it.
- Run the installer.
- Within Workloads tab make sure Desktop development with C++ is checked.
- I recommend keeping the default installation location. Click Install.
- The components will be downloaded and installed on your computer.
- Once the installation has finished, you may be prompted to restart the system.
- Click Restart Now or Close depending on your situation.
Getting the Source Code
- Open your git client and clone PCSX2 repository located at: https://github.com/PCSX2/pcsx2.git
If using a command-line git client like Git Bash you have to do the followings:
- navigate to a folder that will host the repository;
- clone pcsx2 repository.
Example: <source lang="powershell"> cd /dev/projects git clone --recurse-submodules https://github.com/PCSX2/pcsx2.git pcsx2 </source>
- enter repository
<source lang="powershell"> cd pcsx2 </source>
- create a dev branch and switch to it (optional). Good git practices recommend to never develop in master branch.
<source lang="powershell"> git branch dev git checkout dev. </source> I named my working branch dev, but it can have any name. When ready proceed to next step.
Compiling PCSX2's Binary
You've now completed all of the "leg work" required in order to compile PCSX2 on your machine. Congratulations!
Compiling Git Builds of PCSX2
Open the PCSX2 directory you have downloaded the source code into (in this case, C:\Development\Project Source\PCSX2) and double-click on the solution file (PCSX2_suite.sln). This will open Visual Studio (if it is not already open) and you will see a screen similar to this.
Build Target Selection
At the top of your screen, you will see a small drop down list which contains what is known as your "Build Target", as shown in the screenshot. This menu corresponds to the build of PCSX2 that you will be compiling. SSE4, AVX2 refer to CPU instruction sets. Once you have selected the Build Target, it is time to build the solution. You can either select the Build Menu from the top menu, and choose Build Solution, or use the appropriate shortcut key. This is the moment of truth! If you've followed the instructions properly, this process should finish with 0 errors. Warnings are usually nothing to worry about, so, as long as the solution compiles with 0 errors and you have the output files, you should be good to go. Congratulations!
Effective Build Troubleshooting Steps
So, your build failed. What now? Even in the most perfect of circumstances, there is always the possibility that your build is going to fail for some reason or another. I've included a few things to try that should take care of almost all of the common compiling issues that users have.
If at first you don't succeed, retry the build, at least once. Visual Studio is notorious for spamming errors about files being in use, access denied, or errors returned from mt.exe. If this happens to you, or frankly in pretty much any other case, make sure to retry the build at least once to ensure you have a reproducible build failure!
It is good practice to clean your build environment of Visual Studio build-process temporary files and post-build remnants of the solution if you encounter errors while building. This is a quick and painless process. To begin, open the PCSX2_suite.sln Solution file. Once Visual Studio has opened, select the build of PCSX2 that you are having trouble building from the Build Target dropdown (e.g., SSE4, AVX2) Click on the Build menu and select Clean Solution from the list. Try to build again, and see if this solves your problem.
When all else fails, the error log and output screens can be a wealth of information. Even if you're not a developer, you can look at the error log and extrapolate what files are involved in the error you're having. Once you know that, search for the files and see if any of them are in the directories that are supposed to be configured in the search paths -- if so, go verify in your VC++ Directories setting that you have properly entered the dependency directories. Mistyping the directory names, including the wrong directory, or overlooking a directory is one of the most common causes of build failure and can be easily and quickly fixed. If that doesn't work, post about your experiences on the PCSX2 forum under the relevant topic and someone should be able to help you out.
Running PCSX2 from the Visual Studio Debugger
It is possible (and quite easy) to run PCSX2 from the Visual Studio Debugger, if you feel so compelled to do so. See below for instructions on how to do it for all supported version of Visual Studio.
Select build target from top, just like you would do to build PCSX2, then press F5.
|