# Difference between revisions of "HOW-TO:Compile Kodi for Windows"

 Development Compiling HOW-TO:Compile Kodi for Windows

## 1 Prerequisites

### 1.1 Software

Below is a list of the required software to complete a successful compile on Windows.

• An x86 computer with supported operating-system (Vista, Windows 7 x64/x32 bit and up should all work) installed
• Correctly installed graphics device-drivers from the manufacturer's website, (the latest is often the best choice).
• Kodi v16 and lower: Visual C++ 2013 (express edition is fine). Higher version might require some adjustments. You need at least update 2 to be applied to your installation, update 5 recommended
• Kodi v17 and up: Visual Studio 2015 (Community edition is fine). Higher version might require some adjustments. You need at least update 3 to be applied to your installation
• It's possible to use Visual Studio 2017 if you install some 2015 Tools as well:
• select "Individual components" during install, then tick "Visual C++ tools for CMake" and "VC++ 2015.3 v140 toolset for Desktop (x86,x64)" - all other required components will be automatically installed.
• Install MSBuild 2015 "Visual C++ Build Tools 2015"
• When using Visual Studio 2015, make sure to select a custom setup during installation and select C++ tools and and the Windows 10 SDK:
• Install Windows SDK version 10.0.14393 as well

.

• Microsoft DirectX SDK dated August 2009 or later (Obsolete with Kodi 16.0)
• Download the June 2010 version here
• Git for Windows 2.x
• Nullsoft scriptable install system (required for building the installer with buildsetup.bat)
• Java Runtime Environment (JRE)
• Add the path to the directory containing the java executable (java.exe) to your PATH environment variable see here
• A git client for Windows, for example TortoiseGit available here.
• Install CMake
• For debugging on Windows 10, install Graphics Tools. Press Win+I then System. > Apps & features -> Manage optional features -> Add a feature then select Graphics tools.

## 2 Git

Git is a distributed revision control system (think Subversion, but with a central repository for each person) help.github.com is a good place to familiarize yourself with basic Git usage.

### 2.1 $git clone command line This guide assumes a basic understanding of the command line and the Git commands The XBMC source code will be installed to C:/Users/Username/Documents. You should use a different directory (i.e. C:\XBMC) and adjust this guide accordingly if any of the following conditions are true: • Your Windows username has a space in it • You wish to use a different directory (no spaces) If you are familiar with cloning a repository from GitHub, then skip to the next section. Otherwise, these steps (based on the guide at http://help.github.com/forking) will get you up and running. Additionally, more information can be found at Git Usage. 1. Create a free GitHub account, generate a SSH key for yourself and set your user and email in git. 2. Visit the central XBMC project page and click the Fork button. This will put your own personal fork of XBMC in your list of public repos. 3. Launch Git Bash and cd into Documents ($ cd Documents)
4. Clone the new fork of XBMC locally ($git clone [email protected]:gituser/xbmc.git). Note the use of the fork's private URL. Sit back, as this will download about a gigabyte of data.$ git clone [email protected]:garbear/xbmc.git
Cloning into xbmc...
Enter passphrase for key '/c/Users/Garbear/.ssh/id_rsa':
remote: Counting objects: 468274, done.
remote: Compressing objects: 100% (111888/111888), done.
remote: Total 468274 (delta 351100), reused 467072 (delta 350219)
Receiving objects: 100% (468274/468274), 1022.39 MiB | 488 KiB/s, done.
Resolving deltas: 100% (351100/351100), done.
5. When your clone completes, you will have created a remote named "origin" that points to your fork on GitHub (not to the original XBMC repo). To keep track of the original XBMC repo, cd into the xbmc directory ($cd xbmc) and add another remote named "upstream" ($ git remote add upstream git://github.com/xbmc/xbmc.git). Note that upstream uses the public clone URL, so we can't push changes directly to XBMC.

### 2.2 TortoiseGit

• Before starting you must read the following page: Git Usage
• Right click in a directory of your choice and select Git Clone...
• Enter git://github.com/xbmc/xbmc.git for the Url.
Note: there are many ways to setup a local git repository. See Git Usage for more details or git tutorials on the internet for advanced uses.
• Enter a name (e:\Coding\Windows\xbmc for example) for the destination directory into Directory
Note: choose a path and destination directory with no space characters. Some build scripts can't handle them.
• Sit back and eat a sandwich. Downloading the source could take around 20 minutes or more (expect about 400 MB).

## 3 Setting up the build Environment

To setup the build environment, several scripts must be called. The scripts may fail if you have a space in the path to the bat files.
Even though not required for all scripts, using the Developer Command Prompt for Visual Studio is advised to ensure a proper PATH environment.

You now have the option to build Kodi v18 as either a 32 bit or 64 bit program. This requires separate directories as follows:

• The 32 bit build is located in the folder- tools\buildsteps\windows\win32
• The 64 bit build is located in the folder- tools\buildsteps\windows\x64

The following information applies to both versions: