From 8cdf8dec703d882b46ca50a769fabb95ffc48e2c Mon Sep 17 00:00:00 2001 From: manuel Date: Thu, 24 Nov 2016 21:27:41 +0100 Subject: sync with upstream --- project/cmake/README.md | 175 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 154 insertions(+), 21 deletions(-) (limited to 'project/cmake/README.md') 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 @@ This files describes Kodi's CMake based buildsystem. CMake is a cross-platform tool for generating makefiles as well as project files used by IDEs. -The current version of the buildsystem is capable of building the main Kodi -executable (but no packaging or dependency management yet) for the following -platforms: +The current version of the buildsystem is capable of building and packaging +Kodi for the following platforms: -- Linux (GNU Makefiles) -- Windows (NMake Makefiles, Visual Studio 14 (2015)) -- OSX (GNU Makefiles, Xcode) +- Linux (GNU Makefiles, Ninja) +- Windows (NMake Makefiles, Visual Studio 14 (2015), Ninja) +- macOS and iOS (GNU Makefiles, Xcode, Ninja) - Android (GNU Makefiles) +- FreeBSD (GNU Makefiles) Before building Kodi with CMake, please ensure that you have the platform specific dependencies installed. @@ -44,12 +44,12 @@ are downloaded using `DownloadBuildDeps.bat` and `DownloadMingwBuildEnv.bat` and that the mingw libs (ffmpeg, libdvd and others) are built using `make-mingwlibs.bat`. -### OSX +### macOS -For OSX the required dependencies can be found in +For macOS the required dependencies can be found in [docs/README.osx](https://github.com/xbmc/xbmc/tree/master/docs/README.osx). -On OSX it is necessary to build the dependencies in `tools/depends` using +On macOS it is necessary to build the dependencies in `tools/depends` using `./bootstrap && ./configure --host= && make`. The other steps such as `make -C tools/depends/target/xbmc` and `make xcode_depends` are not needed as these steps are covered already by the CMake project. @@ -57,7 +57,7 @@ as these steps are covered already by the CMake project. ### Android The dependencies needed to compile for Android can be found in -[docs/README.osx](https://github.com/xbmc/xbmc/tree/master/docs/README.android) +[docs/README.android](https://github.com/xbmc/xbmc/tree/master/docs/README.android) . All described steps have to be executed (except 5.2 which is replaced by the respective CMake command below). @@ -89,6 +89,22 @@ cmake --build . -- VERBOSE=1 -j$(nproc) # or: make VERBOSE=1 -j$(nproc) `CMAKE_BUILD_TYPE` defaults to `Release`. +#### Debian package generation +The 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`. +You should use CMake/CPack 3.6.0 or higher. Lower versions can generate the packages but package names will be mangled. + +The following optional variables (which can be passed to buildsystem when executing cmake with the -D`=` format) can be used to manipulate package type, name and version: + +- `DEBIAN_PACKAGE_TYPE` controls the name and version of generated packages. Accepted values are `stable`, `unstable` and `nightly` (default is `nightly`). +- `DEBIAN_PACKAGE_EPOCH` controls package epoch (default is `2`) +- `DEBIAN_PACKAGE_VERSION` controls package version (default is `0`) +- `DEBIAN_PACKAGE_REVISION` controls package revision (no default is set) + +Packages metadata can be changed simply by editing files present in the `cpack/deb` folder +A lot more variables are available (see cpack/CPackDebian.cmake file) but you shouldn't mess with them unless you know what you're doing. + +Generated packages can be found in /packages. + ### Raspberry Pi with GNU Makefiles ``` @@ -96,23 +112,28 @@ cmake -DCMAKE_TOOLCHAIN_FILE=/tools/depends/target/Toolchain.cmake /project/cmake/ -cmake --build . # or: nmake -kodi.exe +cmake -G "Visual Studio 14" /project/cmake/ +cmake --build . --config "Debug" # or: Build solution with Visual Studio +Debug\kodi.exe ``` -### Windows with Visual Studio project files +#### Windows installer generation + +The script [project/Win32BuildSetup](https://github.com/xbmc/xbmc/blob/master/project/Win32BuildSetup/BuildSetup.bat) +builds an installable package for Windows. + +### Windows with NMake Makefiles ``` -cmake -G "Visual Studio 14" /project/cmake/ -cmake --build . --config "Debug" # or: Build solution with Visual Studio -set KODI_HOME="%CD%" && Debug\kodi.exe +cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release /project/cmake/ +cmake --build . # or: nmake +kodi.exe ``` -### OSX with GNU Makefiles +### macOS with GNU Makefiles ``` cmake -DCMAKE_TOOLCHAIN_FILE=/tools/depends/target/Toolchain.cmake /project/cmake/ @@ -120,12 +141,28 @@ cmake --build . -- VERBOSE=1 -j$(sysctl -n hw.ncpu) # or: make VERBOSE=1 -j$(sy ./kodi.bin ``` -### OSX with Xcode project files +### macOS with Xcode project files ``` cmake -DCMAKE_TOOLCHAIN_FILE=/tools/depends/target/Toolchain.cmake -G "Xcode" /project/cmake/ cmake --build . --config "Release" -- -verbose -jobs $(sysctl -n hw.ncpu) # or: Build solution with Xcode -KODI_HOME=$(pwd) ./Release/kodi.bin +./Release/kodi.bin +``` + +#### macOS installer generation + +Afterwards an installable DMG for macOS can be built with the following command: + +``` +cmake --build . --config "Release" --target "dmg" # or: make dmg +``` + +#### iOS package generation + +Consequently an installable DEB for iOS can be built with the following command: + +``` +make deb ``` ### Android with GNU Makefiles @@ -135,11 +172,107 @@ cmake -DCMAKE_TOOLCHAIN_FILE=/tools/depends/target/Toolchain.cmake =/build -DKODI_BUILD_DIR= +make +``` + +It is recommended to specify the directories as absolute paths. If relative +paths are used, they are considered relative to the build directory in which +`cmake` was executed (aka the current working working directory). + +Both methods work only for already existing addons. See this +[forum thread](http://forum.kodi.tv/showthread.php?tid=219166&pid=1934922#pid1934922) +and [addons/README.md](https://github.com/xbmc/xbmc/blob/master/project/cmake/addons/README.md) +for addon development and detailed documentation about the addon build system. + +## Sanitizers + +Clang and GCC support different kinds of Sanitizers. To enable a Sanitizer call CMake with the +option `-DECM_ENABLE_SANITIZERS=’san1;san2;...'`. For more information about enabling the +Sanitizers read the documentation in +[modules/extra/ECMEnableSanitizers.cmake](https://github.com/xbmc/xbmc/tree/master/project/cmake/modules/extra/ECMEnableSanitizers.cmake). + +It is also recommended to read the sections about the Sanitizers in the [Clang +documentation](http://clang.llvm.org/docs/). ## Debugging the build -- cgit v1.2.3