1 ![Kodi Logo](resources/banner_slim.png)
4 This guide has been tested with Windows 10 Pro x64, version 22H2, build 19045.4529. Please read it in full before you proceed to familiarize yourself with the build procedure.
7 1. **[Document conventions](#1-document-conventions)**
8 2. **[Prerequisites](#2-prerequisites)**
9 3. **[Get the source code](#3-get-the-source-code)**
10 4. **[Set up the build environment](#4-set-up-the-build-environment)**
11 5. **[Build Kodi automagically](#5-build-kodi-automagically)**
12 6. **[Build Kodi manually](#6-build-kodi-manually)**
14 ## 1. Document conventions
15 This guide assumes you are using `Developer Command Prompt for VS 2022`, also known as `terminal`, `console`, `command-line` or simply `cli`. Commands need to be run at the terminal, one at a time and in the provided order.
17 This is a comment that provides context:
20 this is another command
24 **Example:** Clone Kodi's current master branch:
26 git clone https://github.com/xbmc/xbmc kodi
29 Commands that contain strings enclosed in angle brackets denote something you need to change to suit your needs.
31 git clone -b <branch-name> https://github.com/xbmc/xbmc kodi
34 **Example:** Clone Kodi's current Matrix branch:
36 git clone -b Matrix https://github.com/xbmc/xbmc kodi
39 Several different strategies are used to draw your attention to certain pieces of information. In order of how critical the information is, these items are marked as a note, tip, or warning. For example:
42 > Linux is user friendly... It's just very particular about who its friends are.
45 > Algorithm is what developers call code they do not want to explain.
48 > Developers don't change light bulbs. It's a hardware problem.
50 **[back to top](#table-of-contents)** | **[back to section top](#1-document-conventions)**
54 * **Windows** 64bit OS, Windows 8.1 or above (allows build of x64, win32, uwp, arm)
55 * **[CMake](https://cmake.org/download/)** (version 3.20 or greater is required to build Kodi, version 3.21 or greater to build with Visual Studio 2022)
56 * **[Git for Windows](https://gitforwindows.org/)**
57 * **[Java Runtime Environment (JRE)](http://www.oracle.com/technetwork/java/javase/downloads/index.html)**
58 * **[Nullsoft scriptable install system (NSIS)](http://nsis.sourceforge.net/Download)** (Only needed if you want to generate an installer file)
59 * **[Visual Studio 2022](https://visualstudio.microsoft.com/downloads/)** or **[Visual Studio 2019](https://visualstudio.microsoft.com/vs/older-downloads/)** (Community Edition is fine)
61 To run Kodi you need a relatively recent CPU with integrated GPU or discrete GPU with up-to-date graphics device-drivers installed from the manufacturer's website.
62 * **[AMD](https://support.amd.com/en-us/download)**
63 * **[Intel](https://downloadcenter.intel.com/product/80939/Graphics-Drivers)**
64 * **[NVIDIA](http://www.nvidia.com/Download/index.aspx)**
66 ### CMake install notes
67 All install screens should remain at their default values with the exception of the following.
68 * Under **Install options** change default to `Add CMake to system PATH for all users` or `Add CMake to system PATH for current user` (whichever you prefer).
70 ### Git for Windows install notes
71 All install screens should remain at their default values with the exception of the following two.
72 * Under **Choosing the default editor used by Git** change default to `Use Notepad++ as Git's default editor` or your favorite editor.
73 * Under **Adjust your PATH environment** change default to `Use Git and optional Unix tools from the Windows Command Prompt`.
76 Default options are fine.
77 After install finishes, add java's executable file path to your `PATH` **[environment variable](http://www.java.com/en/download/help/path.xml)**. Should be similar to `C:\Program Files\Java\jre1.8.0_311\bin`.
79 ### NSIS install notes
80 Default options are fine.
82 ### Visual Studio 2022/2019 install notes
83 Start the Visual Studio installer and click **Workloads** select
84 * Under **Desktop & Mobile** section select
85 * `Desktop development with C++`
86 * Select the optional element Windows 11 SDK (10.0.22621.0)
87 * `Universal Windows Platform development` (if compiling for UWP or UWP-ARM)
89 Click in **Individual components** select
90 * Under **Compilers, build tools and runtimes** section select
91 * `MSVC v142/3 - VS 2019/22 C++ ARM build tools (Latest)` (if compiling for UWP-ARM)
93 Hit `Install`. Yes, it will download and install almost 8GB of stuff for x64 only or up to 20GB if everything is selected for UWP / UWP-ARM as well.
95 **[back to top](#table-of-contents)** | **[back to section top](#2-prerequisites)**
97 ## 3. Get the source code
98 Change to your `home` directory:
103 Clone Kodi's current master branch:
105 git clone https://github.com/xbmc/xbmc kodi
108 **[back to top](#table-of-contents)**
110 ## 4. Set up the build environment
111 To set up the build environment, several scripts must be called.
114 > The scripts may fail if you have a space in the path to the bat files.
116 Kodi can be built as either a normal 32bit or 64bit program, UWP 32bit and 64bit and UWP ARM 32bit. Unless there is a reason to prefer 32bit builds, we advise you to build Kodi for 64bit.
119 > Look for comments starting with `Or ...` and only execute the command(s) you need.
121 Change to the 64bit build directory (**recommended**):
123 cd %userprofile%\kodi\tools\buildsteps\windows\x64
126 Or change to the 32bit build directory:
128 cd %userprofile%\kodi\tools\buildsteps\windows\win32
131 Or change to the UWP 64bit build directory:
133 cd %userprofile%\kodi\tools\buildsteps\windows\x64-uwp
136 Or change to the UWP 32bit build directory:
138 cd %userprofile%\kodi\tools\buildsteps\windows\win32-uwp
141 Or change to the UWP ARM 32bit build directory:
143 cd %userprofile%\kodi\tools\buildsteps\windows\arm-uwp
146 Download dependencies:
148 download-dependencies.bat
152 > Look for the `All formed packages ready!` success message. If you see the message `ERROR: Not all formed packages are ready!`, execute the command again until you see the success message.
154 Download and setup the build environment for libraries:
164 **[back to top](#table-of-contents)** | **[back to section top](#4-set-up-the-build-environment)**
166 ## 5. Build Kodi automagically
167 If all you want is to build a Kodi package ready to install, execute the command below and you're done. If you want to find out more about building, ignore this step and continue reading. Or execute the command below, grab some coffee and keep reading. Building takes a while anyway.
169 Build a package ready to install:
174 *Normal* 32bit and 64bit builds generate an `exe` file ready to run, located at `%userprofile%\kodi\kodi-build\Debug` or `%userprofile%\kodi\kodi-build\Release`, depending on the build config. An installer `exe` file, located at `%userprofile%\kodi\project\Win32BuildSetup`, is also generated.
176 UWP builds generate `msix`, `appxsym` and `cer` files, located at `%userprofile%\kodi\project\UWPBuildSetup`. You can install them following this **[guide](https://kodi.wiki/view/HOW-TO:Install_Kodi_for_Universal_Windows_Platform)**.
179 > To generate an exact replica of the official Kodi Windows installer, some additional steps are required:
181 Build built-in add-ons (peripheral.joystick only) with command line:
183 make-addons.bat peripheral.joystick
186 Build the installer with the command line:
188 BuildSetup.bat nobinaryaddons clean
191 `BuildSetup.bat` without parameters also builds all the Kodi add-ons that are not needed because they are not included in the installer and the process is very time consuming.
193 **[back to top](#table-of-contents)**
195 ## 6. Build Kodi manually
196 Change to your `home` directory:
201 Create an out-of-source build directory:
206 Change to build directory:
211 Configure build for 64bit (**recommended**):
213 cmake -G "Visual Studio 17 2022" -A x64 -T host=x64 %userprofile%\kodi
216 Or configure build for 32bit:
218 cmake -G "Visual Studio 17 2022" -A Win32 -T host=x64 %userprofile%\kodi
221 Or configure build for UWP 64bit:
223 cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 -T host=x64 %userprofile%\kodi
226 Or configure build for UWP 32bit:
228 cmake -G "Visual Studio 17 2022" -A Win32 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 -T host=x64 %userprofile%\kodi
231 Or configure build for UWP ARM 32bit:
233 cmake -G "Visual Studio 17 2022" -A ARM -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 -T host=x64 %userprofile%\kodi
236 **Visual Studio 2019:**
240 -G "Visual Studio 17 2022"
245 -G "Visual Studio 16 2019"
249 Build a `Debug` binary:
251 cmake --build . --config "Debug"
254 Or build a `Release` binary:
256 cmake --build . --config "Release"
259 *Normal* 32bit and 64bit builds generate an `exe` file ready to run, located at `%userprofile%\kodi-build\Debug` or `%userprofile%\kodi-build\Release`, depending on the build config.
260 UWP builds generate `msix`, `appxsym` and `cer` files, located inside directories at `%userprofile%\kodi-build\AppPackages\kodi\`. You can install them following this **[guide](https://kodi.wiki/view/HOW-TO:Install_Kodi_for_Universal_Windows_Platform)**.
263 **[back to top](#table-of-contents)** | **[back to section top](#6-build-kodi-manually)**