PCSX2 Documentation/Compiling on Windows: Difference between revisions

Remove dx sdk info, no longer needed.
No edit summary
(Remove dx sdk info, no longer needed.)
Line 8: Line 8:


====Downloading additional prerequisites====
====Downloading additional prerequisites====
*[https://www.microsoft.com/en-us/download/details.aspx?id=6812 DirectX SDK (June 2010)]
*[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'')
*[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'')
*[https://www.7-zip.org/ 7-zip] ''(Optional) Helps avoid unnecessary software from being dropped by DirectX SDK installer''
*[https://nsis.sourceforge.io/Download Nullsoft Install System (Optional)] ''Only needed if you're compiling the Installer''
*[https://nsis.sourceforge.io/Download Nullsoft Install System (Optional)] ''Only needed if you're compiling the Installer''
*[https://nsis.sourceforge.io/Advanced_Uninstall_Log_NSIS_Header NSIS Advanced Uninstall Header] ''Only needed if you're compiling the Installer''
*[https://nsis.sourceforge.io/Advanced_Uninstall_Log_NSIS_Header NSIS Advanced Uninstall Header] ''Only needed if you're compiling the Installer''
Line 29: Line 27:
#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.
===Installing SDKs===
Recent revisions of PCSX2 only require DirectX SDK to compile successfully. OpenGL Extension Wrangler library becoming redistributable allowed its integration into the codebase. nVidia CG Toolkit, now defunct, its functionality has been replaced by a more popular shading language called GLSL. This shading language is now implemented in all graphics driver releases. 
====DirectX SDK====
DirectX SDK installer is a problematic peace of software as installers that drop unsolicited software on target machine behind user's back are nothing good mainly due to 2 reasons:
#the unsolicited software eats system resources, this is even more unpleasant if any of these unsolicited peaces of software is never used;
#in these days when IT security threats are at large any unsolicited software is equivalent to a collection of security holes.
Experimented with this installer on a [https://en.wikipedia.org/wiki/Virtual_machine virtual machine] and discovered it installs the following components without consent:
*.NET Framework v2.0
*Visual C++ 2008 Redistributable runtimes
*Visual C++ 2010 Redistributable runtimes
None of these software products are any more supported by Microsoft, meaning no more security patches and none of these are needed to build PCSX2. Bellow are described 2 ways of installing DirectX SDK, one secure and minimal and another easier but dirty and insecure.
=====Secure and minimal installation=====
#Download the DirectX SDK Web Installer and 7-zip;
#Install 7-zip with default settings, the installer in executable format it's by far the easiest to use and has minimum system footprint;
#Open 7-zip and navigate to folder where you downloaded DirectX SDK installer;
#Right click on the installer and Select 7-Zip - Open Inside, this opens the installer as an archive;
#Extract Lib and Include to a folder that will host DirectX SDK. If that folder doesn't exist it's going to be created;
#Set DirectX SDK environment variable (DXSDK_DIR).
======Setting DirectX SDK environment variable======
There is a large palette of possibilities of setting DirectX SDK environment variable (DXSDK_DIR):
*as system environment variable;
*as an environment variable for currently logged on user;
*programmatically.
There are some important conditions regarding the value of this environment variable:
*it must be an absolute folder path or an expression that evaluates to an absolute folder path;
*it must end with an extra "\".
Examples:
<source lang="powershell">
c:\dev\dep\dxsdk
..\dep\dxsdk
</source>
are both incorrect because they don't end with "\" and even more, the second one is not an absolute path.
<source lang="powershell">
c:\dev\dep\dxsdk\
</source>
is correct.
Now that we know what kind of value DXSDK_DIR must have, all that's left is to set it.
There are various guides online describing how to set an environment variable using various editions of Windows, so I will not enter in details, instead I'll describe a tip on how to easily set DXSDK_DIR programmatically using Git Bash.
This git client has 2 launchers: one with UNIX-like interface and another using Windows command prompt itself, both launchers being batch scripts. The one that interests us is the simpler batch file, that one that opens Windows Command Prompt.
 
Most of this batch script looks like this:
<source lang="powershell">
@rem Do not use "echo off" to not affect any child calls.
@setlocal
@rem Get the absolute path to the current directory, which is assumed to be the
@rem Git installation root.
@for /F "delims=" %%I in ("%~dp0") do @set git_install_root=%%~fI
@set PATH=%git_install_root%bin;%git_install_root%mingw\bin;%git_install_root%cmd;%PATH%
@if not exist "%HOME%" @set HOME=%HOMEDRIVE%%HOMEPATH%
@if not exist "%HOME%" @set HOME=%USERPROFILE%
@set PLINK_PROTOCOL=ssh
@if not defined TERM set TERM=msys
</source>
If both PCSX2 repository and git installation folder are under a common folder, and if we create a batch file with this source in that common folder, we can set DXSDK_DIR using git_install_root value.
For example we have a folder tree that looks like this:
<source lang="powershell">
c:\dev\dep    \
                dxsdk\
      git    \ 
      projects\     
                pcsx2\
</source>
*The batch file goes in c:\dev
*git_install_root variable value in this case is c:\dev\
We need to do some tweaks to our batch script in order to work:
*Thirst we have to adjust the line that customizes PATH. In this case just add git\ after %git_install_root% on all 3 spots;
*Append a code line where DXSDK_DIR is set:
<source lang="powershell">
@set DXSDK_DIR=%git_install_root%dep\dxsdk\
</source>
#Append a command that launches Visual Studio.
Finding the location of Visual Studio executable is easy. Just right click on Visual Studio Start Menu entry or Start screen tile (on Windows 8/8.1) and click properties. Grab the contents of the target field and past it in the batch file source. You can  insert an @ prior to that code to inhibit display output.
When ready proced to next step.
=====Standard (dirty and insecure installation)=====
#Remove any previous installations of "Microsoft Visual C++ 2010 Redistributable Packages". This is important otherwise the installation may fail.
#Download the Web Installer from the link above. Run it, and click next at the Welcome Screen (shown below.)
#Accept the EULA as shown.
#You will be prompted to join the Windows Customer Experience Improvement Program. I chose not to, but the decision is yours to make. It won't impact anything you'll be doing with the software.
#You will then be prompted for a destination folder, I recommend choosing the default to make life easier later on.
#You will be prompted with a list of components.Only headers and libs are needed to build PCSCX2, the rest are entirely subject to your choice if you need them. Then go ahead and click Next.
#The DirectX SDK will then begin installing.
#You should then be presented with this screen.
#Click finish and move on to the next step.
[[File:directxsdk1.jpg | frameless]]
[[File:directxsdk2.jpg | frameless]]
[[File:directxsdk3.jpg | frameless]]
[[File:directxsdk4.jpg | frameless]]
[[File:directxsdk5.jpg | frameless]]
[[File:directxsdk6.jpg | frameless]]
[[File:directxsdk7.jpg | frameless]]


==Configuring the Build Environment==
==Configuring the Build Environment==