1 ![Kodi Logo](resources/banner_slim.png)
4 This guide has been tested with Windows 10 Pro x64, version 21H2, build 19044.1415. 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:
41 **NOTE:** Linux is user friendly... It's just very particular about who its friends are.
42 **TIP:** Algorithm is what developers call code they do not want to explain.
43 **WARNING:** Developers don't change light bulbs. It's a hardware problem.
45 **[back to top](#table-of-contents)** | **[back to section top](#1-document-conventions)**
49 * **[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)
50 * **[Git for Windows](https://gitforwindows.org/)**
51 * **[Java Runtime Environment (JRE)](http://www.oracle.com/technetwork/java/javase/downloads/index.html)**
52 * **[Nullsoft scriptable install system (NSIS)](http://nsis.sourceforge.net/Download)** (Only needed if you want to generate an installer file)
53 * **[Visual Studio 2022](https://visualstudio.microsoft.com/downloads/)** or **[Visual Studio 2019](https://visualstudio.microsoft.com/vs/older-downloads/)** (Community Edition is fine)
55 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.
56 * **[AMD](https://support.amd.com/en-us/download)**
57 * **[Intel](https://downloadcenter.intel.com/product/80939/Graphics-Drivers)**
58 * **[NVIDIA](http://www.nvidia.com/Download/index.aspx)**
60 ### CMake install notes
61 All install screens should remain at their default values with the exception of the following.
62 * 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).
64 ### Git for Windows install notes
65 All install screens should remain at their default values with the exception of the following two.
66 * Under **Choosing the default editor used by Git** change default to `Use Notepad++ as Git's default editor` or your favorite editor.
67 * Under **Adjust your PATH environment** change default to `Use Git and optional Unix tools from the Windows Command Prompt`.
70 Default options are fine.
71 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`.
73 ### NSIS install notes
74 Default options are fine.
76 ### Visual Studio 2022/2019 install notes
77 Start the Visual Studio installer and click **Workloads** select
78 * Under **Desktop & Mobile** section select
79 * `Desktop development with C++`
80 * `Universal Windows Platform development` (if compiling for UWP or UWP-ARM)
82 Click in **Individual components** select
83 * Under **Compilers, build tools and runtimes** section select
84 * `MSVC v142/3 - VS 2019/22 C++ ARM build tools (Latest)` (if compiling for UWP-ARM)
85 * Under **SDKs, libraries, and frameworks** section select
86 * `Windows 10 SDK (10.0.18362.0)` (if compiling for UWP or UWP-ARM)
88 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.
90 **[back to top](#table-of-contents)** | **[back to section top](#2-prerequisites)**
92 ## 3. Get the source code
93 Change to your `home` directory:
98 Clone Kodi's current master branch:
100 git clone https://github.com/xbmc/xbmc kodi
103 **[back to top](#table-of-contents)**
105 ## 4. Set up the build environment
106 To set up the build environment, several scripts must be called.
108 **WARNING:** The scripts may fail if you have a space in the path to the bat files.
110 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.
112 **TIP:** Look for comments starting with `Or ...` and only execute the command(s) you need.
114 Change to the 64bit build directory (**recommended**):
116 cd %userprofile%\kodi\tools\buildsteps\windows\x64
119 Or change to the 32bit build directory:
121 cd %userprofile%\kodi\tools\buildsteps\windows\win32
124 Or change to the UWP 64bit build directory:
126 cd %userprofile%\kodi\tools\buildsteps\windows\x64-uwp
129 Or change to the UWP 32bit build directory:
131 cd %userprofile%\kodi\tools\buildsteps\windows\win32-uwp
134 Or change to the UWP ARM 32bit build directory:
136 cd %userprofile%\kodi\tools\buildsteps\windows\arm-uwp
139 Download dependencies:
141 download-dependencies.bat
143 **TIP:** 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.
145 Download and setup the build environment for libraries:
155 **[back to top](#table-of-contents)** | **[back to section top](#4-set-up-the-build-environment)**
157 ## 5. Build Kodi automagically
158 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.
160 Build a package ready to install:
165 *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.
167 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)**.
169 **NOTE:** To generate an exact replica of the official Kodi Windows installer, some additional steps are required:
171 Build built-in add-ons (peripheral.joystick only) with command line:
173 make-addons.bat peripheral.joystick
176 Build the installer with the command line:
178 BuildSetup.bat nobinaryaddons clean
181 `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.
183 **[back to top](#table-of-contents)**
185 ## 6. Build Kodi manually
186 Change to your `home` directory:
191 Create an out-of-source build directory:
196 Change to build directory:
201 Configure build for 64bit (**recommended**):
203 cmake -G "Visual Studio 17 2022" -A x64 -T host=x64 %userprofile%\kodi
206 Or configure build for 32bit:
208 cmake -G "Visual Studio 17 2022" -A Win32 -T host=x64 %userprofile%\kodi
211 Or configure build for UWP 64bit:
213 cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0.18362.0 -T host=x64 %userprofile%\kodi
216 Or configure build for UWP 32bit:
218 cmake -G "Visual Studio 17 2022" -A Win32 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0.18362.0 -T host=x64 %userprofile%\kodi
221 Or configure build for UWP ARM 32bit:
223 cmake -G "Visual Studio 17 2022" -A ARM -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0.18362.0 -T host=x64 %userprofile%\kodi
226 **Visual Studio 2019:**
230 -G "Visual Studio 17 2022"
235 -G "Visual Studio 16 2019"
239 Build a `Debug` binary:
241 cmake --build . --config "Debug"
244 Or build a `Release` binary:
246 cmake --build . --config "Release"
249 *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.
250 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)**.
253 **[back to top](#table-of-contents)** | **[back to section top](#6-build-kodi-manually)**