aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-rw-r--r--cmake/KodiConfig.cmake.in34
-rw-r--r--cmake/README.md299
-rw-r--r--cmake/addons/CMakeLists.txt434
-rw-r--r--cmake/addons/README.md65
-rw-r--r--cmake/addons/bootstrap/Bootstrap.cmake39
-rw-r--r--cmake/addons/bootstrap/CMakeLists.txt94
-rw-r--r--cmake/addons/bootstrap/README.md48
-rw-r--r--cmake/addons/bootstrap/repositories/binary-addons.txt1
-rw-r--r--cmake/addons/depends/CMakeLists.txt41
-rw-r--r--cmake/addons/depends/README61
-rw-r--r--cmake/addons/depends/common/kodi-platform/deps.txt2
-rw-r--r--cmake/addons/depends/common/kodi-platform/kodi-platform.txt1
-rw-r--r--cmake/addons/depends/common/p8-platform/p8-platform.txt1
-rw-r--r--cmake/addons/depends/common/tinyxml/CMakeLists.txt22
-rw-r--r--cmake/addons/depends/common/tinyxml/tinyxml.txt1
-rw-r--r--cmake/addons/depends/windows/CMakeLists.txt52
-rw-r--r--cmake/addons/depends/windows/Install.cmake24
-rw-r--r--cmake/addons/depends/windows/README19
-rw-r--r--cmake/addons/depends/windows/cmake/mingw/CMakeLists.txt33
-rw-r--r--cmake/addons/depends/windows/cmake/mingw/MinGWConfig.cmake.in3
-rw-r--r--cmake/addons/depends/windows/cmake/mingw/Toolchain_mingw32.cmake.in17
-rw-r--r--cmake/addons/depends/windows/cmake/mingw/mingw.txt1
-rw-r--r--cmake/addons/depends/windows/cmake/mingw/mingw32-cmd.bat.in6
-rw-r--r--cmake/addons/depends/windows/cmake/mingw/noinstall.txt0
-rw-r--r--cmake/addons/depends/windows/cmake/msys/CMakeLists.txt5
-rw-r--r--cmake/addons/depends/windows/cmake/msys/msys.txt1
-rw-r--r--cmake/addons/depends/windows/cmake/msys/noinstall.txt0
-rw-r--r--cmake/addons/depends/windows/prebuilt/README21
-rw-r--r--cmake/cpack/CPackConfigDEB.cmake352
-rw-r--r--cmake/cpack/deb/NEWS.Debian24
-rw-r--r--cmake/cpack/deb/copyright3126
-rw-r--r--cmake/cpack/deb/lintian/overrides/kodi1
-rw-r--r--cmake/cpack/deb/menu/kodi2
-rw-r--r--cmake/cpack/deb/package-description.txt16
-rw-r--r--cmake/cpack/deb/packages/kodi-addon-dev.txt.in25
-rw-r--r--cmake/cpack/deb/packages/kodi-audio-dev.txt.in25
-rw-r--r--cmake/cpack/deb/packages/kodi-bin.txt.in25
-rw-r--r--cmake/cpack/deb/packages/kodi-eventclients-common.txt.in25
-rw-r--r--cmake/cpack/deb/packages/kodi-eventclients-dev.txt.in25
-rw-r--r--cmake/cpack/deb/packages/kodi-eventclients-ps3.txt.in25
-rw-r--r--cmake/cpack/deb/packages/kodi-eventclients-wiiremote.txt.in25
-rw-r--r--cmake/cpack/deb/packages/kodi-eventclients-xbmc-send.txt.in25
-rw-r--r--cmake/cpack/deb/packages/kodi-inputstream-dev.txt.in25
-rw-r--r--cmake/cpack/deb/packages/kodi-peripheral-dev.txt.in24
-rw-r--r--cmake/cpack/deb/packages/kodi-pvr-dev.txt.in25
-rw-r--r--cmake/cpack/deb/packages/kodi-screensaver-dev.txt.in25
-rw-r--r--cmake/cpack/deb/packages/kodi-tools-texturepacker.txt.in25
-rw-r--r--cmake/cpack/deb/packages/kodi-visualization-dev.txt.in25
-rw-r--r--cmake/cpack/deb/packages/kodi.txt.in25
-rwxr-xr-xcmake/cpack/deb/postinst5
-rwxr-xr-xcmake/cpack/deb/postrm3
-rw-r--r--cmake/installdata/common/addons.txt42
-rw-r--r--cmake/installdata/common/common.txt13
-rw-r--r--cmake/installdata/ios/certificates.txt1
-rw-r--r--cmake/installdata/ios/packaging.txt3
-rw-r--r--cmake/installdata/ios/runtime.txt2
-rw-r--r--cmake/installdata/linux/lirc.txt1
-rw-r--r--cmake/installdata/osx/certificates.txt1
-rw-r--r--cmake/installdata/osx/packaging.txt4
-rw-r--r--cmake/installdata/osx/runtime.txt2
l---------cmake/installdata/rbpi/lirc.txt1
-rw-r--r--cmake/installdata/test-reference-data.txt10
-rw-r--r--cmake/installdata/windows/addons.txt1
-rw-r--r--cmake/installdata/windows/dlls.txt2
-rw-r--r--cmake/installdata/windows/irss.txt2
-rw-r--r--cmake/installdata/windows/python.txt1
-rw-r--r--cmake/modules/FindAML.cmake35
-rw-r--r--cmake/modules/FindASS.cmake44
-rw-r--r--cmake/modules/FindAlsa.cmake46
-rw-r--r--cmake/modules/FindAvahi.cmake63
-rw-r--r--cmake/modules/FindBluetooth.cmake44
-rw-r--r--cmake/modules/FindBluray.cmake58
-rw-r--r--cmake/modules/FindCAP.cmake44
-rw-r--r--cmake/modules/FindCCache.cmake18
-rw-r--r--cmake/modules/FindCEC.cmake68
-rw-r--r--cmake/modules/FindCWiid.cmake44
-rw-r--r--cmake/modules/FindCXX11.cmake18
-rw-r--r--cmake/modules/FindCdio.cmake45
-rw-r--r--cmake/modules/FindCpluff.cmake61
-rw-r--r--cmake/modules/FindCrossGUID.cmake78
-rw-r--r--cmake/modules/FindCurl.cmake83
-rw-r--r--cmake/modules/FindD3DX11Effects.cmake30
-rw-r--r--cmake/modules/FindDBus.cmake52
-rw-r--r--cmake/modules/FindEGL.cmake48
-rw-r--r--cmake/modules/FindEMBEDDED.cmake16
-rw-r--r--cmake/modules/FindFFMPEG.cmake292
-rw-r--r--cmake/modules/FindFreeType.cmake45
-rw-r--r--cmake/modules/FindFribidi.cmake48
-rw-r--r--cmake/modules/FindGIF.cmake46
-rw-r--r--cmake/modules/FindJsonSchemaBuilder.cmake21
-rw-r--r--cmake/modules/FindLibDRM.cmake45
-rw-r--r--cmake/modules/FindLibDvd.cmake219
-rw-r--r--cmake/modules/FindLibUSB.cmake45
-rw-r--r--cmake/modules/FindLibXml2.cmake84
-rw-r--r--cmake/modules/FindLzo2.cmake37
-rw-r--r--cmake/modules/FindMMAL.cmake55
-rw-r--r--cmake/modules/FindMicroHttpd.cmake51
-rw-r--r--cmake/modules/FindMir.cmake33
-rw-r--r--cmake/modules/FindMySqlClient.cmake69
-rw-r--r--cmake/modules/FindNFS.cmake58
-rw-r--r--cmake/modules/FindOpenGLES.cmake48
-rw-r--r--cmake/modules/FindOpenGl.cmake43
-rw-r--r--cmake/modules/FindPCRE.cmake87
-rw-r--r--cmake/modules/FindPlist.cmake58
-rw-r--r--cmake/modules/FindPulseAudio.cmake68
-rw-r--r--cmake/modules/FindPython.cmake39
-rw-r--r--cmake/modules/FindSSE.cmake143
-rw-r--r--cmake/modules/FindSSH.cmake47
-rw-r--r--cmake/modules/FindSWIG.cmake29
-rw-r--r--cmake/modules/FindSdl.cmake46
-rw-r--r--cmake/modules/FindShairplay.cmake63
-rw-r--r--cmake/modules/FindSmbClient.cmake47
-rw-r--r--cmake/modules/FindSqlite3.cmake44
-rw-r--r--cmake/modules/FindTagLib.cmake60
-rw-r--r--cmake/modules/FindTexturePacker.cmake41
-rw-r--r--cmake/modules/FindTinyXML.cmake68
-rw-r--r--cmake/modules/FindUDEV.cmake47
-rw-r--r--cmake/modules/FindUUID.cmake43
-rw-r--r--cmake/modules/FindVAAPI.cmake72
-rw-r--r--cmake/modules/FindVDPAU.cmake47
-rw-r--r--cmake/modules/FindX.cmake57
-rw-r--r--cmake/modules/FindXRandR.cmake47
-rw-r--r--cmake/modules/FindXSLT.cmake50
-rw-r--r--cmake/modules/FindYajl.cmake62
-rw-r--r--cmake/modules/FindZip.cmake46
-rw-r--r--cmake/modules/LDGOLD.cmake45
-rw-r--r--cmake/modules/extra/ECMEnableSanitizers.cmake149
-rw-r--r--cmake/platform/android/defines.txt1
-rw-r--r--cmake/platform/freebsd/defines.txt1
-rw-r--r--cmake/platform/ios/defines.txt1
-rw-r--r--cmake/platform/linux/defines.txt1
-rw-r--r--cmake/platform/osx/defines.txt1
-rw-r--r--cmake/platform/rbpi/defines.txt1
-rw-r--r--cmake/platform/windows/defines.txt1
-rw-r--r--cmake/scripts/android/ArchSetup.cmake35
-rw-r--r--cmake/scripts/android/Install.cmake122
l---------cmake/scripts/android/Macros.cmake1
-rw-r--r--cmake/scripts/android/PathSetup.cmake33
-rw-r--r--cmake/scripts/common/AddOptions.cmake78
-rw-r--r--cmake/scripts/common/AddonHelpers.cmake268
-rw-r--r--cmake/scripts/common/ArchSetup.cmake156
-rw-r--r--cmake/scripts/common/CMakeHelpers.cmake54
-rw-r--r--cmake/scripts/common/CheckCommits.cmake75
-rw-r--r--cmake/scripts/common/CheckTargetPlatform.cmake67
-rw-r--r--cmake/scripts/common/GenerateVersionedFiles.cmake18
-rw-r--r--cmake/scripts/common/GeneratorSetup.cmake49
-rw-r--r--cmake/scripts/common/HandleDepends.cmake252
-rw-r--r--cmake/scripts/common/Macros.cmake622
-rw-r--r--cmake/scripts/common/PrepareEnv.cmake64
-rw-r--r--cmake/scripts/common/ProjectMacros.cmake89
-rw-r--r--cmake/scripts/common/Uninstall.cmake22
-rw-r--r--cmake/scripts/freebsd/ArchSetup.cmake16
l---------cmake/scripts/freebsd/Install.cmake1
l---------cmake/scripts/freebsd/Macros.cmake1
l---------cmake/scripts/freebsd/PathSetup.cmake1
-rw-r--r--cmake/scripts/ios/ArchSetup.cmake57
-rw-r--r--cmake/scripts/ios/Install.cmake85
l---------cmake/scripts/ios/Macros.cmake1
l---------cmake/scripts/ios/PathSetup.cmake1
-rw-r--r--cmake/scripts/linux/ArchSetup.cmake45
-rw-r--r--cmake/scripts/linux/CodeCoverage.cmake97
-rw-r--r--cmake/scripts/linux/ExtraTargets.cmake12
-rw-r--r--cmake/scripts/linux/Install.cmake362
-rw-r--r--cmake/scripts/linux/Macros.cmake95
-rw-r--r--cmake/scripts/linux/PathSetup.cmake40
-rw-r--r--cmake/scripts/osx/ArchSetup.cmake34
-rw-r--r--cmake/scripts/osx/ExtraTargets.cmake3
-rw-r--r--cmake/scripts/osx/Install.cmake40
-rw-r--r--cmake/scripts/osx/Macros.cmake118
-rw-r--r--cmake/scripts/osx/PathSetup.cmake32
-rw-r--r--cmake/scripts/rbpi/ArchSetup.cmake28
l---------cmake/scripts/rbpi/Install.cmake1
l---------cmake/scripts/rbpi/Macros.cmake1
l---------cmake/scripts/rbpi/PathSetup.cmake1
-rw-r--r--cmake/scripts/windows/ArchSetup.cmake89
-rw-r--r--cmake/scripts/windows/CFlagOverrides.cmake5
-rw-r--r--cmake/scripts/windows/CXXFlagOverrides.cmake5
-rw-r--r--cmake/scripts/windows/Install.cmake0
-rw-r--r--cmake/scripts/windows/Macros.cmake66
-rw-r--r--cmake/scripts/windows/PathSetup.cmake34
-rw-r--r--cmake/scripts/windows/tools/patch.cmake37
-rw-r--r--cmake/treedata/android/subdirs.txt17
-rw-r--r--cmake/treedata/common/addons.txt0
-rw-r--r--cmake/treedata/common/cores.txt9
-rw-r--r--cmake/treedata/common/events.txt2
-rw-r--r--cmake/treedata/common/externals.txt2
-rw-r--r--cmake/treedata/common/filesystem.txt3
-rw-r--r--cmake/treedata/common/games.txt12
-rw-r--r--cmake/treedata/common/interfaces.txt9
-rw-r--r--cmake/treedata/common/music.txt5
-rw-r--r--cmake/treedata/common/network.txt2
-rw-r--r--cmake/treedata/common/peripherals.txt6
-rw-r--r--cmake/treedata/common/profiles.txt3
-rw-r--r--cmake/treedata/common/pvr.txt7
-rw-r--r--cmake/treedata/common/settings.txt4
-rw-r--r--cmake/treedata/common/subdirs.txt41
-rw-r--r--cmake/treedata/common/tests.txt10
-rw-r--r--cmake/treedata/common/video.txt5
-rw-r--r--cmake/treedata/common/videoplayer.txt12
-rw-r--r--cmake/treedata/freebsd/subdirs.txt13
-rw-r--r--cmake/treedata/ios/subdirs.txt15
-rw-r--r--cmake/treedata/linux/subdirs.txt13
-rw-r--r--cmake/treedata/optional/common/X11.txt1
-rw-r--r--cmake/treedata/optional/common/cdrip.txt1
-rw-r--r--cmake/treedata/optional/common/dacp.txt1
-rw-r--r--cmake/treedata/optional/common/mir.txt1
-rw-r--r--cmake/treedata/optional/common/nonfree.txt1
-rw-r--r--cmake/treedata/optional/common/opengl.txt1
-rw-r--r--cmake/treedata/optional/common/opengles.txt1
-rw-r--r--cmake/treedata/optional/common/upnp.txt2
-rw-r--r--cmake/treedata/optional/common/webserver.txt2
-rw-r--r--cmake/treedata/osx/subdirs.txt12
-rw-r--r--cmake/treedata/rbpi/omxplayer.txt1
-rw-r--r--cmake/treedata/rbpi/subdirs.txt12
-rw-r--r--cmake/treedata/windows/externals.txt1
-rw-r--r--cmake/treedata/windows/subdirs.txt14
216 files changed, 12514 insertions, 0 deletions
diff --git a/cmake/KodiConfig.cmake.in b/cmake/KodiConfig.cmake.in
new file mode 100644
index 0000000000..c02a68085a
--- /dev/null
+++ b/cmake/KodiConfig.cmake.in
@@ -0,0 +1,34 @@
+set(APP_NAME @APP_NAME@)
+set(APP_NAME_LC @APP_NAME_LC@)
+set(APP_NAME_UC @APP_NAME_UC@)
+set(APP_VERSION_MAJOR @APP_VERSION_MAJOR@)
+set(APP_VERSION_MINOR @APP_VERSION_MINOR@)
+if(NOT @APP_NAME_UC@_PREFIX)
+ set(@APP_NAME_UC@_PREFIX @APP_PREFIX@)
+endif()
+if(NOT @APP_NAME_UC@_INCLUDE_DIR)
+ set(@APP_NAME_UC@_INCLUDE_DIR @APP_INCLUDE_DIR@)
+endif()
+if(NOT @APP_NAME_UC@_LIB_DIR)
+ set(@APP_NAME_UC@_LIB_DIR @APP_LIB_DIR@)
+endif()
+if(NOT @APP_NAME_UC@_DATA_DIR)
+ set(@APP_NAME_UC@_DATA_DIR @APP_DATA_DIR@)
+endif()
+if(NOT WIN32)
+ set(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} @CXX11_SWITCH@")
+endif()
+list(APPEND CMAKE_MODULE_PATH @APP_LIB_DIR@ @APP_DATA_DIR@/cmake)
+
+string(REPLACE ";" " " ARCH_DEFINES "@ARCH_DEFINES@")
+add_definitions(${ARCH_DEFINES} -DBUILD_KODI_ADDON)
+
+if(NOT CORE_SYSTEM_NAME)
+ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+ set(CORE_SYSTEM_NAME "osx")
+ else()
+ string(TOLOWER ${CMAKE_SYSTEM_NAME} CORE_SYSTEM_NAME)
+ endif()
+endif()
+
+include(AddonHelpers)
diff --git a/cmake/README.md b/cmake/README.md
new file mode 100644
index 0000000000..f3d727e548
--- /dev/null
+++ b/cmake/README.md
@@ -0,0 +1,299 @@
+# Kodi CMake based buildsystem
+
+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 and packaging
+Kodi for the following platforms:
+
+- 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.
+
+While the legacy build systems typically used in-source builds it's recommended
+to use out-of-source builds with CMake. The necessary runtime dependencies such
+as dlls, skins and configuration files are copied over to the build directory
+automatically.
+
+## Dependency installation
+
+### Linux
+
+The dependencies required to build on Linux can be found in
+[docs/README.xxx](https://github.com/xbmc/xbmc/tree/master/docs).
+
+### Raspberry Pi
+
+The cross compilation environment for the Raspberry Pi as well as the
+dependencies have to be installed as explained in
+[docs/README.raspberrypi](https://github.com/xbmc/xbmc/tree/master/docs/README.raspberrypi).
+
+### Windows
+
+For Windows the dependencies can be found in the
+[Wiki](http://kodi.wiki/view/HOW-TO:Compile_Kodi_for_Windows) (Step 1-4). If not already available on your pc, you should
+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).
+
+On Windows, the CMake based buildsystem requires that the binary dependencies
+are downloaded using `DownloadBuildDeps.bat` and `DownloadMingwBuildEnv.bat`
+and that the mingw libs (ffmpeg, libdvd and others) are built using
+`make-mingwlibs.bat`.
+
+### macOS
+
+For macOS the required dependencies can be found in
+[docs/README.osx](https://github.com/xbmc/xbmc/tree/master/docs/README.osx).
+
+On macOS it is necessary to build the dependencies in `tools/depends` using
+`./bootstrap && ./configure --host=<PLATFORM> && 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.
+
+### Android
+
+The dependencies needed to compile for Android can be found in
+[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).
+
+## Building Kodi
+
+This section lists the necessary commands for building Kodi with CMake.
+CMake supports different generators that can be classified into two categories:
+single- and multiconfiguration generators.
+
+A single configuration generator (GNU/NMake Makefiles) generates project files
+for a single build type (e.g. Debug, Release) specified at configure time.
+Multi configuration generators (Visual Studio, Xcode) allow to specify the
+build type at compile time.
+
+All examples below are for out-of-source builds with Kodi checked out to
+`<KODI_SRC>`:
+
+```
+mkdir kodi-build && cd kodi-build
+```
+
+### Linux with GNU Makefiles
+
+```
+cmake <KODI_SRC>/project/cmake/
+cmake --build . -- VERBOSE=1 -j$(nproc) # or: make VERBOSE=1 -j$(nproc)
+./kodi.bin
+```
+
+`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`<variable-name>=<value>` 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 <BUILD_DIR>/packages.
+
+### Raspberry Pi with GNU Makefiles
+
+```
+cmake -DCMAKE_TOOLCHAIN_FILE=<KODI_SRC>/tools/depends/target/Toolchain.cmake <KODI_SRC>/project/cmake/
+cmake --build . -- VERBOSE=1 -j$(nproc) # or: make VERBOSE=1 -j$(nproc)
+```
+
+### Windows with Visual Studio project files
+
+```
+cmake -G "Visual Studio 14" <KODI_SRC>/project/cmake/
+cmake --build . --config "Debug" # or: Build solution with Visual Studio
+Debug\kodi.exe
+```
+
+#### 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 "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release <KODI_SRC>/project/cmake/
+cmake --build . # or: nmake
+kodi.exe
+```
+
+### macOS with GNU Makefiles
+
+```
+cmake -DCMAKE_TOOLCHAIN_FILE=<KODI_SRC>/tools/depends/target/Toolchain.cmake <KODI_SRC>/project/cmake/
+cmake --build . -- VERBOSE=1 -j$(sysctl -n hw.ncpu) # or: make VERBOSE=1 -j$(sysctl -n hw.ncpu)
+./kodi.bin
+```
+
+### macOS with Xcode project files
+
+```
+cmake -DCMAKE_TOOLCHAIN_FILE=<KODI_SRC>/tools/depends/target/Toolchain.cmake -G "Xcode" <KODI_SRC>/project/cmake/
+cmake --build . --config "Release" -- -verbose -jobs $(sysctl -n hw.ncpu) # or: Build solution with Xcode
+./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
+
+```
+cmake -DCMAKE_TOOLCHAIN_FILE=<KODI_SRC>/tools/depends/target/Toolchain.cmake <KODI_SRC>/project/cmake/
+cmake --build . -- VERBOSE=1 -j$(nproc) # or: make VERBOSE=1 -j$(nproc)
+```
+
+#### Android package generation
+
+An installable APK for Android can be built with the following command:
+
+```
+make apk
+```
+
+## Options
+
+Kodi supports a number of build options that can enable or disable certain
+functionality.i These options must be set when running CMake with
+`-DENABLE_<OPTION>=<ON|OFF|AUTO`. The default is `AUTO` which enables
+the option if a certain dependency is found. For example CEC support is
+enabled if libCEC is available. `ON` forcefully enables the dependency
+and the CMake run will fail if the related dependency is not available.
+This is mostly useful for packagers. `OFF` will disable the feature.
+
+Example for forcefully enabling VAAPI and disabling VDPAU:
+
+```
+cmake ... -DENABLE_VAAPI=ON -DENABLE_VDPAU=OFF ...
+```
+
+Example for building with external FFMPEG:
+
+```
+cmake ... -DFFMPEG_PATH=/opt/ffmpeg -DENABLE_INTERNAL_FFMPEG=OFF ...
+```
+
+For more information and an updated list of option, please check the
+main [project/cmake/CMakeLists.txt](https://github.com/xbmc/xbmc/tree/master/project/cmake/CMakeLists.txt).
+
+## Tests
+
+Kodi uses Google Test as its testing framework. Each test file is scanned for tests and these
+are added to CTest, which is the native test driver for CMake.
+
+This scanning happens at configuration time. If tests depend on generated support files which
+should not be scanned, then those support files should be added to the SUPPORT_SOURCES
+variable as opposed to SOURCES before calling core_add_test. You might want to do this where
+the generated support files would not exist at configure time, or if they are so large that
+scanning them would take up an unreasonable amount of configure time.
+
+## Extra targets
+
+When using the makefile builds a few extra targets are defined:
+
+- `make check` builds and executes the test suite.
+- `make check-valgrind` builds and executes the test suite with valgrind memcheck.
+- `make doc` builds the Doxygen documentation.
+
+Code coverage (with Gcov, LCOV and Gcovr) can be built on Linux:
+
+- CMake has to be executed with `-DCMAKE_BUILD_TYPE=Coverage`
+- `make coverage` generates an HTML code coverage report.
+- `make coverage_xml` generates an XML code coverage report.
+
+## Building binary addons
+
+The CMake build system integrates with the addon build system if the GNU
+Makefile generator is used. This offers an easy way to build addons for
+packagers or Kodi developers who don't work on addons.
+
+```
+make binary-addons
+```
+
+Specific addons can be built with:
+
+```
+make binary-addons ADDONS="visualization.spectrum pvr.demo"
+```
+
+Addon developers can build single addons into the Kodi build directory
+so that the addon can be tested with self-compiled specific versions of Kodi.
+
+```
+mkdir pvr.demo-build && cd pvr.demo-build
+cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=<KODI_BUILD_DIR>/build -DKODI_BUILD_DIR=<KODI_BUILD_DIR> <pvr.demo-SRC>
+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
+
+This section covers some tips that can be useful for debugging a CMake
+based build.
+
+### Verbosity (show compiler and linker parameters)
+
+In order to see the exact compiler commands `make` and `nmake` can be
+executed with a `VERBOSE=1` parameter.
+
+On Windows, this is unfortunately not enough because `nmake` uses
+temporary files to workaround `nmake`'s command string length limitations.
+In order to see verbose output the file
+[Modules/Platform/Windows.cmake](https://github.com/Kitware/CMake/blob/master/Modules/Platform/Windows.cmake#L40)
+in the local CMake installation has to be adapted by uncommenting these
+lines:
+
+```
+# uncomment these out to debug nmake and borland makefiles
+#set(CMAKE_START_TEMP_FILE "")
+#set(CMAKE_END_TEMP_FILE "")
+#set(CMAKE_VERBOSE_MAKEFILE 1)
+```
diff --git a/cmake/addons/CMakeLists.txt b/cmake/addons/CMakeLists.txt
new file mode 100644
index 0000000000..96e544bb44
--- /dev/null
+++ b/cmake/addons/CMakeLists.txt
@@ -0,0 +1,434 @@
+cmake_minimum_required(VERSION 3.1)
+project(kodi-addons)
+
+list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
+
+option(ADDON_TARBALL_CACHING "Cache downloaded addon source tarballs?" ON)
+if(ADDON_TARBALL_CACHING)
+ message(STATUS "Addon source tarball caching is enabled")
+else()
+ message(STATUS "Addon source tarball caching is disabled")
+endif()
+
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE Release)
+endif()
+
+if(NOT CORE_SYSTEM_NAME)
+ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+ set(CORE_SYSTEM_NAME "osx")
+ else()
+ string(TOLOWER ${CMAKE_SYSTEM_NAME} CORE_SYSTEM_NAME)
+ endif()
+endif()
+
+include(ExternalProject)
+
+### setup all the necessary paths
+if(APP_ROOT)
+ set(CORE_SOURCE_DIR ${APP_ROOT})
+ unset(APP_ROOT)
+ message(WARNING "APP_ROOT is deprecated. Please use CORE_SOURCE_DIR instead.")
+endif()
+if(NOT CORE_SOURCE_DIR)
+ set(CORE_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../../..)
+else()
+ file(TO_CMAKE_PATH "${CORE_SOURCE_DIR}" CORE_SOURCE_DIR)
+endif()
+get_filename_component(CORE_SOURCE_DIR "${CORE_SOURCE_DIR}" ABSOLUTE)
+
+if(NOT BUILD_DIR)
+ set(BUILD_DIR "${CMAKE_BINARY_DIR}/build")
+else()
+ file(TO_CMAKE_PATH "${BUILD_DIR}" BUILD_DIR)
+endif()
+get_filename_component(BUILD_DIR "${BUILD_DIR}" ABSOLUTE)
+
+if(NOT ADDON_DEPENDS_PATH)
+ set(ADDON_DEPENDS_PATH "${BUILD_DIR}/depends")
+else()
+ file(TO_CMAKE_PATH "${ADDON_DEPENDS_PATH}" ADDON_DEPENDS_PATH)
+endif()
+get_filename_component(ADDON_DEPENDS_PATH "${ADDON_DEPENDS_PATH}" ABSOLUTE)
+
+if(NOT PLATFORM_DIR)
+ set(PLATFORM_DIR ${CORE_SOURCE_DIR}/project/cmake/platform/${CORE_SYSTEM_NAME})
+ file(TO_CMAKE_PATH "${PLATFORM_DIR}" PLATFORM_DIR)
+endif()
+
+# make sure CMAKE_PREFIX_PATH is set
+if(NOT CMAKE_PREFIX_PATH)
+ set(CMAKE_PREFIX_PATH "${ADDON_DEPENDS_PATH}")
+else()
+ file(TO_CMAKE_PATH "${CMAKE_PREFIX_PATH}" CMAKE_PREFIX_PATH)
+ list(APPEND CMAKE_PREFIX_PATH "${ADDON_DEPENDS_PATH}")
+endif()
+
+# check for autoconf stuff to pass on
+if(AUTOCONF_FILES)
+ string(REPLACE " " ";" AUTOCONF_FILES ${AUTOCONF_FILES})
+ set(CROSS_AUTOCONF "yes")
+endif()
+
+if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR NOT CMAKE_INSTALL_PREFIX)
+ set(CMAKE_INSTALL_PREFIX "${PROJECT_SOURCE_DIR}/output/addons")
+endif()
+list(APPEND CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX})
+
+set(BUILD_ARGS -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
+ -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
+ -DPACKAGE_CONFIG_PATH=${ADDON_DEPENDS_PATH}/lib/pkgconfig
+ -DADDON_DEPENDS_PATH=${ADDON_DEPENDS_PATH}
+ -DOVERRIDE_PATHS=${OVERRIDE_PATHS}
+ -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
+ -DCMAKE_USER_MAKE_RULES_OVERRIDE=${CMAKE_USER_MAKE_RULES_OVERRIDE}
+ -DCMAKE_USER_MAKE_RULES_OVERRIDE_CXX=${CMAKE_USER_MAKE_RULES_OVERRIDE_CXX}
+ -DCORE_SYSTEM_NAME=${CORE_SYSTEM_NAME}
+ -DBUILD_SHARED_LIBS=1
+ -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
+ -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS})
+
+if(MSVC)
+ # move cmake specific targets to a CMakePredefinedTargets folder in Visual Studio
+ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+endif()
+
+option(PACKAGE_ZIP "Prepare built addons for packaging" OFF)
+if(PACKAGE_ZIP)
+ # needed for project installing
+ list(APPEND BUILD_ARGS -DPACKAGE_ZIP=ON)
+
+ # figure out where to store the packaged ZIP archives
+ if(NOT PACKAGE_DIR)
+ set(PACKAGE_DIR "${BUILD_DIR}/zips")
+ else()
+ file(TO_CMAKE_PATH "${PACKAGE_DIR}" PACKAGE_DIR)
+ endif()
+ list(APPEND BUILD_ARGS -DPACKAGE_DIR=${PACKAGE_DIR})
+
+ message(STATUS "ZIP packaging enabled (destination: ${PACKAGE_DIR})")
+endif()
+
+if(CMAKE_TOOLCHAIN_FILE)
+ list(APPEND BUILD_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE})
+ message(STATUS "Toolchain specified")
+ message(STATUS ${BUILD_ARGS})
+endif()
+
+if(NOT ADDONS_TO_BUILD)
+ set(ADDONS_TO_BUILD "all")
+else()
+ string(STRIP "${ADDONS_TO_BUILD}" ADDONS_TO_BUILD)
+ message(STATUS "Building following addons: ${ADDONS_TO_BUILD}")
+ string(REPLACE " " ";" ADDONS_TO_BUILD ${ADDONS_TO_BUILD})
+endif()
+
+if(NOT ADDONS_DEFINITION_DIR)
+ set(ADDONS_DEFINITION_DIR ${PROJECT_SOURCE_DIR}/addons)
+else()
+ file(TO_CMAKE_PATH "${ADDONS_DEFINITION_DIR}" ADDONS_DEFINITION_DIR)
+endif()
+get_filename_component(ADDONS_DEFINITION_DIR "${ADDONS_DEFINITION_DIR}" ABSOLUTE)
+
+if(ADDON_SRC_PREFIX)
+ if(NOT IS_ABSOLUTE ${ADDON_SRC_PREFIX})
+ get_filename_component(ADDON_SRC_PREFIX "${CMAKE_BINARY_DIR}/${ADDON_SRC_PREFIX}" ABSOLUTE)
+ endif()
+ message(STATUS "Overriding addon source directory prefix: ${ADDON_SRC_PREFIX}")
+endif()
+
+if(NOT APP_LIB_DIR)
+ set(APP_LIB_DIR "${ADDON_DEPENDS_PATH}/lib/kodi")
+else()
+ file(TO_CMAKE_PATH "${APP_LIB_DIR}" APP_LIB_DIR)
+endif()
+
+set(APP_PREFIX "${CMAKE_INSTALL_PREFIX}")
+
+# check for platform specific stuff
+if(EXISTS ${PLATFORM_DIR}/defines.txt)
+ file(STRINGS ${PLATFORM_DIR}/defines.txt platformdefines)
+
+ if(NOT ARCH_DEFINES AND platformdefines)
+ set(ARCH_DEFINES ${platformdefines})
+ endif()
+endif()
+
+# include check_target_platform() function
+include(${CORE_SOURCE_DIR}/project/cmake/scripts/common/CheckTargetPlatform.cmake)
+
+set(ADDON_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
+if(NOT WIN32)
+ # check install permissions
+ check_install_permissions(${CMAKE_INSTALL_PREFIX} can_write)
+ if(NOT ${can_write} AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ set(NEED_SUDO TRUE)
+ set(ADDON_INSTALL_DIR ${CMAKE_BINARY_DIR}/.install)
+ list(APPEND BUILD_ARGS -DOVERRIDE_PATHS=ON)
+ message(STATUS "NEED_SUDO: ${NEED_SUDO} (no write permission for ${CMAKE_INSTALL_PREFIX})")
+ endif()
+endif()
+
+### prepare the build environment for the binary addons
+# copy the PrepareEnv.cmake script to the depends path so that we can include it
+file(COPY ${CORE_SOURCE_DIR}/project/cmake/scripts/common/PrepareEnv.cmake DESTINATION ${APP_LIB_DIR})
+
+# add the location of PrepareEnv.cmake to CMAKE_MODULE_PATH so that it is found
+list(APPEND CMAKE_MODULE_PATH ${APP_LIB_DIR})
+
+# include PrepareEnv.cmake which contains the logic to install the addon header bindings etc
+include(PrepareEnv)
+
+### add the depends subdirectory for any general dependencies
+message(STATUS "\n-- ---- Preparing general dependencies ----")
+add_subdirectory(depends)
+
+# add a custom target "package-addons" which will package and install all addons
+add_custom_target(package-addons)
+
+### get and build all the binary addons
+# look for all the addons to be built
+file(GLOB_RECURSE addons ${ADDONS_DEFINITION_DIR}/*.txt)
+
+#if there are no addons assume that bootstrapping hasn't happened yet
+if(NOT addons)
+ message(STATUS "Bootstrapping all default repositories as no addons were found...")
+ set(BOOTSTRAP_BUILD_DIR "${BUILD_DIR}/bootstrap")
+
+ # make sure that the bootstraps build addon exists
+ if(NOT EXISTS ${BOOTSTRAP_BUILD_DIR})
+ file(MAKE_DIRECTORY ${BOOTSTRAP_BUILD_DIR})
+ endif()
+
+ string(REPLACE ";" " " ADDONS_TO_BUILD_STR "${ADDONS_TO_BUILD}")
+ # generate the bootstrap buildsystem
+ execute_process(COMMAND ${CMAKE_COMMAND} ${PROJECT_SOURCE_DIR}/bootstrap
+ -DCMAKE_INSTALL_PREFIX:PATH=${ADDONS_DEFINITION_DIR}
+ -DBUILD_DIR:PATH=${BOOTSTRAP_BUILD_DIR}
+ -DADDONS_TO_BUILD:STRING=${ADDONS_TO_BUILD_STR}
+ -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
+ WORKING_DIRECTORY ${BOOTSTRAP_BUILD_DIR})
+
+ # execute the generated bootstrap buildsystem
+ execute_process(COMMAND ${CMAKE_COMMAND} --build ${BOOTSTRAP_BUILD_DIR}
+ WORKING_DIRECTORY ${BOOTSTRAP_BUILD_DIR})
+
+ # now look for all the addons to be built again
+ file(GLOB_RECURSE addons ${ADDONS_DEFINITION_DIR}/*.txt)
+
+ if(NOT addons)
+ message(FATAL_ERROR "No addons available to be built")
+ endif()
+endif()
+
+# Track if at least one addon has been found. Everything else is likely an
+# error either in ADDONS_TO_BUILD or in the directory configuration.
+set(SUPPORTED_ADDON_FOUND FALSE)
+
+foreach(addon ${addons})
+ if(NOT (addon MATCHES platforms.txt))
+ file(STRINGS ${addon} def)
+ string(REPLACE " " ";" def ${def})
+ list(GET def 0 id)
+
+ set(ADDON_FOUND FALSE)
+ # try to find a perfect match
+ list(FIND ADDONS_TO_BUILD ${id} idx)
+ if(idx GREATER -1 OR "${ADDONS_TO_BUILD}" STREQUAL "all")
+ set(ADDON_FOUND TRUE)
+ # Maybe we have a regex
+ elseif(id MATCHES "${ADDONS_TO_BUILD}")
+ message(STATUS "Pattern ${ADDONS_TO_BUILD} matches ${id}, building addon")
+ set(ADDON_FOUND TRUE)
+ endif()
+
+ if(ADDON_FOUND)
+ message(STATUS "\n-- ---- Configuring addon ${addon} ----")
+ set(SUPPORTED_ADDON_FOUND TRUE)
+
+ get_filename_component(dir ${addon} DIRECTORY)
+
+ # check if the addon has a platforms.txt
+ set(platform_found FALSE)
+ check_target_platform(${dir} ${CORE_SYSTEM_NAME} platform_found)
+
+ if(${platform_found})
+ # make sure the output directory is clean
+ file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/${id}/")
+
+ # get the URL and revision of the addon
+ list(LENGTH def deflength)
+ list(GET def 1 url)
+
+ set(archive_name ${id})
+ if(ADDON_SRC_PREFIX)
+ set(SOURCE_DIR ${ADDON_SRC_PREFIX}/${id})
+ set(archive_name "")
+ else()
+ set(SOURCE_DIR "")
+ endif()
+
+ # if there is a 3rd parameter in the file, we consider it a git revision
+ if(deflength GREATER 2 AND "${SOURCE_DIR}" STREQUAL "")
+ list(GET def 2 revision)
+
+ # we need access to a git executable
+ find_package(Git REQUIRED)
+
+ # resolve revision to git hash
+ execute_process(COMMAND ${GIT_EXECUTABLE} ls-remote ${url} ${revision} OUTPUT_VARIABLE revision_hash)
+ # git ls-remote only works on branches and tag names but not on revisions
+ if(NOT "${revision_hash}" STREQUAL "")
+ string(REPLACE "\t" ";" revision_list ${revision_hash})
+ list(GET revision_list 0 revision_hash)
+ message(STATUS "${id}: git branch/tag ${revision} resolved to hash: ${revision_hash}")
+ set(revision ${revision_hash})
+ endif()
+
+ # Note: downloading specific revisions via http in the format below is probably github specific
+ # if we ever use other repositories, this might need adapting
+ set(url ${url}/archive/${revision}.tar.gz)
+ set(archive_name ${archive_name}-${revision})
+ elseif("${SOURCE_DIR}" STREQUAL "")
+ # check if the URL starts with file://
+ string(REGEX MATCH "^file://.*$" local_url "${url}")
+
+ #if not we assume this to be a local directory
+ if(local_url)
+ # this is not an archive
+ set(archive_name "")
+
+ # remove the file:// protocol from the URL
+ string(REPLACE "file://" "" SOURCE_DIR "${url}")
+
+ # on win32 we may have to remove another leading /
+ if(WIN32)
+ # check if the path is a local path
+ string(REGEX MATCH "^/.*$" local_path "${SOURCE_DIR}")
+ if(local_path)
+ string(SUBSTRING "${SOURCE_DIR}" 1 -1 SOURCE_DIR)
+ endif()
+ endif()
+ endif()
+ endif()
+
+ # download the addon if necessary
+ if(NOT "${archive_name}" STREQUAL "")
+ # download and extract the addon
+ if(NOT ADDON_TARBALL_CACHING OR NOT EXISTS ${BUILD_DIR}/download/${archive_name}.tar.gz)
+ # cleanup any of the previously downloaded archives of this addon
+ file(GLOB archives "${BUILD_DIR}/download/${id}*.tar.gz")
+ if(archives)
+ message(STATUS "Removing old archives of ${id}: ${archives}")
+ file(REMOVE ${archives})
+ endif()
+
+ # download the addon
+ file(DOWNLOAD "${url}" "${BUILD_DIR}/download/${archive_name}.tar.gz" STATUS dlstatus LOG dllog SHOW_PROGRESS)
+ list(GET dlstatus 0 retcode)
+ if(NOT ${retcode} EQUAL 0)
+ message(FATAL_ERROR "ERROR downloading ${url} - status: ${dlstatus} log: ${dllog}")
+ endif()
+ endif()
+
+ # remove any previously extracted version of the addon
+ file(REMOVE_RECURSE "${BUILD_DIR}/${id}")
+
+ # extract the addon from the archive
+ execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzvf ${BUILD_DIR}/download/${archive_name}.tar.gz
+ WORKING_DIRECTORY ${BUILD_DIR})
+ file(GLOB extract_dir "${BUILD_DIR}/${archive_name}*")
+ if(extract_dir STREQUAL "")
+ message(FATAL_ERROR "${id}: error extracting ${BUILD_DIR}/download/${archive_name}.tar.gz")
+ else()
+ file(RENAME "${extract_dir}" "${BUILD_DIR}/${id}")
+ endif()
+
+ set(SOURCE_DIR ${BUILD_DIR}/${id})
+ endif()
+
+ if(NOT "${SOURCE_DIR}" STREQUAL "" AND EXISTS ${SOURCE_DIR})
+ # create a list of addons we are building
+ list(APPEND ALL_ADDONS_BUILDING ${id})
+
+ # setup the buildsystem for the addon
+ externalproject_add(${id}
+ SOURCE_DIR ${SOURCE_DIR}
+ INSTALL_DIR ${ADDON_INSTALL_DIR}
+ CMAKE_ARGS ${BUILD_ARGS})
+
+ # add a custom step to the external project between the configure and the build step which will always
+ # be executed and therefore forces a re-build of all changed files
+ externalproject_add_step(${id} forcebuild
+ COMMAND ${CMAKE_COMMAND} -E echo "Force build of ${id}"
+ DEPENDEES configure
+ DEPENDERS build
+ ALWAYS 1)
+
+ # add "kodi-platform" as a dependency to every addon
+ add_dependencies(${id} kodi-platform)
+
+ set(${id}_DEPENDS_DIR ${SOURCE_DIR}/depends)
+
+ if(EXISTS ${${id}_DEPENDS_DIR})
+ include(${CORE_SOURCE_DIR}/project/cmake/scripts/common/HandleDepends.cmake)
+ add_addon_depends(${id} ${${id}_DEPENDS_DIR})
+ if(${id}_DEPS AND NOT "${${id}_DEPS}" STREQUAL "")
+ message(STATUS "${id} DEPENDENCIES: ${${id}_DEPS}")
+ add_dependencies(${id} ${${id}_DEPS})
+ endif()
+ endif()
+
+ if(CROSS_AUTOCONF AND AUTOCONF_FILES)
+ if(EXISTS ${SOURCE_DIR}/bootstrap/autoreconf.txt)
+ file(STRINGS ${SOURCE_DIR}/bootstrap/autoreconf.txt conf_dirs)
+ foreach(conf_dir ${conf_dirs})
+ foreach(afile ${AUTOCONF_FILES})
+ message(STATUS "copying ${afile} to ${SOURCE_DIR}/${conf_dir}")
+ file(COPY ${afile} DESTINATION ${SOURCE_DIR}/${conf_dir})
+ endforeach()
+ endforeach()
+ endif()
+ endif()
+
+ # create a forwarding target to the addon-package target
+ add_custom_target(package-${id}
+ COMMAND ${CMAKE_COMMAND} --build ${id}-prefix/src/${id}-build --target addon-package
+ DEPENDS ${id})
+ add_dependencies(package-addons package-${id})
+
+ else()
+ message(FATAL_ERROR "${id}: invalid or missing addon source directory at ${SOURCE_DIR}")
+ endif()
+ else()
+ # add a dummy target for addons that are unsupported on this platform
+ add_custom_target(${id} COMMAND ${CMAKE_COMMAND} -E echo "IGNORED ${id} - not supported on ${CORE_SYSTEM_NAME}\n")
+ endif()
+ endif()
+ endif()
+endforeach()
+message(STATUS "")
+
+if(NEED_SUDO)
+ add_custom_target(sudo-install
+ COMMAND ${CMAKE_COMMAND} -E echo "sudo rights needed to install to ${CMAKE_INSTALL_PREFIX}\n"
+ COMMAND sudo ${CMAKE_COMMAND} -E copy_directory ${ADDON_INSTALL_DIR}/ ${CMAKE_INSTALL_PREFIX}/
+ COMMAND sudo -k)
+
+ foreach(_id ${ALL_ADDONS_BUILDING})
+ add_dependencies(sudo-install ${_id})
+ endforeach()
+ message(WARNING "sudo rights needed to install to ${CMAKE_INSTALL_PREFIX}")
+ message(STATUS "\nplease type \"make sudo-install\"\n\n")
+endif()
+
+if(NOT SUPPORTED_ADDON_FOUND)
+ message(FATAL_ERROR "${ADDONS_TO_BUILD} did not match any of the supported addons. \
+ A list of supported addons can be viewed by building the 'supported_addons' target. \
+ Addon definitions are loaded from ADDONS_DEFINITION_DIR (${ADDONS_DEFINITION_DIR}).")
+endif()
+
+# add custom target "supported_addons" that returns all addons that are supported on this platform
+string(REPLACE ";" " " ALL_ADDONS_BUILDING "${ALL_ADDONS_BUILDING}")
+add_custom_target(supported_addons COMMAND ${CMAKE_COMMAND} -E echo "ALL_ADDONS_BUILDING: ${ALL_ADDONS_BUILDING}" VERBATIM)
+add_custom_target(need-sudo COMMAND ${CMAKE_COMMAND} -E echo ${NEED_SUDO} VERBATIM)
diff --git a/cmake/addons/README.md b/cmake/addons/README.md
new file mode 100644
index 0000000000..6470ee1686
--- /dev/null
+++ b/cmake/addons/README.md
@@ -0,0 +1,65 @@
+![Kodi logo](https://raw.githubusercontent.com/xbmc/xbmc-forum/master/xbmc/images/logo-sbs-black.png)
+# Kodi add-ons CMake based buildsystem
+This directory contains the cmake-based buildsystem for Kodi add-ons. It looks into the directory pointed to by the *ADDONS_DEFINITION_DIR* option (which defaults to the *addons* sub-directory) and parses all *.txt files recursively. Each add-on must have its own `<addon-id>.txt` file in a separate sub-directory that must follow one of the defined formats:
+
+ - `<addon-id> <git-url> <git-revision>`
+ - `<addon-id> <tarball-url>`
+ - `<addon-id> <file://path>`
+
+where
+- `<addon-id>` must be identical to the add-on's ID as defined in the add-on's addon.xml
+- `<git-url>` must be the URL of the git repository containing the add-on
+- `<git-revision>` must be a valid git tag/branch/commit in the add-on's git repository which will be used for the build
+- `<tarball-url>` must be the URL to a .tar.gz tarball containing the add-on
+- `<file://path>` must be a *file://* based path to the directory containing the add-on
+
+## Reserved filenames
+- **platforms.txt**
+
+List of platforms to build an add-on for (or *all*). Negating platforms is supported using a leading exclamation mark, e.g. *!windows*.
+
+Available platforms are: linux, windows, osx, ios, android, rbpi and freebsd.
+
+#### Attention
+If no add-on definitions could be found, the buildsystem assumes that the bootstrapping of the add-on definition repositories hasn't been performed yet and automatically executes the add-on bootstrapping buildsystem located in the *bootstrap* sub-directory with the default settings (i.e. *all* add-ons from all pre-defined add-on definition repositories are bootstrapped into the directory pointed to by the *ADDONS_DEFINITION_DIR* option).
+
+## Buildsystem variables
+The buildsystem uses the following variables (which can be passed into it when executing cmake with the -D`<variable-name>=<value>` format) to manipulate the build process:
+- `ADDONS_TO_BUILD` has two variations, which are tested in order:
+ - a quoted, space delimited list of `<addon-id>s` that you want to build (default is *all*)
+ - a regular expression that every `<addon-id>` is matched against (e.g. `ADDONS_TO_BUILD="pvr.*"`) to build all pvr add-ons
+- `ADDONS_DEFINITION_DIR` points to the directory containing the definitions for the addons to be built
+- `ADDON_SRC_PREFIX` can be used to override the add-on repository location. It must point to the locally available parent directory of the add-on(s) to build. `<addon-id>` will be appended to this path automatically
+- `CMAKE_BUILD_TYPE` specifies the type of the build. This can be either *Debug* or *Release* (default is *Release*)
+- `CMAKE_INSTALL_PREFIX` points to the directory where the built add-ons and their additional files (addon.xml, resources, ...) will be installed to (defaults to `<ADDON_DEPENDS_PATH>`)
+- `CMAKE_TOOLCHAIN_FILE` can be used to pass a toolchain file into the add-on builds
+- `ADDON_DEPENDS_PATH` points to the directory containing the *include* and *lib* directories of the add-ons' dependencies.
+- `CORE_SOURCE_DIR` points to the root directory of the project (default is the absolute representation of ../../.. starting from this directory)
+- `BUILD_DIR` points to the directory where the add-ons and their dependencies will be downloaded and built
+- `PACKAGE_ZIP=ON` means that the add-ons will be 'packaged' into a common folder, rather than being placed in `<CMAKE_INSTALL_PREFIX>/lib/kodi/addons` and `<CMAKE_INSTALL_PREFIX>/share/kodi/addons`
+- `PACKAGE_DIR` points to the directory where the ZIP archived add-ons will be stored after they have been packaged (defaults to `<BUILD_DIR>/zips`)
+- `ARCH_DEFINES` specifies the platform-specific C/C++ preprocessor defines (defaults to empty)
+- `ADDON_TARBALL_CACHING` specifies whether downloaded add-on source tarballs should be cached or not (defaults to *ON*)
+
+## Deprecated buildsystem variables
+Buildsystem will print a warning if you use any of the below-listed variables. For now they still work but you should adapt your workflow to the new variables.
+- `APP_ROOT` - Use `CORE_SOURCE_DIR` instead
+
+## Building
+The buildsystem makes some assumptions about the environment which must be met by whoever uses it:
+- Any dependencies of the add-ons must already be built and their include and library files must be present in the path pointed to by `<CMAKE_PREFIX_PATH>` (in *include* and *lib* sub-directories)
+
+To trigger the cmake-based buildsystem the following command must be executed with `<path>` set to this directory (absolute or relative) allowing for in-source and out-of-source builds
+
+`cmake <path> -G <generator>`
+
+CMake supports multiple generators. See [here] (https://cmake.org/cmake/help/v3.1/manual/cmake-generators.7.html) for a list.
+
+In case of additional options the call might look like this:
+
+cmake `<path>` [-G `<generator>`] \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DCORE_SOURCE_DIR="`<path-to-app-root>`" \
+ -DARCH_DEFINES="-DTARGET_LINUX" \
+ -DADDON_DEPENDS_PATH=`<path-to-built-depends>` \
+ -DCMAKE_INSTALL_PREFIX="`<path-to-install-directory`"
diff --git a/cmake/addons/bootstrap/Bootstrap.cmake b/cmake/addons/bootstrap/Bootstrap.cmake
new file mode 100644
index 0000000000..5d20302590
--- /dev/null
+++ b/cmake/addons/bootstrap/Bootstrap.cmake
@@ -0,0 +1,39 @@
+list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
+
+# make sure that the installation location has been specified
+if(NOT CMAKE_INSTALL_PREFIX)
+ message(FATAL_ERROR "CMAKE_INSTALL_PREFIX has not been specified")
+endif()
+
+# figure out which addons to bootstrap (defaults to all)
+if(NOT ADDONS_TO_BUILD)
+ set(ADDONS_TO_BUILD "all")
+else()
+ string(STRIP "${ADDONS_TO_BUILD}" ADDONS_TO_BUILD)
+ message(STATUS "Bootstrapping following addons: ${ADDONS_TO_BUILD}")
+ string(REPLACE " " ";" ADDONS_TO_BUILD ${ADDONS_TO_BUILD})
+endif()
+
+# find all addon definitions and go through them
+file(GLOB_RECURSE ADDON_DEFINITIONS ${PROJECT_SOURCE_DIR}/*.txt)
+foreach(ADDON_DEFINITION_FILE ${ADDON_DEFINITIONS})
+ # ignore platforms.txt
+ if(NOT (ADDON_DEFINITION_FILE MATCHES platforms.txt))
+ # read the addon definition file
+ file(STRINGS ${ADDON_DEFINITION_FILE} ADDON_DEFINITION)
+ string(REPLACE " " ";" ADDON_DEFINITION ${ADDON_DEFINITION})
+
+ # extract the addon definition's identifier
+ list(GET ADDON_DEFINITION 0 ADDON_ID)
+
+ # check if the addon definition should be built
+ if(ADDON_ID MATCHES "^${ADDONS_TO_BUILD}" OR ADDONS_TO_BUILD STREQUAL all)
+ # get the path to the addon definition directory
+ get_filename_component(ADDON_DEFINITION_DIR ${ADDON_DEFINITION_FILE} DIRECTORY)
+
+ # install the addon definition
+ message(STATUS "Bootstrapping ${ADDON_ID} addon...")
+ file(INSTALL ${ADDON_DEFINITION_DIR} DESTINATION ${CMAKE_INSTALL_PREFIX})
+ endif()
+ endif()
+endforeach()
diff --git a/cmake/addons/bootstrap/CMakeLists.txt b/cmake/addons/bootstrap/CMakeLists.txt
new file mode 100644
index 0000000000..c20b97efca
--- /dev/null
+++ b/cmake/addons/bootstrap/CMakeLists.txt
@@ -0,0 +1,94 @@
+cmake_minimum_required(VERSION 3.1)
+project(kodi-addons-bootstrap)
+
+list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
+
+# make sure CMAKE_INSTALL_PREFIX is properly set
+if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR NOT CMAKE_INSTALL_PREFIX)
+ set(CMAKE_INSTALL_PREFIX "${PROJECT_SOURCE_DIR}/../addons")
+endif()
+list(APPEND CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX})
+
+# figure out where the build directory is located
+if(NOT BUILD_DIR)
+ set(BUILD_DIR "${CMAKE_BINARY_DIR}/build")
+else()
+ file(TO_CMAKE_PATH "${BUILD_DIR}" BUILD_DIR)
+endif()
+get_filename_component(BUILD_DIR "${BUILD_DIR}" ABSOLUTE)
+
+# make sure that the repositories to build have been specified
+if(NOT REPOSITORY_TO_BUILD)
+ set(REPOSITORY_TO_BUILD_DEFAULT ON)
+ set(REPOSITORY_TO_BUILD "all")
+ set(REPOSITORY_REVISION "")
+ message(STATUS "Bootstrapping all repositories")
+else()
+ set(REPOSITORY_TO_BUILD_DEFAULT OFF)
+ message(STATUS "Bootstrapping following repository: ${REPOSITORY_TO_BUILD}")
+endif()
+
+# figure out which addons to bootstrap (defaults to all)
+if(NOT ADDONS_TO_BUILD)
+ set(ADDONS_TO_BUILD "all")
+ message(STATUS "Bootstrapping all addons")
+else()
+ message(STATUS "Bootstrapping following addons: ${ADDONS_TO_BUILD}")
+endif()
+
+include(ExternalProject)
+
+function(bootstrap_repo repo_id repo_url repo_revision)
+ message(STATUS "Bootstrapping addons from ${repo_id} (${repo_url} ${repo_revision})...")
+ externalproject_add(${repo_id}
+ GIT_REPOSITORY ${repo_url}
+ GIT_TAG ${repo_revision}
+ PREFIX ${BUILD_DIR}/${repo_id}
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ${CMAKE_COMMAND}
+ -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
+ -DPROJECT_SOURCE_DIR=<SOURCE_DIR>
+ -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
+ -DADDONS_TO_BUILD=${ADDONS_TO_BUILD}
+ -P ${PROJECT_SOURCE_DIR}/Bootstrap.cmake
+ )
+endfunction()
+
+# look for all addons repository definitions
+set(REPOSITORY_TO_BUILD_FOUND OFF)
+file(GLOB repos repositories/*.txt)
+foreach(repo ${repos})
+ file(STRINGS ${repo} repo_definition)
+ string(REPLACE " " ";" repo_definition ${repo_definition})
+ list(GET repo_definition 0 repo_id)
+
+ list(FIND REPOSITORY_TO_BUILD ${repo_id} idx)
+ if(idx GREATER -1 OR REPOSITORY_TO_BUILD STREQUAL "all")
+ set(REPOSITORY_TO_BUILD_FOUND ON)
+
+ # get the URL of the repository
+ list(GET repo_definition 1 repo_url)
+
+ # get the revision of the repository if not provided as an argument
+ if(NOT REPOSITORY_REVISION)
+ list(GET repo_definition 2 repo_revision)
+ else()
+ set(repo_revision "${REPOSITORY_REVISION}")
+ endif()
+
+ bootstrap_repo(${repo_id} ${repo_url} ${repo_revision})
+ endif()
+endforeach()
+
+# if we have been asked to bootstrap a specific repository (not the default one) and
+# it couldn't be found in the predefined repository definitions we assume that it's a
+# URL to a specific repository
+if(NOT REPOSITORY_TO_BUILD_DEFAULT AND NOT REPOSITORY_TO_BUILD_FOUND)
+ # default to the master branch if no revision has been provided
+ if(NOT REPOSITORY_REVISION)
+ set(REPOSITORY_REVISION "master")
+ endif()
+
+ bootstrap_repo(binary-addons-custom ${REPOSITORY_TO_BUILD} ${REPOSITORY_REVISION})
+endif()
diff --git a/cmake/addons/bootstrap/README.md b/cmake/addons/bootstrap/README.md
new file mode 100644
index 0000000000..b886b5b8c9
--- /dev/null
+++ b/cmake/addons/bootstrap/README.md
@@ -0,0 +1,48 @@
+# KODI ADDON DEFINITIONS BOOTSTRAPPING
+This directory contains the cmake-based buildsystem for addon definitions
+bootstrapping which downloads the addon definitions from one or more addon
+definitions repositories. These addon definitions are then used by the addon
+buildsystem to figure out which addons and which versions to build. It looks
+into the "repositories" sub-directory and parses all *.txt files recursively.
+Each addon definitions repository must have its own <repository>.txt file which
+must follow the following defined format:
+```
+<repository> <git-url> <git-revision>
+```
+where
+* `<repository>` is the identification of the repository.
+* `<git-url>` must be the URL of the git repository containing the addon
+ definitions
+* `<git-revision>` must be a valid git tag/branch/commit in the addon
+ definitions repository's git repository which will be used for the build
+
+The buildsystem uses the following variables (which can be passed into it when
+executing cmake with the `-D<variable-name>=<value>` option):
+* `CMAKE_INSTALL_PREFIX` points to the directory where the downloaded addon
+definitions will be installed to (defaults to `../addons`).
+* `BUILD_DIR` points to the directory where the addon definitions repositories
+will be downloaded to.
+* `REPOSITORY_TO_BUILD` specifies a single addon definitions repository to be
+downloaded and processed (defaults to `"all"`).
+* `REPOSITORY_REVISION` specifies the git revision in the addon definitions
+repository which will be used for the build. This option is only valid in
+combination with the `REPOSITORY_TO_BUILD` option (defaults to the git
+revision specified in the repository's definition file).
+* `ADDONS_TO_BUILD` is a quoted, space delimited list of `<addon-id>`s that
+should be bootstrapped (default is `"all"`).
+
+To trigger the cmake-based buildsystem the following command must be executed
+with <path> being the path to this directory (absolute or relative, allowing for
+in-source and out-of-source builds).
+```
+cmake <path> -G <generator>
+```
+
+cmake supports multiple generators, see
+http://www.cmake.org/cmake/help/v2.8.8/cmake.html#section_Generators for a list.
+
+In case of additional options the call might look like this
+```
+cmake <path> [-G <generator>] \
+ -DCMAKE_INSTALL_PREFIX="<path-to-install-directory>"
+``` \ No newline at end of file
diff --git a/cmake/addons/bootstrap/repositories/binary-addons.txt b/cmake/addons/bootstrap/repositories/binary-addons.txt
new file mode 100644
index 0000000000..8674f06b82
--- /dev/null
+++ b/cmake/addons/bootstrap/repositories/binary-addons.txt
@@ -0,0 +1 @@
+binary-addons https://github.com/xbmc/repo-binary-addons.git master \ No newline at end of file
diff --git a/cmake/addons/depends/CMakeLists.txt b/cmake/addons/depends/CMakeLists.txt
new file mode 100644
index 0000000000..622701de79
--- /dev/null
+++ b/cmake/addons/depends/CMakeLists.txt
@@ -0,0 +1,41 @@
+cmake_minimum_required(VERSION 3.1)
+project(kodi-addons-depends)
+
+list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
+
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE Release)
+endif()
+
+if(NOT CORE_SYSTEM_NAME)
+ string(TOLOWER ${CMAKE_SYSTEM_NAME} CORE_SYSTEM_NAME)
+endif()
+
+include(ExternalProject)
+
+if(NOT ADDON_DEPENDS_PATH)
+ set(ADDON_DEPENDS_PATH ${PROJECT_SOURCE_DIR}/../build/depends)
+else()
+ file(TO_CMAKE_PATH "${ADDON_DEPENDS_PATH}" ADDON_DEPENDS_PATH)
+endif()
+get_filename_component(ADDON_DEPENDS_PATH "${ADDON_DEPENDS_PATH}" ABSOLUTE)
+list(APPEND CMAKE_PREFIX_PATH ${ADDON_DEPENDS_PATH})
+
+if(NOT BUILD_DIR)
+ set(BUILD_DIR "${CMAKE_BINARY_DIR}/build")
+else()
+ file(TO_CMAKE_PATH "${BUILD_DIR}" BUILD_DIR)
+endif()
+get_filename_component(BUILD_DIR "${BUILD_DIR}" ABSOLUTE)
+
+## use add_addon_depends to handle the cmake based dependencies
+include(${CORE_SOURCE_DIR}/project/cmake/scripts/common/HandleDepends.cmake)
+add_addon_depends(depends "${PROJECT_SOURCE_DIR}")
+
+## if there's a platform-specific sub-directory containing a CMakeLists.txt, add it to the build as well
+if(EXISTS ${PROJECT_SOURCE_DIR}/${CORE_SYSTEM_NAME}/CMakeLists.txt)
+ message(STATUS "Processing ${CORE_SYSTEM_NAME}")
+ add_subdirectory(${CORE_SYSTEM_NAME})
+else()
+ message(STATUS "No platform specific file ${PROJECT_SOURCE_DIR}/${CORE_SYSTEM_NAME}/CMakeLists.txt found")
+endif()
diff --git a/cmake/addons/depends/README b/cmake/addons/depends/README
new file mode 100644
index 0000000000..584a167f72
--- /dev/null
+++ b/cmake/addons/depends/README
@@ -0,0 +1,61 @@
+KODI ADDON DEPENDENCIES
+=======================
+This directory contains the cmake-based buildsystem for addon dependencies. It
+looks into the "common" and the "<platform>/cmake" sub-directories and parses
+all *.txt files recursively. Each dependency must have its own <dependency>.txt
+file (either in the main sub-directory or in a separate subdirectory of the main
+subdirectory) which must follow one of the defined formats:
+ * an empty file means that no extra downloads are necessary
+ * <dependency>
+ * <dependency> <url>
+ * <dependency> <git-url> <git-revision>
+where
+ * <dependency> must be identical to the filename
+ * <url> must be the URL to an archive that is downloaded and extracted.
+ * <git-url> must be the URL of the git repository containing the
+ dependency.
+ * <git-revision> must be a valid git tag/branch/commit in the dependency's git
+ repository which will be used for the build.
+
+Reserved filenames (for additional information on how to build a dependency)
+are:
+ * CMakeLists.txt: build instructions for the dependency
+ * install.txt: instructions on how to install the dependency's built files
+ * noinstall.txt: no installation step required (content is ignored)
+ * flags.txt: additional build flags
+ * deps.txt: whitespace separated list of dependencies of this dependency
+
+The buildsystem uses the following variables (which can be passed into it when
+executing cmake with the -D<variable-name>=<value> option) to e.g. access
+specific paths:
+ * CMAKE_BUILD_TYPE specifies the type of the build. This can be either "Debug"
+ or "Release" (default is "Release").
+ * CMAKE_TOOLCHAIN_FILE can be used to pass a toolchain file into the add-on
+ builds.
+ * CORE_SYSTEM_NAME is the name of the platform (e.g. "linux" or "android") in
+ lower-case (defaults to lowercase(CMAKE_SYSTEM_NAME)).
+ * CORE_SOURCE_DIR points to the root directory of the project (default is the
+ absolute representation of ../../.. starting from this directory).
+ * ADDON_DEPENDS_PATH points to the directory where the built dependencies
+ (their include and library file) will be installed to.
+ * ARCH_DEFINES specifies the platform-specific C/C++ preprocessor defines
+ (defaults to empty).
+ * DEPENDS_TO_BUILD is a quoted, space delimited list of <dependency>s that
+ you want to build (default is "all").
+
+To trigger the cmake-based buildsystem the following command must be executed
+with <path> being the path to this directory (absolute or relative, allowing for
+in-source and out-of-source builds).
+
+ cmake <path> -G <generator>
+
+cmake supports multiple generators, see
+http://www.cmake.org/cmake/help/v2.8.8/cmake.html#section_Generators for a list.
+
+In case of additional options the call might look like this
+
+ cmake <path> [-G <generator>] \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DCORE_SOURCE_DIR="<path-to-project-root>" \
+ -DARCH_DEFINES="-DTARGET_LINUX" \
+ -DCMAKE_INSTALL_PREFIX="<path-to-install-directory"
diff --git a/cmake/addons/depends/common/kodi-platform/deps.txt b/cmake/addons/depends/common/kodi-platform/deps.txt
new file mode 100644
index 0000000000..b9538152d3
--- /dev/null
+++ b/cmake/addons/depends/common/kodi-platform/deps.txt
@@ -0,0 +1,2 @@
+tinyxml
+p8-platform
diff --git a/cmake/addons/depends/common/kodi-platform/kodi-platform.txt b/cmake/addons/depends/common/kodi-platform/kodi-platform.txt
new file mode 100644
index 0000000000..46ef93cc94
--- /dev/null
+++ b/cmake/addons/depends/common/kodi-platform/kodi-platform.txt
@@ -0,0 +1 @@
+kodi-platform https://github.com/xbmc/kodi-platform c8188d82678fec6b784597db69a68e74ff4986b5
diff --git a/cmake/addons/depends/common/p8-platform/p8-platform.txt b/cmake/addons/depends/common/p8-platform/p8-platform.txt
new file mode 100644
index 0000000000..7db4e36ec1
--- /dev/null
+++ b/cmake/addons/depends/common/p8-platform/p8-platform.txt
@@ -0,0 +1 @@
+p8-platform https://github.com/Pulse-Eight/platform.git 38343e0acd6a636ac46139aa666aee4a8d1f13db
diff --git a/cmake/addons/depends/common/tinyxml/CMakeLists.txt b/cmake/addons/depends/common/tinyxml/CMakeLists.txt
new file mode 100644
index 0000000000..ec396eeb40
--- /dev/null
+++ b/cmake/addons/depends/common/tinyxml/CMakeLists.txt
@@ -0,0 +1,22 @@
+cmake_minimum_required(VERSION 3.1)
+project(tinyxml)
+
+set(SOURCES src/tinystr.cpp
+ src/tinyxml.cpp
+ src/tinyxmlerror.cpp
+ src/tinyxmlparser.cpp)
+
+if(WIN32)
+ add_definitions(-DWIN32 -D_LIB)
+endif()
+add_definitions(-DTIXML_USE_STL)
+
+add_library(tinyxml ${SOURCES})
+
+include_directories(${PROJECT_SOURCE_DIR}/include)
+
+set(HEADERS ${PROJECT_SOURCE_DIR}/include/tinystr.h
+ ${PROJECT_SOURCE_DIR}/include/tinyxml.h)
+
+install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
+install(TARGETS tinyxml DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
diff --git a/cmake/addons/depends/common/tinyxml/tinyxml.txt b/cmake/addons/depends/common/tinyxml/tinyxml.txt
new file mode 100644
index 0000000000..f8e05e8756
--- /dev/null
+++ b/cmake/addons/depends/common/tinyxml/tinyxml.txt
@@ -0,0 +1 @@
+tinyxml http://mirrors.kodi.tv/build-deps/sources/tinyxml-2.6.2_2.tar.gz
diff --git a/cmake/addons/depends/windows/CMakeLists.txt b/cmake/addons/depends/windows/CMakeLists.txt
new file mode 100644
index 0000000000..c8739c08ec
--- /dev/null
+++ b/cmake/addons/depends/windows/CMakeLists.txt
@@ -0,0 +1,52 @@
+cmake_minimum_required(VERSION 3.1)
+project(kodi-addons-depends-windows)
+
+list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
+
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE Release)
+endif()
+
+include(ExternalProject)
+
+if(NOT ADDON_DEPENDS_PATH)
+ message(FATAL_ERROR "ADDON_DEPENDS_PATH (${ADDON_DEPENDS_PATH}) is not a valid target directory.")
+else()
+ file(TO_CMAKE_PATH "${ADDON_DEPENDS_PATH}" ADDON_DEPENDS_PATH)
+endif()
+get_filename_component(ADDON_DEPENDS_PATH "${ADDON_DEPENDS_PATH}" ABSOLUTE)
+list(APPEND CMAKE_PREFIX_PATH ${ADDON_DEPENDS_PATH})
+
+if(NOT DEPENDS_TO_BUILD)
+ set(DEPENDS_TO_BUILD "all")
+endif()
+
+function(add_internal id url inputfile)
+ externalproject_add(${id}
+ URL ${url}
+ PREFIX build/${id}
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ${CMAKE_COMMAND}
+ -DINPUTDIR=${PROJECT_BINARY_DIR}/build/${id}/src/${id}
+ -DINPUTFILE=${inputfile}
+ -DDESTDIR=${ADDON_DEPENDS_PATH}
+ -P ${PROJECT_SOURCE_DIR}/Install.cmake
+ )
+endfunction()
+
+file(GLOB_RECURSE download_input_files prebuilt/*.txt)
+foreach(file ${download_input_files})
+ if(NOT file MATCHES install.txt)
+ file(STRINGS ${file} def)
+ get_filename_component(dir ${file} DIRECTORY)
+ string(REPLACE " " ";" def ${def})
+ list(GET def 0 id)
+
+ list(FIND DEPENDS_TO_BUILD ${id} idx)
+ if(idx GREATER -1 OR DEPENDS_TO_BUILD STREQUAL "all")
+ list(GET def 1 url)
+ add_internal(${id} ${url} ${dir}/install.txt)
+ endif()
+ endif()
+endforeach()
diff --git a/cmake/addons/depends/windows/Install.cmake b/cmake/addons/depends/windows/Install.cmake
new file mode 100644
index 0000000000..9a3adbb7c3
--- /dev/null
+++ b/cmake/addons/depends/windows/Install.cmake
@@ -0,0 +1,24 @@
+if(EXISTS "${INPUTFILE}")
+ # if there's an input file we use it to determine which files to copy where
+ file(STRINGS ${INPUTFILE} FILES)
+ string(REPLACE "\n" ";" FILES "${FILES}")
+ foreach(file ${FILES})
+ string(REPLACE " " ";" file "${file}")
+ list(GET file 0 dir)
+ list(GET file 1 dest)
+ list(LENGTH file deflength)
+ if(deflength GREATER 2)
+ list(GET file 2 copy)
+ endif()
+ file(GLOB files ${INPUTDIR}/${dir})
+ foreach(instfile ${files})
+ file(COPY ${instfile} DESTINATION ${DESTDIR}/${dest})
+ if(copy)
+ file(COPY ${instfile} DESTINATION ${DESTDIR}/${copy})
+ endif()
+ endforeach()
+ endforeach()
+else()
+ # otherwise we assume that the content of the extracted archive is already well-formed and can just be copied
+ file(COPY ${INPUTDIR}/${dir} DESTINATION ${DESTDIR})
+endif() \ No newline at end of file
diff --git a/cmake/addons/depends/windows/README b/cmake/addons/depends/windows/README
new file mode 100644
index 0000000000..67dc59451d
--- /dev/null
+++ b/cmake/addons/depends/windows/README
@@ -0,0 +1,19 @@
+KODI WIN32 ADDON DEPENDENCIES
+=============================
+This directory contains the cmake-based buildsystem for dependencies (currently
+only prebuilt) used by one or multiple addons. The buildsystem looks into the
+"prebuilt" sub-directory, downloads all the specified dependencies, extracts
+them and places them into the "depends" sub-directory.
+
+To trigger the cmake-based buildsystem the following command must be executed
+with <path> being the path to this directory (absolute or relative, allowing for
+in-source and out-of-source builds).
+
+ cmake <path> [-G <generator>]
+
+cmake supports multiple generators, see
+http://www.cmake.org/cmake/help/v2.8.8/cmake.html#section_Generators for a list.
+For win32 builds one of the "Visual Studio XX" or the "NMake Makefiles"
+generators is preferred. For the "NMake Makefiles" generator to work the above
+command must be called from an environment prepared for VC++ builds (see
+http://msdn.microsoft.com/en-us/library/f2ccy3wt.aspx).
diff --git a/cmake/addons/depends/windows/cmake/mingw/CMakeLists.txt b/cmake/addons/depends/windows/cmake/mingw/CMakeLists.txt
new file mode 100644
index 0000000000..2c2c4b8e3f
--- /dev/null
+++ b/cmake/addons/depends/windows/cmake/mingw/CMakeLists.txt
@@ -0,0 +1,33 @@
+cmake_minimum_required(VERSION 3.1)
+project(mingw)
+
+function(generate_mingw32_wrapper cmd)
+ set(CMD ${cmd})
+ configure_file(${PROJECT_SOURCE_DIR}/mingw32-cmd.bat.in ${MINGW_PATH}/bin/${CMD}.bat @ONLY)
+endfunction()
+
+get_filename_component(CORE_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../../../../../../.. REALPATH)
+
+set(MSYS_PATH "${CORE_SOURCE_DIR}/project/BuildDependencies/msys64")
+set(MINGW_PATH "${MSYS_PATH}/mingw32")
+
+# configure the MinGW toolchain file
+configure_file(${PROJECT_SOURCE_DIR}/Toolchain_mingw32.cmake.in ${CMAKE_INSTALL_PREFIX}/Toolchain_mingw32.cmake @ONLY)
+
+# configure MinGWConfig.cmake
+configure_file(${PROJECT_SOURCE_DIR}/MinGWConfig.cmake.in ${CMAKE_INSTALL_PREFIX}/MinGWConfig.cmake)
+
+# TODO: MinGW GCC 5.3.0-1 comes without cc.exe, Remove this once package is bumped to 5.3.0-p2
+# See https://github.com/Alexpux/MINGW-packages/pull/1034
+if(NOT EXISTS ${MINGW_PATH}/bin/cc.exe)
+ execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${MINGW_PATH}/bin/gcc.exe ${MINGW_PATH}/bin/cc.exe)
+endif()
+
+# configure the MinGW wrapper batch scripts
+generate_mingw32_wrapper("make")
+generate_mingw32_wrapper("gcc")
+generate_mingw32_wrapper("cc")
+generate_mingw32_wrapper("g++")
+generate_mingw32_wrapper("ar")
+generate_mingw32_wrapper("ld")
+generate_mingw32_wrapper("windres")
diff --git a/cmake/addons/depends/windows/cmake/mingw/MinGWConfig.cmake.in b/cmake/addons/depends/windows/cmake/mingw/MinGWConfig.cmake.in
new file mode 100644
index 0000000000..2d6baa777d
--- /dev/null
+++ b/cmake/addons/depends/windows/cmake/mingw/MinGWConfig.cmake.in
@@ -0,0 +1,3 @@
+set(MINGW_INCLUDE_DIRS @MINGW_PATH@/include)
+set(MINGW_MAKE @MINGW_PATH@/bin/make.bat -j$ENV{NUMBER_OF_PROCESSORS})
+set(MINGW_FOUND 1)
diff --git a/cmake/addons/depends/windows/cmake/mingw/Toolchain_mingw32.cmake.in b/cmake/addons/depends/windows/cmake/mingw/Toolchain_mingw32.cmake.in
new file mode 100644
index 0000000000..01d281d8a1
--- /dev/null
+++ b/cmake/addons/depends/windows/cmake/mingw/Toolchain_mingw32.cmake.in
@@ -0,0 +1,17 @@
+set(CMAKE_SYSTEM_VERSION 1)
+set(CMAKE_SYSTEM_NAME Windows)
+
+set(CMAKE_FIND_ROOT_PATH @CMAKE_FIND_ROOT_PATH@ @CMAKE_INSTALL_PREFIX@ @MSYS_PATH@ @MINGW_PATH@)
+
+# specify the cross compiler
+set(CMAKE_C_COMPILER @MINGW_PATH@/bin/gcc.bat)
+set(CMAKE_CXX_COMPILER @MINGW_PATH@/bin/g++.bat)
+set(CMAKE_AR @MINGW_PATH@/bin/ar.bat CACHE FILEPATH "Archiver")
+set(CMAKE_LINKER @MINGW_PATH@/bin/ld.bat CACHE FILEPATH "Linker")
+SET(CMAKE_RC_COMPILER @MINGW_PATH@/bin/windres.bat)
+
+# search for programs in the build host directories
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+# for libraries and headers in the target directories
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
diff --git a/cmake/addons/depends/windows/cmake/mingw/mingw.txt b/cmake/addons/depends/windows/cmake/mingw/mingw.txt
new file mode 100644
index 0000000000..90aa6aee7e
--- /dev/null
+++ b/cmake/addons/depends/windows/cmake/mingw/mingw.txt
@@ -0,0 +1 @@
+mingw
diff --git a/cmake/addons/depends/windows/cmake/mingw/mingw32-cmd.bat.in b/cmake/addons/depends/windows/cmake/mingw/mingw32-cmd.bat.in
new file mode 100644
index 0000000000..44a0ea2cc9
--- /dev/null
+++ b/cmake/addons/depends/windows/cmake/mingw/mingw32-cmd.bat.in
@@ -0,0 +1,6 @@
+@ECHO OFF
+SETLOCAL
+
+SET PATH=@MINGW_PATH@/bin;@MSYS_PATH@/usr/bin;%PATH%
+@CMD@.exe %*
+
diff --git a/cmake/addons/depends/windows/cmake/mingw/noinstall.txt b/cmake/addons/depends/windows/cmake/mingw/noinstall.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/cmake/addons/depends/windows/cmake/mingw/noinstall.txt
diff --git a/cmake/addons/depends/windows/cmake/msys/CMakeLists.txt b/cmake/addons/depends/windows/cmake/msys/CMakeLists.txt
new file mode 100644
index 0000000000..1c0536e902
--- /dev/null
+++ b/cmake/addons/depends/windows/cmake/msys/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 3.1)
+project(msys LANGUAGES NONE)
+
+# This is an empty dummy dependency because a lot of game addons depend on it.
+# After they got fixed, this can be removed.
diff --git a/cmake/addons/depends/windows/cmake/msys/msys.txt b/cmake/addons/depends/windows/cmake/msys/msys.txt
new file mode 100644
index 0000000000..00de9c2b98
--- /dev/null
+++ b/cmake/addons/depends/windows/cmake/msys/msys.txt
@@ -0,0 +1 @@
+msys
diff --git a/cmake/addons/depends/windows/cmake/msys/noinstall.txt b/cmake/addons/depends/windows/cmake/msys/noinstall.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/cmake/addons/depends/windows/cmake/msys/noinstall.txt
diff --git a/cmake/addons/depends/windows/prebuilt/README b/cmake/addons/depends/windows/prebuilt/README
new file mode 100644
index 0000000000..a0c70d6bde
--- /dev/null
+++ b/cmake/addons/depends/windows/prebuilt/README
@@ -0,0 +1,21 @@
+KODI WIN32 PREBUILT ADDON DEPENDENCIES
+======================================
+This directory contains a file or sub-directory for every prebuilt dependency
+used by one of the addons being built. There are two different modes supported.
+Both include a file named <library-id>.txt which must follow the defined format
+ <library-id> <download-url>
+
+If the archive, which the <download-url> points at, contains
+ * only the necessary files and in the proper directory structure (i.e. an
+ "include" and a "lib" directory) then the file must be put into this
+ directory and nothing else is needed.
+ * unnecessary files and/or does not follow the defined directory structure
+ (i.e. an "include" and a "lib" directory) then the file must be put into a
+ sub-directory named <library-id>. Furthermore an additional file called
+ "install.txt" must be placed in that sub-directory. install.txt contains a
+ line for every path/directory/file with a destination where it must be copied
+ to. It must follow the defined format
+ <source> <destination> [<copy-destination>]
+ where <source> must be an existing file, directory or a path containing
+ wildcards, <destination> and the optional <copy-destination> must be existing
+ directories.
diff --git a/cmake/cpack/CPackConfigDEB.cmake b/cmake/cpack/CPackConfigDEB.cmake
new file mode 100644
index 0000000000..cb8e59e840
--- /dev/null
+++ b/cmake/cpack/CPackConfigDEB.cmake
@@ -0,0 +1,352 @@
+# include Macros.cmake to automate generation of time/date stamps, maintainer, etc.
+include(${PROJECT_SOURCE_DIR}/scripts/common/Macros.cmake)
+
+# find stuff we need
+find_program(LSB_RELEASE_CMD lsb_release)
+find_program(DPKG_CMD dpkg)
+find_package(Git)
+find_program(GZIP_CMD gzip)
+
+# set packaging dir
+if(NOT CPACK_PACKAGE_DIRECTORY)
+ set(CPACK_PACKAGE_DIRECTORY ${CMAKE_BINARY_DIR}/packages)
+endif()
+
+# force CPack generated DEBs to use the same path as CMAKE_INSTALL_PREFIX
+set(CPACK_SET_DESTDIR true)
+
+# set architecture
+if(NOT CPACK_SYSTEM_NAME)
+ set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_PROCESSOR})
+ # sanity check
+ if(CPACK_SYSTEM_NAME STREQUAL x86_64)
+ set(CPACK_SYSTEM_NAME amd64)
+ endif()
+endif()
+
+# set packaging by components
+set(CPACK_DEB_COMPONENT_INSTALL ON)
+
+# enforce Debian policy permission rules
+set(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION ON)
+
+# packaging by components doesn't fully work with CMake/CPack <3.6.0
+# CPACK_DEBIAN_<COMPONENT>_FILE_NAME is a 3.6.0 addition
+# warn if detected version is lower
+if(CMAKE_VERSION VERSION_LESS 3.6)
+ message(WARNING "DEB Generator: CMake/CPack 3.6 or higher is needed to produce correctly named packages.")
+endif()
+
+# distro codename
+if(NOT DISTRO_CODENAME)
+ if(NOT LSB_RELEASE_CMD)
+ message(WARNING "DEB Generator: Can't find lsb_release in your path. Setting DISTRO_CODENAME to unknown.")
+ set(DISTRO_CODENAME unknown)
+ else()
+ execute_process(COMMAND ${LSB_RELEASE_CMD} -cs
+ OUTPUT_VARIABLE DISTRO_CODENAME
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ endif()
+endif()
+
+# package version
+if(DEBIAN_PACKAGE_VERSION)
+ set(DISTRO_CODENAME ${DEBIAN_PACKAGE_VERSION}${DISTRO_CODENAME})
+else()
+ set(DISTRO_CODENAME 0${DISTRO_CODENAME})
+endif()
+
+# package revision
+if(DEBIAN_PACKAGE_REVISION)
+ set(DISTRO_CODENAME ${DISTRO_CODENAME}${DEBIAN_PACKAGE_REVISION})
+endif()
+
+# package type
+if(DEBIAN_PACKAGE_TYPE STREQUAL stable)
+ set(RELEASE_IDENTIFIER final)
+elseif(DEBIAN_PACKAGE_TYPE STREQUAL unstable)
+ set(RELEASE_IDENTIFIER ${APP_VERSION_TAG_LC})
+else()
+ core_find_git_rev(RELEASE_IDENTIFIER)
+endif()
+
+# package name
+string(TIMESTAMP PACKAGE_TIMESTAMP "%Y%m%d.%H%M" UTC)
+set(PACKAGE_NAME_VERSION ${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}~git${PACKAGE_TIMESTAMP}-${RELEASE_IDENTIFIER}-${DISTRO_CODENAME})
+unset(RELEASE_IDENTIFIER)
+
+# package version
+if(DEBIAN_PACKAGE_EPOCH)
+ set(CPACK_DEBIAN_PACKAGE_VERSION ${DEBIAN_PACKAGE_EPOCH}:${PACKAGE_NAME_VERSION})
+else()
+ set(CPACK_DEBIAN_PACKAGE_VERSION 2:${PACKAGE_NAME_VERSION})
+endif()
+
+# architecture
+if(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
+ if(NOT DPKG_CMD)
+ message(WARNING "DEB Generator: Can't find dpkg in your path. Setting CPACK_DEBIAN_PACKAGE_ARCHITECTURE to i386.")
+ set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386)
+ endif()
+ execute_process(COMMAND "${DPKG_CMD}" --print-architecture
+ OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+endif()
+
+# package maintainer
+if(NOT CPACK_DEBIAN_PACKAGE_MAINTAINER)
+ userstamp()
+ set(CPACK_DEBIAN_PACKAGE_MAINTAINER ${PACKAGE_MAINTAINER})
+ unset(PACKAGE_MAINTAINER)
+endif()
+
+# package description common to all packages
+if(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION)
+ file(STRINGS ${PROJECT_SOURCE_DIR}/cpack/deb/package-description.txt DESC_LINES)
+ foreach(LINE IN LISTS DESC_LINES)
+ set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "${CPACK_DEBIAN_PACKAGE_DESCRIPTION} ${LINE}\n")
+ endforeach()
+endif()
+
+# package homepage
+if(NOT CPACK_DEBIAN_PACKAGE_HOMEPAGE)
+ set(CPACK_DEBIAN_PACKAGE_HOMEPAGE ${APP_WEBSITE})
+endif()
+
+# generate a Debian compliant changelog
+set(CHANGELOG_HEADER "${APP_NAME_LC} (${CPACK_DEBIAN_PACKAGE_VERSION}) ${DISTRO_CODENAME}\; urgency=high")
+rfc2822stamp()
+# two spaces between maintainer and timestamp is NOT a mistake
+set(CHANGELOG_FOOTER " -- ${CPACK_DEBIAN_PACKAGE_MAINTAINER} ${RFC2822_TIMESTAMP}")
+
+if(GIT_FOUND AND GZIP_CMD AND EXISTS ${CORE_SOURCE_DIR}/.git)
+ execute_process(COMMAND ${GIT_EXECUTABLE} log --no-merges --pretty=format:"%n [%an]%n * %s" --since="last month"
+ OUTPUT_VARIABLE CHANGELOG
+ WORKING_DIRECTORY ${CORE_SOURCE_DIR}
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ string(REPLACE "\"" "" CHANGELOG ${CHANGELOG})
+ file(WRITE ${CPACK_PACKAGE_DIRECTORY}/deb/changelog.Debian ${CHANGELOG_HEADER}\n${CHANGELOG}\n\n${CHANGELOG_FOOTER})
+ execute_process(COMMAND ${GZIP_CMD} -f -9 -n ${CPACK_PACKAGE_DIRECTORY}/deb/changelog.Debian)
+ unset(CHANGELOG_HEADER)
+ unset(CHANGELOG_FOOTER)
+ unset(RFC2822_TIMESTAMP)
+else()
+ message(WARNING "DEB Generator: Can't find git and/or gzip in your path. DEB packages will be missing changelog.Debian.gz.")
+endif()
+
+# Generate NEWS.Debian
+configure_file(${PROJECT_SOURCE_DIR}/cpack/deb/NEWS.Debian
+ ${CPACK_PACKAGE_DIRECTORY}/deb/NEWS.Debian @ONLY)
+if(GZIP_CMD)
+ execute_process(COMMAND ${GZIP_CMD} -f -9 -n ${CPACK_PACKAGE_DIRECTORY}/deb/NEWS.Debian)
+else()
+ message(WARNING "DEB Generator: Can't find gzip in your path. DEB packages will be missing NEWS.Debian.")
+endif()
+
+# Generate man pages
+configure_file(${CORE_SOURCE_DIR}/docs/manpages/kodi.bin.1
+ ${CPACK_PACKAGE_DIRECTORY}/deb/kodi.1 COPYONLY)
+configure_file(${CORE_SOURCE_DIR}/docs/manpages/kodi.bin.1
+ ${CPACK_PACKAGE_DIRECTORY}/deb/kodi.bin.1 COPYONLY)
+configure_file(${CORE_SOURCE_DIR}/docs/manpages/kodi-standalone.1
+ ${CPACK_PACKAGE_DIRECTORY}/deb/kodi-standalone.1 COPYONLY)
+if(ENABLE_EVENTCLIENTS)
+ configure_file(${CORE_SOURCE_DIR}/docs/manpages/kodi-ps3remote.1
+ ${CPACK_PACKAGE_DIRECTORY}/deb/kodi-ps3remote.1 COPYONLY)
+ configure_file(${CORE_SOURCE_DIR}/docs/manpages/kodi-send.1
+ ${CPACK_PACKAGE_DIRECTORY}/deb/kodi-send.1 COPYONLY)
+ configure_file(${CORE_SOURCE_DIR}/docs/manpages/kodi-wiiremote.1
+ ${CPACK_PACKAGE_DIRECTORY}/deb/kodi-wiiremote.1 COPYONLY)
+endif()
+
+if(GZIP_CMD)
+ execute_process(COMMAND ${GZIP_CMD} -f -9 -n ${CPACK_PACKAGE_DIRECTORY}/deb/kodi.1)
+ execute_process(COMMAND ${GZIP_CMD} -f -9 -n ${CPACK_PACKAGE_DIRECTORY}/deb/kodi.bin.1)
+ execute_process(COMMAND ${GZIP_CMD} -f -9 -n ${CPACK_PACKAGE_DIRECTORY}/deb/kodi-standalone.1)
+ if(ENABLE_EVENTCLIENTS)
+ execute_process(COMMAND ${GZIP_CMD} -f -9 -n ${CPACK_PACKAGE_DIRECTORY}/deb/kodi-ps3remote.1)
+ execute_process(COMMAND ${GZIP_CMD} -f -9 -n ${CPACK_PACKAGE_DIRECTORY}/deb/kodi-send.1)
+ execute_process(COMMAND ${GZIP_CMD} -f -9 -n ${CPACK_PACKAGE_DIRECTORY}/deb/kodi-wiiremote.1)
+ endif()
+else()
+ message(WARNING "DEB Generator: Can't find gzip in your path. Several DEB packages will be missing man pages.")
+endif()
+
+install(FILES ${CPACK_PACKAGE_DIRECTORY}/deb/kodi.1.gz
+ ${CPACK_PACKAGE_DIRECTORY}/deb/kodi.bin.1.gz
+ ${CPACK_PACKAGE_DIRECTORY}/deb/kodi-standalone.1.gz
+ DESTINATION share/man/man1
+ COMPONENT kodi)
+if(ENABLE_EVENTCLIENTS)
+install(FILES ${CPACK_PACKAGE_DIRECTORY}/deb/kodi-ps3remote.1.gz
+ DESTINATION share/man/man1
+ COMPONENT kodi-eventclients-ps3)
+install(FILES ${CPACK_PACKAGE_DIRECTORY}/deb/kodi-send.1.gz
+ DESTINATION share/man/man1
+ COMPONENT kodi-eventclients-xbmc-send)
+install(FILES ${CPACK_PACKAGE_DIRECTORY}/deb/kodi-wiiremote.1.gz
+ DESTINATION share/man/man1
+ COMPONENT kodi-eventclients-wiiremote)
+endif()
+
+# configure package metadata files
+file(GLOB DEBIAN_PACKAGE_FILES ${PROJECT_SOURCE_DIR}/cpack/deb/packages/*.txt.in)
+foreach(file ${DEBIAN_PACKAGE_FILES})
+ get_filename_component(package ${file} NAME_WE)
+ # filter eventclients so we don't have to support two more deps
+ # (libbluetooth-dev and libcwiid-dev) just because of wii-remote
+ string(SUBSTRING ${package} 0 17 PACKAGE_FILTER)
+ if(NOT ENABLE_EVENTCLIENTS AND PACKAGE_FILTER STREQUAL kodi-eventclients)
+ message(STATUS "DEB Generator: ${package} matches ${PACKAGE_FILTER}, skipping.")
+ # do nothing
+ else()
+ configure_file(${file}
+ ${CPACK_PACKAGE_DIRECTORY}/deb/${package}.txt @ONLY)
+ list(APPEND DEBIAN_PACKAGES ${package})
+ endif()
+endforeach()
+unset(DEBIAN_PACKAGE_FILES)
+
+# generate packages
+include(CMakeParseArguments)
+foreach(file ${DEBIAN_PACKAGES})
+ core_file_read_filtered(DEBIAN_METADATA ${CPACK_PACKAGE_DIRECTORY}/deb/${file}.txt)
+ string(REPLACE " " ";" DEBIAN_METADATA "${DEBIAN_METADATA}")
+ cmake_parse_arguments(DEB
+ ""
+ "PACKAGE_NAME;PACKAGE_ARCHITECTURE;PACKAGE_SECTION;PACKAGE_PRIORITY;PACKAGE_SHLIBDEPS"
+ "PACKAGE_DEPENDS;PACKAGE_RECOMMENDS;PACKAGE_SUGGESTS;PACKAGE_BREAKS;PACKAGE_REPLACES;PACKAGE_PROVIDES;PACKAGE_DESCRIPTION_HEADER;PACKAGE_DESCRIPTION_FOOTER"
+ ${DEBIAN_METADATA})
+ string(REPLACE ";" " " DEB_PACKAGE_DEPENDS "${DEB_PACKAGE_DEPENDS}")
+ string(REPLACE ";" " " DEB_PACKAGE_RECOMMENDS "${DEB_PACKAGE_RECOMMENDS}")
+ string(REPLACE ";" " " DEB_PACKAGE_SUGGESTS "${DEB_PACKAGE_SUGGESTS}")
+ string(REPLACE ";" " " DEB_PACKAGE_BREAKS "${DEB_PACKAGE_BREAKS}")
+ string(REPLACE ";" " " DEB_PACKAGE_REPLACES "${DEB_PACKAGE_REPLACES}")
+ string(REPLACE ";" " " DEB_PACKAGE_PROVIDES "${DEB_PACKAGE_PROVIDES}")
+ string(REPLACE ";" " " DEB_PACKAGE_DESCRIPTION_HEADER "${DEB_PACKAGE_DESCRIPTION_HEADER}")
+ string(REPLACE ";" " " DEB_PACKAGE_DESCRIPTION_FOOTER "${DEB_PACKAGE_DESCRIPTION_FOOTER}")
+
+ string(TOUPPER ${file} COMPONENT)
+
+ if(NOT DEB_PACKAGE_ARCHITECTURE)
+ message(STATUS "DEB Generator: Mandatory variable CPACK_DEBIAN_${COMPONENT}_PACKAGE_ARCHITECTURE is empty. Setting to ${CPACK_SYSTEM_NAME}.")
+ set(CPACK_DEBIAN_${COMPONENT}_PACKAGE_ARCHITECTURE ${CPACK_SYSTEM_NAME})
+ else()
+ set(CPACK_DEBIAN_${COMPONENT}_PACKAGE_ARCHITECTURE ${DEB_PACKAGE_ARCHITECTURE})
+ endif()
+
+ if(DEB_PACKAGE_NAME)
+ if(DEB_PACKAGE_ARCHITECTURE)
+ set(CPACK_DEBIAN_${COMPONENT}_FILE_NAME ${DEB_PACKAGE_NAME}_${PACKAGE_NAME_VERSION}_${DEB_PACKAGE_ARCHITECTURE}.deb)
+ else()
+ set(CPACK_DEBIAN_${COMPONENT}_FILE_NAME ${DEB_PACKAGE_NAME}_${PACKAGE_NAME_VERSION}_${CPACK_SYSTEM_NAME}.deb)
+ endif()
+ else()
+ message(FATAL_ERROR "DEB Generator: Mandatory variable CPACK_DEBIAN_${COMPONENT}_FILE_NAME is not set.")
+ endif()
+
+ set(CPACK_DEBIAN_${COMPONENT}_PACKAGE_SOURCE ${APP_NAME_LC})
+
+ if(DEB_PACKAGE_NAME)
+ set(CPACK_DEBIAN_${COMPONENT}_PACKAGE_NAME ${DEB_PACKAGE_NAME})
+ else()
+ message(FATAL_ERROR "DEB Generator: Mandatory variable CPACK_DEBIAN_${COMPONENT}_PACKAGE_NAME is not set.")
+ endif()
+
+ if(DEB_PACKAGE_SECTION)
+ set(CPACK_DEBIAN_${COMPONENT}_PACKAGE_SECTION ${DEB_PACKAGE_SECTION})
+ else()
+ message(FATAL_ERROR "DEB Generator: Mandatory variable CPACK_DEBIAN_${COMPONENT}_PACKAGE_SECTION is not set.")
+ endif()
+
+ if(DEB_PACKAGE_PRIORITY)
+ set(CPACK_DEBIAN_${COMPONENT}_PACKAGE_PRIORITY ${DEB_PACKAGE_PRIORITY})
+ else()
+ message(FATAL_ERROR "DEB Generator: Mandatory variable CPACK_DEBIAN_${COMPONENT}_PACKAGE_PRIORITY is not set.")
+ endif()
+
+ if(DEB_PACKAGE_SHLIBDEPS)
+ set(CPACK_DEBIAN_${COMPONENT}_PACKAGE_SHLIBDEPS ON)
+ else()
+ if(DEB_PACKAGE_DEPENDS)
+ set(CPACK_DEBIAN_${COMPONENT}_PACKAGE_DEPENDS "${DEB_PACKAGE_DEPENDS}")
+ endif()
+ endif()
+
+ if(DEB_PACKAGE_RECOMMENDS)
+ set(CPACK_DEBIAN_${COMPONENT}_PACKAGE_RECOMMENDS "${DEB_PACKAGE_RECOMMENDS}")
+ endif()
+
+ if(DEB_PACKAGE_SUGGESTS)
+ set(CPACK_DEBIAN_${COMPONENT}_PACKAGE_SUGGESTS "${DEB_PACKAGE_SUGGESTS}")
+ endif()
+
+ if(DEB_PACKAGE_BREAKS)
+ set(CPACK_DEBIAN_${COMPONENT}_PACKAGE_BREAKS "${DEB_PACKAGE_BREAKS}")
+ endif()
+
+ if(DEB_PACKAGE_REPLACES)
+ set(CPACK_DEBIAN_${COMPONENT}_PACKAGE_REPLACES "${DEB_PACKAGE_REPLACES}")
+ endif()
+
+ if(DEB_PACKAGE_PROVIDES)
+ set(CPACK_DEBIAN_${COMPONENT}_PACKAGE_PROVIDES "${DEB_PACKAGE_PROVIDES}")
+ endif()
+
+ if(NOT DEB_PACKAGE_DESCRIPTION_HEADER OR NOT DEB_PACKAGE_DESCRIPTION_FOOTER)
+ message(FATAL_ERROR "DEB Generator: Mandatory variable CPACK_COMPONENT_${COMPONENT}_DESCRIPTION is not set.")
+ else()
+ set(CPACK_COMPONENT_${COMPONENT}_DESCRIPTION "\
+${DEB_PACKAGE_DESCRIPTION_HEADER}\n\
+${CPACK_DEBIAN_PACKAGE_DESCRIPTION} \
+${DEB_PACKAGE_DESCRIPTION_FOOTER}")
+ endif()
+
+ install(FILES ${CPACK_PACKAGE_DIRECTORY}/deb/changelog.Debian.gz
+ ${CPACK_PACKAGE_DIRECTORY}/deb/NEWS.Debian.gz
+ ${PROJECT_SOURCE_DIR}/cpack/deb/copyright
+ DESTINATION share/doc/${file}
+ COMPONENT ${file})
+
+ # kodi package exclusive files
+ if(CPACK_DEBIAN_KODI_PACKAGE_NAME)
+ set(CPACK_DEBIAN_KODI_PACKAGE_CONTROL_EXTRA
+ "${PROJECT_SOURCE_DIR}/cpack/deb/postinst;${PROJECT_SOURCE_DIR}/cpack/deb/postrm")
+ install(FILES ${PROJECT_SOURCE_DIR}/cpack/deb/lintian/overrides/kodi
+ DESTINATION share/lintian/overrides
+ COMPONENT kodi)
+ install(FILES ${PROJECT_SOURCE_DIR}/cpack/deb/menu/kodi
+ DESTINATION share/menu
+ COMPONENT kodi)
+ endif()
+endforeach()
+unset(DEBIAN_PACKAGES)
+
+### source package generation specific variables
+# source generator
+set(CPACK_SOURCE_GENERATOR TGZ)
+
+# source package name
+set(CPACK_SOURCE_PACKAGE_FILE_NAME ${APP_NAME_LC}_${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}~git${PACKAGE_TIMESTAMP}-${GIT_HASH}.orig)
+
+# source dir
+set(CMAKE_SOURCE_DIR ${CORE_SOURCE_DIR})
+
+# ignore files for source package
+set(CPACK_SOURCE_IGNORE_FILES
+ "/build/"
+ "/debian/"
+ "/.git/"
+ ".gitignore"
+ "yml$"
+ "~$")
+
+# unset variables
+unset(PACKAGE_TIMESTAMP)
+unset(DISTRO_CODENAME)
+
+# reference docs
+# https://cmake.org/cmake/help/latest/module/CPack.html
+# https://cmake.org/cmake/help/latest/module/CPackDeb.html
+# https://cmake.org/cmake/help/latest/module/CPackComponent.html
+include(CPack)
diff --git a/cmake/cpack/deb/NEWS.Debian b/cmake/cpack/deb/NEWS.Debian
new file mode 100644
index 0000000000..034774b302
--- /dev/null
+++ b/cmake/cpack/deb/NEWS.Debian
@@ -0,0 +1,24 @@
+@CPACK_PACKAGE_NAME@ (@CPACK_DEBIAN_PACKAGE_VERSION@) @DISTRO_CODENAME@; urgency=high
+ * Kodi Krypton (v17.0) will have an awesome new default skin, Estuary.
+ However the vast improvements are deep in the bowels of Kodi core code.
+ .
+ Since the beginning of XBMC back in the days while it was running on
+ the XBOX there was something like DVDPlayer. As the name probably
+ implies it was used to playback DVD discs/files. During the years this
+ DVDPlayer was improved and patched up to stay within modern day
+ standards of video playback expectancy. However it became clear that
+ for the future a major overhaul and rewrite was needed to keep up and
+ be future proof. As such the developers who did the AudioEngine in v12
+ picked up this job and have now transformed it into VideoPlayer.
+ .
+ Together with some platform developers they ripped out the old
+ DVDPlayer code, chopped it into pieces, put it in the blender, picked
+ the needed pieces and put it back in without breaking the rest of Kodi.
+ This certainly wasn’t an easy job as DVDPlayer was like the bottom
+ block of a Jenga tower that needed to be replaced while still being
+ entangled throughout the whole tower. It had it’s tentacles in parts
+ of the code where it shouldn’t have been in the first place. Over a
+ year ago work started on getting this untangled and made ready to
+ be replaced by the new implementation, VideoPlayer.
+
+ -- h.udo <hudokkow@gmail.com> Tue, 05 Jul 2016 13:34:11 +0000
diff --git a/cmake/cpack/deb/copyright b/cmake/cpack/deb/copyright
new file mode 100644
index 0000000000..a79cf54f63
--- /dev/null
+++ b/cmake/cpack/deb/copyright
@@ -0,0 +1,3126 @@
+Kodi is downloaded from http://kodi.tv/.
+Orig tarballs are generated from the script located at
+https://github.com/Kodi/Kodi/tree/master/project/cmake. The
+orig tarball is generated using the sources in https://github.com/Kodi/Kodi.
+
+Main Contact: "Team-Kodi" <team at kodi dot tv>
+
+Upstream Authors:
+
+ Andreas Setterlind [Gamester17]
+ Staffan Lindberg [pike]
+ Arne Morten Kvarving [cptspiff]
+ Anoop Menon [d4rk]
+ Joakim Plate [elupus]
+ Jonathan Marshall [jmarshall]
+ Tobias Arrskog [Topfs2]
+ Roee Vulkan [vulkanr]
+ Winfried Soltys [WiSo]
+ Yuval Tal [yuvalt]
+ John W Vanderbeck [agathorn]
+ Trent Nelson [AlTheKiller]
+ Andres Mejia [ceros]
+ Gunnar Norin [blittan]
+ Dean Ross Parry [C-Quel]
+ Sylvain Rebaud [c0diq]
+ Martin van Beurden [chadoe]
+ Scott Davilla [davilla]
+ Stephan Diederich [MaestroDD]
+ Benjamin Bertrand [Beenje]
+ Benjamin Dickgiesser [DonJ]
+ [GeminiServer]
+ Christian Granqvist [Granqvist]
+ Dave [kraqh3d]
+ Luigi Capriotti [l.capriotti]
+ Sean [malloc]
+ Kyle Hill [monkeyman]
+ [MrC]
+ [nad]
+ [nuka1195]
+ Vincent Blackwell-Price [Voinage]
+ Robert Parris [rwparris2]
+ Sigurdur H. Olafsson [sho]
+ Alasdair Campbell [Alcoheca]
+ Georgy Yunaev [oldnemesis]
+ Chris [phi2039]
+ Bob [bobo1on1]
+ David Allonby [motd2k]
+ Robert Rudd [Rudd]
+ Eric G [Tslayer]
+ Amund Scharning [tut-ankh-amon]
+ Matthias Kortstiege [VDRfan]
+ Daniel Mehrwald [AreaScout]
+ Oumar Aziz Outtara [wattazoum]
+ Chris Haley [CHI3f]
+ [Jezz_X]
+ [Smokehead]
+ Darren [Bizzeh]
+ Marc [Bobbin007]
+ Richard [Butcher]
+ Jan-Willem [Darkie]
+ Chris Branson [forza]
+ [Kreet]
+ [Ysbox]
+ Erwin Beckers [Frodo]
+ Albert Griscti-Soler [RUNTiME]
+ Phil Burr [d7o3g4q] (a.k.a. Duo Egaq)
+ Mathias Mahling [chokemaniac]
+
+Credits:
+
+Kodi - Cross-platform Media Center
+<http://Kodi.org/>
+
+ Copyright © 2005-2016 Team Kodi http://kodi.tv
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Generic classes for raster images
+
+ Copyright © 2000, Juan Soulie <jsoulie@cplusplus.com>
+
+ Permission to use, copy, modify, distribute and sell this software or any
+ part thereof and/or its documentation for any purpose is granted without fee
+ provided that the above copyright notice and this permission notice appear
+ in all copies.
+
+ This software is provided "as is" without express or implied warranty of
+ any kind. The author shall have no liability with respect to the
+ infringement of copyrights or patents that any modification to the content
+ of this file or this file itself may incur.
+
+The FreeType Project
+<http://www.freetype.org/>
+
+ Copyright © 1996-2006, by David Turner, Robert Wilhelm, and Werner Lemberg
+
+ This file is part of the FreeType project, and may only be used,
+ modified, and distributed under the terms of the FreeType project
+ license, LICENSE.TXT. By continuing to use, modify, or distribute
+ this file you indicate that you have read the license and
+ understand and accept it fully.
+
+ A full copy of the FreeType License (FTL) is provided under section
+ "Licenses".
+
+TinyXML - simple, small, C++ XML Parser
+<http://www.grinninglizard.com/tinyxml/>
+
+ Copyright © 2000-2006 Lee Thomason (www.grinninglizard.com)
+ Copyright © 2005 Tyge Lovset
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+
+CString Class in guilib/StdString.h
+
+ Copyright © 2002 Joseph M. O'Leary
+
+ This code is 100% free. Use it anywhere you want. Rewrite it, restructure
+ it, whatever. If you can write software that makes money off of it, good for
+ you. I kinda like capitalism. Please don't blame me if it causes your $30
+ billion dollar satellite explode in orbit. If you redistribute it in any
+ form, I'd appreciate it if you would leave this notice here.
+
+Mach-O library symbol mapping Ruby Scripts
+
+ Copyright © 2008 Elan Feingold (elan at bluemandrill dot com)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Wiimote C Library
+<http://www.wiiuse.net/>
+
+ Copyright © Michael Laforest < para >
+ < thepara (--AT--) g m a i l [--DOT--] com >
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Wiiuse Class for Kodi
+
+ Copyright © 2009 by Cory Fields
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Apple Remote Control Wrapper Classes
+
+ Copyright © 2006 Martin Kahr martinkahr.com. All rights reserved.
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ IN THE SOFTWARE.
+
+Class to Display events received from the Apple Infrared Remote.
+
+ Copyright © 2006-2008 Amit Singh. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+
+ISO C9x compliant stdint.h and inttypes.h for Microsoft Visual Studio
+
+ Copyright © 2006 Alexander Chemeris
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ 3. The name of the author may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+ EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+cURL - library and command line tool for transferring files with URL syntax
+<http://curl.haxx.se/>
+
+ Copyright © 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
+
+ Permission to use, copy, modify, and distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Except as contained in this notice, the name of a copyright holder shall not
+ be used in advertising or otherwise to promote the sale, use or other
+ dealings in this Software without prior written authorization of the
+ copyright holder.
+
+RegExp.h
+
+ Copyright © 1986, 1993, 1995 by University of Toronto.
+
+ Permission is granted to anyone to use this software for any
+ purpose on any computer system, and to redistribute it in any way,
+ subject to the following restrictions:
+
+ 1. The author is not responsible for the consequences of use of
+ this software, no matter how awful, even if they arise
+ from defects in it.
+
+ 2. The origin of this software must not be misrepresented, either
+ by explicit claim or by omission.
+
+ 3. Altered versions must be plainly marked as such, and must not
+ be misrepresented (by explicit claim or omission) as being
+ the original software.
+
+ 4. This notice must not be removed or altered.
+
+GNU gettext - internationalization aids
+<http://www.gnu.org/software/gettext/>
+
+ Copyright © 1988, 1989, 1992, 1993, 1995 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+DBUSServer Class
+<http://www.azurdigitalnetworks.net/>
+
+ Copyright © 2009 Azur Digital Networks
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Really Slick X Screensavers
+<http://www.reallyslick.com/>
+
+ Copyright © 2002-2006 Michael Chapman
+ Copyright © 2002 Terence M. Welsh
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+SDLMain.h
+
+ Copyright © Darrell Walisser <dwaliss1@purdue.edu>
+ Copyright © Max Horn <max@quendi.de>
+
+ Feel free to customize this file to suit your needs.
+
+XKGeneral.h - General Utility and Helper function Class' Header
+
+ Copyright © TEAM ASSEMBLY www.team-assembly.com
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Goom 2k4
+<http://www.ios-software.com/index.php3?page=projet&quoi=1&lg=AN>
+
+ Copyright © 2000-2004, Jean-Christophe Hoelt <jeko@ios-software.com>
+ Copyright © 2000-2004, Guillaume Borios <gyom@ios-software.com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ iTunes Visualizer Plug-In SDK files included in Goom 2k4 are under the
+ following license.
+
+ Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
+
+ This Apple software is supplied to you by Apple Computer, Inc. in
+ consideration of your agreement to the following terms, and your use,
+ installation, modification or redistribution of this Apple software
+ constitutes acceptance of these terms. If you do not agree with these terms,
+ please do not use, install, modify or redistribute this Apple software.
+
+ In consideration of your agreement to abide by the following terms, and
+ subject to these terms, Apple grants you a personal, non-exclusive license,
+ under Apple's intellectual property rights in this Apple Software (the
+ "Apple Software"), to use, reproduce, modify and distribute the Apple
+ Software; provided that no license is granted herein under any patents that
+ may be infringed by your modifications, derivative works or by other works
+ in which the Apple Software may be incorporated. No names, trademarks,
+ service marks or logos of Apple Computer, Inc. may be used to endorse or
+ promote products derived from the Apple Software without specific prior
+ written permission from Apple. Except as expressly stated herein, no other
+ rights or licenses, express or implied, are granted by Apple and nothing
+ herein grants any license under any patents except claims of Apple patents
+ that cover this Apple Software as originally provided by Apple, and only to
+ the extent necessary to use and distribute this Apple Software as originally
+ provided by Apple.
+
+ The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO
+ WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
+ WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
+ COMBINATION WITH ANY PRODUCT.
+
+ IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION
+ AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER
+ THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR
+ OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+XAnalyser, frequence spectrum analyser for X Window
+<http://arvin.schnell-web.net/xanalyser/>
+
+ Copyright © 1998 Arvin Schnell
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+XMMS - Cross-platform multimedia player
+<http://www.xmms.org/>
+
+ Copyright © 1998-2000 Peter Alm, Mikael Alm, Olle Hallnas, Thomas Nilsson
+ and 4Front Technologies
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Pthreads-win32 - POSIX Threads Library for Win32
+<http://sourceware.org/pthreads-win32/>
+
+ Copyright © 1998 John E. Bossom
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+projectM - OpenGL based advanced music visualization program
+<http://projectm.sourceforge.net/>
+
+ Copyright © 2003-2007 projectM Team
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+OpenDAAP
+<http://www.opendaap.org/>
+
+ Copyright © 2004 Forza (Chris Barnett)
+ Copyright © the authors of libOpenDAAP
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+zlib - A Massively Spiffy Yet Delicately Unobtrusive Compression Library
+<http://www.zlib.net/>
+
+ Copyright © 1995-2002 Jean-loup Gailly and Mark Adler.
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+
+iso9660.h
+
+ Copyright © The Joker / Avalaunch team
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Neptune Portable C++ Runtime Library
+<http://neptune.sourceforge.net/>
+
+ Copyright © 2001-2006 Gilles Boccon-Gibod
+ Copyright © 2002-2008, Axiomatic Systems, LLC.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the <organization> nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY AXIOMATIC SYSTEMS ''AS IS'' AND ANY
+ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL AXIOMATIC SYSTEMS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+MMST implementation taken from the xine-mms plugin made by Major MMS
+(http://geocities.com/majormms/).
+
+ Copyright © 2005-2008 Team Kodi
+ Copyright © 2002 Abhijeet Phatak <abhijeetphatak@yahoo.com>
+ Copyright © 2002 the xine project
+ Copyright © 2000-2001 major mms
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Ogg Bitstream Library
+<http://www.xiph.org/>
+
+ Copyright © 1994-2002 Xiph.Org Foundation http://www.xiph.org/
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the Xiph.org Foundation nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ This software is provided by the copyright holders and contributors “as is”
+ and any express or implied warranties, including, but not limited to, the
+ implied warranties of merchantability and fitness for a particular purpose
+ are disclaimed. In no event shall the foundation or contributors be liable
+ for any direct, indirect, incidental, special, exemplary, or consequential
+ damages (including, but not limited to, procurement of substitute goods or
+ services; loss of use, data, or profits; or business interruption) however
+ caused and on any theory of liability, whether in contract, strict
+ liability, or tort (including negligence or otherwise) arising in any way
+ out of the use of this software, even if advised of the possibility of such
+ damage.
+
+The Vorbis General Audio Compression Codec
+<http://www.xiph.org/>
+
+ Copyright © 2002, Xiph.org Foundation
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the Xiph.org Foundation nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ This software is provided by the copyright holders and contributors “as is”
+ and any express or implied warranties, including, but not limited to, the
+ implied warranties of merchantability and fitness for a particular purpose
+ are disclaimed. In no event shall the foundation or contributors be liable
+ for any direct, indirect, incidental, special, exemplary, or consequential
+ damages (including, but not limited to, procurement of substitute goods or
+ services; loss of use, data, or profits; or business interruption) however
+ caused and on any theory of liability, whether in contract, strict
+ liability, or tort (including negligence or otherwise) arising in any way
+ out of the use of this software, even if advised of the possibility of such
+ damage.
+
+LAME Ain't an Mp3 Encoder
+<http://lame.sourceforge.net/>
+
+ Copyright © 1999 Mark Taylor
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+GNU libmicrohttpd
+<http://www.gnu.org/software/libmicrohttpd/>
+
+ (C) 2006, 2007, 2008, 2009 Christian Grothoff (and other contributing
+ authors)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Python Programming Language
+<http://www.python.org/>
+
+ Copyright © 2001-2008 Python Software Foundation. All rights reserved.
+ Copyright © 2000 BeOpen.com. All rights reserved.
+ Copyright © 1995-2001 Corporation for National Research Initiatives. All
+ rights reserved.
+ Copyright © 1991-1995 Stichting Mathematisch Centrum. All rights reserved.
+
+ Python is distributed under the Python Software Foundation License
+ version 2. A copy of the license may be retrieved from
+ http://www.python.org/psf/license/ and is repeated below under the section
+ "License: PSF License for Python 2.4".
+
+libopendaap - library which enables applications to discover, and connect to,
+iTunes music shares.
+<http://craz.net/programs/itunes/libopendaap.html>
+
+ Copyright © 2004 David Hammerton.
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to
+ deal in the Software without restriction, including without limitation the
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ IN THE SOFTWARE.
+
+libsamplerate - audio rate conversion library
+<http://www.mega-nerd.com/SRC/>
+
+ Copyright © 2002-2008 Erik de Castro Lopo <erikd@mega-nerd.com>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+MediaMVP Media Center
+<http://www.mvpmc.org/>
+
+ Copyright © 2004-2006, Eric Lund, Jon Gettler, Sergio Slobodrian
+ http://www.mvpmc.org/
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+MySQL
+<http://www.mysql.com/>
+
+ Copyright © 2000-2003 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+libid3tag - ID3 tag manipulation library
+<http://www.underbit.com/products/mad/>
+
+ Copyright © 2000-2004 Underbit Technologies, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Simple DirectMedia Layer
+<http://www.libsdl.org/>
+
+ Copyright © 1997-2006 Sam Lantinga
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+libfribidi - Free Implementation of the Unicode BiDi algorithm
+<http://www.fribidi.org/>
+
+ Copyright © 1999,2000 Dov Grobgeld
+ Copyright © 2001,2002 Behdad Esfahbod
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+CDRip - library that provides methods for extracting data from audio CDs
+<http://libcdrip.sourceforge.net/>
+
+ Copyright © 1999 - 2002 Albert L. Faber
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Platinum - UPnP library
+<http://www.plutinosoft.com/>
+
+ Copyright © 2004-2008, Plutinosoft, LLC. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+SQLite - library that implements a self-contained, serverless,
+zero-configuration, transactional SQL database engine.
+<http://www.sqlite.org/>
+
+ Copyright © 2004, Leo Seib, Hannover
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to
+ deal in the Software without restriction, including without limitation the
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ IN THE SOFTWARE.
+
+CxImage - C++ image processing and conversion library
+<http://www.xdp.it/cximage.htm>
+
+ Copyright © 2001 - 2008, Davide Pizzolato
+
+ Original CImage and CImageIterator implementation are:
+ Copyright © 1995, Alejandro Aguilar Sierra
+ (asierra(at)servidor(dot)unam(dot)mx)
+
+ Covered code is provided under this license on an "as is" basis, without
+ warranty of any kind, either expressed or implied, including, without
+ limitation, warranties that the covered code is free of defects,
+ merchantable, fit for a particular purpose or non-infringing. The entire
+ risk as to the quality and performance of the covered code is with you.
+ Should any covered code prove defective in any respect, you (not the initial
+ developer or any other contributor) assume the cost of any necessary
+ servicing, repair or correction. This disclaimer of warranty constitutes an
+ essential part of this license. No use of any covered code is authorized
+ hereunder except under this disclaimer.
+
+ Permission is hereby granted to use, copy, modify, and distribute this
+ source code, or portions hereof, for any purpose, including commercial
+ applications, freely and without fee, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+
+ 3. This notice may not be removed or altered from any source distribution.
+
+ Portions of CxImage are under different copyright and under different
+ licenses.
+
+ JasPer
+ Copyright © 2001-2006 Michael David Adams
+ Copyright © 1999-2000 Image Power, Inc.
+ Copyright © 1999-2000 The University of British Columbia
+ All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person (the
+ "User") obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without restriction,
+ including without limitation the rights to use, copy, modify, merge,
+ publish, distribute, and/or sell copies of the Software, and to permit
+ persons to whom the Software is furnished to do so, subject to the
+ following conditions:
+
+ 1. The above copyright notices and this permission notice (which
+ includes the disclaimer below) shall be included in all copies or
+ substantial portions of the Software.
+
+ 2. The name of a copyright holder shall not be used to endorse or
+ promote products derived from the Software without specific prior
+ written permission.
+
+ THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
+ LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
+ THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
+ "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
+ BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+ PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
+ EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
+ PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
+ THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
+ EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
+ BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
+ PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
+ GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
+ ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
+ IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
+ SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
+ AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
+ SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
+ THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
+ PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
+ RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
+ EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
+
+ JBIG
+ Copyright © Markus Kuhn -- http://www.cl.cam.ac.uk/~mgk25/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ MNG
+ Copyright © 2000-2007 Gerard Juyn (gerard@libmng.com)
+
+ For the purposes of this copyright and license, "Contributing Authors"
+ is defined as the following set of individuals:
+
+ Gerard Juyn
+ Glenn Randers-Pehrson
+
+ The MNG Library is supplied "AS IS". The Contributing Authors
+ disclaim all warranties, expressed or implied, including, without
+ limitation, the warranties of merchantability and of fitness for any
+ purpose. The Contributing Authors assume no liability for direct,
+ indirect, incidental, special, exemplary, or consequential damages,
+ which may result from the use of the MNG Library, even if advised of
+ the possibility of such damage.
+
+ Permission is hereby granted to use, copy, modify, and distribute this
+ source code, or portions hereof, for any purpose, without fee, subject
+ to the following restrictions:
+
+ 1. The origin of this source code must not be misrepresented;
+ you must not claim that you wrote the original software.
+
+ 2. Altered versions must be plainly marked as such and must not be
+ misrepresented as being the original source.
+
+ 3. This Copyright notice may not be removed or altered from any source
+ or altered source distribution.
+
+ The Contributing Authors specifically permit, without fee, and
+ encourage the use of this source code as a component to supporting
+ MNG and JNG file format in commercial products. If you use this
+ source code in a product, acknowledgment would be highly appreciated.
+
+ JPEG
+ Copyright © 1994-1998, Thomas G. Lane.
+
+ JPEG code is under the Independent JPEG Group License which can be found at
+ http://dev.w3.org/cvsweb/Amaya/libjpeg/Attic/README?rev=1.2 and is repeated
+ under the section "License: IJG License".
+
+ TIFF
+ Copyright © 1988-1997 Sam Leffler
+ Copyright © 1991-1997 Silicon Graphics, Inc.
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to
+ deal in the Software without restriction, including without limitation the
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ IN THE SOFTWARE.
+
+ PNG
+ Copyright © 1998, 1999 Glenn Randers-Pehrson
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+
+ Dave Coffin's raw photo decoder
+ Copyright © 1997-2009 by Dave Coffin, dcoffin a cybercom o net
+
+ Covered code is provided under this license on an "as is" basis, without
+ warranty of any kind, either expressed or implied, including, without
+ limitation, warranties that the covered code is free of defects,
+ merchantable, fit for a particular purpose or non-infringing. The entire
+ risk as to the quality and performance of the covered code is with you.
+ Should any covered code prove defective in any respect, you (not the initial
+ developer or any other contributor) assume the cost of any necessary
+ servicing, repair or correction. This disclaimer of warranty constitutes an
+ essential part of this license. No use of any covered code is authorized
+ hereunder except under this disclaimer.
+
+ No license is required to download and use libdcr. However,
+ to lawfully redistribute libdcr, you must either (a) offer, at
+ no extra charge, full source code for all executable files
+ containing RESTRICTED functions, (b) distribute this code under
+ the GPL Version 2 or later, (c) remove all RESTRICTED functions,
+ re-implement them, or copy them from an earlier, unrestricted
+ revision of dcraw.c, or (d) purchase a license from the author
+ of dcraw.c.
+
+PortAudio - portable cross-platform Audio API
+<http://www.portaudio.com/>
+
+ Copyright © 1999-2002 Ross Bencina and Phil Burk
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to
+ deal in the Software without restriction, including without limitation the
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ IN THE SOFTWARE.
+
+Audioscrobbler - The Social Music Technology Playground
+<http://www.audioscrobbler.net/>
+
+ Copyright © 2003 Russell Garrett (russ-scrobbler@garrett.co.uk)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Samba - Opening Windows to a Wider World
+<http://www.samba.org/>
+
+ Copyright © Andrew Tridgell 1998
+ Copyright © Richard Sharpe 2000
+ Copyright © John Terpsra 2000
+ Copyright © Tom Jansen (Ninja ISD) 2002
+ Copyright © Derrell Lipman 2003
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+PCRE - Perl Compatible Regular Expressions
+<http://www.pcre.org/>
+
+ Copyright © 1997-2007 University of Cambridge
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of the University of Cambridge nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+
+HDHomeRun - Networked Digital Tuner
+<http://www.silicondust.com/>
+
+ Copyright © 2006-2008 Silicondust Engineering Ltd. <www.silicondust.com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 3 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library. If not, see
+ <http://www.gnu.org/licenses/>.
+
+ As a special exception to the GNU Lesser General Public License,
+ you may link, statically or dynamically, an application with a
+ publicly distributed version of the Library to produce an
+ executable file containing portions of the Library, and
+ distribute that executable file under terms of your choice,
+ without any of the additional requirements listed in clause 4 of
+ the GNU Lesser General Public License.
+
+ By "a publicly distributed version of the Library", we mean
+ either the unmodified Library as distributed by Silicondust, or a
+ modified version of the Library that is distributed under the
+ conditions defined in the GNU Lesser General Public License.
+
+LibASS - portable library for SSA/ASS subtitles rendering
+<http://sourceforge.net/projects/libass/>
+
+ Copyright © 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+libRTV - ReplayTV library
+
+ Copyright © 2002 John Todd Larason <jtl@molehill.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+libiconv - iconv() implementation
+<http://www.gnu.org/software/libiconv/>
+
+ Copyright © 1999-2003 Free Software Foundation, Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Boost C++ Libraries
+<http://www.boost.org/>
+
+ Copyright © 2001, 2002 Peter Dimov and Multi Media Ltd.
+ Copyright © 2007 Peter Dimov
+
+ Permission is hereby granted, free of charge, to any person or organization
+ obtaining a copy of the software and accompanying documentation covered by
+ this license (the "Software") to use, reproduce, display, distribute,
+ execute, and transmit the Software, and to prepare derivative works of the
+ Software, and to permit third-parties to whom the Software is furnished to
+ do so, all subject to the following:
+
+ The copyright notices in the Software and this entire statement, including
+ the above license grant, this restriction and the following disclaimer,
+ must be included in all copies of the Software, in whole or in part, and
+ all derivative works of the Software, unless such copies or derivative
+ works are solely in the form of machine-executable object code generated by
+ a source language processor.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+ SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+ FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+
+HTS Tvheadend - Combined DVB receiver, Digital Video Recorder and Showtime
+streaming server for Linux.
+<http://www.lonelycoder.com/hts/>
+
+ Copyright © 2008 Andreas Öman
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+GNU Compact Disc Input and Control Library
+<http://www.gnu.org/software/libcdio/index.html>
+
+ Copyright © 2001 Herbert Valerio Riedel <hvr@gnu.org>
+ Copyright © 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+SNESAPU - SNES APU emulator library
+<http://www.alpha-ii.com/>
+
+ Copyright © 2001-2006 Alpha-II
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Musepack Decoder Library
+<http://www.musepack.net/>
+
+ Copyright © 2005, The Musepack Development Team. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyrig
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of the The Musepack Development Team nor the
+ names of its contributors may be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+FLAC - Free Lossless Audio Codec
+
+ Copyright © 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Gens APU from Gens
+<http://info.sonicretro.org/Gens/GS>
+
+ Copyright © 2002 by Stéphane Dallongeville
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+vgmstream - library for playback of various video game audio formats
+<http://vgmstream.sourceforge.net/>
+
+ Copyright © 2008-2009 Adam Gashlin, Fastelbja, Ronny Elfert
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+nosefart - NES sound format player
+<http://nosefart.sourceforge.net/>
+
+ Copyright © 1998-2000 Matthew Conte (matt@conte.com)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+MAD - MPEG Audio Decoder
+<http://www.underbit.com/products/mad/>
+
+ Copyright © 2000-2004 Underbit Technologies, Inc
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+SID Player Music Library V2
+<http://sidplay2.sourceforge.net/>
+
+ Copyright © Michael Schwendt <mschwendt@yahoo.com>
+ Copyright © 2000 by Simon White
+ Copyright © 2001-2002 by Jarno Paananen
+ Copyright © 2004 Dag Lem <resid@nimrod.no>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Xbox ADPCM audio codec
+<http://www.winamp.com/plugins/details/147392>
+
+ Copyright © Luigi Auriemma
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ST-Sound - general "Nostalgic" Computer Sound Emulator
+<http://leonard.oxg.free.fr>
+
+ Copyright © 1995-1999 Arnaud Carré ( http://leonard.oxg.free.fr )
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+TiMidity++ - software synthesizer
+<http://timidity.sourceforge.net/>
+
+ Copyright © 1999-2002 Masanao Izumo <mo@goice.co.jp>
+ Copyright © 1995 Tuukka Toivonen <tt@cgs.fi>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+FFmpeg - complete, cross-platform solution to record, convert and stream audio
+and video
+<http://www.ffmpeg.org/>
+
+ Copyright © Fabrice Bellard
+ Copyright © Alex Beregszaszi
+ Copyright © BERO
+ Copyright © Mario Brito
+ Copyright © Ronald Bultje
+ Copyright © Tim Ferguson
+ Copyright © Brian Foley
+ Copyright © Arpad Gereoffy
+ Copyright © Philip Gladstone
+ Copyright © Vladimir Gneushev
+ Copyright © Wolfgang Hesseler
+ Copyright © Falk Hueffner
+ Copyright © Zdenek Kabelac
+ Copyright © Robin Kay
+ Copyright © Todd Kirby
+ Copyright © Nick Kurshev
+ Copyright © Mike Melanson
+ Copyright © Michael Niedermayer
+ Copyright © François Revol
+ Copyright © Roman Shaposhnik
+ Copyright © Dieter Shirley
+ Copyright © Juan J. Sierralta
+ Copyright © Ewald Snel
+ Copyright © Leon van Stuivenberg
+ Copyright © Roberto Togni
+ Copyright © Lionel Ulmer
+
+ Falls under two licenses, the LGPL-2.1 and GPL-2.
+
+ LGPL-2.1
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ GPL-2
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+nuttcp - TCP/UDP network testing tool
+<http://www.lcp.nrl.navy.mil/nuttcp/>
+
+ Copyright © 1995-1999 WIDE Project.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the project nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+
+libdvdnav and libdvdread - libraries to read DVDs and navigate DVD menus
+<http://www.mplayerhq.hu/>
+
+ Copyright © 2001-2004 Rich Wareham <richwareham@users.sourceforge.net>
+ Copyright © 2000, 2001, 2002 H�kan Hjort <d95hjort@dtek.chalmers.se>
+ Copyright © 1998, 1999 Eric Smith <eric@brouhaha.com>
+ Copyright © 2001, 2002 Billy Biggs <vektor@dumbterm.net>
+ Copyright © 2000, 2001 Martin Norb�ck
+ Copyright © 2000, 2001 Bj�rn Englund
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+libdca - free library for decoding DTS Coherent Acoustics streams
+<http://www.videolan.org/developers/libdca.html>
+
+ Copyright © 2004 Gildas Bazin <gbazin@videolan.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+libspucc - library that's part of the Xine project
+<http://www.xine-project.org/home>
+
+ Copyright © 2000-2008 the xine project
+ Copyright © Christian Vogler cvogler@gradient.cis.upenn.edu - December 2001
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+libmpeg2 - a free MPEG-2 video stream decoder
+<http://libmpeg2.sourceforge.net/>
+
+ Copyright © 2000-2004 Michel Lespinasse <walken@zoy.org>
+ Copyright © 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+libdvdcss - library designed for accessing encrypted DVDs
+<http://www.videolan.org/developers/libdvdcss.html>
+
+ Copyright © 1999-2001 VideoLAN
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Sample frequency change classes
+
+ Copyright © Spoon (www.dbpoweramp.com) March 2002 dbpoweramp@dbpoweramp.com
+
+ The code is based on original SSRC by Naoki Shibata
+ <http://shibatch.sourceforge.net/
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Kodi-xrandr.c
+
+ Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc.
+ Copyright © 2002 Hewlett Packard Company, Inc.
+ Copyright © 2006 Intel Corporation
+
+ Permission to use, copy, modify, distribute, and sell this software and its
+ documentation for any purpose is hereby granted without fee, provided that
+ the above copyright notice appear in all copies and that both that copyright
+ notice and this permission notice appear in supporting documentation, and
+ that the name of the copyright holders not be used in advertising or
+ publicity pertaining to distribution of the software without specific,
+ written prior permission. The copyright holders make no representations
+ about the suitability of this software for any purpose. It is provided "as
+ is" without express or implied warranty.
+
+ THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ OF THIS SOFTWARE.
+
+Kodi/Crc32.cpp and Kodi/Crc32.h
+
+ Copyright (C) 2005-2009 Team Kodi
+ http://kodi.tv
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ Portion of this code was taken from efone.
+ efone - Distributed internet phone system.
+
+ (c) 1999,2000 Krzysztof Dabrowski
+ (c) 1999,2000 ElysiuM deeZine
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version
+ 2 of the License, or (at your option) any later version.
+
+ based on implementation by Finn Yannick Jacobs
+
+guilib/AnimatedGif.cpp and guilib/AnimatedGif.h
+
+ Copyright (c) 2000, Juan Soulie <jsoulie@cplusplus.com>
+
+ Permission to use, copy, modify, distribute and sell this software or any
+ part thereof and/or its documentation for any purpose is granted without fee
+ provided that the above copyright notice and this permission notice appear
+ in all copies.
+
+ This software is provided "as is" without express or implied warranty of
+ any kind. The author shall have no liability with respect to the
+ infringement of copyrights or patents that any modification to the content
+ of this file or this file itself may incur.
+
+json-cpp - lightweight data-interchange format
+<http://jsoncpp.sourceforge.net/>
+
+ Author is Baptiste Lepilleur <blep@users.sourceforge.net>
+
+ The json-cpp library and this documentation are in Public Domain.
+
+Crystal HD
+<http://www.broadcom.com/support/crystal_hd/>
+
+ Copyright(c) 2006-2009 Broadcom Corporation.
+
+ The Crystal HD library is free software: you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation, version 2.1 of the License.
+
+ The Crystal HD library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+ You should have received a copy of the GNU Lesser General Public License
+ along with this header. If not, see <http://www.gnu.org/licenses/>.
+
+ The Crystal HD driver is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, version 2 of the License.
+
+ The Crystal HD driver is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this driver. If not, see <http://www.gnu.org/licenses/>.
+
+OpenSSH
+<http://www.openssh.org/>
+
+ Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
+ All rights reserved.
+
+ See the section 'License: OpenSSH' for full license terms.
+
+Enca - Extremely Naive Charset Analyser
+<http://freshmeat.net/projects/enca/>
+
+ Copyright (C) 2000-2003 David Necas (Yeti) <yeti@physics.muni.cz>
+ Copyright (C) 2009 Michal Cihar <michal@cihar.com>
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of version 2 of the GNU General Public License as published
+ by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+C-Pluff - a plug-in framework for C
+<http://www.c-pluff.org/>
+
+ Copyright 2007 Johannes Lehtinen
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ C-Pluff uses data structure implementations from Kazlib library.
+
+ KazLib copyright and license
+ ----------------------------
+
+ Hash Table Data Type
+ List Abstract Data Type
+ Copyright (C) 1997 Kaz Kylheku <kaz@ashi.footprints.net>
+
+ Free Software License:
+
+ All rights are reserved by the author, with the following exceptions:
+ Permission is granted to freely reproduce and distribute this software,
+ possibly in exchange for a fee, provided that this copyright notice appears
+ intact. Permission is also granted to adapt this software to produce
+ derivative works, as long as the modified versions carry this copyright
+ notice and additional notices stating that the work has been modified.
+ This source code may be translated into executable form and incorporated
+ into proprietary software; there is no requirement for such software to
+ contain a copyright notice related to this source.
+
+J2ME Event Client
+
+ Copyright (c) 2008 topfs2
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+OSXRemote Client
+
+ Created by Stephan Diederich.
+ Copyright 2008 University Heidelberg. All rights reserved.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+HIDRemote Classes used by OSXRemote Client
+
+ Copyright (c) 2007-2009 IOSPIRIT GmbH (http://www.iospirit.com/)
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ * Neither the name of IOSPIRIT GmbH nor the names of its contributors may be
+ used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+
+Implementation of POSIX directory browsing functions and types for Win32.
+
+ Copyright Kevlin Henney, 1997, 2003. All rights reserved.
+
+ Permission to use, copy, modify, and distribute this software and its
+ documentation for any purpose is hereby granted without fee, provided
+ that this copyright and permissions notice appear in all copies and
+ derivatives.
+
+ This software is supplied "as is" without express or implied warranty.
+
+ But that said, if there are any problems please get in touch.
+
+Bitstream Vera Fonts
+
+ Copyright (C) 2003 Bitstream, Inc.
+ All Rights Reserved. Bitstream Vera is a trademark of Bitstream, Inc.
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of the fonts accompanying this license ("Fonts") and associated
+ documentation files (the "Font Software"), to reproduce and distribute
+ the Font Software, including without limitation the rights to use, copy,
+ merge, publish, distribute, and/or sell copies of the Font Software, and
+ to permit persons to whom the Font Software is furnished to do so,
+ subject to the following conditions:
+
+ The above copyright and trademark notices and this permission notice
+ shall be included in all copies of one or more of the Font Software
+ typefaces.
+
+ The Font Software may be modified, altered, or added to, and in
+ particular the designs of glyphs or characters in the Fonts may be
+ modified and additional glyphs or characters may be added to the Fonts,
+ only if the fonts are renamed to names not containing either the words
+ "Bitstream" or the word "Vera".
+
+ This License becomes null and void to the extent applicable to Fonts or
+ Font Software that has been modified and is distributed under the
+ "Bitstream Vera" names.
+
+ The Font Software may be sold as part of a larger software package but
+ no copy of one or more of the Font Software typefaces may be sold by
+ itself.
+
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
+ COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL
+ BITSTREAM OR THE GNOME FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL,
+ OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT
+ SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
+
+ Except as contained in this notice, the names of Gnome, the Gnome
+ Foundation, and Bitstream Inc., shall not be used in advertising or
+ otherwise to promote the sale, use or other dealings in this Font
+ Software without prior written authorization from the Gnome Foundation
+ or Bitstream Inc., respectively. For further information, contact:
+ <fonts@gnome.org>.
+
+DejaVu Fonts
+
+ Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.
+ Glyphs imported from Arev fonts are (c) Tavmjung Bah (see below)
+ Bitstream Vera Fonts Copyright
+ ------------------------------
+ Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is
+ a trademark of Bitstream, Inc.
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of the fonts accompanying this license ("Fonts") and associated
+ documentation files (the "Font Software"), to reproduce and distribute the
+ Font Software, including without limitation the rights to use, copy, merge,
+ publish, distribute, and/or sell copies of the Font Software, and to permit
+ persons to whom the Font Software is furnished to do so, subject to the
+ following conditions:
+ The above copyright and trademark notices and this permission notice shall
+ be included in all copies of one or more of the Font Software typefaces.
+ The Font Software may be modified, altered, or added to, and in particular
+ the designs of glyphs or characters in the Fonts may be modified and
+ additional glyphs or characters may be added to the Fonts, only if the fonts
+ are renamed to names not containing either the words "Bitstream" or the word
+ "Vera".
+ This License becomes null and void to the extent applicable to Fonts or Font
+ Software that has been modified and is distributed under the "Bitstream
+ Vera" names.
+ The Font Software may be sold as part of a larger software package but no
+ copy of one or more of the Font Software typefaces may be sold by itself.
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
+ TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME
+ FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING
+ ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE
+ FONT SOFTWARE.
+ Except as contained in this notice, the names of Gnome, the Gnome
+ Foundation, and Bitstream Inc., shall not be used in advertising or
+ otherwise to promote the sale, use or other dealings in this Font Software
+ without prior written authorization from the Gnome Foundation or Bitstream
+ Inc., respectively. For further information, contact: fonts at gnome dot
+ org.
+ Arev Fonts Copyright
+ ------------------------------
+ Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved.
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of the fonts accompanying this license ("Fonts") and
+ associated documentation files (the "Font Software"), to reproduce
+ and distribute the modifications to the Bitstream Vera Font Software,
+ including without limitation the rights to use, copy, merge, publish,
+ distribute, and/or sell copies of the Font Software, and to permit
+ persons to whom the Font Software is furnished to do so, subject to
+ the following conditions:
+ The above copyright and trademark notices and this permission notice
+ shall be included in all copies of one or more of the Font Software
+ typefaces.
+ The Font Software may be modified, altered, or added to, and in
+ particular the designs of glyphs or characters in the Fonts may be
+ modified and additional glyphs or characters may be added to the
+ Fonts, only if the fonts are renamed to names not containing either
+ the words "Tavmjong Bah" or the word "Arev".
+ This License becomes null and void to the extent applicable to Fonts
+ or Font Software that has been modified and is distributed under the
+ "Tavmjong Bah Arev" names.
+ The Font Software may be sold as part of a larger software package but
+ no copy of one or more of the Font Software typefaces may be sold by
+ itself.
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL
+ TAVMJONG BAH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+ OTHER DEALINGS IN THE FONT SOFTWARE.
+ Except as contained in this notice, the name of Tavmjong Bah shall not
+ be used in advertising or otherwise to promote the sale, use or other
+ dealings in this Font Software without prior written authorization
+ from Tavmjong Bah. For further information, contact: tavmjong @ free
+
+SlingboxLib - Library to communicate with Slingbox devices
+<http://www.stonyx.com>
+
+ Copyright (C) 2010-2011 Stonyx
+
+ This library is free software. You can redistribute it and/or modify it
+ under the terms of the GNU General Public License Version 2 (or at your
+ option any later version) as published by The Free Software Foundation.
+
+ This library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ASAP (Another Slight Atari Player)
+<http://asap.sourceforge.net>
+
+ Copyright (C) 2005-2009 Piotr Fusik
+
+ ASAP is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2 of the License,
+ or (at your option) any later version.
+
+ ASAP is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty
+ of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+CMyth - C library for communicating with MythTv server
+<http://www.mvpmc.org>
+
+ Copyright (C) 2004-2006, Eric Lund, Jon Gettler
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+libapetag - Library for manipulating APE tags.
+<http://src.gnu-darwin.org/ports/audio/easytag/work/easytag-2.1/src/libapetag/>
+
+ Copyright (c) 2002 Artur Polaczynski (Ar't) All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+libbluray - Blu-ray disc playback support library
+
+ Copyright (C) 2010, hpi1
+ Copyright (C) 2010, fraxinas
+ Copyright (C) 2010, John Stebbins
+ Copyright (C) 2010, Joakim
+ Copyright (C) 2010, Obliter0n
+ Copyright (C) 2010, William Hahne
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+libexif - library to parse EXIF files
+
+ Copyright (C) 2001-2009, Lutz Müller <urc8@rz.uni-karlsruhe.de>
+ Copyright (C) 2004-2009, Jan Patera <patera@users.sourceforge.net>
+ Copyright (C) 2004, Joerg Hoh<joerg@devone.org>
+ Copyright (C) 2005-2006, Hubert Figuiere <hub@figuiere.net>
+ Copyright (C) 2002-2005, Hans Ulrich Niedermann <gp@n-dimensional.de>
+ Copyright (C) 2007-2010, Dan Fandrich <dan@coneharvesters.com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+libnfs - NFS client library
+
+ Copyright (C) 2010-2011 Ronnie Sahlberg <ronniesahlberg@gmail.com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+libsquish - Open source DXT compression library
+
+ Copyright (C) 2006 Simon Brown <si@sjbrown.co.uk>
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+LZO Library - LZO real-time data compression library
+
+ Copyright (C) 1996-1997 Markus Franz Xaver Johannes Oberhumer
+
+ The LZO library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of
+ the License, or (at your option) any later version.
+
+ The LZO library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Licenses:
+
+License: GPL
+
+A copy of the GPL can be found on Debian systems at
+/usr/share/common-licenses/GPL.
+
+License: LGPL
+
+A copy of the LGPL can be found on Debian systems at
+/usr/share/common-licenses/LGPL.
+
+License: FTL
+ The FreeType Project LICENSE
+ ----------------------------
+
+ 2006-Jan-27
+
+ Copyright 1996-2002, 2006 by
+ David Turner, Robert Wilhelm, and Werner Lemberg
+
+
+
+Introduction
+============
+
+ The FreeType Project is distributed in several archive packages;
+ some of them may contain, in addition to the FreeType font engine,
+ various tools and contributions which rely on, or relate to, the
+ FreeType Project.
+
+ This license applies to all files found in such packages, and
+ which do not fall under their own explicit license. The license
+ affects thus the FreeType font engine, the test programs,
+ documentation and makefiles, at the very least.
+
+ This license was inspired by the BSD, Artistic, and IJG
+ (Independent JPEG Group) licenses, which all encourage inclusion
+ and use of free software in commercial and freeware products
+ alike. As a consequence, its main points are that:
+
+ o We don't promise that this software works. However, we will be
+ interested in any kind of bug reports. (`as is' distribution)
+
+ o You can use this software for whatever you want, in parts or
+ full form, without having to pay us. (`royalty-free' usage)
+
+ o You may not pretend that you wrote this software. If you use
+ it, or only parts of it, in a program, you must acknowledge
+ somewhere in your documentation that you have used the
+ FreeType code. (`credits')
+
+ We specifically permit and encourage the inclusion of this
+ software, with or without modifications, in commercial products.
+ We disclaim all warranties covering The FreeType Project and
+ assume no liability related to The FreeType Project.
+
+
+ Finally, many people asked us for a preferred form for a
+ credit/disclaimer to use in compliance with this license. We thus
+ encourage you to use the following text:
+
+ """
+ Portions of this software are copyright © <year> The FreeType
+ Project (www.freetype.org). All rights reserved.
+ """
+
+ Please replace <year> with the value from the FreeType version you
+ actually use.
+
+
+Legal Terms
+===========
+
+0. Definitions
+--------------
+
+ Throughout this license, the terms `package', `FreeType Project',
+ and `FreeType archive' refer to the set of files originally
+ distributed by the authors (David Turner, Robert Wilhelm, and
+ Werner Lemberg) as the `FreeType Project', be they named as alpha,
+ beta or final release.
+
+ `You' refers to the licensee, or person using the project, where
+ `using' is a generic term including compiling the project's source
+ code as well as linking it to form a `program' or `executable'.
+ This program is referred to as `a program using the FreeType
+ engine'.
+
+ This license applies to all files distributed in the original
+ FreeType Project, including all source code, binaries and
+ documentation, unless otherwise stated in the file in its
+ original, unmodified form as distributed in the original archive.
+ If you are unsure whether or not a particular file is covered by
+ this license, you must contact us to verify this.
+
+ The FreeType Project is copyright (C) 1996-2000 by David Turner,
+ Robert Wilhelm, and Werner Lemberg. All rights reserved except as
+ specified below.
+
+1. No Warranty
+--------------
+
+ THE FREETYPE PROJECT IS PROVIDED `AS IS' WITHOUT WARRANTY OF ANY
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE. IN NO EVENT WILL ANY OF THE AUTHORS OR COPYRIGHT HOLDERS
+ BE LIABLE FOR ANY DAMAGES CAUSED BY THE USE OR THE INABILITY TO
+ USE, OF THE FREETYPE PROJECT.
+
+2. Redistribution
+-----------------
+
+ This license grants a worldwide, royalty-free, perpetual and
+ irrevocable right and license to use, execute, perform, compile,
+ display, copy, create derivative works of, distribute and
+ sublicense the FreeType Project (in both source and object code
+ forms) and derivative works thereof for any purpose; and to
+ authorize others to exercise some or all of the rights granted
+ herein, subject to the following conditions:
+
+ o Redistribution of source code must retain this license file
+ (`FTL.TXT') unaltered; any additions, deletions or changes to
+ the original files must be clearly indicated in accompanying
+ documentation. The copyright notices of the unaltered,
+ original files must be preserved in all copies of source
+ files.
+
+ o Redistribution in binary form must provide a disclaimer that
+ states that the software is based in part of the work of the
+ FreeType Team, in the distribution documentation. We also
+ encourage you to put an URL to the FreeType web page in your
+ documentation, though this isn't mandatory.
+
+ These conditions apply to any software derived from or based on
+ the FreeType Project, not just the unmodified files. If you use
+ our work, you must acknowledge us. However, no fee need be paid
+ to us.
+
+3. Advertising
+--------------
+
+ Neither the FreeType authors and contributors nor you shall use
+ the name of the other for commercial, advertising, or promotional
+ purposes without specific prior written permission.
+
+ We suggest, but do not require, that you use one or more of the
+ following phrases to refer to this software in your documentation
+ or advertising materials: `FreeType Project', `FreeType Engine',
+ `FreeType library', or `FreeType Distribution'.
+
+ As you have not signed this license, you are not required to
+ accept it. However, as the FreeType Project is copyrighted
+ material, only this license, or another one contracted with the
+ authors, grants you the right to use, distribute, and modify it.
+ Therefore, by using, distributing, or modifying the FreeType
+ Project, you indicate that you understand and accept all the terms
+ of this license.
+
+4. Contacts
+-----------
+
+ There are two mailing lists related to FreeType:
+
+ o freetype@nongnu.org
+
+ Discusses general use and applications of FreeType, as well as
+ future and wanted additions to the library and distribution.
+ If you are looking for support, start in this list if you
+ haven't found anything to help you in the documentation.
+
+ o freetype-devel@nongnu.org
+
+ Discusses bugs, as well as engine internals, design issues,
+ specific licenses, porting, etc.
+
+ Our home page can be found at
+
+ http://www.freetype.org
+
+
+--- end of FTL ---
+
+License: PSF License for Python 2.4
+
+A. HISTORY OF THE SOFTWARE
+==========================
+
+Python was created in the early 1990s by Guido van Rossum at Stichting
+Mathematisch Centrum (CWI, see http://www.cwi.nl) in the Netherlands
+as a successor of a language called ABC. Guido remains Python's
+principal author, although it includes many contributions from others.
+
+In 1995, Guido continued his work on Python at the Corporation for
+National Research Initiatives (CNRI, see http://www.cnri.reston.va.us)
+in Reston, Virginia where he released several versions of the
+software.
+
+In May 2000, Guido and the Python core development team moved to
+BeOpen.com to form the BeOpen PythonLabs team. In October of the same
+year, the PythonLabs team moved to Digital Creations (now Zope
+Corporation, see http://www.zope.com). In 2001, the Python Software
+Foundation (PSF, see http://www.python.org/psf/) was formed, a
+non-profit organization created specifically to own Python-related
+Intellectual Property. Zope Corporation is a sponsoring member of
+the PSF.
+
+All Python releases are Open Source (see http://www.opensource.org for
+the Open Source Definition). Historically, most, but not all, Python
+releases have also been GPL-compatible; the table below summarizes
+the various releases.
+
+ Release Derived Year Owner GPL-
+ from compatible? (1)
+
+ 0.9.0 thru 1.2 1991-1995 CWI yes
+ 1.3 thru 1.5.2 1.2 1995-1999 CNRI yes
+ 1.6 1.5.2 2000 CNRI no
+ 2.0 1.6 2000 BeOpen.com no
+ 1.6.1 1.6 2001 CNRI yes (2)
+ 2.1 2.0+1.6.1 2001 PSF no
+ 2.0.1 2.0+1.6.1 2001 PSF yes
+ 2.1.1 2.1+2.0.1 2001 PSF yes
+ 2.2 2.1.1 2001 PSF yes
+ 2.1.2 2.1.1 2002 PSF yes
+ 2.1.3 2.1.2 2002 PSF yes
+ 2.2.1 2.2 2002 PSF yes
+ 2.2.2 2.2.1 2002 PSF yes
+ 2.2.3 2.2.2 2003 PSF yes
+ 2.3 2.2.2 2002-2003 PSF yes
+ 2.3.1 2.3 2002-2003 PSF yes
+ 2.3.2 2.3.1 2002-2003 PSF yes
+ 2.3.3 2.3.2 2002-2003 PSF yes
+ 2.3.4 2.3.3 2004 PSF yes
+ 2.3.5 2.3.4 2005 PSF yes
+ 2.4 2.3 2004 PSF yes
+ 2.4.1 2.4 2005 PSF yes
+ 2.4.2 2.4.1 2005 PSF yes
+ 2.4.3 2.4.2 2006 PSF yes
+ 2.4.4 2.4.3 2006 PSF yes
+
+Footnotes:
+
+(1) GPL-compatible doesn't mean that we're distributing Python under
+ the GPL. All Python licenses, unlike the GPL, let you distribute
+ a modified version without making your changes open source. The
+ GPL-compatible licenses make it possible to combine Python with
+ other software that is released under the GPL; the others don't.
+
+(2) According to Richard Stallman, 1.6.1 is not GPL-compatible,
+ because its license has a choice of law clause. According to
+ CNRI, however, Stallman's lawyer has told CNRI's lawyer that 1.6.1
+ is "not incompatible" with the GPL.
+
+Thanks to the many outside volunteers who have worked under Guido's
+direction to make these releases possible.
+
+
+B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON
+===============================================================
+
+PSF LICENSE AGREEMENT FOR PYTHON 2.4
+------------------------------------
+
+1. This LICENSE AGREEMENT is between the Python Software Foundation
+("PSF"), and the Individual or Organization ("Licensee") accessing and
+otherwise using Python 2.4 software in source or binary form and its
+associated documentation.
+
+2. Subject to the terms and conditions of this License Agreement, PSF
+hereby grants Licensee a nonexclusive, royalty-free, world-wide
+license to reproduce, analyze, test, perform and/or display publicly,
+prepare derivative works, distribute, and otherwise use Python 2.4
+alone or in any derivative version, provided, however, that PSF's
+License Agreement and PSF's notice of copyright, i.e., "Copyright (c)
+2001, 2002, 2003, 2004 Python Software Foundation; All Rights Reserved"
+are retained in Python 2.4 alone or in any derivative version prepared
+by Licensee.
+
+3. In the event Licensee prepares a derivative work that is based on
+or incorporates Python 2.4 or any part thereof, and wants to make
+the derivative work available to others as provided herein, then
+Licensee hereby agrees to include in any such work a brief summary of
+the changes made to Python 2.4.
+
+4. PSF is making Python 2.4 available to Licensee on an "AS IS"
+basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
+IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
+DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
+FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 2.4 WILL NOT
+INFRINGE ANY THIRD PARTY RIGHTS.
+
+5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
+2.4 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
+A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 2.4,
+OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
+
+6. This License Agreement will automatically terminate upon a material
+breach of its terms and conditions.
+
+7. Nothing in this License Agreement shall be deemed to create any
+relationship of agency, partnership, or joint venture between PSF and
+Licensee. This License Agreement does not grant permission to use PSF
+trademarks or trade name in a trademark sense to endorse or promote
+products or services of Licensee, or any third party.
+
+8. By copying, installing or otherwise using Python 2.4, Licensee
+agrees to be bound by the terms and conditions of this License
+Agreement.
+
+
+BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0
+-------------------------------------------
+
+BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1
+
+1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an
+office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the
+Individual or Organization ("Licensee") accessing and otherwise using
+this software in source or binary form and its associated
+documentation ("the Software").
+
+2. Subject to the terms and conditions of this BeOpen Python License
+Agreement, BeOpen hereby grants Licensee a non-exclusive,
+royalty-free, world-wide license to reproduce, analyze, test, perform
+and/or display publicly, prepare derivative works, distribute, and
+otherwise use the Software alone or in any derivative version,
+provided, however, that the BeOpen Python License is retained in the
+Software, alone or in any derivative version prepared by Licensee.
+
+3. BeOpen is making the Software available to Licensee on an "AS IS"
+basis. BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
+IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND
+DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
+FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT
+INFRINGE ANY THIRD PARTY RIGHTS.
+
+4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE
+SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS
+AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY
+DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
+
+5. This License Agreement will automatically terminate upon a material
+breach of its terms and conditions.
+
+6. This License Agreement shall be governed by and interpreted in all
+respects by the law of the State of California, excluding conflict of
+law provisions. Nothing in this License Agreement shall be deemed to
+create any relationship of agency, partnership, or joint venture
+between BeOpen and Licensee. This License Agreement does not grant
+permission to use BeOpen trademarks or trade names in a trademark
+sense to endorse or promote products or services of Licensee, or any
+third party. As an exception, the "BeOpen Python" logos available at
+http://www.pythonlabs.com/logos.html may be used according to the
+permissions granted on that web page.
+
+7. By copying, installing or otherwise using the software, Licensee
+agrees to be bound by the terms and conditions of this License
+Agreement.
+
+
+CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1
+---------------------------------------
+
+1. This LICENSE AGREEMENT is between the Corporation for National
+Research Initiatives, having an office at 1895 Preston White Drive,
+Reston, VA 20191 ("CNRI"), and the Individual or Organization
+("Licensee") accessing and otherwise using Python 1.6.1 software in
+source or binary form and its associated documentation.
+
+2. Subject to the terms and conditions of this License Agreement, CNRI
+hereby grants Licensee a nonexclusive, royalty-free, world-wide
+license to reproduce, analyze, test, perform and/or display publicly,
+prepare derivative works, distribute, and otherwise use Python 1.6.1
+alone or in any derivative version, provided, however, that CNRI's
+License Agreement and CNRI's notice of copyright, i.e., "Copyright (c)
+1995-2001 Corporation for National Research Initiatives; All Rights
+Reserved" are retained in Python 1.6.1 alone or in any derivative
+version prepared by Licensee. Alternately, in lieu of CNRI's License
+Agreement, Licensee may substitute the following text (omitting the
+quotes): "Python 1.6.1 is made available subject to the terms and
+conditions in CNRI's License Agreement. This Agreement together with
+Python 1.6.1 may be located on the Internet using the following
+unique, persistent identifier (known as a handle): 1895.22/1013. This
+Agreement may also be obtained from a proxy server on the Internet
+using the following URL: http://hdl.handle.net/1895.22/1013".
+
+3. In the event Licensee prepares a derivative work that is based on
+or incorporates Python 1.6.1 or any part thereof, and wants to make
+the derivative work available to others as provided herein, then
+Licensee hereby agrees to include in any such work a brief summary of
+the changes made to Python 1.6.1.
+
+4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS"
+basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
+IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND
+DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
+FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT
+INFRINGE ANY THIRD PARTY RIGHTS.
+
+5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
+1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
+A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1,
+OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
+
+6. This License Agreement will automatically terminate upon a material
+breach of its terms and conditions.
+
+7. This License Agreement shall be governed by the federal
+intellectual property law of the United States, including without
+limitation the federal copyright law, and, to the extent such
+U.S. federal law does not apply, by the law of the Commonwealth of
+Virginia, excluding Virginia's conflict of law provisions.
+Notwithstanding the foregoing, with regard to derivative works based
+on Python 1.6.1 that incorporate non-separable material that was
+previously distributed under the GNU General Public License (GPL), the
+law of the Commonwealth of Virginia shall govern this License
+Agreement only as to issues arising under or with respect to
+Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this
+License Agreement shall be deemed to create any relationship of
+agency, partnership, or joint venture between CNRI and Licensee. This
+License Agreement does not grant permission to use CNRI trademarks or
+trade name in a trademark sense to endorse or promote products or
+services of Licensee, or any third party.
+
+8. By clicking on the "ACCEPT" button where indicated, or by copying,
+installing or otherwise using Python 1.6.1, Licensee agrees to be
+bound by the terms and conditions of this License Agreement.
+
+ ACCEPT
+
+
+CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2
+--------------------------------------------------
+
+Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam,
+The Netherlands. All rights reserved.
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Stichting Mathematisch
+Centrum or CWI not be used in advertising or publicity pertaining to
+distribution of the software without specific, written prior
+permission.
+
+STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
+THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
+FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+-- End of PSF License for Python 2.4 --
+
+License: IJG License
+
+LEGAL ISSUES
+============
+
+In plain English:
+
+1. We don't promise that this software works. (But if you find any bugs,
+ please let us know!)
+2. You can use this software for whatever you want. You don't have to pay us.
+3. You may not pretend that you wrote this software. If you use it in a
+ program, you must acknowledge somewhere in your documentation that
+ you've used the IJG code.
+
+In legalese:
+
+The authors make NO WARRANTY or representation, either express or implied,
+with respect to this software, its quality, accuracy, merchantability, or
+fitness for a particular purpose. This software is provided "AS IS", and you,
+its user, assume the entire risk as to its quality and accuracy.
+
+This software is copyright (C) 1991-1998, Thomas G. Lane.
+All Rights Reserved except as specified below.
+
+Permission is hereby granted to use, copy, modify, and distribute this
+software (or portions thereof) for any purpose, without fee, subject to these
+conditions:
+(1) If any part of the source code for this software is distributed, then this
+README file must be included, with this copyright and no-warranty notice
+unaltered; and any additions, deletions, or changes to the original files
+must be clearly indicated in accompanying documentation.
+(2) If only executable code is distributed, then the accompanying
+documentation must state that "this software is based in part on the work of
+the Independent JPEG Group".
+(3) Permission for use of this software is granted only if the user accepts
+full responsibility for any undesirable consequences; the authors accept
+NO LIABILITY for damages of any kind.
+
+These conditions apply to any software derived from or based on the IJG code,
+not just to the unmodified library. If you use our work, you ought to
+acknowledge us.
+
+Permission is NOT granted for the use of any IJG author's name or company name
+in advertising or publicity relating to this software or products derived from
+it. This software may be referred to only as "the Independent JPEG Group's
+software".
+
+We specifically permit and encourage the use of this software as the basis of
+commercial products, provided that all warranty or liability claims are
+assumed by the product vendor.
+
+
+ansi2knr.c is included in this distribution by permission of L. Peter Deutsch,
+sole proprietor of its copyright holder, Aladdin Enterprises of Menlo Park, CA.
+ansi2knr.c is NOT covered by the above copyright and conditions, but instead
+by the usual distribution terms of the Free Software Foundation; principally,
+that you must include source code if you redistribute it. (See the file
+ansi2knr.c for full details.) However, since ansi2knr.c is not needed as part
+of any program generated from the IJG code, this does not limit you more than
+the foregoing paragraphs do.
+
+The Unix configuration script "configure" was produced with GNU Autoconf.
+It is copyright by the Free Software Foundation but is freely distributable.
+The same holds for its supporting scripts (config.guess, config.sub,
+ltconfig, ltmain.sh). Another support script, install-sh, is copyright
+by M.I.T. but is also freely distributable.
+
+It appears that the arithmetic coding option of the JPEG spec is covered by
+patents owned by IBM, AT&T, and Mitsubishi. Hence arithmetic coding cannot
+legally be used without obtaining one or more licenses. For this reason,
+support for arithmetic coding has been removed from the free JPEG software.
+(Since arithmetic coding provides only a marginal gain over the unpatented
+Huffman mode, it is unlikely that very many implementations will support it.)
+So far as we are aware, there are no patent restrictions on the remaining
+code.
+
+The IJG distribution formerly included code to read and write GIF files.
+To avoid entanglement with the Unisys LZW patent, GIF reading support has
+been removed altogether, and the GIF writer has been simplified to produce
+"uncompressed GIFs". This technique does not use the LZW algorithm; the
+resulting GIF files are larger than usual, but are readable by all standard
+GIF decoders.
+
+We are required to state that
+ "The Graphics Interchange Format(c) is the Copyright property of
+ CompuServe Incorporated. GIF(sm) is a Service Mark property of
+ CompuServe Incorporated."
+
+-- End of IJG License --
+
+License: OpenSSH
+
+This file is part of the OpenSSH software.
+
+The licences which components of this software fall under are as
+follows. First, we will summarize and say that all components
+are under a BSD licence, or a licence more free than that.
+
+OpenSSH contains no GPL code.
+
+1)
+ * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
+ * All rights reserved
+ *
+ * As far as I am concerned, the code I have written for this software
+ * can be used freely for any purpose. Any derived versions of this
+ * software must be clearly marked as such, and if the derived work is
+ * incompatible with the protocol description in the RFC file, it must be
+ * called by a name other than "ssh" or "Secure Shell".
+
+ [Tatu continues]
+ * However, I am not implying to give any licenses to any patents or
+ * copyrights held by third parties, and the software includes parts that
+ * are not under my direct control. As far as I know, all included
+ * source code is used in accordance with the relevant license agreements
+ * and can be used freely for any purpose (the GNU license being the most
+ * restrictive); see below for details.
+
+ [However, none of that term is relevant at this point in time. All of
+ these restrictively licenced software components which he talks about
+ have been removed from OpenSSH, i.e.,
+
+ - RSA is no longer included, found in the OpenSSL library
+ - IDEA is no longer included, its use is deprecated
+ - DES is now external, in the OpenSSL library
+ - GMP is no longer used, and instead we call BN code from OpenSSL
+ - Zlib is now external, in a library
+ - The make-ssh-known-hosts script is no longer included
+ - TSS has been removed
+ - MD5 is now external, in the OpenSSL library
+ - RC4 support has been replaced with ARC4 support from OpenSSL
+ - Blowfish is now external, in the OpenSSL library
+
+ [The licence continues]
+
+ Note that any information and cryptographic algorithms used in this
+ software are publicly available on the Internet and at any major
+ bookstore, scientific library, and patent office worldwide. More
+ information can be found e.g. at "http://www.cs.hut.fi/crypto".
+
+ The legal status of this program is some combination of all these
+ permissions and restrictions. Use only at your own responsibility.
+ You will be responsible for any legal consequences yourself; I am not
+ making any claims whether possessing or using this is legal or not in
+ your country, and I am not taking any responsibility on your behalf.
+
+
+ NO WARRANTY
+
+ BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+ OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+ REPAIR OR CORRECTION.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+ INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGES.
+
+2)
+ The 32-bit CRC compensation attack detector in deattack.c was
+ contributed by CORE SDI S.A. under a BSD-style license.
+
+ * Cryptographic attack detector for ssh - source code
+ *
+ * Copyright (c) 1998 CORE SDI S.A., Buenos Aires, Argentina.
+ *
+ * All rights reserved. Redistribution and use in source and binary
+ * forms, with or without modification, are permitted provided that
+ * this copyright notice is retained.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES ARE DISCLAIMED. IN NO EVENT SHALL CORE SDI S.A. BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY OR
+ * CONSEQUENTIAL DAMAGES RESULTING FROM THE USE OR MISUSE OF THIS
+ * SOFTWARE.
+ *
+ * Ariel Futoransky <futo@core-sdi.com>
+ * <http://www.core-sdi.com>
+
+3)
+ ssh-keyscan was contributed by David Mazieres under a BSD-style
+ license.
+
+ * Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>.
+ *
+ * Modification and redistribution in source and binary forms is
+ * permitted provided that due credit is given to the author and the
+ * OpenBSD project by leaving this copyright notice intact.
+
+4)
+ The Rijndael implementation by Vincent Rijmen, Antoon Bosselaers
+ and Paulo Barreto is in the public domain and distributed
+ with the following license:
+
+ * @version 3.0 (December 2000)
+ *
+ * Optimised ANSI C code for the Rijndael cipher (now AES)
+ *
+ * @author Vincent Rijmen <vincent.rijmen@esat.kuleuven.ac.be>
+ * @author Antoon Bosselaers <antoon.bosselaers@esat.kuleuven.ac.be>
+ * @author Paulo Barreto <paulo.barreto@terra.com.br>
+ *
+ * This code is hereby placed in the public domain.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+5)
+ One component of the ssh source code is under a 3-clause BSD license,
+ held by the University of California, since we pulled these parts from
+ original Berkeley code.
+
+ * Copyright (c) 1983, 1990, 1992, 1993, 1995
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+
+6)
+ Remaining components of the software are provided under a standard
+ 2-term BSD licence with the following names as copyright holders:
+
+ Markus Friedl
+ Theo de Raadt
+ Niels Provos
+ Dug Song
+ Aaron Campbell
+ Damien Miller
+ Kevin Steves
+ Daniel Kouril
+ Wesley Griffin
+ Per Allansson
+ Nils Nordman
+ Simon Wilkinson
+
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+-- End of OpenSSH License --
diff --git a/cmake/cpack/deb/lintian/overrides/kodi b/cmake/cpack/deb/lintian/overrides/kodi
new file mode 100644
index 0000000000..d9536c4c23
--- /dev/null
+++ b/cmake/cpack/deb/lintian/overrides/kodi
@@ -0,0 +1 @@
+kodi: description-starts-with-package-name
diff --git a/cmake/cpack/deb/menu/kodi b/cmake/cpack/deb/menu/kodi
new file mode 100644
index 0000000000..0c221a44f4
--- /dev/null
+++ b/cmake/cpack/deb/menu/kodi
@@ -0,0 +1,2 @@
+?package(kodi):needs="X11" section="Applications/Video" \
+ title="kodi" command="/usr/bin/kodi"
diff --git a/cmake/cpack/deb/package-description.txt b/cmake/cpack/deb/package-description.txt
new file mode 100644
index 0000000000..961e1c8aa4
--- /dev/null
+++ b/cmake/cpack/deb/package-description.txt
@@ -0,0 +1,16 @@
+Kodi, formerly known as XBMC Media Center, is an award winning free and open
+source software media-player and entertainment hub for all your digital media.
+Kodi is available for Linux, Mac OS X (Leopard, Tiger and Apple TV) and
+Microsoft Windows, as well as the original Xbox game console. Created in 2003
+by a group of like minded programmers, Kodi is a non-profit project run and
+developed by volunteers located around the world. More than 50 software
+developers have contributed to Kodi, and 100-plus translators have worked to
+expand its reach, making it available in more than 30 languages.
+.
+While Kodi functions very well as a standard media player application for your
+computer, it has been designed to be the perfect companion for your HTPC.
+Supporting an almost endless range of remote controls, and combined with its
+beautiful interface and powerful skinning engine, Kodi feels very natural to
+use from the couch and is the ideal solution for your home theater. Once
+installed, your computer will become a fully functional multimedia jukebox.
+. \ No newline at end of file
diff --git a/cmake/cpack/deb/packages/kodi-addon-dev.txt.in b/cmake/cpack/deb/packages/kodi-addon-dev.txt.in
new file mode 100644
index 0000000000..aebae7e2e0
--- /dev/null
+++ b/cmake/cpack/deb/packages/kodi-addon-dev.txt.in
@@ -0,0 +1,25 @@
+# kodi-addon-dev debian package metadata
+#
+# Setting PACKAGE_SHLIBDEPS to 'ON' will cause CPack to ignore PACKAGE_DEPENDS
+# content and use dpkg-shlibdeps to automatically generate the package dependency
+# list. Only useful for packages that contain binaries.
+#
+# PACKAGE_ARCHITECTURE should be set to 'all' only if package contains
+# architecture agnostic data. CPack will set proper architecture (amd64/i386/etc)
+# based on build options.
+#
+# Remaining settings are (hopefully) self-explanatory.
+
+PACKAGE_NAME @APP_NAME_LC@-addon-dev
+PACKAGE_ARCHITECTURE all
+PACKAGE_SECTION libdevel
+PACKAGE_PRIORITY optional
+PACKAGE_SHLIBDEPS
+PACKAGE_DEPENDS
+PACKAGE_RECOMMENDS @APP_NAME_LC@-audio-dev, @APP_NAME_LC@-inputstream-dev, @APP_NAME_LC@-pvr-dev, @APP_NAME_LC@-screensaver-dev, @APP_NAME_LC@-visualization-dev
+PACKAGE_SUGGESTS
+PACKAGE_BREAKS
+PACKAGE_REPLACES
+PACKAGE_PROVIDES xbmc-addon-dev
+PACKAGE_DESCRIPTION_HEADER @APP_NAME@ Media Center (general add-on dev package)
+PACKAGE_DESCRIPTION_FOOTER This is the development package for @APP_NAME@'s add-ons.
diff --git a/cmake/cpack/deb/packages/kodi-audio-dev.txt.in b/cmake/cpack/deb/packages/kodi-audio-dev.txt.in
new file mode 100644
index 0000000000..f03a64d92d
--- /dev/null
+++ b/cmake/cpack/deb/packages/kodi-audio-dev.txt.in
@@ -0,0 +1,25 @@
+# kodi-audio-dev debian package metadata
+#
+# Setting PACKAGE_SHLIBDEPS to 'ON' will cause CPack to ignore PACKAGE_DEPENDS
+# content and use dpkg-shlibdeps to automatically generate the package dependency
+# list. Only useful for packages that contain binaries.
+#
+# PACKAGE_ARCHITECTURE should be set to 'all' only if package contains
+# architecture agnostic data. CPack will set proper architecture (amd64/i386/etc)
+# based on build options.
+#
+# Remaining settings are (hopefully) self-explanatory.
+
+PACKAGE_NAME @APP_NAME_LC@-audio-dev
+PACKAGE_ARCHITECTURE all
+PACKAGE_SECTION libdevel
+PACKAGE_PRIORITY optional
+PACKAGE_SHLIBDEPS
+PACKAGE_DEPENDS @APP_NAME_LC@-addon-dev
+PACKAGE_RECOMMENDS
+PACKAGE_SUGGESTS
+PACKAGE_BREAKS
+PACKAGE_REPLACES
+PACKAGE_PROVIDES xbmc-audio-dev
+PACKAGE_DESCRIPTION_HEADER @APP_NAME@ Media Center (audio add-ons dev package)
+PACKAGE_DESCRIPTION_FOOTER This is the development package for @APP_NAME@'s audio add-ons.
diff --git a/cmake/cpack/deb/packages/kodi-bin.txt.in b/cmake/cpack/deb/packages/kodi-bin.txt.in
new file mode 100644
index 0000000000..8ee33d3b9a
--- /dev/null
+++ b/cmake/cpack/deb/packages/kodi-bin.txt.in
@@ -0,0 +1,25 @@
+# kodi-bin debian package metadata
+#
+# Setting PACKAGE_SHLIBDEPS to 'ON' will cause CPack to ignore PACKAGE_DEPENDS
+# content and use dpkg-shlibdeps to automatically generate the package dependency
+# list. Only useful for packages that contain binaries.
+#
+# PACKAGE_ARCHITECTURE should be set to 'all' only if package contains
+# architecture agnostic data. CPack will set proper architecture (amd64/i386/etc)
+# based on build options.
+#
+# Remaining settings are (hopefully) self-explanatory.
+
+PACKAGE_NAME @APP_NAME_LC@-bin
+PACKAGE_ARCHITECTURE
+PACKAGE_SECTION video
+PACKAGE_PRIORITY optional
+PACKAGE_SHLIBDEPS
+PACKAGE_DEPENDS libasound2 (>= 1.0.27), libavahi-client3 (>= 0.6.16), libavahi-common3 (>= 0.6.16), libbluetooth3 (>= 4.91), libbz2-1.0, libc6 (>= 2.15), libcdio13 (>= 0.83), libcrossguid1, libdbus-1-3 (>= 1.9.14), libdrm2 (>= 2.4.16), libegl1-mesa (>= 7.8.1) | libegl1-x11, libexpat1 (>= 2.0.1), libfreetype6 (>= 2.2.1), libfribidi0 (>= 0.19.2), libgcc1 (>= 1:3.0), libgl1-mesa-glx | libgl1, libgnutls30 (>= 3.4.2), liblzma5 (>= 5.1.1alpha+20120614), liblzo2-2, libmicrohttpd10 (>= 0.9.20), libmysqlclient20 (>= 5.7.11), libpcre3, libpcrecpp0v5 (>= 7.7), libpulse0 (>= 0.99.4), libpython2.7 (>= 2.7), libsmbclient (>= 2:4.0.3+dfsg1), libsqlite3-0 (>= 3.6.11), libssh-4 (>= 0.6.1), libstdc++6 (>= 5.2), libtag1v5 (>= 1.9.1-2.4ubuntu1), libtinyxml2.6.2v5, libudev1 (>= 183), libva-x11-1 (>= 1.0.3), libva1 (>= 1.4.0), libx11-6, libxext6, libxml2 (>= 2.7.4), libxrandr2 (>= 2:1.2.99.3), libxslt1.1 (>= 1.1.25), libyajl2 (>= 2.0.4), zlib1g (>= 1:1.2.0.2)
+PACKAGE_RECOMMENDS
+PACKAGE_SUGGESTS
+PACKAGE_BREAKS xbmc-bin (<< 2:14.0~git20141019), xbmc-common
+PACKAGE_REPLACES xbmc-bin (<< 2:14.0~git20141019), xbmc-common
+PACKAGE_PROVIDES @APP_NAME_LC@-bin, @APP_NAME_LC@-common, xbmc-bin, xbmc-common
+PACKAGE_DESCRIPTION_HEADER @APP_NAME@ Media Center (binary data package)
+PACKAGE_DESCRIPTION_FOOTER This package contains @APP_NAME@'s binary data.
diff --git a/cmake/cpack/deb/packages/kodi-eventclients-common.txt.in b/cmake/cpack/deb/packages/kodi-eventclients-common.txt.in
new file mode 100644
index 0000000000..6559842970
--- /dev/null
+++ b/cmake/cpack/deb/packages/kodi-eventclients-common.txt.in
@@ -0,0 +1,25 @@
+# kodi-eventclients-common debian package metadata
+#
+# Setting PACKAGE_SHLIBDEPS to 'ON' will cause CPack to ignore PACKAGE_DEPENDS
+# content and use dpkg-shlibdeps to automatically generate the package dependency
+# list. Only useful for packages that contain binaries.
+#
+# PACKAGE_ARCHITECTURE should be set to 'all' only if package contains
+# architecture agnostic data. CPack will set proper architecture (amd64/i386/etc)
+# based on build options.
+#
+# Remaining settings are (hopefully) self-explanatory.
+
+PACKAGE_NAME @APP_NAME_LC@-eventclients-common
+PACKAGE_ARCHITECTURE all
+PACKAGE_SECTION video
+PACKAGE_PRIORITY optional
+PACKAGE_SHLIBDEPS
+PACKAGE_DEPENDS
+PACKAGE_RECOMMENDS
+PACKAGE_SUGGESTS
+PACKAGE_BREAKS
+PACKAGE_REPLACES
+PACKAGE_PROVIDES xbmc-eventclients-common
+PACKAGE_DESCRIPTION_HEADER @APP_NAME@ Media Center (event client common package)
+PACKAGE_DESCRIPTION_FOOTER This is the common package for @APP_NAME@'s event client.
diff --git a/cmake/cpack/deb/packages/kodi-eventclients-dev.txt.in b/cmake/cpack/deb/packages/kodi-eventclients-dev.txt.in
new file mode 100644
index 0000000000..4b166b5d1a
--- /dev/null
+++ b/cmake/cpack/deb/packages/kodi-eventclients-dev.txt.in
@@ -0,0 +1,25 @@
+# kodi-eventclients-dev debian package metadata
+#
+# Setting PACKAGE_SHLIBDEPS to 'ON' will cause CPack to ignore PACKAGE_DEPENDS
+# content and use dpkg-shlibdeps to automatically generate the package dependency
+# list. Only useful for packages that contain binaries.
+#
+# PACKAGE_ARCHITECTURE should be set to 'all' only if package contains
+# architecture agnostic data. CPack will set proper architecture (amd64/i386/etc)
+# based on build options.
+#
+# Remaining settings are (hopefully) self-explanatory.
+
+PACKAGE_NAME @APP_NAME_LC@-eventclients-dev
+PACKAGE_ARCHITECTURE all
+PACKAGE_SECTION libdevel
+PACKAGE_PRIORITY optional
+PACKAGE_SHLIBDEPS
+PACKAGE_DEPENDS @APP_NAME_LC@-eventclients-common (= @CPACK_DEBIAN_PACKAGE_VERSION@)
+PACKAGE_RECOMMENDS
+PACKAGE_SUGGESTS
+PACKAGE_BREAKS
+PACKAGE_REPLACES
+PACKAGE_PROVIDES xbmc-eventclients-dev
+PACKAGE_DESCRIPTION_HEADER @APP_NAME@ Media Center (event client dev package)
+PACKAGE_DESCRIPTION_FOOTER This is the development package for @APP_NAME@'s event client.
diff --git a/cmake/cpack/deb/packages/kodi-eventclients-ps3.txt.in b/cmake/cpack/deb/packages/kodi-eventclients-ps3.txt.in
new file mode 100644
index 0000000000..bd432a29ba
--- /dev/null
+++ b/cmake/cpack/deb/packages/kodi-eventclients-ps3.txt.in
@@ -0,0 +1,25 @@
+# kodi-eventclients-ps3 debian package metadata
+#
+# Setting PACKAGE_SHLIBDEPS to 'ON' will cause CPack to ignore PACKAGE_DEPENDS
+# content and use dpkg-shlibdeps to automatically generate the package dependency
+# list. Only useful for packages that contain binaries.
+#
+# PACKAGE_ARCHITECTURE should be set to 'all' only if package contains
+# architecture agnostic data. CPack will set proper architecture (amd64/i386/etc)
+# based on build options.
+#
+# Remaining settings are (hopefully) self-explanatory.
+
+PACKAGE_NAME @APP_NAME_LC@-eventclients-ps3
+PACKAGE_ARCHITECTURE all
+PACKAGE_SECTION video
+PACKAGE_PRIORITY optional
+PACKAGE_SHLIBDEPS
+PACKAGE_DEPENDS @APP_NAME_LC@-eventclients-common (= @CPACK_DEBIAN_PACKAGE_VERSION@), python-bluez | python-lightblue
+PACKAGE_RECOMMENDS
+PACKAGE_SUGGESTS
+PACKAGE_BREAKS
+PACKAGE_REPLACES
+PACKAGE_PROVIDES xbmc-eventclients-ps3
+PACKAGE_DESCRIPTION_HEADER @APP_NAME@ Media Center (PS3 event client package)
+PACKAGE_DESCRIPTION_FOOTER This is the PS3 package for @APP_NAME@'s event client.
diff --git a/cmake/cpack/deb/packages/kodi-eventclients-wiiremote.txt.in b/cmake/cpack/deb/packages/kodi-eventclients-wiiremote.txt.in
new file mode 100644
index 0000000000..5973784ac1
--- /dev/null
+++ b/cmake/cpack/deb/packages/kodi-eventclients-wiiremote.txt.in
@@ -0,0 +1,25 @@
+# kodi-eventclients-wiiremote debian package metadata
+#
+# Setting PACKAGE_SHLIBDEPS to 'ON' will cause CPack to ignore PACKAGE_DEPENDS
+# content and use dpkg-shlibdeps to automatically generate the package dependency
+# list. Only useful for packages that contain binaries.
+#
+# PACKAGE_ARCHITECTURE should be set to 'all' only if package contains
+# architecture agnostic data. CPack will set proper architecture (amd64/i386/etc)
+# based on build options.
+#
+# Remaining settings are (hopefully) self-explanatory.
+
+PACKAGE_NAME @APP_NAME_LC@-eventclients-wiiremote
+PACKAGE_ARCHITECTURE
+PACKAGE_SECTION video
+PACKAGE_PRIORITY optional
+PACKAGE_SHLIBDEPS
+PACKAGE_DEPENDS @APP_NAME_LC@-eventclients-common (= @CPACK_DEBIAN_PACKAGE_VERSION@), libbluetooth3 (>= 4.91), libc6 (>= 2.14), libcwiid1 (>= 0.6.00+svn184), libgcc1 (>= 1:3.0), libstdc++6 (>= 5.2)
+PACKAGE_RECOMMENDS
+PACKAGE_SUGGESTS
+PACKAGE_BREAKS
+PACKAGE_REPLACES
+PACKAGE_PROVIDES xbmc-eventclients-wiiremote
+PACKAGE_DESCRIPTION_HEADER @APP_NAME@ Media Center (Wii Remote event client package)
+PACKAGE_DESCRIPTION_FOOTER This is the Wii Remote package for @APP_NAME@'s event client.
diff --git a/cmake/cpack/deb/packages/kodi-eventclients-xbmc-send.txt.in b/cmake/cpack/deb/packages/kodi-eventclients-xbmc-send.txt.in
new file mode 100644
index 0000000000..0062479dd4
--- /dev/null
+++ b/cmake/cpack/deb/packages/kodi-eventclients-xbmc-send.txt.in
@@ -0,0 +1,25 @@
+# kodi-eventclients-xbmc-send debian package metadata
+#
+# Setting PACKAGE_SHLIBDEPS to 'ON' will cause CPack to ignore PACKAGE_DEPENDS
+# content and use dpkg-shlibdeps to automatically generate the package dependency
+# list. Only useful for packages that contain binaries.
+#
+# PACKAGE_ARCHITECTURE should be set to 'all' only if package contains
+# architecture agnostic data. CPack will set proper architecture (amd64/i386/etc)
+# based on build options.
+#
+# Remaining settings are (hopefully) self-explanatory.
+
+PACKAGE_NAME @APP_NAME_LC@-eventclients-xbmc-send
+PACKAGE_ARCHITECTURE all
+PACKAGE_SECTION video
+PACKAGE_PRIORITY optional
+PACKAGE_SHLIBDEPS
+PACKAGE_DEPENDS @APP_NAME_LC@-eventclients-common (= @CPACK_DEBIAN_PACKAGE_VERSION@)
+PACKAGE_RECOMMENDS
+PACKAGE_SUGGESTS
+PACKAGE_BREAKS
+PACKAGE_REPLACES
+PACKAGE_PROVIDES xbmc-eventclients-xbmc-send
+PACKAGE_DESCRIPTION_HEADER @APP_NAME@ Media Center (@APP_NAME@-send event client package)
+PACKAGE_DESCRIPTION_FOOTER This is the Kodi-SEND package for @APP_NAME@'s event client.
diff --git a/cmake/cpack/deb/packages/kodi-inputstream-dev.txt.in b/cmake/cpack/deb/packages/kodi-inputstream-dev.txt.in
new file mode 100644
index 0000000000..3b4c381ab7
--- /dev/null
+++ b/cmake/cpack/deb/packages/kodi-inputstream-dev.txt.in
@@ -0,0 +1,25 @@
+# kodi-inputstream-dev debian package metadata
+#
+# Setting PACKAGE_SHLIBDEPS to 'ON' will cause CPack to ignore PACKAGE_DEPENDS
+# content and use dpkg-shlibdeps to automatically generate the package dependency
+# list. Only useful for packages that contain binaries.
+#
+# PACKAGE_ARCHITECTURE should be set to 'all' only if package contains
+# architecture agnostic data. CPack will set proper architecture (amd64/i386/etc)
+# based on build options.
+#
+# Remaining settings are (hopefully) self-explanatory.
+
+PACKAGE_NAME @APP_NAME_LC@-inputstream-dev
+PACKAGE_ARCHITECTURE all
+PACKAGE_SECTION libdevel
+PACKAGE_PRIORITY optional
+PACKAGE_SHLIBDEPS
+PACKAGE_DEPENDS @APP_NAME_LC@-addon-dev
+PACKAGE_RECOMMENDS
+PACKAGE_SUGGESTS
+PACKAGE_BREAKS
+PACKAGE_REPLACES
+PACKAGE_PROVIDES xbmc-inputstream-dev
+PACKAGE_DESCRIPTION_HEADER @APP_NAME@ Media Center (inputstream add-ons dev package)
+PACKAGE_DESCRIPTION_FOOTER This is the development package for @APP_NAME@'s inputstream add-ons.
diff --git a/cmake/cpack/deb/packages/kodi-peripheral-dev.txt.in b/cmake/cpack/deb/packages/kodi-peripheral-dev.txt.in
new file mode 100644
index 0000000000..1c41c5f5d2
--- /dev/null
+++ b/cmake/cpack/deb/packages/kodi-peripheral-dev.txt.in
@@ -0,0 +1,24 @@
+# kodi-peripheral-dev debian package metadata
+#
+# Setting PACKAGE_SHLIBDEPS to 'ON' will cause CPack to ignore PACKAGE_DEPENDS
+# content and use dpkg-shlibdeps to automatically generate the package dependency
+# list. Only useful for packages that contain binaries.
+#
+# PACKAGE_ARCHITECTURE should be set to 'all' only if package contains
+# architecture agnostic data. CPack will set proper architecture (amd64/i386/etc)
+# based on build options.
+#
+# Remaining settings are (hopefully) self-explanatory.
+
+PACKAGE_NAME @APP_NAME_LC@-peripheral-dev
+PACKAGE_ARCHITECTURE all
+PACKAGE_SECTION libdevel
+PACKAGE_PRIORITY optional
+PACKAGE_SHLIBDEPS
+PACKAGE_DEPENDS @APP_NAME_LC@-addon-dev
+PACKAGE_RECOMMENDS
+PACKAGE_SUGGESTS
+PACKAGE_BREAKS
+PACKAGE_REPLACES
+PACKAGE_DESCRIPTION_HEADER @APP_NAME@ Media Center (peripheral add-ons dev package)
+PACKAGE_DESCRIPTION_FOOTER This is the development package for @APP_NAME@'s peripheral add-ons.
diff --git a/cmake/cpack/deb/packages/kodi-pvr-dev.txt.in b/cmake/cpack/deb/packages/kodi-pvr-dev.txt.in
new file mode 100644
index 0000000000..90e4a1400a
--- /dev/null
+++ b/cmake/cpack/deb/packages/kodi-pvr-dev.txt.in
@@ -0,0 +1,25 @@
+# kodi-pvr-dev debian package metadata
+#
+# Setting PACKAGE_SHLIBDEPS to 'ON' will cause CPack to ignore PACKAGE_DEPENDS
+# content and use dpkg-shlibdeps to automatically generate the package dependency
+# list. Only useful for packages that contain binaries.
+#
+# PACKAGE_ARCHITECTURE should be set to 'all' only if package contains
+# architecture agnostic data. CPack will set proper architecture (amd64/i386/etc)
+# based on build options.
+#
+# Remaining settings are (hopefully) self-explanatory.
+
+PACKAGE_NAME @APP_NAME_LC@-pvr-dev
+PACKAGE_ARCHITECTURE all
+PACKAGE_SECTION libdevel
+PACKAGE_PRIORITY optional
+PACKAGE_SHLIBDEPS
+PACKAGE_DEPENDS @APP_NAME_LC@-addon-dev
+PACKAGE_RECOMMENDS
+PACKAGE_SUGGESTS
+PACKAGE_BREAKS
+PACKAGE_REPLACES
+PACKAGE_PROVIDES xbmc-pvr-dev
+PACKAGE_DESCRIPTION_HEADER @APP_NAME@ Media Center (PVR add-ons dev package)
+PACKAGE_DESCRIPTION_FOOTER This is the development package for @APP_NAME@'s PVR add-ons.
diff --git a/cmake/cpack/deb/packages/kodi-screensaver-dev.txt.in b/cmake/cpack/deb/packages/kodi-screensaver-dev.txt.in
new file mode 100644
index 0000000000..877c3ab290
--- /dev/null
+++ b/cmake/cpack/deb/packages/kodi-screensaver-dev.txt.in
@@ -0,0 +1,25 @@
+# kodi-screensaver-dev debian package metadata
+#
+# Setting PACKAGE_SHLIBDEPS to 'ON' will cause CPack to ignore PACKAGE_DEPENDS
+# content and use dpkg-shlibdeps to automatically generate the package dependency
+# list. Only useful for packages that contain binaries.
+#
+# PACKAGE_ARCHITECTURE should be set to 'all' only if package contains
+# architecture agnostic data. CPack will set proper architecture (amd64/i386/etc)
+# based on build options.
+#
+# Remaining settings are (hopefully) self-explanatory.
+
+PACKAGE_NAME @APP_NAME_LC@-screensaver-dev
+PACKAGE_ARCHITECTURE all
+PACKAGE_SECTION libdevel
+PACKAGE_PRIORITY optional
+PACKAGE_SHLIBDEPS
+PACKAGE_DEPENDS @APP_NAME_LC@-addon-dev
+PACKAGE_RECOMMENDS
+PACKAGE_SUGGESTS
+PACKAGE_BREAKS
+PACKAGE_REPLACES
+PACKAGE_PROVIDES xbmc-screensaver-dev
+PACKAGE_DESCRIPTION_HEADER @APP_NAME@ Media Center (screensaver add-ons dev package)
+PACKAGE_DESCRIPTION_FOOTER This is the development package for @APP_NAME@'s screensaver add-ons.
diff --git a/cmake/cpack/deb/packages/kodi-tools-texturepacker.txt.in b/cmake/cpack/deb/packages/kodi-tools-texturepacker.txt.in
new file mode 100644
index 0000000000..c5c5f8d296
--- /dev/null
+++ b/cmake/cpack/deb/packages/kodi-tools-texturepacker.txt.in
@@ -0,0 +1,25 @@
+# kodi-tools-texturepacker debian package metadata
+#
+# Setting PACKAGE_SHLIBDEPS to 'ON' will cause CPack to ignore PACKAGE_DEPENDS
+# content and use dpkg-shlibdeps to automatically generate the package dependency
+# list. Only useful for packages that contain binaries.
+#
+# PACKAGE_ARCHITECTURE should be set to 'all' only if package contains
+# architecture agnostic data. CPack will set proper architecture (amd64/i386/etc)
+# based on build options.
+#
+# Remaining settings are (hopefully) self-explanatory.
+
+PACKAGE_NAME @APP_NAME_LC@-tools-texturepacker
+PACKAGE_ARCHITECTURE
+PACKAGE_SECTION video
+PACKAGE_PRIORITY optional
+PACKAGE_SHLIBDEPS
+PACKAGE_DEPENDS
+PACKAGE_RECOMMENDS
+PACKAGE_SUGGESTS
+PACKAGE_BREAKS
+PACKAGE_REPLACES
+PACKAGE_PROVIDES
+PACKAGE_DESCRIPTION_HEADER @APP_NAME@ Media Center (skin development - TexturePacker tool)
+PACKAGE_DESCRIPTION_FOOTER This is @APP_NAME@'s TexturePacker tool for skin development.
diff --git a/cmake/cpack/deb/packages/kodi-visualization-dev.txt.in b/cmake/cpack/deb/packages/kodi-visualization-dev.txt.in
new file mode 100644
index 0000000000..ecc543613f
--- /dev/null
+++ b/cmake/cpack/deb/packages/kodi-visualization-dev.txt.in
@@ -0,0 +1,25 @@
+# kodi-visualization-dev debian package metadata
+#
+# Setting PACKAGE_SHLIBDEPS to 'ON' will cause CPack to ignore PACKAGE_DEPENDS
+# content and use dpkg-shlibdeps to automatically generate the package dependency
+# list. Only useful for packages that contain binaries.
+#
+# PACKAGE_ARCHITECTURE should be set to 'all' only if package contains
+# architecture agnostic data. CPack will set proper architecture (amd64/i386/etc)
+# based on build options.
+#
+# Remaining settings are (hopefully) self-explanatory.
+
+PACKAGE_NAME @APP_NAME_LC@-visualization-dev
+PACKAGE_ARCHITECTURE all
+PACKAGE_SECTION libdevel
+PACKAGE_PRIORITY optional
+PACKAGE_SHLIBDEPS
+PACKAGE_DEPENDS @APP_NAME_LC@-addon-dev
+PACKAGE_RECOMMENDS
+PACKAGE_SUGGESTS
+PACKAGE_BREAKS
+PACKAGE_REPLACES
+PACKAGE_PROVIDES xbmc-visualization-dev
+PACKAGE_DESCRIPTION_HEADER @APP_NAME@ Media Center (visualization add-ons dev package)
+PACKAGE_DESCRIPTION_FOOTER This is the development package for @APP_NAME@'s visualization add-ons.
diff --git a/cmake/cpack/deb/packages/kodi.txt.in b/cmake/cpack/deb/packages/kodi.txt.in
new file mode 100644
index 0000000000..4ca417b700
--- /dev/null
+++ b/cmake/cpack/deb/packages/kodi.txt.in
@@ -0,0 +1,25 @@
+# kodi debian package metadata
+#
+# Setting PACKAGE_SHLIBDEPS to 'ON' will cause CPack to ignore PACKAGE_DEPENDS
+# content and use dpkg-shlibdeps to automatically generate the package dependency
+# list. Only useful for packages that contain binaries.
+#
+# PACKAGE_ARCHITECTURE should be set to 'all' only if package contains
+# architecture agnostic data. CPack will set proper architecture (amd64/i386/etc)
+# based on build options.
+#
+# Remaining settings are (hopefully) self-explanatory.
+
+PACKAGE_NAME @APP_NAME_LC@
+PACKAGE_ARCHITECTURE all
+PACKAGE_SECTION video
+PACKAGE_PRIORITY optional
+PACKAGE_SHLIBDEPS
+PACKAGE_DEPENDS @APP_NAME_LC@-bin (>= @CPACK_DEBIAN_PACKAGE_VERSION@), @APP_NAME_LC@-bin (<< @CPACK_DEBIAN_PACKAGE_VERSION@.1~), curl, libcurl3, mesa-utils, x11-utils, fonts-liberation | ttf-liberation, fonts-dejavu-core | ttf-dejavu-core, python-bluez | python-lightblue, python-imaging, python-simplejson, libass5 | libass4, libgif5 | libgif7, libssh-4 | libssh2-1, libnfs8 | libnfs4 | libnfs1, libbluray1, libshairplay0, libvorbisfile3, libaacs0, libcec4, libgnutls30 | libgnutls-deb0-28 | libgnutls28 | libgnutls26, libxslt1.1, libyajl2
+PACKAGE_RECOMMENDS libvdpau1, libva-intel-vaapi-driver, libva1
+PACKAGE_SUGGESTS @APP_NAME_LC@-pvr-mythtv, @APP_NAME_LC@-pvr-vuplus, @APP_NAME_LC@-pvr-vdr-vnsi, @APP_NAME_LC@-pvr-njoy, @APP_NAME_LC@-pvr-nextpvr, @APP_NAME_LC@-pvr-mediaportal-tvserver, @APP_NAME_LC@-pvr-tvheadend-hts, @APP_NAME_LC@-pvr-dvbviewer, @APP_NAME_LC@-pvr-argustv, @APP_NAME_LC@-pvr-iptvsimple, @APP_NAME_LC@-audioencoder-vorbis, @APP_NAME_LC@-audioencoder-flac, @APP_NAME_LC@-audioencoder-lame
+PACKAGE_BREAKS xbmc (<< 2:14.0~git20141019), xbmc-data, xbmc-standalone
+PACKAGE_REPLACES xbmc (<< 2:14.0~git20141019), xbmc-data, xbmc-standalone
+PACKAGE_PROVIDES @APP_NAME_LC@-data, @APP_NAME_LC@-skin-estuary, @APP_NAME_LC@-standalone, xbmc, xbmc-data, xbmc-standalone
+PACKAGE_DESCRIPTION_HEADER @APP_NAME@ Media Center (arch-independent data package)
+PACKAGE_DESCRIPTION_FOOTER This package contains @APP_NAME@'s architecture independent data.
diff --git a/cmake/cpack/deb/postinst b/cmake/cpack/deb/postinst
new file mode 100755
index 0000000000..318d280f8b
--- /dev/null
+++ b/cmake/cpack/deb/postinst
@@ -0,0 +1,5 @@
+#!/bin/sh
+set -e
+if [ "$1" = "configure" ] && [ -x "`which update-menus 2>/dev/null`" ]; then
+ update-menus
+fi
diff --git a/cmake/cpack/deb/postrm b/cmake/cpack/deb/postrm
new file mode 100755
index 0000000000..adc11fdec8
--- /dev/null
+++ b/cmake/cpack/deb/postrm
@@ -0,0 +1,3 @@
+#!/bin/sh
+set -e
+if [ -x "`which update-menus 2>/dev/null`" ]; then update-menus ; fi
diff --git a/cmake/installdata/common/addons.txt b/cmake/installdata/common/addons.txt
new file mode 100644
index 0000000000..cd434515fd
--- /dev/null
+++ b/cmake/installdata/common/addons.txt
@@ -0,0 +1,42 @@
+addons/audioencoder.xbmc.builtin.aac/*
+addons/audioencoder.xbmc.builtin.wav/*
+addons/audioencoder.xbmc.builtin.wma/*
+addons/game.controller.default/*
+addons/kodi.adsp/*
+addons/kodi.audiodecoder/*
+addons/kodi.game/*
+addons/kodi.inputstream/*
+addons/kodi.peripheral/*
+addons/kodi.resource/*
+addons/xbmc.addon/metadata.xsd
+addons/xbmc.addon/repository.xsd
+addons/xbmc.audioencoder/*
+addons/xbmc.codec/*
+addons/xbmc.core/*
+addons/xbmc.gui/*
+addons/xbmc.metadata/*
+addons/xbmc.pvr/*
+addons/xbmc.python/*
+addons/xbmc.webinterface/*
+addons/repository.xbmc.org/*
+addons/webinterface.default/*
+addons/screensaver.xbmc.builtin.dim/*
+addons/screensaver.xbmc.builtin.black/*
+addons/script.module.pil/*
+addons/script.module.pysqlite/*
+addons/resource.language.en_gb/*
+addons/resource.uisounds.kodi/*
+addons/resource.images.weathericons.default/*
+addons/service.xbmc.versioncheck/*
+addons/metadata.local/*
+addons/metadata.album.universal/*
+addons/metadata.artists.universal/*
+addons/metadata.common.allmusic.com/*
+addons/metadata.common.fanart.tv/*
+addons/metadata.common.htbackdrops.com/*
+addons/metadata.common.imdb.com/*
+addons/metadata.common.musicbrainz.org/*
+addons/metadata.common.theaudiodb.com/*
+addons/metadata.common.themoviedb.org/*
+addons/metadata.themoviedb.org/*
+addons/metadata.tvdb.com/*
diff --git a/cmake/installdata/common/common.txt b/cmake/installdata/common/common.txt
new file mode 100644
index 0000000000..c1e52f0ee5
--- /dev/null
+++ b/cmake/installdata/common/common.txt
@@ -0,0 +1,13 @@
+media/*
+sounds/*
+system/keymaps/*
+system/library/*
+system/players/VideoPlayer/etc/*
+system/shaders/*
+system/settings/*
+userdata/*
+system/addon-manifest.xml
+system/colors.xml
+system/peripherals.xml
+system/playercorefactory.xml
+system/keyboardlayouts/*
diff --git a/cmake/installdata/ios/certificates.txt b/cmake/installdata/ios/certificates.txt
new file mode 100644
index 0000000000..14e74a7536
--- /dev/null
+++ b/cmake/installdata/ios/certificates.txt
@@ -0,0 +1 @@
+tools/depends/target/openssl/cacert.pem system/certs \ No newline at end of file
diff --git a/cmake/installdata/ios/packaging.txt b/cmake/installdata/ios/packaging.txt
new file mode 100644
index 0000000000..ce990b5bb7
--- /dev/null
+++ b/cmake/installdata/ios/packaging.txt
@@ -0,0 +1,3 @@
+LICENSE.gpl
+privacy-policy.txt
+xbmc/platform/darwin/Credits.html
diff --git a/cmake/installdata/ios/runtime.txt b/cmake/installdata/ios/runtime.txt
new file mode 100644
index 0000000000..3bb546754e
--- /dev/null
+++ b/cmake/installdata/ios/runtime.txt
@@ -0,0 +1,2 @@
+tools/darwin/runtime/preflight
+tools/darwin/runtime/org.xbmc.helper.plist
diff --git a/cmake/installdata/linux/lirc.txt b/cmake/installdata/linux/lirc.txt
new file mode 100644
index 0000000000..1b48478e14
--- /dev/null
+++ b/cmake/installdata/linux/lirc.txt
@@ -0,0 +1 @@
+system/Lircmap.xml
diff --git a/cmake/installdata/osx/certificates.txt b/cmake/installdata/osx/certificates.txt
new file mode 100644
index 0000000000..14e74a7536
--- /dev/null
+++ b/cmake/installdata/osx/certificates.txt
@@ -0,0 +1 @@
+tools/depends/target/openssl/cacert.pem system/certs \ No newline at end of file
diff --git a/cmake/installdata/osx/packaging.txt b/cmake/installdata/osx/packaging.txt
new file mode 100644
index 0000000000..f869e4c146
--- /dev/null
+++ b/cmake/installdata/osx/packaging.txt
@@ -0,0 +1,4 @@
+LICENSE.gpl
+privacy-policy.txt
+xbmc/platform/darwin/Credits.html
+tools/darwin/packaging/media/osx/icon.iconset/*
diff --git a/cmake/installdata/osx/runtime.txt b/cmake/installdata/osx/runtime.txt
new file mode 100644
index 0000000000..3bb546754e
--- /dev/null
+++ b/cmake/installdata/osx/runtime.txt
@@ -0,0 +1,2 @@
+tools/darwin/runtime/preflight
+tools/darwin/runtime/org.xbmc.helper.plist
diff --git a/cmake/installdata/rbpi/lirc.txt b/cmake/installdata/rbpi/lirc.txt
new file mode 120000
index 0000000000..e89ae50094
--- /dev/null
+++ b/cmake/installdata/rbpi/lirc.txt
@@ -0,0 +1 @@
+../linux/lirc.txt \ No newline at end of file
diff --git a/cmake/installdata/test-reference-data.txt b/cmake/installdata/test-reference-data.txt
new file mode 100644
index 0000000000..895079a05a
--- /dev/null
+++ b/cmake/installdata/test-reference-data.txt
@@ -0,0 +1,10 @@
+xbmc/utils/test/CXBMCTinyXML-test.xml
+xbmc/utils/test/data/language/Spanish/strings.po
+xbmc/filesystem/test/reffile.txt
+xbmc/filesystem/test/reffile.txt.rar
+xbmc/filesystem/test/reffile.txt.zip
+xbmc/filesystem/test/refRARnormal.rar
+xbmc/filesystem/test/refRARstored.rar
+xbmc/network/test/data/test.html
+xbmc/network/test/data/test.png
+xbmc/network/test/data/test-ranges.txt
diff --git a/cmake/installdata/windows/addons.txt b/cmake/installdata/windows/addons.txt
new file mode 100644
index 0000000000..92bf9b3ca6
--- /dev/null
+++ b/cmake/installdata/windows/addons.txt
@@ -0,0 +1 @@
+addons/repository.pvr-win32.xbmc.org/*
diff --git a/cmake/installdata/windows/dlls.txt b/cmake/installdata/windows/dlls.txt
new file mode 100644
index 0000000000..64d9756a59
--- /dev/null
+++ b/cmake/installdata/windows/dlls.txt
@@ -0,0 +1,2 @@
+system/*.dll .
+project/Win32BuildSetup/dependencies/python27.dll . \ No newline at end of file
diff --git a/cmake/installdata/windows/irss.txt b/cmake/installdata/windows/irss.txt
new file mode 100644
index 0000000000..6fd8d484e7
--- /dev/null
+++ b/cmake/installdata/windows/irss.txt
@@ -0,0 +1,2 @@
+system/IRSSmap.xml
+system/X10-Lola-IRSSmap.xml
diff --git a/cmake/installdata/windows/python.txt b/cmake/installdata/windows/python.txt
new file mode 100644
index 0000000000..b8053187cf
--- /dev/null
+++ b/cmake/installdata/windows/python.txt
@@ -0,0 +1 @@
+system/python/* \ No newline at end of file
diff --git a/cmake/modules/FindAML.cmake b/cmake/modules/FindAML.cmake
new file mode 100644
index 0000000000..5b9a859ead
--- /dev/null
+++ b/cmake/modules/FindAML.cmake
@@ -0,0 +1,35 @@
+#.rst:
+# FindAML
+# -------
+# Finds the AML codec
+#
+# This will will define the following variables::
+#
+# AML_FOUND - system has AML
+# AML_INCLUDE_DIRS - the AML include directory
+# AML_DEFINITIONS - the AML definitions
+#
+# and the following imported targets::
+#
+# AML::AML - The AML codec
+
+find_path(AML_INCLUDE_DIR codec_error.h
+ PATH_SUFFIXES amcodec)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(AML
+ REQUIRED_VARS AML_INCLUDE_DIR)
+
+if(AML_FOUND)
+ set(AML_INCLUDE_DIRS ${AML_INCLUDE_DIR})
+ set(AML_DEFINITIONS -DHAS_LIBAMCODEC=1)
+
+ if(NOT TARGET AML::AML)
+ add_library(AML::AML UNKNOWN IMPORTED)
+ set_target_properties(AML::AML PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${AML_INCLUDE_DIR}"
+ INTERFACE_COMPILE_DEFINITIONS HAS_LIBAMCODEC=1)
+ endif()
+endif()
+
+mark_as_advanced(AMLCODEC_INCLUDE_DIR)
diff --git a/cmake/modules/FindASS.cmake b/cmake/modules/FindASS.cmake
new file mode 100644
index 0000000000..2d592fad15
--- /dev/null
+++ b/cmake/modules/FindASS.cmake
@@ -0,0 +1,44 @@
+#.rst:
+# FindASS
+# -------
+# Finds the ASS library
+#
+# This will will define the following variables::
+#
+# ASS_FOUND - system has ASS
+# ASS_INCLUDE_DIRS - the ASS include directory
+# ASS_LIBRARIES - the ASS libraries
+#
+# and the following imported targets::
+#
+# ASS::ASS - The ASS library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_ASS libass QUIET)
+endif()
+
+find_path(ASS_INCLUDE_DIR NAMES ass/ass.h
+ PATHS ${PC_ASS_INCLUDEDIR})
+find_library(ASS_LIBRARY NAMES ass libass
+ PATHS ${PC_ASS_LIBDIR})
+
+set(ASS_VERSION ${PC_ASS_VERSION})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(ASS
+ REQUIRED_VARS ASS_LIBRARY ASS_INCLUDE_DIR
+ VERSION_VAR ASS_VERSION)
+
+if(ASS_FOUND)
+ set(ASS_LIBRARIES ${ASS_LIBRARY})
+ set(ASS_INCLUDE_DIRS ${ASS_INCLUDE_DIR})
+
+ if(NOT TARGET ASS::ASS)
+ add_library(ASS::ASS UNKNOWN IMPORTED)
+ set_target_properties(ASS::ASS PROPERTIES
+ IMPORTED_LOCATION "${ASS_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${ASS_INCLUDE_DIR}")
+ endif()
+endif()
+
+mark_as_advanced(ASS_INCLUDE_DIR ASS_LIBRARY)
diff --git a/cmake/modules/FindAlsa.cmake b/cmake/modules/FindAlsa.cmake
new file mode 100644
index 0000000000..a2822431f8
--- /dev/null
+++ b/cmake/modules/FindAlsa.cmake
@@ -0,0 +1,46 @@
+#.rst:
+# FindAlsa
+# --------
+# Finds the Alsa library
+#
+# This will will define the following variables::
+#
+# ALSA_FOUND - system has Alsa
+# ALSA_INCLUDE_DIRS - the Alsa include directory
+# ALSA_LIBRARIES - the Alsa libraries
+# ALSA_DEFINITIONS - the Alsa compile definitions
+#
+# and the following imported targets::
+#
+# ALSA::ALSA - The Alsa library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_ALSA alsa QUIET)
+endif()
+
+find_path(ALSA_INCLUDE_DIR NAMES alsa/asoundlib.h
+ PATHS ${PC_ALSA_INCLUDEDIR})
+find_library(ALSA_LIBRARY NAMES asound
+ PATHS ${PC_ALSA_LIBDIR})
+
+set(ALSA_VERSION ${PC_ALSA_VERSION})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(ALSA
+ REQUIRED_VARS ALSA_LIBRARY ALSA_INCLUDE_DIR
+ VERSION_VAR ALSA_VERSION)
+
+if(ALSA_FOUND)
+ set(ALSA_INCLUDE_DIRS "") # Don't want these added as 'timer.h' is a dangerous file
+ set(ALSA_LIBRARIES ${ALSA_LIBRARY})
+ set(ALSA_DEFINITIONS -DHAVE_ALSA=1 -DUSE_ALSA=1)
+
+ if(NOT TARGET ALSA::ALSA)
+ add_library(ALSA::ALSA UNKNOWN IMPORTED)
+ set_target_properties(ALSA::ALSA PROPERTIES
+ IMPORTED_LOCATION "${ALSA_LIBRARY}"
+ INTERFACE_COMPILE_DEFINITIONS "${ALSA_DEFINITIONS}")
+ endif()
+endif()
+
+mark_as_advanced(ALSA_INCLUDE_DIR ALSA_LIBRARY)
diff --git a/cmake/modules/FindAvahi.cmake b/cmake/modules/FindAvahi.cmake
new file mode 100644
index 0000000000..77c3e4d67a
--- /dev/null
+++ b/cmake/modules/FindAvahi.cmake
@@ -0,0 +1,63 @@
+#.rst:
+# FindAvahi
+# ---------
+# Finds the avahi library
+#
+# This will will define the following variables::
+#
+# AVAHI_FOUND - system has avahi
+# AVAHI_INCLUDE_DIRS - the avahi include directory
+# AVAHI_LIBRARIES - the avahi libraries
+# AVAHI_DEFINITIONS - the avahi definitions
+#
+# and the following imported targets::
+#
+# Avahi::Avahi - The avahi library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_AVAHI avahi-client QUIET)
+endif()
+
+find_path(AVAHI_CLIENT_INCLUDE_DIR NAMES avahi-client/client.h
+ PATHS ${PC_AVAHI_INCLUDEDIR})
+find_path(AVAHI_COMMON_INCLUDE_DIR NAMES avahi-common/defs.h
+ PATHS ${PC_AVAHI_INCLUDEDIR})
+find_library(AVAHI_CLIENT_LIBRARY NAMES avahi-client
+ PATHS ${PC_AVAHI_LIBDIR})
+find_library(AVAHI_COMMON_LIBRARY NAMES avahi-common
+ PATHS ${PC_AVAHI_LIBDIR})
+
+set(AVAHI_VERSION ${PC_AVAHI_VERSION})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Avahi
+ REQUIRED_VARS AVAHI_CLIENT_LIBRARY AVAHI_COMMON_LIBRARY
+ AVAHI_CLIENT_INCLUDE_DIR AVAHI_COMMON_INCLUDE_DIR
+ VERSION_VAR AVAHI_VERSION)
+
+if(AVAHI_FOUND)
+ set(AVAHI_INCLUDE_DIRS ${AVAHI_CLIENT_INCLUDE_DIR}
+ ${AVAHI_COMMON_INCLUDE_DIR})
+ set(AVAHI_LIBRARIES ${AVAHI_CLIENT_LIBRARY}
+ ${AVAHI_COMMON_LIBRARY})
+ set(AVAHI_DEFINITIONS -DHAVE_LIBAVAHI_CLIENT=1 -DHAVE_LIBAVAHI_COMMON=1)
+
+ if(NOT TARGET Avahi::Avahi)
+ add_library(Avahi::Avahi UNKNOWN IMPORTED)
+ set_target_properties(Avahi::Avahi PROPERTIES
+ IMPORTED_LOCATION "${AVAHI_CLIENT_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${AVAHI_CLIENT_INCLUDE_DIR}"
+ INTERFACE_COMPILE_DEFINITIONS HAVE_LIBAVAHI_CLIENT=1)
+ endif()
+ if(NOT TARGET Avahi::AvahiCommon)
+ add_library(Avahi::AvahiCommon UNKNOWN IMPORTED)
+ set_target_properties(Avahi::AvahiCommon PROPERTIES
+ IMPORTED_LOCATION "${AVAHI_COMMON_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${AVAHI_COMMON_INCLUDE_DIR}"
+ INTERFACE_COMPILE_DEFINITIONS HAVE_LIBAVAHI_COMMON=1
+ INTERFACE_LINK_LIBRARIES Avahi::Avahi)
+ endif()
+endif()
+
+mark_as_advanced(AVAHI_CLIENT_INCLUDE_DIR AVAHI_COMMON_INCLUDE_DIR
+ AVAHI_CLIENT_LIBRARY AVAHI_COMMON_LIBRARY)
diff --git a/cmake/modules/FindBluetooth.cmake b/cmake/modules/FindBluetooth.cmake
new file mode 100644
index 0000000000..a69980dc74
--- /dev/null
+++ b/cmake/modules/FindBluetooth.cmake
@@ -0,0 +1,44 @@
+#.rst:
+# FindBluetooth
+# ---------
+# Finds the Bluetooth library
+#
+# This will will define the following variables::
+#
+# BLUETOOTH_FOUND - system has Bluetooth
+# BLUETOOTH_INCLUDE_DIRS - the Bluetooth include directory
+# BLUETOOTH_LIBRARIES - the Bluetooth libraries
+#
+# and the following imported targets::
+#
+# Bluetooth::Bluetooth - The Bluetooth library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_BLUETOOTH bluez bluetooth QUIET)
+endif()
+
+find_path(BLUETOOTH_INCLUDE_DIR NAMES bluetooth/bluetooth.h
+ PATHS ${PC_BLUETOOTH_INCLUDEDIR})
+find_library(BLUETOOTH_LIBRARY NAMES bluetooth libbluetooth
+ PATHS ${PC_BLUETOOTH_LIBDIR})
+
+set(BLUETOOTH_VERSION ${PC_BLUETOOTH_VERSION})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Bluetooth
+ REQUIRED_VARS BLUETOOTH_LIBRARY BLUETOOTH_INCLUDE_DIR
+ VERSION_VAR BLUETOOTH_VERSION)
+
+if(BLUETOOTH_FOUND)
+ set(BLUETOOTH_INCLUDE_DIRS ${BLUETOOTH_INCLUDE_DIR})
+ set(BLUETOOTH_LIBRARIES ${BLUETOOTH_LIBRARY})
+
+ if(NOT TARGET Bluetooth::Bluetooth)
+ add_library(Bluetooth::Bluetooth UNKNOWN IMPORTED)
+ set_target_properties(Bluetooth::Bluetooth PROPERTIES
+ IMPORTED_LOCATION "${BLUETOOTH_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${BLUETOOTH_INCLUDE_DIR}")
+ endif()
+endif()
+
+mark_as_advanced(BLUETOOTH_INCLUDE_DIR BLUETOOTH_LIBRARY)
diff --git a/cmake/modules/FindBluray.cmake b/cmake/modules/FindBluray.cmake
new file mode 100644
index 0000000000..b8422ed207
--- /dev/null
+++ b/cmake/modules/FindBluray.cmake
@@ -0,0 +1,58 @@
+#.rst:
+# FindBluray
+# ----------
+# Finds the libbluray library
+#
+# This will will define the following variables::
+#
+# BLURAY_FOUND - system has libbluray
+# BLURAY_INCLUDE_DIRS - the libbluray include directory
+# BLURAY_LIBRARIES - the libbluray libraries
+# BLURAY_DEFINITIONS - the libbluray compile definitions
+#
+# and the following imported targets::
+#
+# Bluray::Bluray - The libblueray library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_BLURAY libbluray>=0.7.0 QUIET)
+endif()
+
+find_path(BLURAY_INCLUDE_DIR libbluray/bluray.h
+ PATHS ${PC_BLURAY_INCLUDEDIR})
+
+set(BLURAY_VERSION ${PC_BLURAY_VERSION})
+
+include(FindPackageHandleStandardArgs)
+if(NOT WIN32)
+ find_library(BLURAY_LIBRARY NAMES bluray
+ PATHS ${PC_BLURAY_LIBDIR})
+
+ find_package_handle_standard_args(Bluray
+ REQUIRED_VARS BLURAY_LIBRARY BLURAY_INCLUDE_DIR
+ VERSION_VAR BLURAY_VERSION)
+else()
+ # Dynamically loaded DLL
+ find_package_handle_standard_args(Bluray
+ REQUIRED_VARS BLURAY_INCLUDE_DIR
+ VERSION_VAR BLURAY_VERSION)
+endif()
+
+if(BLURAY_FOUND)
+ set(BLURAY_LIBRARIES ${BLURAY_LIBRARY})
+ set(BLURAY_INCLUDE_DIRS ${BLURAY_INCLUDE_DIR})
+ set(BLURAY_DEFINITIONS -DHAVE_LIBBLURAY=1)
+
+ if(NOT TARGET Bluray::Bluray)
+ add_library(Bluray::Bluray UNKNOWN IMPORTED)
+ if(BLURAY_LIBRARY)
+ set_target_properties(Bluray::Bluray PROPERTIES
+ IMPORTED_LOCATION "${BLURAY_LIBRARY}")
+ endif()
+ set_target_properties(Bluray::Bluray PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${BLURAY_INCLUDE_DIR}"
+ INTERFACE_COMPILE_DEFINITIONS HAVE_LIBBLURAY=1)
+ endif()
+endif()
+
+mark_as_advanced(BLURAY_INCLUDE_DIR BLURAY_LIBRARY)
diff --git a/cmake/modules/FindCAP.cmake b/cmake/modules/FindCAP.cmake
new file mode 100644
index 0000000000..04e8378ea4
--- /dev/null
+++ b/cmake/modules/FindCAP.cmake
@@ -0,0 +1,44 @@
+#.rst:
+# FindCAP
+# -----------
+# Finds the POSIX 1003.1e capabilities library
+#
+# This will define the following variables::
+#
+# CAP_FOUND - system has LibCap
+# CAP_INCLUDE_DIRS - the LibCap include directory
+# CAP_LIBRARIES - the LibCap libraries
+#
+# and the following imported targets::
+#
+# CAP::CAP - The LibCap library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_CAP libcap QUIET)
+endif()
+
+find_path(CAP_INCLUDE_DIR NAMES sys/capability.h
+ PATHS ${PC_CAP_INCLUDEDIR})
+find_library(CAP_LIBRARY NAMES cap libcap
+ PATHS ${PC_CAP_LIBDIR})
+
+set(CAP_VERSION ${PC_CAP_VERSION})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(CAP
+ REQUIRED_VARS CAP_LIBRARY CAP_INCLUDE_DIR
+ VERSION_VAR CAP_VERSION)
+
+if(CAP_FOUND)
+ set(CAP_LIBRARIES ${CAP_LIBRARY})
+ set(CAP_INCLUDE_DIRS ${CAP_INCLUDE_DIR})
+
+ if(NOT TARGET CAP::CAP)
+ add_library(CAP::CAP UNKNOWN IMPORTED)
+ set_target_properties(CAP::CAP PROPERTIES
+ IMPORTED_LOCATION "${CAP_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${CAP_INCLUDE_DIR}")
+ endif()
+endif()
+
+mark_as_advanced(CAP_INCLUDE_DIR CAP_LIBRARY)
diff --git a/cmake/modules/FindCCache.cmake b/cmake/modules/FindCCache.cmake
new file mode 100644
index 0000000000..a7fd29faba
--- /dev/null
+++ b/cmake/modules/FindCCache.cmake
@@ -0,0 +1,18 @@
+#.rst:
+# FindCCache
+# ----------
+# Finds ccache and sets it up as compiler wrapper.
+# This should ideally be called before the call to project().
+#
+# See: https://crascit.com/2016/04/09/using-ccache-with-cmake/
+
+find_program(CCACHE_PROGRAM ccache)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(CCACHE REQUIRED_VARS CCACHE_PROGRAM)
+
+if(CCACHE_FOUND)
+ # Supports Unix Makefiles and Ninja
+ set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
+ set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CCACHE_PROGRAM}")
+endif()
diff --git a/cmake/modules/FindCEC.cmake b/cmake/modules/FindCEC.cmake
new file mode 100644
index 0000000000..bd6fd1d2da
--- /dev/null
+++ b/cmake/modules/FindCEC.cmake
@@ -0,0 +1,68 @@
+#.rst:
+# FindCEC
+# -------
+# Finds the libCEC library
+#
+# This will will define the following variables::
+#
+# CEC_FOUND - system has libCEC
+# CEC_INCLUDE_DIRS - the libCEC include directory
+# CEC_LIBRARIES - the libCEC libraries
+# CEC_DEFINITIONS - the libCEC compile definitions
+#
+# and the following imported targets::
+#
+# CEC::CEC - The libCEC library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_CEC libcec QUIET)
+endif()
+
+find_path(CEC_INCLUDE_DIR NAMES libcec/cec.h libCEC/CEC.h
+ PATHS ${PC_CEC_INCLUDEDIR})
+
+if(PC_CEC_VERSION)
+ set(CEC_VERSION ${PC_CEC_VERSION})
+elseif(CEC_INCLUDE_DIR AND EXISTS "${CEC_INCLUDE_DIR}/libcec/version.h")
+ file(STRINGS "${CEC_INCLUDE_DIR}/libcec/version.h" cec_version_str REGEX "^[\t ]+LIBCEC_VERSION_TO_UINT\\(.*\\)")
+ string(REGEX REPLACE "^[\t ]+LIBCEC_VERSION_TO_UINT\\(([0-9]+), ([0-9]+), ([0-9]+)\\)" "\\1.\\2.\\3" CEC_VERSION "${cec_version_str}")
+ unset(cec_version_str)
+endif()
+
+if(NOT CEC_FIND_VERSION)
+ set(CEC_FIND_VERSION 4.0.0)
+endif()
+
+include(FindPackageHandleStandardArgs)
+if(NOT WIN32)
+ find_library(CEC_LIBRARY NAMES cec
+ PATHS ${PC_CEC_LIBDIR})
+
+ find_package_handle_standard_args(CEC
+ REQUIRED_VARS CEC_LIBRARY CEC_INCLUDE_DIR
+ VERSION_VAR CEC_VERSION)
+else()
+ # Dynamically loaded DLL
+ find_package_handle_standard_args(CEC
+ REQUIRED_VARS CEC_INCLUDE_DIR
+ VERSION_VAR CEC_VERSION)
+endif()
+
+if(CEC_FOUND)
+ set(CEC_LIBRARIES ${CEC_LIBRARY})
+ set(CEC_INCLUDE_DIRS ${CEC_INCLUDE_DIR})
+ set(CEC_DEFINITIONS -DHAVE_LIBCEC=1)
+
+ if(NOT TARGET CEC::CEC)
+ add_library(CEC::CEC UNKNOWN IMPORTED)
+ if(CEC_LIBRARY)
+ set_target_properties(CEC::CEC PROPERTIES
+ IMPORTED_LOCATION "${CEC_LIBRARY}")
+ endif()
+ set_target_properties(CEC::CEC PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${CEC_INCLUDE_DIR}"
+ INTERFACE_COMPILE_DEFINITIONS HAVE_LIBCEC=1)
+ endif()
+endif()
+
+mark_as_advanced(CEC_INCLUDE_DIR CEC_LIBRARY)
diff --git a/cmake/modules/FindCWiid.cmake b/cmake/modules/FindCWiid.cmake
new file mode 100644
index 0000000000..88cfbef038
--- /dev/null
+++ b/cmake/modules/FindCWiid.cmake
@@ -0,0 +1,44 @@
+#.rst:
+# FindCWiid
+# ---------
+# Finds the CWiid library
+#
+# This will will define the following variables::
+#
+# CWIID_FOUND - system has CWiid
+# CWIID_INCLUDE_DIRS - the CWiid include directory
+# CWIID_LIBRARIES - the CWiid libraries
+#
+# and the following imported targets::
+#
+# CWiid::CWiid - The CWiid library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_CWIID cwiid QUIET)
+endif()
+
+find_path(CWIID_INCLUDE_DIR NAMES cwiid.h
+ PATHS ${PC_CWIID_INCLUDEDIR})
+find_library(CWIID_LIBRARY NAMES cwiid
+ PATHS ${PC_CWIID_LIBDIR})
+
+set(CWIID_VERSION ${PC_CWIID_VERSION})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(CWIID
+ REQUIRED_VARS CWIID_LIBRARY CWIID_INCLUDE_DIR
+ VERSION_VAR CWIID_VERSION)
+
+if(CWIID_FOUND)
+ set(CWIID_INCLUDE_DIRS ${CWIID_INCLUDE_DIR})
+ set(CWIID_LIBRARIES ${CWIID_LIBRARY})
+
+ if(NOT TARGET CWiid::CWiid)
+ add_library(CWiid::CWiid UNKNOWN IMPORTED)
+ set_target_properties(CWiid::CWiid PROPERTIES
+ IMPORTED_LOCATION "${CWIID_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${CWIID_INCLUDE_DIR}")
+ endif()
+endif()
+
+mark_as_advanced(CWIID_INCLUDE_DIR CWIID_LIBRARY)
diff --git a/cmake/modules/FindCXX11.cmake b/cmake/modules/FindCXX11.cmake
new file mode 100644
index 0000000000..c0b9a52d20
--- /dev/null
+++ b/cmake/modules/FindCXX11.cmake
@@ -0,0 +1,18 @@
+include(TestCXXAcceptsFlag)
+
+# try to use compiler flag -std=c++11
+check_cxx_accepts_flag("-std=c++11" CXX_FLAG_CXX11)
+if(CXX_FLAG_CXX11)
+ add_options (CXX ALL_BUILDS "-std=c++11")
+ set(CXX_STD11_FLAGS "-std=c++11")
+else()
+ # try to use compiler flag -std=c++0x for older compilers
+ check_cxx_accepts_flag("-std=c++0x" CXX_FLAG_CXX0X)
+ if(CXX_FLAG_CXX0X)
+ add_options (CXX ALL_BUILDS "-std=c++0x")
+ set(CXX_STD11_FLAGS "-std=c++0x")
+ endif()
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(CXX11 DEFAULT_MSG CXX_STD11_FLAGS)
diff --git a/cmake/modules/FindCdio.cmake b/cmake/modules/FindCdio.cmake
new file mode 100644
index 0000000000..aa089c26e6
--- /dev/null
+++ b/cmake/modules/FindCdio.cmake
@@ -0,0 +1,45 @@
+#.rst:
+# FindCdio
+# --------
+# Finds the cdio library
+#
+# This will will define the following variables::
+#
+# CDIO_FOUND - system has cdio
+# CDIO_INCLUDE_DIRS - the cdio include directory
+# CDIO_LIBRARIES - the cdio libraries
+#
+# and the following imported targets::
+#
+# CDIO::CDIO - The cdio library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_CDIO libcdio libiso9660 QUIET)
+endif()
+
+find_path(CDIO_INCLUDE_DIR NAMES cdio/cdio.h
+ PATHS ${PC_CDIO_libcdio_INCLUDEDIR}
+ ${PC_CDIO_libiso9660_INCLUDEDIR})
+find_library(CDIO_LIBRARY NAMES cdio
+ PATHS ${CDIO_libcdio_LIBDIR} ${CDIO_libiso9660_LIBDIR})
+
+set(CDIO_VERSION ${PC_CDIO_libcdio_VERSION})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(CDIO
+ REQUIRED_VARS CDIO_LIBRARY CDIO_INCLUDE_DIR
+ VERSION_VAR CDIO_VERSION)
+
+if(CDIO_FOUND)
+ set(CDIO_LIBRARIES ${CDIO_LIBRARY})
+ set(CDIO_INCLUDE_DIRS ${CDIO_INCLUDE_DIR})
+
+ if(NOT TARGET CDIO::CDIO)
+ add_library(CDIO::CDIO UNKNOWN IMPORTED)
+ set_target_properties(CDIO::CDIO PROPERTIES
+ IMPORTED_LOCATION "${CDIO_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${CDIO_INCLUDE_DIR}")
+ endif()
+endif()
+
+mark_as_advanced(CDIO_INCLUDE_DIR CDIO_LIBRARY)
diff --git a/cmake/modules/FindCpluff.cmake b/cmake/modules/FindCpluff.cmake
new file mode 100644
index 0000000000..ce6c127cb5
--- /dev/null
+++ b/cmake/modules/FindCpluff.cmake
@@ -0,0 +1,61 @@
+# - Builds Cpluff as external project
+# Once done this will define
+#
+# CPLUFF_FOUND - system has cpluff
+# CPLUFF_INCLUDE_DIRS - the cpluff include directories
+#
+# and link Kodi against the cpluff libraries.
+
+if(NOT WIN32)
+ string(REPLACE ";" " " defines "${CMAKE_C_FLAGS} ${SYSTEM_DEFINES} -I${EXPAT_INCLUDE_DIR}")
+ get_filename_component(expat_dir ${EXPAT_LIBRARY} DIRECTORY)
+ set(ldflags "-L${expat_dir}")
+
+ # iOS: Without specifying -arch, configure tries to use /bin/cpp as C-preprocessor
+ # http://stackoverflow.com/questions/38836754/cant-cross-compile-c-library-for-arm-ios
+ if(CORE_SYSTEM_NAME STREQUAL ios)
+ set(cppflags "-arch ${CPU}")
+ endif()
+
+ ExternalProject_Add(libcpluff SOURCE_DIR ${CORE_SOURCE_DIR}/lib/cpluff
+ BUILD_IN_SOURCE 1
+ PREFIX ${CORE_BUILD_DIR}/cpluff
+ CONFIGURE_COMMAND CC=${CMAKE_C_COMPILER} ${CORE_SOURCE_DIR}/lib/cpluff/configure
+ --disable-nls
+ --enable-static
+ --disable-shared
+ --with-pic
+ --prefix=<INSTALL_DIR>
+ --libdir=<INSTALL_DIR>/lib
+ --host=${ARCH}
+ CFLAGS=${defines}
+ CPPFLAGS=${cppflags}
+ LDFLAGS=${ldflags})
+ ExternalProject_Add_Step(libcpluff autoreconf
+ DEPENDEES download update patch
+ DEPENDERS configure
+ COMMAND rm -f config.status
+ COMMAND PATH=${NATIVEPREFIX}/bin:$ENV{PATH} autoreconf -vif
+ WORKING_DIRECTORY <SOURCE_DIR>)
+
+ set(ldflags "${ldflags};-lexpat")
+ core_link_library(${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cpluff/lib/libcpluff.a
+ system/libcpluff libcpluff extras "${ldflags}")
+ set(CPLUFF_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cpluff/include)
+ set(CPLUFF_FOUND 1)
+ mark_as_advanced(CPLUFF_INCLUDE_DIRS CPLUFF_FOUND)
+else()
+ find_path(CPLUFF_INCLUDE_DIR cpluff.h)
+
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(CPLUFF
+ REQUIRED_VARS CPLUFF_INCLUDE_DIR)
+
+ if(CPLUFF_FOUND)
+ set(CPLUFF_INCLUDE_DIRS ${CPLUFF_INCLUDE_DIR})
+ endif()
+ mark_as_advanced(CPLUFF_INCLUDE_DIRS CPLUFF_FOUND)
+
+ add_custom_target(libcpluff)
+endif()
+set_target_properties(libcpluff PROPERTIES FOLDER "External Projects")
diff --git a/cmake/modules/FindCrossGUID.cmake b/cmake/modules/FindCrossGUID.cmake
new file mode 100644
index 0000000000..ba2823a7ae
--- /dev/null
+++ b/cmake/modules/FindCrossGUID.cmake
@@ -0,0 +1,78 @@
+if(ENABLE_INTERNAL_CROSSGUID)
+ include(ExternalProject)
+ file(STRINGS ${CORE_SOURCE_DIR}/tools/depends/target/crossguid/Makefile VER)
+ string(REGEX MATCH "VERSION=[^ ]*" CGUID_VER "${VER}")
+ list(GET CGUID_VER 0 CGUID_VER)
+ string(SUBSTRING "${CGUID_VER}" 8 -1 CGUID_VER)
+
+ # allow user to override the download URL with a local tarball
+ # needed for offline build envs
+ if(CROSSGUID_URL)
+ get_filename_component(CROSSGUID_URL "${CROSSGUID_URL}" ABSOLUTE)
+ else()
+ set(CROSSGUID_URL http://mirrors.kodi.tv/build-deps/sources/crossguid-${CGUID_VER}.tar.gz)
+ endif()
+ if(VERBOSE)
+ message(STATUS "CROSSGUID_URL: ${CROSSGUID_URL}")
+ endif()
+
+ if(APPLE)
+ set(EXTRA_ARGS "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}")
+ endif()
+
+ set(CROSSGUID_LIBRARY ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/libcrossguid.a)
+ set(CROSSGUID_INCLUDE_DIR ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/include)
+ externalproject_add(crossguid
+ URL ${CROSSGUID_URL}
+ DOWNLOAD_DIR ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/download
+ PREFIX ${CORE_BUILD_DIR}/crossguid
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}
+ -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
+ "${EXTRA_ARGS}"
+ PATCH_COMMAND ${CMAKE_COMMAND} -E copy
+ ${CORE_SOURCE_DIR}/tools/depends/target/crossguid/CMakeLists.txt
+ <SOURCE_DIR> &&
+ ${CMAKE_COMMAND} -E copy
+ ${CORE_SOURCE_DIR}/tools/depends/target/crossguid/FindUUID.cmake
+ <SOURCE_DIR> &&
+ ${CMAKE_COMMAND} -E copy
+ ${CORE_SOURCE_DIR}/tools/depends/target/crossguid/FindCXX11.cmake
+ <SOURCE_DIR>
+ BUILD_BYPRODUCTS ${CROSSGUID_LIBRARY})
+ set_target_properties(crossguid PROPERTIES FOLDER "External Projects")
+
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(CrossGuid
+ REQUIRED_VARS CROSSGUID_LIBRARY CROSSGUID_INCLUDE_DIR
+ VERSION_VAR CGUID_VER)
+
+ set(CROSSGUID_LIBRARIES ${CROSSGUID_LIBRARY})
+ set(CROSSGUID_INCLUDE_DIRS ${CROSSGUID_INCLUDE_DIR})
+else()
+ find_path(CROSSGUID_INCLUDE_DIR NAMES guid.h)
+
+ find_library(CROSSGUID_LIBRARY_RELEASE NAMES crossguid)
+ find_library(CROSSGUID_LIBRARY_DEBUG NAMES crossguidd)
+
+ include(SelectLibraryConfigurations)
+ select_library_configurations(CROSSGUID)
+
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(CrossGuid
+ REQUIRED_VARS CROSSGUID_LIBRARY CROSSGUID_INCLUDE_DIR)
+
+ if(CROSSGUID_FOUND)
+ set(CROSSGUID_LIBRARIES ${CROSSGUID_LIBRARY})
+ set(CROSSGUID_INCLUDE_DIRS ${CROSSGUID_INCLUDE_DIR})
+
+ add_custom_target(crossguid)
+ set_target_properties(crossguid PROPERTIES FOLDER "External Projects")
+ endif()
+ mark_as_advanced(CROSSGUID_INCLUDE_DIR CROSSGUID_LIBRARY)
+endif()
+
+if(NOT WIN32 AND NOT APPLE)
+ find_package(UUID REQUIRED)
+ list(APPEND CROSSGUID_INCLUDE_DIRS ${UUID_INCLUDE_DIRS})
+ list(APPEND CROSSGUID_LIBRARIES ${UUID_LIBRARIES})
+endif()
diff --git a/cmake/modules/FindCurl.cmake b/cmake/modules/FindCurl.cmake
new file mode 100644
index 0000000000..ed4d81f387
--- /dev/null
+++ b/cmake/modules/FindCurl.cmake
@@ -0,0 +1,83 @@
+#.rst:
+# FindCurl
+# --------
+# Finds the Curl library
+#
+# This will will define the following variables::
+#
+# CURL_FOUND - system has Curl
+# CURL_INCLUDE_DIRS - the Curl include directory
+# CURL_LIBRARIES - the Curl libraries
+# CURL_DEFINITIONS - the Curl definitions
+#
+# and the following imported targets::
+#
+# Curl::Curl - The Curl library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_CURL libcurl QUIET)
+endif()
+
+find_path(CURL_INCLUDE_DIR NAMES curl/curl.h
+ PATHS ${PC_CURL_INCLUDEDIR})
+find_library(CURL_LIBRARY NAMES curl libcurl
+ PATHS ${PC_CURL_LIBDIR})
+
+set(CURL_VERSION ${PC_CURL_VERSION})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Curl
+ REQUIRED_VARS CURL_LIBRARY CURL_INCLUDE_DIR
+ VERSION_VAR CURL_VERSION)
+
+if(CURL_FOUND)
+ set(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIR})
+ set(CURL_LIBRARIES ${CURL_LIBRARY})
+
+ # Check whether OpenSSL inside libcurl is static.
+ if(UNIX)
+ if(NOT DEFINED HAS_CURL_STATIC)
+ get_filename_component(CURL_LIBRARY_DIR ${CURL_LIBRARY} DIRECTORY)
+ find_soname(CURL REQUIRED)
+
+ if(APPLE)
+ set(libchecker nm)
+ set(searchpattern "T [_]?CRYPTO_set_locking_call")
+ else()
+ set(libchecker readelf -s)
+ set(searchpattern "CRYPTO_set_locking_call")
+ endif()
+ execute_process(
+ COMMAND ${libchecker} ${CURL_LIBRARY_DIR}/${CURL_SONAME}
+ COMMAND grep -Eq ${searchpattern}
+ RESULT_VARIABLE HAS_CURL_STATIC)
+ unset(libchecker)
+ unset(searchpattern)
+ if(HAS_CURL_STATIC EQUAL 0)
+ set(HAS_CURL_STATIC TRUE)
+ else()
+ set(HAS_CURL_STATIC FALSE)
+ endif()
+ set(HAS_CURL_STATIC ${HAS_CURL_STATIC} CACHE INTERNAL
+ "OpenSSL is statically linked into Curl")
+ message(STATUS "OpenSSL is statically linked into Curl: ${HAS_CURL_STATIC}")
+ endif()
+ endif()
+
+ if(HAS_CURL_STATIC)
+ set(CURL_DEFINITIONS -DHAS_CURL_STATIC=1)
+ endif()
+
+ if(NOT TARGET Curl::Curl)
+ add_library(Curl::Curl UNKNOWN IMPORTED)
+ set_target_properties(Curl::Curl PROPERTIES
+ IMPORTED_LOCATION "${CURL_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIR}")
+ if(HAS_CURL_STATIC)
+ set_target_properties(Curl::Curl PROPERTIES
+ INTERFACE_COMPILE_DEFINITIONS HAS_CURL_STATIC=1)
+ endif()
+ endif()
+endif()
+
+mark_as_advanced(CURL_INCLUDE_DIR CURL_LIBRARY)
diff --git a/cmake/modules/FindD3DX11Effects.cmake b/cmake/modules/FindD3DX11Effects.cmake
new file mode 100644
index 0000000000..d7468e1db1
--- /dev/null
+++ b/cmake/modules/FindD3DX11Effects.cmake
@@ -0,0 +1,30 @@
+# - Finds D3DX11 dependencies
+# Once done this will define
+#
+# D3DCOMPILER_DLL - Path to the Direct3D Compiler
+# FXC - Path to the DirectX Effects Compiler (FXC)
+
+find_file(D3DCOMPILER_DLL
+ NAMES d3dcompiler_47.dll d3dcompiler_46.dll
+ PATHS
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v10.0;InstallationFolder]/Redist/D3D/x86"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.1;InstallationFolder]/Redist/D3D/x86"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;InstallationFolder]/Redist/D3D/x86"
+ "$ENV{WindowsSdkDir}Redist/d3d/x86"
+ NO_DEFAULT_PATH)
+if(NOT D3DCOMPILER_DLL)
+ message(WARNING "Could NOT find Direct3D Compiler")
+endif()
+mark_as_advanced(D3DCOMPILER_DLL)
+copy_file_to_buildtree(${D3DCOMPILER_DLL} DIRECTORY .)
+
+find_program(FXC fxc
+ PATHS
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v10.0;InstallationFolder]/bin/x86"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.1;InstallationFolder]/bin/x86"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;InstallationFolder]/bin/x86"
+ "$ENV{WindowsSdkDir}bin/x86")
+if(NOT FXC)
+ message(WARNING "Could NOT find DirectX Effects Compiler (FXC)")
+endif()
+mark_as_advanced(FXC)
diff --git a/cmake/modules/FindDBus.cmake b/cmake/modules/FindDBus.cmake
new file mode 100644
index 0000000000..2d64af4ca2
--- /dev/null
+++ b/cmake/modules/FindDBus.cmake
@@ -0,0 +1,52 @@
+#.rst:
+# FindDBUS
+# -------
+# Finds the DBUS library
+#
+# This will will define the following variables::
+#
+# DBUS_FOUND - system has DBUS
+# DBUS_INCLUDE_DIRS - the DBUS include directory
+# DBUS_LIBRARIES - the DBUS libraries
+# DBUS_DEFINITIONS - the DBUS definitions
+#
+# and the following imported targets::
+#
+# DBus::DBus - The DBUS library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_DBUS dbus-1 QUIET)
+endif()
+
+find_path(DBUS_INCLUDE_DIR NAMES dbus/dbus.h
+ PATH_SUFFIXES dbus-1.0
+ PATHS ${PC_DBUS_INCLUDE_DIR})
+find_path(DBUS_ARCH_INCLUDE_DIR NAMES dbus/dbus-arch-deps.h
+ PATH_SUFFIXES dbus-1.0/include
+ PATHS ${PC_DBUS_LIBDIR}
+ /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE})
+find_library(DBUS_LIBRARY NAMES dbus-1
+ PATHS ${PC_DBUS_LIBDIR})
+
+set(DBUS_VERSION ${PC_DBUS_VERSION})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(DBus
+ REQUIRED_VARS DBUS_LIBRARY DBUS_INCLUDE_DIR DBUS_ARCH_INCLUDE_DIR
+ VERSION_VAR DBUS_VERSION)
+
+if(DBUS_FOUND)
+ set(DBUS_LIBRARIES ${DBUS_LIBRARY})
+ set(DBUS_INCLUDE_DIRS ${DBUS_INCLUDE_DIR} ${DBUS_ARCH_INCLUDE_DIR})
+ set(DBUS_DEFINITIONS -DHAVE_DBUS=1)
+
+ if(NOT TARGET DBus::DBus)
+ add_library(DBus::DBus UNKNOWN IMPORTED)
+ set_target_properties(DBus::DBus PROPERTIES
+ IMPORTED_LOCATION "${DBUS_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${DBUS_INCLUDE_DIR}"
+ INTERFACE_COMPILE_DEFINITIONS HAVE_DBUS=1)
+ endif()
+endif()
+
+mark_as_advanced(DBUS_INCLUDE_DIR DBUS_LIBRARY)
diff --git a/cmake/modules/FindEGL.cmake b/cmake/modules/FindEGL.cmake
new file mode 100644
index 0000000000..79bb176fe8
--- /dev/null
+++ b/cmake/modules/FindEGL.cmake
@@ -0,0 +1,48 @@
+#.rst:
+# FindEGL
+# -------
+# Finds the EGL library
+#
+# This will will define the following variables::
+#
+# EGL_FOUND - system has EGL
+# EGL_INCLUDE_DIRS - the EGL include directory
+# EGL_LIBRARIES - the EGL libraries
+# EGL_DEFINITIONS - the EGL definitions
+#
+# and the following imported targets::
+#
+# EGL::EGL - The EGL library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_EGL egl QUIET)
+endif()
+
+find_path(EGL_INCLUDE_DIR EGL/egl.h
+ PATHS ${PC_EGL_INCLUDEDIR})
+
+find_library(EGL_LIBRARY NAMES EGL egl
+ PATHS ${PC_EGL_LIBDIR})
+
+set(EGL_VERSION ${PC_EGL_VERSION})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(EGL
+ REQUIRED_VARS EGL_LIBRARY EGL_INCLUDE_DIR
+ VERSION_VAR EGL_VERSION)
+
+if(EGL_FOUND)
+ set(EGL_LIBRARIES ${EGL_LIBRARY})
+ set(EGL_INCLUDE_DIRS ${EGL_INCLUDE_DIR})
+ set(EGL_DEFINITIONS -DHAVE_LIBEGL=1)
+
+ if(NOT TARGET EGL::EGL)
+ add_library(EGL::EGL UNKNOWN IMPORTED)
+ set_target_properties(EGL::EGL PROPERTIES
+ IMPORTED_LOCATION "${EGL_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${EGL_INCLUDE_DIR}"
+ INTERFACE_COMPILE_DEFINITIONS HAVE_LIBEGL=1)
+ endif()
+endif()
+
+mark_as_advanced(EGL_INCLUDE_DIR EGL_LIBRARY)
diff --git a/cmake/modules/FindEMBEDDED.cmake b/cmake/modules/FindEMBEDDED.cmake
new file mode 100644
index 0000000000..5e49716549
--- /dev/null
+++ b/cmake/modules/FindEMBEDDED.cmake
@@ -0,0 +1,16 @@
+# - Try to find embedded platforms (RPI/IMX6)
+# Once done this will define
+#
+# EMBEDDED_FOUND - system is RPI / IMX6 and we most probably want to compile for GLES2 support
+# (don't configure for OpenGL)
+
+if(NOT CMAKE_SYSTEM_PROCESSOR)
+ set(CMAKE_SYSTEM_PROCESSOR ${CPU})
+endif()
+
+string(REGEX MATCH "^arm" TARGET_ARCH_ARM "${CMAKE_SYSTEM_PROCESSOR}")
+if(NOT KODI_DEPENDSBUILD AND NOT TARGET_ARCH_ARM)
+ return()
+endif()
+
+find_path(EMBEDDED_FOUND NAMES include/linux/imxfb.h include/bcm_host.h PATHS /opt/vc)
diff --git a/cmake/modules/FindFFMPEG.cmake b/cmake/modules/FindFFMPEG.cmake
new file mode 100644
index 0000000000..3d7fcc8ca3
--- /dev/null
+++ b/cmake/modules/FindFFMPEG.cmake
@@ -0,0 +1,292 @@
+# FindFFMPEG
+# --------
+# Finds FFmpeg libraries
+#
+# This module will first look for the required library versions on the system.
+# If they are not found, it will fall back to downloading and building kodi's own version
+#
+# --------
+# the following variables influence behaviour:
+# ENABLE_INTERNAL_FFMPEG - if enabled, kodi's own version will always be built
+#
+# FFMPEG_PATH - use external ffmpeg not found in system paths
+# usage: -DFFMPEG_PATH=/path/to/ffmpeg_install_prefix
+#
+# WITH_FFMPEG - use external ffmpeg not found in system paths
+# WARNING: this option is for developers as it will _disable ffmpeg version checks_!
+# Consider using FFMPEG_PATH instead, which _does_ check library versions
+# usage: -DWITH_FFMPEG=/path/to/ffmpeg_install_prefix
+#
+# --------
+# This module will will define the following variables:
+#
+# FFMPEG_FOUND - system has FFmpeg
+# FFMPEG_INCLUDE_DIRS - FFmpeg include directory
+# FFMPEG_LIBRARIES - FFmpeg libraries
+# FFMPEG_DEFINITIONS - pre-processor definitions
+# FFMPEG_LDFLAGS - linker flags
+#
+# and the following imported targets::
+#
+# ffmpeg - The FFmpeg libraries
+# --------
+#
+
+# required ffmpeg library versions
+set(REQUIRED_FFMPEG_VERSION 3.1)
+set(_avcodec_ver ">=57.48.101")
+set(_avfilter_ver ">=6.47.100")
+set(_avformat_ver ">=57.41.100")
+set(_avutil_ver ">=55.28.100")
+set(_swscale_ver ">=4.1.100")
+set(_swresample_ver ">=2.1.100")
+set(_postproc_ver ">=54.0.100")
+
+
+# Allows building with external ffmpeg not found in system paths,
+# without library version checks
+if(WITH_FFMPEG)
+ set(FFMPEG_PATH ${WITH_FFMPEG})
+ message(STATUS "Warning: FFmpeg version checking disabled")
+ set(REQUIRED_FFMPEG_VERSION undef)
+ unset(_avcodec_ver)
+ unset(_avfilter_ver)
+ unset(_avformat_ver)
+ unset(_avutil_ver)
+ unset(_swscale_ver)
+ unset(_swresample_ver)
+ unset(_postproc_ver)
+endif()
+
+# Allows building with external ffmpeg not found in system paths,
+# with library version checks
+if(FFMPEG_PATH)
+ set(ENABLE_INTERNAL_FFMPEG OFF)
+endif()
+
+# external FFMPEG
+if(NOT ENABLE_INTERNAL_FFMPEG OR KODI_DEPENDSBUILD)
+ if(FFMPEG_PATH)
+ set(ENV{PKG_CONFIG_PATH} "${FFMPEG_PATH}/lib/pkgconfig")
+ list(APPEND CMAKE_PREFIX_PATH ${FFMPEG_PATH})
+ endif()
+
+ set(FFMPEG_PKGS libavcodec${_avcodec_ver}
+ libavfilter${_avfilter_ver}
+ libavformat${_avformat_ver}
+ libavutil${_avutil_ver}
+ libswscale${_swscale_ver}
+ libswresample${_swresample_ver}
+ libpostproc${_postproc_ver})
+
+ if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_FFMPEG ${FFMPEG_PKGS} QUIET)
+ string(REGEX REPLACE "framework;" "framework " PC_FFMPEG_LDFLAGS "${PC_FFMPEG_LDFLAGS}")
+ endif()
+
+ find_path(FFMPEG_INCLUDE_DIRS libavcodec/avcodec.h libavfilter/avfilter.h libavformat/avformat.h
+ libavutil/avutil.h libswscale/swscale.h libpostproc/postprocess.h
+ PATH_SUFFIXES ffmpeg
+ PATHS ${PC_FFMPEG_INCLUDE_DIRS}
+ NO_DEFAULT_PATH)
+ find_path(FFMPEG_INCLUDE_DIRS libavcodec/avcodec.h libavfilter/avfilter.h libavformat/avformat.h
+ libavutil/avutil.h libswscale/swscale.h libpostproc/postprocess.h)
+
+ find_library(FFMPEG_LIBAVCODEC
+ NAMES avcodec libavcodec
+ PATH_SUFFIXES ffmpeg/libavcodec
+ PATHS ${PC_FFMPEG_libavcodec_LIBDIR}
+ NO_DEFAULT_PATH)
+ find_library(FFMPEG_LIBAVCODEC NAMES avcodec libavcodec PATH_SUFFIXES ffmpeg/libavcodec)
+
+ find_library(FFMPEG_LIBAVFILTER
+ NAMES avfilter libavfilter
+ PATH_SUFFIXES ffmpeg/libavfilter
+ PATHS ${PC_FFMPEG_libavfilter_LIBDIR}
+ NO_DEFAULT_PATH)
+ find_library(FFMPEG_LIBAVFILTER NAMES avfilter libavfilter PATH_SUFFIXES ffmpeg/libavfilter)
+
+ find_library(FFMPEG_LIBAVFORMAT
+ NAMES avformat libavformat
+ PATH_SUFFIXES ffmpeg/libavformat
+ PATHS ${PC_FFMPEG_libavformat_LIBDIR}
+ NO_DEFAULT_PATH)
+ find_library(FFMPEG_LIBAVFORMAT NAMES avformat libavformat PATH_SUFFIXES ffmpeg/libavformat)
+
+ find_library(FFMPEG_LIBAVUTIL
+ NAMES avutil libavutil
+ PATH_SUFFIXES ffmpeg/libavutil
+ PATHS ${PC_FFMPEG_libavutil_LIBDIR}
+ NO_DEFAULT_PATH)
+ find_library(FFMPEG_LIBAVUTIL NAMES avutil libavutil PATH_SUFFIXES ffmpeg/libavutil)
+
+ find_library(FFMPEG_LIBSWSCALE
+ NAMES swscale libswscale
+ PATH_SUFFIXES ffmpeg/libswscale
+ PATHS ${PC_FFMPEG_libswscale_LIBDIR}
+ NO_DEFAULT_PATH)
+ find_library(FFMPEG_LIBSWSCALE NAMES swscale libswscale PATH_SUFFIXES ffmpeg/libswscale)
+
+ find_library(FFMPEG_LIBSWRESAMPLE
+ NAMES swresample libswresample
+ PATH_SUFFIXES ffmpeg/libswresample
+ PATHS ${PC_FFMPEG_libswresample_LIBDIR}
+ NO_DEFAULT_PATH)
+ find_library(FFMPEG_LIBSWRESAMPLE NAMES NAMES swresample libswresample PATH_SUFFIXES ffmpeg/libswresample)
+
+ find_library(FFMPEG_LIBPOSTPROC
+ NAMES postproc libpostproc
+ PATH_SUFFIXES ffmpeg/libpostproc
+ PATHS ${PC_FFMPEG_libpostproc_LIBDIR}
+ NO_DEFAULT_PATH)
+ find_library(FFMPEG_LIBPOSTPROC NAMES postproc libpostproc PATH_SUFFIXES ffmpeg/libpostproc)
+
+ if((PC_FFMPEG_FOUND
+ AND PC_FFMPEG_libavcodec_VERSION
+ AND PC_FFMPEG_libavfilter_VERSION
+ AND PC_FFMPEG_libavformat_VERSION
+ AND PC_FFMPEG_libavutil_VERSION
+ AND PC_FFMPEG_libswscale_VERSION
+ AND PC_FFMPEG_libswresample_VERSION
+ AND PC_FFMPEG_libpostproc_VERSION)
+ OR WIN32)
+ set(FFMPEG_VERSION ${REQUIRED_FFMPEG_VERSION})
+
+
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(FFMPEG
+ VERSION_VAR FFMPEG_VERSION
+ REQUIRED_VARS FFMPEG_INCLUDE_DIRS
+ FFMPEG_LIBAVCODEC
+ FFMPEG_LIBAVFILTER
+ FFMPEG_LIBAVFORMAT
+ FFMPEG_LIBAVUTIL
+ FFMPEG_LIBSWSCALE
+ FFMPEG_LIBSWRESAMPLE
+ FFMPEG_LIBPOSTPROC
+ FFMPEG_VERSION
+ FAIL_MESSAGE "FFmpeg ${REQUIRED_FFMPEG_VERSION} not found, please consider using -DENABLE_INTERNAL_FFMPEG=ON")
+
+ else()
+ message(STATUS "FFmpeg ${REQUIRED_FFMPEG_VERSION} not found, falling back to internal build")
+ unset(FFMPEG_INCLUDE_DIRS)
+ unset(FFMPEG_INCLUDE_DIRS CACHE)
+ unset(FFMPEG_LIBRARIES)
+ unset(FFMPEG_LIBRARIES CACHE)
+ unset(FFMPEG_DEFINITIONS)
+ unset(FFMPEG_DEFINITIONS CACHE)
+ endif()
+
+ if(FFMPEG_FOUND)
+ set(FFMPEG_LDFLAGS ${PC_FFMPEG_LDFLAGS} CACHE STRING "ffmpeg linker flags")
+
+ # check if ffmpeg libs are statically linked
+ set(FFMPEG_LIB_TYPE SHARED)
+ foreach(_fflib IN LISTS FFMPEG_LIBRARIES)
+ if(${_fflib} MATCHES ".+\.a$" AND PC_FFMPEG_STATIC_LDFLAGS)
+ set(FFMPEG_LDFLAGS ${PC_FFMPEG_STATIC_LDFLAGS} CACHE STRING "ffmpeg linker flags" FORCE)
+ set(FFMPEG_LIB_TYPE STATIC)
+ break()
+ endif()
+ endforeach()
+
+ set(FFMPEG_LIBRARIES ${FFMPEG_LIBAVCODEC} ${FFMPEG_LIBAVFILTER}
+ ${FFMPEG_LIBAVFORMAT} ${FFMPEG_LIBAVUTIL}
+ ${FFMPEG_LIBSWSCALE} ${FFMPEG_LIBSWRESAMPLE}
+ ${FFMPEG_LIBPOSTPROC} ${FFMPEG_LDFLAGS})
+ list(APPEND FFMPEG_DEFINITIONS -DFFMPEG_VER_SHA=\"${FFMPEG_VERSION}\")
+
+ if(NOT TARGET ffmpeg)
+ add_library(ffmpeg ${FFMPEG_LIB_TYPE} IMPORTED)
+ set_target_properties(ffmpeg PROPERTIES
+ FOLDER "External Projects"
+ IMPORTED_LOCATION "${FFMPEG_LIBRARIES}"
+ INTERFACE_INCLUDE_DIRECTORIES "${FFMPEG_INCLUDE_DIRS}"
+ INTERFACE_LINK_LIBRARIES "${FFMPEG_LDFLAGS}"
+ INTERFACE_COMPILE_DEFINITIONS "${FFMPEG_DEFINITIONS}")
+ endif()
+ endif()
+endif()
+
+# Internal FFMPEG
+if(NOT FFMPEG_FOUND)
+ include(ExternalProject)
+ file(STRINGS ${CORE_SOURCE_DIR}/tools/depends/target/ffmpeg/FFMPEG-VERSION VER)
+ string(REGEX MATCH "VERSION=[^ ]*$.*" FFMPEG_VER "${VER}")
+ list(GET FFMPEG_VER 0 FFMPEG_VER)
+ string(SUBSTRING "${FFMPEG_VER}" 8 -1 FFMPEG_VER)
+ string(REGEX MATCH "BASE_URL=([^ ]*)" FFMPEG_BASE_URL "${VER}")
+ list(GET FFMPEG_BASE_URL 0 FFMPEG_BASE_URL)
+ string(SUBSTRING "${FFMPEG_BASE_URL}" 9 -1 FFMPEG_BASE_URL)
+
+ # allow user to override the download URL with a local tarball
+ # needed for offline build envs
+ if(FFMPEG_URL)
+ get_filename_component(FFMPEG_URL "${FFMPEG_URL}" ABSOLUTE)
+ else()
+ set(FFMPEG_URL ${FFMPEG_BASE_URL}/${FFMPEG_VER}.tar.gz)
+ endif()
+ if(VERBOSE)
+ message(STATUS "FFMPEG_URL: ${FFMPEG_URL}")
+ endif()
+
+ if(KODI_DEPENDSBUILD)
+ set(CROSS_ARGS -DDEPENDS_PATH=${DEPENDS_PATH}
+ -DPKG_CONFIG_EXECUTABLE=${PKG_CONFIG_EXECUTABLE}
+ -DCROSSCOMPILING=${CMAKE_CROSSCOMPILING}
+ -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
+ -DCORE_SYSTEM_NAME=${CORE_SYSTEM_NAME}
+ -DCPU=${WITH_CPU}
+ -DOS=${OS}
+ -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
+ -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
+ -DCMAKE_AR=${CMAKE_AR}
+ -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
+ -DCMAKE_EXE_LINKER_FLAGS=${CMAKE_EXE_LINKER_FLAGS})
+ endif()
+
+ externalproject_add(ffmpeg
+ URL ${FFMPEG_URL}
+ DOWNLOAD_NAME ffmpeg-${FFMPEG_VER}.tar.gz
+ DOWNLOAD_DIR ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/download
+ PREFIX ${CORE_BUILD_DIR}/ffmpeg
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}
+ -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
+ -DFFMPEG_VER=${FFMPEG_VER}
+ -DCORE_SYSTEM_NAME=${CORE_SYSTEM_NAME}
+ ${CROSS_ARGS}
+ PATCH_COMMAND ${CMAKE_COMMAND} -E copy
+ ${CORE_SOURCE_DIR}/tools/depends/target/ffmpeg/CMakeLists.txt
+ <SOURCE_DIR> &&
+ ${CMAKE_COMMAND} -E copy
+ ${CORE_SOURCE_DIR}/tools/depends/target/ffmpeg/FindGnuTls.cmake
+ <SOURCE_DIR>)
+
+ file(WRITE ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/ffmpeg/ffmpeg-link-wrapper
+"#!/bin/bash
+if [[ $@ == *${APP_NAME_LC}.bin* || $@ == *${APP_NAME_LC}.so* || $@ == *${APP_NAME_LC}-test* ]]
+then
+ avformat=`PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libavcodec`
+ avcodec=`PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libavformat`
+ avfilter=`PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libavfilter`
+ avutil=`PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libavutil`
+ swscale=`PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libswscale`
+ swresample=`PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libswresample`
+ gnutls=`PKG_CONFIG_PATH=${DEPENDS_PATH}/lib/pkgconfig/ ${PKG_CONFIG_EXECUTABLE} --libs-only-l --static --silence-errors gnutls`
+ $@ $avcodec $avformat $avcodec $avfilter $swscale $swresample -lpostproc $gnutls
+else
+ $@
+fi")
+ file(COPY ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/ffmpeg/ffmpeg-link-wrapper
+ DESTINATION ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}
+ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)
+ set(FFMPEG_LINK_EXECUTABLE "${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/ffmpeg-link-wrapper <CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>" PARENT_SCOPE)
+ set(FFMPEG_CREATE_SHARED_LIBRARY "${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/ffmpeg-link-wrapper <CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>" PARENT_SCOPE)
+ set(FFMPEG_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/include)
+ list(APPEND FFMPEG_DEFINITIONS -DFFMPEG_VER_SHA=\"${FFMPEG_VER}\"
+ -DUSE_STATIC_FFMPEG=1)
+ set(FFMPEG_FOUND 1)
+ set_target_properties(ffmpeg PROPERTIES FOLDER "External Projects")
+endif()
+
+mark_as_advanced(FFMPEG_INCLUDE_DIRS FFMPEG_LIBRARIES FFMPEG_LDFLAGS FFMPEG_DEFINITIONS FFMPEG_FOUND)
diff --git a/cmake/modules/FindFreeType.cmake b/cmake/modules/FindFreeType.cmake
new file mode 100644
index 0000000000..fb4c668b7b
--- /dev/null
+++ b/cmake/modules/FindFreeType.cmake
@@ -0,0 +1,45 @@
+#.rst:
+# FindFreetype
+# ------------
+# Finds the FreeType library
+#
+# This will will define the following variables::
+#
+# FREETYPE_FOUND - system has FreeType
+# FREETYPE_INCLUDE_DIRS - the FreeType include directory
+# FREETYPE_LIBRARIES - the FreeType libraries
+#
+# and the following imported targets::
+#
+# FreeType::FreeType - The FreeType library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_FREETYPE freetype2 QUIET)
+endif()
+
+find_path(FREETYPE_INCLUDE_DIR NAMES freetype/freetype.h freetype.h
+ PATHS ${PC_FREETYPE_INCLUDEDIR}
+ ${PC_FREETYPE_INCLUDE_DIRS})
+find_library(FREETYPE_LIBRARY NAMES freetype freetype246MT
+ PATHS ${PC_FREETYPE_LIBDIR})
+
+set(FREETYPE_VERSION ${PC_FREETYPE_VERSION})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(FreeType
+ REQUIRED_VARS FREETYPE_LIBRARY FREETYPE_INCLUDE_DIR
+ VERSION_VAR FREETYPE_VERSION)
+
+if(FREETYPE_FOUND)
+ set(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY})
+ set(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIR})
+
+ if(NOT TARGET FreeType::FreeType)
+ add_library(FreeType::FreeType UNKNOWN IMPORTED)
+ set_target_properties(FreeType::FreeType PROPERTIES
+ IMPORTED_LOCATION "${FREETYPE_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${FREETYPE_INCLUDE_DIR}")
+ endif()
+endif()
+
+mark_as_advanced(FREETYPE_INCLUDE_DIR FREETYPE_LIBRARY)
diff --git a/cmake/modules/FindFribidi.cmake b/cmake/modules/FindFribidi.cmake
new file mode 100644
index 0000000000..dcaeb48b7d
--- /dev/null
+++ b/cmake/modules/FindFribidi.cmake
@@ -0,0 +1,48 @@
+#.rst:
+# FindFribidi
+# -----------
+# Finds the GNU FriBidi library
+#
+# This will will define the following variables::
+#
+# FRIBIDI_FOUND - system has FriBidi
+# FRIBIDI_INCLUDE_DIRS - the FriBidi include directory
+# FRIBIDI_LIBRARIES - the FriBidi libraries
+#
+# and the following imported targets::
+#
+# FriBidi::FriBidi - The FriBidi library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_FRIBIDI fribidi QUIET)
+endif()
+
+find_path(FRIBIDI_INCLUDE_DIR NAMES fribidi/fribidi.h
+ PATHS ${PC_FRIBIDI_INCLUDEDIR})
+find_library(FRIBIDI_LIBRARY NAMES fribidi libfribidi
+ PATHS ${PC_FRIBIDI_LIBDIR})
+
+set(FRIBIDI_VERSION ${PC_FRIBIDI_VERSION})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(FriBidi
+ REQUIRED_VARS FRIBIDI_LIBRARY FRIBIDI_INCLUDE_DIR
+ VERSION_VAR FRIBIDI_VERSION)
+
+if(FRIBIDI_FOUND)
+ set(FRIBIDI_LIBRARIES ${FRIBIDI_LIBRARY})
+ set(FRIBIDI_INCLUDE_DIRS ${FRIBIDI_INCLUDE_DIR})
+ if(PC_FRIBIDI_CFLAGS)
+ set(FRIBIDI_DEFINITIONS ${PC_FRIBIDI_CFLAGS})
+ endif()
+
+ if(NOT TARGET FriBidi::FriBidi)
+ add_library(FriBidi::FriBidi UNKNOWN IMPORTED)
+ set_target_properties(FriBidi::FriBidi PROPERTIES
+ IMPORTED_LOCATION "${FRIBIDI_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${FRIBIDI_INCLUDE_DIR}"
+ INTERFACE_COMPILE_OPTIONS "${FRIBIDI_DEFINITIONS}")
+ endif()
+endif()
+
+mark_as_advanced(FRIBIDI_INCLUDE_DIR FRIBIDI_LIBRARY)
diff --git a/cmake/modules/FindGIF.cmake b/cmake/modules/FindGIF.cmake
new file mode 100644
index 0000000000..8649bd4f47
--- /dev/null
+++ b/cmake/modules/FindGIF.cmake
@@ -0,0 +1,46 @@
+#.rst:
+# FindGIF
+# -------
+# Finds the libgif library
+#
+# This will will define the following variables::
+#
+# GIF_FOUND - system has libgif
+# GIF_INCLUDE_DIRS - the libgif include directory
+# GIF_LIBRARIES - the libgif libraries
+#
+# and the following imported targets::
+#
+# GIF::GIF - The libgif library
+
+find_path(GIF_INCLUDE_DIR gif_lib.h)
+
+include(FindPackageHandleStandardArgs)
+if(NOT WIN32)
+ find_library(GIF_LIBRARY NAMES gif)
+ find_package_handle_standard_args(GIF
+ REQUIRED_VARS GIF_LIBRARY GIF_INCLUDE_DIR)
+else()
+ # Dynamically loaded DLL
+ find_package_handle_standard_args(GIF
+ REQUIRED_VARS GIF_INCLUDE_DIR)
+endif()
+
+if(GIF_FOUND)
+ set(GIF_LIBRARIES ${GIF_LIBRARY})
+ set(GIF_INCLUDE_DIRS ${GIF_INCLUDE_DIR})
+ set(GIF_DEFINITIONS -DHAVE_LIBGIF=1)
+
+ if(NOT TARGET GIF::GIF)
+ add_library(GIF::GIF UNKNOWN IMPORTED)
+ if(GIF_LIBRARY)
+ set_target_properties(GIF::GIF PROPERTIES
+ IMPORTED_LOCATION "${GIF_LIBRARY}")
+ endif()
+ set_target_properties(GIF::GIF PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${GIF_INCLUDE_DIR}"
+ INTERFACE_COMPILE_DEFINITIONS HAVE_LIBGIF=1)
+ endif()
+endif()
+
+mark_as_advanced(GIF_INCLUDE_DIR GIF_LIBRARY)
diff --git a/cmake/modules/FindJsonSchemaBuilder.cmake b/cmake/modules/FindJsonSchemaBuilder.cmake
new file mode 100644
index 0000000000..3bffb4831c
--- /dev/null
+++ b/cmake/modules/FindJsonSchemaBuilder.cmake
@@ -0,0 +1,21 @@
+#.rst:
+# FindJsonSchemaBuilder
+# ---------------------
+# Finds the JsonSchemaBuilder
+#
+# This will define the following (imported) targets::
+#
+# JsonSchemaBuilder::JsonSchemaBuilder - The JsonSchemaBuilder executable
+
+if(NOT TARGET JsonSchemaBuilder::JsonSchemaBuilder)
+ if(KODI_DEPENDSBUILD OR CMAKE_CROSSCOMPILING)
+ add_executable(JsonSchemaBuilder::JsonSchemaBuilder IMPORTED GLOBAL)
+ set_target_properties(JsonSchemaBuilder::JsonSchemaBuilder PROPERTIES
+ IMPORTED_LOCATION "${NATIVEPREFIX}/bin/JsonSchemaBuilder")
+ set_target_properties(JsonSchemaBuilder::JsonSchemaBuilder PROPERTIES FOLDER Tools)
+ else()
+ add_subdirectory(${CORE_SOURCE_DIR}/tools/depends/native/JsonSchemaBuilder build/jsonschemabuilder)
+ add_executable(JsonSchemaBuilder::JsonSchemaBuilder ALIAS JsonSchemaBuilder)
+ set_target_properties(JsonSchemaBuilder PROPERTIES FOLDER Tools)
+ endif()
+endif()
diff --git a/cmake/modules/FindLibDRM.cmake b/cmake/modules/FindLibDRM.cmake
new file mode 100644
index 0000000000..35d632e7f3
--- /dev/null
+++ b/cmake/modules/FindLibDRM.cmake
@@ -0,0 +1,45 @@
+#.rst:
+# FindLibDRM
+# ----------
+# Finds the LibDRM library
+#
+# This will will define the following variables::
+#
+# LIBDRM_FOUND - system has LibDRM
+# LIBDRM_INCLUDE_DIRS - the LibDRM include directory
+# LIBDRM_LIBRARIES - the LibDRM libraries
+#
+# and the following imported targets::
+#
+# LibDRM::LibDRM - The LibDRM library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_LIBDRM libdrm QUIET)
+endif()
+
+find_path(LIBDRM_INCLUDE_DIR NAMES drm.h
+ PATH_SUFFIXES libdrm drm
+ PATHS ${PC_LIBDRM_INCLUDEDIR})
+find_library(LIBDRM_LIBRARY NAMES drm
+ PATHS ${PC_LIBDRM_LIBDIR})
+
+set(LIBDRM_VERSION ${PC_LIBDRM_VERSION})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(LibDRM
+ REQUIRED_VARS LIBDRM_LIBRARY LIBDRM_INCLUDE_DIR
+ VERSION_VAR LIBDRM_VERSION)
+
+if(LIBDRM_FOUND)
+ set(LIBDRM_LIBRARIES ${LIBDRM_LIBRARY})
+ set(LIBDRM_INCLUDE_DIRS ${LIBDRM_INCLUDE_DIR})
+
+ if(NOT TARGET LIBDRM::LIBDRM)
+ add_library(LIBDRM::LIBDRM UNKNOWN IMPORTED)
+ set_target_properties(LIBDRM::LIBDRM PROPERTIES
+ IMPORTED_LOCATION "${LIBDRM_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${LIBDRM_INCLUDE_DIR}")
+ endif()
+endif()
+
+mark_as_advanced(LIBDRM_INCLUDE_DIR LIBDRM_LIBRARY)
diff --git a/cmake/modules/FindLibDvd.cmake b/cmake/modules/FindLibDvd.cmake
new file mode 100644
index 0000000000..1f02b5f226
--- /dev/null
+++ b/cmake/modules/FindLibDvd.cmake
@@ -0,0 +1,219 @@
+if(NOT WIN32)
+ if(KODI_DEPENDSBUILD)
+ set(_dvdlibs dvdread dvdnav)
+ set(_handlevars LIBDVD_INCLUDE_DIRS DVDREAD_LIBRARY DVDNAV_LIBRARY)
+ if(ENABLE_DVDCSS)
+ list(APPEND _dvdlibs libdvdcss)
+ list(APPEND _handlevars DVDCSS_LIBRARY)
+ endif()
+
+ if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_DVD ${_dvdlibs} QUIET)
+ endif()
+
+ find_path(LIBDVD_INCLUDE_DIRS dvdnav/dvdnav.h PATHS ${PC_DVD_INCLUDE_DIRS})
+ find_library(DVDREAD_LIBRARY NAMES dvdread libdvdread PATHS ${PC_DVD_dvdread_LIBDIR})
+ find_library(DVDNAV_LIBRARY NAMES dvdnav libdvdnav PATHS ${PC_DVD_dvdnav_LIBDIR})
+ if(ENABLE_DVDCSS)
+ find_library(DVDCSS_LIBRARY NAMES dvdcss libdvdcss PATHS ${PC_DVD_libdvdcss_LIBDIR})
+ endif()
+
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(LIBDVD REQUIRED_VARS ${_handlevars})
+ if(LIBDVD_FOUND)
+ add_library(dvdnav UNKNOWN IMPORTED)
+ set_target_properties(dvdnav PROPERTIES
+ FOLDER "External Projects"
+ IMPORTED_LOCATION "${DVDNAV_LIBRARY}")
+
+ add_library(dvdread UNKNOWN IMPORTED)
+ set_target_properties(dvdread PROPERTIES
+ FOLDER "External Projects"
+ IMPORTED_LOCATION "${DVDREAD_LIBRARY}")
+ add_library(dvdcss UNKNOWN IMPORTED)
+ set_target_properties(dvdcss PROPERTIES
+ FOLDER "External Projects"
+ IMPORTED_LOCATION "${DVDCSS_LIBRARY}")
+
+ set(_linklibs ${DVDREAD_LIBRARY})
+ if(ENABLE_DVDCSS)
+ list(APPEND _linklibs ${DVDCSS_LIBRARY})
+ endif()
+ core_link_library(${DVDNAV_LIBRARY} system/players/VideoPlayer/libdvdnav dvdnav archives "${_linklibs}")
+ set(LIBDVD_LIBRARIES ${DVDNAV_LIBRARY})
+ mark_as_advanced(LIBDVD_INCLUDE_DIRS LIBDVD_LIBRARIES)
+ endif()
+ else()
+ set(dvdlibs libdvdread libdvdnav)
+ if(ENABLE_DVDCSS)
+ list(APPEND dvdlibs libdvdcss)
+ endif()
+ foreach(dvdlib ${dvdlibs})
+ file(GLOB VERSION_FILE ${CORE_SOURCE_DIR}/tools/depends/target/${dvdlib}/DVD*-VERSION)
+ file(STRINGS ${VERSION_FILE} VER)
+ string(REGEX MATCH "VERSION=[^ ]*$.*" ${dvdlib}_VER "${VER}")
+ list(GET ${dvdlib}_VER 0 ${dvdlib}_VER)
+ string(SUBSTRING "${${dvdlib}_VER}" 8 -1 ${dvdlib}_VER)
+ string(REGEX MATCH "BASE_URL=([^ ]*)" ${dvdlib}_BASE_URL "${VER}")
+ list(GET ${dvdlib}_BASE_URL 0 ${dvdlib}_BASE_URL)
+ string(SUBSTRING "${${dvdlib}_BASE_URL}" 9 -1 ${dvdlib}_BASE_URL)
+ string(TOUPPER ${dvdlib} DVDLIB)
+
+ # allow user to override the download URL with a local tarball
+ # needed for offline build envs
+ # allow upper and lowercase var name
+ if(${dvdlib}_URL)
+ set(${DVDLIB}_URL ${${dvdlib}_URL})
+ endif()
+ if(${DVDLIB}_URL)
+ get_filename_component(${DVDLIB}_URL "${${DVDLIB}_URL}" ABSOLUTE)
+ else()
+ set(${DVDLIB}_URL ${${dvdlib}_BASE_URL}/archive/${${dvdlib}_VER}.tar.gz)
+ endif()
+ if(VERBOSE)
+ message(STATUS "${DVDLIB}_URL: ${${DVDLIB}_URL}")
+ endif()
+ endforeach()
+
+ set(DVDREAD_CFLAGS "${DVDREAD_CFLAGS} -I${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/include")
+ if(CMAKE_CROSSCOMPILING)
+ set(EXTRA_FLAGS "CC=${CMAKE_C_COMPILER}")
+ endif()
+
+ if(APPLE)
+ set(CMAKE_LD_FLAGS "-framework IOKit -framework CoreFoundation")
+ endif()
+
+ set(HOST_ARCH ${ARCH})
+ if(CORE_SYSTEM_NAME STREQUAL android)
+ if(ARCH STREQUAL arm)
+ set(HOST_ARCH arm-linux-androideabi)
+ elseif(ARCH STREQUAL aarch64)
+ set(HOST_ARCH aarch64-linux-android)
+ elseif(ARCH STREQUAL i486-linux)
+ set(HOST_ARCH i686-linux-android)
+ endif()
+ endif()
+
+ if(ENABLE_DVDCSS)
+ set(DVDCSS_LIBRARY ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib/libdvdcss.a)
+ ExternalProject_Add(dvdcss URL ${LIBDVDCSS_URL}
+ DOWNLOAD_NAME libdvdcss-${libdvdcss_VER}.tar.gz
+ DOWNLOAD_DIR ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/download
+ PREFIX ${CORE_BUILD_DIR}/libdvd
+ CONFIGURE_COMMAND ac_cv_path_GIT= <SOURCE_DIR>/configure
+ --target=${HOST_ARCH}
+ --host=${HOST_ARCH}
+ --disable-doc
+ --enable-static
+ --disable-shared
+ --with-pic
+ --prefix=<INSTALL_DIR>
+ --libdir=<INSTALL_DIR>/lib
+ "${EXTRA_FLAGS}"
+ "CFLAGS=${CMAKE_C_FLAGS} ${DVDREAD_CFLAGS}"
+ "LDFLAGS=${CMAKE_LD_FLAGS}"
+ BUILD_BYPRODUCTS ${DVDCSS_LIBRARY})
+ ExternalProject_Add_Step(dvdcss autoreconf
+ DEPENDEES download update patch
+ DEPENDERS configure
+ COMMAND PATH=${NATIVEPREFIX}/bin:$ENV{PATH} autoreconf -vif
+ WORKING_DIRECTORY <SOURCE_DIR>)
+
+ set_target_properties(dvdcss PROPERTIES FOLDER "External Projects")
+ endif()
+
+ set(DVDREAD_CFLAGS "-D_XBMC")
+ if(ENABLE_DVDCSS)
+ set(DVDREAD_CFLAGS "${DVDREAD_CFLAGS} -DHAVE_DVDCSS_DVDCSS_H -I${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/include")
+ endif()
+
+ set(DVDREAD_LIBRARY ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib/libdvdread.a)
+ ExternalProject_Add(dvdread URL ${LIBDVDREAD_URL}
+ DOWNLOAD_NAME libdvdread-${libdvdread_VER}.tar.gz
+ DOWNLOAD_DIR ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/download
+ PREFIX ${CORE_BUILD_DIR}/libdvd
+ CONFIGURE_COMMAND ac_cv_path_GIT= <SOURCE_DIR>/configure
+ --target=${HOST_ARCH}
+ --host=${HOST_ARCH}
+ --enable-static
+ --disable-shared
+ --with-pic
+ --prefix=<INSTALL_DIR>
+ --libdir=<INSTALL_DIR>/lib
+ "${EXTRA_FLAGS}"
+ "CFLAGS=${CMAKE_C_FLAGS} ${DVDREAD_CFLAGS}"
+ "LDFLAGS=${CMAKE_LD_FLAGS}"
+ BUILD_BYPRODUCTS ${DVDREAD_LIBRARY})
+ ExternalProject_Add_Step(dvdread autoreconf
+ DEPENDEES download update patch
+ DEPENDERS configure
+ COMMAND PATH=${NATIVEPREFIX}/bin:$ENV{PATH} autoreconf -vif
+ WORKING_DIRECTORY <SOURCE_DIR>)
+ if(ENABLE_DVDCSS)
+ add_dependencies(dvdread dvdcss)
+ endif()
+
+ set_target_properties(dvdread PROPERTIES FOLDER "External Projects")
+
+ if(ENABLE_DVDCSS)
+ set(DVDNAV_LIBS -ldvdcss)
+ endif()
+
+ set(DVDNAV_LIBRARY ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib/libdvdnav.a)
+ ExternalProject_Add(dvdnav URL ${LIBDVDNAV_URL}
+ DOWNLOAD_NAME libdvdnav-${libdvdnav_VER}.tar.gz
+ DOWNLOAD_DIR ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/download
+ PREFIX ${CORE_BUILD_DIR}/libdvd
+ CONFIGURE_COMMAND ac_cv_path_GIT= <SOURCE_DIR>/configure
+ --target=${HOST_ARCH}
+ --host=${HOST_ARCH}
+ --enable-static
+ --disable-shared
+ --with-pic
+ --prefix=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd
+ --libdir=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib
+ "${EXTRA_FLAGS}"
+ "LDFLAGS=${CMAKE_LD_FLAGS} -L${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib"
+ "CFLAGS=${CMAKE_C_FLAGS} ${DVDREAD_CFLAGS}"
+ "DVDREAD_CFLAGS=${DVDREAD_CFLAGS}"
+ "DVDREAD_LIBS=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib/libdvdread.la"
+ "LIBS=${DVDNAV_LIBS}"
+ BUILD_BYPRODUCTS ${DVDNAV_LIBRARY})
+ ExternalProject_Add_Step(dvdnav autoreconf
+ DEPENDEES download update patch
+ DEPENDERS configure
+ COMMAND PATH=${NATIVEPREFIX}/bin:$ENV{PATH} autoreconf -vif
+ WORKING_DIRECTORY <SOURCE_DIR>)
+ add_dependencies(dvdnav dvdread)
+ set_target_properties(dvdnav PROPERTIES FOLDER "External Projects")
+
+ set(_dvdlibs ${DVDREAD_LIBRARY} ${DVDCSS_LIBRARY})
+ # link a shared dvdnav library that includes the whole archives of dvdread and dvdcss as well
+ # the quotes around _dvdlibs are on purpose, since we want to pass a list to the function that will be unpacked automatically
+ core_link_library(${DVDNAV_LIBRARY} system/players/VideoPlayer/libdvdnav dvdnav archives "${_dvdlibs}")
+
+ set(LIBDVD_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/include)
+ set(LIBDVD_LIBRARIES ${DVDNAV_LIBRARY} ${DVDREAD_LIBRARY})
+ if(ENABLE_DVDCSS)
+ list(APPEND LIBDVD_LIBRARIES ${DVDCSS_LIBRARY})
+ endif()
+ set(LIBDVD_LIBRARIES ${LIBDVD_LIBRARIES} CACHE STRING "libdvd libraries" FORCE)
+ set(LIBDVD_FOUND 1 CACHE BOOL "libdvd found" FORCE)
+ endif()
+else()
+ # Dynamically loaded on Windows
+ find_path(LIBDVD_INCLUDE_DIR dvdcss/dvdcss.h PATHS ${CORE_SOURCE_DIR}/lib/libdvd/include)
+
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(LIBDVD REQUIRED_VARS LIBDVD_INCLUDE_DIR)
+
+ if(LIBDVD_FOUND)
+ set(LIBDVD_INCLUDE_DIRS ${LIBDVD_INCLUDE_DIR})
+
+ add_custom_target(dvdnav)
+ set_target_properties(dvdnav PROPERTIES FOLDER "External Projects")
+ endif()
+
+ mark_as_advanced(LIBDVD_INCLUDE_DIR)
+endif()
diff --git a/cmake/modules/FindLibUSB.cmake b/cmake/modules/FindLibUSB.cmake
new file mode 100644
index 0000000000..e976bf48e4
--- /dev/null
+++ b/cmake/modules/FindLibUSB.cmake
@@ -0,0 +1,45 @@
+#.rst:
+# FindLibUSB
+# ----------
+# Finds the USB library
+#
+# This will will define the following variables::
+#
+# LIBUSB_FOUND - system has LibUSB
+# LIBUSB_INCLUDE_DIRS - the USB include directory
+# LIBUSB_LIBRARIES - the USB libraries
+#
+# and the following imported targets::
+#
+# LibUSB::LibUSB - The USB library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_LIBUSB libusb QUIET)
+endif()
+
+find_path(LIBUSB_INCLUDE_DIR usb.h
+ PATHS ${PC_LIBUSB_INCLUDEDIR})
+find_library(LIBUSB_LIBRARY NAMES usb
+ PATHS ${PC_LIBUSB_INCLUDEDIR})
+set(LIBUSB_VERSION ${PC_LIBUSB_VERSION})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(LIBUSB
+ REQUIRED_VARS LIBUSB_LIBRARY LIBUSB_INCLUDE_DIR
+ VERSION_VAR LIBUSB_VERSION)
+
+if(LIBUSB_FOUND)
+ set(LIBUSB_INCLUDE_DIRS ${LIBUSB_INCLUDE_DIR})
+ set(LIBUSB_LIBRARIES ${LIBUSB_LIBRARY})
+ set(LIBUSB_DEFINITIONS -DUSE_LIBUSB=1)
+
+ if(NOT TARGET LibUSB::LibUSB)
+ add_library(LibUSB::LibUSB UNKNOWN IMPORTED)
+ set_target_properties(LibUSB::LibUSB PROPERTIES
+ IMPORTED_LOCATION "${LIBUSB_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${LIBUSB_INCLUDE_DIR}"
+ INTERFACE_COMPILE_DEFINITIONS USE_LIBUSB=1)
+ endif()
+endif()
+
+mark_as_advanced(USB_INCLUDE_DIR USB_LIBRARY)
diff --git a/cmake/modules/FindLibXml2.cmake b/cmake/modules/FindLibXml2.cmake
new file mode 100644
index 0000000000..caeb9459fa
--- /dev/null
+++ b/cmake/modules/FindLibXml2.cmake
@@ -0,0 +1,84 @@
+#.rst:
+# FindLibXml2
+# -----------
+#
+# Try to find the LibXml2 xml processing library
+#
+# Once done this will define
+#
+# ::
+#
+# LIBXML2_FOUND - System has LibXml2
+# LIBXML2_INCLUDE_DIR - The LibXml2 include directory
+# LIBXML2_LIBRARIES - The libraries needed to use LibXml2
+# LIBXML2_DEFINITIONS - Compiler switches required for using LibXml2
+# LIBXML2_XMLLINT_EXECUTABLE - The XML checking tool xmllint coming with LibXml2
+# LIBXML2_VERSION_STRING - the version of LibXml2 found (since CMake 2.8.8)
+
+#=============================================================================
+# Copyright 2006-2009 Kitware, Inc.
+# Copyright 2006 Alexander Neundorf <neundorf@kde.org>
+# Copyright 2016 Team Kodi
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# use pkg-config to get the directories and then use these values
+# in the find_path() and find_library() calls
+find_package(PkgConfig QUIET)
+PKG_CHECK_MODULES(PC_LIBXML QUIET libxml-2.0)
+set(LIBXML2_DEFINITIONS ${PC_LIBXML_CFLAGS_OTHER})
+
+find_path(LIBXML2_INCLUDE_DIR NAMES libxml/xpath.h
+ HINTS
+ ${PC_LIBXML_INCLUDEDIR}
+ ${PC_LIBXML_INCLUDE_DIRS}
+ PATH_SUFFIXES libxml2
+ )
+
+find_library(LIBXML2_LIBRARY NAMES xml2 libxml2
+ HINTS
+ ${PC_LIBXML_LIBDIR}
+ ${PC_LIBXML_LIBRARY_DIRS}
+ )
+
+find_program(LIBXML2_XMLLINT_EXECUTABLE xmllint)
+# for backwards compat. with KDE 4.0.x:
+set(XMLLINT_EXECUTABLE "${LIBXML2_XMLLINT_EXECUTABLE}")
+
+# Make sure to use static flags if apropriate
+if(PC_LIBXML_FOUND)
+ if(${LIBXML2_LIBRARY} MATCHES ".+\.a$" AND PC_LIBXML_STATIC_LDFLAGS)
+ set(LIBXML2_LIBRARY ${LIBXML2_LIBRARY} ${PC_LIBXML_STATIC_LDFLAGS})
+ endif()
+endif()
+
+if(PC_LIBXML_VERSION)
+ set(LIBXML2_VERSION_STRING ${PC_LIBXML_VERSION})
+elseif(LIBXML2_INCLUDE_DIR AND EXISTS "${LIBXML2_INCLUDE_DIR}/libxml/xmlversion.h")
+ file(STRINGS "${LIBXML2_INCLUDE_DIR}/libxml/xmlversion.h" libxml2_version_str
+ REGEX "^#define[\t ]+LIBXML_DOTTED_VERSION[\t ]+\".*\"")
+ string(REGEX REPLACE "^#define[\t ]+LIBXML_DOTTED_VERSION[\t ]+\"([^\"]*)\".*" "\\1"
+ LIBXML2_VERSION_STRING "${libxml2_version_str}")
+ unset(libxml2_version_str)
+endif()
+
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2
+ REQUIRED_VARS LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR
+ VERSION_VAR LIBXML2_VERSION_STRING)
+
+if(LibXml2_FOUND)
+ set(LIBXML2_LIBRARIES ${LIBXML2_LIBRARY})
+ set(LIBXML2_INCLUDE_DIRS ${LIBXML2_INCLUDE_DIR})
+endif()
+
+mark_as_advanced(LIBXML2_INCLUDE_DIRS LIBXML2_LIBRARIES LIBXML2_XMLLINT_EXECUTABLE)
diff --git a/cmake/modules/FindLzo2.cmake b/cmake/modules/FindLzo2.cmake
new file mode 100644
index 0000000000..4f7313f7fb
--- /dev/null
+++ b/cmake/modules/FindLzo2.cmake
@@ -0,0 +1,37 @@
+#.rst:
+# FindLzo2
+# --------
+# Finds the Lzo2 library
+#
+# This will will define the following variables::
+#
+# LZO2_FOUND - system has Lzo2
+# LZO2_INCLUDE_DIRS - the Lzo2 include directory
+# LZO2_LIBRARIES - the Lzo2 libraries
+#
+# and the following imported targets::
+#
+# Lzo2::Lzo2 - The Lzo2 library
+
+find_path(LZO2_INCLUDE_DIR NAMES lzo1x.h
+ PATH_SUFFIXES lzo)
+
+find_library(LZO2_LIBRARY NAMES lzo2 liblzo2)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Lzo2
+ REQUIRED_VARS LZO2_LIBRARY LZO2_INCLUDE_DIR)
+
+if(LZO2_FOUND)
+ set(LZO2_LIBRARIES ${LZO2_LIBRARY})
+ set(LZO2_INCLUDE_DIRS ${LZO2_INCLUDE_DIR})
+
+ if(NOT TARGET Lzo2::Lzo2)
+ add_library(Lzo2::Lzo2 UNKNOWN IMPORTED)
+ set_target_properties(Lzo2::Lzo2 PROPERTIES
+ IMPORTED_LOCATION "${LZO2_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${LZO2_INCLUDE_DIR}")
+ endif()
+endif()
+
+mark_as_advanced(LZO2_INCLUDE_DIR LZO2_LIBRARY)
diff --git a/cmake/modules/FindMMAL.cmake b/cmake/modules/FindMMAL.cmake
new file mode 100644
index 0000000000..0b5f5564ec
--- /dev/null
+++ b/cmake/modules/FindMMAL.cmake
@@ -0,0 +1,55 @@
+# - Try to find MMAL
+# Once done this will define
+#
+# MMAL_FOUND - system has MMAL
+# MMAL_INCLUDE_DIRS - the MMAL include directory
+# MMAL_LIBRARIES - The MMAL libraries
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_MMAL mmal QUIET)
+endif()
+
+
+find_path(MMAL_INCLUDE_DIR NAMES interface/mmal/mmal.h PATHS ${PC_MMAL_INCLUDEDIR})
+find_library(MMAL_LIBRARY NAMES mmal libmmal PATHS ${PC_MMAL_LIBDIR})
+find_library(MMALCORE_LIBRARY NAMES mmal_core libmmal_core PATHS ${PC_MMAL_LIBDIR})
+find_library(MMALUTIL_LIBRARY NAMES mmal_util libmmal_util PATHS ${PC_MMAL_LIBDIR})
+find_library(MMALCLIENT_LIBRARY NAMES mmal_vc_client libmmal_vc_client PATHS ${PC_MMAL_LIBDIR})
+find_library(MMALCOMPONENT_LIBRARY NAMES mmal_components libmmal_components PATHS ${PC_MMAL_LIBDIR})
+find_library(BCM_LIBRARY NAMES bcm_host libbcm_host PATHS ${PC_MMAL_LIBDIR})
+find_library(VCHIQ_LIBRARY NAMES vchiq_arm libvchiq_arm PATHS ${PC_MMAL_LIBDIR})
+find_library(VCHOSTIF_LIBRARY NAMES vchostif libvchostif PATHS ${PC_MMAL_LIBDIR})
+find_library(VCILCS_LIBRARY NAMES vcilcs libvcilcs PATHS ${PC_MMAL_LIBDIR})
+find_library(VCOS_LIBRARY NAMES vcos libvcos PATHS ${PC_MMAL_LIBDIR})
+find_library(VCSM_LIBRARY NAMES vcsm libvcsm PATHS ${PC_MMAL_LIBDIR})
+find_library(CONTAINER_LIBRARY NAMES containers libcontainers PATHS ${PC_MMAL_LIBDIR})
+
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(MMAL REQUIRED_VARS MMAL_INCLUDE_DIR
+ MMAL_LIBRARY MMALCORE_LIBRARY MMALUTIL_LIBRARY
+ MMALCLIENT_LIBRARY MMALCOMPONENT_LIBRARY BCM_LIBRARY
+ VCHIQ_LIBRARY VCOS_LIBRARY VCSM_LIBRARY VCHOSTIF_LIBRARY
+ VCILCS_LIBRARY CONTAINER_LIBRARY)
+
+
+if(MMAL_FOUND)
+ set(MMAL_INCLUDE_DIRS ${MMAL_INCLUDE_DIR})
+ set(MMAL_LIBRARIES ${MMAL_LIBRARY} ${MMALCORE_LIBRARY} ${MMALUTIL_LIBRARY}
+ ${MMALCLIENT_LIBRARY} ${MMALCOMPONENT_LIBRARY}
+ ${BCM_LIBRARY} ${VCHIQ_LIBRARY} ${VCOS_LIBRARY} ${VCSM_LIBRARY}
+ ${VCHOSTIF_LIBRARY} ${VCILCS_LIBRARY} ${CONTAINER_LIBRARY}
+ CACHE STRING "mmal libraries" FORCE)
+ list(APPEND MMAL_DEFINITIONS -DHAVE_MMAL=1 -DHAS_MMAL=1)
+
+ if(NOT TARGET MMAL::MMAL)
+ add_library(MMAL::MMAL UNKNOWN IMPORTED)
+ set_target_properties(MMAL::MMAL PROPERTIES
+ IMPORTED_LOCATION "${MMAL_LIBRARIES}"
+ INTERFACE_INCLUDE_DIRECTORIES "${MMAL_INCLUDE_DIR}")
+ endif()
+endif()
+
+mark_as_advanced(MMAL_INCLUDE_DIRS MMAL_LIBRARIES MMAL_DEFINITIONS
+ MMAL_LIBRARY MMALCORE_LIBRARY MMALUTIL_LIBRARY MMALCLIENT_LIBRARY MMALCOMPONENT_LIBRARY BCM_LIBRARY
+ VCHIQ_LIBRARY VCOS_LIBRARY VCSM_LIBRARY VCHOSTIF_LIBRARY VCILCS_LIBRARY CONTAINER_LIBRARY)
diff --git a/cmake/modules/FindMicroHttpd.cmake b/cmake/modules/FindMicroHttpd.cmake
new file mode 100644
index 0000000000..8eecbc4e0a
--- /dev/null
+++ b/cmake/modules/FindMicroHttpd.cmake
@@ -0,0 +1,51 @@
+#.rst:
+# FindMicroHttpd
+# --------------
+# Finds the MicroHttpd library
+#
+# This will will define the following variables::
+#
+# MICROHTTPD_FOUND - system has MicroHttpd
+# MICROHTTPD_INCLUDE_DIRS - the MicroHttpd include directory
+# MICROHTTPD_LIBRARIES - the MicroHttpd libraries
+# MICROHTTPD_DEFINITIONS - the MicroHttpd definitions
+#
+# and the following imported targets::
+#
+# MicroHttpd::MicroHttpd - The MicroHttpd library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_MICROHTTPD libmicrohttpd>=0.4 QUIET)
+endif()
+
+find_path(MICROHTTPD_INCLUDE_DIR NAMES microhttpd.h
+ PATHS ${PC_MICROHTTPD_INCLUDEDIR})
+find_library(MICROHTTPD_LIBRARY NAMES microhttpd libmicrohttpd
+ PATHS ${PC_MICROHTTPD_LIBDIR})
+
+set(MICROHTTPD_VERSION ${PC_MICROHTTPD_VERSION})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(MicroHttpd
+ REQUIRED_VARS MICROHTTPD_LIBRARY MICROHTTPD_INCLUDE_DIR
+ VERSION_VAR MICROHTTPD_VERSION)
+
+if(MICROHTTPD_FOUND)
+ set(MICROHTTPD_LIBRARIES ${MICROHTTPD_LIBRARY})
+ set(MICROHTTPD_INCLUDE_DIRS ${MICROHTTPD_INCLUDE_DIR})
+ set(MICROHTTPD_DEFINITIONS -DHAVE_LIBMICROHTTPD=1)
+
+ if(KODI_DEPENDSBUILD AND NOT WIN32)
+ find_library(GCRYPT_LIBRARY gcrypt)
+ find_library(GPGERROR_LIBRARY gpg-error)
+ list(APPEND MICROHTTPD_LIBRARIES ${GCRYPT_LIBRARY} ${GPGERROR_LIBRARY})
+ mark_as_advanced(GCRYPT_LIBRARY GPGERROR_LIBRARY)
+ if(NOT APPLE AND NOT CORE_SYSTEM_NAME STREQUAL android)
+ list(APPEND MICROHTTPD_LIBRARIES rt)
+ endif()
+ else()
+ list(APPEND MICROHTTPD_LIBRARIES ${PC_MICROHTTPD_STATIC_LIBRARIES})
+ endif()
+endif()
+
+mark_as_advanced(MICROHTTPD_LIBRARY MICROHTTPD_INCLUDE_DIR)
diff --git a/cmake/modules/FindMir.cmake b/cmake/modules/FindMir.cmake
new file mode 100644
index 0000000000..8847a617fd
--- /dev/null
+++ b/cmake/modules/FindMir.cmake
@@ -0,0 +1,33 @@
+# FindMir
+# -------
+# Finds the Mir library
+#
+# This will will define the following variables::
+#
+# MIR_FOUND - the system has Mir
+# MIR_INCLUDE_DIRS - the Mir include directory
+# MIR_LIBRARIES - the Mir libraries
+# MIR_DEFINITIONS - the Mir definitions
+
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules (PC_MIR mirclient QUIET)
+endif()
+
+find_path(MIR_INCLUDE_DIR NAMES mir_toolkit/mir_client_library.h
+ PATHS ${PC_MIR_INCLUDE_DIRS})
+
+find_library(MIR_LIBRARY NAMES mirclient
+ PATHS ${PC_MIR_LIBRARIES} ${PC_MIR_LIBRARY_DIRS})
+
+include (FindPackageHandleStandardArgs)
+find_package_handle_standard_args (MIR
+ REQUIRED_VARS MIR_LIBRARY MIR_INCLUDE_DIR)
+
+if (MIR_FOUND)
+ set(MIR_LIBRARIES ${MIR_LIBRARY})
+ set(MIR_INCLUDE_DIRS ${PC_MIR_INCLUDE_DIRS})
+ set(MIR_DEFINITIONS -DHAVE_MIR=1)
+endif()
+
+mark_as_advanced (MIR_LIBRARY MIR_INCLUDE_DIR)
diff --git a/cmake/modules/FindMySqlClient.cmake b/cmake/modules/FindMySqlClient.cmake
new file mode 100644
index 0000000000..ceccea39b1
--- /dev/null
+++ b/cmake/modules/FindMySqlClient.cmake
@@ -0,0 +1,69 @@
+#.rst:
+# FindMySqlClient
+# ---------------
+# Finds the MySqlClient library
+#
+# This will will define the following variables::
+#
+# MYSQLCLIENT_FOUND - system has MySqlClient
+# MYSQLCLIENT_INCLUDE_DIRS - the MySqlClient include directory
+# MYSQLCLIENT_LIBRARIES - the MySqlClient libraries
+# MYSQLCLIENT_DEFINITIONS - the MySqlClient compile definitions
+#
+# and the following imported targets::
+#
+# MySqlClient::MySqlClient - The MySqlClient library
+
+# Don't find system wide installed version on Windows
+if(WIN32)
+ set(EXTRA_FIND_ARGS NO_SYSTEM_ENVIRONMENT_PATH)
+else()
+ set(EXTRA_FIND_ARGS)
+endif()
+
+find_path(MYSQLCLIENT_INCLUDE_DIR mysql/mysql_time.h)
+find_library(MYSQLCLIENT_LIBRARY_RELEASE NAMES mysqlclient libmysql
+ PATH_SUFFIXES mysql
+ ${EXTRA_FIND_ARGS})
+find_library(MYSQLCLIENT_LIBRARY_DEBUG NAMES mysqlclient libmysql
+ PATH_SUFFIXES mysql
+ ${EXTRA_FIND_ARGS})
+
+if(MYSQLCLIENT_INCLUDE_DIR AND EXISTS "${MYSQLCLIENT_INCLUDE_DIR}/mysql/mysql_version.h")
+ file(STRINGS "${MYSQLCLIENT_INCLUDE_DIR}/mysql/mysql_version.h" mysql_version_str REGEX "^#define[\t ]+LIBMYSQL_VERSION[\t ]+\".*\".*")
+ string(REGEX REPLACE "^#define[\t ]+LIBMYSQL_VERSION[\t ]+\"([^\"]+)\".*" "\\1" MYSQLCLIENT_VERSION_STRING "${mysql_version_str}")
+ unset(mysql_version_str)
+endif()
+
+include(SelectLibraryConfigurations)
+select_library_configurations(MYSQLCLIENT)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(MySqlClient
+ REQUIRED_VARS MYSQLCLIENT_LIBRARY MYSQLCLIENT_INCLUDE_DIR
+ VERSION_VAR MYSQLCLIENT_VERSION_STRING)
+
+if(MYSQLCLIENT_FOUND)
+ set(MYSQLCLIENT_LIBRARIES ${MYSQLCLIENT_LIBRARY})
+ set(MYSQLCLIENT_INCLUDE_DIRS ${MYSQLCLIENT_INCLUDE_DIR})
+ set(MYSQLCLIENT_DEFINITIONS -DHAVE_MYSQL=1)
+
+ if(NOT TARGET MySqlClient::MySqlClient)
+ add_library(MySqlClient::MySqlClient UNKNOWN IMPORTED)
+ if(MYSQLCLIENT_LIBRARY_RELEASE)
+ set_target_properties(MySqlClient::MySqlClient PROPERTIES
+ IMPORTED_CONFIGURATIONS RELEASE
+ IMPORTED_LOCATION "${MYSQLCLIENT_LIBRARY_RELEASE}")
+ endif()
+ if(MYSQLCLIENT_LIBRARY_DEBUG)
+ set_target_properties(MySqlClient::MySqlClient PROPERTIES
+ IMPORTED_CONFIGURATIONS DEBUG
+ IMPORTED_LOCATION "${MYSQLCLIENT_LIBRARY_DEBUG}")
+ endif()
+ set_target_properties(MySqlClient::MySqlClient PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${MYSQLCLIENT_INCLUDE_DIR}"
+ INTERFACE_COMPILE_DEFINITIONS HAVE_MYSQL=1)
+ endif()
+endif()
+
+mark_as_advanced(MYSQLCLIENT_INCLUDE_DIR MYSQLCLIENT_LIBRARY)
diff --git a/cmake/modules/FindNFS.cmake b/cmake/modules/FindNFS.cmake
new file mode 100644
index 0000000000..646ee33c84
--- /dev/null
+++ b/cmake/modules/FindNFS.cmake
@@ -0,0 +1,58 @@
+#.rst:
+# FindNFS
+# -------
+# Finds the libnfs library
+#
+# This will will define the following variables::
+#
+# NFS_FOUND - system has libnfs
+# NFS_INCLUDE_DIRS - the libnfs include directory
+# NFS_LIBRARIES - the libnfs libraries
+# NFS_DEFINITIONS - the libnfs compile definitions
+#
+# and the following imported targets::
+#
+# NFS::NFS - The libnfs library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_NFS libnfs QUIET)
+endif()
+
+find_path(NFS_INCLUDE_DIR nfsc/libnfs.h
+ PATHS ${PC_NFS_INCLUDEDIR})
+
+set(NFS_VERSION ${PC_NFS_VERSION})
+
+include(FindPackageHandleStandardArgs)
+if(NOT WIN32)
+ find_library(NFS_LIBRARY NAMES nfs
+ PATHS ${PC_NFS_LIBDIR})
+
+ find_package_handle_standard_args(NFS
+ REQUIRED_VARS NFS_LIBRARY NFS_INCLUDE_DIR
+ VERSION_VAR NFS_VERSION)
+else()
+ # Dynamically loaded DLL
+ find_package_handle_standard_args(NFS
+ REQUIRED_VARS NFS_INCLUDE_DIR
+ VERSION_VAR NFS_VERSION)
+endif()
+
+if(NFS_FOUND)
+ set(NFS_LIBRARIES ${NFS_LIBRARY})
+ set(NFS_INCLUDE_DIRS ${NFS_INCLUDE_DIR})
+ set(NFS_DEFINITIONS -DHAVE_LIBNFS=1)
+
+ if(NOT TARGET NFS::NFS)
+ add_library(NFS::NFS UNKNOWN IMPORTED)
+ if(NFS_LIBRARY)
+ set_target_properties(NFS::NFS PROPERTIES
+ IMPORTED_LOCATION "${NFS_LIBRARY_RELEASE}")
+ endif()
+ set_target_properties(NFS::NFS PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${NFS_INCLUDE_DIR}"
+ INTERFACE_COMPILE_DEFINITIONS HAVE_LIBNFS=1)
+ endif()
+endif()
+
+mark_as_advanced(NFS_INCLUDE_DIR NFS_LIBRARY)
diff --git a/cmake/modules/FindOpenGLES.cmake b/cmake/modules/FindOpenGLES.cmake
new file mode 100644
index 0000000000..ab06f968b3
--- /dev/null
+++ b/cmake/modules/FindOpenGLES.cmake
@@ -0,0 +1,48 @@
+#.rst:
+# FindOpenGLES
+# ------------
+# Finds the OpenGLES2 library
+#
+# This will will define the following variables::
+#
+# OPENGLES_FOUND - system has OpenGLES
+# OPENGLES_INCLUDE_DIRS - the OpenGLES include directory
+# OPENGLES_LIBRARIES - the OpenGLES libraries
+# OPENGLES_DEFINITIONS - the OpenGLES definitions
+
+find_package(EMBEDDED)
+
+if(PKG_CONFIG_FOUND AND NOT PLATFORM STREQUAL "raspberry-pi")
+ pkg_check_modules(PC_OPENGLES glesv2 QUIET)
+ if(NOT OPENGLES_FOUND AND EMBEDDED_FOUND)
+ set(CMAKE_PREFIX_PATH ${EMBEDDED_FOUND} ${CMAKE_PREFIX_PATH})
+ endif()
+endif()
+
+if(NOT CORE_SYSTEM_NAME STREQUAL ios)
+ find_path(OPENGLES_INCLUDE_DIR GLES2/gl2.h
+ PATHS ${PC_OPENGLES_INCLUDEDIR})
+ find_library(OPENGLES_gl_LIBRARY NAMES GLESv2
+ PATHS ${PC_OPENGLES_LIBDIR})
+ find_library(OPENGLES_egl_LIBRARY NAMES EGL
+ PATHS ${PC_OPENGLES_LIBDIR})
+else()
+ find_library(OPENGLES_gl_LIBRARY NAMES OpenGLES
+ PATHS ${CMAKE_OSX_SYSROOT}/System/Library
+ PATH_SUFFIXES Frameworks
+ NO_DEFAULT_PATH)
+ set(OPENGLES_INCLUDE_DIR ${OPENGLES_gl_LIBRARY}/Headers)
+ set(OPENGLES_egl_LIBRARY ${OPENGLES_gl_LIBRARY})
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(OpenGLES
+ REQUIRED_VARS OPENGLES_gl_LIBRARY OPENGLES_egl_LIBRARY OPENGLES_INCLUDE_DIR)
+
+if(OPENGLES_FOUND)
+ set(OPENGLES_INCLUDE_DIRS ${OPENGLES_INCLUDE_DIR})
+ set(OPENGLES_LIBRARIES ${OPENGLES_gl_LIBRARY} ${OPENGLES_egl_LIBRARY})
+ set(OPENGLES_DEFINITIONS -DHAVE_LIBGLESV2 -DHAVE_LIBEGL=1)
+endif()
+
+mark_as_advanced(OPENGLES_INCLUDE_DIR OPENGLES_gl_LIBRARY OPENGLES_egl_LIBRARY)
diff --git a/cmake/modules/FindOpenGl.cmake b/cmake/modules/FindOpenGl.cmake
new file mode 100644
index 0000000000..b8cff79daf
--- /dev/null
+++ b/cmake/modules/FindOpenGl.cmake
@@ -0,0 +1,43 @@
+#.rst:
+# FindOpenGl
+# ----------
+# Finds the FindOpenGl library
+#
+# This will will define the following variables::
+#
+# OPENGL_FOUND - system has OpenGl
+# OPENGL_INCLUDE_DIRS - the OpenGl include directory
+# OPENGL_LIBRARIES - the OpenGl libraries
+# OPENGL_DEFINITIONS - the OpenGl definitions
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_OPENGL gl glu QUIET)
+endif()
+
+if(NOT CORE_SYSTEM_NAME STREQUAL osx)
+ find_path(OPENGL_INCLUDE_DIR GL/gl.h
+ PATHS ${PC_OPENGL_gl_INCLUDEDIR})
+ find_library(OPENGL_gl_LIBRARY NAMES GL
+ PATHS ${PC_OPENGL_gl_LIBDIR})
+ find_library(OPENGL_glu_LIBRARY NAMES GLU
+ PATHS ${PC_OPENGL_glu_LIBDIR})
+else()
+ find_library(OPENGL_gl_LIBRARY NAMES OpenGL
+ PATHS ${CMAKE_OSX_SYSROOT}/System/Library
+ PATH_SUFFIXES Frameworks
+ NO_DEFAULT_PATH)
+ set(OPENGL_INCLUDE_DIR ${OPENGL_gl_LIBRARY}/Headers)
+ set(OPENGL_glu_LIBRARY ${OPENGL_gl_LIBRARY})
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(OpenGl
+ REQUIRED_VARS OPENGL_gl_LIBRARY OPENGL_glu_LIBRARY OPENGL_INCLUDE_DIR)
+
+if(OPENGL_FOUND)
+ set(OPENGL_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR})
+ set(OPENGL_LIBRARIES ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
+ set(OPENGL_DEFINITIONS -DHAVE_LIBGL=1)
+endif()
+
+mark_as_advanced(OPENGL_INCLUDE_DIR OPENGL_gl_LIBRARY OPENGL_glu_LIBRARY)
diff --git a/cmake/modules/FindPCRE.cmake b/cmake/modules/FindPCRE.cmake
new file mode 100644
index 0000000000..8babed3b60
--- /dev/null
+++ b/cmake/modules/FindPCRE.cmake
@@ -0,0 +1,87 @@
+#.rst:
+# FindPCRE
+# --------
+# Finds the PCRECPP library
+#
+# This will will define the following variables::
+#
+# PCRE_FOUND - system has libpcrecpp
+# PCRE_INCLUDE_DIRS - the libpcrecpp include directory
+# PCRE_LIBRARIES - the libpcrecpp libraries
+# PCRE_DEFINITIONS - the libpcrecpp definitions
+#
+# and the following imported targets::
+#
+# PCRE::PCRECPP - The PCRECPP library
+# PCRE::PCRE - The PCRE library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_PCRE libpcrecpp QUIET)
+endif()
+
+find_path(PCRE_INCLUDE_DIR pcrecpp.h
+ PATHS ${PC_PCRE_INCLUDEDIR})
+find_library(PCRECPP_LIBRARY_RELEASE NAMES pcrecpp
+ PATHS ${PC_PCRE_LIBDIR})
+find_library(PCRE_LIBRARY_RELEASE NAMES pcre
+ PATHS ${PC_PCRE_LIBDIR})
+find_library(PCRECPP_LIBRARY_DEBUG NAMES pcrecppd
+ PATHS ${PC_PCRE_LIBDIR})
+find_library(PCRE_LIBRARY_DEBUG NAMES pcred
+ PATHS ${PC_PCRE_LIBDIR})
+set(PCRE_VERSION ${PC_PCRE_VERSION})
+
+include(SelectLibraryConfigurations)
+select_library_configurations(PCRECPP)
+select_library_configurations(PCRE)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(PCRE
+ REQUIRED_VARS PCRECPP_LIBRARY PCRE_LIBRARY PCRE_INCLUDE_DIR
+ VERSION_VAR PCRE_VERSION)
+
+if(PCRE_FOUND)
+ set(PCRE_LIBRARIES ${PCRECPP_LIBRARY} ${PCRE_LIBRARY})
+ set(PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIR})
+ if(WIN32)
+ set(PCRE_DEFINITIONS -DPCRE_STATIC=1)
+ endif()
+
+ if(NOT TARGET PCRE::PCRE)
+ add_library(PCRE::PCRE UNKNOWN IMPORTED)
+ if(PCRE_LIBRARY_RELEASE)
+ set_target_properties(PCRE::PCRE PROPERTIES
+ IMPORTED_CONFIGURATIONS RELEASE
+ IMPORTED_LOCATION "${PCRE_LIBRARY_RELEASE}")
+ endif()
+ if(PCRE_LIBRARY_DEBUG)
+ set_target_properties(PCRE::PCRE PROPERTIES
+ IMPORTED_CONFIGURATIONS DEBUG
+ IMPORTED_LOCATION "${PCRE_LIBRARY_DEBUG}")
+ endif()
+ set_target_properties(PCRE::PCRE PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${PCRE_INCLUDE_DIR}")
+ if(WIN32)
+ set_target_properties(PCRE::PCRE PROPERTIES
+ INTERFACE_COMPILE_DEFINITIONS PCRE_STATIC=1)
+ endif()
+
+ endif()
+ if(NOT TARGET PCRE::PCRECPP)
+ add_library(PCRE::PCRECPP UNKNOWN IMPORTED)
+ if(PCRE_LIBRARY_RELEASE)
+ set_target_properties(PCRE::PCRECPP PROPERTIES
+ IMPORTED_CONFIGURATIONS RELEASE
+ IMPORTED_LOCATION "${PCRECPP_LIBRARY_RELEASE}")
+ endif()
+ if(PCRE_LIBRARY_DEBUG)
+ set_target_properties(PCRE::PCRECPP PROPERTIES
+ IMPORTED_CONFIGURATIONS DEBUG
+ IMPORTED_LOCATION "${PCRECPP_LIBRARY_DEBUG}")
+ endif()
+ set_target_properties(PCRE::PCRECPP PROPERTIES
+ INTERFACE_LINK_LIBRARIES PCRE::PCRE)
+ endif()
+endif()
+
+mark_as_advanced(PCRE_INCLUDE_DIR PCRECPP_LIBRARY PCRE_LIBRARY)
diff --git a/cmake/modules/FindPlist.cmake b/cmake/modules/FindPlist.cmake
new file mode 100644
index 0000000000..d7a6c48e36
--- /dev/null
+++ b/cmake/modules/FindPlist.cmake
@@ -0,0 +1,58 @@
+#.rst:
+# FindPlist
+# ---------
+# Finds the Plist library
+#
+# This will will define the following variables::
+#
+# PLIST_FOUND - system has Plist library
+# PLIST_INCLUDE_DIRS - the Plist library include directory
+# PLIST_LIBRARIES - the Plist libraries
+# PLIST_DEFINITIONS - the Plist compile definitions
+#
+# and the following imported targets::
+#
+# Plist::Plist - The Plist library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_PLIST libplist QUIET)
+endif()
+
+find_path(PLIST_INCLUDE_DIR plist/plist.h
+ PATHS ${PC_PLIST_INCLUDEDIR})
+
+set(PLIST_VERSION ${PC_PLIST_VERSION})
+
+include(FindPackageHandleStandardArgs)
+if(NOT WIN32)
+ find_library(PLIST_LIBRARY NAMES plist
+ PATHS ${PC_PLIST_LIBDIR})
+
+ find_package_handle_standard_args(PLIST
+ REQUIRED_VARS PLIST_LIBRARY PLIST_INCLUDE_DIR
+ VERSION_VAR PLIST_VERSION)
+else()
+ # Dynamically loaded DLL
+ find_package_handle_standard_args(PLIST
+ REQUIRED_VARS PLIST_INCLUDE_DIR
+ VERSION_VAR PLIST_VERSION)
+endif()
+
+if(PLIST_FOUND)
+ set(PLIST_LIBRARIES ${PLIST_LIBRARY})
+ set(PLIST_INCLUDE_DIRS ${PLIST_INCLUDE_DIR})
+ set(PLIST_DEFINITIONS -DHAVE_LIBPLIST=1)
+
+ if(NOT TARGET Plist::Plist)
+ add_library(Plist::Plist UNKNOWN IMPORTED)
+ if(PLIST_LIBRARY)
+ set_target_properties(Plist::Plist PROPERTIES
+ IMPORTED_LOCATION "${PLIST_LIBRARY}")
+ endif()
+ set_target_properties(Plist::Plist PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${PLIST_INCLUDE_DIR}"
+ INTERFACE_COMPILE_DEFINITIONS HAVE_LIBPLIST=1)
+ endif()
+endif()
+
+mark_as_advanced(PLIST_INCLUDE_DIR PLIST_LIBRARY)
diff --git a/cmake/modules/FindPulseAudio.cmake b/cmake/modules/FindPulseAudio.cmake
new file mode 100644
index 0000000000..5761005e7a
--- /dev/null
+++ b/cmake/modules/FindPulseAudio.cmake
@@ -0,0 +1,68 @@
+#.rst:
+# FindPulseAudio
+# --------------
+# Finds the PulseAudio library
+#
+# This will define the following variables::
+#
+# PULSEAUDIO_FOUND - system has the PulseAudio library
+# PULSEAUDIO_INCLUDE_DIRS - the PulseAudio include directory
+# PULSEAUDIO_LIBRARIES - the libraries needed to use PulseAudio
+# PULSEAUDIO_DEFINITIONS - the definitions needed to use PulseAudio
+#
+# and the following imported targets::
+#
+# PulseAudio::PulseAudio - The PulseAudio library
+
+if(NOT PulseAudio_FIND_VERSION)
+ set(PulseAudio_FIND_VERSION 2.0.0)
+endif()
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_PULSEAUDIO libpulse>=${PulseAudio_FIND_VERSION} QUIET)
+ pkg_check_modules(PC_PULSEAUDIO_MAINLOOP libpulse-mainloop-glib QUIET)
+endif()
+
+find_path(PULSEAUDIO_INCLUDE_DIR NAMES pulse/pulseaudio.h
+ PATHS ${PC_PULSEAUDIO_INCLUDEDIR} ${PC_PULSEAUDIO_INCLUDE_DIRS})
+
+find_library(PULSEAUDIO_LIBRARY NAMES pulse libpulse
+ PATHS ${PC_PULSEAUDIO_LIBDIR} ${PC_PULSEAUDIO_LIBRARY_DIRS})
+
+find_library(PULSEAUDIO_MAINLOOP_LIBRARY NAMES pulse-mainloop pulse-mainloop-glib libpulse-mainloop-glib
+ PATHS ${PC_PULSEAUDIO_LIBDIR} ${PC_PULSEAUDIO_LIBRARY_DIRS})
+
+if(PC_PULSEAUDIO_VERSION)
+ set(PULSEAUDIO_VERSION_STRING ${PC_PULSEAUDIO_VERSION})
+elseif(PULSEAUDIO_INCLUDE_DIR AND EXISTS "${PULSEAUDIO_INCLUDE_DIR}/pulse/version.h")
+ file(STRINGS "${PULSEAUDIO_INCLUDE_DIR}/pulse/version.h" pulseaudio_version_str REGEX "^#define[\t ]+pa_get_headers_version\\(\\)[\t ]+\\(\".*\"\\).*")
+ string(REGEX REPLACE "^#define[\t ]+pa_get_headers_version\\(\\)[\t ]+\\(\"([^\"]+)\"\\).*" "\\1" PULSEAUDIO_VERSION_STRING "${pulseaudio_version_str}")
+ unset(pulseaudio_version_str)
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(PulseAudio
+ REQUIRED_VARS PULSEAUDIO_LIBRARY PULSEAUDIO_MAINLOOP_LIBRARY PULSEAUDIO_INCLUDE_DIR
+ VERSION_VAR PULSEAUDIO_VERSION_STRING)
+
+if(PULSEAUDIO_FOUND)
+ set(PULSEAUDIO_INCLUDE_DIRS ${PULSEAUDIO_INCLUDE_DIR})
+ set(PULSEAUDIO_LIBRARIES ${PULSEAUDIO_LIBRARY} ${PULSEAUDIO_MAINLOOP_LIBRARY})
+ set(PULSEAUDIO_DEFINITIONS -DHAVE_LIBPULSE=1)
+
+ if(NOT TARGET PulseAudio::PulseAudioMainloop)
+ add_library(PulseAudio::PulseAudioMainloop UNKNOWN IMPORTED)
+ set_target_properties(PulseAudio::PulseAudioMainloop PROPERTIES
+ IMPORTED_LOCATION "${PULSEAUDIO_MAINLOOP_LIBRARY}")
+ endif()
+ if(NOT TARGET PulseAudio::PulseAudio)
+ add_library(PulseAudio::PulseAudio UNKNOWN IMPORTED)
+ set_target_properties(PulseAudio::PulseAudio PROPERTIES
+ IMPORTED_LOCATION "${PULSEAUDIO_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${PULSEAUDIO_INCLUDE_DIR}"
+ INTERFACE_COMPILE_DEFINITIONS HAVE_LIBPULSE=1
+ INTERFACE_LINK_LIBRARIES PulseAudio::PulseAudioMainloop)
+ endif()
+endif()
+
+mark_as_advanced(PULSEAUDIO_INCLUDE_DIR PULSEAUDIO_LIBRARY PULSEAUDIO_MAINLOOP_LIBRARY)
diff --git a/cmake/modules/FindPython.cmake b/cmake/modules/FindPython.cmake
new file mode 100644
index 0000000000..75dcd6cfbb
--- /dev/null
+++ b/cmake/modules/FindPython.cmake
@@ -0,0 +1,39 @@
+# - Try to find python
+# Once done this will define
+#
+# PYTHON_FOUND - system has PYTHON
+# PYTHON_INCLUDE_DIRS - the python include directory
+# PYTHON_LIBRARIES - The python libraries
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_PYTHON python>=2.7 QUIET)
+endif()
+
+find_program(PYTHON_EXECUTABLE python ONLY_CMAKE_FIND_ROOT_PATH)
+find_library(PYTHON_LIBRARY NAMES python2.7 PATHS ${PC_PYTHON_LIBDIR})
+find_path(PYTHON_INCLUDE_DIR NAMES Python.h PATHS ${PC_PYTHON_INCLUDE_DIRS} ${DEPENDS_PATH}/include/python2.7)
+
+if(KODI_DEPENDSBUILD)
+ find_library(FFI_LIBRARY ffi REQUIRED)
+ find_library(EXPAT_LIBRARY expat REQUIRED)
+ find_library(INTL_LIBRARY intl REQUIRED)
+ find_library(GMP_LIBRARY gmp REQUIRED)
+
+ if(NOT CORE_SYSTEM_NAME STREQUAL android)
+ set(PYTHON_DEP_LIBRARIES pthread dl util)
+ endif()
+
+ set(PYTHON_LIBRARIES ${PYTHON_LIBRARY} ${FFI_LIBRARY} ${EXPAT_LIBRARY} ${INTL_LIBRARY} ${GMP_LIBRARY} ${PYTHON_DEP_LIBRARIES})
+else()
+ find_package(PythonLibs 2.7 REQUIRED)
+ list(APPEND PYTHON_LIBRARIES ${PC_PYTHON_STATIC_LIBRARIES})
+endif()
+
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(PYTHON REQUIRED_VARS PYTHON_INCLUDE_DIR PYTHON_LIBRARY PYTHON_LIBRARIES)
+if(PYTHON_FOUND)
+ set(PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIR})
+endif()
+
+mark_as_advanced(PYTHON_EXECUTABLE PYTHON_INCLUDE_DIRS PYTHON_INCLUDE_DIR PYTHON_LIBRARY PYTHON_LIBRARIES PYTHON_LDFLAGS FFI_LIBRARY EXPAT_LIBRARY INTL_LIBRARY GMP_LIBRARY)
diff --git a/cmake/modules/FindSSE.cmake b/cmake/modules/FindSSE.cmake
new file mode 100644
index 0000000000..055466367b
--- /dev/null
+++ b/cmake/modules/FindSSE.cmake
@@ -0,0 +1,143 @@
+# Check if SSE instructions are available on the machine where
+# the project is compiled.
+include(TestCXXAcceptsFlag)
+
+if(CMAKE_SYSTEM_NAME MATCHES "Linux")
+ if(CPU MATCHES "x86_64" OR CPU MATCHES "i.86")
+ exec_program(cat ARGS "/proc/cpuinfo" OUTPUT_VARIABLE CPUINFO)
+
+ string(REGEX REPLACE "^.*(sse).*$" "\\1" _SSE_THERE ${CPUINFO})
+ string(COMPARE EQUAL "sse" "${_SSE_THERE}" _SSE_TRUE)
+ CHECK_CXX_ACCEPTS_FLAG("-msse" _SSE_OK)
+
+ string(REGEX REPLACE "^.*(sse2).*$" "\\1" _SSE_THERE ${CPUINFO})
+ string(COMPARE EQUAL "sse2" "${_SSE_THERE}" _SSE2_TRUE)
+ CHECK_CXX_ACCEPTS_FLAG("-msse2" _SSE2_OK)
+
+ # /proc/cpuinfo apparently omits sse3 :(
+ string(REGEX REPLACE "^.*[^s](sse3).*$" "\\1" _SSE_THERE ${CPUINFO})
+ string(COMPARE EQUAL "sse3" "${_SSE_THERE}" _SSE3_TRUE)
+ if(NOT _SSE3_TRUE)
+ string(REGEX REPLACE "^.*(T2300).*$" "\\1" _SSE_THERE ${CPUINFO})
+ string(COMPARE EQUAL "T2300" "${_SSE_THERE}" _SSE3_TRUE)
+ endif()
+ CHECK_CXX_ACCEPTS_FLAG("-msse3" _SSE3_OK)
+
+ string(REGEX REPLACE "^.*(ssse3).*$" "\\1" _SSE_THERE ${CPUINFO})
+ string(COMPARE EQUAL "ssse3" "${_SSE_THERE}" _SSSE3_TRUE)
+ CHECK_CXX_ACCEPTS_FLAG("-mssse3" _SSSE3_OK)
+
+ string(REGEX REPLACE "^.*(sse4_1).*$" "\\1" _SSE_THERE ${CPUINFO})
+ string(COMPARE EQUAL "sse4_1" "${_SSE_THERE}" _SSE41_TRUE)
+ CHECK_CXX_ACCEPTS_FLAG("-msse4.1" _SSE41_OK)
+
+ string(REGEX REPLACE "^.*(sse4_2).*$" "\\1" _SSE_THERE ${CPUINFO})
+ string(COMPARE EQUAL "sse4_2" "${_SSE_THERE}" _SSE42_TRUE)
+ CHECK_CXX_ACCEPTS_FLAG("-msse4.2" _SSE42_OK)
+
+ string(REGEX REPLACE "^.*(avx).*$" "\\1" _SSE_THERE ${CPUINFO})
+ string(COMPARE EQUAL "avx" "${_SSE_THERE}" _AVX_TRUE)
+ CHECK_CXX_ACCEPTS_FLAG("-mavx" _AVX_OK)
+
+ string(REGEX REPLACE "^.*(avx2).*$" "\\1" _SSE_THERE ${CPUINFO})
+ string(COMPARE EQUAL "avx2" "${_SSE_THERE}" _AVX2_TRUE)
+ CHECK_CXX_ACCEPTS_FLAG("-mavx2" _AVX2_OK)
+ endif()
+elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
+ if(NOT CPU MATCHES "arm")
+ exec_program("/usr/sbin/sysctl -n machdep.cpu.features machdep.cpu.leaf7_features" OUTPUT_VARIABLE CPUINFO)
+
+ string(REGEX REPLACE "^.*[^S](SSE).*$" "\\1" _SSE_THERE ${CPUINFO})
+ string(COMPARE EQUAL "SSE" "${_SSE_THERE}" _SSE_TRUE)
+ CHECK_CXX_ACCEPTS_FLAG("-msse" _SSE_OK)
+
+ string(REGEX REPLACE "^.*[^S](SSE2).*$" "\\1" _SSE_THERE ${CPUINFO})
+ string(COMPARE EQUAL "SSE2" "${_SSE_THERE}" _SSE2_TRUE)
+ CHECK_CXX_ACCEPTS_FLAG("-msse2" _SSE2_OK)
+
+ string(REGEX REPLACE "^.*[^S](SSE3).*$" "\\1" _SSE_THERE ${CPUINFO})
+ string(COMPARE EQUAL "SSE3" "${_SSE_THERE}" _SSE3_TRUE)
+ CHECK_CXX_ACCEPTS_FLAG("-msse3" _SSE3_OK)
+
+ string(REGEX REPLACE "^.*(SSSE3).*$" "\\1" _SSE_THERE ${CPUINFO})
+ string(COMPARE EQUAL "SSSE3" "${_SSE_THERE}" _SSSE3_TRUE)
+ CHECK_CXX_ACCEPTS_FLAG("-mssse3" _SSSE3_OK)
+
+ string(REGEX REPLACE "^.*(SSE4.1).*$" "\\1" _SSE_THERE ${CPUINFO})
+ string(COMPARE EQUAL "SSE4.1" "${_SSE_THERE}" _SSE41_TRUE)
+ CHECK_CXX_ACCEPTS_FLAG("-msse4.1" _SSE41_OK)
+
+ string(REGEX REPLACE "^.*(SSE4.2).*$" "\\1" _SSE_THERE ${CPUINFO})
+ string(COMPARE EQUAL "SSE4.2" "${_SSE_THERE}" _SSE42_TRUE)
+ CHECK_CXX_ACCEPTS_FLAG("-msse4.2" _SSE42_OK)
+
+ string(REGEX REPLACE "^.*(AVX).*$" "\\1" _SSE_THERE ${CPUINFO})
+ string(COMPARE EQUAL "AVX" "${_SSE_THERE}" _AVX_TRUE)
+ CHECK_CXX_ACCEPTS_FLAG("-mavx" _AVX_OK)
+
+ string(REGEX REPLACE "^.*(AVX2).*$" "\\1" _SSE_THERE ${CPUINFO})
+ string(COMPARE EQUAL "AVX2" "${_SSE_THERE}" _AVX2_TRUE)
+ CHECK_CXX_ACCEPTS_FLAG("-mavx2" _AVX2_OK)
+ endif()
+elseif(CMAKE_SYSTEM_NAME MATCHES "Windows")
+ # TODO
+ set(_SSE_TRUE true)
+ set(_SSE_OK true)
+ set(_SSE2_TRUE true)
+ set(_SSE2_OK true)
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(SSE
+ REQUIRED_VARS _SSE_TRUE _SSE_OK
+ FAIL_MESSAGE "Could not find hardware support for SSE")
+find_package_handle_standard_args(SSE2
+ REQUIRED_VARS _SSE2_TRUE _SSE2_OK
+ FAIL_MESSAGE "Could not find hardware support for SSE2")
+find_package_handle_standard_args(SSE3
+ REQUIRED_VARS _SSE3_TRUE _SSE3_OK
+ FAIL_MESSAGE "Could not find hardware support for SSE3")
+find_package_handle_standard_args(SSSE3
+ REQUIRED_VARS _SSSE3_TRUE _SSSE3_OK
+ FAIL_MESSAGE "Could not find hardware support for SSSE3")
+find_package_handle_standard_args(SSE4_1
+ REQUIRED_VARS _SSE41_TRUE _SSE41_OK
+ FAIL_MESSAGE "Could not find hardware support for SSE4.1")
+find_package_handle_standard_args(SSE4_2
+ REQUIRED_VARS _SSE42_TRUE _SSE42_OK
+ FAIL_MESSAGE "Could not find hardware support for SSE4.2")
+find_package_handle_standard_args(AVX
+ REQUIRED_VARS _AVX_TRUE _AVX_OK
+ FAIL_MESSAGE "Could not find hardware support for AVX")
+find_package_handle_standard_args(AVX2
+ REQUIRED_VARS _AVX2_TRUE _AVX2_OK
+ FAIL_MESSAGE "Could not find hardware support for AVX2")
+
+mark_as_advanced(SSE2_FOUND SSE3_FOUND SSSE3_FOUND SSE4_1_FOUND SSE4_2_FOUND AVX_FOUND AVX2_FOUND)
+
+unset(_SSE_THERE)
+unset(_SSE_TRUE)
+unset(_SSE_OK)
+unset(_SSE_OK CACHE)
+unset(_SSE2_TRUE)
+unset(_SSE2_OK)
+unset(_SSE2_OK CACHE)
+unset(_SSE3_TRUE)
+unset(_SSE3_OK)
+unset(_SSE3_OK CACHE)
+unset(_SSSE3_TRUE)
+unset(_SSSE3_OK)
+unset(_SSSE3_OK CACHE)
+unset(_SSE4_1_TRUE)
+unset(_SSE41_OK)
+unset(_SSE41_OK CACHE)
+unset(_SSE4_2_TRUE)
+unset(_SSE42_OK)
+unset(_SSE42_OK CACHE)
+unset(_AVX_TRUE)
+unset(_AVX_OK)
+unset(_AVX_OK CACHE)
+unset(_AVX2_TRUE)
+unset(_AVX2_OK)
+unset(_AVX2_OK CACHE)
+
diff --git a/cmake/modules/FindSSH.cmake b/cmake/modules/FindSSH.cmake
new file mode 100644
index 0000000000..538c699a2d
--- /dev/null
+++ b/cmake/modules/FindSSH.cmake
@@ -0,0 +1,47 @@
+#.rst:
+# FindSSH
+# -------
+# Finds the SSH library
+#
+# This will will define the following variables::
+#
+# SSH_FOUND - system has SSH
+# SSH_INCLUDE_DIRS - the SSH include directory
+# SSH_LIBRARIES - the SSH libraries
+# SSH_DEFINITIONS - the SSH definitions
+#
+# and the following imported targets::
+#
+# SSH::SSH - The SSH library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_SSH libssh QUIET)
+endif()
+
+find_path(SSH_INCLUDE_DIR NAMES libssh/libssh.h
+ PATHS ${PC_SSH_INCLUDEDIR})
+find_library(SSH_LIBRARY NAMES ssh
+ PATHS ${PC_SSH_LIBDIR})
+
+set(SSH_VERSION ${PC_SSH_VERSION})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(SSH
+ REQUIRED_VARS SSH_LIBRARY SSH_INCLUDE_DIR
+ VERSION_VAR SSH_VERSION)
+
+if(SSH_FOUND)
+ set(SSH_LIBRARIES ${SSH_LIBRARY})
+ set(SSH_INCLUDE_DIRS ${SSH_INCLUDE_DIR})
+ set(SSH_DEFINITIONS -DHAVE_LIBSSH=1)
+
+ if(NOT TARGET SSH::SSH)
+ add_library(SSH::SSH UNKNOWN IMPORTED)
+ set_target_properties(SSH::SSH PROPERTIES
+ IMPORTED_LOCATION "${SSH_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${SSH_INCLUDE_DIR}"
+ INTERFACE_COMPILE_DEFINITIONS HAVE_LIBSSH=1)
+ endif()
+endif()
+
+mark_as_advanced(SSH_INCLUDE_DIR SSH_LIBRARY)
diff --git a/cmake/modules/FindSWIG.cmake b/cmake/modules/FindSWIG.cmake
new file mode 100644
index 0000000000..523b49bd82
--- /dev/null
+++ b/cmake/modules/FindSWIG.cmake
@@ -0,0 +1,29 @@
+#.rst:
+# FindSWIG
+# --------
+# Finds the SWIG executable
+#
+# This will will define the following variables::
+#
+# SWIG_FOUND - system has SWIG
+# SWIG_EXECUTABLE - the SWIG executable
+
+find_program(SWIG_EXECUTABLE NAMES swig3.0 swig2.0 swig
+ PATH_SUFFIXES swig)
+if(SWIG_EXECUTABLE)
+ execute_process(COMMAND ${SWIG_EXECUTABLE} -swiglib
+ OUTPUT_VARIABLE SWIG_DIR
+ ERROR_VARIABLE SWIG_swiglib_error
+ RESULT_VARIABLE SWIG_swiglib_result)
+ execute_process(COMMAND ${SWIG_EXECUTABLE} -version
+ OUTPUT_VARIABLE SWIG_version_output
+ ERROR_VARIABLE SWIG_version_output
+ RESULT_VARIABLE SWIG_version_result)
+ string(REGEX REPLACE ".*SWIG Version[^0-9.]*\([0-9.]+\).*" "\\1"
+ SWIG_VERSION "${SWIG_version_output}")
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(SWIG
+ REQUIRED_VARS SWIG_EXECUTABLE SWIG_DIR
+ VERSION_VAR SWIG_VERSION)
diff --git a/cmake/modules/FindSdl.cmake b/cmake/modules/FindSdl.cmake
new file mode 100644
index 0000000000..91bcac5bf7
--- /dev/null
+++ b/cmake/modules/FindSdl.cmake
@@ -0,0 +1,46 @@
+#.rst:
+# FindSDL
+# -------
+# Finds the SDL library
+#
+# This will will define the following variables::
+#
+# SDL_FOUND - system has SDL
+# SDL_INCLUDE_DIRS - the SDL include directory
+# SDL_LIBRARIES - the SDL libraries
+# SDL_DEFINITIONS - the SDL compile definitions
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_SDL2 sdl2 QUIET)
+ if(PC_SDL2_FOUND)
+ set(SDL_VERSION ${PC_SDL2_VERSION})
+ else()
+ pkg_check_modules(PC_SDL1 sdl QUIET)
+ if(PC_SDL1_FOUND)
+ set(SDL_VERSION ${PC_SDL1_VERSION})
+ endif()
+ endif()
+endif()
+
+find_path(SDL_INCLUDE_DIR SDL/SDL.h
+ PATHS ${PC_SDL2_INCLUDE_DIR} ${PC_SDL1_INCLUDE_DIR})
+find_library(SDL_LIBRARY NAMES SDL2 SDL
+ PATHS ${PC_SDL2_LIBDIR} ${PC_SDL1_LIBDIR})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Sdl REQUIRED_VARS SDL_LIBRARY SDL_INCLUDE_DIR
+ VERSION_VAR SDL_VERSION)
+
+if(SDL_FOUND)
+ set(SDL_LIBRARIES ${SDL_LIBRARY})
+ set(SDL_INCLUDE_DIRS ${SDL_INCLUDE_DIR})
+ set(SDL_DEFINITIONS -DHAVE_SDL=1)
+
+ if(SDL_VERSION VERSION_GREATER 2)
+ list(APPEND SDL_DEFINITIONS -DHAVE_SDL_VERSION=2)
+ elseif(SDL_VERSION VERSION_GREATER 1)
+ list(APPEND SDL_DEFINITIONS -DHAVE_SDL_VERSION=1)
+ endif()
+endif()
+
+mark_as_advanced(SDL_LIBRARY SDL_INCLUDE_DIR)
diff --git a/cmake/modules/FindShairplay.cmake b/cmake/modules/FindShairplay.cmake
new file mode 100644
index 0000000000..87d3107f60
--- /dev/null
+++ b/cmake/modules/FindShairplay.cmake
@@ -0,0 +1,63 @@
+#.rst:
+# FindShairplay
+# -------------
+# Finds the Shairplay library
+#
+# This will will define the following variables::
+#
+# SHAIRPLAY_FOUND - system has Shairplay
+# SHAIRPLAY_INCLUDE_DIRS - the Shairplay include directory
+# SHAIRPLAY_LIBRARIES - the Shairplay libraries
+# SHAIRPLAY_DEFINITIONS - the Shairplay compile definitions
+#
+# and the following imported targets::
+#
+# Shairplay::Shairplay - The Shairplay library
+
+find_path(SHAIRPLAY_INCLUDE_DIR shairplay/raop.h)
+
+include(FindPackageHandleStandardArgs)
+if(NOT WIN32)
+ find_library(SHAIRPLAY_LIBRARY NAMES shairplay)
+
+ if(SHAIRPLAY_INCLUDE_DIR AND SHAIRPLAY_LIBRARY)
+ include(CheckCSourceCompiles)
+ set(CMAKE_REQUIRED_INCLUDES ${SHAIRPLAY_INCLUDE_DIRS})
+ set(CMAKE_REQUIRED_LIBRARIES ${SHAIRPLAY_LIBRARIES})
+ check_c_source_compiles("#include <shairplay/raop.h>
+
+ int main()
+ {
+ struct raop_callbacks_s foo;
+ foo.cls;
+ return 0;
+ }
+ " HAVE_SHAIRPLAY_CALLBACK_CLS)
+ endif()
+
+ find_package_handle_standard_args(Shairplay
+ REQUIRED_VARS SHAIRPLAY_LIBRARY SHAIRPLAY_INCLUDE_DIR HAVE_SHAIRPLAY_CALLBACK_CLS)
+else()
+ # Dynamically loaded DLL
+ find_package_handle_standard_args(Shairplay
+ REQUIRED_VARS SHAIRPLAY_INCLUDE_DIR)
+endif()
+
+if(SHAIRPLAY_FOUND)
+ set(SHAIRPLAY_LIBRARIES ${SHAIRPLAY_LIBRARY})
+ set(SHAIRPLAY_INCLUDE_DIRS ${SHAIRPLAY_INCLUDE_DIR})
+ set(SHAIRPLAY_DEFINITIONS -DHAVE_LIBSHAIRPLAY=1)
+
+ if(NOT TARGET Shairplay::Shairplay)
+ add_library(Shairplay::Shairplay UNKNOWN IMPORTED)
+ if(SHAIRPLAY_LIBRARY)
+ set_target_properties(Shairplay::Shairplay PROPERTIES
+ IMPORTED_LOCATION "${SHAIRPLAY_LIBRARY}")
+ endif()
+ set_target_properties(Shairplay::Shairplay PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${SHAIRPLAY_INCLUDE_DIR}"
+ INTERFACE_COMPILE_DEFINITIONS HAVE_LIBSHAIRPLAY=1)
+ endif()
+endif()
+
+mark_as_advanced(SHAIRPLAY_INCLUDE_DIR SHAIRPLAY_LIBRARY)
diff --git a/cmake/modules/FindSmbClient.cmake b/cmake/modules/FindSmbClient.cmake
new file mode 100644
index 0000000000..6455cce3a1
--- /dev/null
+++ b/cmake/modules/FindSmbClient.cmake
@@ -0,0 +1,47 @@
+#.rst:
+# FindSmbClient
+# -------------
+# Finds the SMB Client library
+#
+# This will will define the following variables::
+#
+# SMBCLIENT_FOUND - system has SmbClient
+# SMBCLIENT_INCLUDE_DIRS - the SmbClient include directory
+# SMBCLIENT_LIBRARIES - the SmbClient libraries
+# SMBCLIENT_DEFINITIONS - the SmbClient definitions
+#
+# and the following imported targets::
+#
+# SmbClient::SmbClient - The SmbClient library
+
+if(PKGCONFIG_FOUND)
+ pkg_check_modules(PC_SMBCLIENT smbclient QUIET)
+endif()
+
+find_path(SMBCLIENT_INCLUDE_DIR NAMES libsmbclient.h
+ PATHS ${PC_SMBCLIENT_INCLUDEDIR})
+find_library(SMBCLIENT_LIBRARY NAMES smbclient
+ PATHS ${PC_SMBCLIENT_LIBDIR})
+
+set(SMBCLIENT_VERSION ${PC_SMBCLIENT_VERSION})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(SmbClient
+ REQUIRED_VARS SMBCLIENT_LIBRARY SMBCLIENT_INCLUDE_DIR
+ VERSION_VAR SMBCLIENT_VERSION)
+
+if(SMBCLIENT_FOUND)
+ set(SMBCLIENT_LIBRARIES ${SMBCLIENT_LIBRARY})
+ set(SMBCLIENT_INCLUDE_DIRS ${SMBCLIENT_INCLUDE_DIR})
+ set(SMBCLIENT_DEFINITIONS -DHAVE_LIBSMBCLIENT=1)
+
+ if(NOT TARGET SmbClient::SmbClient)
+ add_library(SmbClient::SmbClient UNKNOWN IMPORTED)
+ set_target_properties(SmbClient::SmbClient PROPERTIES
+ IMPORTED_LOCATION "${SMBCLIENT_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${SMBCLIENT_INCLUDE_DIR}"
+ INTERFACE_COMPILE_DEFINITIONS HAVE_LIBSMBCLIENT=1)
+ endif()
+endif()
+
+mark_as_advanced(LIBSMBCLIENT_INCLUDE_DIR LIBSMBCLIENT_LIBRARY)
diff --git a/cmake/modules/FindSqlite3.cmake b/cmake/modules/FindSqlite3.cmake
new file mode 100644
index 0000000000..abde0cff0a
--- /dev/null
+++ b/cmake/modules/FindSqlite3.cmake
@@ -0,0 +1,44 @@
+#.rst:
+# FindSqlite3
+# -----------
+# Finds the SQLite3 library
+#
+# This will will define the following variables::
+#
+# SQLITE3_FOUND - system has SQLite3
+# SQLITE3_INCLUDE_DIRS - the SQLite3 include directory
+# SQLITE3_LIBRARIES - the SQLite3 libraries
+#
+# and the following imported targets::
+#
+# SQLite3::SQLite3 - The SQLite3 library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_SQLITE3 sqlite3 QUIET)
+endif()
+
+find_path(SQLITE3_INCLUDE_DIR NAMES sqlite3.h
+ PATHS ${PC_SQLITE3_INCLUDEDIR})
+find_library(SQLITE3_LIBRARY NAMES sqlite3
+ PATHS ${PC_SQLITE3_LIBDIR})
+
+set(SQLITE3_VERSION ${PC_SQLITE3_VERSION})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Sqlite3
+ REQUIRED_VARS SQLITE3_LIBRARY SQLITE3_INCLUDE_DIR
+ VERSION_VAR SQLITE3_VERSION)
+
+if(SQLITE3_FOUND)
+ set(SQLITE3_INCLUDE_DIRS ${SQLITE3_INCLUDE_DIR})
+ set(SQLITE3_LIBRARIES ${SQLITE3_LIBRARY})
+
+ if(NOT TARGET SQLite3::SQLite3)
+ add_library(SQLite3::SQLite3 UNKNOWN IMPORTED)
+ set_target_properties(SQLite3::SQLite3 PROPERTIES
+ IMPORTED_LOCATION "${SQLITE3_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${SQLITE3_INCLUDE_DIR}")
+ endif()
+endif()
+
+mark_as_advanced(SQLITE3_INCLUDE_DIR SQLITE3_LIBRARY)
diff --git a/cmake/modules/FindTagLib.cmake b/cmake/modules/FindTagLib.cmake
new file mode 100644
index 0000000000..8c8c2f30a1
--- /dev/null
+++ b/cmake/modules/FindTagLib.cmake
@@ -0,0 +1,60 @@
+#.rst:
+# FindTagLib
+# ----------
+# Finds the TagLib library
+#
+# This will will define the following variables::
+#
+# TAGLIB_FOUND - system has TagLib
+# TAGLIB_INCLUDE_DIRS - the TagLib include directory
+# TAGLIB_LIBRARIES - the TagLib libraries
+#
+# and the following imported targets::
+#
+# TagLib::TagLib - The TagLib library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_TAGLIB taglib>=1.9.0 QUIET)
+endif()
+
+find_path(TAGLIB_INCLUDE_DIR taglib/tag.h
+ PATHS ${PC_TAGLIB_INCLUDEDIR})
+find_library(TAGLIB_LIBRARY_RELEASE NAMES tag
+ PATHS ${PC_TAGLIB_LIBDIR})
+find_library(TAGLIB_LIBRARY_DEBUG NAMES tagd
+ PATHS ${PC_TAGLIB_LIBDIR})
+set(TAGLIB_VERSION ${PC_TAGLIB_VERSION})
+
+include(SelectLibraryConfigurations)
+select_library_configurations(TAGLIB)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(TagLib
+ REQUIRED_VARS TAGLIB_LIBRARY TAGLIB_INCLUDE_DIR
+ VERSION_VAR TAGLIB_VERSION)
+
+if(TAGLIB_FOUND)
+ set(TAGLIB_LIBRARIES ${TAGLIB_LIBRARY})
+
+ # Workaround broken .pc file
+ list(APPEND TAGLIB_LIBRARIES ${PC_TAGLIB_ZLIB_LIBRARIES})
+
+ set(TAGLIB_INCLUDE_DIRS ${TAGLIB_INCLUDE_DIR})
+ if(NOT TARGET TagLib::TagLib)
+ add_library(TagLib::TagLib UNKNOWN IMPORTED)
+ if(TAGLIB_LIBRARY_RELEASE)
+ set_target_properties(TagLib::TagLib PROPERTIES
+ IMPORTED_CONFIGURATIONS RELEASE
+ IMPORTED_LOCATION "${TAGLIB_LIBRARY_RELEASE}")
+ endif()
+ if(TAGLIB_LIBRARY_DEBUG)
+ set_target_properties(TagLib::TagLib PROPERTIES
+ IMPORTED_CONFIGURATIONS DEBUG
+ IMPORTED_LOCATION "${TAGLIB_LIBRARY_DEBUG}")
+ endif()
+ set_target_properties(TagLib::TagLib PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${TAGLIB_INCLUDE_DIR}")
+ endif()
+endif()
+
+mark_as_advanced(TAGLIB_INCLUDE_DIR TAGLIB_LIBRARY)
diff --git a/cmake/modules/FindTexturePacker.cmake b/cmake/modules/FindTexturePacker.cmake
new file mode 100644
index 0000000000..677b4d983b
--- /dev/null
+++ b/cmake/modules/FindTexturePacker.cmake
@@ -0,0 +1,41 @@
+#.rst:
+# FindTexturePacker
+# -----------------
+# Finds the TexturePacker
+#
+# If WITH_TEXTUREPACKER is defined and points to a directory,
+# this path will be used to search for the Texturepacker binary
+#
+#
+# This will define the following (imported) targets::
+#
+# TexturePacker::TexturePacker - The TexturePacker executable
+
+if(NOT TARGET TexturePacker::TexturePacker)
+ if(KODI_DEPENDSBUILD)
+ add_executable(TexturePacker::TexturePacker IMPORTED GLOBAL)
+ set_target_properties(TexturePacker::TexturePacker PROPERTIES
+ IMPORTED_LOCATION "${NATIVEPREFIX}/bin/TexturePacker")
+ elseif(WIN32)
+ add_executable(TexturePacker::TexturePacker IMPORTED GLOBAL)
+ set_target_properties(TexturePacker::TexturePacker PROPERTIES
+ IMPORTED_LOCATION "${CORE_SOURCE_DIR}/tools/TexturePacker/TexturePacker.exe")
+ else()
+ if(WITH_TEXTUREPACKER)
+ get_filename_component(_tppath ${WITH_TEXTUREPACKER} ABSOLUTE)
+ find_program(TEXTUREPACKER_EXECUTABLE TexturePacker PATHS ${_tppath})
+
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(TexturePacker DEFAULT_MSG TEXTUREPACKER_EXECUTABLE)
+ if(TEXTUREPACKER_FOUND)
+ add_executable(TexturePacker::TexturePacker IMPORTED GLOBAL)
+ set_target_properties(TexturePacker::TexturePacker PROPERTIES
+ IMPORTED_LOCATION "${TEXTUREPACKER_EXECUTABLE}")
+ endif()
+ mark_as_advanced(TEXTUREPACKER)
+ else()
+ add_subdirectory(${CORE_SOURCE_DIR}/tools/depends/native/TexturePacker build/texturepacker)
+ add_executable(TexturePacker::TexturePacker ALIAS TexturePacker)
+ endif()
+ endif()
+endif()
diff --git a/cmake/modules/FindTinyXML.cmake b/cmake/modules/FindTinyXML.cmake
new file mode 100644
index 0000000000..1220a94387
--- /dev/null
+++ b/cmake/modules/FindTinyXML.cmake
@@ -0,0 +1,68 @@
+#.rst:
+# FindTinyXML
+# -----------
+# Finds the TinyXML library
+#
+# This will will define the following variables::
+#
+# TINYXML_FOUND - system has TinyXML
+# TINYXML_INCLUDE_DIRS - the TinyXML include directory
+# TINYXML_LIBRARIES - the TinyXML libraries
+# TINYXML_DEFINITIONS - the TinyXML definitions
+#
+# and the following imported targets::
+#
+# TinyXML::TinyXML - The TinyXML library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_TINYXML tinyxml QUIET)
+endif()
+
+find_path(TINYXML_INCLUDE_DIR tinyxml.h
+ PATH_SUFFIXES tinyxml
+ PATHS ${PC_TINYXML_INCLUDEDIR})
+find_library(TINYXML_LIBRARY_RELEASE NAMES tinyxml tinyxmlSTL
+ PATH_SUFFIXES tinyxml
+ PATHS ${PC_TINYXML_LIBDIR})
+find_library(TINYXML_LIBRARY_DEBUG NAMES tinyxmld tinyxmlSTLd
+ PATH_SUFFIXES tinyxml
+ PATHS ${PC_TINYXML_LIBDIR})
+set(TINYXML_VERSION ${PC_TINYXML_VERSION})
+
+include(SelectLibraryConfigurations)
+select_library_configurations(TINYXML)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(TinyXML
+ REQUIRED_VARS TINYXML_LIBRARY TINYXML_INCLUDE_DIR
+ VERSION_VAR TINYXML_VERSION)
+
+if(TINYXML_FOUND)
+ set(TINYXML_LIBRARIES ${TINYXML_LIBRARY})
+ set(TINYXML_INCLUDE_DIRS ${TINYXML_INCLUDE_DIR})
+ if(WIN32)
+ set(TINYXML_DEFINITIONS -DTIXML_USE_STL=1)
+ endif()
+
+ if(NOT TARGET TinyXML::TinyXML)
+ add_library(TinyXML::TinyXML UNKNOWN IMPORTED)
+ if(TINYXML_LIBRARY_RELEASE)
+ set_target_properties(TinyXML::TinyXML PROPERTIES
+ IMPORTED_CONFIGURATIONS RELEASE
+ IMPORTED_LOCATION "${TINYXML_LIBRARY_RELEASE}")
+ endif()
+ if(TINYXML_LIBRARY_DEBUG)
+ set_target_properties(TinyXML::TinyXML PROPERTIES
+ IMPORTED_CONFIGURATIONS DEBUG
+ IMPORTED_LOCATION "${TINYXML_LIBRARY_DEBUG}")
+ endif()
+ set_target_properties(TinyXML::TinyXML PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${TINYXML_INCLUDE_DIR}")
+ if(WIN32)
+ set_target_properties(TinyXML::TinyXML PROPERTIES
+ INTERFACE_COMPILE_DEFINITIONS TIXML_USE_STL=1)
+ endif()
+ endif()
+endif()
+
+mark_as_advanced(TINYXML_INCLUDE_DIR TINYXML_LIBRARY)
diff --git a/cmake/modules/FindUDEV.cmake b/cmake/modules/FindUDEV.cmake
new file mode 100644
index 0000000000..422c437d91
--- /dev/null
+++ b/cmake/modules/FindUDEV.cmake
@@ -0,0 +1,47 @@
+#.rst:
+# FindUDEV
+# -------
+# Finds the UDEV library
+#
+# This will will define the following variables::
+#
+# UDEV_FOUND - system has UDEV
+# UDEV_INCLUDE_DIRS - the UDEV include directory
+# UDEV_LIBRARIES - the UDEV libraries
+# UDEV_DEFINITIONS - the UDEV definitions
+#
+# and the following imported targets::
+#
+# UDEV::UDEV - The UDEV library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_UDEV libudev QUIET)
+endif()
+
+find_path(UDEV_INCLUDE_DIR NAMES libudev.h
+ PATHS ${PC_UDEV_INCLUDEDIR})
+find_library(UDEV_LIBRARY NAMES udev
+ PATHS ${PC_UDEV_LIBDIR})
+
+set(UDEV_VERSION ${PC_UDEV_VERSION})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(UDEV
+ REQUIRED_VARS UDEV_LIBRARY UDEV_INCLUDE_DIR
+ VERSION_VAR UDEV_VERSION)
+
+if(UDEV_FOUND)
+ set(UDEV_LIBRARIES ${UDEV_LIBRARY})
+ set(UDEV_INCLUDE_DIRS ${UDEV_INCLUDE_DIR})
+ set(UDEV_DEFINITIONS -DHAVE_LIBUDEV=1)
+
+ if(NOT TARGET UDEV::UDEV)
+ add_library(UDEV::UDEV UNKNOWN IMPORTED)
+ set_target_properties(UDEV::UDEV PROPERTIES
+ IMPORTED_LOCATION "${UDEV_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${UDEV_INCLUDE_DIR}"
+ INTERFACE_COMPILE_DEFINITIONS HAVE_LIBUDEV=1)
+ endif()
+endif()
+
+mark_as_advanced(UDEV_INCLUDE_DIR UDEV_LIBRARY)
diff --git a/cmake/modules/FindUUID.cmake b/cmake/modules/FindUUID.cmake
new file mode 100644
index 0000000000..173fac277d
--- /dev/null
+++ b/cmake/modules/FindUUID.cmake
@@ -0,0 +1,43 @@
+#.rst:
+# FindUUID
+# --------
+# Finds the libuuid library
+#
+# This will will define the following variables::
+#
+# UUID_FOUND - system has libuuid
+# UUID_INCLUDE_DIRS - the libuuid include directory
+# UUID_LIBRARIES - the libuuid libraries
+#
+# and the following imported targets::
+#
+# UUID::UUID - The libuuid library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_UUID uuid QUIET)
+endif()
+
+find_path(UUID_INCLUDE_DIR uuid/uuid.h
+ PATHS ${PC_UUID_INCLUDEDIR})
+find_library(UUID_LIBRARY uuid
+ PATHS ${PC_UUID_LIBRARY})
+set(UUID_VERSION ${PC_UUID_VERSION})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(UUID
+ REQUIRED_VARS UUID_LIBRARY UUID_INCLUDE_DIR
+ VERSION_VAR UUID_VERSION)
+
+if(UUID_FOUND)
+ set(UUID_LIBRARIES ${UUID_LIBRARY})
+ set(UUID_INCLUDE_DIRS ${UUID_INCLUDE_DIR})
+
+ if(NOT TARGET UUID::UUID)
+ add_library(UUID::UUID UNKNOWN IMPORTED)
+ set_target_properties(UUID::UUID PROPERTIES
+ IMPORTED_LOCATION "${UUID_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${UUID_INCLUDE_DIR}")
+ endif()
+endif()
+
+mark_as_advanced(UUID_INCLUDE_DIR UUID_LIBRARY)
diff --git a/cmake/modules/FindVAAPI.cmake b/cmake/modules/FindVAAPI.cmake
new file mode 100644
index 0000000000..ea9a3c9558
--- /dev/null
+++ b/cmake/modules/FindVAAPI.cmake
@@ -0,0 +1,72 @@
+#.rst:
+# FindVAAPI
+# ---------
+# Finds the VAAPI library
+#
+# This will will define the following variables::
+#
+# VAAPI_FOUND - system has VAAPI
+# VAAPI_INCLUDE_DIRS - the VAAPI include directory
+# VAAPI_LIBRARIES - the VAAPI libraries
+# VAAPI_DEFINITIONS - the VAAPI definitions
+#
+# and the following imported targets::
+#
+# VAAPI::VAAPI - The VAAPI library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_VAAPI libva libva-x11 QUIET)
+endif()
+
+find_path(VAAPI_INCLUDE_DIR va/va.h
+ PATHS ${PC_VAAPI_libva_INCLUDEDIR})
+find_library(VAAPI_libva_LIBRARY NAMES va
+ PATHS ${PC_VAAPI_libva_LIBDIR})
+find_library(VAAPI_libva-x11_LIBRARY NAMES va-x11
+ PATHS ${PC_VAAPI_libva_LIBDIR})
+find_library(VAAPI_libva-drm_LIBRARY NAMES va-drm
+ PATHS ${PC_VAAPI_libva_LIBDIR})
+
+if(PC_VAAPI_libva_VERSION)
+ set(VAAPI_VERSION_STRING ${PC_VAAPI_libva_VERSION})
+elseif(VAAPI_INCLUDE_DIR AND EXISTS "${VAAPI_INCLUDE_DIR}/va/va_version.h")
+ file(STRINGS "${VAAPI_INCLUDE_DIR}/va/va_version.h" vaapi_version_str REGEX "^#define[\t ]+VA_VERSION_S[\t ]+\".*\".*")
+ string(REGEX REPLACE "^#define[\t ]+VA_VERSION_S[\t ]+\"([^\"]+)\".*" "\\1" VAAPI_VERSION_STRING "${vaapi_version_str}")
+ unset(vaapi_version_str)
+endif()
+
+if(NOT VAAPI_FIND_VERSION)
+ set(VAAPI_FIND_VERSION 0.38.0)
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(VAAPI
+ REQUIRED_VARS VAAPI_libva_LIBRARY VAAPI_libva-x11_LIBRARY VAAPI_libva-drm_LIBRARY VAAPI_INCLUDE_DIR
+ VERSION_VAR VAAPI_VERSION_STRING)
+
+if(VAAPI_FOUND)
+ set(VAAPI_INCLUDE_DIRS ${VAAPI_INCLUDE_DIR})
+ set(VAAPI_LIBRARIES ${VAAPI_libva_LIBRARY} ${VAAPI_libva-x11_LIBRARY} ${VAAPI_libva-drm_LIBRARY})
+ set(VAAPI_DEFINITIONS -DHAVE_LIBVA=1)
+
+ if(NOT TARGET VAAPI::VAAPI_X11)
+ add_library(VAAPI::VAAPI_X11 UNKNOWN IMPORTED)
+ set_target_properties(VAAPI::VAAPI_X11 PROPERTIES
+ IMPORTED_LOCATION "${VAAPI_libva-x11_LIBRARY}")
+ endif()
+ if (NOT TARGET VAAPI::VAAPI_DRM)
+ add_library(VAAPI::VAAPI_DRM UNKNOWN IMPORTED)
+ set_target_properties(VAAPI::VAAPI_DRM PROPERTIES
+ IMPORTED_LOCATION "${VAAPI_libva-drm_LIBRARY}")
+ endif()
+ if(NOT TARGET VAAPI::VAAPI)
+ add_library(VAAPI::VAAPI UNKNOWN IMPORTED)
+ set_target_properties(VAAPI::VAAPI PROPERTIES
+ IMPORTED_LOCATION "${VAAPI_libva_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${VAAPI_INCLUDE_DIR}"
+ INTERFACE_COMPILE_DEFINITIONS HAVE_LIBVA=1
+ INTERFACE_LINK_LIBRARIES "VAAPI::VAAPI_X11 VAAPI::VAAPI_DRM")
+ endif()
+endif()
+
+mark_as_advanced(VAAPI_INCLUDE_DIR VAAPI_libva_LIBRARY VAAPI_libva-x11_LIBRARY VAAPI_libva-drm_LIBRARY)
diff --git a/cmake/modules/FindVDPAU.cmake b/cmake/modules/FindVDPAU.cmake
new file mode 100644
index 0000000000..b99e03f49b
--- /dev/null
+++ b/cmake/modules/FindVDPAU.cmake
@@ -0,0 +1,47 @@
+#.rst:
+# FindVDPAU
+# ---------
+# Finds the VDPAU library
+#
+# This will will define the following variables::
+#
+# VDPAU_FOUND - system has VDPAU
+# VDPAU_INCLUDE_DIRS - the VDPAU include directory
+# VDPAU_LIBRARIES - the VDPAU libraries
+# VDPAU_DEFINITIONS - the VDPAU definitions
+#
+# and the following imported targets::
+#
+# VDPAU::VDPAU - The VDPAU library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_VDPAU vdpau QUIET)
+endif()
+
+find_path(VDPAU_INCLUDE_DIR NAMES vdpau/vdpau.h vdpau/vdpau_x11.h
+ PATHS ${PC_VDPAU_INCLUDEDIR})
+find_library(VDPAU_LIBRARY NAMES vdpau
+ PATHS ${PC_VDPAU_LIBDIR})
+
+set(VDPAU_VERSION ${PC_VDPAU_VERSION})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(VDPAU
+ REQUIRED_VARS VDPAU_LIBRARY VDPAU_INCLUDE_DIR
+ VERSION_VAR VDPAU_VERSION)
+
+if(VDPAU_FOUND)
+ set(VDPAU_INCLUDE_DIRS ${VDPAU_INCLUDE_DIR})
+ set(VDPAU_LIBRARIES ${VDPAU_LIBRARY})
+ set(VDPAU_DEFINITIONS -DHAVE_LIBVDPAU=1)
+
+ if(NOT TARGET VDPAU::VDPAU)
+ add_library(VDPAU::VDPAU UNKNOWN IMPORTED)
+ set_target_properties(VDPAU::VDPAU PROPERTIES
+ IMPORTED_LOCATION "${VDPAU_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${VDPAU_INCLUDE_DIR}"
+ INTERFACE_COMPILE_DEFINITIONS HAVE_LIBVDPAU=1)
+ endif()
+endif()
+
+mark_as_advanced(VDPAU_INCLUDE_DIR VDPAU_LIBRARY)
diff --git a/cmake/modules/FindX.cmake b/cmake/modules/FindX.cmake
new file mode 100644
index 0000000000..19bb770cfa
--- /dev/null
+++ b/cmake/modules/FindX.cmake
@@ -0,0 +1,57 @@
+#.rst:
+# FindX
+# -----
+# Finds the X11 library
+#
+# This will will define the following variables::
+#
+# X_FOUND - system has X11
+# X_INCLUDE_DIRS - the X11 include directory
+# X_LIBRARIES - the X11 libraries
+# X_DEFINITIONS - the X11 definitions
+#
+# and the following imported targets::
+#
+# X::X - The X11 library
+# X::Xext - The X11 extension library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_X x11 xext QUIET)
+endif()
+
+find_path(X_INCLUDE_DIR NAMES X11/Xlib.h
+ PATHS ${PC_X_x11_INCLUDEDIR})
+find_library(X_LIBRARY NAMES X11
+ PATHS ${PC_X_x11_LIBDIR})
+find_library(X_EXT_LIBRARY NAMES Xext
+ PATHS ${PC_X_xext_LIBDIR})
+
+set(X_VERSION ${PC_X_x11_VERSION})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(X
+ REQUIRED_VARS X_LIBRARY X_EXT_LIBRARY X_INCLUDE_DIR
+ VERSION_VAR X_VERSION)
+
+if(X_FOUND)
+ set(X_LIBRARIES ${X_LIBRARY} ${X_EXT_LIBRARY})
+ set(X_INCLUDE_DIRS ${X_INCLUDE_DIR})
+ set(X_DEFINITIONS -DHAVE_X11=1)
+
+ if(NOT TARGET X::X)
+ add_library(X::X UNKNOWN IMPORTED)
+ set_target_properties(X::X PROPERTIES
+ IMPORTED_LOCATION "${X_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${X_INCLUDE_DIR}"
+ INTERFACE_COMPILE_DEFINITIONS HAVE_X11=1)
+ endif()
+ if(NOT TARGET X::Xext)
+ add_library(X::Xext UNKNOWN IMPORTED)
+ set_target_properties(X::Xext PROPERTIES
+ IMPORTED_LOCATION "${X_EXT_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${X_INCLUDE_DIR}"
+ INTERFACE_LINK_LIBRARIES X::X)
+ endif()
+endif()
+
+mark_as_advanced(X_INCLUDE_DIR X_LIBRARY X_EXT_LIBRARY)
diff --git a/cmake/modules/FindXRandR.cmake b/cmake/modules/FindXRandR.cmake
new file mode 100644
index 0000000000..9feaedc6f7
--- /dev/null
+++ b/cmake/modules/FindXRandR.cmake
@@ -0,0 +1,47 @@
+#.rst:
+# FindXRandR
+# ----------
+# Finds the XRandR library
+#
+# This will will define the following variables::
+#
+# XRANDR_FOUND - system has XRANDR
+# XRANDR_INCLUDE_DIRS - the XRANDR include directory
+# XRANDR_LIBRARIES - the XRANDR libraries
+# XRANDR_DEFINITIONS - the XRANDR definitions
+#
+# and the following imported targets::
+#
+# XRandR::XRandR - The XRANDR library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_XRANDR xrandr QUIET)
+endif()
+
+find_path(XRANDR_INCLUDE_DIR NAMES X11/extensions/Xrandr.h
+ PATHS ${PC_XRANDR_INCLUDEDIR})
+find_library(XRANDR_LIBRARY NAMES Xrandr
+ PATHS ${PC_XRANDR_LIBDIR})
+
+set(XRANDR_VERSION ${PC_XRANDR_VERSION})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(XRandR
+ REQUIRED_VARS XRANDR_LIBRARY XRANDR_INCLUDE_DIR
+ VERSION_VAR XRANDR_VERSION)
+
+if(XRANDR_FOUND)
+ set(XRANDR_LIBRARIES ${XRANDR_LIBRARY})
+ set(XRANDR_INCLUDE_DIRS ${XRANDR_INCLUDE_DIR})
+ set(XRANDR_DEFINITIONS -DHAVE_LIBXRANDR=1)
+
+ if(NOT TARGET XRandR::XRandR)
+ add_library(XRandR::XRandR UNKNOWN IMPORTED)
+ set_target_properties(XRandR::XRandR PROPERTIES
+ IMPORTED_LOCATION "${XRANDR_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${XRANDR_INCLUDE_DIR}"
+ INTERFACE_COMPILE_DEFINITIONS HAVE_LIBXRANDR=1)
+ endif()
+endif()
+
+mark_as_advanced(XRANDR_INCLUDE_DIR XRANDR_LIBRARY)
diff --git a/cmake/modules/FindXSLT.cmake b/cmake/modules/FindXSLT.cmake
new file mode 100644
index 0000000000..f7fea9e343
--- /dev/null
+++ b/cmake/modules/FindXSLT.cmake
@@ -0,0 +1,50 @@
+#.rst:
+# FindXSLT
+# --------
+# Finds the XSLT library
+#
+# This will will define the following variables::
+#
+# XSLT_FOUND - system has XSLT
+# XSLT_INCLUDE_DIRS - the XSLT include directory
+# XSLT_LIBRARIES - the XSLT libraries
+# XSLT_DEFINITIONS - the XSLT definitions
+#
+# and the following imported targets::
+#
+# XSLT::XSLT - The XSLT library
+
+find_package(LibXml2 REQUIRED)
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_XSLT libxslt QUIET)
+endif()
+
+find_path(XSLT_INCLUDE_DIR NAMES libxslt/xslt.h
+ PATHS ${PC_XSLT_INCLUDEDIR})
+find_library(XSLT_LIBRARY NAMES xslt libxslt
+ PATHS ${PC_XSLT_LIBDIR})
+
+set(XSLT_VERSION ${PC_XSLT_VERSION})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(XSLT
+ REQUIRED_VARS XSLT_LIBRARY XSLT_INCLUDE_DIR
+ VERSION_VAR XSLT_VERSION)
+
+if(XSLT_FOUND)
+ set(XSLT_LIBRARIES ${XSLT_LIBRARY} ${LIBXML2_LIBRARIES})
+ set(XSLT_INCLUDE_DIRS ${XSLT_INCLUDE_DIR} ${LIBXML2_INCLUDE_DIR})
+ set(XSLT_DEFINITIONS -DHAVE_LIBXSLT=1)
+
+ if(NOT TARGET XSLT::XSLT)
+ add_library(XSLT::XSLT UNKNOWN IMPORTED)
+ set_target_properties(XSLT::XSLT PROPERTIES
+ IMPORTED_LOCATION "${XSLT_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${XSLT_INCLUDE_DIR} ${LIBXML2_INCLUDE_DIR}"
+ INTERFACE_COMPILE_DEFINITIONS HAVE_LIBXSLT=1
+ INTERFACE_LINK_LIBRARIES "${LIBXML2_LIBRARIES}")
+ endif()
+endif()
+
+mark_as_advanced(XSLT_INCLUDE_DIR XSLT_LIBRARY)
diff --git a/cmake/modules/FindYajl.cmake b/cmake/modules/FindYajl.cmake
new file mode 100644
index 0000000000..c73a67b809
--- /dev/null
+++ b/cmake/modules/FindYajl.cmake
@@ -0,0 +1,62 @@
+#.rst:
+# FindYajl
+# --------
+# Finds the Yajl library
+#
+# This will will define the following variables::
+#
+# YAJL_FOUND - system has Yajl
+# YAJL_INCLUDE_DIRS - Yajl include directory
+# YAJL_LIBRARIES - the Yajl libraries
+#
+# and the following imported targets::
+#
+# Yajl::Yajl - The Yajl library
+
+if(NOT Yajl_FIND_VERSION)
+ set(Yajl_FIND_VERSION 2.0.0)
+endif()
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_YAJL yajl>=${Yajl_FIND_VERSION} QUIET)
+endif()
+
+find_path(YAJL_INCLUDE_DIR NAMES yajl/yajl_common.h
+ PATHS ${PC_YAJL_INCLUDEDIR})
+find_library(YAJL_LIBRARY NAMES yajl
+ PATHS ${PC_YAJL_LIBDIR})
+
+if(PC_YAJL_VERSION)
+ set(YAJL_VERSION_STRING ${PC_YAJL_VERSION})
+elseif(YAJL_INCLUDE_DIR AND EXISTS "${YAJL_INCLUDE_DIR}/yajl/yajl_version.h")
+ file(STRINGS "${YAJL_INCLUDE_DIR}/yajl/yajl_version.h" yajl_version_str REGEX "^[ \t]*#define[ \t]+YAJL_(MAJOR|MINOR|MICRO)")
+ string(REGEX REPLACE "YAJL_MAJOR ([0-9]+)" "\\1" YAJL_VERSION_MAJOR "${YAJL_VERSION_MAJOR}")
+
+ string(REGEX REPLACE ".*YAJL_MAJOR ([0-9]+).*" "\\1" yajl_major "${yajl_version_str}")
+ string(REGEX REPLACE ".*YAJL_MINOR ([0-9]+).*" "\\1" yajl_minor "${yajl_version_str}")
+ string(REGEX REPLACE ".*YAJL_MICRO ([0-9]+).*" "\\1" yajl_micro "${yajl_version_str}")
+ set(YAJL_VERSION_STRING "${yajl_major}.${yajl_minor}.${yajl_micro}")
+ unset(yajl_version_str)
+ unset(yajl_major)
+ unset(yajl_minor)
+ unset(yajl_micro)
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Yajl
+ REQUIRED_VARS YAJL_LIBRARY YAJL_INCLUDE_DIR
+ VERSION_VAR YAJL_VERSION_STRING)
+
+if(YAJL_FOUND)
+ set(YAJL_INCLUDE_DIRS ${YAJL_INCLUDE_DIR})
+ set(YAJL_LIBRARIES ${YAJL_LIBRARY})
+
+ if(NOT TARGET Yajl::Yajl)
+ add_library(Yajl::Yajl UNKNOWN IMPORTED)
+ set_target_properties(Yajl::Yajl PROPERTIES
+ IMPORTED_LOCATION "${YAJL_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${YAJL_INCLUDE_DIR}")
+ endif()
+endif()
+
+mark_as_advanced(YAJL_INCLUDE_DIR YAJL_LIBRARY)
diff --git a/cmake/modules/FindZip.cmake b/cmake/modules/FindZip.cmake
new file mode 100644
index 0000000000..e0a38c1290
--- /dev/null
+++ b/cmake/modules/FindZip.cmake
@@ -0,0 +1,46 @@
+#.rst:
+# FindZip
+# -----------
+# Finds the Zip library
+#
+# This will will define the following variables::
+#
+# ZIP_FOUND - system has Zip
+# ZIP_INCLUDE_DIRS - the Zip include directory
+# ZIP_LIBRARIES - the Zip libraries
+# ZIP_DEFINITIONS - the Zip libraries
+#
+# and the following imported targets::
+#
+# ZIP::ZIP - The Zip library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_ZIP libzip QUIET)
+endif()
+
+find_path(ZIP_INCLUDE_DIR zip.h
+ PATHS ${PC_ZIP_INCLUDEDIR})
+find_library(ZIP_LIBRARY NAMES zip
+ PATHS ${PC_ZIP_LIBDIR})
+set(ZIP_VERSION ${PC_ZIP_VERSION})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(ZIP
+ REQUIRED_VARS ZIP_LIBRARY ZIP_INCLUDE_DIR
+ VERSION_VAR ZIP_VERSION)
+
+if(ZIP_FOUND)
+ set(ZIP_LIBRARIES ${ZIP_LIBRARY})
+ set(ZIP_INCLUDE_DIRS ${ZIP_INCLUDE_DIR})
+ set(ZIP_DEFINITIONS "${PC_ZIP_CFLAGS}")
+
+ if(NOT TARGET ZIP::ZIP)
+ add_library(ZIP::ZIP UNKNOWN IMPORTED)
+ set_target_properties(ZIP::ZIP PROPERTIES
+ IMPORTED_LOCATION "${ZIP_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${ZIP_INCLUDE_DIR}"
+ INTERFACE_COMPILE_DEFINITIONS "${PC_ZIP_CFLAGS}")
+ endif()
+endif()
+
+mark_as_advanced(ZIP_INCLUDE_DIR ZIP_LIBRARY)
diff --git a/cmake/modules/LDGOLD.cmake b/cmake/modules/LDGOLD.cmake
new file mode 100644
index 0000000000..ad19c6b349
--- /dev/null
+++ b/cmake/modules/LDGOLD.cmake
@@ -0,0 +1,45 @@
+option(ENABLE_LDGOLD "Use GNU gold linker" ON)
+
+set(LDGOLD_FOUND FALSE)
+if(ENABLE_LDGOLD)
+ execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
+ if(LD_VERSION MATCHES "GNU gold")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
+ set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
+ set(LDGOLD_FOUND TRUE)
+ message(STATUS "Linker: GNU gold")
+ else()
+ message(WARNING "GNU gold linker is not available, falling back to default system linker")
+ endif()
+else()
+ message(STATUS "Linker: Default system linker")
+endif()
+
+set(DEFAULT_ENABLE_DEBUGFISSION FALSE)
+if(CMAKE_BUILD_TYPE STREQUAL Debug OR
+ CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo AND
+ LDGOLD_FOUND)
+ set(DEFAULT_ENABLE_DEBUGFISSION TRUE)
+endif()
+
+include(CMakeDependentOption)
+cmake_dependent_option(ENABLE_DEBUGFISSION "Enable Debug Fission support" ON
+ "DEFAULT_ENABLE_DEBUGFISSION" OFF)
+
+set(DEBUGFISSION_FOUND FALSE)
+if(ENABLE_DEBUGFISSION)
+ include(TestCXXAcceptsFlag)
+ check_cxx_accepts_flag(-gsplit-dwarf CXX_ACCEPTS_GSPLIT_DWARF)
+ if(CXX_ACCEPTS_GSPLIT_DWARF)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -gsplit-dwarf")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -gsplit-dwarf")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gdb-index")
+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gdb-index")
+ set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gdb-index")
+ set(DEBUGFISSION_FOUND TRUE)
+ message(STATUS "Debug Fission enabled")
+ else()
+ message(WARNING "Debug Fission is not available")
+ endif()
+endif()
diff --git a/cmake/modules/extra/ECMEnableSanitizers.cmake b/cmake/modules/extra/ECMEnableSanitizers.cmake
new file mode 100644
index 0000000000..aa7092df18
--- /dev/null
+++ b/cmake/modules/extra/ECMEnableSanitizers.cmake
@@ -0,0 +1,149 @@
+#.rst:
+# ECMEnableSanitizers
+# -------------------
+#
+# Enable compiler sanitizer flags.
+#
+# The following sanitizers are supported:
+#
+# - Address Sanitizer
+# - Memory Sanitizer
+# - Thread Sanitizer
+# - Leak Sanitizer
+# - Undefined Behaviour Sanitizer
+#
+# All of them are implemented in Clang, depending on your version, and
+# there is an work in progress in GCC, where some of them are currently
+# implemented.
+#
+# This module will check your current compiler version to see if it
+# supports the sanitizers that you want to enable
+#
+# Usage
+# =====
+#
+# Simply add::
+#
+# include(ECMEnableSanitizers)
+#
+# to your ``CMakeLists.txt``. Note that this module is included in
+# KDECompilerSettings, so projects using that module do not need to also
+# include this one.
+#
+# The sanitizers are not enabled by default. Instead, you must set
+# ``ECM_ENABLE_SANITIZERS`` (either in your ``CMakeLists.txt`` or on the
+# command line) to a semicolon-separated list of sanitizers you wish to enable.
+# The options are:
+#
+# - address
+# - memory
+# - thread
+# - leak
+# - undefined
+#
+# The sanitizers "address", "memory" and "thread" are mutually exclusive. You
+# cannot enable two of them in the same build.
+#
+# "leak" requires the "address" sanitizer.
+#
+# .. note::
+#
+# To reduce the overhead induced by the instrumentation of the sanitizers, it
+# is advised to enable compiler optimizations (``-O1`` or higher).
+#
+# Example
+# =======
+#
+# This is an example of usage::
+#
+# mkdir build
+# cd build
+# cmake -DECM_ENABLE_SANITIZERS='address;leak;undefined' ..
+#
+# .. note::
+#
+# Most of the sanitizers will require Clang. To enable it, use::
+#
+# -DCMAKE_CXX_COMPILER=clang++
+#
+# Since 1.3.0.
+
+#=============================================================================
+# Copyright 2014 Mathieu Tarral <mathieu.tarral@gmail.com>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file COPYING-CMAKE-SCRIPTS for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of extra-cmake-modules, substitute the full
+# License text for the above reference.)
+
+# MACRO check_compiler_version
+#-----------------------------
+macro (check_compiler_version gcc_required_version clang_required_version)
+ if (
+ (
+ CMAKE_CXX_COMPILER_ID MATCHES "GNU"
+ AND
+ CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${gcc_required_version}
+ )
+ OR
+ (
+ CMAKE_CXX_COMPILER_ID MATCHES "Clang"
+ AND
+ CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${clang_required_version}
+ )
+ )
+ # error !
+ message(FATAL_ERROR "You ask to enable the sanitizer ${CUR_SANITIZER},
+ but your compiler ${CMAKE_CXX_COMPILER_ID} version ${CMAKE_CXX_COMPILER_VERSION}
+ does not support it !
+ You should use at least GCC ${gcc_required_version} or Clang ${clang_required_version}
+ (99.99 means not implemented yet)")
+ endif ()
+endmacro ()
+
+# MACRO check_compiler_support
+#------------------------------
+macro (enable_sanitizer_flags sanitize_option)
+ if (${sanitize_option} MATCHES "address")
+ check_compiler_version("4.8" "3.1")
+ set(XSAN_COMPILE_FLAGS "-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls")
+ set(XSAN_LINKER_FLAGS "asan")
+ elseif (${sanitize_option} MATCHES "thread")
+ check_compiler_version("4.8" "3.1")
+ set(XSAN_COMPILE_FLAGS "-fsanitize=thread")
+ set(XSAN_LINKER_FLAGS "tsan")
+ elseif (${sanitize_option} MATCHES "memory")
+ check_compiler_version("99.99" "3.1")
+ set(XSAN_COMPILE_FLAGS "-fsanitize=memory")
+ elseif (${sanitize_option} MATCHES "leak")
+ check_compiler_version("4.9" "3.4")
+ set(XSAN_COMPILE_FLAGS "-fsanitize=leak")
+ set(XSAN_LINKER_FLAGS "lsan")
+ elseif (${sanitize_option} MATCHES "undefined")
+ check_compiler_version("4.9" "3.1")
+ set(XSAN_COMPILE_FLAGS "-fsanitize=undefined -fno-omit-frame-pointer -fno-optimize-sibling-calls")
+ else ()
+ message(FATAL_ERROR "Compiler sanitizer option \"${sanitize_option}\" not supported.")
+ endif ()
+endmacro ()
+
+# for each element of the ECM_ENABLE_SANITIZERS list
+foreach ( CUR_SANITIZER ${ECM_ENABLE_SANITIZERS} )
+ # lowercase filter
+ string(TOLOWER ${CUR_SANITIZER} CUR_SANITIZER)
+ # check option and enable appropriate flags
+ enable_sanitizer_flags ( ${CUR_SANITIZER} )
+ set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${XSAN_COMPILE_FLAGS}" )
+ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
+ link_libraries(${XSAN_LINKER_FLAGS})
+ endif()
+ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ string(REPLACE "-Wl,--no-undefined" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
+ string(REPLACE "-Wl,--no-undefined" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}")
+ endif ()
+endforeach ()
diff --git a/cmake/platform/android/defines.txt b/cmake/platform/android/defines.txt
new file mode 100644
index 0000000000..fa103d0060
--- /dev/null
+++ b/cmake/platform/android/defines.txt
@@ -0,0 +1 @@
+-DTARGET_POSIX -DTARGET_LINUX -D_LINUX -DTARGET_ANDROID
diff --git a/cmake/platform/freebsd/defines.txt b/cmake/platform/freebsd/defines.txt
new file mode 100644
index 0000000000..94835971a3
--- /dev/null
+++ b/cmake/platform/freebsd/defines.txt
@@ -0,0 +1 @@
+-DTARGET_POSIX -DTARGET_FREEBSD -D_LINUX
diff --git a/cmake/platform/ios/defines.txt b/cmake/platform/ios/defines.txt
new file mode 100644
index 0000000000..d0989ea1ce
--- /dev/null
+++ b/cmake/platform/ios/defines.txt
@@ -0,0 +1 @@
+-DTARGET_POSIX -DTARGET_DARWIN -DTARGET_DARWIN_IOS -D_LINUX
diff --git a/cmake/platform/linux/defines.txt b/cmake/platform/linux/defines.txt
new file mode 100644
index 0000000000..3fe9c5caad
--- /dev/null
+++ b/cmake/platform/linux/defines.txt
@@ -0,0 +1 @@
+-DTARGET_POSIX -DTARGET_LINUX -D_LINUX -fPIC
diff --git a/cmake/platform/osx/defines.txt b/cmake/platform/osx/defines.txt
new file mode 100644
index 0000000000..33b009e3a7
--- /dev/null
+++ b/cmake/platform/osx/defines.txt
@@ -0,0 +1 @@
+-DTARGET_POSIX -DTARGET_DARWIN -DTARGET_DARWIN_OSX -D_LINUX
diff --git a/cmake/platform/rbpi/defines.txt b/cmake/platform/rbpi/defines.txt
new file mode 100644
index 0000000000..08fe4cbdd2
--- /dev/null
+++ b/cmake/platform/rbpi/defines.txt
@@ -0,0 +1 @@
+-DTARGET_POSIX -DTARGET_LINUX -D_LINUX -D_ARMEL -DTARGET_RASPBERRY_PI
diff --git a/cmake/platform/windows/defines.txt b/cmake/platform/windows/defines.txt
new file mode 100644
index 0000000000..5ccd98a9c1
--- /dev/null
+++ b/cmake/platform/windows/defines.txt
@@ -0,0 +1 @@
+-DTARGET_WINDOWS -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS -D_USE_32BIT_TIME_T -D_WINSOCKAPI_ \ No newline at end of file
diff --git a/cmake/scripts/android/ArchSetup.cmake b/cmake/scripts/android/ArchSetup.cmake
new file mode 100644
index 0000000000..281f94f869
--- /dev/null
+++ b/cmake/scripts/android/ArchSetup.cmake
@@ -0,0 +1,35 @@
+if(NOT CMAKE_TOOLCHAIN_FILE)
+ message(FATAL_ERROR "CMAKE_TOOLCHAIN_FILE required for android. See ${PROJECT_SOURCE_DIR}/README.md")
+elseif(NOT SDK_PLATFORM)
+ message(FATAL_ERROR "Toolchain did not define SDK_PLATFORM. Possibly outdated depends.")
+endif()
+
+set(ARCH_DEFINES -DTARGET_POSIX -DTARGET_LINUX -D_LINUX -DTARGET_ANDROID)
+set(SYSTEM_DEFINES -D__STDC_CONSTANT_MACROS -D_FILE_DEFINED
+ -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64)
+set(PLATFORM_DIR linux)
+if(WITH_ARCH)
+ set(ARCH ${WITH_ARCH})
+else()
+ if(CPU STREQUAL armeabi-v7a)
+ set(ARCH arm)
+ set(NEON True)
+ elseif(CPU STREQUAL arm64-v8a)
+ set(ARCH aarch64)
+ elseif(CPU STREQUAL i686)
+ set(ARCH i486-linux)
+ set(NEON False)
+ else()
+ message(SEND_ERROR "Unknown CPU: ${CPU}")
+ endif()
+endif()
+
+set(FFMPEG_OPTS --enable-cross-compile --cpu=cortex-a9 --arch=arm --target-os=linux --enable-neon
+ --disable-vdpau --cc=${CMAKE_C_COMPILER} --host-cc=${CMAKE_C_COMPILER}
+ --strip=${CMAKE_STRIP})
+set(ENABLE_SDL OFF CACHE BOOL "" FORCE)
+set(ENABLE_X11 OFF CACHE BOOL "" FORCE)
+set(ENABLE_AML OFF CACHE BOOL "" FORCE)
+set(ENABLE_OPTICAL OFF CACHE BOOL "" FORCE)
+
+list(APPEND DEPLIBS android log jnigraphics)
diff --git a/cmake/scripts/android/Install.cmake b/cmake/scripts/android/Install.cmake
new file mode 100644
index 0000000000..025f194cb5
--- /dev/null
+++ b/cmake/scripts/android/Install.cmake
@@ -0,0 +1,122 @@
+# Android packaging
+
+find_program(AAPT_EXECUTABLE aapt PATHS ${SDK_BUILDTOOLS_PATH})
+if(NOT AAPT_EXECUTABLE)
+ message(FATAL_ERROR "Could NOT find aapt executable")
+endif()
+find_program(DX_EXECUTABLE dx PATHS ${SDK_BUILDTOOLS_PATH})
+if(NOT DX_EXECUTABLE)
+ message(FATAL_ERROR "Could NOT find dx executable")
+endif()
+find_program(ZIPALIGN_EXECUTABLE zipalign PATHS ${SDK_BUILDTOOLS_PATH})
+if(NOT ZIPALIGN_EXECUTABLE)
+ message(FATAL_ERROR "Could NOT find zipalign executable")
+endif()
+
+# Configure files into packaging environment.
+configure_file(${CORE_SOURCE_DIR}/tools/android/packaging/Makefile.in
+ ${CMAKE_BINARY_DIR}/tools/android/packaging/Makefile @ONLY)
+configure_file(${CORE_SOURCE_DIR}/tools/android/packaging/apksign
+ ${CMAKE_BINARY_DIR}/tools/android/packaging/apksign COPYONLY)
+configure_file(${CORE_SOURCE_DIR}/tools/android/packaging/make_symbols.sh
+ ${CMAKE_BINARY_DIR}/tools/android/packaging/make_symbols.sh COPYONLY)
+file(WRITE ${CMAKE_BINARY_DIR}/tools/depends/Makefile.include
+ "$(PREFIX)/lib/${APP_NAME_LC}/lib${APP_NAME_LC}.so: ;\n")
+
+set(package_files strings.xml
+ activity_main.xml
+ AndroidManifest.xml
+ src/org/xbmc/kodi/XBMCOnAudioFocusChangeListener.java
+ src/org/xbmc/kodi/XBMCInputDeviceListener.java
+ src/org/xbmc/kodi/Main.java
+ src/org/xbmc/kodi/XBMCSettingsContentObserver.java
+ src/org/xbmc/kodi/XBMCOnFrameAvailableListener.java
+ src/org/xbmc/kodi/XBMCVideoView.java
+ src/org/xbmc/kodi/Splash.java
+ src/org/xbmc/kodi/XBMCBroadcastReceiver.java)
+foreach(file IN LISTS package_files)
+ configure_file(${CORE_SOURCE_DIR}/tools/android/packaging/xbmc/${file}.in
+ ${CMAKE_BINARY_DIR}/tools/android/packaging/xbmc/${file} @ONLY)
+endforeach()
+
+# Copy files to the location expected by the Android packaging scripts.
+add_custom_target(bundle
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CORE_SOURCE_DIR}/tools/android/packaging/media
+ ${CMAKE_BINARY_DIR}/tools/android/packaging/media
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CORE_SOURCE_DIR}/tools/android/packaging/xbmc/res
+ ${CMAKE_BINARY_DIR}/tools/android/packaging/xbmc/res
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${DEPENDS_PATH}/lib/python2.7 ${libdir}/python2.7
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${DEPENDS_PATH}/share/${APP_NAME_LC} ${datadir}/${APP_NAME_LC}
+ COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${APP_NAME_LC}>
+ ${libdir}/${APP_NAME_LC}/$<TARGET_FILE_NAME:${APP_NAME_LC}>)
+add_dependencies(bundle ${APP_NAME_LC})
+
+# This function is used to prepare a prefix expected by the Android packaging
+# scripts. It creates a bundle_files command that is added to the bundle target.
+function(add_bundle_file file destination relative)
+ if(NOT TARGET bundle_files)
+ file(REMOVE ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/BundleFiles.cmake)
+ add_custom_target(bundle_files COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/BundleFiles.cmake)
+ add_dependencies(bundle bundle_files)
+ endif()
+
+ string(REPLACE "${relative}/" "" outfile ${file})
+ get_filename_component(file ${file} REALPATH)
+ get_filename_component(outdir ${outfile} DIRECTORY)
+ file(APPEND ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/BundleFiles.cmake
+ "file(COPY \"${file}\" DESTINATION \"${destination}/${outdir}\")\n")
+ if(file MATCHES "\\.so\\..+$")
+ get_filename_component(srcfile "${file}" NAME)
+ string(REGEX REPLACE "\\.so\\..+$" "\.so" destfile ${srcfile})
+ file(APPEND ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/BundleFiles.cmake
+ "file(RENAME \"${destination}/${outdir}/${srcfile}\" \"${destination}/${outdir}/${destfile}\")\n")
+ endif()
+endfunction()
+
+# Copy files into prefix
+foreach(file IN LISTS XBT_FILES install_data)
+ string(REPLACE "${CMAKE_BINARY_DIR}/" "" file ${file})
+ add_bundle_file(${CMAKE_BINARY_DIR}/${file} ${datarootdir}/${APP_NAME_LC} ${CMAKE_BINARY_DIR})
+endforeach()
+
+foreach(library IN LISTS LIBRARY_FILES)
+ add_bundle_file(${library} ${libdir}/${APP_NAME_LC} ${CMAKE_BINARY_DIR})
+endforeach()
+
+foreach(lib IN LISTS required_dyload dyload_optional ITEMS Shairplay)
+ string(TOUPPER ${lib} lib_up)
+ set(lib_so ${${lib_up}_SONAME})
+ if(lib_so AND EXISTS ${DEPENDS_PATH}/lib/${lib_so})
+ add_bundle_file(${DEPENDS_PATH}/lib/${lib_so} ${libdir} "")
+ endif()
+endforeach()
+add_bundle_file(${SMBCLIENT_LIBRARY} ${libdir} "")
+
+# Main targets from Makefile.in
+if(CPU MATCHES i686)
+ set(CPU x86)
+ set(ARCH x86)
+endif()
+foreach(target apk obb apk-unsigned apk-obb apk-obb-unsigned apk-noobb apk-clean apk-sign)
+ add_custom_target(${target}
+ COMMAND PATH=${NATIVEPREFIX}/bin:$ENV{PATH} ${CMAKE_MAKE_PROGRAM}
+ -C ${CMAKE_BINARY_DIR}/tools/android/packaging
+ CORE_SOURCE_DIR=${CORE_SOURCE_DIR}
+ CC=${CMAKE_C_COMPILER}
+ CPU=${CPU}
+ ARCH=${ARCH}
+ PREFIX=${prefix}
+ NDKROOT=${NDKROOT}
+ SDKROOT=${SDKROOT}
+ SDK_PLATFORM=${SDK_PLATFORM}
+ STRIP=${CMAKE_STRIP}
+ AAPT=${AAPT_EXECUTABLE}
+ DX=${DX_EXECUTABLE}
+ ZIPALIGN=${ZIPALIGN_EXECUTABLE}
+ ${target}
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/tools/android/packaging
+ )
+ if(NOT target STREQUAL apk-clean)
+ add_dependencies(${target} bundle)
+ endif()
+endforeach()
diff --git a/cmake/scripts/android/Macros.cmake b/cmake/scripts/android/Macros.cmake
new file mode 120000
index 0000000000..2fdbb255f9
--- /dev/null
+++ b/cmake/scripts/android/Macros.cmake
@@ -0,0 +1 @@
+../linux/Macros.cmake \ No newline at end of file
diff --git a/cmake/scripts/android/PathSetup.cmake b/cmake/scripts/android/PathSetup.cmake
new file mode 100644
index 0000000000..69de88318e
--- /dev/null
+++ b/cmake/scripts/android/PathSetup.cmake
@@ -0,0 +1,33 @@
+if(NOT prefix)
+ set(prefix ${CMAKE_BINARY_DIR}/install)
+endif()
+set(CMAKE_INSTALL_PREFIX ${prefix})
+if(NOT exec_prefix)
+ set(exec_prefix ${prefix})
+endif()
+if(NOT libdir)
+ set(libdir ${prefix}/lib)
+endif()
+if(NOT bindir)
+ set(bindir ${prefix}/bin)
+endif()
+if(NOT includedir)
+ set(includedir ${prefix}/include)
+endif()
+if(NOT datarootdir)
+ set(datarootdir ${prefix}/share)
+endif()
+if(NOT datadir)
+ set(datadir ${datarootdir})
+endif()
+
+list(APPEND final_message "-- PATH config --")
+list(APPEND final_message "Prefix: ${prefix}")
+list(APPEND final_message "Libdir: ${libdir}")
+list(APPEND final_message "Bindir: ${bindir}")
+list(APPEND final_message "Includedir: ${includedir}")
+list(APPEND final_message "Datarootdir: ${datarootdir}")
+list(APPEND final_message "Datadir: ${datadir}")
+
+set(PATH_DEFINES -DBIN_INSTALL_PATH=\"${libdir}/kodi\"
+ -DINSTALL_PATH=\"${datarootdir}/kodi\")
diff --git a/cmake/scripts/common/AddOptions.cmake b/cmake/scripts/common/AddOptions.cmake
new file mode 100644
index 0000000000..96837c1673
--- /dev/null
+++ b/cmake/scripts/common/AddOptions.cmake
@@ -0,0 +1,78 @@
+# - Add options without repeating them on the command line
+#
+# Synopsis:
+#
+# add_options (lang build opts)
+#
+# where:
+#
+# lang Name of the language whose compiler should receive the
+# options, e.g. CXX. If a comma-separated list is received
+# then the option is added for all those languages. Use the
+# special value ALL_LANGUAGES for these languages: CXX, C
+# and Fortran
+#
+# build Kind of build to which this options should apply,
+# such as DEBUG and RELEASE. This can also be a comma-
+# separated list. Use the special value ALL_BUILDS to apply
+# to all builds.
+#
+# opts List of options to add. Each should be quoted.
+#
+# Example:
+#
+# add_options (CXX RELEASE "-O3" "-DNDEBUG" "-Wall")
+
+function(add_options langs builds)
+ # special handling of empty language specification
+ if("${langs}" STREQUAL "ALL_LANGUAGES")
+ set(langs CXX C Fortran)
+ endif()
+ foreach(lang IN LISTS langs)
+ # prepend underscore if necessary
+ foreach(build IN LISTS builds)
+ if(NOT ("${build}" STREQUAL "ALL_BUILDS"))
+ set(_bld "_${build}")
+ string(TOUPPER "${_bld}" _bld)
+ else()
+ set(_bld "")
+ endif()
+ foreach(_opt IN LISTS ARGN)
+ set(_var "CMAKE_${lang}_FLAGS${_bld}")
+ #message(STATUS "Adding \"${_opt}\" to \${${_var}}")
+ # remove it first
+ string(REPLACE "${_opt}" "" _without "${${_var}}")
+ string(STRIP "${_without}" _without)
+ # we need to strip this one as well, so they are comparable
+ string(STRIP "${${_var}}" _stripped)
+ # if it wasn't there, then add it at the end
+ if("${_without}" STREQUAL "${_stripped}")
+ # don't add any extra spaces if no options yet are set
+ if(NOT ${_stripped} STREQUAL "")
+ set(${_var} "${_stripped} ${_opt}")
+ else()
+ set(${_var} "${_opt}")
+ endif()
+ set(${_var} "${${_var}}" PARENT_SCOPE)
+ endif()
+ endforeach()
+ endforeach()
+ endforeach()
+endfunction()
+
+# set varname to flag unless user has specified something that matches regex
+function(set_default_option varname flag regex)
+ if(NOT "$ENV{CXXFLAGS}" MATCHES "${regex}"
+ AND NOT "${CMAKE_CXX_FLAGS}" MATCHES "${regex}"
+ AND NOT "${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}}" MATCHES "${regex}")
+ set(${varname} ${flag} PARENT_SCOPE)
+ else()
+ set(${varname} PARENT_SCOPE)
+ endif()
+endfunction()
+
+# note: this must be called before project()
+macro(no_default_options)
+ # prevent the platform probe to set options
+ set(CMAKE_NOT_USING_CONFIG_FLAGS TRUE)
+endmacro()
diff --git a/cmake/scripts/common/AddonHelpers.cmake b/cmake/scripts/common/AddonHelpers.cmake
new file mode 100644
index 0000000000..317230a318
--- /dev/null
+++ b/cmake/scripts/common/AddonHelpers.cmake
@@ -0,0 +1,268 @@
+# Workaround for the fact that cpack's filenames are not customizable.
+# Each add-on is added as a separate component to facilitate zip/tgz packaging.
+# The filenames are always of the form basename-component, which is
+# incompatible with the addonid-version scheme we want. This hack renames
+# the files from the file names generated by the 'package' target.
+# Sadly we cannot extend the 'package' target, as it is a builtin target, see
+# http://public.kitware.com/Bug/view.php?id=8438
+# Thus, we have to add an 'addon-package' target.
+add_custom_target(addon-package
+ COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target package)
+
+macro(add_cpack_workaround target version ext)
+ if(NOT PACKAGE_DIR)
+ set(PACKAGE_DIR "${CMAKE_INSTALL_PREFIX}/zips")
+ endif()
+
+ add_custom_command(TARGET addon-package PRE_BUILD
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${PACKAGE_DIR}
+ COMMAND ${CMAKE_COMMAND} -E copy ${CPACK_PACKAGE_DIRECTORY}/addon-${target}-${version}.${ext} ${PACKAGE_DIR}/${target}-${version}.${ext})
+endmacro()
+
+# Grab the version from a given add-on's addon.xml
+macro (addon_version dir prefix)
+ if(EXISTS ${PROJECT_SOURCE_DIR}/${dir}/addon.xml.in)
+ file(READ ${PROJECT_SOURCE_DIR}/${dir}/addon.xml.in ADDONXML)
+ else()
+ file(READ ${dir}/addon.xml ADDONXML)
+ endif()
+
+ string(REGEX MATCH "<addon[^>]*version.?=.?.[0-9\\.]+" VERSION_STRING ${ADDONXML})
+ string(REGEX REPLACE ".*version=.([0-9\\.]+).*" "\\1" ${prefix}_VERSION ${VERSION_STRING})
+ message(STATUS ${prefix}_VERSION=${${prefix}_VERSION})
+endmacro()
+
+# Build, link and optionally package an add-on
+macro (build_addon target prefix libs)
+ addon_version(${target} ${prefix})
+ if(${prefix}_SOURCES)
+ add_library(${target} ${${prefix}_SOURCES})
+ target_link_libraries(${target} ${${libs}})
+ set_target_properties(${target} PROPERTIES VERSION ${${prefix}_VERSION}
+ SOVERSION ${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}
+ PREFIX "")
+ if(OS STREQUAL "android")
+ set_target_properties(${target} PROPERTIES PREFIX "lib")
+ endif()
+ elseif(${prefix}_CUSTOM_BINARY)
+ add_custom_target(${target} ALL)
+ endif()
+
+ # get the library's location
+ if(${prefix}_CUSTOM_BINARY)
+ list(GET ${prefix}_CUSTOM_BINARY 0 LIBRARY_LOCATION)
+ list(GET ${prefix}_CUSTOM_BINARY 1 LIBRARY_FILENAME)
+ else()
+ set(LIBRARY_LOCATION $<TARGET_FILE:${target}>)
+ # get the library's filename
+ if("${CORE_SYSTEM_NAME}" STREQUAL "android")
+ # for android we need the filename without any version numbers
+ set(LIBRARY_FILENAME $<TARGET_LINKER_FILE_NAME:${target}>)
+ else()
+ set(LIBRARY_FILENAME $<TARGET_FILE_NAME:${target}>)
+ endif()
+ endif()
+
+ # if there's an addon.xml.in we need to generate the addon.xml
+ if(EXISTS ${PROJECT_SOURCE_DIR}/${target}/addon.xml.in)
+ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${PROJECT_SOURCE_DIR}/${target}/addon.xml.in)
+ set(PLATFORM ${CORE_SYSTEM_NAME})
+
+ file(READ ${PROJECT_SOURCE_DIR}/${target}/addon.xml.in addon_file)
+ string(CONFIGURE "${addon_file}" addon_file_conf @ONLY)
+ file(GENERATE OUTPUT ${PROJECT_SOURCE_DIR}/${target}/addon.xml CONTENT "${addon_file_conf}")
+ if(${APP_NAME_UC}_BUILD_DIR)
+ file(GENERATE OUTPUT ${${APP_NAME_UC}_BUILD_DIR}/addons/${target}/addon.xml CONTENT "${addon_file_conf}")
+ endif()
+ endif()
+
+ # if there's an settings.xml.in we need to generate the settings.xml
+ if(EXISTS ${PROJECT_SOURCE_DIR}/${target}/resources/settings.xml.in)
+ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${PROJECT_SOURCE_DIR}/${target}/resources/settings.xml.in)
+ set(PLATFORM ${CORE_SYSTEM_NAME})
+
+ file(READ ${PROJECT_SOURCE_DIR}/${target}/resources/settings.xml.in settings_file)
+ string(CONFIGURE "${settings_file}" settings_file_conf @ONLY)
+ file(GENERATE OUTPUT ${PROJECT_SOURCE_DIR}/${target}/resources/settings.xml CONTENT "${settings_file_conf}")
+ if(${APP_NAME_UC}_BUILD_DIR)
+ file(GENERATE OUTPUT ${${APP_NAME_UC}_BUILD_DIR}/addons/${target}/resources/settings.xml CONTENT "${settings_file_conf}")
+ endif()
+ endif()
+
+ # set zip as default if addon-package is called without PACKAGE_XXX
+ set(CPACK_GENERATOR "ZIP")
+ set(ext "zip")
+ if(PACKAGE_ZIP OR PACKAGE_TGZ)
+ if(PACKAGE_TGZ)
+ set(CPACK_GENERATOR "TGZ")
+ set(ext "tar.gz")
+ endif()
+ set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
+ set(CPACK_PACKAGE_FILE_NAME addon)
+ if(CMAKE_BUILD_TYPE STREQUAL "Release")
+ set(CPACK_STRIP_FILES TRUE)
+ endif()
+ set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
+ set(CPACK_COMPONENTS_IGNORE_GROUPS 1)
+ list(APPEND CPACK_COMPONENTS_ALL ${target}-${${prefix}_VERSION})
+ # Pack files together to create an archive
+ install(DIRECTORY ${target} DESTINATION ./ COMPONENT ${target}-${${prefix}_VERSION} PATTERN "xml.in" EXCLUDE)
+ if(WIN32)
+ if(NOT CPACK_PACKAGE_DIRECTORY)
+ # determine the temporary path
+ file(TO_CMAKE_PATH "$ENV{TEMP}" WIN32_TEMP_PATH)
+ string(LENGTH "${WIN32_TEMP_PATH}" WIN32_TEMP_PATH_LENGTH)
+ string(LENGTH "${PROJECT_BINARY_DIR}" PROJECT_BINARY_DIR_LENGTH)
+
+ # check if the temporary path is shorter than the default packaging directory path
+ if(WIN32_TEMP_PATH_LENGTH GREATER 0 AND WIN32_TEMP_PATH_LENGTH LESS PROJECT_BINARY_DIR_LENGTH)
+ # set the directory used by CPack for packaging to the temp directory
+ set(CPACK_PACKAGE_DIRECTORY ${WIN32_TEMP_PATH})
+ endif()
+ endif()
+
+ # in case of a VC++ project the installation location contains a $(Configuration) VS variable
+ # we replace it with ${CMAKE_BUILD_TYPE} (which doesn't cover the case when the build configuration
+ # is changed within Visual Studio)
+ string(REPLACE "$(Configuration)" "${CMAKE_BUILD_TYPE}" LIBRARY_LOCATION "${LIBRARY_LOCATION}")
+
+ if(${prefix}_SOURCES)
+ # install the generated DLL file
+ install(PROGRAMS ${LIBRARY_LOCATION} DESTINATION ${target}
+ COMPONENT ${target}-${${prefix}_VERSION})
+
+ if(CMAKE_BUILD_TYPE MATCHES Debug)
+ # for debug builds also install the PDB file
+ get_filename_component(LIBRARY_DIR ${LIBRARY_LOCATION} DIRECTORY)
+ install(FILES ${LIBRARY_DIR}/${target}.pdb DESTINATION ${target}
+ COMPONENT ${target}-${${prefix}_VERSION})
+ endif()
+ endif()
+ if (${prefix}_CUSTOM_BINARY)
+ list(GET ${prefix}_CUSTOM_BINARY 0 FROM_BINARY)
+ list(GET ${prefix}_CUSTOM_BINARY 1 TO_BINARY)
+ install(FILES ${FROM_BINARY} DESTINATION ${target} RENAME ${TO_BINARY})
+ endif()
+ if(${prefix}_CUSTOM_DATA)
+ install(DIRECTORY ${${prefix}_CUSTOM_DATA} DESTINATION ${target}/resources)
+ endif()
+ else()
+ if(NOT CPACK_PACKAGE_DIRECTORY)
+ set(CPACK_PACKAGE_DIRECTORY ${CMAKE_BINARY_DIR})
+ endif()
+ if(${prefix}_SOURCES)
+ install(TARGETS ${target} DESTINATION ${target}
+ COMPONENT ${target}-${${prefix}_VERSION})
+ endif()
+ if (${prefix}_CUSTOM_BINARY)
+ list(GET ${prefix}_CUSTOM_BINARY 0 FROM_BINARY)
+ list(GET ${prefix}_CUSTOM_BINARY 1 TO_BINARY)
+ if(OS STREQUAL "android")
+ set(TO_BINARY "lib${TO_BINARY}")
+ endif()
+ install(FILES ${FROM_BINARY} DESTINATION ${target} RENAME ${TO_BINARY}
+ COMPONENT ${target}-${${prefix}_VERSION})
+ endif()
+ if(${prefix}_CUSTOM_DATA)
+ install(DIRECTORY ${${prefix}_CUSTOM_DATA} DESTINATION ${target}/resources)
+ endif()
+ endif()
+ add_cpack_workaround(${target} ${${prefix}_VERSION} ${ext})
+ else()
+ if(CORE_SYSTEM_NAME STREQUAL linux OR CORE_SYSTEM_NAME STREQUAL rbpi OR CORE_SYSTEM_NAME STREQUAL freebsd)
+ if(NOT OVERRIDE_PATHS)
+ if(CMAKE_INSTALL_PREFIX AND NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND NOT CMAKE_INSTALL_PREFIX STREQUAL "${${APP_NAME_UC}_PREFIX}")
+ message(WARNING "CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} differs from ${APP_NAME} prefix, changing to ${${APP_NAME_UC}_PREFIX}. Please pass -DOVERRIDE_PATHS=1 to skip this check")
+ endif()
+ if(CMAKE_INSTALL_LIBDIR AND NOT CMAKE_INSTALL_LIBDIR STREQUAL "${${APP_NAME_UC}_LIB_DIR}")
+ message(WARNING "CMAKE_INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR} differs from ${APP_NAME} libdir, changing to ${${APP_NAME_UC}_LIB_DIR}. Please pass -DOVERRIDE_PATHS=1 to skip this check")
+ endif()
+ if(CMAKE_INSTALL_DATADIR AND NOT CMAKE_INSTALL_DATADIR STREQUAL "${${APP_NAME_UC}_DATA_DIR}")
+ message(WARNING "CMAKE_INSTALL_DATADIR ${CMAKE_INSTALL_DATADIR} differs from ${APP_NAME} datadir, changing to ${${APP_NAME_UC}_DATA_DIR}. Please pass -DOVERRIDE_PATHS=1 to skip this check")
+ endif()
+ set(CMAKE_INSTALL_PREFIX "${${APP_NAME_UC}_PREFIX}" CACHE PATH "${APP_NAME} install prefix" FORCE)
+ set(CMAKE_INSTALL_LIBDIR "${${APP_NAME_UC}_LIB_DIR}" CACHE PATH "${APP_NAME} install libdir" FORCE)
+ set(CMAKE_INSTALL_DATADIR "${${APP_NAME_UC}_DATA_DIR}" CACHE PATH "${APP_NAME} install datadir" FORCE)
+ else()
+ if(NOT CMAKE_INSTALL_LIBDIR)
+ set(CMAKE_INSTALL_LIBDIR "${CMAKE_INSTALL_PREFIX}/lib/${APP_NAME_LC}")
+ endif()
+ if(NOT CMAKE_INSTALL_DATADIR)
+ set(CMAKE_INSTALL_DATADIR "${CMAKE_INSTALL_PREFIX}/share/${APP_NAME_LC}")
+ endif()
+ endif()
+ else()
+ set(CMAKE_INSTALL_LIBDIR "lib/${APP_NAME_LC}")
+ set(CMAKE_INSTALL_DATADIR "share/${APP_NAME_LC}")
+ endif()
+ if(${prefix}_SOURCES)
+ install(TARGETS ${target} DESTINATION ${CMAKE_INSTALL_LIBDIR}/addons/${target})
+ endif()
+ if (${prefix}_CUSTOM_BINARY)
+ list(GET ${prefix}_CUSTOM_BINARY 0 FROM_BINARY)
+ list(GET ${prefix}_CUSTOM_BINARY 1 TO_BINARY)
+ if(OS STREQUAL "android")
+ set(TO_BINARY "lib${TO_BINARY}")
+ endif()
+ install(FILES ${FROM_BINARY} DESTINATION ${CMAKE_INSTALL_LIBDIR}/addons/${target} RENAME ${TO_BINARY})
+ endif()
+ install(DIRECTORY ${target} DESTINATION ${CMAKE_INSTALL_DATADIR}/addons PATTERN "xml.in" EXCLUDE)
+ if(${prefix}_CUSTOM_DATA)
+ install(DIRECTORY ${${prefix}_CUSTOM_DATA} DESTINATION ${CMAKE_INSTALL_DATADIR}/addons/${target}/resources)
+ endif()
+ endif()
+ if(${APP_NAME_UC}_BUILD_DIR)
+ file(GLOB_RECURSE files ${CMAKE_CURRENT_SOURCE_DIR}/${target}/*)
+ if(${prefix}_CUSTOM_DATA)
+ add_custom_command(TARGET ${target} POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy_directory
+ ${${prefix}_CUSTOM_DATA}
+ ${${APP_NAME_UC}_BUILD_DIR}/addons/${target}/resources)
+ endif()
+ foreach(file ${files})
+ string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/${target}/" "" name "${file}")
+ # A good way to deal with () in filenames
+ if(NOT ${file} MATCHES xml.in)
+ configure_file(${file} ${${APP_NAME_UC}_BUILD_DIR}/addons/${target}/${name} COPYONLY)
+ endif()
+ endforeach()
+ add_custom_command(TARGET ${target} POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy
+ ${LIBRARY_LOCATION}
+ ${${APP_NAME_UC}_BUILD_DIR}/addons/${target}/${LIBRARY_FILENAME})
+ endif()
+endmacro()
+
+# finds a path to a given file (recursive)
+function (kodi_find_path var_name filename search_path strip_file)
+ file(GLOB_RECURSE PATH_TO_FILE ${search_path} ${filename})
+ if(strip_file)
+ string(REPLACE ${filename} "" PATH_TO_FILE ${PATH_TO_FILE})
+ endif()
+ set (${var_name} ${PATH_TO_FILE} PARENT_SCOPE)
+endfunction()
+
+# Cmake build options
+include(AddOptions)
+include(TestCXXAcceptsFlag)
+option(PACKAGE_ZIP "Package Zip file?" OFF)
+option(PACKAGE_TGZ "Package TGZ file?" OFF)
+option(BUILD_SHARED_LIBS "Build shared libs?" ON)
+
+# LTO support?
+CHECK_CXX_ACCEPTS_FLAG("-flto" HAVE_LTO)
+if(HAVE_LTO)
+ option(USE_LTO "use link time optimization" OFF)
+ if(USE_LTO)
+ add_options(ALL_LANGUAGES ALL_BUILDS "-flto")
+ endif()
+endif()
+
+# set this to try linking dependencies as static as possible
+if(ADDONS_PREFER_STATIC_LIBS)
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
+endif()
+
+if(${APP_NAME_UC}_BUILD_DIR)
+ list(APPEND CMAKE_PREFIX_PATH ${${APP_NAME_UC}_BUILD_DIR}/build)
+endif()
diff --git a/cmake/scripts/common/ArchSetup.cmake b/cmake/scripts/common/ArchSetup.cmake
new file mode 100644
index 0000000000..4b862c8b50
--- /dev/null
+++ b/cmake/scripts/common/ArchSetup.cmake
@@ -0,0 +1,156 @@
+# This script configures the build for a given architecture.
+# Flags and stringified arch is set up.
+# General compiler tests belongs here.
+#
+# On return, the following variables are set:
+# CMAKE_SYSTEM_NAME - a lowercased system name
+# CPU - the CPU on the target
+# ARCH - the system architecture
+# ARCH_DEFINES - list of compiler definitions for this architecture
+# SYSTEM_DEFINES - list of compiler definitions for this system
+# DEP_DEFINES - compiler definitions for system dependencies (e.g. LIRC)
+# + the results of compiler tests etc.
+
+include(CheckCXXSourceCompiles)
+include(CheckSymbolExists)
+include(CheckFunctionExists)
+include(CheckIncludeFile)
+
+# Macro to check if a given type exists in a given header
+# Arguments:
+# header the header to check
+# type the type to check for existence
+# var the compiler definition to set if type exists
+# On return:
+# If type was found, the definition is added to SYSTEM_DEFINES
+macro(check_type header type var)
+ check_cxx_source_compiles("#include <${header}>
+ int main()
+ {
+ ${type} s;
+ }" ${var})
+ if(${var})
+ list(APPEND SYSTEM_DEFINES -D${var}=1)
+ endif()
+endmacro()
+
+# Macro to check if a given builtin function exists
+# Arguments:
+# func the function to check
+# var the compiler definition to set if type exists
+# On return:
+# If type was found, the definition is added to SYSTEM_DEFINES
+macro(check_builtin func var)
+ check_cxx_source_compiles("
+ int main()
+ {
+ ${func};
+ }" ${var})
+ if(${var})
+ list(APPEND SYSTEM_DEFINES -D${var}=1)
+ endif()
+endmacro()
+
+
+# -------- Main script ---------
+message(STATUS "System type: ${CMAKE_SYSTEM_NAME}")
+if(NOT CORE_SYSTEM_NAME)
+ string(TOLOWER ${CMAKE_SYSTEM_NAME} CORE_SYSTEM_NAME)
+endif()
+
+if(WITH_CPU)
+ set(CPU ${WITH_CPU})
+elseif(NOT KODI_DEPENDSBUILD)
+ set(CPU ${CMAKE_SYSTEM_PROCESSOR})
+endif()
+
+if(CMAKE_TOOLCHAIN_FILE)
+ if(NOT EXISTS "${CMAKE_TOOLCHAIN_FILE}")
+ message(FATAL_ERROR "Toolchain file ${CMAKE_TOOLCHAIN_FILE} does not exist.")
+ elseif(KODI_DEPENDSBUILD AND (NOT DEPENDS_PATH OR NOT NATIVEPREFIX))
+ message(FATAL_ERROR "Toolchain did not define DEPENDS_PATH or NATIVEPREFIX. Possibly outdated depends.")
+ endif()
+endif()
+
+# While CMAKE_CROSSCOMPILING is set unconditionally if there's a toolchain file,
+# this variable is set if we can execute build artefacts on the host system (for example unit tests).
+if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL CMAKE_SYSTEM_PROCESSOR AND
+ CMAKE_HOST_SYSTEM_NAME STREQUAL CMAKE_SYSTEM_NAME)
+ set(CORE_HOST_IS_TARGET TRUE)
+else()
+ set(CORE_HOST_IS_TARGET FALSE)
+endif()
+
+# Main cpp
+set(CORE_MAIN_SOURCE ${CORE_SOURCE_DIR}/xbmc/platform/posix/main.cpp)
+
+# system specific arch setup
+if(NOT EXISTS ${PROJECT_SOURCE_DIR}/scripts/${CORE_SYSTEM_NAME}/ArchSetup.cmake)
+ message(FATAL_ERROR "Couldn't find configuration for '${CORE_SYSTEM_NAME}' "
+ "Either the platform is not (yet) supported "
+ "or a toolchain file has to be specified. "
+ "Consult ${CMAKE_SOURCE_DIR}/README.md for instructions. "
+ "Note: Specifying a toolchain requires a clean build directory!")
+endif()
+include(${PROJECT_SOURCE_DIR}/scripts/${CORE_SYSTEM_NAME}/ArchSetup.cmake)
+
+message(STATUS "Core system type: ${CORE_SYSTEM_NAME}")
+message(STATUS "Platform: ${PLATFORM}")
+message(STATUS "CPU: ${CPU}, ARCH: ${ARCH}")
+message(STATUS "Cross-Compiling: ${CMAKE_CROSSCOMPILING}")
+message(STATUS "Execute build artefacts on host: ${CORE_HOST_IS_TARGET}")
+message(STATUS "Depends based build: ${KODI_DEPENDSBUILD}")
+
+check_type(string std::u16string HAVE_STD__U16_STRING)
+check_type(string std::u32string HAVE_STD__U32_STRING)
+check_type(string char16_t HAVE_CHAR16_T)
+check_type(string char32_t HAVE_CHAR32_T)
+check_type(stdint.h uint_least16_t HAVE_STDINT_H)
+check_symbol_exists(posix_fadvise fcntl.h HAVE_POSIX_FADVISE)
+check_symbol_exists(PRIdMAX inttypes.h HAVE_INTTYPES_H)
+check_builtin("long* temp=0; long ret=__sync_add_and_fetch(temp, 1)" HAS_BUILTIN_SYNC_ADD_AND_FETCH)
+check_builtin("long* temp=0; long ret=__sync_sub_and_fetch(temp, 1)" HAS_BUILTIN_SYNC_SUB_AND_FETCH)
+check_builtin("long* temp=0; long ret=__sync_val_compare_and_swap(temp, 1, 1)" HAS_BUILTIN_SYNC_VAL_COMPARE_AND_SWAP)
+check_include_file(sys/inotify.h HAVE_INOTIFY)
+if(HAVE_INOTIFY)
+ list(APPEND SYSTEM_DEFINES -DHAVE_INOTIFY=1)
+endif()
+if(HAVE_POSIX_FADVISE)
+ list(APPEND SYSTEM_DEFINES -DHAVE_POSIX_FADVISE=1)
+endif()
+check_function_exists(localtime_r HAVE_LOCALTIME_R)
+if(HAVE_LOCALTIME_R)
+ list(APPEND SYSTEM_DEFINES -DHAVE_LOCALTIME_R=1)
+endif()
+if(HAVE_INTTYPES_H)
+ list(APPEND SYSTEM_DEFINES -DHAVE_INTTYPES_H=1)
+endif()
+
+find_package(SSE)
+foreach(_sse SSE SSE2 SSE3 SSSE3 SSE4_1 SSE4_2 AVX AVX2)
+ if(${${_sse}_FOUND})
+ # enable SSE versions up to 4.1 by default, if available
+ if(NOT ${_sse} MATCHES "AVX" AND NOT ${_sse} STREQUAL "SSE4_2")
+ option(ENABLE_${_sse} "Enable ${_sse}" ON)
+ else()
+ option(ENABLE_${_sse} "Enable ${_sse}" OFF)
+ endif()
+ endif()
+ if(ENABLE_${_sse})
+ set(HAVE_${_sse} TRUE CACHE STRING "${_sse} enabled")
+ list(APPEND ARCH_DEFINES -DHAVE_${_sse}=1)
+ endif()
+endforeach()
+
+if(NOT DEFINED NEON OR NEON)
+ option(ENABLE_NEON "Enable NEON optimization" ${NEON})
+ if(ENABLE_NEON)
+ message(STATUS "NEON optimization enabled")
+ add_options(CXX ALL_BUILDS "-mfpu=neon -mvectorize-with-neon-quad")
+ endif()
+endif()
+
+if(CMAKE_BUILD_TYPE STREQUAL "Debug")
+ add_options (ALL_LANGUAGES DEBUG "-g" "-D_DEBUG" "-Wall")
+endif()
+
diff --git a/cmake/scripts/common/CMakeHelpers.cmake b/cmake/scripts/common/CMakeHelpers.cmake
new file mode 100644
index 0000000000..995c38ab2b
--- /dev/null
+++ b/cmake/scripts/common/CMakeHelpers.cmake
@@ -0,0 +1,54 @@
+# This file contains functions that support the debugging of the CMake files.
+
+# This file shouldn't be included per default in any CMake file. It should be
+# included and used only on demand. All functions are prefixed with "debug_".
+#
+# Usage:
+# include(scripts/common/CMakeHelpers.cmake)
+# debug_print_variables()
+
+# Print all CMake variables.
+macro(debug_print_variables)
+ get_cmake_property(_variableNames VARIABLES)
+ foreach(_variableName ${_variableNames})
+ message(STATUS "${_variableName} = ${${_variableName}}")
+ endforeach()
+endmacro()
+
+# Get all properties that CMake supports and convert them to a list.
+function(debug_get_properties VAR)
+ execute_process(COMMAND cmake --help-property-list
+ OUTPUT_VARIABLE _properties)
+ string(REGEX REPLACE ";" "\\\\;" _properties "${_properties}")
+ string(REGEX REPLACE "\n" ";" _properties "${_properties}")
+ list(REMOVE_DUPLICATES _properties)
+ list(REMOVE_ITEM _properties LOCATION)
+ set(${VAR} ${_properties} PARENT_SCOPE)
+endfunction()
+
+# List all properties.
+function(debug_list_properties)
+ debug_get_properties(_properties)
+ message("CMake properties = ${_properties}")
+endfunction()
+
+# Print all set properties of a specified target.
+function(debug_print_target_properties target)
+ if(NOT TARGET ${target})
+ message(FATAL_ERROR "There is no target named '${target}'")
+ endif()
+
+ debug_get_properties(_properties)
+
+ # Reading LOCATION property is deprecated and triggers a fatal error.
+ string(REGEX REPLACE ";LOCATION;|LOCATION" "" _properties "${_properties}")
+ string(REGEX REPLACE "<CONFIG>" "${CMAKE_BUILD_TYPE}" _properties
+ "${_properties}")
+ foreach(_property ${_properties})
+ get_property(_value TARGET ${target} PROPERTY ${_property} SET)
+ if(_value)
+ get_target_property(_value ${target} ${_property})
+ message("${target} ${_property} = ${_value}")
+ endif()
+ endforeach()
+endfunction()
diff --git a/cmake/scripts/common/CheckCommits.cmake b/cmake/scripts/common/CheckCommits.cmake
new file mode 100644
index 0000000000..304e623ae8
--- /dev/null
+++ b/cmake/scripts/common/CheckCommits.cmake
@@ -0,0 +1,75 @@
+find_package(Git REQUIRED)
+
+macro(sanity_check message)
+ if(status_code)
+ message(FATAL_ERROR "${message}")
+ endif()
+endmacro()
+
+# Check that there are no changes in working-tree
+execute_process(COMMAND ${GIT_EXECUTABLE} diff --quiet
+ RESULT_VARIABLE status_code)
+sanity_check("Cannot run with working tree changes. Commit, stash or drop them.")
+
+# Setup base of tests
+set(check_base $ENV{CHECK_BASE})
+if(NOT check_base)
+ set(check_base origin/master)
+endif()
+
+# Setup end of tests
+set(check_head $ENV{CHECK_HEAD})
+if(NOT check_head)
+ set(check_head HEAD)
+endif()
+
+# Setup target to build
+set(check_target $ENV{CHECK_TARGET})
+if(NOT check_target)
+ set(check_target check)
+endif()
+
+# Build threads
+set(build_threads $ENV{CHECK_THREADS})
+if(NOT build_threads)
+ if(UNIX)
+ execute_process(COMMAND nproc
+ OUTPUT_VARIABLE build_threads)
+ string(REGEX REPLACE "(\r?\n)+$" "" build_threads "${build_threads}")
+ endif()
+endif()
+
+# Record current HEAD
+execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
+ OUTPUT_VARIABLE current_branch)
+
+string(REGEX REPLACE "(\r?\n)+$" "" current_branch "${current_branch}")
+
+# Grab revision list
+execute_process(COMMAND ${GIT_EXECUTABLE} rev-list ${check_base}..${check_head} --reverse
+ OUTPUT_VARIABLE rev_list)
+
+string(REPLACE "\n" ";" rev_list ${rev_list})
+foreach(rev ${rev_list})
+ # Checkout
+ message("Testing revision ${rev}")
+ execute_process(COMMAND ${GIT_EXECUTABLE} checkout ${rev}
+ RESULT_VARIABLE status_code)
+ sanity_check("Failed to checkout ${rev}")
+
+ # Build
+ if(build_threads GREATER 2)
+ execute_process(COMMAND ${CMAKE_COMMAND} "--build" "${CMAKE_BINARY_DIR}" "--target" "${check_target}" "--use-stderr" "--" "-j${build_threads}"
+ RESULT_VARIABLE status_code)
+ else()
+ execute_process(COMMAND ${CMAKE_COMMAND} "--build" "${CMAKE_BINARY_DIR}" "--target" "${check_target}" "--use-stderr"
+ RESULT_VARIABLE status_code)
+ endif()
+ if(status_code)
+ execute_process(COMMAND ${GIT_EXECUTABLE} checkout ${current_branch})
+ endif()
+ sanity_check("Failed to build target for revision ${rev}")
+endforeach()
+
+message("Everything checks out fine")
+execute_process(COMMAND ${GIT_EXECUTABLE} checkout ${current_branch})
diff --git a/cmake/scripts/common/CheckTargetPlatform.cmake b/cmake/scripts/common/CheckTargetPlatform.cmake
new file mode 100644
index 0000000000..82ee668c03
--- /dev/null
+++ b/cmake/scripts/common/CheckTargetPlatform.cmake
@@ -0,0 +1,67 @@
+# handle target platforms
+function(check_target_platform dir target_platform build)
+ # param[in] dir path/directory of the addon/dependency
+ # param[in] target_platform target platform of the build
+ # param[out] build Result whether the addon/dependency should be built for the specified target platform
+
+ set(${build} FALSE)
+ # check if the given directory exists and contains a platforms.txt
+ if(EXISTS ${dir} AND EXISTS ${dir}/platforms.txt)
+ # get all the specified platforms
+ file(STRINGS ${dir}/platforms.txt platforms)
+
+ list( LENGTH platforms listlen )
+ if(${listlen} EQUAL 1)
+ string(REPLACE " " ";" platforms ${platforms})
+ endif()
+
+ # check if the addon/dependency should be built for the current platform
+ foreach(platform ${platforms})
+ if(${platform} STREQUAL "all" OR ${platform} STREQUAL ${target_platform})
+ set(${build} TRUE)
+ else()
+ # check if the platform is defined as "!<platform>"
+ string(SUBSTRING ${platform} 0 1 platform_first)
+ if(${platform_first} STREQUAL "!")
+ # extract the platform
+ string(LENGTH ${platform} platform_length)
+ math(EXPR platform_length "${platform_length} - 1")
+ string(SUBSTRING ${platform} 1 ${platform_length} platform)
+
+ # check if the current platform does not match the extracted platform
+ if(NOT ${platform} STREQUAL ${target_platform})
+ set(${build} TRUE)
+ endif()
+ endif()
+ endif()
+ endforeach()
+ else()
+ set(${build} TRUE)
+ endif()
+
+ # make the ${build} variable available to the calling script
+ set(${build} "${${build}}" PARENT_SCOPE)
+endfunction()
+
+function(check_install_permissions install_dir have_perms)
+ # param[in] install_dir directory to check for write permissions
+ # param[out] have_perms wether we have permissions to install to install_dir
+
+ set(testfile_lib ${install_dir}/lib/kodi/.cmake-inst-test)
+ set(testfile_share ${install_dir}/share/kodi/.cmake-inst-test)
+ get_filename_component(testdir_lib ${testfile_lib} DIRECTORY)
+ get_filename_component(testdir_share ${testfile_share} DIRECTORY)
+
+ execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${testdir_lib})
+ execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${testdir_share})
+ execute_process(COMMAND ${CMAKE_COMMAND} -E touch ${testfile_lib})
+ execute_process(COMMAND ${CMAKE_COMMAND} -E touch ${testfile_share})
+
+ if(EXISTS ${testfile_lib} AND EXISTS ${testfile_share})
+ set(${have_perms} True PARENT_SCOPE)
+ else()
+ message(STATUS "check_install_permissions ${install_dir}: failed to create files")
+ set(${have_perms} False PARENT_SCOPE)
+ endif()
+ file(REMOVE ${testfile_lib} ${testfile_share})
+endfunction()
diff --git a/cmake/scripts/common/GenerateVersionedFiles.cmake b/cmake/scripts/common/GenerateVersionedFiles.cmake
new file mode 100644
index 0000000000..e105b277e8
--- /dev/null
+++ b/cmake/scripts/common/GenerateVersionedFiles.cmake
@@ -0,0 +1,18 @@
+include(${CORE_SOURCE_DIR}/project/cmake/scripts/common/Macros.cmake)
+
+core_find_versions()
+file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/addons/xbmc.addon)
+file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/addons/kodi.guilib)
+
+# configure_file without dependency tracking
+# configure_file would register additional file dependencies that interfere
+# with the ones from add_custom_command (and the generation would happen twice)
+function(generate_versioned_file _SRC _DEST)
+ file(READ ${CORE_SOURCE_DIR}/${_SRC} file_content)
+ string(CONFIGURE "${file_content}" file_content @ONLY)
+ file(WRITE ${CMAKE_BINARY_DIR}/${_DEST} "${file_content}")
+endfunction()
+
+generate_versioned_file(addons/xbmc.addon/addon.xml.in addons/xbmc.addon/addon.xml)
+generate_versioned_file(addons/kodi.guilib/addon.xml.in addons/kodi.guilib/addon.xml)
+generate_versioned_file(xbmc/CompileInfo.cpp.in ${CORE_BUILD_DIR}/xbmc/CompileInfo.cpp)
diff --git a/cmake/scripts/common/GeneratorSetup.cmake b/cmake/scripts/common/GeneratorSetup.cmake
new file mode 100644
index 0000000000..304b5042e7
--- /dev/null
+++ b/cmake/scripts/common/GeneratorSetup.cmake
@@ -0,0 +1,49 @@
+# Configure single-/multiconfiguration generators and variables
+#
+# CORE_BUILD_CONFIG that is set to
+# - CMAKE_BUILD_TYPE for single configuration generators such as make, nmake
+# - a variable that expands on build time to the current configuration for
+# multi configuration generators such as VS or Xcode
+if(CMAKE_CONFIGURATION_TYPES)
+ if(CMAKE_BUILD_TYPE)
+ message(FATAL_ERROR "CMAKE_BUILD_TYPE must not be defined for multi-configuration generators")
+ endif()
+ set(CORE_BUILD_CONFIG ${CMAKE_CFG_INTDIR})
+ message(STATUS "Generator: Multi-configuration (${CMAKE_GENERATOR})")
+else()
+ if(CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE}
+ CACHE STRING "Choose build type (${CMAKE_BUILD_TYPES})" FORCE)
+ else()
+ # Set default
+ set(CMAKE_BUILD_TYPE Release
+ CACHE STRING "Choose build type (${CMAKE_BUILD_TYPES})" FORCE)
+ endif()
+ set(CORE_BUILD_CONFIG ${CMAKE_BUILD_TYPE})
+ message(STATUS "Generator: Single-configuration: ${CMAKE_BUILD_TYPE} (${CMAKE_GENERATOR})")
+endif()
+
+# Print CMake version
+message(STATUS "CMake Version: ${CMAKE_VERSION}")
+
+# Deal with CMake special cases
+if(CMAKE_VERSION VERSION_EQUAL 3.5.1)
+ message(WARNING "CMake 3.5.1 introduced a crash during configuration. "
+ "Please consider upgrading to 3.5.2 (cmake.org/Bug/view.php?id=16044)")
+endif()
+
+# Darwin needs CMake 3.4
+if(APPLE AND CMAKE_VERSION VERSION_LESS 3.4)
+ message(WARNING "Build on Darwin requires CMake 3.4 or later (tdb library support) "
+ "or the usage of the patched version in depends.")
+endif()
+
+# Windows needs CMake 3.6 (VS_STARTUP_PROJECT)
+if(WIN32 AND CMAKE_VERSION VERSION_LESS 3.6)
+ message(FATAL_ERROR "Build on Windows needs CMake 3.6 or later")
+endif()
+
+# Ninja needs CMake 3.2 due to ExternalProject BUILD_BYPRODUCTS usage
+if(CMAKE_GENERATOR STREQUAL Ninja AND CMAKE_VERSION VERSION_LESS 3.2)
+ message(FATAL_ERROR "Generator: Ninja requires CMake 3.2 or later")
+endif()
diff --git a/cmake/scripts/common/HandleDepends.cmake b/cmake/scripts/common/HandleDepends.cmake
new file mode 100644
index 0000000000..adc105bf31
--- /dev/null
+++ b/cmake/scripts/common/HandleDepends.cmake
@@ -0,0 +1,252 @@
+include(${CORE_SOURCE_DIR}/project/cmake/scripts/common/CheckTargetPlatform.cmake)
+
+# handle addon depends
+function(add_addon_depends addon searchpath)
+ # input: string addon string searchpath
+
+ set(OUTPUT_DIR ${ADDON_DEPENDS_PATH})
+ # look for platform-specific dependencies
+ file(GLOB_RECURSE cmake_input_files ${searchpath}/${CORE_SYSTEM_NAME}/*.txt)
+ file(GLOB_RECURSE cmake_input_files2 ${searchpath}/common/*.txt)
+ list(APPEND cmake_input_files ${cmake_input_files2})
+
+ foreach(file ${cmake_input_files})
+ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${file})
+ if(NOT (file MATCHES CMakeLists.txt OR
+ file MATCHES install.txt OR
+ file MATCHES noinstall.txt OR
+ file MATCHES flags.txt OR
+ file MATCHES deps.txt OR
+ file MATCHES "[a-z]+-deps[.]txt" OR
+ file MATCHES platforms.txt))
+ message(STATUS "Processing ${file}")
+ file(STRINGS ${file} def)
+ string(REPLACE " " ";" def ${def})
+ list(LENGTH def deflength)
+ get_filename_component(dir ${file} DIRECTORY)
+
+ # get the id of the dependency
+ if(NOT "${def}" STREQUAL "")
+ # read the id from the file
+ list(GET def 0 id)
+ else()
+ # read the id from the filename
+ get_filename_component(id ${file} NAME_WE)
+ endif()
+
+ # check if the dependency has a platforms.txt
+ set(platform_found FALSE)
+ check_target_platform(${dir} ${CORE_SYSTEM_NAME} platform_found)
+
+ if(${platform_found} AND NOT TARGET ${id})
+ # determine the download URL of the dependency
+ set(url "")
+ if(deflength GREATER 1)
+ list(GET def 1 url)
+ message(STATUS "${id} url: ${url}")
+ endif()
+
+ # check if there are any library specific flags that need to be passed on
+ if(EXISTS ${dir}/flags.txt)
+ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${dir}/flags.txt)
+ file(STRINGS ${dir}/flags.txt extraflags)
+
+ # replace some custom placeholders
+ string(REPLACE "@MINGW_TOOLCHAIN_FILE@" "${OUTPUT_DIR}/Toolchain_mingw32.cmake" extraflags "${extraflags}")
+ string(REPLACE " " ";" extraflags ${extraflags})
+
+ message(STATUS "${id} extraflags: ${extraflags}")
+ endif()
+
+ set(BUILD_ARGS -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
+ -DOUTPUT_DIR=${OUTPUT_DIR}
+ -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
+ -DCMAKE_USER_MAKE_RULES_OVERRIDE=${CMAKE_USER_MAKE_RULES_OVERRIDE}
+ -DCMAKE_USER_MAKE_RULES_OVERRIDE_CXX=${CMAKE_USER_MAKE_RULES_OVERRIDE_CXX}
+ -DCMAKE_INSTALL_PREFIX=${OUTPUT_DIR}
+ -DCORE_SYSTEM_NAME=${CORE_SYSTEM_NAME}
+ -DENABLE_STATIC=1
+ -DBUILD_SHARED_LIBS=0)
+ # if there are no make rules override files available take care of manually passing on ARCH_DEFINES
+ if(NOT CMAKE_USER_MAKE_RULES_OVERRIDE AND NOT CMAKE_USER_MAKE_RULES_OVERRIDE_CXX)
+ # make sure we create strings, not lists
+ set(TMP_C_FLAGS "${CMAKE_C_FLAGS} ${ARCH_DEFINES}")
+ set(TMP_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARCH_DEFINES}")
+ list(APPEND BUILD_ARGS -DCMAKE_C_FLAGS=${TMP_C_FLAGS}
+ -DCMAKE_CXX_FLAGS=${TMP_CXX_FLAGS})
+ endif()
+
+ if(CMAKE_TOOLCHAIN_FILE)
+ list(APPEND BUILD_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE})
+ message("toolchain specified")
+ message(${BUILD_ARGS})
+ endif()
+
+ # prepare patchfile. ensure we have a clean file after reconfiguring
+ set(PATCH_FILE ${BUILD_DIR}/${id}/tmp/patch.cmake)
+ file(REMOVE ${PATCH_FILE})
+
+ # if there's a CMakeLists.txt use it to prepare the build
+ if(EXISTS ${dir}/CMakeLists.txt)
+ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${dir}/CMakeLists.txt)
+ file(APPEND ${PATCH_FILE}
+ "file(COPY ${dir}/CMakeLists.txt
+ DESTINATION ${BUILD_DIR}/${id}/src/${id})\n")
+ endif()
+
+ # check if we have patches to apply
+ file(GLOB patches ${dir}/*.patch)
+ list(SORT patches)
+ foreach(patch ${patches})
+ if(NOT PATCH_PROGRAM OR "${PATCH_PROGRAM}" STREQUAL "")
+ if(NOT PATCH_EXECUTABLE)
+ # find the path to the patch executable
+ find_program(PATCH_EXECUTABLE NAMES patch)
+
+ if(NOT PATCH_EXECUTABLE)
+ message(FATAL_ERROR "Missing patch command (we looked in ${CMAKE_PREFIX_PATH})")
+ endif()
+ endif()
+
+ set(PATCH_PROGRAM ${PATCH_EXECUTABLE})
+
+ # On Windows "patch.exe" can only handle CR-LF line-endings.
+ # Our patches have LF-only line endings - except when they
+ # have been checked out as part of a dependency hosted on Git
+ # and core.autocrlf=true.
+ if(WIN32)
+ file(READ ${patch} patch_content_hex HEX)
+ # Force handle LF-only line endings
+ if(NOT patch_content_hex MATCHES "0d0a")
+ set(PATCH_PROGRAM "\"${PATCH_PROGRAM}\" --binary")
+ endif()
+ endif()
+ endif()
+
+ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${patch})
+ file(APPEND ${PATCH_FILE}
+ "execute_process(COMMAND ${PATCH_PROGRAM} -p1 -i \"${patch}\")\n")
+ endforeach()
+
+
+ # if there's an install.txt use it to properly install the built files
+ set(INSTALL_COMMAND "")
+ if(EXISTS ${dir}/install.txt)
+ set(INSTALL_COMMAND INSTALL_COMMAND ${CMAKE_COMMAND}
+ -DINPUTDIR=${BUILD_DIR}/${id}/src/${id}-build/
+ -DINPUTFILE=${dir}/install.txt
+ -DDESTDIR=${OUTPUT_DIR}
+ -DENABLE_STATIC=1
+ "${extraflags}"
+ -P ${PROJECT_SOURCE_DIR}/install.cmake)
+ elseif(EXISTS ${dir}/noinstall.txt)
+ set(INSTALL_COMMAND INSTALL_COMMAND "")
+ endif()
+
+ # check if there's a platform-specific or generic deps.txt containing dependencies on other libraries
+ if(EXISTS ${dir}/${CORE_SYSTEM_NAME}-deps.txt)
+ file(STRINGS ${dir}/${CORE_SYSTEM_NAME}-deps.txt deps)
+ message(STATUS "${id} depends: ${deps}")
+ elseif(EXISTS ${dir}/deps.txt)
+ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${dir}/deps.txt)
+ file(STRINGS ${dir}/deps.txt deps)
+ message(STATUS "${id} depends: ${deps}")
+ else()
+ set(deps)
+ endif()
+
+ if(CROSS_AUTOCONF AND AUTOCONF_FILES)
+ foreach(afile ${AUTOCONF_FILES})
+ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${afile})
+ file(APPEND ${PATCH_FILE}
+ "message(STATUS \"AUTOCONF: copying ${afile} to ${BUILD_DIR}/${id}/src/${id}\")\n
+ file(COPY ${afile} DESTINATION ${BUILD_DIR}/${id}/src/${id})\n")
+ endforeach()
+ endif()
+
+ # if the patch file exists we need to set the PATCH_COMMAND
+ set(PATCH_COMMAND "")
+ if(EXISTS ${PATCH_FILE})
+ set(PATCH_COMMAND ${CMAKE_COMMAND} -P ${PATCH_FILE})
+ endif()
+
+ # prepare the setup of the call to externalproject_add()
+ set(EXTERNALPROJECT_SETUP PREFIX ${BUILD_DIR}/${id}
+ CMAKE_ARGS ${extraflags} ${BUILD_ARGS}
+ PATCH_COMMAND ${PATCH_COMMAND}
+ "${INSTALL_COMMAND}")
+
+ if(CMAKE_VERSION VERSION_GREATER 3.5.9)
+ list(APPEND EXTERNALPROJECT_SETUP GIT_SHALLOW 1)
+ endif()
+
+ # if there's an url defined we need to pass that to externalproject_add()
+ if(DEFINED url AND NOT "${url}" STREQUAL "")
+ # check if there's a third parameter in the file
+ if(deflength GREATER 2)
+ # the third parameter is considered as a revision of a git repository
+ list(GET def 2 revision)
+
+ externalproject_add(${id}
+ GIT_REPOSITORY ${url}
+ GIT_TAG ${revision}
+ "${EXTERNALPROJECT_SETUP}")
+
+ # For patchfiles to work, disable (users globally set) autocrlf=true
+ if(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_GREATER 3.7)
+ message(AUTHOR_WARNING "Make use of GIT_CONFIG")
+ endif()
+ if(WIN32 AND patches)
+ externalproject_add_step(${id} gitconfig
+ COMMAND git config core.autocrlf false
+ COMMAND git rm -rf --cached .
+ COMMAND git reset --hard HEAD
+ COMMENT "Performing gitconfig step: Disabling autocrlf to enable patching for '${id}'"
+ DEPENDERS patch
+ WORKING_DIRECTORY <SOURCE_DIR>)
+ endif()
+ else()
+ set(CONFIGURE_COMMAND "")
+ if(NOT WIN32)
+ # manually specify the configure command to be able to pass in the custom PKG_CONFIG_PATH
+ set(CONFIGURE_COMMAND PKG_CONFIG_PATH=${OUTPUT_DIR}/lib/pkgconfig
+ ${CMAKE_COMMAND} -DCMAKE_LIBRARY_PATH=${OUTPUT_DIR}/lib ${extraflags} ${BUILD_ARGS}
+ ${BUILD_DIR}/${id}/src/${id}
+ -DPACKAGE_CONFIG_PATH=${OUTPUT_DIR}/lib/pkgconfig
+ -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
+ -DOUTPUT_DIR=${OUTPUT_DIR}
+ -DCMAKE_PREFIX_PATH=${OUTPUT_DIR}
+ -DCMAKE_INSTALL_PREFIX=${OUTPUT_DIR}
+ -DCMAKE_EXE_LINKER_FLAGS=-L${OUTPUT_DIR}/lib
+ -DCMAKE_INCLUDE_PATH=${OUTPUT_DIR}/include)
+ endif()
+
+ externalproject_add(${id}
+ URL ${url}
+ DOWNLOAD_DIR ${BUILD_DIR}/download
+ CONFIGURE_COMMAND ${CONFIGURE_COMMAND}
+ "${EXTERNALPROJECT_SETUP}")
+ endif()
+ else()
+ externalproject_add(${id}
+ SOURCE_DIR ${dir}
+ "${EXTERNALPROJECT_SETUP}")
+ endif()
+
+ if(deps)
+ add_dependencies(${id} ${deps})
+ endif()
+ endif()
+
+ # if the dependency is available for the target platform add it to the list of the addon's dependencies
+ # (even if the target already exists as it still has to be built before the addon)
+ if(${platform_found})
+ list(APPEND ${addon}_DEPS ${id})
+ endif()
+ endif()
+ endforeach()
+
+ # make the ${addon}_DEPS variable available to the calling script
+ set(${addon}_DEPS "${${addon}_DEPS}" PARENT_SCOPE)
+endfunction()
+
diff --git a/cmake/scripts/common/Macros.cmake b/cmake/scripts/common/Macros.cmake
new file mode 100644
index 0000000000..62dfb873b5
--- /dev/null
+++ b/cmake/scripts/common/Macros.cmake
@@ -0,0 +1,622 @@
+# This script holds the main functions used to construct the build system
+
+# include system specific macros
+include(${CORE_SOURCE_DIR}/project/cmake/scripts/${CORE_SYSTEM_NAME}/Macros.cmake)
+
+# IDEs: Group source files in target in folders (file system hierarchy)
+# Source: http://blog.audio-tk.com/2015/09/01/sorting-source-files-and-projects-in-folders-with-cmake-and-visual-studioxcode/
+# Arguments:
+# target The target that shall be grouped by folders.
+# Optional Arguments:
+# RELATIVE allows to specify a different reference folder.
+function(source_group_by_folder target)
+ if(NOT TARGET ${target})
+ message(FATAL_ERROR "There is no target named '${target}'")
+ endif()
+
+ set(SOURCE_GROUP_DELIMITER "/")
+
+ cmake_parse_arguments(arg "" "RELATIVE" "" ${ARGN})
+ if(arg_RELATIVE)
+ set(relative_dir ${arg_RELATIVE})
+ else()
+ set(relative_dir ${CMAKE_CURRENT_SOURCE_DIR})
+ endif()
+
+ get_property(files TARGET ${target} PROPERTY SOURCES)
+ if(files)
+ list(SORT files)
+
+ if(CMAKE_GENERATOR STREQUAL Xcode)
+ set_target_properties(${target} PROPERTIES SOURCES "${files}")
+ endif()
+ endif()
+ foreach(file ${files})
+ if(NOT IS_ABSOLUTE ${file})
+ set(file ${CMAKE_CURRENT_SOURCE_DIR}/${file})
+ endif()
+ file(RELATIVE_PATH relative_file ${relative_dir} ${file})
+ get_filename_component(dir "${relative_file}" DIRECTORY)
+ if(NOT dir STREQUAL "${last_dir}")
+ if(files)
+ source_group("${last_dir}" FILES ${files})
+ endif()
+ set(files "")
+ endif()
+ set(files ${files} ${file})
+ set(last_dir "${dir}")
+ endforeach(file)
+ if(files)
+ source_group("${last_dir}" FILES ${files})
+ endif()
+endfunction()
+
+# Add sources to main application
+# Arguments:
+# name name of the library to add
+# Implicit arguments:
+# ENABLE_STATIC_LIBS Build static libraries per directory
+# SOURCES the sources of the library
+# HEADERS the headers of the library (only for IDE support)
+# OTHERS other library related files (only for IDE support)
+# On return:
+# Library will be built, optionally added to ${core_DEPENDS}
+# Sets CORE_LIBRARY for calls for setting target specific options
+function(core_add_library name)
+ if(ENABLE_STATIC_LIBS)
+ add_library(${name} STATIC ${SOURCES} ${HEADERS} ${OTHERS})
+ set_target_properties(${name} PROPERTIES PREFIX "")
+ set(core_DEPENDS ${name} ${core_DEPENDS} CACHE STRING "" FORCE)
+ add_dependencies(${name} libcpluff ffmpeg dvdnav crossguid)
+ set(CORE_LIBRARY ${name} PARENT_SCOPE)
+
+ # Add precompiled headers to Kodi main libraries
+ if(CORE_SYSTEM_NAME STREQUAL windows)
+ add_precompiled_header(${name} pch.h ${CORE_SOURCE_DIR}/xbmc/platform/win32/pch.cpp PCH_TARGET kodi)
+ set_language_cxx(${name})
+ target_link_libraries(${name} PUBLIC effects11)
+ endif()
+ else()
+ foreach(src IN LISTS SOURCES HEADERS OTHERS)
+ get_filename_component(src_path "${src}" ABSOLUTE)
+ list(APPEND FILES ${src_path})
+ endforeach()
+ target_sources(lib${APP_NAME_LC} PRIVATE ${FILES})
+ set(CORE_LIBRARY lib${APP_NAME_LC} PARENT_SCOPE)
+ endif()
+endfunction()
+
+# Add a test library, and add sources to list for gtest integration macros
+function(core_add_test_library name)
+ if(ENABLE_STATIC_LIBS)
+ add_library(${name} STATIC ${SOURCES} ${SUPPORTED_SOURCES} ${HEADERS} ${OTHERS})
+ set_target_properties(${name} PROPERTIES PREFIX ""
+ EXCLUDE_FROM_ALL 1
+ FOLDER "Build Utilities/tests")
+ add_dependencies(${name} libcpluff ffmpeg dvdnav crossguid)
+ set(test_archives ${test_archives} ${name} CACHE STRING "" FORCE)
+ endif()
+ foreach(src IN LISTS SOURCES SUPPORTED_SOURCES HEADERS OTHERS)
+ get_filename_component(src_path "${src}" ABSOLUTE)
+ set(test_sources "${src_path}" ${test_sources} CACHE STRING "" FORCE)
+ endforeach()
+endfunction()
+
+# Add an addon callback library
+# Arguments:
+# name name of the library to add
+# Implicit arguments:
+# SOURCES the sources of the library
+# HEADERS the headers of the library (only for IDE support)
+# OTHERS other library related files (only for IDE support)
+# On return:
+# Library target is defined and added to LIBRARY_FILES
+function(core_add_addon_library name)
+ get_filename_component(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+ list(APPEND SOURCES lib${name}.cpp)
+ core_add_shared_library(${name} OUTPUT_DIRECTORY addons/${DIRECTORY})
+ set_target_properties(${name} PROPERTIES FOLDER addons)
+ target_include_directories(${name} PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi
+ ${CORE_SOURCE_DIR}/xbmc)
+endfunction()
+
+# Add an dl-loaded shared library
+# Arguments:
+# name name of the library to add
+# Optional arguments:
+# WRAPPED wrap this library on POSIX platforms to add VFS support for
+# libraries that would otherwise not support it.
+# OUTPUT_DIRECTORY where to create the library in the build dir
+# (default: system)
+# Implicit arguments:
+# SOURCES the sources of the library
+# HEADERS the headers of the library (only for IDE support)
+# OTHERS other library related files (only for IDE support)
+# On return:
+# Library target is defined and added to LIBRARY_FILES
+function(core_add_shared_library name)
+ cmake_parse_arguments(arg "WRAPPED" "OUTPUT_DIRECTORY" "" ${ARGN})
+ if(arg_OUTPUT_DIRECTORY)
+ set(OUTPUT_DIRECTORY ${arg_OUTPUT_DIRECTORY})
+ else()
+ if(NOT CORE_SYSTEM_NAME STREQUAL windows)
+ set(OUTPUT_DIRECTORY system)
+ endif()
+ endif()
+ if(CORE_SYSTEM_NAME STREQUAL windows)
+ set(OUTPUT_NAME lib${name})
+ else()
+ set(OUTPUT_NAME lib${name}-${ARCH})
+ endif()
+
+ if(NOT arg_WRAPPED OR CORE_SYSTEM_NAME STREQUAL windows)
+ add_library(${name} SHARED ${SOURCES} ${HEADERS} ${OTHERS})
+ set_target_properties(${name} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${OUTPUT_DIRECTORY}
+ RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${OUTPUT_DIRECTORY}
+ OUTPUT_NAME ${OUTPUT_NAME} PREFIX "")
+ foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})
+ string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG)
+ set_target_properties(${name} PROPERTIES LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/${OUTPUT_DIRECTORY}
+ RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/${OUTPUT_DIRECTORY})
+ endforeach()
+
+ set(LIBRARY_FILES ${LIBRARY_FILES} ${CMAKE_BINARY_DIR}/${OUTPUT_DIRECTORY}/${OUTPUT_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} CACHE STRING "" FORCE)
+ add_dependencies(${APP_NAME_LC}-libraries ${name})
+ else()
+ add_library(${name} STATIC ${SOURCES} ${HEADERS} ${OTHERS})
+ set_target_properties(${name} PROPERTIES POSITION_INDEPENDENT_CODE 1)
+ core_link_library(${name} ${OUTPUT_DIRECTORY}/lib${name})
+ endif()
+endfunction()
+
+# Sets the compile language for all C source files in a target to CXX.
+# Needs to be called from the CMakeLists.txt that defines the target.
+# Arguments:
+# target target
+function(set_language_cxx target)
+ get_property(sources TARGET ${target} PROPERTY SOURCES)
+ foreach(file IN LISTS sources)
+ if(file MATCHES "\.c$")
+ set_source_files_properties(${file} PROPERTIES LANGUAGE CXX)
+ endif()
+ endforeach()
+endfunction()
+
+# Add a data file to installation list with a mirror in build tree
+# Mirroring files in the buildtree allows to execute the app from there.
+# Arguments:
+# file full path to file to mirror
+# Optional Arguments:
+# NO_INSTALL: exclude file from installation target (only mirror)
+# DIRECTORY: directory where the file should be mirrored to
+# (default: preserve tree structure relative to CORE_SOURCE_DIR)
+# On return:
+# Files is mirrored to the build tree and added to ${install_data}
+# (if NO_INSTALL is not given).
+function(copy_file_to_buildtree file)
+ cmake_parse_arguments(arg "NO_INSTALL" "DIRECTORY" "" ${ARGN})
+ if(arg_DIRECTORY)
+ set(outdir ${arg_DIRECTORY})
+ get_filename_component(outfile ${file} NAME)
+ set(outfile ${outdir}/${outfile})
+ else()
+ string(REPLACE "${CORE_SOURCE_DIR}/" "" outfile ${file})
+ get_filename_component(outdir ${outfile} DIRECTORY)
+ endif()
+
+ if(NOT TARGET export-files)
+ file(REMOVE ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/ExportFiles.cmake)
+ add_custom_target(export-files ALL COMMENT "Copying files into build tree"
+ COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/ExportFiles.cmake)
+ set_target_properties(export-files PROPERTIES FOLDER "Build Utilities")
+ file(APPEND ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/ExportFiles.cmake "# Export files to build tree\n")
+ endif()
+
+ # Exclude autotools build artefacts and other blacklisted files in source tree.
+ if(file MATCHES "(Makefile|\.in|\.xbt|\.so|\.dylib|\.gitignore)$")
+ if(VERBOSE)
+ message(STATUS "copy_file_to_buildtree - ignoring file: ${file}")
+ endif()
+ return()
+ endif()
+
+ if(NOT file STREQUAL ${CMAKE_BINARY_DIR}/${outfile})
+ if(VERBOSE)
+ message(STATUS "copy_file_to_buildtree - copying file: ${file} -> ${CMAKE_BINARY_DIR}/${outfile}")
+ endif()
+ file(APPEND ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/ExportFiles.cmake
+ "file(COPY \"${file}\" DESTINATION \"${CMAKE_BINARY_DIR}/${outdir}\")\n")
+ endif()
+
+ if(NOT arg_NO_INSTALL)
+ list(APPEND install_data ${outfile})
+ set(install_data ${install_data} PARENT_SCOPE)
+ endif()
+endfunction()
+
+# Add data files to installation list with a mirror in build tree.
+# reads list of files to install from a given list of text files.
+# Arguments:
+# pattern globbing pattern for text files to read
+# Optional Arguments:
+# NO_INSTALL: exclude files from installation target
+# Implicit arguments:
+# CORE_SOURCE_DIR - root of source tree
+# On return:
+# Files are mirrored to the build tree and added to ${install_data}
+# (if NO_INSTALL is not given).
+function(copy_files_from_filelist_to_buildtree pattern)
+ # copies files listed in text files to the buildtree
+ # Input: [glob pattern: filepattern]
+ cmake_parse_arguments(arg "NO_INSTALL" "" "" ${ARGN})
+ list(APPEND pattern ${ARGN})
+ list(SORT pattern)
+ if(VERBOSE)
+ message(STATUS "copy_files_from_filelist_to_buildtree - got pattern: ${pattern}")
+ endif()
+ foreach(pat ${pattern})
+ file(GLOB filenames ${pat})
+ foreach(filename ${filenames})
+ string(STRIP ${filename} filename)
+ core_file_read_filtered(fstrings ${filename})
+ foreach(dir ${fstrings})
+ string(REPLACE " " ";" dir ${dir})
+ list(GET dir 0 src)
+ list(LENGTH dir len)
+ if(len EQUAL 1)
+ set(dest)
+ else()
+ list(GET dir -1 dest)
+ endif()
+
+ # If the full path to an existing file is specified then add that single file.
+ # Don't recursively add all files with the given name.
+ if(EXISTS ${CORE_SOURCE_DIR}/${src} AND NOT IS_DIRECTORY ${CORE_SOURCE_DIR}/${src})
+ set(files ${src})
+ else()
+ file(GLOB_RECURSE files RELATIVE ${CORE_SOURCE_DIR} ${CORE_SOURCE_DIR}/${src})
+ endif()
+
+ foreach(file ${files})
+ if(arg_NO_INSTALL)
+ copy_file_to_buildtree(${CORE_SOURCE_DIR}/${file} DIRECTORY ${dest} NO_INSTALL)
+ else()
+ copy_file_to_buildtree(${CORE_SOURCE_DIR}/${file} DIRECTORY ${dest})
+ endif()
+ endforeach()
+ endforeach()
+ endforeach()
+ endforeach()
+ set(install_data ${install_data} PARENT_SCOPE)
+endfunction()
+
+# helper macro to set modified variables in parent scope
+macro(export_dep)
+ set(SYSTEM_INCLUDES ${SYSTEM_INCLUDES} PARENT_SCOPE)
+ set(DEPLIBS ${DEPLIBS} PARENT_SCOPE)
+ set(DEP_DEFINES ${DEP_DEFINES} PARENT_SCOPE)
+ set(${depup}_FOUND ${${depup}_FOUND} PARENT_SCOPE)
+ mark_as_advanced(${depup}_LIBRARIES)
+endmacro()
+
+# add a required dependency of main application
+# Arguments:
+# dep name of find rule for dependency, used uppercased for variable prefix
+# On return:
+# dependency added to ${SYSTEM_INCLUDES}, ${DEPLIBS} and ${DEP_DEFINES}
+function(core_require_dep dep)
+ find_package(${dep} REQUIRED)
+ string(TOUPPER ${dep} depup)
+ list(APPEND SYSTEM_INCLUDES ${${depup}_INCLUDE_DIRS})
+ list(APPEND DEPLIBS ${${depup}_LIBRARIES})
+ list(APPEND DEP_DEFINES ${${depup}_DEFINITIONS})
+ export_dep()
+endfunction()
+
+# add a required dyloaded dependency of main application
+# Arguments:
+# dep name of find rule for dependency, used uppercased for variable prefix
+# On return:
+# dependency added to ${SYSTEM_INCLUDES}, ${dep}_SONAME is set up
+function(core_require_dyload_dep dep)
+ find_package(${dep} REQUIRED)
+ string(TOUPPER ${dep} depup)
+ list(APPEND SYSTEM_INCLUDES ${${depup}_INCLUDE_DIRS})
+ list(APPEND DEP_DEFINES ${${depup}_DEFINITIONS})
+ find_soname(${depup} REQUIRED)
+ export_dep()
+ set(${depup}_SONAME ${${depup}_SONAME} PARENT_SCOPE)
+endfunction()
+
+# helper macro for optional deps
+macro(setup_enable_switch)
+ string(TOUPPER ${dep} depup)
+ if(ARGV1)
+ set(enable_switch ${ARGV1})
+ else()
+ set(enable_switch ENABLE_${depup})
+ endif()
+ # normal options are boolean, so we override set our ENABLE_FOO var to allow "auto" handling
+ set(${enable_switch} "AUTO" CACHE STRING "Enable ${depup} support?")
+endmacro()
+
+# add an optional dependency of main application
+# Arguments:
+# dep name of find rule for dependency, used uppercased for variable prefix
+# On return:
+# dependency optionally added to ${SYSTEM_INCLUDES}, ${DEPLIBS} and ${DEP_DEFINES}
+function(core_optional_dep dep)
+ setup_enable_switch()
+ if(${enable_switch} STREQUAL AUTO)
+ find_package(${dep})
+ elseif(${${enable_switch}})
+ find_package(${dep} REQUIRED)
+ endif()
+
+ if(${depup}_FOUND)
+ list(APPEND SYSTEM_INCLUDES ${${depup}_INCLUDE_DIRS})
+ list(APPEND DEPLIBS ${${depup}_LIBRARIES})
+ list(APPEND DEP_DEFINES ${${depup}_DEFINITIONS})
+ set(final_message ${final_message} "${depup} enabled: Yes" PARENT_SCOPE)
+ export_dep()
+ else()
+ set(final_message ${final_message} "${depup} enabled: No" PARENT_SCOPE)
+ endif()
+endfunction()
+
+# add an optional dyloaded dependency of main application
+# Arguments:
+# dep name of find rule for dependency, used uppercased for variable prefix
+# On return:
+# dependency optionally added to ${SYSTEM_INCLUDES}, ${DEP_DEFINES}, ${dep}_SONAME is set up
+function(core_optional_dyload_dep dep)
+ setup_enable_switch()
+ if(${enable_switch})
+ find_package(${dep})
+ if(${depup}_FOUND)
+ list(APPEND SYSTEM_INCLUDES ${${depup}_INCLUDE_DIRS})
+ find_soname(${depup} REQUIRED)
+ list(APPEND DEP_DEFINES ${${depup}_DEFINITIONS})
+ set(final_message ${final_message} "${depup} enabled: Yes" PARENT_SCOPE)
+ export_dep()
+ set(${depup}_SONAME ${${depup}_SONAME} PARENT_SCOPE)
+ endif()
+ endif()
+endfunction()
+
+function(core_file_read_filtered result filepattern)
+ # Reads STRINGS from text files
+ # with comments filtered out
+ # Result: [list: result]
+ # Input: [glob pattern: filepattern]
+ file(GLOB filenames ${filepattern})
+ list(SORT filenames)
+ foreach(filename ${filenames})
+ if(VERBOSE)
+ message(STATUS "core_file_read_filtered - filename: ${filename}")
+ endif()
+ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${filename})
+ file(STRINGS ${filename} fstrings REGEX "^[^#//]")
+ foreach(fstring ${fstrings})
+ string(REGEX REPLACE "^(.*)#(.*)" "\\1" fstring ${fstring})
+ string(REGEX REPLACE "[ \n\r\t]//.*" "" fstring ${fstring})
+ string(STRIP ${fstring} fstring)
+ list(APPEND filename_strings ${fstring})
+ endforeach()
+ endforeach()
+ set(${result} ${filename_strings} PARENT_SCOPE)
+endfunction()
+
+function(core_add_subdirs_from_filelist files)
+ # Adds subdirectories from a sorted list of files
+ # Input: [list: filenames] [bool: sort]
+ foreach(arg ${ARGN})
+ list(APPEND files ${arg})
+ endforeach()
+ list(SORT files)
+ if(VERBOSE)
+ message(STATUS "core_add_subdirs_from_filelist - got pattern: ${files}")
+ endif()
+ foreach(filename ${files})
+ string(STRIP ${filename} filename)
+ core_file_read_filtered(fstrings ${filename})
+ foreach(subdir ${fstrings})
+ string(REPLACE " " ";" subdir ${subdir})
+ list(GET subdir 0 subdir_src)
+ list(GET subdir -1 subdir_dest)
+ if(VERBOSE)
+ message(STATUS " core_add_subdirs_from_filelist - adding subdir: ${CORE_SOURCE_DIR}/${subdir_src} -> ${CORE_BUILD_DIR}/${subdir_dest}")
+ endif()
+ add_subdirectory(${CORE_SOURCE_DIR}/${subdir_src} ${CORE_BUILD_DIR}/${subdir_dest})
+ endforeach()
+ endforeach()
+endfunction()
+
+macro(core_add_optional_subdirs_from_filelist pattern)
+ # Adds subdirectories from text files
+ # if the option(s) in the 3rd field are enabled
+ # Input: [glob pattern: filepattern]
+ foreach(arg ${ARGN})
+ list(APPEND pattern ${arg})
+ endforeach()
+ foreach(elem ${pattern})
+ string(STRIP ${elem} elem)
+ list(APPEND filepattern ${elem})
+ endforeach()
+
+ file(GLOB filenames ${filepattern})
+ list(SORT filenames)
+ if(VERBOSE)
+ message(STATUS "core_add_optional_subdirs_from_filelist - got pattern: ${filenames}")
+ endif()
+
+ foreach(filename ${filenames})
+ if(VERBOSE)
+ message(STATUS "core_add_optional_subdirs_from_filelist - reading file: ${filename}")
+ endif()
+ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${filename})
+ file(STRINGS ${filename} fstrings REGEX "^[^#//]")
+ foreach(line ${fstrings})
+ string(REPLACE " " ";" line "${line}")
+ list(GET line 0 subdir_src)
+ list(GET line 1 subdir_dest)
+ list(GET line 3 opts)
+ foreach(opt ${opts})
+ if(ENABLE_${opt})
+ if(VERBOSE)
+ message(STATUS " core_add_optional_subdirs_from_filelist - adding subdir: ${CORE_SOURCE_DIR}/${subdir_src} -> ${CORE_BUILD_DIR}/${subdir_dest}")
+ endif()
+ add_subdirectory(${CORE_SOURCE_DIR}/${subdir_src} ${CORE_BUILD_DIR}/${subdir_dest})
+ else()
+ if(VERBOSE)
+ message(STATUS " core_add_optional_subdirs_from_filelist: OPTION ${opt} not enabled for ${subdir_src}, skipping subdir")
+ endif()
+ endif()
+ endforeach()
+ endforeach()
+ endforeach()
+endmacro()
+
+# Generates an RFC2822 timestamp
+#
+# The following variable is set:
+# RFC2822_TIMESTAMP
+function(rfc2822stamp)
+ execute_process(COMMAND date -R
+ OUTPUT_VARIABLE RESULT)
+ set(RFC2822_TIMESTAMP ${RESULT} PARENT_SCOPE)
+endfunction()
+
+# Generates an user stamp from git config info
+#
+# The following variable is set:
+# PACKAGE_MAINTAINER - user stamp in the form of "username <username@example.com>"
+# if no git tree is found, value is set to "nobody <nobody@example.com>"
+function(userstamp)
+ find_package(Git)
+ if(GIT_FOUND AND EXISTS ${CORE_SOURCE_DIR}/.git)
+ execute_process(COMMAND ${GIT_EXECUTABLE} config user.name
+ OUTPUT_VARIABLE username
+ WORKING_DIRECTORY ${CORE_SOURCE_DIR}
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process(COMMAND ${GIT_EXECUTABLE} config user.email
+ OUTPUT_VARIABLE useremail
+ WORKING_DIRECTORY ${CORE_SOURCE_DIR}
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ set(PACKAGE_MAINTAINER "${username} <${useremail}>" PARENT_SCOPE)
+ else()
+ set(PACKAGE_MAINTAINER "nobody <nobody@example.com>" PARENT_SCOPE)
+ endif()
+endfunction()
+
+# Parses git info and sets variables used to identify the build
+# Arguments:
+# stamp variable name to return
+# Optional Arguments:
+# FULL: generate git HEAD commit in the form of 'YYYYMMDD-hash'
+# if git tree is dirty, value is set in the form of 'YYYYMMDD-hash-dirty'
+# if no git tree is found, value is set in the form of 'YYYYMMDD-nogitfound'
+# if FULL is not given, stamp is generated following the same process as above
+# but without 'YYYYMMDD'
+# On return:
+# Variable is set with generated stamp to PARENT_SCOPE
+function(core_find_git_rev stamp)
+ # allow manual setting GIT_VERSION
+ if(GIT_VERSION)
+ set(${stamp} ${GIT_VERSION} PARENT_SCOPE)
+ else()
+ find_package(Git)
+ if(GIT_FOUND AND EXISTS ${CORE_SOURCE_DIR}/.git)
+ execute_process(COMMAND ${GIT_EXECUTABLE} diff-files --ignore-submodules --quiet --
+ RESULT_VARIABLE status_code
+ WORKING_DIRECTORY ${CORE_SOURCE_DIR})
+ if(NOT status_code)
+ execute_process(COMMAND ${GIT_EXECUTABLE} diff-index --ignore-submodules --quiet HEAD --
+ RESULT_VARIABLE status_code
+ WORKING_DIRECTORY ${CORE_SOURCE_DIR})
+ endif()
+ if(status_code)
+ execute_process(COMMAND ${GIT_EXECUTABLE} log -n 1 --pretty=format:"%h-dirty" HEAD
+ OUTPUT_VARIABLE HASH
+ WORKING_DIRECTORY ${CORE_SOURCE_DIR})
+ string(SUBSTRING ${HASH} 1 13 HASH)
+ else()
+ execute_process(COMMAND ${GIT_EXECUTABLE} log -n 1 --pretty=format:"%h" HEAD
+ OUTPUT_VARIABLE HASH
+ WORKING_DIRECTORY ${CORE_SOURCE_DIR})
+ string(SUBSTRING ${HASH} 1 7 HASH)
+ endif()
+ execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --pretty=format:"%cd" --date=short HEAD
+ OUTPUT_VARIABLE DATE
+ WORKING_DIRECTORY ${CORE_SOURCE_DIR})
+ string(SUBSTRING ${DATE} 1 10 DATE)
+ string(REPLACE "-" "" DATE ${DATE})
+ else()
+ string(TIMESTAMP DATE "%Y%m%d" UTC)
+ set(HASH "nogitfound")
+ endif()
+ cmake_parse_arguments(arg "FULL" "" "" ${ARGN})
+ if(arg_FULL)
+ set(${stamp} ${DATE}-${HASH} PARENT_SCOPE)
+ else()
+ set(${stamp} ${HASH} PARENT_SCOPE)
+ endif()
+ endif()
+endfunction()
+
+# Parses version.txt and libKODI_guilib.h and sets variables
+# used to construct dirs structure, file naming, API version, etc.
+#
+# The following variables are set from version.txt:
+# APP_NAME - app name
+# APP_NAME_LC - lowercased app name
+# APP_NAME_UC - uppercased app name
+# COMPANY_NAME - company name
+# APP_VERSION_MAJOR - the app version major
+# APP_VERSION_MINOR - the app version minor
+# APP_VERSION_TAG - the app version tag
+# APP_VERSION_TAG_LC - lowercased app version tag
+# APP_VERSION - the app version (${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}-${APP_VERSION_TAG})
+# APP_ADDON_API - the addon API version in the form of 16.9.702
+# FILE_VERSION - file version in the form of 16,9,702,0 - Windows only
+#
+# The following variables are set from libKODI_guilib.h:
+# guilib_version - current ADDONGUI API version
+# guilib_version_min - minimal ADDONGUI API version
+macro(core_find_versions)
+ include(CMakeParseArguments)
+ core_file_read_filtered(version_list ${CORE_SOURCE_DIR}/version.txt)
+ string(REPLACE " " ";" version_list "${version_list}")
+ cmake_parse_arguments(APP "" "APP_NAME;COMPANY_NAME;WEBSITE;VERSION_MAJOR;VERSION_MINOR;VERSION_TAG;VERSION_CODE;ADDON_API" "" ${version_list})
+
+ set(APP_NAME ${APP_APP_NAME}) # inconsistency but APP_APP_NAME looks weird
+ string(TOLOWER ${APP_APP_NAME} APP_NAME_LC)
+ string(TOUPPER ${APP_APP_NAME} APP_NAME_UC)
+ set(COMPANY_NAME ${APP_COMPANY_NAME})
+ set(APP_VERSION ${APP_VERSION_MAJOR}.${APP_VERSION_MINOR})
+ if(APP_VERSION_TAG)
+ set(APP_VERSION ${APP_VERSION}-${APP_VERSION_TAG})
+ string(TOLOWER ${APP_VERSION_TAG} APP_VERSION_TAG_LC)
+ endif()
+ string(REPLACE "." "," FILE_VERSION ${APP_ADDON_API}.0)
+ file(STRINGS ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h guilib_version REGEX "^.*GUILIB_API_VERSION (.*)$")
+ string(REGEX REPLACE ".*\"(.*)\"" "\\1" guilib_version ${guilib_version})
+ file(STRINGS ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h guilib_version_min REGEX "^.*GUILIB_MIN_API_VERSION (.*)$")
+ string(REGEX REPLACE ".*\"(.*)\"" "\\1" guilib_version_min ${guilib_version_min})
+ # unset variables not used anywhere else
+ unset(version_list)
+ unset(APP_APP_NAME)
+
+ # bail if we can't parse version.txt
+ if(NOT DEFINED APP_VERSION_MAJOR OR NOT DEFINED APP_VERSION_MINOR)
+ message(FATAL_ERROR "Could not determine app version! Make sure that ${CORE_SOURCE_DIR}/version.txt exists")
+ endif()
+
+ # bail if we can't parse libKODI_guilib.h
+ if(NOT DEFINED guilib_version OR NOT DEFINED guilib_version_min)
+ message(FATAL_ERROR "Could not determine add-on API version! Make sure that ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h exists")
+ endif()
+endmacro()
+
diff --git a/cmake/scripts/common/PrepareEnv.cmake b/cmake/scripts/common/PrepareEnv.cmake
new file mode 100644
index 0000000000..51be7395a8
--- /dev/null
+++ b/cmake/scripts/common/PrepareEnv.cmake
@@ -0,0 +1,64 @@
+# parse version.txt and libKODI_guilib.h to get the version and API info
+include(${CORE_SOURCE_DIR}/project/cmake/scripts/common/Macros.cmake)
+core_find_versions()
+
+# in case we need to download something, set KODI_MIRROR to the default if not alread set
+if(NOT DEFINED KODI_MIRROR)
+ set(KODI_MIRROR "http://mirrors.kodi.tv")
+endif()
+
+### copy all the addon binding header files to include/kodi
+# make sure include/kodi exists and is empty
+set(APP_LIB_DIR ${ADDON_DEPENDS_PATH}/lib/${APP_NAME_LC})
+if(NOT EXISTS "${APP_LIB_DIR}/")
+ file(MAKE_DIRECTORY ${APP_LIB_DIR})
+endif()
+
+set(APP_DATA_DIR ${ADDON_DEPENDS_PATH}/share/${APP_NAME_LC})
+if(NOT EXISTS "${APP_DATA_DIR}/")
+ file(MAKE_DIRECTORY ${APP_DATA_DIR})
+endif()
+
+set(APP_INCLUDE_DIR ${ADDON_DEPENDS_PATH}/include/${APP_NAME_LC})
+if(NOT EXISTS "${APP_INCLUDE_DIR}/")
+ file(MAKE_DIRECTORY ${APP_INCLUDE_DIR})
+endif()
+
+# make sure C++11 is always set
+if(NOT WIN32)
+ string(REGEX MATCH "-std=(gnu|c)\\+\\+11" cxx11flag "${CMAKE_CXX_FLAGS}")
+ if(NOT cxx11flag)
+ set(CXX11_SWITCH "-std=c++11")
+ endif()
+endif()
+
+# generate the proper KodiConfig.cmake file
+configure_file(${CORE_SOURCE_DIR}/project/cmake/KodiConfig.cmake.in ${APP_LIB_DIR}/KodiConfig.cmake @ONLY)
+
+# copy cmake helpers to lib/kodi
+file(COPY ${CORE_SOURCE_DIR}/project/cmake/scripts/common/AddonHelpers.cmake
+ ${CORE_SOURCE_DIR}/project/cmake/scripts/common/AddOptions.cmake
+ DESTINATION ${APP_LIB_DIR})
+
+### copy all the addon binding header files to include/kodi
+# parse addon-bindings.mk to get the list of header files to copy
+core_file_read_filtered(bindings ${CORE_SOURCE_DIR}/xbmc/addons/addon-bindings.mk)
+foreach(binding ${bindings})
+ string(REPLACE " =" ";" binding "${binding}")
+ string(REPLACE "+=" ";" binding "${binding}")
+ list(GET binding 1 header)
+ # copy the header file to include/kodi
+ configure_file(${CORE_SOURCE_DIR}/${header} ${APP_INCLUDE_DIR} COPYONLY)
+endforeach()
+
+### processing additional tools required by the platform
+if(EXISTS ${CORE_SOURCE_DIR}/project/cmake/scripts/${CORE_SYSTEM_NAME}/tools/)
+ file(GLOB platform_tools ${CORE_SOURCE_DIR}/project/cmake/scripts/${CORE_SYSTEM_NAME}/tools/*.cmake)
+ foreach(platform_tool ${platform_tools})
+ get_filename_component(platform_tool_name ${platform_tool} NAME_WE)
+ message(STATUS "Processing ${CORE_SYSTEM_NAME} specific tool: ${platform_tool_name}")
+
+ # include the file
+ include(${platform_tool})
+ endforeach()
+endif()
diff --git a/cmake/scripts/common/ProjectMacros.cmake b/cmake/scripts/common/ProjectMacros.cmake
new file mode 100644
index 0000000000..e73ef903ed
--- /dev/null
+++ b/cmake/scripts/common/ProjectMacros.cmake
@@ -0,0 +1,89 @@
+# This script holds macros which are project specific
+
+# Pack a skin xbt file
+# Arguments:
+# input input directory to pack
+# output ouput xbt file
+# On return:
+# xbt is added to ${XBT_FILES}
+function(pack_xbt input output)
+ file(GLOB_RECURSE MEDIA_FILES ${input}/*)
+ get_filename_component(dir ${output} DIRECTORY)
+ add_custom_command(OUTPUT ${output}
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${dir}
+ COMMAND TexturePacker::TexturePacker
+ ARGS -input ${input}
+ -output ${output}
+ -dupecheck
+ DEPENDS ${MEDIA_FILES})
+ list(APPEND XBT_FILES ${output})
+ set(XBT_FILES ${XBT_FILES} PARENT_SCOPE)
+endfunction()
+
+# Add a skin to installation list, mirroring it in build tree, packing textures
+# Arguments:
+# skin skin directory
+# On return:
+# xbt is added to ${XBT_FILES}, data added to ${install_data}, mirror in build tree
+function(copy_skin_to_buildtree skin)
+ file(GLOB_RECURSE FILES ${skin}/*)
+ file(GLOB_RECURSE MEDIA_FILES ${skin}/media/*)
+ list(REMOVE_ITEM FILES ${MEDIA_FILES})
+ foreach(file ${FILES})
+ copy_file_to_buildtree(${file})
+ endforeach()
+ file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${dest}/media)
+ string(REPLACE "${CORE_SOURCE_DIR}/" "" dest ${skin})
+ pack_xbt(${skin}/media ${CMAKE_BINARY_DIR}/${dest}/media/Textures.xbt)
+
+ file(GLOB THEMES RELATIVE ${skin}/themes ${skin}/themes/*)
+ foreach(theme ${THEMES})
+ pack_xbt(${skin}/themes/${theme} ${CMAKE_BINARY_DIR}/${dest}/media/${theme}.xbt)
+ endforeach()
+
+ set(XBT_FILES ${XBT_FILES} PARENT_SCOPE)
+ set(install_data ${install_data} PARENT_SCOPE)
+endfunction()
+
+# Get GTest tests as CMake tests.
+# Copied from FindGTest.cmake
+# Thanks to Daniel Blezek <blezek@gmail.com> for the GTEST_ADD_TESTS code
+function(GTEST_ADD_TESTS executable extra_args)
+ if(NOT ARGN)
+ message(FATAL_ERROR "Missing ARGN: Read the documentation for GTEST_ADD_TESTS")
+ endif()
+ foreach(source ${ARGN})
+ # This assumes that every source file passed in exists. Consider using
+ # SUPPORT_SOURCES for source files which do not contain tests and might
+ # have to be generated.
+ file(READ "${source}" contents)
+ string(REGEX MATCHALL "TEST_?[F]?\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents})
+ foreach(hit ${found_tests})
+ string(REGEX REPLACE ".*\\( *([A-Za-z_0-9]+), *([A-Za-z_0-9]+) *\\).*" "\\1.\\2" test_name ${hit})
+ add_test(${test_name} ${executable} --gtest_filter=${test_name} ${extra_args})
+ endforeach()
+ # Groups parametrized tests under a single ctest entry
+ string(REGEX MATCHALL "INSTANTIATE_TEST_CASE_P\\(([^,]+), *([^,]+)" found_tests2 ${contents})
+ foreach(hit ${found_tests2})
+ string(SUBSTRING ${hit} 24 -1 test_name)
+ string(REPLACE "," ";" test_name "${test_name}")
+ list(GET test_name 0 filter_name)
+ list(GET test_name 1 test_prefix)
+ string(STRIP ${test_prefix} test_prefix)
+ add_test(${test_prefix}.${filter_name} ${executable} --gtest_filter=${filter_name}* ${extra_args})
+ endforeach()
+ endforeach()
+endfunction()
+
+function(whole_archive output)
+ if(CMAKE_CXX_COMPILER_ID STREQUAL GNU OR CMAKE_CXX_COMPILER_ID STREQUAL Clang)
+ set(${output} -Wl,--whole-archive ${ARGN} -Wl,--no-whole-archive PARENT_SCOPE)
+ elseif(CMAKE_CXX_COMPILER_ID STREQUAL AppleClang)
+ foreach(library ${ARGN})
+ list(APPEND ${output} -Wl,-force_load ${library})
+ set(${output} ${${output}} PARENT_SCOPE)
+ endforeach()
+ else()
+ set(${output} ${ARGN} PARENT_SCOPE)
+ endif()
+endfunction()
diff --git a/cmake/scripts/common/Uninstall.cmake b/cmake/scripts/common/Uninstall.cmake
new file mode 100644
index 0000000000..5660e19d82
--- /dev/null
+++ b/cmake/scripts/common/Uninstall.cmake
@@ -0,0 +1,22 @@
+# Uninstall target
+set(MANIFEST ${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt)
+if(EXISTS ${MANIFEST})
+ file(STRINGS ${MANIFEST} files)
+ foreach(file IN LISTS files)
+ if(EXISTS $ENV{DESTDIR}${file})
+ message(STATUS "Uninstalling: ${file}")
+ execute_process(
+ COMMAND ${CMAKE_COMMAND} -E remove $ENV{DESTDIR}${file}
+ OUTPUT_VARIABLE rm_out
+ RESULT_VARIABLE rm_retval
+ )
+ if(NOT "${rm_retval}" STREQUAL 0)
+ message(FATAL_ERROR "Failed to remove file: $ENV{DESTDIR}${file}")
+ endif()
+ else()
+ message(STATUS "File does not exist: $ENV{DESTDIR}${file}")
+ endif()
+ endforeach(file)
+else()
+ message(STATUS "Cannot find install manifest: '${MANIFEST}'")
+endif()
diff --git a/cmake/scripts/freebsd/ArchSetup.cmake b/cmake/scripts/freebsd/ArchSetup.cmake
new file mode 100644
index 0000000000..013205c6a0
--- /dev/null
+++ b/cmake/scripts/freebsd/ArchSetup.cmake
@@ -0,0 +1,16 @@
+set(ARCH_DEFINES -D_LINUX -DTARGET_POSIX -DTARGET_FREEBSD)
+set(SYSTEM_DEFINES -D__STDC_CONSTANT_MACROS -D_FILE_DEFINED
+ -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64)
+set(PLATFORM_DIR linux)
+set(SYSTEM_LDFLAGS -L/usr/local/lib)
+if(WITH_ARCH)
+ set(ARCH ${WITH_ARCH})
+else()
+ if(CMAKE_SYSTEM_PROCESSOR STREQUAL amd64)
+ set(ARCH x86_64-freebsd)
+ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i.86")
+ set(ARCH x86-freebsd)
+ else()
+ message(WARNING "unknown CPU: ${CPU}")
+ endif()
+endif()
diff --git a/cmake/scripts/freebsd/Install.cmake b/cmake/scripts/freebsd/Install.cmake
new file mode 120000
index 0000000000..28ce0129b9
--- /dev/null
+++ b/cmake/scripts/freebsd/Install.cmake
@@ -0,0 +1 @@
+../linux/Install.cmake \ No newline at end of file
diff --git a/cmake/scripts/freebsd/Macros.cmake b/cmake/scripts/freebsd/Macros.cmake
new file mode 120000
index 0000000000..2fdbb255f9
--- /dev/null
+++ b/cmake/scripts/freebsd/Macros.cmake
@@ -0,0 +1 @@
+../linux/Macros.cmake \ No newline at end of file
diff --git a/cmake/scripts/freebsd/PathSetup.cmake b/cmake/scripts/freebsd/PathSetup.cmake
new file mode 120000
index 0000000000..6786c1c131
--- /dev/null
+++ b/cmake/scripts/freebsd/PathSetup.cmake
@@ -0,0 +1 @@
+../linux/PathSetup.cmake \ No newline at end of file
diff --git a/cmake/scripts/ios/ArchSetup.cmake b/cmake/scripts/ios/ArchSetup.cmake
new file mode 100644
index 0000000000..f3e8590d4f
--- /dev/null
+++ b/cmake/scripts/ios/ArchSetup.cmake
@@ -0,0 +1,57 @@
+if(NOT CMAKE_TOOLCHAIN_FILE)
+ message(FATAL_ERROR "CMAKE_TOOLCHAIN_FILE required for ios. See ${PROJECT_SOURCE_DIR}/README.md")
+endif()
+
+set(CORE_MAIN_SOURCE ${CORE_SOURCE_DIR}/xbmc/platform/darwin/ios/XBMCApplication.m)
+
+set(ARCH_DEFINES -D_LINUX -DTARGET_POSIX -DTARGET_DARWIN -DTARGET_DARWIN_IOS)
+set(SYSTEM_DEFINES -D_REENTRANT -D_FILE_DEFINED -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
+ -D__STDC_CONSTANT_MACROS)
+set(PLATFORM_DIR linux)
+set(CMAKE_SYSTEM_NAME Darwin)
+if(WITH_ARCH)
+ set(ARCH ${WITH_ARCH})
+else()
+ if(CPU STREQUAL armv7 OR CPU STREQUAL arm64)
+ set(CMAKE_OSX_ARCHITECTURES ${CPU})
+ set(ARCH arm-osx)
+ set(NEON False)
+ else()
+ message(SEND_ERROR "Unknown CPU: ${CPU}")
+ endif()
+endif()
+
+find_package(CXX11 REQUIRED)
+
+list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${NATIVEPREFIX})
+
+list(APPEND DEPLIBS "-framework CoreFoundation" "-framework CoreVideo"
+ "-framework CoreAudio" "-framework AudioToolbox"
+ "-framework QuartzCore" "-framework MediaPlayer"
+ "-framework CFNetwork" "-framework CoreGraphics"
+ "-framework Foundation" "-framework UIKit"
+ "-framework CoreMedia" "-framework AVFoundation"
+ "-framework VideoToolbox")
+
+set(ENABLE_DVDCSS OFF CACHE BOOL "" FORCE)
+set(ENABLE_OPTICAL OFF CACHE BOOL "" FORCE)
+
+set(CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "5.1")
+set(CMAKE_XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2")
+
+set(CMAKE_XCODE_ATTRIBUTE_INLINES_ARE_PRIVATE_EXTERN OFF)
+set(CMAKE_XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN OFF)
+set(CMAKE_XCODE_ATTRIBUTE_COPY_PHASE_STRIP OFF)
+
+# Xcode strips dead code by default which breaks wrapping
+set(CMAKE_XCODE_ATTRIBUTE_DEAD_CODE_STRIPPING OFF)
+
+# Unify output directories for iOS packaging scripts
+if(NOT CMAKE_GENERATOR MATCHES Xcode)
+ set(CORE_BUILD_CONFIG "${CORE_BUILD_CONFIG}-iphoneos")
+endif()
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CORE_BUILD_DIR}/${CORE_BUILD_CONFIG})
+foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})
+ string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG)
+ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CORE_BUILD_DIR}/${CORE_BUILD_CONFIG})
+endforeach()
diff --git a/cmake/scripts/ios/Install.cmake b/cmake/scripts/ios/Install.cmake
new file mode 100644
index 0000000000..c49fcd581b
--- /dev/null
+++ b/cmake/scripts/ios/Install.cmake
@@ -0,0 +1,85 @@
+# IOS packaging
+
+set(BUNDLE_RESOURCES ${CORE_SOURCE_DIR}/xbmc/platform/darwin/ios/Default-568h@2x.png
+ ${CORE_SOURCE_DIR}/xbmc/platform/darwin/ios/Default-667h@2x.png
+ ${CORE_SOURCE_DIR}/xbmc/platform/darwin/ios/Default-736h@3x.png
+ ${CORE_SOURCE_DIR}/xbmc/platform/darwin/ios/Default-Landscape-736h@3x.png
+ ${CORE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon29x29.png
+ ${CORE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon29x29@2x.png
+ ${CORE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon40x40.png
+ ${CORE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon40x40@2x.png
+ ${CORE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon50x50.png
+ ${CORE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon50x50@2x.png
+ ${CORE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon57x57.png
+ ${CORE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon57x57@2x.png
+ ${CORE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon60x60.png
+ ${CORE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon60x60@2x.png
+ ${CORE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon72x72.png
+ ${CORE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon72x72@2x.png
+ ${CORE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon76x76.png
+ ${CORE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon76x76@2x.png)
+
+if(CMAKE_GENERATOR STREQUAL Xcode)
+ set(RESOURCE_LOCATION ${APP_NAME}.app)
+else()
+ set(RESOURCE_LOCATION ".")
+endif()
+
+target_sources(${APP_NAME_LC} PRIVATE ${BUNDLE_RESOURCES})
+foreach(file IN LISTS BUNDLE_RESOURCES)
+ set_source_files_properties(${file} PROPERTIES MACOSX_PACKAGE_LOCATION ${RESOURCE_LOCATION})
+endforeach()
+
+target_sources(${APP_NAME_LC} PRIVATE ${CORE_SOURCE_DIR}/xbmc/platform/darwin/ios/English.lproj/InfoPlist.strings)
+set_source_files_properties(${CORE_SOURCE_DIR}/xbmc/platform/darwin/ios/English.lproj/InfoPlist.strings PROPERTIES MACOSX_PACKAGE_LOCATION "${RESOURCE_LOCATION}/English.lproj")
+
+# Options for code signing propagated as env vars to Codesign.command via Xcode
+set(IOS_CODE_SIGN_IDENTITY "" CACHE STRING "Code Sign Identity")
+if(IOS_CODE_SIGN_IDENTITY)
+ set_target_properties(${APP_NAME_LC} PROPERTIES XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED TRUE
+ XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY ${IOS_CODE_SIGN_IDENTITY})
+endif()
+
+add_custom_command(TARGET ${APP_NAME_LC} POST_BUILD
+ # TODO: Remove in sync with CopyRootFiles-ios expecting the ".bin" file
+ COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${APP_NAME_LC}>
+ $<TARGET_FILE_DIR:${APP_NAME_LC}>/${APP_NAME}.bin
+
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/DllPaths_generated.h
+ ${CMAKE_BINARY_DIR}/xbmc/DllPaths_generated.h
+ COMMAND "ACTION=build"
+ "TARGET_BUILD_DIR=$<TARGET_FILE_DIR:${APP_NAME_LC}>/.."
+ "TARGET_NAME=${APP_NAME}.app"
+ "APP_NAME=${APP_NAME}"
+ "PRODUCT_NAME=${APP_NAME}"
+ "WRAPPER_EXTENSION=app"
+ "SRCROOT=${CMAKE_BINARY_DIR}"
+ ${CORE_SOURCE_DIR}/tools/darwin/Support/CopyRootFiles-ios.command
+ COMMAND "XBMC_DEPENDS=${DEPENDS_PATH}"
+ "TARGET_BUILD_DIR=$<TARGET_FILE_DIR:${APP_NAME_LC}>/.."
+ "TARGET_NAME=${APP_NAME}.app"
+ "APP_NAME=${APP_NAME}"
+ "PRODUCT_NAME=${APP_NAME}"
+ "FULL_PRODUCT_NAME=${APP_NAME}.app"
+ "WRAPPER_EXTENSION=app"
+ "SRCROOT=${CMAKE_BINARY_DIR}"
+ ${CORE_SOURCE_DIR}/tools/darwin/Support/copyframeworks-ios.command
+ COMMAND "XBMC_DEPENDS_ROOT=${NATIVEPREFIX}/.."
+ "PLATFORM_NAME=${PLATFORM}"
+ "CODESIGNING_FOLDER_PATH=$<TARGET_FILE_DIR:${APP_NAME_LC}>"
+ "BUILT_PRODUCTS_DIR=$<TARGET_FILE_DIR:${APP_NAME_LC}>/.."
+ "WRAPPER_NAME=${APP_NAME}.app"
+ "APP_NAME=${APP_NAME}"
+ ${CORE_SOURCE_DIR}/tools/darwin/Support/Codesign.command
+)
+
+set(DEPENDS_ROOT_FOR_XCODE ${NATIVEPREFIX}/..)
+configure_file(${CORE_SOURCE_DIR}/tools/darwin/packaging/ios/mkdeb-ios.sh.in
+ ${CMAKE_BINARY_DIR}/tools/darwin/packaging/ios/mkdeb-ios.sh @ONLY)
+configure_file(${CORE_SOURCE_DIR}/tools/darwin/packaging/migrate_to_kodi_ios.sh.in
+ ${CMAKE_BINARY_DIR}/tools/darwin/packaging/migrate_to_kodi_ios.sh @ONLY)
+
+add_custom_target(deb
+ COMMAND sh ./mkdeb-ios.sh ${CORE_BUILD_CONFIG}
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/tools/darwin/packaging/ios)
+add_dependencies(deb ${APP_NAME_LC})
diff --git a/cmake/scripts/ios/Macros.cmake b/cmake/scripts/ios/Macros.cmake
new file mode 120000
index 0000000000..54c1b280e0
--- /dev/null
+++ b/cmake/scripts/ios/Macros.cmake
@@ -0,0 +1 @@
+../osx/Macros.cmake \ No newline at end of file
diff --git a/cmake/scripts/ios/PathSetup.cmake b/cmake/scripts/ios/PathSetup.cmake
new file mode 120000
index 0000000000..d7f25b2cad
--- /dev/null
+++ b/cmake/scripts/ios/PathSetup.cmake
@@ -0,0 +1 @@
+../osx/PathSetup.cmake \ No newline at end of file
diff --git a/cmake/scripts/linux/ArchSetup.cmake b/cmake/scripts/linux/ArchSetup.cmake
new file mode 100644
index 0000000000..bcd70df74f
--- /dev/null
+++ b/cmake/scripts/linux/ArchSetup.cmake
@@ -0,0 +1,45 @@
+set(ARCH_DEFINES -D_LINUX -DTARGET_POSIX -DTARGET_LINUX)
+set(SYSTEM_DEFINES -D__STDC_CONSTANT_MACROS -D_FILE_DEFINED
+ -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64)
+set(PLATFORM_DIR linux)
+set(CMAKE_SYSTEM_NAME Linux)
+if(WITH_ARCH)
+ set(ARCH ${WITH_ARCH})
+else()
+ if(CPU STREQUAL x86_64)
+ set(ARCH x86_64-linux)
+ set(NEON False)
+ elseif(CPU MATCHES "i.86")
+ set(ARCH i486-linux)
+ set(NEON False)
+ add_options(CXX ALL_BUILDS "-msse")
+ elseif(CPU MATCHES arm)
+ set(ARCH arm)
+ set(NEON True)
+ elseif(CPU MATCHES aarch64 OR CPU MATCHES arm64)
+ set(ARCH aarch64)
+ set(NEON False)
+ else()
+ message(SEND_ERROR "Unknown CPU: ${CPU}")
+ endif()
+endif()
+
+# Make sure we strip binaries in Release build
+if(CMAKE_BUILD_TYPE STREQUAL Release AND CMAKE_COMPILER_IS_GNUCXX)
+ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s")
+endif()
+
+find_package(CXX11 REQUIRED)
+include(LDGOLD)
+
+# Code Coverage
+if(CMAKE_BUILD_TYPE STREQUAL Coverage)
+ set(COVERAGE_TEST_BINARY ${APP_NAME_LC}-test)
+ set(COVERAGE_SOURCE_DIR ${CORE_SOURCE_DIR})
+ set(COVERAGE_DEPENDS "\${APP_NAME_LC}" "\${APP_NAME_LC}-test")
+ set(COVERAGE_EXCLUDES */test/* lib/* */lib/*)
+endif()
+
+if(ENABLE_MIR)
+ set(ENABLE_VDPAU OFF CACHE BOOL "Disabling VDPAU since no Mir support" FORCE)
+endif()
diff --git a/cmake/scripts/linux/CodeCoverage.cmake b/cmake/scripts/linux/CodeCoverage.cmake
new file mode 100644
index 0000000000..efc2208b07
--- /dev/null
+++ b/cmake/scripts/linux/CodeCoverage.cmake
@@ -0,0 +1,97 @@
+# - CodeCoverage
+# Generate code coverage reports with LCOV and GCovr.
+#
+# Configuration:
+# COVERAGE_SOURCE_DIR - Source root directory (default ${CMAKE_SOURCE_DIR}).
+# COVERAGE_BINARY_DIR - Directory where the coverage reports (and intermediate files)
+# are generated to.
+# COVERAGE_EXCLUDES - List of exclude patterns (for example '*/tests/*').
+#
+# The following targets will be generated:
+# coverage - Builds an html report. Requires LCOV.
+# coverage_xml - Builds an xml report (in Cobertura format for Jenkins).
+# Requires Gcovr.
+#
+# Inspired by https://github.com/bilke/cmake-modules/blob/master/CodeCoverage.cmake
+
+# Comiler and linker setup
+set(CMAKE_C_FLAGS_COVERAGE "-g -O0 --coverage" CACHE STRING
+ "Flags used by the C compiler during coverage builds." FORCE)
+set(CMAKE_CXX_FLAGS_COVERAGE "-g -O0 --coverage" CACHE STRING
+ "Flags used by the C++ compiler during coverage builds." FORCE)
+set(CMAKE_EXE_LINKER_FLAGS_COVERAGE "--coverage" CACHE STRING
+ "Flags used for linking binaries during coverage builds." FORCE)
+set(CMAKE_SHARED_LINKER_FLAGS_COVERAGE "--coverage" CACHE STRING
+ "Flags used by the shared libraries linker during coverage builds." FORCE)
+mark_as_advanced(
+ CMAKE_C_FLAGS_COVERAGE CMAKE_CXX_FLAGS_COVERAGE CMAKE_EXE_LINKER_FLAGS_COVERAGE
+ CMAKE_SHARED_LINKER_FLAGS_COVERAGE CMAKE_STATIC_LINKER_FLAGS_COVERAGE
+)
+
+find_program(LCOV_EXECUTABLE lcov)
+find_program(GENINFO_EXECUTABLE geninfo)
+find_program(GENHTML_EXECUTABLE genhtml)
+find_program(GCOVR_EXECUTABLE gcovr)
+mark_as_advanced(LCOV_EXECUTABLE GENINFO_EXECUTABLE GENHTML_EXECUTABLE GCOVR_EXECUTABLE)
+
+# Default options
+if(NOT COVERAGE_SOURCE_DIR)
+ set(COVERAGE_SOURCE_DIR ${CMAKE_SOURCE_DIR})
+endif()
+if(NOT COVERAGE_BINARY_DIR)
+ set(COVERAGE_BINARY_DIR ${CMAKE_BINARY_DIR}/coverage)
+endif()
+if(NOT COVERAGE_EXCLUDES)
+ set(COVERAGE_EXCLUDES)
+endif()
+
+# Allow variables in COVERAGE_DEPENDS that are not evaluated before this file is included.
+string(CONFIGURE "${COVERAGE_DEPENDS}" COVERAGE_DEPENDS)
+
+# Add coverage target that generates an HTML report using LCOV
+if(LCOV_EXECUTABLE AND GENINFO_EXECUTABLE AND GENHTML_EXECUTABLE)
+ file(MAKE_DIRECTORY ${COVERAGE_BINARY_DIR})
+ add_custom_target(coverage
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${COVERAGE_BINARY_DIR}
+ COMMAND ${LCOV_EXECUTABLE} -z -q -d ${CMAKE_BINARY_DIR}
+ COMMAND ${LCOV_EXECUTABLE} -c -q -i -d ${CMAKE_BINARY_DIR} -b ${COVERAGE_SOURCE_DIR}
+ -o ${COVERAGE_BINARY_DIR}/${PROJECT_NAME}.coverage_base.info
+ COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target test || true
+ COMMAND ${LCOV_EXECUTABLE} -c -q -d ${CMAKE_BINARY_DIR} -b ${COVERAGE_SOURCE_DIR}
+ -o ${COVERAGE_BINARY_DIR}/${PROJECT_NAME}.coverage_test.info
+ COMMAND ${LCOV_EXECUTABLE} -a ${COVERAGE_BINARY_DIR}/${PROJECT_NAME}.coverage_base.info
+ -a ${COVERAGE_BINARY_DIR}/${PROJECT_NAME}.coverage_test.info
+ -o ${COVERAGE_BINARY_DIR}/${PROJECT_NAME}.coverage.info -q
+ COMMAND ${LCOV_EXECUTABLE} -q -r ${COVERAGE_BINARY_DIR}/${PROJECT_NAME}.coverage.info
+ /usr/include/* ${CMAKE_BINARY_DIR}/* ${COVERAGE_EXCLUDES}
+ -o ${COVERAGE_BINARY_DIR}/${PROJECT_NAME}.coverage.info
+ COMMAND ${GENHTML_EXECUTABLE} ${COVERAGE_BINARY_DIR}/${PROJECT_NAME}.coverage.info
+ -o ${COVERAGE_BINARY_DIR}/html -s --legend --highlight --demangle-cpp
+ COMMAND ${CMAKE_COMMAND} -E echo "Coverage report: file://${COVERAGE_BINARY_DIR}/html/index.html"
+ WORKING_DIRECTORY ${COVERAGE_BINARY_DIR}
+ VERBATIM
+ DEPENDS ${COVERAGE_DEPENDS}
+ COMMENT "Generate code coverage html report"
+ )
+else()
+ message(WARNING "Target coverage not available (lcov, geninfo and genhtml needed).")
+endif()
+
+# Add coverage target that generates an XML report using Gcovr
+if(GCOVR_EXECUTABLE)
+ file(MAKE_DIRECTORY ${COVERAGE_BINARY_DIR})
+ string(REGEX REPLACE "([^;]+)" "--exclude=\"\\1\"" _gcovr_excludes "${COVERAGE_EXCLUDES}")
+ string(REPLACE "*" ".*" _gcovr_excludes "${_gcovr_excludes}")
+ add_custom_target(coverage_xml
+ COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target test || true
+ COMMAND ${GCOVR_EXECUTABLE} -x -r ${COVERAGE_SOURCE_DIR} -o ${COVERAGE_BINARY_DIR}/coverage.xml
+ --object-directory ${CMAKE_BINARY_DIR} ${_gcovr_excludes} ${CMAKE_BINARY_DIR}
+ COMMAND ${CMAKE_COMMAND} -E echo "Coverage report: file://${COVERAGE_BINARY_DIR}/coverage.xml"
+ WORKING_DIRECTORY ${COVERAGE_BINARY_DIR}
+ DEPENDS ${COVERAGE_DEPENDS}
+ COMMENT "Generate code coverage xml report"
+ )
+ unset(_gcovr_excludes)
+else()
+ message(WARNING "Target coverage_xml not available (gcovr needed).")
+endif()
diff --git a/cmake/scripts/linux/ExtraTargets.cmake b/cmake/scripts/linux/ExtraTargets.cmake
new file mode 100644
index 0000000000..2bb5f6fa01
--- /dev/null
+++ b/cmake/scripts/linux/ExtraTargets.cmake
@@ -0,0 +1,12 @@
+# xrandr
+if(ENABLE_X11 AND X_FOUND AND XRANDR_FOUND)
+ find_package(X QUIET)
+ find_package(XRandR QUIET)
+ add_executable(${APP_NAME_LC}-xrandr ${CORE_SOURCE_DIR}/xbmc-xrandr.c)
+ target_link_libraries(${APP_NAME_LC}-xrandr ${SYSTEM_LDFLAGS} ${X_LIBRARIES} m ${XRANDR_LIBRARIES})
+endif()
+
+# WiiRemote
+if(ENABLE_EVENTCLIENTS)
+ add_subdirectory(${CORE_SOURCE_DIR}/tools/EventClients/Clients/WiiRemote build/WiiRemote)
+endif()
diff --git a/cmake/scripts/linux/Install.cmake b/cmake/scripts/linux/Install.cmake
new file mode 100644
index 0000000000..75c37dc860
--- /dev/null
+++ b/cmake/scripts/linux/Install.cmake
@@ -0,0 +1,362 @@
+if(X_FOUND)
+ set(USE_X11 1)
+else()
+ set(USE_X11 0)
+endif()
+if(OPENGL_FOUND)
+ set(USE_OPENGL 1)
+else()
+ set(USE_OPENGL 0)
+endif()
+if(OPENGLES_FOUND)
+ set(USE_OPENGLES 1)
+else()
+ set(USE_OPENGLES 0)
+endif()
+
+# CMake config
+set(APP_PREFIX ${prefix})
+set(APP_LIB_DIR ${libdir}/${APP_NAME_LC})
+set(APP_DATA_DIR ${datarootdir}/${APP_NAME_LC})
+set(APP_INCLUDE_DIR ${includedir}/${APP_NAME_LC})
+set(CXX11_SWITCH "-std=c++11")
+
+# Set XBMC_STANDALONE_SH_PULSE so we can insert PulseAudio block into kodi-standalone
+if(EXISTS ${CORE_SOURCE_DIR}/tools/Linux/kodi-standalone.sh.pulse)
+ if(ENABLE_PULSEAUDIO AND PULSEAUDIO_FOUND)
+ file(READ "${CORE_SOURCE_DIR}/tools/Linux/kodi-standalone.sh.pulse" pulse_content)
+ set(XBMC_STANDALONE_SH_PULSE ${pulse_content})
+ endif()
+endif()
+
+# Configure startup scripts
+configure_file(${CORE_SOURCE_DIR}/tools/Linux/kodi.sh.in
+ ${CORE_BUILD_DIR}/scripts/${APP_NAME_LC} @ONLY)
+configure_file(${CORE_SOURCE_DIR}/tools/Linux/kodi-standalone.sh.in
+ ${CORE_BUILD_DIR}/scripts/${APP_NAME_LC}-standalone @ONLY)
+
+# Configure cmake files
+configure_file(${PROJECT_SOURCE_DIR}/KodiConfig.cmake.in
+ ${CORE_BUILD_DIR}/scripts/${APP_NAME}Config.cmake @ONLY)
+
+# Configure xsession entry
+configure_file(${CORE_SOURCE_DIR}/tools/Linux/kodi-xsession.desktop.in
+ ${CORE_BUILD_DIR}/${APP_NAME_LC}.desktop @ONLY)
+
+# Install app
+install(TARGETS ${APP_NAME_LC}
+ DESTINATION ${libdir}/${APP_NAME_LC}
+ COMPONENT kodi-bin)
+if(ENABLE_X11 AND XRANDR_FOUND)
+ install(TARGETS ${APP_NAME_LC}-xrandr
+ DESTINATION ${libdir}/${APP_NAME_LC}
+ COMPONENT kodi-bin)
+endif()
+
+# Install scripts
+install(PROGRAMS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/scripts/${APP_NAME_LC}
+ ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/scripts/${APP_NAME_LC}-standalone
+ DESTINATION ${bindir}
+ COMPONENT kodi-bin)
+
+# Install libraries
+foreach(library ${LIBRARY_FILES})
+ get_filename_component(dir ${library} DIRECTORY)
+ string(REPLACE "${CMAKE_BINARY_DIR}/" "" dir ${dir})
+ install(PROGRAMS ${library}
+ DESTINATION ${libdir}/${APP_NAME_LC}/${dir}
+ COMPONENT kodi-bin)
+endforeach()
+
+# Install add-ons, fonts, icons, keyboard maps, keymaps, etc
+# (addons, media, system, userdata folders in share/kodi/)
+foreach(file ${install_data})
+ get_filename_component(dir ${file} DIRECTORY)
+ install(FILES ${CMAKE_BINARY_DIR}/${file}
+ DESTINATION ${datarootdir}/${APP_NAME_LC}/${dir}
+ COMPONENT kodi)
+endforeach()
+
+# Install xsession entry
+install(FILES ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${APP_NAME_LC}.desktop
+ DESTINATION ${datarootdir}/xsessions
+ COMPONENT kodi)
+
+# Install desktop entry
+install(FILES ${CORE_SOURCE_DIR}/tools/Linux/kodi.desktop
+ DESTINATION ${datarootdir}/applications
+ COMPONENT kodi)
+
+# Install icons
+install(FILES ${CORE_SOURCE_DIR}/tools/Linux/packaging/media/icon16x16.png
+ RENAME ${APP_NAME_LC}.png
+ DESTINATION ${datarootdir}/icons/hicolor/16x16/apps
+ COMPONENT kodi)
+install(FILES ${CORE_SOURCE_DIR}/tools/Linux/packaging/media/icon22x22.png
+ RENAME ${APP_NAME_LC}.png
+ DESTINATION ${datarootdir}/icons/hicolor/22x22/apps
+ COMPONENT kodi)
+install(FILES ${CORE_SOURCE_DIR}/tools/Linux/packaging/media/icon24x24.png
+ RENAME ${APP_NAME_LC}.png
+ DESTINATION ${datarootdir}/icons/hicolor/24x24/apps
+ COMPONENT kodi)
+install(FILES ${CORE_SOURCE_DIR}/tools/Linux/packaging/media/icon32x32.png
+ RENAME ${APP_NAME_LC}.png
+ DESTINATION ${datarootdir}/icons/hicolor/32x32/apps
+ COMPONENT kodi)
+install(FILES ${CORE_SOURCE_DIR}/tools/Linux/packaging/media/icon48x48.png
+ RENAME ${APP_NAME_LC}.png
+ DESTINATION ${datarootdir}/icons/hicolor/48x48/apps
+ COMPONENT kodi)
+install(FILES ${CORE_SOURCE_DIR}/tools/Linux/packaging/media/icon64x64.png
+ RENAME ${APP_NAME_LC}.png
+ DESTINATION ${datarootdir}/icons/hicolor/64x64/apps
+ COMPONENT kodi)
+install(FILES ${CORE_SOURCE_DIR}/tools/Linux/packaging/media/icon128x128.png
+ RENAME ${APP_NAME_LC}.png
+ DESTINATION ${datarootdir}/icons/hicolor/128x128/apps
+ COMPONENT kodi)
+install(FILES ${CORE_SOURCE_DIR}/tools/Linux/packaging/media/icon256x256.png
+ RENAME ${APP_NAME_LC}.png
+ DESTINATION ${datarootdir}/icons/hicolor/256x256/apps
+ COMPONENT kodi)
+
+# Install docs
+install(FILES ${CORE_SOURCE_DIR}/copying.txt
+ ${CORE_SOURCE_DIR}/LICENSE.GPL
+ ${CORE_SOURCE_DIR}/version.txt
+ ${CORE_SOURCE_DIR}/docs/README.linux
+ DESTINATION ${docdir}
+ COMPONENT kodi)
+
+install(FILES ${CORE_SOURCE_DIR}/privacy-policy.txt
+ DESTINATION ${datarootdir}/${APP_NAME_LC}
+ COMPONENT kodi)
+
+# Install kodi-tools-texturepacker
+if(NOT WITH_TEXTUREPACKER)
+ install(PROGRAMS $<TARGET_FILE:TexturePacker::TexturePacker>
+ DESTINATION ${bindir}
+ COMPONENT kodi-tools-texturepacker)
+endif()
+
+# Install kodi-addon-dev headers
+install(FILES ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_vfs_types.h
+ ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_vfs_utils.hpp
+ ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_adsp.h
+ ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_audioengine.h
+ ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h
+ ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_inputstream.h
+ ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_peripheral.h
+ ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h
+ ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_codec.h
+ ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_pvr.h
+ ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_game.h
+ ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_cpp_dll.h
+ ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_dll.h
+ ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_types.h
+ ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_codec_types.h
+ ${CORE_SOURCE_DIR}/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h
+ ${CORE_SOURCE_DIR}/xbmc/filesystem/IFileTypes.h
+ ${CORE_SOURCE_DIR}/xbmc/input/XBMC_vkeys.h
+ DESTINATION ${includedir}/${APP_NAME_LC}
+ COMPONENT kodi-addon-dev)
+
+# Install kodi-addon-dev add-on bindings
+install(FILES ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/scripts/${APP_NAME}Config.cmake
+ ${CORE_SOURCE_DIR}/project/cmake/scripts/common/AddonHelpers.cmake
+ ${CORE_SOURCE_DIR}/project/cmake/scripts/common/AddOptions.cmake
+ ${CORE_SOURCE_DIR}/project/cmake/scripts/common/ArchSetup.cmake
+ ${CORE_SOURCE_DIR}/project/cmake/scripts/common/CheckCommits.cmake
+ ${CORE_SOURCE_DIR}/project/cmake/scripts/common/CheckTargetPlatform.cmake
+ ${CORE_SOURCE_DIR}/project/cmake/scripts/common/GenerateVersionedFiles.cmake
+ ${CORE_SOURCE_DIR}/project/cmake/scripts/common/GeneratorSetup.cmake
+ ${CORE_SOURCE_DIR}/project/cmake/scripts/common/HandleDepends.cmake
+ ${CORE_SOURCE_DIR}/project/cmake/scripts/common/Macros.cmake
+ ${CORE_SOURCE_DIR}/project/cmake/scripts/common/PrepareEnv.cmake
+ ${CORE_SOURCE_DIR}/project/cmake/scripts/common/ProjectMacros.cmake
+ ${CORE_SOURCE_DIR}/project/cmake/scripts/linux/PathSetup.cmake
+ DESTINATION ${datarootdir}/${APP_NAME_LC}/cmake
+ COMPONENT kodi-addon-dev)
+
+# Install kodi-audio-dev
+install(FILES ${CORE_SOURCE_DIR}/xbmc/cores/AudioEngine/Utils/AEChannelData.h
+ ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_dll.h
+ ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_types.h
+ ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_dll.h
+ ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_types.h
+ ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_dll.h
+ ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_types.h
+ ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audioengine_types.h
+ DESTINATION ${includedir}/${APP_NAME_LC}
+ COMPONENT kodi-audio-dev)
+
+if(ENABLE_EVENTCLIENTS)
+ # Install kodi-eventclients-common BT python files
+ install(PROGRAMS ${CORE_SOURCE_DIR}/tools/EventClients/lib/python/bt/__init__.py
+ ${CORE_SOURCE_DIR}/tools/EventClients/lib/python/bt/bt.py
+ ${CORE_SOURCE_DIR}/tools/EventClients/lib/python/bt/hid.py
+ DESTINATION lib/python2.7/dist-packages/${APP_NAME_LC}/bt
+ COMPONENT kodi-eventclients-common)
+
+ # Install kodi-eventclients-common PS3 python files
+ install(PROGRAMS ${CORE_SOURCE_DIR}/tools/EventClients/lib/python/ps3/__init__.py
+ ${CORE_SOURCE_DIR}/tools/EventClients/lib/python/ps3/keymaps.py
+ ${CORE_SOURCE_DIR}/tools/EventClients/lib/python/ps3/sixaxis.py
+ ${CORE_SOURCE_DIR}/tools/EventClients/lib/python/ps3/sixpair.py
+ ${CORE_SOURCE_DIR}/tools/EventClients/lib/python/ps3/sixwatch.py
+ DESTINATION lib/python2.7/dist-packages/${APP_NAME_LC}/ps3
+ COMPONENT kodi-eventclients-common)
+
+ # Install kodi-eventclients-common python files
+ file(WRITE ${CMAKE_BINARY_DIR}/packages/deb/defs.py ICON_PATH="usr/share/pixmaps/${APP_NAME_LC}/")
+ install(PROGRAMS ${CMAKE_BINARY_DIR}/packages/deb/defs.py
+ ${CORE_SOURCE_DIR}/tools/EventClients/lib/python/__init__.py
+ "${CORE_SOURCE_DIR}/tools/EventClients/Clients/PS3 BD Remote/ps3_remote.py"
+ ${CORE_SOURCE_DIR}/tools/EventClients/lib/python/xbmcclient.py
+ ${CORE_SOURCE_DIR}/tools/EventClients/lib/python/zeroconf.py
+ DESTINATION lib/python2.7/dist-packages/${APP_NAME_LC}
+ COMPONENT kodi-eventclients-common)
+
+ # Install kodi-eventclients-common icons
+ install(FILES ${CORE_SOURCE_DIR}/tools/EventClients/icons/bluetooth.png
+ ${CORE_SOURCE_DIR}/tools/EventClients/icons/phone.png
+ ${CORE_SOURCE_DIR}/tools/EventClients/icons/mail.png
+ ${CORE_SOURCE_DIR}/tools/EventClients/icons/mouse.png
+ DESTINATION ${datarootdir}/pixmaps/${APP_NAME_LC}
+ COMPONENT kodi-eventclients-common)
+
+ # Install kodi-eventclients-dev headers
+ install(FILES ${CORE_SOURCE_DIR}/tools/EventClients/lib/c++/xbmcclient.h
+ DESTINATION ${includedir}/${APP_NAME_LC}
+ COMPONENT kodi-eventclients-dev)
+
+ # Install kodi-eventclients-dev C# examples
+ install(FILES "${CORE_SOURCE_DIR}/tools/EventClients/examples/c#/XBMCDemoClient1.cs"
+ DESTINATION "${docdir}/${APP_NAME_LC}-eventclients-dev/examples/C#"
+ COMPONENT kodi-eventclients-dev)
+
+ # Install kodi-eventclients-dev C++ examples
+ install(FILES ${CORE_SOURCE_DIR}/tools/EventClients/examples/c++/example_notification.cpp
+ ${CORE_SOURCE_DIR}/tools/EventClients/examples/c++/example_log.cpp
+ ${CORE_SOURCE_DIR}/tools/EventClients/examples/c++/example_button1.cpp
+ ${CORE_SOURCE_DIR}/tools/EventClients/examples/c++/example_mouse.cpp
+ ${CORE_SOURCE_DIR}/tools/EventClients/examples/c++/example_button2.cpp
+ DESTINATION ${docdir}/${APP_NAME_LC}-eventclients-dev/examples/C++
+ COMPONENT kodi-eventclients-dev)
+
+ # Install kodi-eventclients-dev java examples
+ install(FILES ${CORE_SOURCE_DIR}/tools/EventClients/examples/java/XBMCDemoClient1.java
+ DESTINATION ${docdir}/${APP_NAME_LC}-eventclients-dev/examples/java
+ COMPONENT kodi-eventclients-dev)
+
+ # Install kodi-eventclients-dev python examples
+ install(PROGRAMS ${CORE_SOURCE_DIR}/tools/EventClients/examples/python/example_mouse.py
+ ${CORE_SOURCE_DIR}/tools/EventClients/examples/python/example_button1.py
+ ${CORE_SOURCE_DIR}/tools/EventClients/examples/python/example_notification.py
+ ${CORE_SOURCE_DIR}/tools/EventClients/examples/python/example_action.py
+ ${CORE_SOURCE_DIR}/tools/EventClients/examples/python/example_button2.py
+ ${CORE_SOURCE_DIR}/tools/EventClients/examples/python/example_simple.py
+ DESTINATION ${docdir}/${APP_NAME_LC}-eventclients-dev/examples/python
+ COMPONENT kodi-eventclients-dev)
+
+ # Install kodi-eventclients-ps3
+ install(PROGRAMS "${CORE_SOURCE_DIR}/tools/EventClients/Clients/PS3 BD Remote/ps3_remote.py"
+ RENAME ${APP_NAME_LC}-ps3remote
+ DESTINATION ${bindir}
+ COMPONENT kodi-eventclients-ps3)
+
+ # Install kodi-eventclients-wiiremote
+ install(PROGRAMS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/WiiRemote/${APP_NAME_LC}-wiiremote
+ DESTINATION ${bindir}
+ COMPONENT kodi-eventclients-wiiremote)
+
+ # Install kodi-eventclients-xbmc-send
+ install(PROGRAMS "${CORE_SOURCE_DIR}/tools/EventClients/Clients/Kodi Send/kodi-send.py"
+ RENAME ${APP_NAME_LC}-send
+ DESTINATION ${bindir}
+ COMPONENT kodi-eventclients-xbmc-send)
+endif()
+
+# Install kodi-inputstream-dev
+install(FILES ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h
+ ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_types.h
+ DESTINATION ${includedir}/${APP_NAME_LC}
+ COMPONENT kodi-inputstream-dev)
+
+# Install kodi-pvr-dev
+install(FILES ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_epg_types.h
+ ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_dll.h
+ ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h
+ DESTINATION ${includedir}/${APP_NAME_LC}
+ COMPONENT kodi-pvr-dev)
+
+# Install kodi-screensaver-dev
+install(FILES ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_scr_dll.h
+ ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_scr_types.h
+ DESTINATION ${includedir}/${APP_NAME_LC}
+ COMPONENT kodi-screensaver-dev)
+
+# Install kodi-visualization-dev
+install(FILES ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_dll.h
+ ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_types.h
+ DESTINATION ${includedir}/${APP_NAME_LC}
+ COMPONENT kodi-visualization-dev)
+
+# Install kodi-peripheral-dev
+install(FILES ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_dll.h
+ ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_types.h
+ ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_utils.hpp
+ DESTINATION ${includedir}/${APP_NAME_LC}
+ COMPONENT kodi-peripheral-dev)
+
+# Install kodi-game-dev
+install(FILES ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_dll.h
+ ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_types.h
+ DESTINATION ${includedir}/${APP_NAME_LC}
+ COMPONENT kodi-game-dev)
+
+
+# Install XBT skin files
+foreach(texture ${XBT_FILES})
+ string(REPLACE "${CMAKE_BINARY_DIR}/" "" dir ${texture})
+ get_filename_component(dir ${dir} DIRECTORY)
+ install(FILES ${texture}
+ DESTINATION ${datarootdir}/${APP_NAME_LC}/${dir}
+ COMPONENT kodi)
+endforeach()
+
+# Install extra stuff if it exists
+if(EXISTS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/extra-installs)
+ install(CODE "file(STRINGS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/extra-installs dirs)
+ foreach(dir \${dirs})
+ file(GLOB_RECURSE FILES RELATIVE ${CMAKE_BINARY_DIR} \${dir}/*)
+ foreach(file \${FILES})
+ get_filename_component(dir \${file} DIRECTORY)
+ file(INSTALL \${file} DESTINATION ${datarootdir}/${APP_NAME_LC}/\${dir})
+ endforeach()
+ endforeach()")
+endif()
+
+if(NOT "$ENV{DESTDIR}" STREQUAL "")
+ set(DESTDIR ${CMAKE_BINARY_DIR}/$ENV{DESTDIR})
+endif()
+foreach(subdir ${build_dirs})
+ if(NOT subdir MATCHES kodi-platform)
+ string(REPLACE " " ";" subdir ${subdir})
+ list(GET subdir 0 id)
+ install(CODE "execute_process(COMMAND ${CMAKE_MAKE_PROGRAM} -C ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${id}/src/${id}-build install DESTDIR=${DESTDIR})")
+ endif()
+endforeach()
+
+# generate packages? yes please, if everything checks out
+if(CPACK_GENERATOR)
+ if(CPACK_GENERATOR STREQUAL DEB AND CORE_SYSTEM_NAME STREQUAL linux)
+ if(CMAKE_BUILD_TYPE STREQUAL Debug)
+ message(STATUS "DEB Generator: Build type is set to 'Debug'. Packaged binaries will be unstripped.")
+ endif()
+ include(${PROJECT_SOURCE_DIR}/cpack/CPackConfigDEB.cmake)
+ else()
+ message(FATAL_ERROR "DEB Generator: Can't configure CPack to generate Debian packages on non-linux systems.")
+ endif()
+endif()
diff --git a/cmake/scripts/linux/Macros.cmake b/cmake/scripts/linux/Macros.cmake
new file mode 100644
index 0000000000..b07b17f748
--- /dev/null
+++ b/cmake/scripts/linux/Macros.cmake
@@ -0,0 +1,95 @@
+function(core_link_library lib wraplib)
+ set(export -Wl,--unresolved-symbols=ignore-all
+ `cat ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cores/dll-loader/exports/wrapper.def`
+ ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cores/dll-loader/exports/CMakeFiles/wrapper.dir/wrapper.c.o)
+ set(check_arg "")
+ if(TARGET ${lib})
+ set(target ${lib})
+ set(link_lib $<TARGET_FILE:${lib}>)
+ set(check_arg ${ARGV2})
+ set(data_arg ${ARGV3})
+ else()
+ set(target ${ARGV2})
+ set(link_lib ${lib})
+ set(check_arg ${ARGV3})
+ set(data_arg ${ARGV4})
+ endif()
+
+ # wrapper has to be adapted in order to support coverage.
+ if(CMAKE_BUILD_TYPE STREQUAL Coverage)
+ set(export "")
+ endif()
+
+ if(check_arg STREQUAL export)
+ set(export ${export}
+ -Wl,--version-script=${ARGV3})
+ elseif(check_arg STREQUAL extras)
+ foreach(arg ${data_arg})
+ list(APPEND export ${arg})
+ endforeach()
+ elseif(check_arg STREQUAL archives)
+ set(extra_libs ${data_arg})
+ endif()
+
+ string(REGEX REPLACE "[ ]+" ";" _flags "${CMAKE_SHARED_LINKER_FLAGS}")
+ get_filename_component(dir ${wraplib} DIRECTORY)
+ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX}
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${dir}
+ COMMAND ${CMAKE_C_COMPILER}
+ ARGS ${_flags} -Wl,--whole-archive
+ "${link_lib}" ${extra_libs}
+ -Wl,--no-whole-archive -lm
+ -Wl,-soname,${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX}
+ -shared -o ${CMAKE_BINARY_DIR}/${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX}
+ ${export}
+ DEPENDS ${target} wrapper.def wrapper)
+
+ get_filename_component(libname ${wraplib} NAME_WE)
+ add_custom_target(wrap_${libname} ALL DEPENDS ${CMAKE_BINARY_DIR}/${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX})
+ set_target_properties(wrap_${libname} PROPERTIES FOLDER lib/wrapped)
+ add_dependencies(${APP_NAME_LC}-libraries wrap_${libname})
+
+ set(LIBRARY_FILES ${LIBRARY_FILES} ${CMAKE_BINARY_DIR}/${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX} CACHE STRING "" FORCE)
+endfunction()
+
+function(find_soname lib)
+ cmake_parse_arguments(arg "REQUIRED" "" "" ${ARGN})
+
+ string(TOLOWER ${lib} liblow)
+ if(${lib}_LDFLAGS)
+ set(link_lib "${${lib}_LDFLAGS}")
+ else()
+ if(IS_ABSOLUTE "${${lib}_LIBRARIES}")
+ set(link_lib "${${lib}_LIBRARIES}")
+ else()
+ set(link_lib -l${${lib}_LIBRARIES})
+ endif()
+ endif()
+ execute_process(COMMAND ${CMAKE_C_COMPILER} -nostdlib -o /dev/null -Wl,-M ${link_lib}
+ COMMAND grep LOAD.*${liblow}
+ ERROR_QUIET
+ OUTPUT_VARIABLE ${lib}_FILENAME)
+ string(REPLACE "LOAD " "" ${lib}_FILENAME "${${lib}_FILENAME}")
+ string(STRIP "${${lib}_FILENAME}" ${lib}_FILENAME)
+ if(NOT ${lib}_FILENAME)
+ execute_process(COMMAND ${CMAKE_C_COMPILER} -nostdlib -o /dev/null -Wl,-t ${link_lib}
+ OUTPUT_QUIET
+ ERROR_VARIABLE _TMP_FILENAME)
+ string(REGEX MATCH ".*lib${liblow}.so" ${lib}_FILENAME ${_TMP_FILENAME})
+ endif()
+ if(${lib}_FILENAME)
+ execute_process(COMMAND objdump -p ${${lib}_FILENAME}
+ COMMAND grep SONAME.*${liblow}
+ ERROR_QUIET
+ OUTPUT_VARIABLE ${lib}_SONAME)
+ string(REPLACE "SONAME " "" ${lib}_SONAME ${${lib}_SONAME})
+ string(STRIP ${${lib}_SONAME} ${lib}_SONAME)
+ if(VERBOSE)
+ message(STATUS "${lib} soname: ${${lib}_SONAME}")
+ endif()
+ set(${lib}_SONAME ${${lib}_SONAME} PARENT_SCOPE)
+ endif()
+ if(arg_REQUIRED AND NOT ${lib}_SONAME)
+ message(FATAL_ERROR "Could not find dynamically loadable library ${lib}")
+ endif()
+endfunction()
diff --git a/cmake/scripts/linux/PathSetup.cmake b/cmake/scripts/linux/PathSetup.cmake
new file mode 100644
index 0000000000..5532c2d962
--- /dev/null
+++ b/cmake/scripts/linux/PathSetup.cmake
@@ -0,0 +1,40 @@
+include(GNUInstallDirs)
+
+if(NOT prefix)
+ set(prefix ${CMAKE_INSTALL_PREFIX})
+else()
+ set(CMAKE_INSTALL_PREFIX ${prefix})
+endif()
+if(NOT exec_prefix)
+ set(exec_prefix ${prefix})
+endif()
+if(NOT libdir)
+ set(libdir ${CMAKE_INSTALL_FULL_LIBDIR})
+endif()
+if(NOT bindir)
+ set(bindir ${CMAKE_INSTALL_FULL_BINDIR})
+endif()
+if(NOT includedir)
+ set(includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR})
+endif()
+if(NOT datarootdir)
+ set(datarootdir ${CMAKE_INSTALL_FULL_DATAROOTDIR})
+endif()
+if(NOT datadir)
+ set(datadir ${CMAKE_INSTALL_FULL_DATADIR})
+endif()
+if(NOT docdir)
+ set(docdir ${CMAKE_INSTALL_FULL_DOCDIR})
+endif()
+
+list(APPEND final_message "-- PATH config --")
+list(APPEND final_message "Prefix: ${prefix}")
+list(APPEND final_message "Libdir: ${libdir}")
+list(APPEND final_message "Bindir: ${bindir}")
+list(APPEND final_message "Includedir: ${includedir}")
+list(APPEND final_message "Datarootdir: ${datarootdir}")
+list(APPEND final_message "Datadir: ${datadir}")
+list(APPEND final_message "Docdir: ${docdir}")
+
+set(PATH_DEFINES -DBIN_INSTALL_PATH=\"${libdir}/kodi\"
+ -DINSTALL_PATH=\"${datarootdir}/kodi\")
diff --git a/cmake/scripts/osx/ArchSetup.cmake b/cmake/scripts/osx/ArchSetup.cmake
new file mode 100644
index 0000000000..30478636e6
--- /dev/null
+++ b/cmake/scripts/osx/ArchSetup.cmake
@@ -0,0 +1,34 @@
+if(NOT CMAKE_TOOLCHAIN_FILE)
+ message(FATAL_ERROR "CMAKE_TOOLCHAIN_FILE required for osx. See ${PROJECT_SOURCE_DIR}/README.md")
+endif()
+
+set(CORE_MAIN_SOURCE ${CORE_SOURCE_DIR}/xbmc/platform/posix/main.cpp
+ ${CORE_SOURCE_DIR}/xbmc/platform/darwin/osx/SDLMain.mm
+ ${CORE_SOURCE_DIR}/xbmc/platform/darwin/osx/SDLMain.h)
+
+set(ARCH_DEFINES -D_LINUX -DTARGET_POSIX -DTARGET_DARWIN -DTARGET_DARWIN_OSX)
+set(SYSTEM_DEFINES -D_REENTRANT -D_FILE_DEFINED -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
+ -D__STDC_CONSTANT_MACROS)
+set(PLATFORM_DIR linux)
+set(CMAKE_SYSTEM_NAME Darwin)
+if(WITH_ARCH)
+ set(ARCH ${WITH_ARCH})
+else()
+ if(CPU STREQUAL x86_64 OR CPU STREQUAL i386)
+ set(ARCH x86-osx)
+ set(NEON False)
+ else()
+ message(SEND_ERROR "Unknown CPU: ${CPU}")
+ endif()
+endif()
+
+find_package(CXX11 REQUIRED)
+
+list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${NATIVEPREFIX})
+
+list(APPEND DEPLIBS "-framework DiskArbitration" "-framework IOKit"
+ "-framework IOSurface" "-framework SystemConfiguration"
+ "-framework ApplicationServices" "-framework AppKit"
+ "-framework CoreAudio" "-framework AudioToolbox"
+ "-framework CoreGraphics" "-framework CoreMedia"
+ "-framework VideoToolbox")
diff --git a/cmake/scripts/osx/ExtraTargets.cmake b/cmake/scripts/osx/ExtraTargets.cmake
new file mode 100644
index 0000000000..ed9c089144
--- /dev/null
+++ b/cmake/scripts/osx/ExtraTargets.cmake
@@ -0,0 +1,3 @@
+# XBMCHelper
+add_subdirectory(${CORE_SOURCE_DIR}/tools/EventClients/Clients/OSXRemote build/XBMCHelper)
+add_dependencies(${APP_NAME_LC} XBMCHelper)
diff --git a/cmake/scripts/osx/Install.cmake b/cmake/scripts/osx/Install.cmake
new file mode 100644
index 0000000000..3924ccf032
--- /dev/null
+++ b/cmake/scripts/osx/Install.cmake
@@ -0,0 +1,40 @@
+# OSX packaging
+
+set(PACKAGE_OUTPUT_DIR ${CMAKE_BINARY_DIR}/build/${CORE_BUILD_CONFIG})
+
+configure_file(${CORE_SOURCE_DIR}/xbmc/platform/darwin/osx/Info.plist.in
+ ${CMAKE_BINARY_DIR}/xbmc/platform/darwin/osx/Info.plist @ONLY)
+execute_process(COMMAND perl -p -i -e "s/r####/${APP_SCMID}/" ${CMAKE_BINARY_DIR}/xbmc/platform/darwin/osx/Info.plist)
+
+add_custom_target(bundle
+ COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${APP_NAME_LC}> ${PACKAGE_OUTPUT_DIR}/${APP_NAME}
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/DllPaths_generated.h
+ ${CMAKE_BINARY_DIR}/xbmc/DllPaths_generated.h
+ COMMAND "ACTION=build"
+ "TARGET_BUILD_DIR=${PACKAGE_OUTPUT_DIR}"
+ "TARGET_NAME=${APP_NAME}.app"
+ "APP_NAME=${APP_NAME}"
+ "SRCROOT=${CMAKE_BINARY_DIR}"
+ ${CORE_SOURCE_DIR}/tools/darwin/Support/CopyRootFiles-osx.command
+ COMMAND "XBMC_DEPENDS=${DEPENDS_PATH}"
+ "TARGET_BUILD_DIR=${PACKAGE_OUTPUT_DIR}"
+ "TARGET_NAME=${APP_NAME}.app"
+ "APP_NAME=${APP_NAME}"
+ "FULL_PRODUCT_NAME=${APP_NAME}.app"
+ "SRCROOT=${CMAKE_BINARY_DIR}"
+ ${CORE_SOURCE_DIR}/tools/darwin/Support/copyframeworks-osx.command)
+set_target_properties(bundle PROPERTIES FOLDER "Build Utilities")
+add_dependencies(bundle ${APP_NAME_LC})
+
+configure_file(${CORE_SOURCE_DIR}/tools/darwin/packaging/osx/mkdmg-osx.sh.in
+ ${CMAKE_BINARY_DIR}/tools/darwin/packaging/osx/mkdmg-osx.sh @ONLY)
+
+add_custom_target(dmg
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CORE_SOURCE_DIR}/tools/darwin/packaging/osx/
+ ${CMAKE_BINARY_DIR}/tools/darwin/packaging/osx/
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CORE_SOURCE_DIR}/tools/darwin/packaging/media/osx/
+ ${CMAKE_BINARY_DIR}/tools/darwin/packaging/media/osx/
+ COMMAND ./mkdmg-osx.sh ${CORE_BUILD_CONFIG}
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/tools/darwin/packaging/osx)
+set_target_properties(dmg PROPERTIES FOLDER "Build Utilities")
+add_dependencies(dmg bundle)
diff --git a/cmake/scripts/osx/Macros.cmake b/cmake/scripts/osx/Macros.cmake
new file mode 100644
index 0000000000..52f87d1ca2
--- /dev/null
+++ b/cmake/scripts/osx/Macros.cmake
@@ -0,0 +1,118 @@
+function(core_link_library lib wraplib)
+ if(CMAKE_GENERATOR MATCHES "Unix Makefiles" OR CMAKE_GENERATOR STREQUAL Ninja)
+ set(wrapper_obj cores/dll-loader/exports/CMakeFiles/wrapper.dir/wrapper.c.o)
+ elseif(CMAKE_GENERATOR MATCHES "Xcode")
+ set(wrapper_obj cores/dll-loader/exports/kodi.build/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/wrapper.build/Objects-$(CURRENT_VARIANT)/$(CURRENT_ARCH)/wrapper.o)
+ else()
+ message(FATAL_ERROR "Unsupported generator in core_link_library")
+ endif()
+
+ set(export -bundle -undefined dynamic_lookup -read_only_relocs suppress
+ -Wl,-alias_list,${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cores/dll-loader/exports/wrapper.def
+ ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${wrapper_obj})
+ set(extension ${CMAKE_SHARED_MODULE_SUFFIX})
+ set(check_arg "")
+ if(TARGET ${lib})
+ set(target ${lib})
+ set(link_lib $<TARGET_FILE:${lib}>)
+ set(check_arg ${ARGV2})
+ set(data_arg ${ARGV3})
+
+ # iOS: EFFECTIVE_PLATFORM_NAME is not resolved
+ # http://public.kitware.com/pipermail/cmake/2016-March/063049.html
+ if(CORE_SYSTEM_NAME STREQUAL ios AND CMAKE_GENERATOR STREQUAL Xcode)
+ get_target_property(dir ${lib} BINARY_DIR)
+ set(link_lib ${dir}/${CORE_BUILD_CONFIG}/${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX})
+ endif()
+ else()
+ set(target ${ARGV2})
+ set(link_lib ${lib})
+ set(check_arg ${ARGV3})
+ set(data_arg ${ARGV4})
+ endif()
+ if(check_arg STREQUAL export)
+ set(export ${export}
+ -Wl,--version-script=${ARGV3})
+ elseif(check_arg STREQUAL extras)
+ foreach(arg ${data_arg})
+ list(APPEND export ${arg})
+ endforeach()
+ elseif(check_arg STREQUAL archives)
+ set(extra_libs ${data_arg})
+ endif()
+ get_filename_component(dir ${wraplib} DIRECTORY)
+
+ # We can't simply pass the linker flags to the args section of the custom command
+ # because cmake will add quotes around it (and the linker will fail due to those).
+ # We need to do this handstand first ...
+ string(REPLACE " " ";" CUSTOM_COMMAND_ARGS_LDFLAGS ${CMAKE_SHARED_LINKER_FLAGS})
+
+ add_custom_command(OUTPUT ${wraplib}-${ARCH}${extension}
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${dir}
+ COMMAND ${CMAKE_C_COMPILER}
+ ARGS ${CUSTOM_COMMAND_ARGS_LDFLAGS} ${export} -Wl,-force_load ${link_lib} ${extra_libs}
+ -o ${CMAKE_BINARY_DIR}/${wraplib}-${ARCH}${extension}
+ DEPENDS ${target} wrapper.def wrapper
+ VERBATIM)
+
+ get_filename_component(libname ${wraplib} NAME_WE)
+ add_custom_target(wrap_${libname} ALL DEPENDS ${wraplib}-${ARCH}${extension})
+ set_target_properties(wrap_${libname} PROPERTIES FOLDER lib/wrapped)
+ add_dependencies(${APP_NAME_LC}-libraries wrap_${libname})
+
+ set(LIBRARY_FILES ${LIBRARY_FILES} ${CMAKE_BINARY_DIR}/${wraplib}-${ARCH}${extension} CACHE STRING "" FORCE)
+endfunction()
+
+function(find_soname lib)
+ cmake_parse_arguments(arg "REQUIRED" "" "" ${ARGN})
+
+ string(TOLOWER ${lib} liblow)
+ if(${lib}_LDFLAGS)
+ set(link_lib "${${lib}_LDFLAGS}")
+ else()
+ set(link_lib "${${lib}_LIBRARIES}")
+ endif()
+
+ execute_process(COMMAND ${CMAKE_C_COMPILER} -print-search-dirs
+ COMMAND fgrep libraries:
+ COMMAND sed "s/[^=]*=\\(.*\\)/\\1/"
+ COMMAND sed "s/:/ /g"
+ ERROR_QUIET
+ OUTPUT_VARIABLE cc_lib_path
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process(COMMAND echo ${link_lib}
+ COMMAND sed "s/-L[ ]*//g"
+ COMMAND sed "s/-l[^ ]*//g"
+ ERROR_QUIET
+ OUTPUT_VARIABLE env_lib_path
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ foreach(path ${cc_lib_path} ${env_lib_path})
+ if(IS_DIRECTORY ${path})
+ execute_process(COMMAND ls -- ${path}/lib${liblow}.dylib
+ ERROR_QUIET
+ OUTPUT_VARIABLE lib_file
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ else()
+ set(lib_file ${path})
+ endif()
+ if(lib_file)
+ # we want the path/name that is embedded in the dylib
+ execute_process(COMMAND otool -L ${lib_file}
+ COMMAND grep -v lib${liblow}.dylib
+ COMMAND grep ${liblow}
+ COMMAND awk "{V=1; print $V}"
+ ERROR_QUIET
+ OUTPUT_VARIABLE filename
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ get_filename_component(${lib}_SONAME "${filename}" NAME)
+ if(VERBOSE)
+ message(STATUS "${lib} soname: ${${lib}_SONAME}")
+ endif()
+ endif()
+ endforeach()
+ if(arg_REQUIRED AND NOT ${lib}_SONAME)
+ message(FATAL_ERROR "Could not find dynamically loadable library ${lib}")
+ endif()
+ set(${lib}_SONAME ${${lib}_SONAME} PARENT_SCOPE)
+endfunction()
diff --git a/cmake/scripts/osx/PathSetup.cmake b/cmake/scripts/osx/PathSetup.cmake
new file mode 100644
index 0000000000..071dfd45ea
--- /dev/null
+++ b/cmake/scripts/osx/PathSetup.cmake
@@ -0,0 +1,32 @@
+if(NOT prefix)
+ set(prefix ${DEPENDS_PATH})
+endif()
+if(NOT exec_prefix)
+ set(exec_prefix ${prefix})
+endif()
+if(NOT libdir)
+ set(libdir ${prefix}/lib)
+endif()
+if(NOT bindir)
+ set(bindir ${prefix}/bin)
+endif()
+if(NOT includedir)
+ set(includedir ${prefix}/include)
+endif()
+if(NOT datarootdir)
+ set(datarootdir ${prefix}/share)
+endif()
+if(NOT datadir)
+ set(datadir ${datarootdir})
+endif()
+
+list(APPEND final_message "-- PATH config --")
+list(APPEND final_message "Prefix: ${prefix}")
+list(APPEND final_message "Libdir: ${libdir}")
+list(APPEND final_message "Bindir: ${bindir}")
+list(APPEND final_message "Includedir: ${includedir}")
+list(APPEND final_message "Datarootdir: ${datarootdir}")
+list(APPEND final_message "Datadir: ${datadir}")
+
+set(PATH_DEFINES -DBIN_INSTALL_PATH=\"${libdir}/kodi\"
+ -DINSTALL_PATH=\"${datarootdir}/kodi\")
diff --git a/cmake/scripts/rbpi/ArchSetup.cmake b/cmake/scripts/rbpi/ArchSetup.cmake
new file mode 100644
index 0000000000..d955dd5363
--- /dev/null
+++ b/cmake/scripts/rbpi/ArchSetup.cmake
@@ -0,0 +1,28 @@
+set(ARCH_DEFINES -DTARGET_POSIX -DTARGET_LINUX -D_LINUX -D_ARMEL -DTARGET_RASPBERRY_PI
+ -DHAS_OMXPLAYER -DHAVE_OMXLIB)
+set(SYSTEM_DEFINES -D__STDC_CONSTANT_MACROS -D_FILE_DEFINED
+ -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64)
+set(PLATFORM_DIR linux)
+
+string(REGEX REPLACE "[ ]+" ";" SYSTEM_LDFLAGS "$ENV{LDFLAGS}")
+set(CMAKE_SYSTEM_NAME Linux)
+
+if(WITH_ARCH)
+ set(ARCH ${WITH_ARCH})
+else()
+ if(CPU STREQUAL arm1176jzf-s)
+ set(ARCH arm-linux-gnueabihf)
+ set(NEON False)
+ elseif(CPU MATCHES "cortex-a7" OR CPU MATCHES "cortex-a53")
+ set(ARCH arm-linux-gnueabihf)
+ set(NEON True)
+ else()
+ message(SEND_ERROR "Unknown CPU: ${CPU}")
+ endif()
+endif()
+
+find_package(CXX11 REQUIRED)
+
+set(MMAL_FOUND 1 CACHE INTERNAL "MMAL")
+set(OMX_FOUND 1 CACHE INTERNAL "OMX")
+set(OMXLIB_FOUND 1 CACHE INTERNAL "OMX")
diff --git a/cmake/scripts/rbpi/Install.cmake b/cmake/scripts/rbpi/Install.cmake
new file mode 120000
index 0000000000..28ce0129b9
--- /dev/null
+++ b/cmake/scripts/rbpi/Install.cmake
@@ -0,0 +1 @@
+../linux/Install.cmake \ No newline at end of file
diff --git a/cmake/scripts/rbpi/Macros.cmake b/cmake/scripts/rbpi/Macros.cmake
new file mode 120000
index 0000000000..2fdbb255f9
--- /dev/null
+++ b/cmake/scripts/rbpi/Macros.cmake
@@ -0,0 +1 @@
+../linux/Macros.cmake \ No newline at end of file
diff --git a/cmake/scripts/rbpi/PathSetup.cmake b/cmake/scripts/rbpi/PathSetup.cmake
new file mode 120000
index 0000000000..6786c1c131
--- /dev/null
+++ b/cmake/scripts/rbpi/PathSetup.cmake
@@ -0,0 +1 @@
+../linux/PathSetup.cmake \ No newline at end of file
diff --git a/cmake/scripts/windows/ArchSetup.cmake b/cmake/scripts/windows/ArchSetup.cmake
new file mode 100644
index 0000000000..d1c81a2541
--- /dev/null
+++ b/cmake/scripts/windows/ArchSetup.cmake
@@ -0,0 +1,89 @@
+# -------- Architecture settings ---------
+
+set(ARCH win32)
+
+
+# -------- Paths (mainly for find_package) ---------
+
+set(PLATFORM_DIR platform/win32)
+
+# Precompiled headers fail with per target output directory. (needs CMake 3.1)
+set(PRECOMPILEDHEADER_DIR ${PROJECT_BINARY_DIR}/${CORE_BUILD_CONFIG}/objs)
+
+set(CMAKE_SYSTEM_NAME Windows)
+list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${PROJECT_SOURCE_DIR}/../../lib/win32)
+list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${PROJECT_SOURCE_DIR}/../../lib/win32/ffmpeg)
+list(APPEND CMAKE_SYSTEM_LIBRARY_PATH ${PROJECT_SOURCE_DIR}/../../lib/win32/ffmpeg/bin)
+list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${PROJECT_SOURCE_DIR}/../BuildDependencies)
+
+set(PYTHON_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/../BuildDependencies/include/python)
+
+
+# -------- Compiler options ---------
+
+add_options(CXX ALL_BUILDS "/wd\"4996\"")
+set(ARCH_DEFINES -D_WINDOWS -DTARGET_WINDOWS -D__SSE__ -D__SSE2__)
+set(SYSTEM_DEFINES -DNOMINMAX -D_USE_32BIT_TIME_T -DHAS_DX -D__STDC_CONSTANT_MACROS
+ -DTAGLIB_STATIC -DNPT_CONFIG_ENABLE_LOGGING
+ -DPLT_HTTP_DEFAULT_USER_AGENT="UPnP/1.0 DLNADOC/1.50 Kodi"
+ -DPLT_HTTP_DEFAULT_SERVER="UPnP/1.0 DLNADOC/1.50 Kodi"
+ $<$<CONFIG:Debug>:-DD3D_DEBUG_INFO -D_ITERATOR_DEBUG_LEVEL=0>)
+
+# Make sure /FS is set for Visual Studio in order to prevent simultanious access to pdb files.
+if(CMAKE_GENERATOR MATCHES "Visual Studio")
+ set(CMAKE_CXX_FLAGS "/MP /FS ${CMAKE_CXX_FLAGS}")
+endif()
+
+# Google Test needs to use shared version of runtime libraries
+set(gtest_force_shared_crt ON CACHE STRING "" FORCE)
+
+
+# -------- Linker options ---------
+
+set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO")
+
+# For #pragma comment(lib X)
+# TODO: It would certainly be better to handle these libraries via CMake modules.
+link_directories(${PROJECT_SOURCE_DIR}/../../lib/win32/ffmpeg/bin
+ ${PROJECT_SOURCE_DIR}/../BuildDependencies/lib)
+
+# Additional libraries
+list(APPEND DEPLIBS d3d11.lib DInput8.lib DSound.lib winmm.lib Mpr.lib Iphlpapi.lib
+ PowrProf.lib setupapi.lib dwmapi.lib yajl.lib dxguid.lib DelayImp.lib)
+
+# NODEFAULTLIB option
+set(_nodefaultlibs_RELEASE libcmt)
+set(_nodefaultlibs_DEBUG libcmt msvcrt)
+foreach(_lib ${_nodefaultlibs_RELEASE})
+ set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:\"${_lib}\"")
+endforeach()
+foreach(_lib ${_nodefaultlibs_DEBUG})
+ set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:\"${_lib}\"")
+endforeach()
+
+# DELAYLOAD option
+set(_delayloadlibs zlib.dll libmysql.dll libxslt.dll dnssd.dll dwmapi.dll ssh.dll sqlite3.dll
+ avcodec-57.dll avfilter-6.dll avformat-57.dll avutil-55.dll
+ postproc-54.dll swresample-2.dll swscale-4.dll d3dcompiler_47.dll)
+foreach(_lib ${_delayloadlibs})
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DELAYLOAD:\"${_lib}\"")
+endforeach()
+
+# Make the Release version create a PDB
+set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
+# Minimize the size or the resulting DLLs
+set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF")
+
+
+# -------- Visual Studio options ---------
+
+if(CMAKE_GENERATOR MATCHES "Visual Studio")
+ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+
+ # Generate a batch file that opens Visual Studio with the necessary env variables set.
+ file(WRITE ${CMAKE_BINARY_DIR}/kodi-sln.bat
+ "@echo off\n"
+ "set KODI_HOME=%~dp0\n"
+ "set PATH=%~dp0\\system\n"
+ "start %~dp0\\${PROJECT_NAME}.sln")
+endif()
diff --git a/cmake/scripts/windows/CFlagOverrides.cmake b/cmake/scripts/windows/CFlagOverrides.cmake
new file mode 100644
index 0000000000..00f4e22af4
--- /dev/null
+++ b/cmake/scripts/windows/CFlagOverrides.cmake
@@ -0,0 +1,5 @@
+if(MSVC)
+ set(CMAKE_C_FLAGS "/MP /DWIN32 /D_WINDOWS /W3 /Zi /arch:SSE2")
+ set(CMAKE_C_FLAGS_DEBUG "/D_DEBUG /MDd /Ob0 /Od /RTC1 /D_ITERATOR_DEBUG_LEVEL=0")
+ set(CMAKE_C_FLAGS_RELEASE "/MD /Ox /Ob2 /Oi /Ot /Oy /GL /DNDEBUG")
+endif()
diff --git a/cmake/scripts/windows/CXXFlagOverrides.cmake b/cmake/scripts/windows/CXXFlagOverrides.cmake
new file mode 100644
index 0000000000..3c4d6c410a
--- /dev/null
+++ b/cmake/scripts/windows/CXXFlagOverrides.cmake
@@ -0,0 +1,5 @@
+if(MSVC)
+ set(CMAKE_CXX_FLAGS "/MP /DWIN32 /D_WINDOWS /W3 /GR /Zi /EHsc /arch:SSE2")
+ set(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /MDd /Ob0 /Od /RTC1 /D_ITERATOR_DEBUG_LEVEL=0")
+ set(CMAKE_CXX_FLAGS_RELEASE "/MD /Ox /Ob2 /Oi /Ot /Oy /GL /DNDEBUG")
+endif()
diff --git a/cmake/scripts/windows/Install.cmake b/cmake/scripts/windows/Install.cmake
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/cmake/scripts/windows/Install.cmake
diff --git a/cmake/scripts/windows/Macros.cmake b/cmake/scripts/windows/Macros.cmake
new file mode 100644
index 0000000000..2d3500d8f3
--- /dev/null
+++ b/cmake/scripts/windows/Macros.cmake
@@ -0,0 +1,66 @@
+function(core_link_library lib wraplib)
+ message(AUTHOR_WARNING "core_link_library is not compatible with windows.")
+endfunction()
+
+function(find_soname lib)
+ # Windows uses hardcoded dlls in xbmc/DllPaths_win32.h.
+ # Therefore the output of this function is unused.
+endfunction()
+
+# Add precompiled header to target
+# Arguments:
+# target existing target that will be set up to compile with a precompiled header
+# pch_header the precompiled header file
+# pch_source the precompiled header source file
+# Optional Arguments:
+# PCH_TARGET build precompiled header as separate target with the given name
+# so that the same precompiled header can be used for multiple libraries
+# EXCLUDE_SOURCES if not all target sources shall use the precompiled header,
+# the relevant files can be listed here
+# On return:
+# Compiles the pch_source into a precompiled header and adds the header to
+# the given target
+function(add_precompiled_header target pch_header pch_source)
+ cmake_parse_arguments(PCH "" "PCH_TARGET" "EXCLUDE_SOURCES" ${ARGN})
+
+ if(PCH_PCH_TARGET)
+ set(pch_binary ${PRECOMPILEDHEADER_DIR}/${PCH_PCH_TARGET}.pch)
+ else()
+ set(pch_binary ${PRECOMPILEDHEADER_DIR}/${target}.pch)
+ endif()
+
+ # Set compile options and dependency for sources
+ get_target_property(sources ${target} SOURCES)
+ list(REMOVE_ITEM sources ${pch_source})
+ foreach(exclude_source IN LISTS PCH_EXCLUDE_SOURCES)
+ list(REMOVE_ITEM sources ${exclude_source})
+ endforeach()
+ set_source_files_properties(${sources}
+ PROPERTIES COMPILE_FLAGS "/Yu\"${pch_header}\" /Fp\"${pch_binary}\" /FI\"${pch_header}\""
+ OBJECT_DEPENDS "${pch_binary}")
+
+ # Set compile options for precompiled header
+ if(NOT PCH_PCH_TARGET OR NOT TARGET ${PCH_PCH_TARGET}_pch)
+ set_source_files_properties(${pch_source}
+ PROPERTIES COMPILE_FLAGS "/Yc\"${pch_header}\" /Fp\"${pch_binary}\""
+ OBJECT_OUTPUTS "${pch_binary}")
+ endif()
+
+ # Compile precompiled header
+ if(PCH_PCH_TARGET)
+ # As own target for usage in multiple libraries
+ if(NOT TARGET ${PCH_PCH_TARGET}_pch)
+ add_library(${PCH_PCH_TARGET}_pch STATIC ${pch_source})
+ set_target_properties(${PCH_PCH_TARGET}_pch PROPERTIES COMPILE_PDB_NAME vc140
+ COMPILE_PDB_OUTPUT_DIRECTORY ${PRECOMPILEDHEADER_DIR}
+ FOLDER "Build Utilities")
+ endif()
+ # From VS2012 onwards, precompiled headers have to be linked against (LNK2011).
+ target_link_libraries(${target} PUBLIC ${PCH_PCH_TARGET}_pch)
+ set_target_properties(${target} PROPERTIES COMPILE_PDB_NAME vc140
+ COMPILE_PDB_OUTPUT_DIRECTORY ${PRECOMPILEDHEADER_DIR})
+ else()
+ # As part of the target
+ target_sources(${target} PRIVATE ${pch_source})
+ endif()
+endfunction()
diff --git a/cmake/scripts/windows/PathSetup.cmake b/cmake/scripts/windows/PathSetup.cmake
new file mode 100644
index 0000000000..8550616cd7
--- /dev/null
+++ b/cmake/scripts/windows/PathSetup.cmake
@@ -0,0 +1,34 @@
+if(NOT prefix)
+ set(prefix ${CMAKE_INSTALL_PREFIX})
+else()
+ set(CMAKE_INSTALL_PREFIX ${prefix})
+endif()
+if(NOT exec_prefix)
+ set(exec_prefix ${prefix})
+endif()
+if(NOT libdir)
+ set(libdir ${prefix}/lib)
+endif()
+if(NOT bindir)
+ set(bindir ${prefix}/bin)
+endif()
+if(NOT includedir)
+ set(includedir ${prefix}/include)
+endif()
+if(NOT datarootdir)
+ set(datarootdir ${prefix}/share)
+endif()
+if(NOT datadir)
+ set(datadir ${datarootdir})
+endif()
+
+list(APPEND final_message "-- PATH config --")
+list(APPEND final_message "Prefix: ${prefix}")
+list(APPEND final_message "Libdir: ${libdir}")
+list(APPEND final_message "Bindir: ${bindir}")
+list(APPEND final_message "Includedir: ${includedir}")
+list(APPEND final_message "Datarootdir: ${datarootdir}")
+list(APPEND final_message "Datadir: ${datadir}")
+
+set(PATH_DEFINES -DBIN_INSTALL_PATH=\"${libdir}/kodi\"
+ -DINSTALL_PATH=\"${datarootdir}/kodi\")
diff --git a/cmake/scripts/windows/tools/patch.cmake b/cmake/scripts/windows/tools/patch.cmake
new file mode 100644
index 0000000000..0ef2952219
--- /dev/null
+++ b/cmake/scripts/windows/tools/patch.cmake
@@ -0,0 +1,37 @@
+find_program(PATCH_FOUND NAMES patch patch.exe)
+if(PATCH_FOUND)
+ message(STATUS "patch utility found at ${PATCH_FOUND}")
+else()
+ set(PATCH_ARCHIVE_NAME "patch-2.5.9-7-bin-1")
+ set(PATCH_ARCHIVE "${PATCH_ARCHIVE_NAME}.zip")
+ set(PATCH_URL "${KODI_MIRROR}/build-deps/win32/${PATCH_ARCHIVE}")
+ set(PATCH_DOWNLOAD ${BUILD_DIR}/download/${PATCH_ARCHIVE})
+
+ # download the archive containing patch.exe
+ message(STATUS "Downloading patch utility from ${PATCH_URL}...")
+ file(DOWNLOAD "${PATCH_URL}" "${PATCH_DOWNLOAD}" STATUS PATCH_DL_STATUS LOG PATCH_LOG SHOW_PROGRESS)
+ list(GET PATCH_DL_STATUS 0 PATCH_RETCODE)
+ if(NOT PATCH_RETCODE EQUAL 0)
+ message(FATAL_ERROR "ERROR downloading ${PATCH_URL} - status: ${PATCH_DL_STATUS} log: ${PATCH_LOG}")
+ endif()
+
+ # extract the archive containing patch.exe
+ execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzvf ${PATCH_DOWNLOAD}
+ WORKING_DIRECTORY ${BUILD_DIR})
+
+ # make sure the extraction worked and that patch.exe is there
+ set(PATCH_PATH ${BUILD_DIR}/${PATCH_ARCHIVE_NAME})
+ set(PATCH_BINARY_PATH ${PATCH_PATH}/bin/patch.exe)
+ if(NOT EXISTS ${PATCH_PATH} OR NOT EXISTS ${PATCH_BINARY_PATH})
+ message(FATAL_ERROR "ERROR extracting patch utility from ${PATCH_PATH}")
+ endif()
+
+ # copy patch.exe into the output directory
+ file(INSTALL ${PATCH_BINARY_PATH} DESTINATION ${ADDON_DEPENDS_PATH}/bin)
+
+ # make sure that cmake can find the copied patch.exe
+ find_program(PATCH_FOUND NAMES patch patch.exe)
+ if(NOT PATCH_FOUND)
+ message(FATAL_ERROR "ERROR installing patch utility from ${PATCH_BINARY_PATH} to ${ADDON_DEPENDS_PATH}/bin")
+ endif()
+endif()
diff --git a/cmake/treedata/android/subdirs.txt b/cmake/treedata/android/subdirs.txt
new file mode 100644
index 0000000000..599017c539
--- /dev/null
+++ b/cmake/treedata/android/subdirs.txt
@@ -0,0 +1,17 @@
+xbmc/linux linuxsupport
+xbmc/input/touch input/touch
+xbmc/input/touch/generic input/touch/generic
+xbmc/network/linux network/linux
+xbmc/peripherals/bus/linux peripherals/bus/linux
+xbmc/peripherals/bus/android peripherals/bus/android
+xbmc/powermanagement/android powermanagement/android
+xbmc/storage/android storage/android
+xbmc/filesystem/posix filesystem/posix
+xbmc/utils/posix utils_posix
+xbmc/windowing/android windowing/android
+xbmc/windowing/egl windowing/egl
+xbmc/platform/posix posix
+xbmc/platform/android/activity android_activity
+xbmc/platform/android/bionic_supplement android_bionicsupplement
+xbmc/platform/android/jni android_jni
+xbmc/platform/android/loader android_loader
diff --git a/cmake/treedata/common/addons.txt b/cmake/treedata/common/addons.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/cmake/treedata/common/addons.txt
diff --git a/cmake/treedata/common/cores.txt b/cmake/treedata/common/cores.txt
new file mode 100644
index 0000000000..8d79dd18dc
--- /dev/null
+++ b/cmake/treedata/common/cores.txt
@@ -0,0 +1,9 @@
+xbmc/cores cores
+xbmc/cores/AudioEngine cores/audioengine
+xbmc/cores/DllLoader cores/dll-loader
+xbmc/cores/DllLoader/exports cores/dll-loader/exports
+xbmc/cores/DllLoader/exports/util cores/dll-loader/exports/util
+xbmc/cores/ExternalPlayer cores/externalplayer
+xbmc/cores/paplayer cores/paplayer
+xbmc/cores/playercorefactory cores/playercorefactory
+xbmc/cores/RetroPlayer cores/RetroPlayer
diff --git a/cmake/treedata/common/events.txt b/cmake/treedata/common/events.txt
new file mode 100644
index 0000000000..0adeb08412
--- /dev/null
+++ b/cmake/treedata/common/events.txt
@@ -0,0 +1,2 @@
+xbmc/events events
+xbmc/events/windows events/windows
diff --git a/cmake/treedata/common/externals.txt b/cmake/treedata/common/externals.txt
new file mode 100644
index 0000000000..e3b9ab4af5
--- /dev/null
+++ b/cmake/treedata/common/externals.txt
@@ -0,0 +1,2 @@
+xbmc/contrib/kissfft kissfft
+lib/libexif exif
diff --git a/cmake/treedata/common/filesystem.txt b/cmake/treedata/common/filesystem.txt
new file mode 100644
index 0000000000..1c49a74d4b
--- /dev/null
+++ b/cmake/treedata/common/filesystem.txt
@@ -0,0 +1,3 @@
+xbmc/filesystem filesystem
+xbmc/filesystem/VideoDatabaseDirectory filesystem/videodatabase
+xbmc/filesystem/MusicDatabaseDirectory filesystem/musicdatabase
diff --git a/cmake/treedata/common/games.txt b/cmake/treedata/common/games.txt
new file mode 100644
index 0000000000..03d42bc29f
--- /dev/null
+++ b/cmake/treedata/common/games.txt
@@ -0,0 +1,12 @@
+xbmc/games games
+xbmc/games/addons games/addons
+xbmc/games/addons/playback games/addons/playback
+xbmc/games/addons/savestates games/addons/savestates
+xbmc/games/controllers games/controllers
+xbmc/games/controllers/dialogs games/controllers/dialogs
+xbmc/games/controllers/guicontrols games/controllers/guicontrols
+xbmc/games/controllers/windows games/controllers/windows
+xbmc/games/dialogs games/dialogs
+xbmc/games/ports games/ports
+xbmc/games/tags games/tags
+xbmc/games/windows games/windows
diff --git a/cmake/treedata/common/interfaces.txt b/cmake/treedata/common/interfaces.txt
new file mode 100644
index 0000000000..ffd35706d4
--- /dev/null
+++ b/cmake/treedata/common/interfaces.txt
@@ -0,0 +1,9 @@
+xbmc/interfaces interfaces
+xbmc/interfaces/builtins interfaces/builtins
+xbmc/interfaces/generic interfaces/generic
+xbmc/interfaces/info interfaces/info
+xbmc/interfaces/json-rpc interfaces/json-rpc
+xbmc/interfaces/json-rpc/schema interfaces/json-rpc/schema
+xbmc/interfaces/legacy interfaces/legacy
+xbmc/interfaces/legacy/wsgi interfaces/legacy/wsgi
+xbmc/interfaces/python interfaces/python
diff --git a/cmake/treedata/common/music.txt b/cmake/treedata/common/music.txt
new file mode 100644
index 0000000000..71f30e16fa
--- /dev/null
+++ b/cmake/treedata/common/music.txt
@@ -0,0 +1,5 @@
+xbmc/music music
+xbmc/music/dialogs music/dialogs
+xbmc/music/infoscanner music/infoscanner
+xbmc/music/tags music/tags
+xbmc/music/windows music/windows
diff --git a/cmake/treedata/common/network.txt b/cmake/treedata/common/network.txt
new file mode 100644
index 0000000000..46da314d77
--- /dev/null
+++ b/cmake/treedata/common/network.txt
@@ -0,0 +1,2 @@
+xbmc/network network
+xbmc/network/websocket network/websocket
diff --git a/cmake/treedata/common/peripherals.txt b/cmake/treedata/common/peripherals.txt
new file mode 100644
index 0000000000..903b5378e0
--- /dev/null
+++ b/cmake/treedata/common/peripherals.txt
@@ -0,0 +1,6 @@
+xbmc/peripherals peripherals
+xbmc/peripherals/addons peripherals/addons
+xbmc/peripherals/bus peripherals/bus
+xbmc/peripherals/bus/virtual peripherals/bus/virtual
+xbmc/peripherals/devices peripherals/devices
+xbmc/peripherals/dialogs peripherals/dialogs
diff --git a/cmake/treedata/common/profiles.txt b/cmake/treedata/common/profiles.txt
new file mode 100644
index 0000000000..fae570ba88
--- /dev/null
+++ b/cmake/treedata/common/profiles.txt
@@ -0,0 +1,3 @@
+xbmc/profiles profiles
+xbmc/profiles/dialogs profiles/dialogs
+xbmc/profiles/windows profiles/windows
diff --git a/cmake/treedata/common/pvr.txt b/cmake/treedata/common/pvr.txt
new file mode 100644
index 0000000000..679767731a
--- /dev/null
+++ b/cmake/treedata/common/pvr.txt
@@ -0,0 +1,7 @@
+xbmc/pvr pvr
+xbmc/pvr/addons pvr/addons
+xbmc/pvr/channels pvr/channels
+xbmc/pvr/dialogs pvr/dialogs
+xbmc/pvr/recordings pvr/recordings
+xbmc/pvr/timers pvr/timers
+xbmc/pvr/windows pvr/windows
diff --git a/cmake/treedata/common/settings.txt b/cmake/treedata/common/settings.txt
new file mode 100644
index 0000000000..c5aa2aecd3
--- /dev/null
+++ b/cmake/treedata/common/settings.txt
@@ -0,0 +1,4 @@
+xbmc/settings settings
+xbmc/settings/dialogs settings/dialogs
+xbmc/settings/lib settings/lib
+xbmc/settings/windows settings/windows
diff --git a/cmake/treedata/common/subdirs.txt b/cmake/treedata/common/subdirs.txt
new file mode 100644
index 0000000000..4e42de054c
--- /dev/null
+++ b/cmake/treedata/common/subdirs.txt
@@ -0,0 +1,41 @@
+xbmc xbmc
+xbmc/addons addons
+xbmc/addons/interfaces addonsBinaryInterfaces
+xbmc/addons/interfaces/Addon addonCallbacks_Addon
+xbmc/addons/interfaces/AudioDSP addonCallbacks_AudioDSP
+xbmc/addons/interfaces/AudioEngine addonCallbacks_AudioEngine
+xbmc/addons/interfaces/Codec addonCallbacks_Codec
+xbmc/addons/interfaces/Game addonCallbacks_Game
+xbmc/addons/interfaces/GUI addonCallbacks_GUI
+xbmc/addons/interfaces/InputStream addonCallbacks_InputStream
+xbmc/addons/interfaces/Peripheral addonCallbacks_Peripheral
+xbmc/addons/interfaces/PVR addonCallbacks_PVR
+xbmc/commons commons
+xbmc/dbwrappers dbwrappers
+xbmc/dialogs dialogs
+xbmc/epg epg
+xbmc/guilib guilib
+xbmc/input input
+xbmc/input/joysticks input/joysticks
+xbmc/input/joysticks/dialogs input/joysticks/dialogs
+xbmc/input/joysticks/generic input/joysticks/generic
+xbmc/input/keyboard input/keyboard
+xbmc/input/keyboard/generic input/keyboard/generic
+xbmc/input/mouse input/mouse
+xbmc/input/mouse/generic input/mouse/generic
+xbmc/listproviders listproviders
+xbmc/media media
+xbmc/messaging messaging
+xbmc/messaging/helpers messagingHelpers
+xbmc/pictures pictures
+xbmc/platform platform
+xbmc/playlists playlists
+xbmc/powermanagement powermanagement
+xbmc/programs programs
+xbmc/rendering rendering
+xbmc/storage storage
+xbmc/threads threads
+xbmc/utils utils
+xbmc/view view
+xbmc/windowing windowing
+xbmc/windows windows
diff --git a/cmake/treedata/common/tests.txt b/cmake/treedata/common/tests.txt
new file mode 100644
index 0000000000..358bc4d546
--- /dev/null
+++ b/cmake/treedata/common/tests.txt
@@ -0,0 +1,10 @@
+xbmc/test test
+xbmc/addons/test test/addons
+xbmc/filesystem/test test/filesystem
+xbmc/interfaces/python/test test/python
+xbmc/music/tags/test test/music_tags
+xbmc/network/test test/network
+xbmc/threads/test test/threads
+xbmc/utils/test test/utils
+xbmc/video/test test/video
+xbmc/cores/AudioEngine/Sinks/test test/audioengine_sinks
diff --git a/cmake/treedata/common/video.txt b/cmake/treedata/common/video.txt
new file mode 100644
index 0000000000..e7855a0809
--- /dev/null
+++ b/cmake/treedata/common/video.txt
@@ -0,0 +1,5 @@
+xbmc/video video
+xbmc/video/dialogs video/dialogs
+xbmc/video/jobs video/jobs
+xbmc/video/videosync video/sync
+xbmc/video/windows video/windows
diff --git a/cmake/treedata/common/videoplayer.txt b/cmake/treedata/common/videoplayer.txt
new file mode 100644
index 0000000000..8c8d45d1ad
--- /dev/null
+++ b/cmake/treedata/common/videoplayer.txt
@@ -0,0 +1,12 @@
+xbmc/cores/VideoPlayer cores/VideoPlayer
+xbmc/cores/VideoPlayer/DVDCodecs cores/VideoPlayer/codecs
+xbmc/cores/VideoPlayer/DVDCodecs/Audio cores/VideoPlayer/codecs/audio
+xbmc/cores/VideoPlayer/DVDCodecs/Overlay cores/VideoPlayer/codecs/overlay
+xbmc/cores/VideoPlayer/DVDCodecs/Video cores/VideoPlayer/codecs/video
+xbmc/cores/VideoPlayer/DVDDemuxers cores/VideoPlayer/demuxers
+xbmc/cores/VideoPlayer/DVDInputStreams cores/VideoPlayer/inputstreams
+xbmc/cores/VideoPlayer/DVDSubtitles cores/VideoPlayer/subtitles
+xbmc/cores/VideoPlayer/Process cores/VideoPlayer/process
+xbmc/cores/VideoPlayer/VideoRenderers cores/VideoPlayer/videorenderers
+xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders cores/VideoPlayer/videorenderers/shaders
+xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender cores/VideoPlayer/videorenderers/hwdec
diff --git a/cmake/treedata/freebsd/subdirs.txt b/cmake/treedata/freebsd/subdirs.txt
new file mode 100644
index 0000000000..df2fa76da9
--- /dev/null
+++ b/cmake/treedata/freebsd/subdirs.txt
@@ -0,0 +1,13 @@
+xbmc/linux linuxsupport
+xbmc/linux/sse4 sse4
+xbmc/input/linux input/linux
+xbmc/input/touch input/touch
+xbmc/input/touch/generic input/touch/generic
+xbmc/network/linux network/linux
+xbmc/peripherals/bus/linux peripherals/bus/linux
+xbmc/powermanagement/linux powermanagement/linux
+xbmc/storage/linux storage/linux
+xbmc/filesystem/posix filesystem/posix
+xbmc/utils/posix utils_posix
+xbmc/platform/posix posix
+xbmc/freebsd freebsdsupport
diff --git a/cmake/treedata/ios/subdirs.txt b/cmake/treedata/ios/subdirs.txt
new file mode 100644
index 0000000000..b681ed5ced
--- /dev/null
+++ b/cmake/treedata/ios/subdirs.txt
@@ -0,0 +1,15 @@
+xbmc/linux linuxsupport
+xbmc/input/touch input/touch
+xbmc/input/touch/generic input/touch/generic
+xbmc/network/linux network/linux
+xbmc/network/osx network/osx
+xbmc/peripherals/bus/osx peripherals/bus/osx
+xbmc/powermanagement/osx powermanagement/osx
+xbmc/storage/osx storage/osx
+xbmc/platform/posix posix
+xbmc/platform/darwin platform_darwin
+xbmc/platform/darwin/ios platform_ios
+xbmc/platform/darwin/ios-common platform_ios-common
+xbmc/filesystem/posix filesystem/posix
+xbmc/utils/posix utils_posix
+xbmc/windowing/osx windowing/osx
diff --git a/cmake/treedata/linux/subdirs.txt b/cmake/treedata/linux/subdirs.txt
new file mode 100644
index 0000000000..2dc80450d0
--- /dev/null
+++ b/cmake/treedata/linux/subdirs.txt
@@ -0,0 +1,13 @@
+xbmc/linux linuxsupport
+xbmc/linux/sse4 sse4
+xbmc/input/linux input/linux
+xbmc/input/touch input/touch
+xbmc/input/touch/generic input/touch/generic
+xbmc/network/linux network/linux
+xbmc/peripherals/bus/linux peripherals/bus/linux
+xbmc/powermanagement/linux powermanagement/linux
+xbmc/storage/linux storage/linux
+xbmc/filesystem/posix filesystem/posix
+xbmc/utils/posix utils_posix
+xbmc/windowing/egl windowing/egl
+xbmc/platform/posix posix
diff --git a/cmake/treedata/optional/common/X11.txt b/cmake/treedata/optional/common/X11.txt
new file mode 100644
index 0000000000..f4afa572dd
--- /dev/null
+++ b/cmake/treedata/optional/common/X11.txt
@@ -0,0 +1 @@
+xbmc/windowing/X11 windowing/X11 # X11
diff --git a/cmake/treedata/optional/common/cdrip.txt b/cmake/treedata/optional/common/cdrip.txt
new file mode 100644
index 0000000000..79b53907d4
--- /dev/null
+++ b/cmake/treedata/optional/common/cdrip.txt
@@ -0,0 +1 @@
+xbmc/cdrip cdrip # OPTICAL
diff --git a/cmake/treedata/optional/common/dacp.txt b/cmake/treedata/optional/common/dacp.txt
new file mode 100644
index 0000000000..fd225c29ea
--- /dev/null
+++ b/cmake/treedata/optional/common/dacp.txt
@@ -0,0 +1 @@
+xbmc/network/dacp network/dacp # AIRTUNES
diff --git a/cmake/treedata/optional/common/mir.txt b/cmake/treedata/optional/common/mir.txt
new file mode 100644
index 0000000000..d681e8b5ae
--- /dev/null
+++ b/cmake/treedata/optional/common/mir.txt
@@ -0,0 +1 @@
+xbmc/windowing/mir windowing/mir # MIR
diff --git a/cmake/treedata/optional/common/nonfree.txt b/cmake/treedata/optional/common/nonfree.txt
new file mode 100644
index 0000000000..470ed59752
--- /dev/null
+++ b/cmake/treedata/optional/common/nonfree.txt
@@ -0,0 +1 @@
+lib/UnrarXLib unrarxlib # NONFREE
diff --git a/cmake/treedata/optional/common/opengl.txt b/cmake/treedata/optional/common/opengl.txt
new file mode 100644
index 0000000000..b88ad7a643
--- /dev/null
+++ b/cmake/treedata/optional/common/opengl.txt
@@ -0,0 +1 @@
+xbmc/rendering/gl rendering/gl # OPENGL
diff --git a/cmake/treedata/optional/common/opengles.txt b/cmake/treedata/optional/common/opengles.txt
new file mode 100644
index 0000000000..6a223a11d1
--- /dev/null
+++ b/cmake/treedata/optional/common/opengles.txt
@@ -0,0 +1 @@
+xbmc/rendering/gles rendering/gles # OPENGLES
diff --git a/cmake/treedata/optional/common/upnp.txt b/cmake/treedata/optional/common/upnp.txt
new file mode 100644
index 0000000000..5589b808e9
--- /dev/null
+++ b/cmake/treedata/optional/common/upnp.txt
@@ -0,0 +1,2 @@
+lib/libUPnP upnp # UPNP
+xbmc/network/upnp network/upnp # UPNP
diff --git a/cmake/treedata/optional/common/webserver.txt b/cmake/treedata/optional/common/webserver.txt
new file mode 100644
index 0000000000..b492006a5b
--- /dev/null
+++ b/cmake/treedata/optional/common/webserver.txt
@@ -0,0 +1,2 @@
+xbmc/network/httprequesthandler network/httprequesthandler # MICROHTTPD
+xbmc/network/httprequesthandler/python network/httprequesthandler/python # MICROHTTPD
diff --git a/cmake/treedata/osx/subdirs.txt b/cmake/treedata/osx/subdirs.txt
new file mode 100644
index 0000000000..f0fc5c5515
--- /dev/null
+++ b/cmake/treedata/osx/subdirs.txt
@@ -0,0 +1,12 @@
+xbmc/linux linuxsupport
+xbmc/network/linux network/linux
+xbmc/network/osx network/osx
+xbmc/peripherals/bus/osx peripherals/bus/osx
+xbmc/powermanagement/osx powermanagement/osx
+xbmc/storage/osx storage/osx
+xbmc/platform/posix posix
+xbmc/platform/darwin platform_darwin
+xbmc/platform/darwin/osx platform_osx
+xbmc/filesystem/posix filesystem/posix
+xbmc/utils/posix utils_posix
+xbmc/windowing/osx windowing/osx
diff --git a/cmake/treedata/rbpi/omxplayer.txt b/cmake/treedata/rbpi/omxplayer.txt
new file mode 100644
index 0000000000..d56f1df87e
--- /dev/null
+++ b/cmake/treedata/rbpi/omxplayer.txt
@@ -0,0 +1 @@
+xbmc/cores/omxplayer cores/omxplayer
diff --git a/cmake/treedata/rbpi/subdirs.txt b/cmake/treedata/rbpi/subdirs.txt
new file mode 100644
index 0000000000..866ec00a6b
--- /dev/null
+++ b/cmake/treedata/rbpi/subdirs.txt
@@ -0,0 +1,12 @@
+xbmc/linux linuxsupport
+xbmc/input/linux input/linux
+xbmc/input/touch input/touch
+xbmc/input/touch/generic input/touch/generic
+xbmc/network/linux network/linux
+xbmc/peripherals/bus/linux peripherals/bus/linux
+xbmc/powermanagement/linux powermanagement/linux
+xbmc/storage/linux storage/linux
+xbmc/filesystem/posix filesystem/posix
+xbmc/utils/posix utils_posix
+xbmc/platform/posix posix
+xbmc/windowing/egl windowing/egl # EGL
diff --git a/cmake/treedata/windows/externals.txt b/cmake/treedata/windows/externals.txt
new file mode 100644
index 0000000000..989677e6c9
--- /dev/null
+++ b/cmake/treedata/windows/externals.txt
@@ -0,0 +1 @@
+lib/win32/Effects11 Effects11
diff --git a/cmake/treedata/windows/subdirs.txt b/cmake/treedata/windows/subdirs.txt
new file mode 100644
index 0000000000..e52d2f6013
--- /dev/null
+++ b/cmake/treedata/windows/subdirs.txt
@@ -0,0 +1,14 @@
+xbmc/platform/win32 platform_win32
+xbmc/input/windows input/windows
+xbmc/input/touch input/touch
+xbmc/input/touch/generic input/touch/generic
+xbmc/network/windows network/windows
+xbmc/network/mdns network/mdns
+xbmc/peripherals/bus/win32 peripherals/bus/win32
+xbmc/powermanagement/windows powermanagement/windows
+xbmc/storage/windows storage/windows
+xbmc/filesystem/win32 filesystem/win32
+xbmc/utils/win32 utils_win32
+xbmc/rendering/dx rendering_dx
+xbmc/threads/platform/win threads_win
+xbmc/windowing/windows windowing/windows