summaryrefslogtreecommitdiffstats
path: root/project/cmake/README.md
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2016-11-24 21:27:41 +0100
committermanuel <manuel@mausz.at>2016-11-24 21:27:41 +0100
commit8cdf8dec703d882b46ca50a769fabb95ffc48e2c (patch)
treef7fe8233508f79d3dc94f8f445ce6342e7dfbdbb /project/cmake/README.md
parent5823b05feb29a59510c32a9c28ca18b50b9b6399 (diff)
downloadkodi-pvr-build-8cdf8dec703d882b46ca50a769fabb95ffc48e2c.tar.gz
kodi-pvr-build-8cdf8dec703d882b46ca50a769fabb95ffc48e2c.tar.bz2
kodi-pvr-build-8cdf8dec703d882b46ca50a769fabb95ffc48e2c.zip
sync with upstream
Diffstat (limited to 'project/cmake/README.md')
-rw-r--r--project/cmake/README.md175
1 files changed, 154 insertions, 21 deletions
diff --git a/project/cmake/README.md b/project/cmake/README.md
index 28af525..f3d727e 100644
--- a/project/cmake/README.md
+++ b/project/cmake/README.md
@@ -3,14 +3,14 @@
3This files describes Kodi's CMake based buildsystem. CMake is a cross-platform 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. 4tool for generating makefiles as well as project files used by IDEs.
5 5
6The current version of the buildsystem is capable of building the main Kodi 6The current version of the buildsystem is capable of building and packaging
7executable (but no packaging or dependency management yet) for the following 7Kodi for the following platforms:
8platforms:
9 8
10- Linux (GNU Makefiles) 9- Linux (GNU Makefiles, Ninja)
11- Windows (NMake Makefiles, Visual Studio 14 (2015)) 10- Windows (NMake Makefiles, Visual Studio 14 (2015), Ninja)
12- OSX (GNU Makefiles, Xcode) 11- macOS and iOS (GNU Makefiles, Xcode, Ninja)
13- Android (GNU Makefiles) 12- Android (GNU Makefiles)
13- FreeBSD (GNU Makefiles)
14 14
15Before building Kodi with CMake, please ensure that you have the platform 15Before building Kodi with CMake, please ensure that you have the platform
16specific dependencies installed. 16specific dependencies installed.
@@ -44,12 +44,12 @@ are downloaded using `DownloadBuildDeps.bat` and `DownloadMingwBuildEnv.bat`
44and that the mingw libs (ffmpeg, libdvd and others) are built using 44and that the mingw libs (ffmpeg, libdvd and others) are built using
45`make-mingwlibs.bat`. 45`make-mingwlibs.bat`.
46 46
47### OSX 47### macOS
48 48
49For OSX the required dependencies can be found in 49For macOS the required dependencies can be found in
50[docs/README.osx](https://github.com/xbmc/xbmc/tree/master/docs/README.osx). 50[docs/README.osx](https://github.com/xbmc/xbmc/tree/master/docs/README.osx).
51 51
52On OSX it is necessary to build the dependencies in `tools/depends` using 52On macOS it is necessary to build the dependencies in `tools/depends` using
53`./bootstrap && ./configure --host=<PLATFORM> && make`. The other steps such 53`./bootstrap && ./configure --host=<PLATFORM> && make`. The other steps such
54as `make -C tools/depends/target/xbmc` and `make xcode_depends` are not needed 54as `make -C tools/depends/target/xbmc` and `make xcode_depends` are not needed
55as these steps are covered already by the CMake project. 55as these steps are covered already by the CMake project.
@@ -57,7 +57,7 @@ as these steps are covered already by the CMake project.
57### Android 57### Android
58 58
59The dependencies needed to compile for Android can be found in 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) 60[docs/README.android](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 61. All described steps have to be executed (except 5.2 which is replaced by the
62respective CMake command below). 62respective CMake command below).
63 63
@@ -89,6 +89,22 @@ cmake --build . -- VERBOSE=1 -j$(nproc) # or: make VERBOSE=1 -j$(nproc)
89 89
90`CMAKE_BUILD_TYPE` defaults to `Release`. 90`CMAKE_BUILD_TYPE` defaults to `Release`.
91 91
92#### Debian package generation
93The buildsystem is capable of generating Debian packages using CPack. To generate them, `CPACK_GENERATOR` has to be set to *DEB*, i.e. executing CMake's configure step with `-DCPACK_GENERATOR=DEB`.
94You should use CMake/CPack 3.6.0 or higher. Lower versions can generate the packages but package names will be mangled.
95
96The following optional variables (which can be passed to buildsystem when executing cmake with the -D`<variable-name>=<value>` format) can be used to manipulate package type, name and version:
97
98- `DEBIAN_PACKAGE_TYPE` controls the name and version of generated packages. Accepted values are `stable`, `unstable` and `nightly` (default is `nightly`).
99- `DEBIAN_PACKAGE_EPOCH` controls package epoch (default is `2`)
100- `DEBIAN_PACKAGE_VERSION` controls package version (default is `0`)
101- `DEBIAN_PACKAGE_REVISION` controls package revision (no default is set)
102
103Packages metadata can be changed simply by editing files present in the `cpack/deb` folder
104A lot more variables are available (see cpack/CPackDebian.cmake file) but you shouldn't mess with them unless you know what you're doing.
105
106Generated packages can be found in <BUILD_DIR>/packages.
107
92### Raspberry Pi with GNU Makefiles 108### Raspberry Pi with GNU Makefiles
93 109
94``` 110```
@@ -96,23 +112,28 @@ cmake -DCMAKE_TOOLCHAIN_FILE=<KODI_SRC>/tools/depends/target/Toolchain.cmake <KO
96cmake --build . -- VERBOSE=1 -j$(nproc) # or: make VERBOSE=1 -j$(nproc) 112cmake --build . -- VERBOSE=1 -j$(nproc) # or: make VERBOSE=1 -j$(nproc)
97``` 113```
98 114
99### Windows with NMake Makefiles 115### Windows with Visual Studio project files
100 116
101``` 117```
102cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release <KODI_SRC>/project/cmake/ 118cmake -G "Visual Studio 14" <KODI_SRC>/project/cmake/
103cmake --build . # or: nmake 119cmake --build . --config "Debug" # or: Build solution with Visual Studio
104kodi.exe 120Debug\kodi.exe
105``` 121```
106 122
107### Windows with Visual Studio project files 123#### Windows installer generation
124
125The script [project/Win32BuildSetup](https://github.com/xbmc/xbmc/blob/master/project/Win32BuildSetup/BuildSetup.bat)
126builds an installable package for Windows.
127
128### Windows with NMake Makefiles
108 129
109``` 130```
110cmake -G "Visual Studio 14" <KODI_SRC>/project/cmake/ 131cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release <KODI_SRC>/project/cmake/
111cmake --build . --config "Debug" # or: Build solution with Visual Studio 132cmake --build . # or: nmake
112set KODI_HOME="%CD%" && Debug\kodi.exe 133kodi.exe
113``` 134```
114 135
115### OSX with GNU Makefiles 136### macOS with GNU Makefiles
116 137
117``` 138```
118cmake -DCMAKE_TOOLCHAIN_FILE=<KODI_SRC>/tools/depends/target/Toolchain.cmake <KODI_SRC>/project/cmake/ 139cmake -DCMAKE_TOOLCHAIN_FILE=<KODI_SRC>/tools/depends/target/Toolchain.cmake <KODI_SRC>/project/cmake/
@@ -120,12 +141,28 @@ cmake --build . -- VERBOSE=1 -j$(sysctl -n hw.ncpu) # or: make VERBOSE=1 -j$(sy
120./kodi.bin 141./kodi.bin
121``` 142```
122 143
123### OSX with Xcode project files 144### macOS with Xcode project files
124 145
125``` 146```
126cmake -DCMAKE_TOOLCHAIN_FILE=<KODI_SRC>/tools/depends/target/Toolchain.cmake -G "Xcode" <KODI_SRC>/project/cmake/ 147cmake -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 148cmake --build . --config "Release" -- -verbose -jobs $(sysctl -n hw.ncpu) # or: Build solution with Xcode
128KODI_HOME=$(pwd) ./Release/kodi.bin 149./Release/kodi.bin
150```
151
152#### macOS installer generation
153
154Afterwards an installable DMG for macOS can be built with the following command:
155
156```
157cmake --build . --config "Release" --target "dmg" # or: make dmg
158```
159
160#### iOS package generation
161
162Consequently an installable DEB for iOS can be built with the following command:
163
164```
165make deb
129``` 166```
130 167
131### Android with GNU Makefiles 168### Android with GNU Makefiles
@@ -135,11 +172,107 @@ cmake -DCMAKE_TOOLCHAIN_FILE=<KODI_SRC>/tools/depends/target/Toolchain.cmake <KO
135cmake --build . -- VERBOSE=1 -j$(nproc) # or: make VERBOSE=1 -j$(nproc) 172cmake --build . -- VERBOSE=1 -j$(nproc) # or: make VERBOSE=1 -j$(nproc)
136``` 173```
137 174
175#### Android package generation
176
177An installable APK for Android can be built with the following command:
178
179```
180make apk
181```
182
183## Options
184
185Kodi supports a number of build options that can enable or disable certain
186functionality.i These options must be set when running CMake with
187`-DENABLE_<OPTION>=<ON|OFF|AUTO`. The default is `AUTO` which enables
188the option if a certain dependency is found. For example CEC support is
189enabled if libCEC is available. `ON` forcefully enables the dependency
190and the CMake run will fail if the related dependency is not available.
191This is mostly useful for packagers. `OFF` will disable the feature.
192
193Example for forcefully enabling VAAPI and disabling VDPAU:
194
195```
196cmake ... -DENABLE_VAAPI=ON -DENABLE_VDPAU=OFF ...
197```
198
199Example for building with external FFMPEG:
200
201```
202cmake ... -DFFMPEG_PATH=/opt/ffmpeg -DENABLE_INTERNAL_FFMPEG=OFF ...
203```
204
205For more information and an updated list of option, please check the
206main [project/cmake/CMakeLists.txt](https://github.com/xbmc/xbmc/tree/master/project/cmake/CMakeLists.txt).
207
208## Tests
209
210Kodi uses Google Test as its testing framework. Each test file is scanned for tests and these
211are added to CTest, which is the native test driver for CMake.
212
213This scanning happens at configuration time. If tests depend on generated support files which
214should not be scanned, then those support files should be added to the SUPPORT_SOURCES
215variable as opposed to SOURCES before calling core_add_test. You might want to do this where
216the generated support files would not exist at configure time, or if they are so large that
217scanning them would take up an unreasonable amount of configure time.
218
138## Extra targets 219## Extra targets
139 220
140When using the makefile builds a few extra targets are defined: 221When using the makefile builds a few extra targets are defined:
141 222
142- `make check` builds and executes the test suite. 223- `make check` builds and executes the test suite.
224- `make check-valgrind` builds and executes the test suite with valgrind memcheck.
225- `make doc` builds the Doxygen documentation.
226
227Code coverage (with Gcov, LCOV and Gcovr) can be built on Linux:
228
229- CMake has to be executed with `-DCMAKE_BUILD_TYPE=Coverage`
230- `make coverage` generates an HTML code coverage report.
231- `make coverage_xml` generates an XML code coverage report.
232
233## Building binary addons
234
235The CMake build system integrates with the addon build system if the GNU
236Makefile generator is used. This offers an easy way to build addons for
237packagers or Kodi developers who don't work on addons.
238
239```
240make binary-addons
241```
242
243Specific addons can be built with:
244
245```
246make binary-addons ADDONS="visualization.spectrum pvr.demo"
247```
248
249Addon developers can build single addons into the Kodi build directory
250so that the addon can be tested with self-compiled specific versions of Kodi.
251
252```
253mkdir pvr.demo-build && cd pvr.demo-build
254cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=<KODI_BUILD_DIR>/build -DKODI_BUILD_DIR=<KODI_BUILD_DIR> <pvr.demo-SRC>
255make
256```
257
258It is recommended to specify the directories as absolute paths. If relative
259paths are used, they are considered relative to the build directory in which
260`cmake` was executed (aka the current working working directory).
261
262Both methods work only for already existing addons. See this
263[forum thread](http://forum.kodi.tv/showthread.php?tid=219166&pid=1934922#pid1934922)
264and [addons/README.md](https://github.com/xbmc/xbmc/blob/master/project/cmake/addons/README.md)
265for addon development and detailed documentation about the addon build system.
266
267## Sanitizers
268
269Clang and GCC support different kinds of Sanitizers. To enable a Sanitizer call CMake with the
270option `-DECM_ENABLE_SANITIZERS=’san1;san2;...'`. For more information about enabling the
271Sanitizers read the documentation in
272[modules/extra/ECMEnableSanitizers.cmake](https://github.com/xbmc/xbmc/tree/master/project/cmake/modules/extra/ECMEnableSanitizers.cmake).
273
274It is also recommended to read the sections about the Sanitizers in the [Clang
275documentation](http://clang.llvm.org/docs/).
143 276
144## Debugging the build 277## Debugging the build
145 278