diff options
Diffstat (limited to 'project/cmake/README.md')
| -rw-r--r-- | project/cmake/README.md | 166 |
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 | |||
| 3 | This files describes Kodi's CMake based buildsystem. CMake is a cross-platform | ||
| 4 | tool for generating makefiles as well as project files used by IDEs. | ||
| 5 | |||
| 6 | The current version of the buildsystem is capable of building the main Kodi | ||
| 7 | executable (but no packaging or dependency management yet) for the following | ||
| 8 | platforms: | ||
| 9 | |||
| 10 | - Linux (GNU Makefiles) | ||
| 11 | - Windows (NMake Makefiles, Visual Studio 12 (2013)) | ||
| 12 | - OSX (GNU Makefiles, Xcode) | ||
| 13 | - Android (GNU Makefiles) | ||
| 14 | |||
| 15 | Before building Kodi with CMake, please ensure that you have the platform | ||
| 16 | specific dependencies installed. | ||
| 17 | |||
| 18 | While the legacy build systems typically used in-source builds it's recommended | ||
| 19 | to use out-of-source builds with CMake. The necessary runtime dependencies such | ||
| 20 | as dlls, skins and configuration files are copied over to the build directory | ||
| 21 | automatically. | ||
| 22 | |||
| 23 | ## Dependency installation | ||
| 24 | |||
| 25 | ### Linux | ||
| 26 | |||
| 27 | The 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 | |||
| 32 | The cross compilation environment for the Raspberry Pi as well as the | ||
| 33 | dependencies 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 | |||
| 38 | For 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 | ||
| 40 | install 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 | |||
| 42 | On Windows, the CMake based buildsystem requires that the binary dependencies | ||
| 43 | are downloaded using `DownloadBuildDeps.bat` and `DownloadMingwBuildEnv.bat` | ||
| 44 | and that the mingw libs (ffmpeg, libdvd and others) are built using | ||
| 45 | `make-mingwlibs.bat`. | ||
| 46 | |||
| 47 | ### OSX | ||
| 48 | |||
| 49 | For OSX the required dependencies can be found in | ||
| 50 | [docs/README.osx](https://github.com/xbmc/xbmc/tree/master/docs/README.osx). | ||
| 51 | |||
| 52 | On OSX it is necessary to build the dependencies in `tools/depends` using | ||
| 53 | `./bootstrap && ./configure --host=<PLATFORM> && make`. The other steps such | ||
| 54 | as `make -C tools/depends/target/xbmc` and `make xcode_depends` are not needed | ||
| 55 | as these steps are covered already by the CMake project. | ||
| 56 | |||
| 57 | ### Android | ||
| 58 | |||
| 59 | The 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 | ||
| 62 | respective CMake command below). | ||
| 63 | |||
| 64 | ## Building Kodi | ||
| 65 | |||
| 66 | This section lists the necessary commands for building Kodi with CMake. | ||
| 67 | CMake supports different generators that can be classified into two categories: | ||
| 68 | single- and multiconfiguration generators. | ||
| 69 | |||
| 70 | A single configuration generator (GNU/NMake Makefiles) generates project files | ||
| 71 | for a single build type (e.g. Debug, Release) specified at configure time. | ||
| 72 | Multi configuration generators (Visual Studio, Xcode) allow to specify the | ||
| 73 | build type at compile time. | ||
| 74 | |||
| 75 | All examples below are for out-of-source builds with Kodi checked out to | ||
| 76 | `<KODI_SRC>`: | ||
| 77 | |||
| 78 | ``` | ||
| 79 | mkdir kodi-build && cd kodi-build | ||
| 80 | ``` | ||
| 81 | |||
| 82 | ### Linux with GNU Makefiles | ||
| 83 | |||
| 84 | ``` | ||
| 85 | cmake <KODI_SRC>/project/cmake/ | ||
| 86 | cmake --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 | ``` | ||
| 95 | cmake -DCMAKE_TOOLCHAIN_FILE=<KODI_SRC>/tools/depends/target/Toolchain.cmake <KODI_SRC>/project/cmake/ | ||
| 96 | cmake --build . -- VERBOSE=1 -j$(nproc) # or: make VERBOSE=1 -j$(nproc) | ||
| 97 | ``` | ||
| 98 | |||
| 99 | ### Windows with NMake Makefiles | ||
| 100 | |||
| 101 | ``` | ||
| 102 | cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release <KODI_SRC>/project/cmake/ | ||
| 103 | cmake --build . # or: nmake | ||
| 104 | kodi.exe | ||
| 105 | ``` | ||
| 106 | |||
| 107 | ### Windows with Visual Studio project files | ||
| 108 | |||
| 109 | ``` | ||
| 110 | cmake -G "Visual Studio 12" <KODI_SRC>/project/cmake/ | ||
| 111 | cmake --build . --config "Debug" # or: Build solution with Visual Studio | ||
| 112 | set KODI_HOME="%CD%" && Debug\kodi.exe | ||
| 113 | ``` | ||
| 114 | |||
| 115 | ### OSX with GNU Makefiles | ||
| 116 | |||
| 117 | ``` | ||
| 118 | cmake -DCMAKE_TOOLCHAIN_FILE=<KODI_SRC>/tools/depends/target/Toolchain.cmake <KODI_SRC>/project/cmake/ | ||
| 119 | cmake --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 | ``` | ||
| 126 | cmake -DCMAKE_TOOLCHAIN_FILE=<KODI_SRC>/tools/depends/target/Toolchain.cmake -G "Xcode" <KODI_SRC>/project/cmake/ | ||
| 127 | cmake --build . --config "Release" -- -verbose -jobs $(sysctl -n hw.ncpu) # or: Build solution with Xcode | ||
| 128 | KODI_HOME=$(pwd) ./Release/kodi.bin | ||
| 129 | ``` | ||
| 130 | |||
| 131 | ### Android with GNU Makefiles | ||
| 132 | |||
| 133 | ``` | ||
| 134 | cmake -DCMAKE_TOOLCHAIN_FILE=<KODI_SRC>/tools/depends/target/Toolchain.cmake <KODI_SRC>/project/cmake/ | ||
| 135 | cmake --build . -- VERBOSE=1 -j$(nproc) # or: make VERBOSE=1 -j$(nproc) | ||
| 136 | ``` | ||
| 137 | |||
| 138 | ## Extra targets | ||
| 139 | |||
| 140 | When 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 | |||
| 146 | This section covers some tips that can be useful for debugging a CMake | ||
| 147 | based build. | ||
| 148 | |||
| 149 | ### Verbosity (show compiler and linker parameters) | ||
| 150 | |||
| 151 | In order to see the exact compiler commands `make` and `nmake` can be | ||
| 152 | executed with a `VERBOSE=1` parameter. | ||
| 153 | |||
| 154 | On Windows, this is unfortunately not enough because `nmake` uses | ||
| 155 | temporary files to workaround `nmake`'s command string length limitations. | ||
| 156 | In order to see verbose output the file | ||
| 157 | [Modules/Platform/Windows.cmake](https://github.com/Kitware/CMake/blob/master/Modules/Platform/Windows.cmake#L40) | ||
| 158 | in the local CMake installation has to be adapted by uncommenting these | ||
| 159 | lines: | ||
| 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 | ``` | ||
