PCSX2 Documentation/Compiling on Windows: Difference between revisions

Line 111: Line 111:
#Extract Lib and Include to a folder that will host DirectX SDK. If that folder doesn't exist it's going to be created;
#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).
#Set DirectX SDK environment variable (DXSDK_DIR).
======Setting DirectX SDK environment variable======         
======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 it 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\
</code>
#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. You can  insert an "@" prior to that code to inhibit screen output.
 
=====Standard (dirty and insecure installation)=====
=====Standard (dirty and insecure installation)=====
#Download the Web Installer from the link above. Run it, and click next at the Welcome Screen (shown below.)
#Download the Web Installer from the link above. Run it, and click next at the Welcome Screen (shown below.)
ninja
34

edits