summaryrefslogtreecommitdiffstats
path: root/project/cmake/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'project/cmake/README.md')
-rw-r--r--project/cmake/README.md166
1 files changed, 166 insertions, 0 deletions
diff --git a/project/cmake/README.md b/project/cmake/README.md
new file mode 100644
index 0000000..c0f94d8
--- /dev/null
+++ b/project/cmake/README.md
@@ -0,0 +1,166 @@
1# Kodi CMake based buildsystem
2
3This files describes Kodi's CMake based buildsystem. CMake is a cross-platform
4tool for generating makefiles as well as project files used by IDEs.
5
6The current version of the buildsystem is capable of building the main Kodi
7executable (but no packaging or dependency management yet) for the following
8platforms:
9
10- Linux (GNU Makefiles)
11- Windows (NMake Makefiles, Visual Studio 12 (2013))
12- OSX (GNU Makefiles, Xcode)
13- Android (GNU Makefiles)
14
15Before building Kodi with CMake, please ensure that you have the platform
16specific dependencies installed.
17
18While the legacy build systems typically used in-source builds it's recommended
19to use out-of-source builds with CMake. The necessary runtime dependencies such
20as dlls, skins and configuration files are copied over to the build directory
21automatically.
22
23## Dependency installation
24
25### Linux
26
27The dependencies required to build on Linux can be found in
28[docs/README.xxx](https://github.com/xbmc/xbmc/tree/master/docs).
29
30### Raspberry Pi
31
32The cross compilation environment for the Raspberry Pi as well as the
33dependencies have to be installed as explained in
34[docs/README.raspberrypi](https://github.com/xbmc/xbmc/tree/master/docs/README.raspberrypi).
35
36### Windows
37
38For Windows the dependencies can be found in the
39[Wiki](http://kodi.wiki/view/HOW-TO:Compile_Kodi_for_Windows) (Step 1-4). If not already available on your pc, you should
40install the [Windows Software Development Kit (SDK)](https://dev.windows.com/en-us/downloads/sdk-archive) for your Windows version. This is required for HLSL shader offline compiling with the [Effect-Compiler Tool](https://msdn.microsoft.com/de-de/library/windows/desktop/bb232919(v=vs.85).aspx) (fxc.exe).
41
42On Windows, the CMake based buildsystem requires that the binary dependencies
43are downloaded using `DownloadBuildDeps.bat` and `DownloadMingwBuildEnv.bat`
44and that the mingw libs (ffmpeg, libdvd and others) are built using
45`make-mingwlibs.bat`.
46
47### OSX
48
49For OSX the required dependencies can be found in
50[docs/README.osx](https://github.com/xbmc/xbmc/tree/master/docs/README.osx).
51
52On OSX it is necessary to build the dependencies in `tools/depends` using
53`./bootstrap && ./configure --host=<PLATFORM> && make`. The other steps such
54as `make -C tools/depends/target/xbmc` and `make xcode_depends` are not needed
55as these steps are covered already by the CMake project.
56
57### Android
58
59The dependencies needed to compile for Android can be found in
60[docs/README.osx](https://github.com/xbmc/xbmc/tree/master/docs/README.android)
61. All described steps have to be executed (except 5.2 which is replaced by the
62respective CMake command below).
63
64## Building Kodi
65
66This section lists the necessary commands for building Kodi with CMake.
67CMake supports different generators that can be classified into two categories:
68single- and multiconfiguration generators.
69
70A single configuration generator (GNU/NMake Makefiles) generates project files
71for a single build type (e.g. Debug, Release) specified at configure time.
72Multi configuration generators (Visual Studio, Xcode) allow to specify the
73build type at compile time.
74
75All examples below are for out-of-source builds with Kodi checked out to
76`<KODI_SRC>`:
77
78```
79mkdir kodi-build && cd kodi-build
80```
81
82### Linux with GNU Makefiles
83
84```
85cmake <KODI_SRC>/project/cmake/
86cmake --build . -- VERBOSE=1 -j$(nproc) # or: make VERBOSE=1 -j$(nproc)
87./kodi.bin
88```
89
90`CMAKE_BUILD_TYPE` defaults to `Release`.
91
92### Raspberry Pi with GNU Makefiles
93
94```
95cmake -DCMAKE_TOOLCHAIN_FILE=<KODI_SRC>/tools/depends/target/Toolchain.cmake <KODI_SRC>/project/cmake/
96cmake --build . -- VERBOSE=1 -j$(nproc) # or: make VERBOSE=1 -j$(nproc)
97```
98
99### Windows with NMake Makefiles
100
101```
102cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release <KODI_SRC>/project/cmake/
103cmake --build . # or: nmake
104kodi.exe
105```
106
107### Windows with Visual Studio project files
108
109```
110cmake -G "Visual Studio 12" <KODI_SRC>/project/cmake/
111cmake --build . --config "Debug" # or: Build solution with Visual Studio
112set KODI_HOME="%CD%" && Debug\kodi.exe
113```
114
115### OSX with GNU Makefiles
116
117```
118cmake -DCMAKE_TOOLCHAIN_FILE=<KODI_SRC>/tools/depends/target/Toolchain.cmake <KODI_SRC>/project/cmake/
119cmake --build . -- VERBOSE=1 -j$(sysctl -n hw.ncpu) # or: make VERBOSE=1 -j$(sysctl -n hw.ncpu)
120./kodi.bin
121```
122
123### OSX with Xcode project files
124
125```
126cmake -DCMAKE_TOOLCHAIN_FILE=<KODI_SRC>/tools/depends/target/Toolchain.cmake -G "Xcode" <KODI_SRC>/project/cmake/
127cmake --build . --config "Release" -- -verbose -jobs $(sysctl -n hw.ncpu) # or: Build solution with Xcode
128KODI_HOME=$(pwd) ./Release/kodi.bin
129```
130
131### Android with GNU Makefiles
132
133```
134cmake -DCMAKE_TOOLCHAIN_FILE=<KODI_SRC>/tools/depends/target/Toolchain.cmake <KODI_SRC>/project/cmake/
135cmake --build . -- VERBOSE=1 -j$(nproc) # or: make VERBOSE=1 -j$(nproc)
136```
137
138## Extra targets
139
140When using the makefile builds a few extra targets are defined:
141
142- `make check` builds and executes the test suite.
143
144## Debugging the build
145
146This section covers some tips that can be useful for debugging a CMake
147based build.
148
149### Verbosity (show compiler and linker parameters)
150
151In order to see the exact compiler commands `make` and `nmake` can be
152executed with a `VERBOSE=1` parameter.
153
154On Windows, this is unfortunately not enough because `nmake` uses
155temporary files to workaround `nmake`'s command string length limitations.
156In order to see verbose output the file
157[Modules/Platform/Windows.cmake](https://github.com/Kitware/CMake/blob/master/Modules/Platform/Windows.cmake#L40)
158in the local CMake installation has to be adapted by uncommenting these
159lines:
160
161```
162# uncomment these out to debug nmake and borland makefiles
163#set(CMAKE_START_TEMP_FILE "")
164#set(CMAKE_END_TEMP_FILE "")
165#set(CMAKE_VERBOSE_MAKEFILE 1)
166```