summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-rw-r--r--cmake/KodiConfig.cmake.in33
-rw-r--r--cmake/README.md105
-rw-r--r--cmake/addons/CMakeLists.txt518
-rw-r--r--cmake/addons/README.md49
-rw-r--r--cmake/addons/bootstrap/Bootstrap.cmake39
-rw-r--r--cmake/addons/bootstrap/CMakeLists.txt93
-rw-r--r--cmake/addons/bootstrap/README.md49
-rw-r--r--cmake/addons/bootstrap/repositories/binary-addons.txt1
-rw-r--r--cmake/addons/depends/CMakeLists.txt41
-rw-r--r--cmake/addons/depends/README35
-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/prebuilt/README21
-rw-r--r--cmake/cpack/CPackConfigDEB.cmake349
-rw-r--r--cmake/cpack/deb/NEWS.Debian24
-rw-r--r--cmake/cpack/deb/copyright3047
-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-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-kodi-send.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-tools-texturepacker.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.txt45
-rw-r--r--cmake/installdata/common/certificates.txt1
-rw-r--r--cmake/installdata/common/common.txt13
-rw-r--r--cmake/installdata/darwin_embedded/fontconfig.txt1
-rw-r--r--cmake/installdata/darwin_embedded/packaging.txt3
-rw-r--r--cmake/installdata/darwin_embedded/runtime.txt2
-rw-r--r--cmake/installdata/linux/lirc.txt1
-rw-r--r--cmake/installdata/osx/packaging.txt4
-rw-r--r--cmake/installdata/osx/runtime.txt2
-rw-r--r--cmake/installdata/test-reference-data.txt36
-rw-r--r--cmake/installdata/windows/addons.txt2
-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/installdata/windowsstore/addons.txt2
-rw-r--r--cmake/installdata/windowsstore/dlls.txt1
-rw-r--r--cmake/installdata/windowsstore/irss.txt2
-rw-r--r--cmake/installdata/windowsstore/python.txt1
-rw-r--r--cmake/messages/flatbuffers/retroplayer.txt1
-rw-r--r--cmake/modules/FindASS.cmake44
-rw-r--r--cmake/modules/FindAlsa.cmake46
-rw-r--r--cmake/modules/FindAtomic.cmake56
-rw-r--r--cmake/modules/FindAvahi.cmake63
-rw-r--r--cmake/modules/FindBluetooth.cmake44
-rw-r--r--cmake/modules/FindBluray.cmake67
-rw-r--r--cmake/modules/FindCAP.cmake44
-rw-r--r--cmake/modules/FindCEC.cmake61
-rw-r--r--cmake/modules/FindCWiid.cmake44
-rw-r--r--cmake/modules/FindCdio.cmake42
-rw-r--r--cmake/modules/FindCrossGUID.cmake111
-rw-r--r--cmake/modules/FindCurl.cmake62
-rw-r--r--cmake/modules/FindD3DX11Effects.cmake33
-rw-r--r--cmake/modules/FindDBus.cmake52
-rw-r--r--cmake/modules/FindDav1d.cmake62
-rw-r--r--cmake/modules/FindEGL.cmake57
-rw-r--r--cmake/modules/FindEpollShim.cmake27
-rw-r--r--cmake/modules/FindFFMPEG.cmake318
-rw-r--r--cmake/modules/FindFlatBuffers.cmake63
-rw-r--r--cmake/modules/FindFmt.cmake149
-rw-r--r--cmake/modules/FindFreeType.cmake46
-rw-r--r--cmake/modules/FindFriBidi.cmake52
-rw-r--r--cmake/modules/FindFstrcmp.cmake63
-rw-r--r--cmake/modules/FindGBM.cmake68
-rw-r--r--cmake/modules/FindGIF.cmake40
-rw-r--r--cmake/modules/FindGLU.cmake33
-rw-r--r--cmake/modules/FindGLX.cmake36
-rw-r--r--cmake/modules/FindGnuTLS.cmake34
-rw-r--r--cmake/modules/FindHarfBuzz.cmake46
-rw-r--r--cmake/modules/FindIconv.cmake44
-rw-r--r--cmake/modules/FindIso9660pp.cmake45
-rw-r--r--cmake/modules/FindKissFFT.cmake46
-rw-r--r--cmake/modules/FindLCMS2.cmake48
-rw-r--r--cmake/modules/FindLLVM.cmake19
-rw-r--r--cmake/modules/FindLibAndroidJNI.cmake40
-rw-r--r--cmake/modules/FindLibDRM.cmake67
-rw-r--r--cmake/modules/FindLibDvd.cmake32
-rw-r--r--cmake/modules/FindLibDvdCSS.cmake123
-rw-r--r--cmake/modules/FindLibDvdNav.cmake146
-rw-r--r--cmake/modules/FindLibDvdRead.cmake154
-rw-r--r--cmake/modules/FindLibInput.cmake36
-rw-r--r--cmake/modules/FindLibUSB.cmake45
-rw-r--r--cmake/modules/FindLibXml2.cmake84
-rw-r--r--cmake/modules/FindLibZip.cmake74
-rw-r--r--cmake/modules/FindLircClient.cmake36
-rw-r--r--cmake/modules/FindLzo2.cmake37
-rw-r--r--cmake/modules/FindMDNS.cmake47
-rw-r--r--cmake/modules/FindMariaDBClient.cmake83
-rw-r--r--cmake/modules/FindMicroHttpd.cmake43
-rw-r--r--cmake/modules/FindMySqlClient.cmake69
-rw-r--r--cmake/modules/FindNFS.cmake117
-rw-r--r--cmake/modules/FindOpenGLES.cmake50
-rw-r--r--cmake/modules/FindOpenGl.cmake40
-rw-r--r--cmake/modules/FindPCRE.cmake170
-rw-r--r--cmake/modules/FindPipewire.cmake54
-rw-r--r--cmake/modules/FindPlist.cmake51
-rw-r--r--cmake/modules/FindPulseAudio.cmake68
-rw-r--r--cmake/modules/FindPython.cmake101
-rw-r--r--cmake/modules/FindRapidJSON.cmake67
-rw-r--r--cmake/modules/FindSSE.cmake195
-rw-r--r--cmake/modules/FindSdl.cmake29
-rw-r--r--cmake/modules/FindShairplay.cmake57
-rw-r--r--cmake/modules/FindSmbClient.cmake50
-rw-r--r--cmake/modules/FindSndio.cmake41
-rw-r--r--cmake/modules/FindSpdlog.cmake128
-rw-r--r--cmake/modules/FindSqlite3.cmake44
-rw-r--r--cmake/modules/FindTagLib.cmake92
-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/FindUdfread.cmake57
-rw-r--r--cmake/modules/FindVAAPI.cmake66
-rw-r--r--cmake/modules/FindVDPAU.cmake47
-rw-r--r--cmake/modules/FindWaylandProtocols.cmake24
-rw-r--r--cmake/modules/FindWaylandpp.cmake68
-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/FindXkbcommon.cmake40
-rw-r--r--cmake/modules/buildtools/FindCCache.cmake38
-rw-r--r--cmake/modules/buildtools/FindClangFormat.cmake19
-rw-r--r--cmake/modules/buildtools/FindClangTidy.cmake29
-rw-r--r--cmake/modules/buildtools/FindCppcheck.cmake32
-rw-r--r--cmake/modules/buildtools/FindFlatC.cmake99
-rw-r--r--cmake/modules/buildtools/FindGtest.cmake71
-rw-r--r--cmake/modules/buildtools/FindIncludeWhatYouUse.cmake26
-rw-r--r--cmake/modules/buildtools/FindJsonSchemaBuilder.cmake53
-rw-r--r--cmake/modules/buildtools/FindNASM.cmake30
-rw-r--r--cmake/modules/buildtools/FindPatch.cmake84
-rw-r--r--cmake/modules/buildtools/FindSWIG.cmake29
-rw-r--r--cmake/modules/buildtools/FindTexturePacker.cmake93
-rw-r--r--cmake/modules/buildtools/LDGOLD.cmake42
-rw-r--r--cmake/modules/buildtools/LLD.cmake22
-rw-r--r--cmake/modules/buildtools/MOLD.cmake77
-rw-r--r--cmake/modules/extra/ECMEnableSanitizers.cmake149
-rw-r--r--cmake/platform/android/android.cmake7
-rw-r--r--cmake/platform/android/defines.txt1
-rw-r--r--cmake/platform/darwin_embedded/defines.txt1
-rw-r--r--cmake/platform/darwin_embedded/ios.cmake1
-rw-r--r--cmake/platform/darwin_embedded/tvos.cmake2
-rw-r--r--cmake/platform/freebsd/defines.txt1
-rw-r--r--cmake/platform/freebsd/gbm.cmake2
-rw-r--r--cmake/platform/freebsd/wayland.cmake1
-rw-r--r--cmake/platform/freebsd/x11.cmake2
-rw-r--r--cmake/platform/linux/defines.txt1
-rw-r--r--cmake/platform/linux/gbm.cmake8
-rw-r--r--cmake/platform/linux/wayland.cmake14
-rw-r--r--cmake/platform/linux/x11.cmake9
-rw-r--r--cmake/platform/osx/defines.txt1
-rw-r--r--cmake/platform/osx/osx.cmake20
-rw-r--r--cmake/platform/windows/defines.txt1
-rw-r--r--cmake/platform/windows/windows.cmake2
-rw-r--r--cmake/platform/windowsstore/defines.txt1
-rw-r--r--cmake/platform/windowsstore/windowsstore.cmake2
-rw-r--r--cmake/scripts/android/ArchSetup.cmake45
-rw-r--r--cmake/scripts/android/Install.cmake174
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.cmake437
-rw-r--r--cmake/scripts/common/AddonHelpers.dox59
-rw-r--r--cmake/scripts/common/ArchSetup.cmake201
-rw-r--r--cmake/scripts/common/CMakeHelpers.cmake54
-rw-r--r--cmake/scripts/common/CheckCommits.cmake75
-rw-r--r--cmake/scripts/common/CheckTargetPlatform.cmake70
-rw-r--r--cmake/scripts/common/CompilerSettings.cmake5
-rw-r--r--cmake/scripts/common/DependencyOptions.cmake23
-rw-r--r--cmake/scripts/common/GenerateVersionedFiles.cmake35
-rw-r--r--cmake/scripts/common/GeneratorSetup.cmake49
-rw-r--r--cmake/scripts/common/HandleDepends.cmake301
-rw-r--r--cmake/scripts/common/Macros.cmake789
-rw-r--r--cmake/scripts/common/ModuleHelpers.cmake424
-rw-r--r--cmake/scripts/common/PathSetup.cmake13
-rw-r--r--cmake/scripts/common/Platform.cmake57
-rw-r--r--cmake/scripts/common/PrepareEnv.cmake107
-rw-r--r--cmake/scripts/common/ProjectMacros.cmake89
-rw-r--r--cmake/scripts/common/StaticAnalysis.cmake39
-rw-r--r--cmake/scripts/common/Uninstall.cmake58
-rw-r--r--cmake/scripts/darwin/Macros.cmake8
-rw-r--r--cmake/scripts/darwin_embedded/ArchSetup.cmake68
-rw-r--r--cmake/scripts/darwin_embedded/ExtraTargets.cmake32
-rw-r--r--cmake/scripts/darwin_embedded/Install.cmake130
-rw-r--r--cmake/scripts/darwin_embedded/Macros.cmake119
-rw-r--r--cmake/scripts/darwin_embedded/PathSetup.cmake7
-rw-r--r--cmake/scripts/freebsd/ArchSetup.cmake46
-rw-r--r--cmake/scripts/freebsd/ExtraTargets.cmake1
l---------cmake/scripts/freebsd/Install.cmake1
-rw-r--r--cmake/scripts/freebsd/Macros.cmake95
l---------cmake/scripts/freebsd/PathSetup.cmake1
-rw-r--r--cmake/scripts/linux/ArchSetup.cmake207
-rw-r--r--cmake/scripts/linux/CodeCoverage.cmake97
-rw-r--r--cmake/scripts/linux/ExtraTargets.cmake32
-rw-r--r--cmake/scripts/linux/Install.cmake329
-rw-r--r--cmake/scripts/linux/Linkers.txt4
-rw-r--r--cmake/scripts/linux/Macros.cmake95
-rw-r--r--cmake/scripts/linux/PathSetup.cmake40
-rw-r--r--cmake/scripts/osx/ArchSetup.cmake56
-rw-r--r--cmake/scripts/osx/ExtraTargets.cmake3
-rw-r--r--cmake/scripts/osx/Install.cmake73
-rw-r--r--cmake/scripts/osx/Macros.cmake119
-rw-r--r--cmake/scripts/osx/PathSetup.cmake32
-rw-r--r--cmake/scripts/windows/ArchSetup.cmake128
-rw-r--r--cmake/scripts/windows/CFlagOverrides.cmake10
-rw-r--r--cmake/scripts/windows/CXXFlagOverrides.cmake10
-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.cmake50
-rw-r--r--cmake/scripts/windowsstore/ArchSetup.cmake127
-rw-r--r--cmake/scripts/windowsstore/CFlagOverrides.cmake17
-rw-r--r--cmake/scripts/windowsstore/CXXFlagOverrides.cmake17
-rw-r--r--cmake/scripts/windowsstore/Install.cmake10
-rw-r--r--cmake/scripts/windowsstore/Macros.cmake182
-rw-r--r--cmake/scripts/windowsstore/PathSetup.cmake34
-rw-r--r--cmake/scripts/windowsstore/tools/patch.cmake50
-rw-r--r--cmake/treedata/android/subdirs.txt24
-rw-r--r--cmake/treedata/common/addon_dev_kit.txt26
-rw-r--r--cmake/treedata/common/addons.txt0
-rw-r--r--cmake/treedata/common/cores.txt8
-rw-r--r--cmake/treedata/common/events.txt2
-rw-r--r--cmake/treedata/common/externals.txt1
-rw-r--r--cmake/treedata/common/filesystem.txt3
-rw-r--r--cmake/treedata/common/games.txt19
-rw-r--r--cmake/treedata/common/gbm/gbm.txt3
-rw-r--r--cmake/treedata/common/interfaces.txt6
-rw-r--r--cmake/treedata/common/media.txt2
-rw-r--r--cmake/treedata/common/music.txt6
-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.txt13
-rw-r--r--cmake/treedata/common/retroplayer.txt17
-rw-r--r--cmake/treedata/common/settings.txt4
-rw-r--r--cmake/treedata/common/subdirs.txt46
-rw-r--r--cmake/treedata/common/tests.txt14
-rw-r--r--cmake/treedata/common/video.txt5
-rw-r--r--cmake/treedata/common/videoplayer.txt14
-rw-r--r--cmake/treedata/common/wayland/wayland.txt3
-rw-r--r--cmake/treedata/common/x11/X.txt3
-rw-r--r--cmake/treedata/darwin_embedded/ios/ios.txt3
-rw-r--r--cmake/treedata/darwin_embedded/subdirs.txt15
-rw-r--r--cmake/treedata/darwin_embedded/tvos/tvos.txt6
-rw-r--r--cmake/treedata/freebsd/subdirs.txt17
-rw-r--r--cmake/treedata/linux/subdirs.txt18
-rw-r--r--cmake/treedata/linux/tests.txt1
-rw-r--r--cmake/treedata/optional/common/avahi.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/mdns.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/python.txt4
-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.txt22
-rw-r--r--cmake/treedata/windows/externals.txt1
-rw-r--r--cmake/treedata/windows/subdirs.txt20
-rw-r--r--cmake/treedata/windowsstore/externals.txt1
-rw-r--r--cmake/treedata/windowsstore/subdirs.txt17
269 files changed, 16903 insertions, 0 deletions
diff --git a/cmake/KodiConfig.cmake.in b/cmake/KodiConfig.cmake.in
new file mode 100644
index 0000000..a06d889
--- /dev/null
+++ b/cmake/KodiConfig.cmake.in
@@ -0,0 +1,33 @@
+set(APP_NAME @APP_NAME@)
+set(APP_NAME_LC @APP_NAME_LC@)
+set(APP_NAME_UC @APP_NAME_UC@)
+set(APP_PACKAGE @APP_PACKAGE@)
+set(APP_VERSION_MAJOR @APP_VERSION_MAJOR@)
+set(APP_VERSION_MINOR @APP_VERSION_MINOR@)
+set(APP_VERSION_CODE @APP_VERSION_CODE@)
+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()
+set(APP_RENDER_SYSTEM @APP_RENDER_SYSTEM@)
+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)
+
+set(CORE_SYSTEM_NAME @CORE_SYSTEM_NAME@)
+set(PLATFORM @CORE_SYSTEM_NAME@)
+set(PLATFORM_TAG @PLATFORM_TAG@)
+set(CMAKE_CXX_STANDARD @CMAKE_CXX_STANDARD@)
+set(CMAKE_CXX_STANDARD_REQUIRED @CMAKE_CXX_STANDARD_REQUIRED@)
+set(CMAKE_CXX_EXTENSIONS @CMAKE_CXX_EXTENSIONS@)
+
+include(AddonHelpers)
diff --git a/cmake/README.md b/cmake/README.md
new file mode 100644
index 0000000..9fd5d1b
--- /dev/null
+++ b/cmake/README.md
@@ -0,0 +1,105 @@
+![Kodi Logo](../docs/resources/banner_slim.png)
+
+# Kodi's CMake Based Build System
+Welcome to Kodi's CMake Based Build System. CMake is a cross-platform tool for generating makefiles as well as project files used by IDEs. The current version of the build system is capable of building and packaging Kodi for the following platforms:
+
+* Linux (several distros)
+* Windows
+* macOS, iOS and tvOS
+* Android
+* FreeBSD
+
+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. Instructions are highly dependent on your operating system and target platform but we prepared a set of **[build guides](../docs/README.md)** for your convenience.
+
+## Build options
+Kodi supports a number of build options that can enable or disable functionality. 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. `OFF` will disable the feature.
+
+Example for forcefully enabling VAAPI and disabling VDPAU:
+```
+cmake ... -DENABLE_VAAPI=ON -DENABLE_VDPAU=OFF ...
+```
+
+Unfortunately, Kodi's CMake gazillion options are not fully documented yet. For more information and an updated list of options, please check the main **[CMakeLists.txt](../CMakeLists.txt)**.
+
+## 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 (see READMEs in sub-directories for additional variables):
+- `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
+- `ARCH_DEFINES` specifies the platform-specific C/C++ preprocessor defines (defaults to empty)
+
+## Building
+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 \
+ -DARCH_DEFINES="-DTARGET_LINUX" \
+ -DCMAKE_INSTALL_PREFIX="`<path-to-install-directory`"
+
+## 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 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
+Kodi's CMake build system integrates with the add-on build system if the GNU Makefile generator is used. This offers an easy way to build add-ons for packagers or Kodi developers who don't work on add-ons.
+
+Build all add-ons:
+```
+make binary-addons
+```
+
+Build specific add-ons:
+```
+make binary-addons ADDONS="visualization.spectrum pvr.demo"
+```
+
+Add-on developers can build single add-ons into the Kodi build directory so that the add-on 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 (the current working directory).
+
+Both methods work only for already existing add-ons. See this **[forum thread](https://forum.kodi.tv/showthread.php?tid=219166&pid=1934922)** and add-ons **[README](cmake/addons/README.md)**
+for add-on development and detailed documentation about the add-on 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 module **[documentation](modules/extra/ECMEnableSanitizers.cmake)**.
+
+It is also recommended to read the sections about sanitizers in the [Clang documentation](http://clang.llvm.org/docs/).
+
+## Debugging the build
+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 0000000..c1313d7
--- /dev/null
+++ b/cmake/addons/CMakeLists.txt
@@ -0,0 +1,518 @@
+cmake_minimum_required(VERSION 3.5)
+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}/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})
+
+if (CMAKE_SYSTEM_NAME STREQUAL WindowsStore)
+ set(BUILD_ARGS_ext -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
+ -DCMAKE_SYSTEM_VERSION=${CMAKE_SYSTEM_VERSION})
+endif()
+
+include(${CORE_SOURCE_DIR}/cmake/scripts/common/CompilerSettings.cmake)
+
+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}
+ ${BUILD_ARGS_ext})
+
+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()
+
+# used for addons where need special folders to store there content (if
+# not set the addon define it byself).
+# e.g. Google Chromium addon where his git bring:
+# - "unable to create file" ... "Filename too long"
+# see also WARNING by Windows on: https://bitbucket.org/chromiumembedded/cef/wiki/MasterBuildQuickStart
+if(THIRD_PARTY_PATH)
+ message(STATUS "Third party lib path specified")
+ message(STATUS ${THIRD_PARTY_PATH})
+ list(APPEND BUILD_ARGS -DTHIRD_PARTY_PATH=${THIRD_PARTY_PATH})
+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}/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}/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)
+
+if(NOT ADDONS_TO_BUILD)
+ set(ADDONS_TO_BUILD "all")
+endif()
+
+if(NOT ADDONS_TO_BUILD STREQUAL "all")
+ # Exact addon match list
+ set(REGEX_ADDONS_TO_BUILD ${ADDONS_TO_BUILD})
+ set(EXACT_MATCH_ADDON_LIST "")
+ set(EXCLUDE_ADDONS "")
+
+ foreach(addon ${ADDONS_TO_BUILD})
+ set(FOUND_EXCLUSION "")
+ string(REGEX MATCH "^[-](.*)" FOUND_EXCLUSION "${addon}")
+ if(NOT FOUND_EXCLUSION STREQUAL "")
+ list(APPEND EXCLUDE_ADDONS ${CMAKE_MATCH_1})
+ list(REMOVE_ITEM REGEX_ADDONS_TO_BUILD "-${CMAKE_MATCH_1}")
+ else()
+ foreach(addonrepoitem ${addons})
+ if(NOT (addonrepoitem MATCHES platforms.txt))
+ # need to strip regex chars, or the filter regex will use
+ string(REPLACE "*" "" strippedregex ${addon})
+ if(${addonrepoitem} MATCHES "^.*\/(${strippedregex}).txt")
+ list(APPEND EXACT_MATCH_ADDON_LIST ${addon})
+ # remove exact matches from addons_to_build
+ list(REMOVE_ITEM REGEX_ADDONS_TO_BUILD "${addon}")
+ endif()
+ endif()
+ endforeach()
+ endif()
+ endforeach()
+
+ message(STATUS "Exclusion list: ${EXCLUDE_ADDONS}")
+ message(STATUS "Exact Match list: ${EXACT_MATCH_ADDON_LIST}")
+ message(STATUS "Regex list: ${REGEX_ADDONS_TO_BUILD}")
+endif()
+
+foreach(addon ${addons})
+ if(NOT (addon MATCHES platforms.txt))
+ file(STRINGS ${addon} def)
+ string(REPLACE " " ";" def ${def})
+ list(GET def 0 id)
+
+ if("${ADDONS_TO_BUILD}" STREQUAL "all")
+ set(ADDON_FOUND TRUE)
+ else()
+ set(ADDON_EXCLUDE FALSE)
+ set(ADDON_FOUND FALSE)
+ foreach(exclusion ${EXCLUDE_ADDONS})
+ if(id MATCHES "${exclusion}")
+ set(ADDON_EXCLUDE TRUE)
+ message(STATUS "Addon ${id} matches exclusion rule -${exclusion}")
+ break()
+ endif()
+ endforeach()
+
+ if(ADDON_EXCLUDE)
+ continue()
+ endif()
+
+ list(FIND EXACT_MATCH_ADDON_LIST ${id} idx)
+ if(idx GREATER -1)
+ # exact match, so build
+ message(STATUS "Exact match ${id}, building addon")
+ set(ADDON_FOUND TRUE)
+ else()
+ # regex search
+ foreach(ADDONLISTITEM ${REGEX_ADDONS_TO_BUILD})
+ if(id MATCHES "${ADDONLISTITEM}")
+ message(STATUS "Pattern ${ADDONLISTITEM} matches ${id}, building addon")
+ set(ADDON_FOUND TRUE)
+ break()
+ endif()
+ endforeach()
+ endif()
+ 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)
+ file(REMOVE ${BUILD_DIR}/download/${archive_name}.tar.gz)
+ message(STATUS "ERROR downloading ${url} - status: ${dlstatus} log: ${dllog}")
+ # add a dummy target for addons to get it in addons failure file
+ list(APPEND ALL_ADDONS_BUILDING ${id})
+ add_custom_target(${id} COMMAND ${CMAKE_COMMAND} -E echo "IGNORED ${id} - download failed" COMMAND exit 1)
+ continue()
+ 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)
+
+ set(${id}_DEPENDS_DIR ${SOURCE_DIR}/depends)
+
+ if(EXISTS ${${id}_DEPENDS_DIR})
+ include(${CORE_SOURCE_DIR}/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
+ get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+ if(_isMultiConfig)
+ set(config --config $<CONFIG>)
+ endif()
+ add_custom_target(package-${id}
+ COMMAND ${CMAKE_COMMAND} --build ${id}-prefix/src/${id}-build ${config} --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 0000000..ed1894e
--- /dev/null
+++ b/cmake/addons/README.md
@@ -0,0 +1,49 @@
+![Kodi logo](https://github.com/xbmc/xbmc/raw/master/docs/resources/banner_slim.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 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 addon-related 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 four rules for matching a provided space delimited list:
+ - to build all addons, just use `all` (default is *all*)
+ - an exact match of an `<addon-id>` that you want to build (e.g. `ADDONS_TO_BUILD="game.libretro"`)
+ - a regular expression `<addon-id>` is matched against (e.g. `ADDONS_TO_BUILD="pvr.*"`) to build all pvr add-ons
+ - a regular expression exclusion can be made using `-<addon-id regex>` (e.g. `ADDONS_TO_BUILD="pvr.* -pvr.dvb"`) to exclude pvr.dvblink and pvr.dvbviewer, but build all other 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_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>`)
+- `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`)
+- `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)
diff --git a/cmake/addons/bootstrap/Bootstrap.cmake b/cmake/addons/bootstrap/Bootstrap.cmake
new file mode 100644
index 0000000..5d20302
--- /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 0000000..66b7e3d
--- /dev/null
+++ b/cmake/addons/bootstrap/CMakeLists.txt
@@ -0,0 +1,93 @@
+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}
+ -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 0000000..52ded74
--- /dev/null
+++ b/cmake/addons/bootstrap/README.md
@@ -0,0 +1,49 @@
+![Kodi logo](https://github.com/xbmc/xbmc/raw/master/docs/resources/banner_slim.png)
+# 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 0000000..d286ad7
--- /dev/null
+++ b/cmake/addons/bootstrap/repositories/binary-addons.txt
@@ -0,0 +1 @@
+binary-addons https://github.com/xbmc/repo-binary-addons.git Nexus
diff --git a/cmake/addons/depends/CMakeLists.txt b/cmake/addons/depends/CMakeLists.txt
new file mode 100644
index 0000000..831e0ed
--- /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}/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 0000000..76df284
--- /dev/null
+++ b/cmake/addons/depends/README
@@ -0,0 +1,35 @@
+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
+ * flags-<CPU>.txt: additional arch specific platform build flags
+ * deps.txt: whitespace separated list of dependencies of this dependency
+
+The buildsystem uses the following depends-related variables (which can be passed
+into it when executing cmake with the -D<variable-name>=<value> option) to e.g.
+access specific paths:
+ * DEPENDS_TO_BUILD is a quoted, space delimited list of <dependency>s that
+ you want to build (default is "all").
+ * ADDON_EXTRA_ARGS is a quoted, space delimited list of arguments passed to
+ all <dependency>s built (eg -DADDON_EXTRA_ARGS="-Darg1=1 -Darg2=2").
diff --git a/cmake/addons/depends/windows/CMakeLists.txt b/cmake/addons/depends/windows/CMakeLists.txt
new file mode 100644
index 0000000..c8739c0
--- /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 0000000..9a3adbb
--- /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 0000000..67dc594
--- /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/prebuilt/README b/cmake/addons/depends/windows/prebuilt/README
new file mode 100644
index 0000000..a0c70d6
--- /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 0000000..9aa687d
--- /dev/null
+++ b/cmake/cpack/CPackConfigDEB.cmake
@@ -0,0 +1,349 @@
+# include Macros.cmake to automate generation of time/date stamps, maintainer, etc.
+include(${CMAKE_SOURCE_DIR}/cmake/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})
+
+# 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 ${CMAKE_SOURCE_DIR}/cmake/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 ${CMAKE_SOURCE_DIR}/.git)
+ execute_process(COMMAND ${GIT_EXECUTABLE} log --no-merges --pretty=format:"%n [%an]%n * %s" --since="30 days ago"
+ OUTPUT_VARIABLE CHANGELOG
+ WORKING_DIRECTORY ${CMAKE_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(${CMAKE_SOURCE_DIR}/cmake/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(${CMAKE_SOURCE_DIR}/docs/manpages/kodi.bin.1
+ ${CPACK_PACKAGE_DIRECTORY}/deb/kodi.1 COPYONLY)
+configure_file(${CMAKE_SOURCE_DIR}/docs/manpages/kodi.bin.1
+ ${CPACK_PACKAGE_DIRECTORY}/deb/kodi.bin.1 COPYONLY)
+configure_file(${CMAKE_SOURCE_DIR}/docs/manpages/kodi-standalone.1
+ ${CPACK_PACKAGE_DIRECTORY}/deb/kodi-standalone.1 COPYONLY)
+if(ENABLE_EVENTCLIENTS)
+ configure_file(${CMAKE_SOURCE_DIR}/docs/manpages/kodi-ps3remote.1
+ ${CPACK_PACKAGE_DIRECTORY}/deb/kodi-ps3remote.1 COPYONLY)
+ configure_file(${CMAKE_SOURCE_DIR}/docs/manpages/kodi-send.1
+ ${CPACK_PACKAGE_DIRECTORY}/deb/kodi-send.1 COPYONLY)
+ configure_file(${CMAKE_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-kodi-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 ${CMAKE_SOURCE_DIR}/cmake/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)
+ endif()
+
+ if(DEB_PACKAGE_DEPENDS)
+ set(CPACK_DEBIAN_${COMPONENT}_PACKAGE_DEPENDS "${DEB_PACKAGE_DEPENDS}")
+ 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
+ ${CMAKE_SOURCE_DIR}/cmake/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
+ "${CMAKE_SOURCE_DIR}/cmake/cpack/deb/postinst;${CMAKE_SOURCE_DIR}/cmake/cpack/deb/postrm")
+ install(FILES ${CMAKE_SOURCE_DIR}/cmake/cpack/deb/lintian/overrides/kodi
+ DESTINATION share/lintian/overrides
+ COMPONENT kodi)
+ install(FILES ${CMAKE_SOURCE_DIR}/cmake/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}-${RELEASE_IDENTIFIER}.orig)
+unset(RELEASE_IDENTIFIER)
+
+# 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 0000000..034774b
--- /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 0000000..3a3916c
--- /dev/null
+++ b/cmake/cpack/deb/copyright
@@ -0,0 +1,3047 @@
+Kodi is downloaded from http://kodi.tv/.
+Orig tarballs are generated from the script located at
+https://github.com/xbmc/xbmc/. The orig tarball is
+generated using the sources in https://github.com/xbmc/xbmc/.
+
+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/>.
+
+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/>.
+
+dav1d - AV1 cross-platform decoder
+<https://code.videolan.org/videolan/dav1d>
+
+ Copyright © 2018-2019, VideoLAN and dav1d authors
+ 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 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.
+
+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: Alliance for Open Media Patent License 1.0
+
+1. License Terms.
+
+1.1. Patent License. Subject to the terms and conditions of this License, each
+ Licensor, on behalf of itself and successors in interest and assigns,
+ grants Licensee a non-sublicensable, perpetual, worldwide, non-exclusive,
+ no-charge, royalty-free, irrevocable (except as expressly stated in this
+ License) patent license to its Necessary Claims to make, use, sell, offer
+ for sale, import or distribute any Implementation.
+
+1.2. Conditions.
+
+1.2.1. Availability. As a condition to the grant of rights to Licensee to make,
+ sell, offer for sale, import or distribute an Implementation under
+ Section 1.1, Licensee must make its Necessary Claims available under
+ this License, and must reproduce this License with any Implementation
+ as follows:
+
+ a. For distribution in source code, by including this License in the
+ root directory of the source code with its Implementation.
+
+ b. For distribution in any other form (including binary, object form,
+ and/or hardware description code (e.g., HDL, RTL, Gate Level Netlist,
+ GDSII, etc.)), by including this License in the documentation, legal
+ notices, and/or other written materials provided with the
+ Implementation.
+
+1.2.2. Additional Conditions. This license is directly from Licensor to
+ Licensee. Licensee acknowledges as a condition of benefiting from it
+ that no rights from Licensor are received from suppliers, distributors,
+ or otherwise in connection with this License.
+
+1.3. Defensive Termination. If any Licensee, its Affiliates, or its agents
+ initiates patent litigation or files, maintains, or voluntarily
+ participates in a lawsuit against another entity or any person asserting
+ that any Implementation infringes Necessary Claims, any patent licenses
+ granted under this License directly to the Licensee are immediately
+ terminated as of the date of the initiation of action unless 1) that suit
+ was in response to a corresponding suit regarding an Implementation first
+ brought against an initiating entity, or 2) that suit was brought to
+ enforce the terms of this License (including intervention in a third-party
+ action by a Licensee).
+
+1.4. Disclaimers. The Reference Implementation and Specification are provided
+ "AS IS" and without warranty. The entire risk as to implementing or
+ otherwise using the Reference Implementation or Specification is assumed
+ by the implementer and user. Licensor expressly disclaims any warranties
+ (express, implied, or otherwise), including implied warranties of
+ merchantability, non-infringement, fitness for a particular purpose, or
+ title, related to the material. IN NO EVENT WILL LICENSOR BE LIABLE TO
+ ANY OTHER PARTY FOR LOST PROFITS OR ANY FORM OF INDIRECT, SPECIAL,
+ INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER FROM ANY CAUSES OF
+ ACTION OF ANY KIND WITH RESPECT TO THIS LICENSE, WHETHER BASED ON BREACH
+ OF CONTRACT, TORT (INCLUDING NEGLIGENCE), OR OTHERWISE, AND WHETHER OR
+ NOT THE OTHER PARTRY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+2. Definitions.
+
+2.1. Affiliate. “Affiliate” means an entity that directly or indirectly
+ Controls, is Controlled by, or is under common Control of that party.
+
+2.2. Control. “Control” means direct or indirect control of more than 50% of
+ the voting power to elect directors of that corporation, or for any other
+ entity, the power to direct management of such entity.
+
+2.3. Decoder. "Decoder" means any decoder that conforms fully with all
+ non-optional portions of the Specification.
+
+2.4. Encoder. "Encoder" means any encoder that produces a bitstream that can
+ be decoded by a Decoder only to the extent it produces such a bitstream.
+
+2.5. Final Deliverable. “Final Deliverable” means the final version of a
+ deliverable approved by the Alliance for Open Media as a Final
+ Deliverable.
+
+2.6. Implementation. "Implementation" means any implementation, including the
+ Reference Implementation, that is an Encoder and/or a Decoder. An
+ Implementation also includes components of an Implementation only to the
+ extent they are used as part of an Implementation.
+
+2.7. License. “License” means this license.
+
+2.8. Licensee. “Licensee” means any person or entity who exercises patent
+ rights granted under this License.
+
+2.9. Licensor. "Licensor" means (i) any Licensee that makes, sells, offers
+ for sale, imports or distributes any Implementation, or (ii) a person
+ or entity that has a licensing obligation to the Implementation as a
+ result of its membership and/or participation in the Alliance for Open
+ Media working group that developed the Specification.
+
+2.10. Necessary Claims. "Necessary Claims" means all claims of patents or
+ patent applications, (a) that currently or at any time in the future,
+ are owned or controlled by the Licensor, and (b) (i) would be an
+ Essential Claim as defined by the W3C Policy as of February 5, 2004
+ (https://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential)
+ as if the Specification was a W3C Recommendation; or (ii) are infringed
+ by the Reference Implementation.
+
+2.11. Reference Implementation. “Reference Implementation” means an Encoder
+ and/or Decoder released by the Alliance for Open Media as a Final
+ Deliverable.
+
+2.12. Specification. “Specification” means the specification designated by
+ the Alliance for Open Media as a Final Deliverable for which this
+ License was issued.
+
+-- End of Alliance for Open Media Patent License 1.0 License -- \ No newline at end of file
diff --git a/cmake/cpack/deb/lintian/overrides/kodi b/cmake/cpack/deb/lintian/overrides/kodi
new file mode 100644
index 0000000..d9536c4
--- /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 0000000..0c221a4
--- /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 0000000..961e1c8
--- /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 0000000..8c81d09
--- /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 use dpkg-shlibdeps to
+# automatically generate the package dependency list and append its output to
+# PACKAGE_DEPENDS 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
+PACKAGE_SUGGESTS
+PACKAGE_BREAKS
+PACKAGE_REPLACES @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_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-bin.txt.in b/cmake/cpack/deb/packages/kodi-bin.txt.in
new file mode 100644
index 0000000..0e31451
--- /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 use dpkg-shlibdeps to
+# automatically generate the package dependency list and append its output to
+# PACKAGE_DEPENDS 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 ON
+PACKAGE_DEPENDS
+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 0000000..7e61d8c
--- /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 use dpkg-shlibdeps to
+# automatically generate the package dependency list and append its output to
+# PACKAGE_DEPENDS 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 0000000..1a69904
--- /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 use dpkg-shlibdeps to
+# automatically generate the package dependency list and append its output to
+# PACKAGE_DEPENDS 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-kodi-send.txt.in b/cmake/cpack/deb/packages/kodi-eventclients-kodi-send.txt.in
new file mode 100644
index 0000000..b5292de
--- /dev/null
+++ b/cmake/cpack/deb/packages/kodi-eventclients-kodi-send.txt.in
@@ -0,0 +1,25 @@
+# kodi-eventclients-kodi-send debian package metadata
+#
+# Setting PACKAGE_SHLIBDEPS to 'ON' will cause CPack to use dpkg-shlibdeps to
+# automatically generate the package dependency list and append its output to
+# PACKAGE_DEPENDS 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-kodi-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 kodi-eventclients-xbmc-send
+PACKAGE_REPLACES kodi-eventclients-xbmc-send
+PACKAGE_PROVIDES kodi-eventclients-kodi-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-eventclients-ps3.txt.in b/cmake/cpack/deb/packages/kodi-eventclients-ps3.txt.in
new file mode 100644
index 0000000..4456e0e
--- /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 use dpkg-shlibdeps to
+# automatically generate the package dependency list and append its output to
+# PACKAGE_DEPENDS 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 0000000..3dbfadf
--- /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 use dpkg-shlibdeps to
+# automatically generate the package dependency list and append its output to
+# PACKAGE_DEPENDS 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 ON
+PACKAGE_DEPENDS @APP_NAME_LC@-eventclients-common (= @CPACK_DEBIAN_PACKAGE_VERSION@)
+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-tools-texturepacker.txt.in b/cmake/cpack/deb/packages/kodi-tools-texturepacker.txt.in
new file mode 100644
index 0000000..79c1f0f
--- /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 use dpkg-shlibdeps to
+# automatically generate the package dependency list and append its output to
+# PACKAGE_DEPENDS 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 ON
+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.txt.in b/cmake/cpack/deb/packages/kodi.txt.in
new file mode 100644
index 0000000..6cce5fd
--- /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 use dpkg-shlibdeps to
+# automatically generate the package dependency list and append its output to
+# PACKAGE_DEPENDS 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, libcurl4 | libcurl3, mesa-utils, x11-utils, fonts-liberation | ttf-liberation, fonts-dejavu-core | ttf-dejavu-core, python3-pil, python3-simplejson, libass9 | libass5 | libass4, libgif5 | libgif7, libnfs8 | libnfs4 | libnfs1, libbluray1 | libbluray2, libshairplay0, libvorbisfile3, libaacs0, libcec6 | libcec4, libgnutls30 | libgnutls-deb0-28 | libgnutls28 | libgnutls26, libxslt1.1
+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 0000000..318d280
--- /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 0000000..adc11fd
--- /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 0000000..263e57b
--- /dev/null
+++ b/cmake/installdata/common/addons.txt
@@ -0,0 +1,45 @@
+addons/audioencoder.kodi.builtin.aac/*
+addons/audioencoder.kodi.builtin.wma/*
+addons/game.controller.default/*
+addons/game.controller.keyboard/*
+addons/game.controller.mouse/*
+addons/game.controller.snes/*
+addons/kodi.audiodecoder/*
+addons/kodi.game/*
+addons/kodi.imagedecoder/*
+addons/kodi.inputstream/*
+addons/kodi.peripheral/*
+addons/kodi.resource/*
+addons/kodi.vfs/*
+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.musicbrainz.org/*
+addons/metadata.common.theaudiodb.com/*
+addons/metadata.generic.albums/*
+addons/metadata.generic.artists/*
+addons/metadata.local/*
+addons/metadata.themoviedb.org.python/*
+addons/metadata.tvshows.themoviedb.org.python/*
+addons/repository.xbmc.org/*
+addons/resource.images.weathericons.default/*
+addons/resource.language.en_gb/*
+addons/resource.uisounds.kodi/*
+addons/screensaver.xbmc.builtin.black/*
+addons/screensaver.xbmc.builtin.dim/*
+addons/script.module.pil/*
+addons/script.module.pycryptodome/*
+addons/service.xbmc.versioncheck/*
+addons/webinterface.default/*
+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/*
diff --git a/cmake/installdata/common/certificates.txt b/cmake/installdata/common/certificates.txt
new file mode 100644
index 0000000..e802c04
--- /dev/null
+++ b/cmake/installdata/common/certificates.txt
@@ -0,0 +1 @@
+system/certs/*
diff --git a/cmake/installdata/common/common.txt b/cmake/installdata/common/common.txt
new file mode 100644
index 0000000..a3853b4
--- /dev/null
+++ b/cmake/installdata/common/common.txt
@@ -0,0 +1,13 @@
+media/*
+sounds/*
+system/addon-manifest.xml
+system/colors.xml
+system/dialogcolors.xml
+system/keyboardlayouts/*
+system/keymaps/*
+system/library/*
+system/peripherals.xml
+system/playercorefactory.xml
+system/settings/*
+system/shaders/*
+userdata/*
diff --git a/cmake/installdata/darwin_embedded/fontconfig.txt b/cmake/installdata/darwin_embedded/fontconfig.txt
new file mode 100644
index 0000000..1f1bd9d
--- /dev/null
+++ b/cmake/installdata/darwin_embedded/fontconfig.txt
@@ -0,0 +1 @@
+system/players/VideoPlayer/etc/*
diff --git a/cmake/installdata/darwin_embedded/packaging.txt b/cmake/installdata/darwin_embedded/packaging.txt
new file mode 100644
index 0000000..3d5ae4a
--- /dev/null
+++ b/cmake/installdata/darwin_embedded/packaging.txt
@@ -0,0 +1,3 @@
+LICENSE.md
+privacy-policy.txt
+xbmc/platform/darwin/Credits.html
diff --git a/cmake/installdata/darwin_embedded/runtime.txt b/cmake/installdata/darwin_embedded/runtime.txt
new file mode 100644
index 0000000..92595bd
--- /dev/null
+++ b/cmake/installdata/darwin_embedded/runtime.txt
@@ -0,0 +1,2 @@
+tools/darwin/runtime/org.xbmc.helper.plist
+tools/darwin/runtime/preflight
diff --git a/cmake/installdata/linux/lirc.txt b/cmake/installdata/linux/lirc.txt
new file mode 100644
index 0000000..1b48478
--- /dev/null
+++ b/cmake/installdata/linux/lirc.txt
@@ -0,0 +1 @@
+system/Lircmap.xml
diff --git a/cmake/installdata/osx/packaging.txt b/cmake/installdata/osx/packaging.txt
new file mode 100644
index 0000000..d0ba0b7
--- /dev/null
+++ b/cmake/installdata/osx/packaging.txt
@@ -0,0 +1,4 @@
+LICENSE.md
+privacy-policy.txt
+tools/darwin/packaging/media/osx/icon.iconset/*
+xbmc/platform/darwin/Credits.html
diff --git a/cmake/installdata/osx/runtime.txt b/cmake/installdata/osx/runtime.txt
new file mode 100644
index 0000000..92595bd
--- /dev/null
+++ b/cmake/installdata/osx/runtime.txt
@@ -0,0 +1,2 @@
+tools/darwin/runtime/org.xbmc.helper.plist
+tools/darwin/runtime/preflight
diff --git a/cmake/installdata/test-reference-data.txt b/cmake/installdata/test-reference-data.txt
new file mode 100644
index 0000000..df8e88e
--- /dev/null
+++ b/cmake/installdata/test-reference-data.txt
@@ -0,0 +1,36 @@
+xbmc/cores/VideoPlayer/test/edl/testdata/comskipversion1.txt
+xbmc/cores/VideoPlayer/test/edl/testdata/comskipversion2.txt
+xbmc/cores/VideoPlayer/test/edl/testdata/edlautowindautowait.edl
+xbmc/cores/VideoPlayer/test/edl/testdata/mplayerframebased.edl
+xbmc/cores/VideoPlayer/test/edl/testdata/mplayertimebased.edl
+xbmc/cores/VideoPlayer/test/edl/testdata/mplayertimebasedinterleavedcuts.edl
+xbmc/cores/VideoPlayer/test/edl/testdata/mplayertimebasedmixed.edl
+xbmc/cores/VideoPlayer/test/edl/testdata/snapstream.mkv.chapters.xml
+xbmc/cores/VideoPlayer/test/edl/testdata/videoredo.Vprj
+xbmc/filesystem/test/data/httpdirectory/apache-default.html
+xbmc/filesystem/test/data/httpdirectory/apache-fancy.html
+xbmc/filesystem/test/data/httpdirectory/apache-html.html
+xbmc/filesystem/test/data/httpdirectory/basic-multiline.html
+xbmc/filesystem/test/data/httpdirectory/basic.html
+xbmc/filesystem/test/data/httpdirectory/lighttp-default.html
+xbmc/filesystem/test/data/httpdirectory/nginx-default.html
+xbmc/filesystem/test/data/httpdirectory/nginx-fancyindex.html
+xbmc/filesystem/test/extendedlocalheader.zip
+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-ranges.txt
+xbmc/network/test/data/test.html
+xbmc/network/test/data/test.png
+xbmc/playlists/test/test.xspf
+xbmc/video/test/testdata/moviestack_ab/Movie-(2001)/Movie-(2001)A.mp4
+xbmc/video/test/testdata/moviestack_ab/Movie-(2001)/Movie-(2001)B.mp4
+xbmc/video/test/testdata/moviestack_part/Movie_(2001)/Movie_(2001)_part1.mkv
+xbmc/video/test/testdata/moviestack_part/Movie_(2001)/Movie_(2001)_part2.mkv
+xbmc/video/test/testdata/moviestack_part/Movie_(2001)/Movie_(2001)_part3.mkv
+xbmc/video/test/testdata/moviestack_dvdiso/Movie_(2001)/Movie_(2001)_dvd1.iso
+xbmc/video/test/testdata/moviestack_dvdiso/Movie_(2001)/Movie_(2001)_dvd2.iso
+xbmc/utils/test/CXBMCTinyXML-test.xml
+xbmc/utils/test/data/language/Spanish/strings.po
diff --git a/cmake/installdata/windows/addons.txt b/cmake/installdata/windows/addons.txt
new file mode 100644
index 0000000..66b583a
--- /dev/null
+++ b/cmake/installdata/windows/addons.txt
@@ -0,0 +1,2 @@
+project/BuildDependencies/${ARCH}/addons/script.module.pil KEEP_DIR_STRUCTURE addons
+project/BuildDependencies/${ARCH}/addons/script.module.pycryptodome KEEP_DIR_STRUCTURE addons
diff --git a/cmake/installdata/windows/dlls.txt b/cmake/installdata/windows/dlls.txt
new file mode 100644
index 0000000..8cb5665
--- /dev/null
+++ b/cmake/installdata/windows/dlls.txt
@@ -0,0 +1,2 @@
+project/BuildDependencies/${ARCH}/bin/*.dll .
+project/BuildDependencies/${ARCH}/bin/libbluray*.jar .
diff --git a/cmake/installdata/windows/irss.txt b/cmake/installdata/windows/irss.txt
new file mode 100644
index 0000000..6fd8d48
--- /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 0000000..5606628
--- /dev/null
+++ b/cmake/installdata/windows/python.txt
@@ -0,0 +1 @@
+project/BuildDependencies/${ARCH}/bin/Python KEEP_DIR_STRUCTURE system
diff --git a/cmake/installdata/windowsstore/addons.txt b/cmake/installdata/windowsstore/addons.txt
new file mode 100644
index 0000000..3b4d9a9
--- /dev/null
+++ b/cmake/installdata/windowsstore/addons.txt
@@ -0,0 +1,2 @@
+project/BuildDependencies/win10-${ARCH}/addons/*
+system/addon-manifest-uwp.xml
diff --git a/cmake/installdata/windowsstore/dlls.txt b/cmake/installdata/windowsstore/dlls.txt
new file mode 100644
index 0000000..8b45449
--- /dev/null
+++ b/cmake/installdata/windowsstore/dlls.txt
@@ -0,0 +1 @@
+project/BuildDependencies/win10-${ARCH}/bin/*.dll dlls
diff --git a/cmake/installdata/windowsstore/irss.txt b/cmake/installdata/windowsstore/irss.txt
new file mode 100644
index 0000000..6fd8d48
--- /dev/null
+++ b/cmake/installdata/windowsstore/irss.txt
@@ -0,0 +1,2 @@
+system/IRSSmap.xml
+system/X10-Lola-IRSSmap.xml
diff --git a/cmake/installdata/windowsstore/python.txt b/cmake/installdata/windowsstore/python.txt
new file mode 100644
index 0000000..db57ebc
--- /dev/null
+++ b/cmake/installdata/windowsstore/python.txt
@@ -0,0 +1 @@
+project/BuildDependencies/win10-${ARCH}/bin/Python KEEP_DIR_STRUCTURE system \ No newline at end of file
diff --git a/cmake/messages/flatbuffers/retroplayer.txt b/cmake/messages/flatbuffers/retroplayer.txt
new file mode 100644
index 0000000..3d42d5c
--- /dev/null
+++ b/cmake/messages/flatbuffers/retroplayer.txt
@@ -0,0 +1 @@
+xbmc/cores/RetroPlayer/messages cores/RetroPlayer/messages
diff --git a/cmake/modules/FindASS.cmake b/cmake/modules/FindASS.cmake
new file mode 100644
index 0000000..cb9d732
--- /dev/null
+++ b/cmake/modules/FindASS.cmake
@@ -0,0 +1,44 @@
+#.rst:
+# FindASS
+# -------
+# Finds the ASS library
+#
+# This 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 0000000..fdc7db8
--- /dev/null
+++ b/cmake/modules/FindAlsa.cmake
@@ -0,0 +1,46 @@
+#.rst:
+# FindAlsa
+# --------
+# Finds the Alsa library
+#
+# This 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>=1.0.27 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 -DHAS_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/FindAtomic.cmake b/cmake/modules/FindAtomic.cmake
new file mode 100644
index 0000000..8ea3c81
--- /dev/null
+++ b/cmake/modules/FindAtomic.cmake
@@ -0,0 +1,56 @@
+#.rst:
+# FindAtomic
+# -----
+# Finds the ATOMIC library
+#
+# This will define the following variables::
+#
+# ATOMIC_FOUND - system has ATOMIC
+# ATOMIC_LIBRARIES - the ATOMIC libraries
+#
+# and the following imported targets::
+#
+# ATOMIC::ATOMIC - The ATOMIC library
+
+
+include(CheckCXXSourceCompiles)
+
+set(atomic_code
+ "
+ #include <atomic>
+ #include <cstdint>
+ std::atomic<uint8_t> n8 (0); // riscv64
+ std::atomic<uint64_t> n64 (0); // armel, mipsel, powerpc
+ int main() {
+ ++n8;
+ ++n64;
+ return 0;
+ }")
+
+check_cxx_source_compiles("${atomic_code}" ATOMIC_LOCK_FREE_INSTRUCTIONS)
+
+if(ATOMIC_LOCK_FREE_INSTRUCTIONS)
+ set(ATOMIC_FOUND TRUE)
+ set(ATOMIC_LIBRARIES)
+else()
+ set(CMAKE_REQUIRED_LIBRARIES "-latomic")
+ check_cxx_source_compiles("${atomic_code}" ATOMIC_IN_LIBRARY)
+ set(CMAKE_REQUIRED_LIBRARIES)
+ if(ATOMIC_IN_LIBRARY)
+ set(ATOMIC_LIBRARY atomic)
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(Atomic DEFAULT_MSG ATOMIC_LIBRARY)
+ set(ATOMIC_LIBRARIES ${ATOMIC_LIBRARY})
+ if(NOT TARGET ATOMIC::ATOMIC)
+ add_library(ATOMIC::ATOMIC UNKNOWN IMPORTED)
+ set_target_properties(ATOMIC::ATOMIC PROPERTIES
+ IMPORTED_LOCATION "${ATOMIC_LIBRARY}")
+ endif()
+ unset(ATOMIC_LIBRARY)
+ else()
+ if(Atomic_FIND_REQUIRED)
+ message(FATAL_ERROR "Neither lock free instructions nor -latomic found.")
+ endif()
+ endif()
+endif()
+unset(atomic_code)
diff --git a/cmake/modules/FindAvahi.cmake b/cmake/modules/FindAvahi.cmake
new file mode 100644
index 0000000..e0e6689
--- /dev/null
+++ b/cmake/modules/FindAvahi.cmake
@@ -0,0 +1,63 @@
+#.rst:
+# FindAvahi
+# ---------
+# Finds the avahi library
+#
+# This 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 -DHAS_AVAHI=1 -DHAS_ZEROCONF=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 HAS_AVAHI=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 HAS_AVAHI=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 0000000..7ca99bb
--- /dev/null
+++ b/cmake/modules/FindBluetooth.cmake
@@ -0,0 +1,44 @@
+#.rst:
+# FindBluetooth
+# ---------
+# Finds the Bluetooth library
+#
+# This 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 0000000..34bc50e
--- /dev/null
+++ b/cmake/modules/FindBluray.cmake
@@ -0,0 +1,67 @@
+#.rst:
+# FindBluray
+# ----------
+# Finds the libbluray library
+#
+# This 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 libbluray library
+
+set(Bluray_FIND_VERSION 0.9.3)
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_BLURAY libbluray>=${Bluray_FIND_VERSION} QUIET)
+ set(BLURAY_VERSION ${PC_BLURAY_VERSION})
+endif()
+
+find_path(BLURAY_INCLUDE_DIR libbluray/bluray.h
+ PATHS ${PC_BLURAY_INCLUDEDIR})
+
+if(NOT BLURAY_VERSION AND EXISTS ${BLURAY_INCLUDE_DIR}/libbluray/bluray-version.h)
+ file(STRINGS ${BLURAY_INCLUDE_DIR}/libbluray/bluray-version.h _bluray_version_str
+ REGEX "#define[ \t]BLURAY_VERSION_STRING[ \t][\"]?[0-9.]+[\"]?")
+ string(REGEX REPLACE "^.*BLURAY_VERSION_STRING[ \t][\"]?([0-9.]+).*$" "\\1" BLURAY_VERSION ${_bluray_version_str})
+ unset(_bluray_version_str)
+endif()
+
+find_library(BLURAY_LIBRARY NAMES bluray libbluray
+ PATHS ${PC_BLURAY_LIBDIR})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Bluray
+ REQUIRED_VARS BLURAY_LIBRARY BLURAY_INCLUDE_DIR BLURAY_VERSION
+ VERSION_VAR BLURAY_VERSION)
+
+if(BLURAY_FOUND)
+ set(BLURAY_LIBRARIES ${BLURAY_LIBRARY})
+ set(BLURAY_INCLUDE_DIRS ${BLURAY_INCLUDE_DIR})
+ set(BLURAY_DEFINITIONS -DHAVE_LIBBLURAY=1)
+
+ # todo: improve syntax
+ if (NOT CORE_PLATFORM_NAME_LC STREQUAL windowsstore)
+ list(APPEND BLURAY_DEFINITIONS -DHAVE_LIBBLURAY_BDJ=1)
+ endif()
+
+ if(${BLURAY_LIBRARY} MATCHES ".+\.a$" AND PC_BLURAY_STATIC_LIBRARIES)
+ list(APPEND BLURAY_LIBRARIES ${PC_BLURAY_STATIC_LIBRARIES})
+ endif()
+
+ 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 0000000..04e8378
--- /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/FindCEC.cmake b/cmake/modules/FindCEC.cmake
new file mode 100644
index 0000000..00b2e12
--- /dev/null
+++ b/cmake/modules/FindCEC.cmake
@@ -0,0 +1,61 @@
+#.rst:
+# FindCEC
+# -------
+# Finds the libCEC library
+#
+# This 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()
+
+find_library(CEC_LIBRARY NAMES cec
+ PATHS ${PC_CEC_LIBDIR})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(CEC
+ REQUIRED_VARS CEC_LIBRARY CEC_INCLUDE_DIR
+ VERSION_VAR CEC_VERSION)
+
+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 0000000..e1cb022
--- /dev/null
+++ b/cmake/modules/FindCWiid.cmake
@@ -0,0 +1,44 @@
+#.rst:
+# FindCWiid
+# ---------
+# Finds the CWiid library
+#
+# This 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/FindCdio.cmake b/cmake/modules/FindCdio.cmake
new file mode 100644
index 0000000..3a10b06
--- /dev/null
+++ b/cmake/modules/FindCdio.cmake
@@ -0,0 +1,42 @@
+#.rst:
+# FindCdio
+# --------
+# Finds the cdio library
+#
+# This will define the following variables::
+#
+# CDIO_FOUND - system has cdio
+# CDIO_INCLUDE_DIRS - the cdio include directory
+# CDIO_LIBRARIES - the cdio libraries
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_CDIO libcdio>=0.80 QUIET)
+ pkg_check_modules(PC_CDIOPP libcdio++>=2.1.0 QUIET)
+endif()
+
+find_path(CDIO_INCLUDE_DIR NAMES cdio/cdio.h
+ PATHS ${PC_CDIO_INCLUDEDIR})
+
+find_library(CDIO_LIBRARY NAMES cdio libcdio
+ PATHS ${PC_CDIO_LIBDIR})
+
+if(DEFINED PC_CDIO_VERSION AND DEFINED PC_CDIOPP_VERSION AND NOT "${PC_CDIO_VERSION}" VERSION_EQUAL "${PC_CDIOPP_VERSION}")
+ message(WARNING "Detected libcdio (${PC_CDIO_VERSION}) and libcdio++ (${PC_CDIOPP_VERSION}) version mismatch. libcdio++ will not be used.")
+else()
+ find_path(CDIOPP_INCLUDE_DIR NAMES cdio++/cdio.hpp
+ PATHS ${PC_CDIOPP_INCLUDEDIR} ${CDIO_INCLUDE_DIR})
+
+ set(CDIO_VERSION ${PC_CDIO_VERSION})
+endif()
+
+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})
+endif()
+
+mark_as_advanced(CDIO_INCLUDE_DIR CDIOPP_INCLUDE_DIR CDIO_LIBRARY)
diff --git a/cmake/modules/FindCrossGUID.cmake b/cmake/modules/FindCrossGUID.cmake
new file mode 100644
index 0000000..4aceb84
--- /dev/null
+++ b/cmake/modules/FindCrossGUID.cmake
@@ -0,0 +1,111 @@
+# FindCrossGUID
+# -------
+# Finds the CrossGUID library
+#
+# This will define the following variables::
+#
+# CROSSGUID_FOUND_FOUND - system has CrossGUID
+# CROSSGUID_INCLUDE_DIRS - the CrossGUID include directory
+# CROSSGUID_LIBRARIES - the CrossGUID libraries
+# CROSSGUID_DEFINITIONS - cmake definitions required
+#
+# and the following imported targets::
+#
+# CrossGUID::CrossGUID - The CrossGUID library
+
+if(ENABLE_INTERNAL_CROSSGUID)
+ include(cmake/scripts/common/ModuleHelpers.cmake)
+
+ set(MODULE_LC crossguid)
+
+ SETUP_BUILD_VARS()
+
+ set(CROSSGUID_VERSION ${${MODULE}_VER})
+ set(CROSSGUID_DEFINITIONS -DHAVE_NEW_CROSSGUID)
+ set(CROSSGUID_DEBUG_POSTFIX "-dgb")
+
+ if(ANDROID)
+ list(APPEND CROSSGUID_DEFINITIONS -DGUID_ANDROID)
+ endif()
+
+ set(patches "${CMAKE_SOURCE_DIR}/tools/depends/target/crossguid/001-fix-unused-function.patch"
+ "${CMAKE_SOURCE_DIR}/tools/depends/target/crossguid/002-disable-Wall-error.patch"
+ "${CMAKE_SOURCE_DIR}/tools/depends/target/crossguid/003-add-cstdint-include.patch")
+
+ generate_patchcommand("${patches}")
+
+ set(CMAKE_ARGS -DCROSSGUID_TESTS=OFF
+ -DDISABLE_WALL=ON)
+
+ BUILD_DEP_TARGET()
+
+else()
+ if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_CROSSGUID crossguid QUIET)
+ set(CROSSGUID_VERSION ${PC_CROSSGUID_VERSION})
+ endif()
+
+ if(CROSSGUID_FOUND)
+ find_path(CROSSGUID_INCLUDE_DIR NAMES crossguid/guid.hpp guid.h
+ PATHS ${PC_CROSSGUID_INCLUDEDIR})
+
+ find_library(CROSSGUID_LIBRARY_RELEASE NAMES crossguid
+ PATHS ${PC_CROSSGUID_LIBDIR})
+ find_library(CROSSGUID_LIBRARY_DEBUG NAMES crossguidd crossguid-dgb
+ PATHS ${PC_CROSSGUID_LIBDIR})
+ else()
+ find_path(CROSSGUID_INCLUDE_DIR NAMES crossguid/guid.hpp guid.h)
+ find_library(CROSSGUID_LIBRARY_RELEASE NAMES crossguid)
+ find_library(CROSSGUID_LIBRARY_DEBUG NAMES crossguidd)
+ endif()
+endif()
+
+# Select relevant lib build type (ie CROSSGUID_LIBRARY_RELEASE or CROSSGUID_LIBRARY_DEBUG)
+include(SelectLibraryConfigurations)
+select_library_configurations(CROSSGUID)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(CrossGUID
+ REQUIRED_VARS CROSSGUID_LIBRARY CROSSGUID_INCLUDE_DIR
+ VERSION_VAR CROSSGUID_VERSION)
+
+if(CROSSGUID_FOUND)
+ set(CROSSGUID_LIBRARIES ${CROSSGUID_LIBRARY})
+ set(CROSSGUID_INCLUDE_DIRS ${CROSSGUID_INCLUDE_DIR})
+
+ # NEW_CROSSGUID >= 0.2.0 release
+ if(EXISTS "${CROSSGUID_INCLUDE_DIR}/crossguid/guid.hpp")
+ list(APPEND CROSSGUID_DEFINITIONS -DHAVE_NEW_CROSSGUID)
+ endif()
+
+ if(UNIX AND NOT (APPLE OR ANDROID))
+ # Suppress mismatch warning, see https://cmake.org/cmake/help/latest/module/FindPackageHandleStandardArgs.html
+ set(FPHSA_NAME_MISMATCHED 1)
+ find_package(UUID REQUIRED)
+ unset(FPHSA_NAME_MISMATCHED)
+ list(APPEND CROSSGUID_INCLUDE_DIRS ${UUID_INCLUDE_DIRS})
+ list(APPEND CROSSGUID_LIBRARIES ${UUID_LIBRARIES})
+ endif()
+
+ if(NOT TARGET CrossGUID::CrossGUID)
+ add_library(CrossGUID::CrossGUID UNKNOWN IMPORTED)
+ if(CROSSGUID_LIBRARY_RELEASE)
+ set_target_properties(CrossGUID::CrossGUID PROPERTIES
+ IMPORTED_CONFIGURATIONS RELEASE
+ IMPORTED_LOCATION "${CROSSGUID_LIBRARY_RELEASE}")
+ endif()
+ if(CROSSGUID_LIBRARY_DEBUG)
+ set_target_properties(CrossGUID::CrossGUID PROPERTIES
+ IMPORTED_CONFIGURATIONS DEBUG
+ IMPORTED_LOCATION "${CROSSGUID_LIBRARY_DEBUG}")
+ endif()
+ set_target_properties(CrossGUID::CrossGUID PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${CROSSGUID_INCLUDE_DIRS}")
+ endif()
+ if(TARGET crossguid)
+ add_dependencies(CrossGUID::CrossGUID crossguid)
+ endif()
+ set_property(GLOBAL APPEND PROPERTY INTERNAL_DEPS_PROP CrossGUID::CrossGUID)
+
+endif()
+mark_as_advanced(CROSSGUID_INCLUDE_DIR CROSSGUID_LIBRARY)
diff --git a/cmake/modules/FindCurl.cmake b/cmake/modules/FindCurl.cmake
new file mode 100644
index 0000000..6411a92
--- /dev/null
+++ b/cmake/modules/FindCurl.cmake
@@ -0,0 +1,62 @@
+#.rst:
+# FindCurl
+# --------
+# Finds the Curl library
+#
+# This 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 libcurl_imp
+ PATHS ${PC_CURL_LIBDIR})
+
+set(CURL_VERSION ${PC_CURL_VERSION})
+
+set(CURL_LIB_TYPE SHARED)
+set(CURL_LDFLAGS ${PC_CURL_LDFLAGS})
+
+# check if curl is statically linked
+if(${CURL_LIBRARY} MATCHES ".+\.a$" AND PC_CURL_STATIC_LDFLAGS)
+ set(CURL_LIB_TYPE STATIC)
+ set(CURL_LDFLAGS ${PC_CURL_STATIC_LDFLAGS})
+
+ pkg_check_modules(PC_NGHTTP2 libnghttp2 QUIET)
+ find_library(NGHTTP2_LIBRARY NAMES libnghttp2 nghttp2
+ PATHS ${PC_NGHTTP2_LIBDIR})
+endif()
+
+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} ${NGHTTP2_LIBRARY})
+
+ if(NOT TARGET Curl::Curl)
+ add_library(Curl::Curl ${CURL_LIB_TYPE} 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 CURL_LDFLAGS)
diff --git a/cmake/modules/FindD3DX11Effects.cmake b/cmake/modules/FindD3DX11Effects.cmake
new file mode 100644
index 0000000..9b1eb15
--- /dev/null
+++ b/cmake/modules/FindD3DX11Effects.cmake
@@ -0,0 +1,33 @@
+# - Finds D3DX11 dependencies
+# Once done this will define
+#
+# D3DCOMPILER_DLL - Path to the Direct3D Compiler
+# FXC - Path to the DirectX Effects Compiler (FXC)
+
+if(NOT CORE_SYSTEM_NAME STREQUAL windowsstore)
+ 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/${SDK_TARGET_ARCH}"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.1;InstallationFolder]/Redist/D3D/${SDK_TARGET_ARCH}"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;InstallationFolder]/Redist/D3D/${SDK_TARGET_ARCH}"
+ "$ENV{WindowsSdkDir}Redist/d3d/${SDK_TARGET_ARCH}"
+ 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 .)
+endif()
+
+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\\v10.0;InstallationFolder]/bin/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v10.0;ProductVersion].0/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 0000000..df3edc5
--- /dev/null
+++ b/cmake/modules/FindDBus.cmake
@@ -0,0 +1,52 @@
+#.rst:
+# FindDBUS
+# -------
+# Finds the DBUS library
+#
+# This 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 -DHAS_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 HAS_DBUS=1)
+ endif()
+endif()
+
+mark_as_advanced(DBUS_INCLUDE_DIR DBUS_LIBRARY)
diff --git a/cmake/modules/FindDav1d.cmake b/cmake/modules/FindDav1d.cmake
new file mode 100644
index 0000000..9e91a61
--- /dev/null
+++ b/cmake/modules/FindDav1d.cmake
@@ -0,0 +1,62 @@
+#.rst:
+# FindDav1d
+# --------
+# Finds the dav1d library
+#
+# This will define the following variables::
+#
+# DAV1D_FOUND - system has dav1d
+# DAV1D_INCLUDE_DIRS - the dav1d include directories
+# DAV1D_LIBRARIES - the dav1d libraries
+
+if(ENABLE_INTERNAL_DAV1D)
+ include(cmake/scripts/common/ModuleHelpers.cmake)
+
+ set(MODULE_LC dav1d)
+
+ SETUP_BUILD_VARS()
+
+ set(DAV1D_VERSION ${${MODULE}_VER})
+
+ find_program(NINJA_EXECUTABLE ninja REQUIRED)
+ find_program(MESON_EXECUTABLE meson REQUIRED)
+
+ set(CONFIGURE_COMMAND ${MESON_EXECUTABLE}
+ --buildtype=release
+ --default-library=static
+ --prefix=${DEPENDS_PATH}
+ --libdir=lib
+ -Denable_asm=true
+ -Denable_tools=false
+ -Denable_examples=false
+ -Denable_tests=false
+ ../dav1d)
+ set(BUILD_COMMAND ${NINJA_EXECUTABLE})
+ set(INSTALL_COMMAND ${NINJA_EXECUTABLE} install)
+
+ BUILD_DEP_TARGET()
+else()
+ if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_DAV1D dav1d QUIET)
+ endif()
+
+ find_library(DAV1D_LIBRARY NAMES dav1d libdav1d
+ PATHS ${PC_DAV1D_LIBDIR})
+
+ find_path(DAV1D_INCLUDE_DIR NAMES dav1d/dav1d.h
+ PATHS ${PC_DAV1D_INCLUDEDIR})
+
+ set(DAV1D_VERSION ${PC_DAV1D_VERSION})
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Dav1d
+ REQUIRED_VARS DAV1D_LIBRARY DAV1D_INCLUDE_DIR
+ VERSION_VAR DAV1D_VERSION)
+
+if(DAV1D_FOUND)
+ set(DAV1D_INCLUDE_DIRS ${DAV1D_INCLUDE_DIR})
+ set(DAV1D_LIBRARIES ${DAV1D_LIBRARY})
+endif()
+
+mark_as_advanced(DAV1D_INCLUDE_DIR DAV1D_LIBRARY)
diff --git a/cmake/modules/FindEGL.cmake b/cmake/modules/FindEGL.cmake
new file mode 100644
index 0000000..37bd663
--- /dev/null
+++ b/cmake/modules/FindEGL.cmake
@@ -0,0 +1,57 @@
+#.rst:
+# FindEGL
+# -------
+# Finds the EGL library
+#
+# This 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
+# HAVE_EGLEXTANGLE - if eglext_angle.h exists else use eglextchromium.h
+#
+# 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 -DHAS_EGL=1)
+ set(CMAKE_REQUIRED_INCLUDES "${EGL_INCLUDE_DIR}")
+ include(CheckIncludeFiles)
+ check_include_files("EGL/egl.h;EGL/eglext.h;EGL/eglext_angle.h" HAVE_EGLEXTANGLE)
+ unset(CMAKE_REQUIRED_INCLUDES)
+
+ if(HAVE_EGLEXTANGLE)
+ list(APPEND EGL_DEFINITIONS "-DHAVE_EGLEXTANGLE=1")
+ endif()
+
+ 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 HAS_EGL=1)
+ endif()
+endif()
+
+mark_as_advanced(EGL_INCLUDE_DIR EGL_LIBRARY)
diff --git a/cmake/modules/FindEpollShim.cmake b/cmake/modules/FindEpollShim.cmake
new file mode 100644
index 0000000..61366d8
--- /dev/null
+++ b/cmake/modules/FindEpollShim.cmake
@@ -0,0 +1,27 @@
+# FindEpollShim
+# -------------
+# Finds the epoll-shim library
+#
+# This will define the following variables::
+#
+# EPOLLSHIM_FOUND - the system has epoll-shim
+# EPOLLSHIM_INCLUDE_DIR - the epoll-shim include directory
+# EPOLLSHIM_LIBRARY - the epoll-shim library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_EPOLLSHIM epoll-shim QUIET)
+endif()
+
+find_path(EPOLLSHIM_INCLUDE_DIR NAMES sys/epoll.h PATHS ${PC_EPOLLSHIM_INCLUDE_DIRS})
+find_library(EPOLLSHIM_LIBRARY NAMES epoll-shim PATHS ${PC_EPOLLSHIM_LIBDIR})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(EpollShim
+ REQUIRED_VARS EPOLLSHIM_LIBRARY EPOLLSHIM_INCLUDE_DIR)
+
+if(EPOLLSHIM_FOUND)
+ set(EPOLLSHIM_INCLUDE_DIRS ${EPOLLSHIM_INCLUDE_DIR})
+ set(EPOLLSHIM_LIBRARIES ${EPOLLSHIM_LIBRARY})
+endif()
+
+mark_as_advanced(EPOLLSHIM_INCLUDE_DIR EPOLLSHIM_LIBRARY)
diff --git a/cmake/modules/FindFFMPEG.cmake b/cmake/modules/FindFFMPEG.cmake
new file mode 100644
index 0000000..fedbf0a
--- /dev/null
+++ b/cmake/modules/FindFFMPEG.cmake
@@ -0,0 +1,318 @@
+# 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 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
+# --------
+#
+
+# Macro to build internal FFmpeg
+# Refactoring to a macro allows simple fallthrough callback if system ffmpeg failure
+macro(buildFFMPEG)
+ include(cmake/scripts/common/ModuleHelpers.cmake)
+
+ set(MODULE_LC ffmpeg)
+
+ # We require this due to the odd nature of github URL's compared to our other tarball
+ # mirror system. If User sets FFMPEG_URL, allow get_filename_component in SETUP_BUILD_VARS
+ if(FFMPEG_URL)
+ set(FFMPEG_URL_PROVIDED TRUE)
+ endif()
+
+ SETUP_BUILD_VARS()
+
+ if(NOT FFMPEG_URL_PROVIDED)
+ # override FFMPEG_URL due to tar naming when retrieved from github release for ffmpeg
+ set(FFMPEG_URL ${FFMPEG_BASE_URL}/archive/${FFMPEG_VER}.tar.gz)
+ endif()
+
+ if(NOT DAV1D_FOUND)
+ message(STATUS "dav1d not found, internal ffmpeg build will be missing AV1 support!")
+ endif()
+
+ set(FFMPEG_OPTIONS -DENABLE_CCACHE=${ENABLE_CCACHE}
+ -DCCACHE_PROGRAM=${CCACHE_PROGRAM}
+ -DENABLE_VAAPI=${ENABLE_VAAPI}
+ -DENABLE_VDPAU=${ENABLE_VDPAU}
+ -DENABLE_DAV1D=${DAV1D_FOUND}
+ -DEXTRA_FLAGS=${FFMPEG_EXTRA_FLAGS})
+
+ if(KODI_DEPENDSBUILD)
+ set(CROSS_ARGS -DDEPENDS_PATH=${DEPENDS_PATH}
+ -DPKG_CONFIG_EXECUTABLE=${PKG_CONFIG_EXECUTABLE}
+ -DCROSSCOMPILING=${CMAKE_CROSSCOMPILING}
+ -DOS=${OS}
+ -DCMAKE_AR=${CMAKE_AR})
+ endif()
+ set(LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS})
+ list(APPEND LINKER_FLAGS ${SYSTEM_LDFLAGS})
+
+ # Some list shenanigans not being passed through without stringify/listify
+ # externalproject_add allows declaring list separator to generate a list for the target
+ string(REPLACE ";" "|" FFMPEG_MODULE_PATH "${CMAKE_MODULE_PATH}")
+ set(FFMPEG_LIST_SEPARATOR LIST_SEPARATOR |)
+
+ set(CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}
+ -DCMAKE_MODULE_PATH=${FFMPEG_MODULE_PATH}
+ -DFFMPEG_VER=${FFMPEG_VER}
+ -DCORE_SYSTEM_NAME=${CORE_SYSTEM_NAME}
+ -DCORE_PLATFORM_NAME=${CORE_PLATFORM_NAME_LC}
+ -DCPU=${CPU}
+ -DENABLE_NEON=${ENABLE_NEON}
+ -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
+ -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
+ -DENABLE_CCACHE=${ENABLE_CCACHE}
+ -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
+ -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
+ -DCMAKE_EXE_LINKER_FLAGS=${LINKER_FLAGS}
+ ${CROSS_ARGS}
+ ${FFMPEG_OPTIONS}
+ -DPKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig)
+ set(PATCH_COMMAND ${CMAKE_COMMAND} -E copy
+ ${CMAKE_SOURCE_DIR}/tools/depends/target/ffmpeg/CMakeLists.txt
+ <SOURCE_DIR>)
+
+ if(CMAKE_GENERATOR STREQUAL Xcode)
+ set(FFMPEG_GENERATOR CMAKE_GENERATOR "Unix Makefiles")
+ endif()
+
+ set(FFMPEG_LIB_TYPE STATIC)
+
+ BUILD_DEP_TARGET()
+
+ if(ENABLE_INTERNAL_DAV1D)
+ add_dependencies(ffmpeg dav1d)
+ endif()
+
+ find_program(BASH_COMMAND bash)
+ if(NOT BASH_COMMAND)
+ message(FATAL_ERROR "Internal FFmpeg requires bash.")
+ endif()
+ file(WRITE ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/ffmpeg/ffmpeg-link-wrapper
+"#!${BASH_COMMAND}
+if [[ $@ == *${APP_NAME_LC}.bin* || $@ == *${APP_NAME_LC}${APP_BINARY_SUFFIX}* || $@ == *${APP_NAME_LC}.so* || $@ == *${APP_NAME_LC}-test* ]]
+then
+ avcodec=`PKG_CONFIG_PATH=${DEPENDS_PATH}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libavcodec`
+ avformat=`PKG_CONFIG_PATH=${DEPENDS_PATH}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libavformat`
+ avfilter=`PKG_CONFIG_PATH=${DEPENDS_PATH}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libavfilter`
+ avutil=`PKG_CONFIG_PATH=${DEPENDS_PATH}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libavutil`
+ swscale=`PKG_CONFIG_PATH=${DEPENDS_PATH}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libswscale`
+ swresample=`PKG_CONFIG_PATH=${DEPENDS_PATH}/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)
+ set(FFMPEG_DEFINITIONS -DUSE_STATIC_FFMPEG=1)
+ set(FFMPEG_FOUND 1)
+
+ set_target_properties(ffmpeg PROPERTIES FOLDER "External Projects")
+endmacro()
+
+
+# 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)
+else()
+ # required ffmpeg library versions
+ set(REQUIRED_FFMPEG_VERSION 4.4.1)
+ set(_avcodec_ver ">=58.134.100")
+ set(_avfilter_ver ">=7.110.100")
+ set(_avformat_ver ">=58.76.100")
+ set(_avutil_ver ">=56.70.100")
+ set(_postproc_ver ">=55.9.100")
+ set(_swresample_ver ">=3.9.100")
+ set(_swscale_ver ">=5.9.100")
+endif()
+
+# Allows building with external ffmpeg not found in system paths,
+# with library version checks
+if(FFMPEG_PATH)
+ set(ENABLE_INTERNAL_FFMPEG OFF)
+endif()
+
+if(ENABLE_INTERNAL_FFMPEG)
+ buildFFMPEG()
+else()
+ # external FFMPEG
+ if(FFMPEG_PATH)
+ 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")
+
+ if(FFMPEG_FOUND)
+ set(FFMPEG_LDFLAGS ${PC_FFMPEG_LDFLAGS} CACHE STRING "ffmpeg linker flags")
+
+ set(FFMPEG_LIBRARIES ${FFMPEG_LIBAVCODEC} ${FFMPEG_LIBAVFILTER}
+ ${FFMPEG_LIBAVFORMAT} ${FFMPEG_LIBAVUTIL}
+ ${FFMPEG_LIBSWSCALE} ${FFMPEG_LIBSWRESAMPLE}
+ ${FFMPEG_LIBPOSTPROC} ${FFMPEG_LDFLAGS})
+
+ # 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_LIB_TYPE STATIC)
+ break()
+ endif()
+ endforeach()
+ endif()
+ else()
+ if(FFMPEG_PATH)
+ message(FATAL_ERROR "FFmpeg not found, please consider using -DENABLE_INTERNAL_FFMPEG=ON")
+ else()
+ message(STATUS "FFmpeg ${REQUIRED_FFMPEG_VERSION} not found, falling back to internal build")
+ buildFFMPEG()
+ endif()
+ endif()
+endif()
+
+if(FFMPEG_FOUND)
+
+ 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()
+
+ set_property(GLOBAL APPEND PROPERTY INTERNAL_DEPS_PROP ffmpeg)
+endif()
+
+mark_as_advanced(FFMPEG_INCLUDE_DIRS FFMPEG_LIBRARIES FFMPEG_LDFLAGS FFMPEG_DEFINITIONS FFMPEG_FOUND)
diff --git a/cmake/modules/FindFlatBuffers.cmake b/cmake/modules/FindFlatBuffers.cmake
new file mode 100644
index 0000000..fffac4f
--- /dev/null
+++ b/cmake/modules/FindFlatBuffers.cmake
@@ -0,0 +1,63 @@
+# FindFlatBuffers
+# --------
+# Find the FlatBuffers schema compiler and headers
+#
+# This will define the following variables:
+#
+# FLATBUFFERS_FOUND - system has FlatBuffers compiler and headers
+# FLATBUFFERS_INCLUDE_DIRS - the FlatFuffers include directory
+# FLATBUFFERS_MESSAGES_INCLUDE_DIR - the directory for generated headers
+
+find_package(FlatC REQUIRED)
+
+if(ENABLE_INTERNAL_FLATBUFFERS)
+ include(cmake/scripts/common/ModuleHelpers.cmake)
+
+ set(MODULE_LC flatbuffers)
+
+ SETUP_BUILD_VARS()
+
+ # Override build type detection and always build as release
+ set(FLATBUFFERS_BUILD_TYPE Release)
+
+ set(CMAKE_ARGS -DFLATBUFFERS_CODE_COVERAGE=OFF
+ -DFLATBUFFERS_BUILD_TESTS=OFF
+ -DFLATBUFFERS_INSTALL=ON
+ -DFLATBUFFERS_BUILD_FLATLIB=OFF
+ -DFLATBUFFERS_BUILD_FLATC=OFF
+ -DFLATBUFFERS_BUILD_FLATHASH=OFF
+ -DFLATBUFFERS_BUILD_GRPCTEST=OFF
+ -DFLATBUFFERS_BUILD_SHAREDLIB=OFF
+ "${EXTRA_ARGS}")
+ set(BUILD_BYPRODUCTS ${DEPENDS_PATH}/include/flatbuffers/flatbuffers.h)
+
+ BUILD_DEP_TARGET()
+else()
+ find_path(FLATBUFFERS_INCLUDE_DIR NAMES flatbuffers/flatbuffers.h)
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(FlatBuffers
+ REQUIRED_VARS FLATBUFFERS_INCLUDE_DIR
+ VERSION_VAR FLATBUFFERS_VER)
+
+if(FLATBUFFERS_FOUND)
+ set(FLATBUFFERS_MESSAGES_INCLUDE_DIR ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cores/RetroPlayer/messages CACHE INTERNAL "Generated FlatBuffer headers")
+ set(FLATBUFFERS_INCLUDE_DIRS ${FLATBUFFERS_INCLUDE_DIR} ${FLATBUFFERS_MESSAGES_INCLUDE_DIR})
+
+ if(NOT TARGET flatbuffers::flatbuffers)
+ add_library(flatbuffers::flatbuffers UNKNOWN IMPORTED)
+ set_target_properties(flatbuffers::flatbuffers PROPERTIES
+ FOLDER "External Projects"
+ INTERFACE_INCLUDE_DIRECTORIES ${FLATBUFFERS_INCLUDE_DIR})
+ endif()
+
+ add_dependencies(flatbuffers::flatbuffers flatbuffers::flatc)
+
+ if(TARGET flatbuffers)
+ add_dependencies(flatbuffers::flatbuffers flatbuffers)
+ endif()
+ set_property(GLOBAL APPEND PROPERTY INTERNAL_DEPS_PROP flatbuffers::flatbuffers)
+endif()
+
+mark_as_advanced(FLATBUFFERS_INCLUDE_DIR)
diff --git a/cmake/modules/FindFmt.cmake b/cmake/modules/FindFmt.cmake
new file mode 100644
index 0000000..7f0023b
--- /dev/null
+++ b/cmake/modules/FindFmt.cmake
@@ -0,0 +1,149 @@
+# FindFmt
+# -------
+# Finds the Fmt library
+#
+# This will define the following variables::
+#
+# FMT_FOUND - system has Fmt
+# FMT_INCLUDE_DIRS - the Fmt include directory
+# FMT_LIBRARIES - the Fmt libraries
+#
+# and the following imported targets::
+#
+# fmt::fmt - The Fmt library
+
+define_property(TARGET PROPERTY LIB_BUILD
+ BRIEF_DOCS "This target will be compiling the library"
+ FULL_DOCS "This target will be compiling the library")
+
+set(FORCE_BUILD OFF)
+
+# If target exists, no need to rerun find
+# Allows a module that may be a dependency for multiple libraries to just be executed
+# once to populate all required variables/targets
+if((NOT TARGET fmt::fmt OR Fmt_FIND_REQUIRED) AND NOT TARGET fmt)
+
+ # Build if ENABLE_INTERNAL_FMT, or if required version in find_package call is greater
+ # than already found FMT_VERSION from a previous find_package call
+ if(ENABLE_INTERNAL_FMT OR (Fmt_FIND_REQUIRED AND FMT_VERSION VERSION_LESS Fmt_FIND_VERSION))
+
+ include(cmake/scripts/common/ModuleHelpers.cmake)
+
+ set(MODULE_LC fmt)
+
+ SETUP_BUILD_VARS()
+
+ # Check for existing FMT. If version >= FMT-VERSION file version, dont build
+ find_package(FMT CONFIG QUIET)
+
+ if(Fmt_FIND_VERSION)
+ if(FMT_VERSION VERSION_LESS ${Fmt_FIND_VERSION})
+ set(FORCE_BUILD ON)
+ endif()
+ else()
+ set(FORCE_BUILD ON)
+ endif()
+
+ if(${FORCE_BUILD} OR FMT_VERSION VERSION_LESS ${${MODULE}_VER})
+
+ # Set FORCE_BUILD to enable fmt::fmt property that build will occur
+ set(FORCE_BUILD ON)
+
+ if(APPLE)
+ set(EXTRA_ARGS "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}")
+ endif()
+
+ set(FMT_VERSION ${${MODULE}_VER})
+ # fmt debug uses postfix d for all platforms
+ set(FMT_DEBUG_POSTFIX d)
+
+ if(WIN32 OR WINDOWS_STORE)
+ set(patches "${CMAKE_SOURCE_DIR}/tools/depends/target/${MODULE_LC}/001-windows-pdb-symbol-gen.patch")
+ generate_patchcommand("${patches}")
+ endif()
+
+ set(CMAKE_ARGS -DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS}
+ -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}
+ -DFMT_DOC=OFF
+ -DFMT_TEST=OFF
+ -DFMT_INSTALL=ON
+ "${EXTRA_ARGS}")
+
+ BUILD_DEP_TARGET()
+ else()
+ # Populate paths for find_package_handle_standard_args
+ find_path(FMT_INCLUDE_DIR NAMES fmt/format.h)
+ find_library(FMT_LIBRARY_RELEASE NAMES fmt)
+ find_library(FMT_LIBRARY_DEBUG NAMES fmtd)
+ endif()
+ else()
+ find_package(FMT 6.1.2 CONFIG REQUIRED QUIET)
+
+ if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_FMT libfmt QUIET)
+ if(PC_FMT_VERSION AND NOT FMT_VERSION)
+ set(FMT_VERSION ${PC_FMT_VERSION})
+ endif()
+ endif()
+
+ find_path(FMT_INCLUDE_DIR NAMES fmt/format.h
+ PATHS ${PC_FMT_INCLUDEDIR})
+
+ find_library(FMT_LIBRARY_RELEASE NAMES fmt
+ PATHS ${PC_FMT_LIBDIR})
+ find_library(FMT_LIBRARY_DEBUG NAMES fmtd
+ PATHS ${PC_FMT_LIBDIR})
+
+ endif()
+
+ include(SelectLibraryConfigurations)
+ select_library_configurations(FMT)
+
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(Fmt
+ REQUIRED_VARS FMT_LIBRARY FMT_INCLUDE_DIR
+ VERSION_VAR FMT_VERSION)
+
+ if(FMT_FOUND)
+ set(FMT_LIBRARIES ${FMT_LIBRARY})
+ set(FMT_INCLUDE_DIRS ${FMT_INCLUDE_DIR})
+
+ # Reorder this to allow handling of FMT_FORCE_BUILD and not duplicate in property
+ if(NOT TARGET fmt::fmt)
+ set_property(GLOBAL APPEND PROPERTY INTERNAL_DEPS_PROP fmt::fmt)
+ endif()
+
+ if(NOT TARGET fmt::fmt OR FORCE_BUILD)
+ if(NOT TARGET fmt::fmt)
+ add_library(fmt::fmt UNKNOWN IMPORTED)
+ endif()
+
+ if(FMT_LIBRARY_RELEASE)
+ set_target_properties(fmt::fmt PROPERTIES
+ IMPORTED_CONFIGURATIONS RELEASE
+ IMPORTED_LOCATION "${FMT_LIBRARY_RELEASE}")
+ endif()
+ if(FMT_LIBRARY_DEBUG)
+ set_target_properties(fmt::fmt PROPERTIES
+ IMPORTED_CONFIGURATIONS DEBUG
+ IMPORTED_LOCATION "${FMT_LIBRARY_DEBUG}")
+ endif()
+ set_target_properties(fmt::fmt PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${FMT_INCLUDE_DIR}")
+
+ # If a force build is done, let any calling packages know they may want to rebuild
+ if(FORCE_BUILD)
+ set_target_properties(fmt::fmt PROPERTIES LIB_BUILD ON)
+ endif()
+ endif()
+ if(TARGET fmt)
+ add_dependencies(fmt::fmt fmt)
+ endif()
+ else()
+ if(FMT_FIND_REQUIRED)
+ message(FATAL_ERROR "Fmt lib not found. Maybe use -DENABLE_INTERNAL_FMT=ON")
+ endif()
+ endif()
+
+ mark_as_advanced(FMT_INCLUDE_DIR FMT_LIBRARY)
+endif()
diff --git a/cmake/modules/FindFreeType.cmake b/cmake/modules/FindFreeType.cmake
new file mode 100644
index 0000000..771819e
--- /dev/null
+++ b/cmake/modules/FindFreeType.cmake
@@ -0,0 +1,46 @@
+#.rst:
+# FindFreetype
+# ------------
+# Finds the FreeType library
+#
+# This 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}
+ PATH_SUFFIXES freetype2)
+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 0000000..65e543a
--- /dev/null
+++ b/cmake/modules/FindFriBidi.cmake
@@ -0,0 +1,52 @@
+#.rst:
+# FindFribidi
+# -----------
+# Finds the GNU FriBidi library
+#
+# This 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.h
+ PATH_SUFFIXES fribidi
+ 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_INCLUDE_DIRS)
+ list(APPEND FRIBIDI_INCLUDE_DIRS ${PC_FRIBIDI_INCLUDE_DIRS})
+ endif()
+ if(PC_FRIBIDI_CFLAGS_OTHER)
+ set(FRIBIDI_DEFINITIONS ${PC_FRIBIDI_CFLAGS_OTHER})
+ 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_DIRS}"
+ INTERFACE_COMPILE_OPTIONS "${FRIBIDI_DEFINITIONS}")
+ endif()
+endif()
+
+mark_as_advanced(FRIBIDI_INCLUDE_DIR FRIBIDI_LIBRARY)
diff --git a/cmake/modules/FindFstrcmp.cmake b/cmake/modules/FindFstrcmp.cmake
new file mode 100644
index 0000000..d2625f1
--- /dev/null
+++ b/cmake/modules/FindFstrcmp.cmake
@@ -0,0 +1,63 @@
+#.rst:
+# FindFstrcmp
+# --------
+# Finds the fstrcmp library
+#
+# This will define the following variables::
+#
+# FSTRCMP_FOUND - system has libfstrcmp
+# FSTRCMP_INCLUDE_DIRS - the libfstrcmp include directory
+# FSTRCMP_LIBRARIES - the libfstrcmp libraries
+#
+
+if(ENABLE_INTERNAL_FSTRCMP)
+ find_program(LIBTOOL libtool REQUIRED)
+ include(cmake/scripts/common/ModuleHelpers.cmake)
+
+ set(MODULE_LC fstrcmp)
+
+ SETUP_BUILD_VARS()
+
+ find_program(AUTORECONF autoreconf REQUIRED)
+
+ set(CONFIGURE_COMMAND ${AUTORECONF} -vif
+ COMMAND ./configure --prefix ${DEPENDS_PATH})
+ set(BUILD_COMMAND make lib/libfstrcmp.la)
+ set(BUILD_IN_SOURCE 1)
+ set(INSTALL_COMMAND make install-libdir install-include)
+
+ BUILD_DEP_TARGET()
+else()
+ if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_FSTRCMP fstrcmp QUIET)
+ endif()
+
+ find_path(FSTRCMP_INCLUDE_DIR NAMES fstrcmp.h
+ PATHS ${PC_FSTRCMP_INCLUDEDIR})
+
+ find_library(FSTRCMP_LIBRARY NAMES fstrcmp
+ PATHS ${PC_FSTRCMP_LIBDIR})
+
+ set(FSTRCMP_VER ${PC_FSTRCMP_VERSION})
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Fstrcmp
+ REQUIRED_VARS FSTRCMP_LIBRARY FSTRCMP_INCLUDE_DIR
+ VERSION_VAR FSTRCMP_VER)
+
+if(FSTRCMP_FOUND)
+ set(FSTRCMP_INCLUDE_DIRS ${FSTRCMP_INCLUDE_DIR})
+ set(FSTRCMP_LIBRARIES ${FSTRCMP_LIBRARY})
+
+ if(NOT TARGET fstrcmp)
+ add_library(fstrcmp UNKNOWN IMPORTED)
+ set_target_properties(fstrcmp PROPERTIES
+ IMPORTED_LOCATION "${FSTRCMP_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${FSTRCMP_INCLUDE_DIR}")
+ endif()
+
+ set_property(GLOBAL APPEND PROPERTY INTERNAL_DEPS_PROP fstrcmp)
+endif()
+
+mark_as_advanced(FSTRCMP_INCLUDE_DIR FSTRCMP_LIBRARY)
diff --git a/cmake/modules/FindGBM.cmake b/cmake/modules/FindGBM.cmake
new file mode 100644
index 0000000..37a26a7
--- /dev/null
+++ b/cmake/modules/FindGBM.cmake
@@ -0,0 +1,68 @@
+# FindGBM
+# ----------
+# Finds the GBM library
+#
+# This will define the following variables::
+#
+# GBM_FOUND - system has GBM
+# GBM_INCLUDE_DIRS - the GBM include directory
+# GBM_LIBRARIES - the GBM libraries
+# GBM_DEFINITIONS - the GBM definitions
+#
+# and the following imported targets::
+#
+# GBM::GBM - The GBM library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_GBM gbm QUIET)
+endif()
+
+find_path(GBM_INCLUDE_DIR NAMES gbm.h
+ PATHS ${PC_GBM_INCLUDEDIR})
+find_library(GBM_LIBRARY NAMES gbm
+ PATHS ${PC_GBM_LIBDIR})
+
+set(GBM_VERSION ${PC_GBM_VERSION})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(GBM
+ REQUIRED_VARS GBM_LIBRARY GBM_INCLUDE_DIR
+ VERSION_VAR GBM_VERSION)
+
+include(CheckCSourceCompiles)
+set(CMAKE_REQUIRED_LIBRARIES ${GBM_LIBRARY})
+check_c_source_compiles("#include <gbm.h>
+
+ int main()
+ {
+ gbm_bo_map(NULL, 0, 0, 0, 0, GBM_BO_TRANSFER_WRITE, NULL, NULL);
+ }
+ " GBM_HAS_BO_MAP)
+
+check_c_source_compiles("#include <gbm.h>
+
+ int main()
+ {
+ gbm_surface_create_with_modifiers(NULL, 0, 0, 0, NULL, 0);
+ }
+ " GBM_HAS_MODIFIERS)
+
+if(GBM_FOUND)
+ set(GBM_LIBRARIES ${GBM_LIBRARY})
+ set(GBM_INCLUDE_DIRS ${GBM_INCLUDE_DIR})
+ set(GBM_DEFINITIONS -DHAVE_GBM=1)
+ if(GBM_HAS_BO_MAP)
+ list(APPEND GBM_DEFINITIONS -DHAS_GBM_BO_MAP=1)
+ endif()
+ if(GBM_HAS_MODIFIERS)
+ list(APPEND GBM_DEFINITIONS -DHAS_GBM_MODIFIERS=1)
+ endif()
+ if(NOT TARGET GBM::GBM)
+ add_library(GBM::GBM UNKNOWN IMPORTED)
+ set_target_properties(GBM::GBM PROPERTIES
+ IMPORTED_LOCATION "${GBM_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${GBM_INCLUDE_DIR}")
+ endif()
+endif()
+
+mark_as_advanced(GBM_INCLUDE_DIR GBM_LIBRARY)
diff --git a/cmake/modules/FindGIF.cmake b/cmake/modules/FindGIF.cmake
new file mode 100644
index 0000000..7564a58
--- /dev/null
+++ b/cmake/modules/FindGIF.cmake
@@ -0,0 +1,40 @@
+#.rst:
+# FindGIF
+# -------
+# Finds the libgif library
+#
+# This 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)
+find_library(GIF_LIBRARY NAMES gif)
+find_package_handle_standard_args(GIF
+ REQUIRED_VARS GIF_LIBRARY GIF_INCLUDE_DIR)
+
+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/FindGLU.cmake b/cmake/modules/FindGLU.cmake
new file mode 100644
index 0000000..f91d33d
--- /dev/null
+++ b/cmake/modules/FindGLU.cmake
@@ -0,0 +1,33 @@
+#.rst:
+# FindGLU
+# -----
+# Finds the GLU library
+#
+# This will define the following variables::
+#
+# GLU_FOUND - system has GLU
+# GLU_INCLUDE_DIRS - the GLU include directory
+# GLU_LIBRARIES - the GLU libraries
+# GLU_DEFINITIONS - the GLU definitions
+#
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_GLU glu QUIET)
+endif()
+
+find_path(GLU_INCLUDE_DIR NAMES GL/glu.h
+ PATHS ${PC_GLU_INCLUDEDIR})
+find_library(GLU_LIBRARY NAMES GLU
+ PATHS ${PC_GLU_LIBDIR})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(GLU
+ REQUIRED_VARS GLU_LIBRARY GLU_INCLUDE_DIR)
+
+if(GLU_FOUND)
+ set(GLU_LIBRARIES ${GLU_LIBRARY})
+ set(GLU_INCLUDE_DIRS ${GLU_INCLUDE_DIR})
+ set(GLU_DEFINITIONS -DHAS_GLU=1)
+endif()
+
+mark_as_advanced(GLU_INCLUDE_DIR GLU_LIBRARY)
diff --git a/cmake/modules/FindGLX.cmake b/cmake/modules/FindGLX.cmake
new file mode 100644
index 0000000..066cbb8
--- /dev/null
+++ b/cmake/modules/FindGLX.cmake
@@ -0,0 +1,36 @@
+#.rst:
+# FindGLX
+# -----
+# Finds the GLX library
+#
+# This will define the following variables::
+#
+# GLX_FOUND - system has GLX
+# GLX_INCLUDE_DIRS - the GLX include directory
+# GLX_LIBRARIES - the GLX libraries
+# GLX_DEFINITIONS - the GLX definitions
+#
+# and the following imported targets::
+#
+# GLX::GLX - The GLX library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_GLX glx QUIET)
+endif()
+
+find_path(GLX_INCLUDE_DIR NAMES GL/glx.h
+ PATHS ${PC_GLX_INCLUDEDIR})
+find_library(GLX_LIBRARY NAMES GL
+ PATHS ${PC_GLX_LIBDIR})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(GLX
+ REQUIRED_VARS GLX_LIBRARY GLX_INCLUDE_DIR)
+
+if(GLX_FOUND)
+ set(GLX_LIBRARIES ${GLX_LIBRARY})
+ set(GLX_INCLUDE_DIRS ${GLX_INCLUDE_DIR})
+ set(GLX_DEFINITIONS -DHAS_GLX=1)
+endif()
+
+mark_as_advanced(GLX_INCLUDE_DIR GLX_LIBRARY)
diff --git a/cmake/modules/FindGnuTLS.cmake b/cmake/modules/FindGnuTLS.cmake
new file mode 100644
index 0000000..41226bf
--- /dev/null
+++ b/cmake/modules/FindGnuTLS.cmake
@@ -0,0 +1,34 @@
+# - Try to find gnutls
+# Once done this will define
+#
+# GNUTLS_FOUND - system has gnutls
+# GNUTLS_INCLUDE_DIRS - the gnutls include directory
+# GNUTLS_LIBRARIES - The gnutls libraries
+
+# Suppress PkgConfig Mismatch warning, see https://cmake.org/cmake/help/latest/module/FindPackageHandleStandardArgs.html
+set(FPHSA_NAME_MISMATCHED 1)
+include(FindPkgConfig)
+find_package(PkgConfig QUIET)
+unset(FPHSA_NAME_MISMATCHED)
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(GNUTLS gnutls QUIET)
+endif()
+
+if(NOT GNUTLS_FOUND)
+ find_path(GNUTLS_INCLUDE_DIRS gnutls/gnutls.h)
+ find_library(GNUTLS_LIBRARIES gnutls)
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(GnuTLS DEFAULT_MSG GNUTLS_INCLUDE_DIRS GNUTLS_LIBRARIES)
+
+if(GNUTLS_FOUND)
+ list(APPEND GNUTLS_DEFINITIONS -DHAVE_GNUTLS=1)
+else()
+ if(GNUTLS_FIND_REQUIRED)
+ message(FATAL_ERROR "GNUTLS Not Found.")
+ endif()
+endif()
+
+mark_as_advanced(GNUTLS_INCLUDE_DIRS GNUTLS_LIBRARIES GNUTLS_DEFINITIONS)
diff --git a/cmake/modules/FindHarfBuzz.cmake b/cmake/modules/FindHarfBuzz.cmake
new file mode 100644
index 0000000..6691136
--- /dev/null
+++ b/cmake/modules/FindHarfBuzz.cmake
@@ -0,0 +1,46 @@
+#.rst:
+# FindHarfbuzz
+# ------------
+# Finds the HarfBuzz library
+#
+# This will define the following variables::
+#
+# HARFBUZZ_FOUND - system has HarfBuzz
+# HARFBUZZ_INCLUDE_DIRS - the HarfBuzz include directory
+# HARFBUZZ_LIBRARIES - the HarfBuzz libraries
+#
+# and the following imported targets::
+#
+# HarfBuzz::HarfBuzz - The HarfBuzz library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_HARFBUZZ harfbuzz QUIET)
+endif()
+
+find_path(HARFBUZZ_INCLUDE_DIR NAMES harfbuzz/hb-ft.h hb-ft.h
+ PATHS ${PC_HARFBUZZ_INCLUDEDIR}
+ ${PC_HARFBUZZ_INCLUDE_DIRS}
+ PATH_SUFFIXES harfbuzz)
+find_library(HARFBUZZ_LIBRARY NAMES harfbuzz harfbuzz
+ PATHS ${PC_HARFBUZZ_LIBDIR})
+
+set(HARFBUZZ_VERSION ${PC_HARFBUZZ_VERSION})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(HarfBuzz
+ REQUIRED_VARS HARFBUZZ_LIBRARY HARFBUZZ_INCLUDE_DIR
+ VERSION_VAR HARFBUZZ_VERSION)
+
+if(HARFBUZZ_FOUND)
+ set(HARFBUZZ_LIBRARIES ${HARFBUZZ_LIBRARY})
+ set(HARFBUZZ_INCLUDE_DIRS ${HARFBUZZ_INCLUDE_DIR})
+
+ if(NOT TARGET HarfBuzz::HarfBuzz)
+ add_library(HarfBuzz::HarfBuzz UNKNOWN IMPORTED)
+ set_target_properties(HarfBuzz::HarfBuzz PROPERTIES
+ IMPORTED_LOCATION "${HARFBUZZ_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${HARFBUZZ_INCLUDE_DIR}")
+ endif()
+endif()
+
+mark_as_advanced(HARFBUZZ_INCLUDE_DIR HARFBUZZ_LIBRARY)
diff --git a/cmake/modules/FindIconv.cmake b/cmake/modules/FindIconv.cmake
new file mode 100644
index 0000000..ae7d8d7
--- /dev/null
+++ b/cmake/modules/FindIconv.cmake
@@ -0,0 +1,44 @@
+#.rst:
+# FindICONV
+# --------
+# Finds the ICONV library
+#
+# This will define the following variables::
+#
+# ICONV_FOUND - system has ICONV
+# ICONV_INCLUDE_DIRS - the ICONV include directory
+# ICONV_LIBRARIES - the ICONV libraries
+#
+# and the following imported targets::
+#
+# ICONV::ICONV - The ICONV library
+
+find_path(ICONV_INCLUDE_DIR NAMES iconv.h)
+
+find_library(ICONV_LIBRARY NAMES iconv libiconv c)
+
+set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARY})
+check_function_exists(iconv HAVE_ICONV_FUNCTION)
+if(NOT HAVE_ICONV_FUNCTION)
+ check_function_exists(libiconv HAVE_LIBICONV_FUNCTION2)
+ set(HAVE_ICONV_FUNCTION ${HAVE_LIBICONV_FUNCTION2})
+ unset(HAVE_LIBICONV_FUNCTION2)
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Iconv
+ REQUIRED_VARS ICONV_LIBRARY ICONV_INCLUDE_DIR HAVE_ICONV_FUNCTION)
+
+if(ICONV_FOUND)
+ set(ICONV_LIBRARIES ${ICONV_LIBRARY})
+ set(ICONV_INCLUDE_DIRS ${ICONV_INCLUDE_DIR})
+
+ if(NOT TARGET ICONV::ICONV)
+ add_library(ICONV::ICONV UNKNOWN IMPORTED)
+ set_target_properties(ICONV::ICONV PROPERTIES
+ IMPORTED_LOCATION "${ICONV_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${ICONV_INCLUDE_DIR}")
+ endif()
+endif()
+
+mark_as_advanced(ICONV_INCLUDE_DIR ICONV_LIBRARY HAVE_ICONV_FUNCTION)
diff --git a/cmake/modules/FindIso9660pp.cmake b/cmake/modules/FindIso9660pp.cmake
new file mode 100644
index 0000000..f98273b
--- /dev/null
+++ b/cmake/modules/FindIso9660pp.cmake
@@ -0,0 +1,45 @@
+#.rst:
+# FindIso9660pp
+# --------
+# Finds the iso9660++ library
+#
+# This will define the following variables::
+#
+# ISO9660PP_FOUND - system has iso9660++
+# ISO9660PP_INCLUDE_DIRS - the iso9660++ include directory
+# ISO9660PP_LIBRARIES - the iso9660++ libraries
+# ISO9660PP_DEFINITIONS - the iso9660++ definitions
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_ISO9660PP libiso9660++>=2.1.0 QUIET)
+ pkg_check_modules(PC_ISO9660 libiso9660>=2.1.0 QUIET)
+endif()
+
+find_package(Cdio)
+
+find_path(ISO9660PP_INCLUDE_DIR NAMES cdio++/iso9660.hpp
+ PATHS ${PC_ISO9660PP_INCLUDEDIR})
+
+find_library(ISO9660PP_LIBRARY NAMES libiso9660++ iso9660++
+ PATHS ${PC_ISO9660PP_LIBDIR})
+
+find_path(ISO9660_INCLUDE_DIR NAMES cdio/iso9660.h
+ PATHS ${PC_ISO9660_INCLUDEDIR})
+
+find_library(ISO9660_LIBRARY NAMES libiso9660 iso9660
+ PATHS ${PC_ISO9660_LIBDIR})
+
+set(ISO9660PP_VERSION ${PC_ISO9660PP_VERSION})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Iso9660pp
+ REQUIRED_VARS ISO9660PP_LIBRARY ISO9660PP_INCLUDE_DIR ISO9660_LIBRARY ISO9660_INCLUDE_DIR CDIO_LIBRARY CDIO_INCLUDE_DIR CDIOPP_INCLUDE_DIR
+ VERSION_VAR ISO9660PP_VERSION)
+
+if(ISO9660PP_FOUND)
+ set(ISO9660PP_LIBRARIES ${ISO9660PP_LIBRARY} ${ISO9660_LIBRARY} ${CDIO_LIBRARY})
+ set(ISO9660PP_INCLUDE_DIRS ${CDIO_INCLUDE_DIR} ${CDIOPP_INCLUDE_DIR} ${ISO9660_INCLUDE_DIR} ${ISO9660PP_INCLUDE_DIR})
+ set(ISO9660PP_DEFINITIONS -DHAS_ISO9660PP=1)
+endif()
+
+mark_as_advanced(ISO9660PP_INCLUDE_DIR ISO9660PP_LIBRARY ISO9660_INCLUDE_DIR ISO9660_LIBRARY)
diff --git a/cmake/modules/FindKissFFT.cmake b/cmake/modules/FindKissFFT.cmake
new file mode 100644
index 0000000..08a7020
--- /dev/null
+++ b/cmake/modules/FindKissFFT.cmake
@@ -0,0 +1,46 @@
+#.rst:
+# FindKissFFT
+# ------------
+# Finds the KissFFT as a Fast Fourier Transformation (FFT) library
+#
+# This will define the following variables:
+#
+# KISSFFT_FOUND - System has KissFFT
+# KISSFFT_INCLUDE_DIRS - the KissFFT include directory
+# KISSFFT_LIBRARIES - the KissFFT libraries
+#
+
+if(ENABLE_INTERNAL_KISSFFT)
+ # KissFFT is located in xbmc/contrib/kissfft
+ set(KISSFFT_FOUND TRUE)
+ set(KISSFFT_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/xbmc/contrib")
+ message(STATUS "Found KissFFT: ${KISSFFT_INCLUDE_DIRS}")
+else()
+ find_package(PkgConfig)
+ if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_KISSFFT kissfft QUIET)
+ endif()
+
+ find_path(KISSFFT_INCLUDE_DIR kissfft/kiss_fft.h kissfft/kiss_fftr.h
+ PATHS ${PC_KISSFFT_INCLUDEDIR})
+ find_library(KISSFFT_LIBRARY NAMES kissfft-float kissfft-int32 kissfft-int16 kissfft-simd
+ PATHS ${PC_KISSFFT_LIBDIR})
+
+ # Check if all REQUIRED_VARS are satisfied and set KISSFFT_FOUND
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(KissFFT REQUIRED_VARS KISSFFT_INCLUDE_DIR KISSFFT_LIBRARY)
+
+ if(KISSFFT_FOUND)
+ set(KISSFFT_INCLUDE_DIRS ${KISSFFT_INCLUDE_DIR})
+ set(KISSFFT_LIBRARIES ${KISSFFT_LIBRARY})
+
+ if(NOT TARGET kissfft)
+ add_library(kissfft UNKNOWN IMPORTED)
+ set_target_properties(kissfft PROPERTIES
+ IMPORTED_LOCATION "${KISSFFT_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${KISSFFT_INCLUDE_DIR}")
+ endif()
+ endif()
+
+ mark_as_advanced(KISSFFT_INCLUDE_DIR KISSFFT_LIBRARY)
+endif()
diff --git a/cmake/modules/FindLCMS2.cmake b/cmake/modules/FindLCMS2.cmake
new file mode 100644
index 0000000..d025158
--- /dev/null
+++ b/cmake/modules/FindLCMS2.cmake
@@ -0,0 +1,48 @@
+#.rst:
+# FindLCMS2
+# -----------
+# Finds the LCMS Color Management library
+#
+# This will define the following variables::
+#
+# LCMS2_FOUND - system has LCMS Color Management
+# LCMS2_INCLUDE_DIRS - the LCMS Color Management include directory
+# LCMS2_LIBRARIES - the LCMS Color Management libraries
+# LCMS2_DEFINITIONS - the LCMS Color Management definitions
+#
+# and the following imported targets::
+#
+# LCMS2::LCMS2 - The LCMS Color Management library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_LCMS2 lcms2>=2.10 QUIET)
+endif()
+
+find_path(LCMS2_INCLUDE_DIR NAMES lcms2.h
+ PATHS ${PC_LCMS2_INCLUDEDIR})
+find_library(LCMS2_LIBRARY NAMES lcms2 liblcms2
+ PATHS ${PC_LCMS2_LIBDIR})
+
+set(LCMS2_VERSION ${PC_LCMS2_VERSION})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(LCMS2
+ REQUIRED_VARS LCMS2_LIBRARY LCMS2_INCLUDE_DIR
+ VERSION_VAR LCMS2_VERSION)
+
+if(LCMS2_FOUND)
+ set(LCMS2_LIBRARIES ${LCMS2_LIBRARY})
+ set(LCMS2_INCLUDE_DIRS ${LCMS2_INCLUDE_DIR})
+ set(LCMS2_DEFINITIONS -DHAVE_LCMS2=1 -DCMS_NO_REGISTER_KEYWORD=1)
+
+ if(NOT TARGET LCMS2::LCMS2)
+ add_library(LCMS2::LCMS2 UNKNOWN IMPORTED)
+ set_target_properties(LCMS2::LCMS2 PROPERTIES
+ IMPORTED_LOCATION "${LCMS2_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${LCMS2_INCLUDE_DIR}"
+ INTERFACE_COMPILE_DEFINITIONS HAVE_LCMS2=1)
+ endif()
+endif()
+
+mark_as_advanced(LCMS2_INCLUDE_DIR LCMS2_LIBRARY)
+
diff --git a/cmake/modules/FindLLVM.cmake b/cmake/modules/FindLLVM.cmake
new file mode 100644
index 0000000..7b97aa0
--- /dev/null
+++ b/cmake/modules/FindLLVM.cmake
@@ -0,0 +1,19 @@
+#.rst:
+# FindLLVM
+# ----------
+# Finds llvm tools
+#
+
+find_program(LLVM_AR_EXECUTABLE NAMES llvm-ar llvm-ar-12 llvm-ar-11 llvm-ar-10 llvm-ar-9 llvm-ar-8)
+find_program(LLVM_NM_EXECUTABLE NAMES llvm-nm llvm-nm-12 llvm-nm-11 llvm-nm-10 llvm-nm-9 llvm-nm-8)
+find_program(LLVM_RANLIB_EXECUTABLE NAMES llvm-ranlib llvm-ranlib-12 llvm-ranlib-11 llvm-ranlib-10 llvm-ranlib-9 llvm-ranlib-8)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(LLVM REQUIRED_VARS LLVM_AR_EXECUTABLE LLVM_NM_EXECUTABLE LLVM_RANLIB_EXECUTABLE)
+
+if(LLVM_FOUND)
+ set(CMAKE_AR ${LLVM_AR_EXECUTABLE})
+ set(CMAKE_NM ${LLVM_NM_EXECUTABLE})
+ set(CMAKE_RANLIB ${LLVM_RANLIB_EXECUTABLE})
+endif()
+mark_as_advanced(CMAKE_AR CMAKE_NM CMAKE_RANLIB)
diff --git a/cmake/modules/FindLibAndroidJNI.cmake b/cmake/modules/FindLibAndroidJNI.cmake
new file mode 100644
index 0000000..506e70f
--- /dev/null
+++ b/cmake/modules/FindLibAndroidJNI.cmake
@@ -0,0 +1,40 @@
+# FindLibAndroidJNI
+# -------
+# Finds the LibAndroidJNI library
+#
+# This will define the following variables::
+#
+# LIBANDROIDJNI_FOUND - system has LibAndroidJNI
+# LIBANDROIDJNI_INCLUDE_DIRS - the LibAndroidJNI include directory
+# LIBANDROIDJNI_LIBRARIES - the LibAndroidJNI libraries
+#
+# and the following imported targets::
+#
+# libandroidjni - The LibAndroidJNI library
+
+include(cmake/scripts/common/ModuleHelpers.cmake)
+
+set(MODULE_LC libandroidjni)
+
+SETUP_BUILD_VARS()
+
+set(LIBANDROIDJNI_BUILD_TYPE Release)
+
+# We still need to supply SOMETHING to CMAKE_ARGS to initiate a cmake BUILD_DEP_TARGET
+# Setting cmake_build_type twice wont cause issues
+set(CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release)
+
+BUILD_DEP_TARGET()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(LibAndroidJNI
+ REQUIRED_VARS LIBANDROIDJNI_LIBRARY LIBANDROIDJNI_INCLUDE_DIR
+ VERSION_VAR LIBANDROIDJNI_VER)
+
+if(LIBANDROIDJNI_FOUND)
+ set(LIBANDROIDJNI_LIBRARIES ${LIBANDROIDJNI_LIBRARY})
+ set(LIBANDROIDJNI_INCLUDE_DIRS ${LIBANDROIDJNI_INCLUDE_DIR})
+
+ set_property(GLOBAL APPEND PROPERTY INTERNAL_DEPS_PROP libandroidjni)
+endif()
+mark_as_advanced(LIBANDROIDJNI_INCLUDE_DIR LIBANDROIDJNI_LIBRARY)
diff --git a/cmake/modules/FindLibDRM.cmake b/cmake/modules/FindLibDRM.cmake
new file mode 100644
index 0000000..f3ad769
--- /dev/null
+++ b/cmake/modules/FindLibDRM.cmake
@@ -0,0 +1,67 @@
+#.rst:
+# FindLibDRM
+# ----------
+# Finds the LibDRM library
+#
+# This will define the following variables::
+#
+# LIBDRM_FOUND - system has LibDRM
+# LIBDRM_INCLUDE_DIRS - the LibDRM include directory
+# LIBDRM_LIBRARIES - the LibDRM libraries
+# LIBDRM_DEFINITIONS - the LibDRM definitions
+#
+# and the following imported targets::
+#
+# LibDRM::LibDRM - The LibDRM library
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_LIBDRM libdrm>=2.4.95 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)
+
+include(CheckCSourceCompiles)
+set(CMAKE_REQUIRED_INCLUDES ${LIBDRM_INCLUDE_DIR})
+check_c_source_compiles("#include <drm_mode.h>
+
+ int main()
+ {
+ struct hdr_output_metadata test;
+ return test.metadata_type;
+ }
+ " LIBDRM_HAS_HDR_OUTPUT_METADATA)
+
+include(CheckSymbolExists)
+set(CMAKE_REQUIRED_LIBRARIES ${LIBDRM_LIBRARY})
+check_symbol_exists(drmGetFormatModifierName xf86drm.h LIBDRM_HAS_MODIFIER_NAME)
+
+if(LIBDRM_FOUND)
+ set(LIBDRM_LIBRARIES ${LIBDRM_LIBRARY})
+ set(LIBDRM_INCLUDE_DIRS ${LIBDRM_INCLUDE_DIR})
+ if(LIBDRM_HAS_HDR_OUTPUT_METADATA)
+ set(LIBDRM_DEFINITIONS -DHAVE_HDR_OUTPUT_METADATA=1)
+ endif()
+ if(LIBDRM_HAS_MODIFIER_NAME)
+ list(APPEND LIBDRM_DEFINITIONS -DHAVE_DRM_MODIFIER_NAME=1)
+ endif()
+
+ 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 0000000..6853e84
--- /dev/null
+++ b/cmake/modules/FindLibDvd.cmake
@@ -0,0 +1,32 @@
+
+# Check for existing LIBDVDREAD.
+# Suppress mismatch warning, see https://cmake.org/cmake/help/latest/module/FindPackageHandleStandardArgs.html
+set(FPHSA_NAME_MISMATCHED 1)
+find_package(LibDvdNav MODULE REQUIRED)
+unset(FPHSA_NAME_MISMATCHED)
+
+set(_dvdlibs ${LIBDVDREAD_LIBRARY} ${LIBDVDCSS_LIBRARY})
+
+if(NOT CORE_SYSTEM_NAME MATCHES windows)
+ # 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(${LIBDVDNAV_LIBRARY} system/players/VideoPlayer/libdvdnav libdvdnav archives "${_dvdlibs}")
+else()
+ set(LIBDVD_TARGET_DIR .)
+ if(CORE_SYSTEM_NAME STREQUAL windowsstore)
+ set(LIBDVD_TARGET_DIR dlls)
+ endif()
+ copy_file_to_buildtree(${DEPENDS_PATH}/bin/libdvdnav.dll DIRECTORY ${LIBDVD_TARGET_DIR})
+ add_dependencies(export-files LibDvdNav::LibDvdNav)
+endif()
+
+set(LIBDVD_INCLUDE_DIRS ${LIBDVDREAD_INCLUDE_DIR} ${LIBDVDNAV_INCLUDE_DIR})
+set(LIBDVD_LIBRARIES ${LIBDVDNAV_LIBRARY} ${LIBDVDREAD_LIBRARY})
+if(TARGET LibDvdCSS::LibDvdCSS)
+ list(APPEND LIBDVD_LIBRARIES ${LIBDVDCSS_LIBRARY})
+ list(APPEND LIBDVD_INCLUDE_DIRS ${LIBDVDCSS_INCLUDE_DIR})
+endif()
+set(LIBDVD_LIBRARIES ${LIBDVD_LIBRARIES} CACHE STRING "libdvd libraries" FORCE)
+set(LIBDVD_FOUND 1 CACHE BOOL "libdvd found" FORCE)
+
+mark_as_advanced(LIBDVD_INCLUDE_DIRS LIBDVD_LIBRARIES)
diff --git a/cmake/modules/FindLibDvdCSS.cmake b/cmake/modules/FindLibDvdCSS.cmake
new file mode 100644
index 0000000..38c5538
--- /dev/null
+++ b/cmake/modules/FindLibDvdCSS.cmake
@@ -0,0 +1,123 @@
+#.rst:
+# FindLibDvdCSS
+# ----------
+# Finds the libdvdcss library
+#
+# This will define the following variables::
+#
+# LIBDVDCSS_FOUND - system has LibDvdCSS
+# LIBDVDCSS_INCLUDE_DIRS - the LibDvdCSS include directory
+# LIBDVDCSS_LIBRARIES - the LibDvdCSS libraries
+#
+# and the following imported targets::
+#
+# LibDvdCSS::LibDvdCSS - The LibDvdCSS library
+
+if(ENABLE_DVDCSS)
+ include(cmake/scripts/common/ModuleHelpers.cmake)
+
+ set(MODULE_LC libdvdcss)
+
+ # We require this due to the odd nature of github URL's compared to our other tarball
+ # mirror system. If User sets LIBDVDCSS_URL or libdvdcss_URL, allow get_filename_component in SETUP_BUILD_VARS
+ if(LIBDVDCSS_URL OR ${MODULE_LC}_URL)
+ if(${MODULE_LC}_URL)
+ set(LIBDVDCSS_URL ${${MODULE_LC}_URL})
+ endif()
+ set(LIBDVDCSS_URL_PROVIDED TRUE)
+ endif()
+
+ SETUP_BUILD_VARS()
+
+ if(NOT LIBDVDCSS_URL_PROVIDED)
+ # override LIBDVDCSS_URL_PROVIDED due to tar naming when retrieved from github release
+ set(LIBDVDCSS_URL ${LIBDVDCSS_BASE_URL}/archive/${LIBDVDCSS_VER}.tar.gz)
+ endif()
+
+ set(LIBDVDCSS_VERSION ${${MODULE}_VER})
+
+ 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)
+ elseif(ARCH STREQUAL x86_64)
+ set(HOST_ARCH x86_64-linux-android)
+ endif()
+ elseif(CORE_SYSTEM_NAME STREQUAL windowsstore)
+ set(LIBDVD_ADDITIONAL_ARGS "-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}" "-DCMAKE_SYSTEM_VERSION=${CMAKE_SYSTEM_VERSION}")
+ set(${MODULE}_CXX_FLAGS "/Zc:twoPhase-")
+ endif()
+
+ if(APPLE)
+ set(LIBDVDCSS_FLAGS " -framework CoreFoundation")
+ if(NOT CORE_SYSTEM_NAME STREQUAL darwin_embedded)
+ string(APPEND LIBDVDCSS_FLAGS " -framework IOKit")
+ endif()
+ endif()
+
+ if(CORE_SYSTEM_NAME MATCHES windows)
+ set(CMAKE_ARGS -DDUMMY_DEFINE=ON
+ ${LIBDVD_ADDITIONAL_ARGS})
+ else()
+ find_program(AUTORECONF autoreconf REQUIRED)
+ find_program(MAKE_EXECUTABLE make REQUIRED)
+
+ set(CONFIGURE_COMMAND ${AUTORECONF} -vif
+ COMMAND ac_cv_path_GIT= ./configure
+ --target=${HOST_ARCH}
+ --host=${HOST_ARCH}
+ --disable-doc
+ --enable-static
+ --disable-shared
+ --with-pic
+ --prefix=${DEPENDS_PATH}
+ --libdir=${DEPENDS_PATH}/lib
+ "CC=${CMAKE_C_COMPILER}"
+ "CFLAGS=${CMAKE_C_FLAGS}"
+ "LDFLAGS=${CMAKE_EXE_LINKER_FLAGS} ${LIBDVDCSS_FLAGS}")
+ set(BUILD_COMMAND ${MAKE_EXECUTABLE})
+ set(INSTALL_COMMAND ${MAKE_EXECUTABLE} install)
+ set(BUILD_IN_SOURCE 1)
+ endif()
+
+ BUILD_DEP_TARGET()
+
+endif()
+
+include(SelectLibraryConfigurations)
+select_library_configurations(LibDvdCSS)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(LibDvdCSS
+ REQUIRED_VARS LIBDVDCSS_LIBRARY LIBDVDCSS_INCLUDE_DIR
+ VERSION_VAR LIBDVDCSS_VERSION)
+
+if(LIBDVDCSS_FOUND)
+ set(LIBDVDCSS_INCLUDE_DIRS ${LIBDVDCSS_INCLUDE_DIR})
+ set(LIBDVDCSS_LIBRARIES ${LIBDVDCSS_LIBRARY})
+ set(LIBDVDCSS_DEFINITIONS -DHAVE_DVDCSS_DVDCSS_H)
+
+ if(NOT TARGET LibDvdCSS::LibDvdCSS)
+ add_library(LibDvdCSS::LibDvdCSS UNKNOWN IMPORTED)
+
+ set_target_properties(LibDvdCSS::LibDvdCSS PROPERTIES
+ IMPORTED_LOCATION "${LIBDVDCSS_LIBRARY}"
+ INTERFACE_COMPILE_DEFINITIONS "${LIBDVDCSS_DEFINITIONS}"
+ INTERFACE_INCLUDE_DIRECTORIES "${LIBDVDCSS_INCLUDE_DIR}")
+
+ if(TARGET libdvdcss)
+ add_dependencies(LibDvdCSS::LibDvdCSS libdvdcss)
+ endif()
+ endif()
+
+else()
+ if(LIBDVDCSS_FIND_REQUIRED)
+ message(FATAL_ERROR "Libdvdcss not found. Possibly remove ENABLE_DVDCSS.")
+ endif()
+endif()
+
+mark_as_advanced(LIBDVDCSS_INCLUDE_DIR LIBDVDCSS_LIBRARY)
diff --git a/cmake/modules/FindLibDvdNav.cmake b/cmake/modules/FindLibDvdNav.cmake
new file mode 100644
index 0000000..681610e
--- /dev/null
+++ b/cmake/modules/FindLibDvdNav.cmake
@@ -0,0 +1,146 @@
+#.rst:
+# FindLibDvdNav
+# ----------
+# Finds the dvdnav library
+#
+# This will define the following variables::
+#
+# LIBDVDNAV_FOUND - system has LibDvdNav
+# LIBDVDNAV_INCLUDE_DIRS - the LibDvdNav include directory
+# LIBDVDNAV_LIBRARIES - the LibDvdNav libraries
+#
+# and the following imported targets::
+#
+# LibDvdNav::LibDvdNav - The LibDvdNav library
+
+if(NOT TARGET LibDvdNav::LibDvdNav)
+
+ # Check for existing LibDvdRead.
+ # Suppress mismatch warning, see https://cmake.org/cmake/help/latest/module/FindPackageHandleStandardArgs.html
+ set(FPHSA_NAME_MISMATCHED 1)
+ find_package(LibDvdRead MODULE REQUIRED)
+ unset(FPHSA_NAME_MISMATCHED)
+
+ include(cmake/scripts/common/ModuleHelpers.cmake)
+
+ set(MODULE_LC libdvdnav)
+
+ # We require this due to the odd nature of github URL's compared to our other tarball
+ # mirror system. If User sets LIBDVDNAV_URL or libdvdnav_URL, allow get_filename_component in SETUP_BUILD_VARS
+ if(LIBDVDNAV_URL OR ${MODULE_LC}_URL)
+ if(${MODULE_LC}_URL)
+ set(LIBDVDNAV_URL ${${MODULE_LC}_URL})
+ endif()
+ set(LIBDVDNAV_URL_PROVIDED TRUE)
+ endif()
+
+ SETUP_BUILD_VARS()
+
+ if(NOT LIBDVDNAV_URL_PROVIDED)
+ # override LIBDVDNAV_URL due to tar naming when retrieved from github release
+ set(LIBDVDNAV_URL ${LIBDVDNAV_BASE_URL}/archive/${LIBDVDNAV_VER}.tar.gz)
+ endif()
+
+ set(LIBDVDNAV_VERSION ${${MODULE}_VER})
+
+ 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)
+ elseif(ARCH STREQUAL x86_64)
+ set(HOST_ARCH x86_64-linux-android)
+ endif()
+ elseif(CORE_SYSTEM_NAME STREQUAL windowsstore)
+ set(LIBDVD_ADDITIONAL_ARGS "-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}" "-DCMAKE_SYSTEM_VERSION=${CMAKE_SYSTEM_VERSION}")
+ endif()
+
+ string(APPEND LIBDVDNAV_CFLAGS "-D_XBMC")
+
+ if(APPLE)
+ set(LIBDVDNAV_LDFLAGS "-framework CoreFoundation")
+ string(APPEND LIBDVDNAV_CFLAGS " -D__DARWIN__")
+ if(NOT CORE_SYSTEM_NAME STREQUAL darwin_embedded)
+ string(APPEND LIBDVDNAV_LDFLAGS " -framework IOKit")
+ endif()
+ endif()
+
+ if(CORE_SYSTEM_NAME MATCHES windows)
+ set(CMAKE_ARGS -DDUMMY_DEFINE=ON
+ ${LIBDVD_ADDITIONAL_ARGS})
+ else()
+
+ string(APPEND LIBDVDNAV_CFLAGS " -I$<TARGET_PROPERTY:LibDvdRead::LibDvdRead,INTERFACE_INCLUDE_DIRECTORIES> $<TARGET_PROPERTY:LibDvdRead::LibDvdRead,INTERFACE_COMPILE_DEFINITIONS>")
+
+ find_program(AUTORECONF autoreconf REQUIRED)
+ find_program(MAKE_EXECUTABLE make REQUIRED)
+
+ set(CONFIGURE_COMMAND ${AUTORECONF} -vif
+ COMMAND ac_cv_path_GIT= ./configure
+ --target=${HOST_ARCH}
+ --host=${HOST_ARCH}
+ --enable-static
+ --disable-shared
+ --with-pic
+ --prefix=${DEPENDS_PATH}
+ --libdir=${DEPENDS_PATH}/lib
+ "CC=${CMAKE_C_COMPILER}"
+ "CFLAGS=${CMAKE_C_FLAGS} ${LIBDVDNAV_CFLAGS}"
+ "LDFLAGS=${CMAKE_EXE_LINKER_FLAGS} ${LIBDVDNAV_LDFLAGS}"
+ "PKG_CONFIG_PATH=${DEPENDS_PATH}/lib/pkgconfig")
+
+ set(BUILD_COMMAND ${MAKE_EXECUTABLE})
+ set(INSTALL_COMMAND ${MAKE_EXECUTABLE} install)
+ set(BUILD_IN_SOURCE 1)
+ endif()
+
+ BUILD_DEP_TARGET()
+
+ if(TARGET LibDvdRead::LibDvdRead)
+ add_dependencies(libdvdnav LibDvdRead::LibDvdRead)
+ endif()
+endif()
+
+include(SelectLibraryConfigurations)
+select_library_configurations(LibDvdNav)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(LibDvdNav
+ REQUIRED_VARS LIBDVDNAV_LIBRARY LIBDVDNAV_INCLUDE_DIR
+ VERSION_VAR LIBDVDNAV_VERSION)
+
+if(LIBDVDNAV_FOUND)
+ set(LIBDVDNAV_INCLUDE_DIRS ${LIBDVDNAV_INCLUDE_DIR})
+ set(LIBDVDNAV_LIBRARIES ${LIBDVDNAV_LIBRARY})
+ set(LIBDVDNAV_DEFINITIONS -D_XBMC)
+
+ if(APPLE)
+ string(APPEND LIBDVDNAV_DEFINITIONS " -D__DARWIN__")
+ endif()
+
+ if(NOT TARGET LibDvdNav::LibDvdNav)
+ add_library(LibDvdNav::LibDvdNav UNKNOWN IMPORTED)
+
+ set_target_properties(LibDvdNav::LibDvdNav PROPERTIES
+ IMPORTED_LOCATION "${LIBDVDNAV_LIBRARY}"
+ INTERFACE_COMPILE_DEFINITIONS "${LIBDVDNAV_DEFINITIONS}"
+ INTERFACE_INCLUDE_DIRECTORIES "${LIBDVDNAV_INCLUDE_DIR}")
+
+ if(TARGET libdvdnav)
+ add_dependencies(LibDvdNav::LibDvdNav libdvdnav)
+ endif()
+ if(TARGET LibDvdRead::LibDvdRead)
+ add_dependencies(LibDvdNav::LibDvdNav LibDvdRead::LibDvdRead)
+ endif()
+ endif()
+ set_property(GLOBAL APPEND PROPERTY INTERNAL_DEPS_PROP LibDvdNav::LibDvdNav)
+else()
+ if(LIBDVDNAV_FIND_REQUIRED)
+ message(FATAL_ERROR "Libdvdnav not found")
+ endif()
+endif()
+
+mark_as_advanced(LIBDVDNAV_INCLUDE_DIR LIBDVDNAV_LIBRARY)
diff --git a/cmake/modules/FindLibDvdRead.cmake b/cmake/modules/FindLibDvdRead.cmake
new file mode 100644
index 0000000..d7e8e88
--- /dev/null
+++ b/cmake/modules/FindLibDvdRead.cmake
@@ -0,0 +1,154 @@
+#.rst:
+# FindLibDvdRead
+# ----------
+# Finds the dvdread library
+#
+# This will define the following variables::
+#
+# LIBDVDREAD_FOUND - system has LibDvdRead
+# LIBDVDREAD_INCLUDE_DIRS - the LibDvdRead include directory
+# LIBDVDREAD_LIBRARIES - the LibDvdRead libraries
+#
+# and the following imported targets::
+#
+# LibDvdRead::LibDvdRead - The LibDvdRead library
+
+if(NOT TARGET LibDvdRead::LibDvdRead)
+
+ if(ENABLE_DVDCSS)
+ # Check for existing LIBDVDCSS.
+ # Suppress mismatch warning, see https://cmake.org/cmake/help/latest/module/FindPackageHandleStandardArgs.html
+ set(FPHSA_NAME_MISMATCHED 1)
+ find_package(LibDvdCSS MODULE REQUIRED)
+ unset(FPHSA_NAME_MISMATCHED)
+ endif()
+
+ include(cmake/scripts/common/ModuleHelpers.cmake)
+
+ set(MODULE_LC libdvdread)
+
+ # We require this due to the odd nature of github URL's compared to our other tarball
+ # mirror system. If User sets LIBDVDREAD_URL or libdvdread_URL, allow get_filename_component in SETUP_BUILD_VARS
+ if(LIBDVDREAD_URL OR ${MODULE_LC}_URL)
+ if(${MODULE_LC}_URL)
+ set(LIBDVDREAD_URL ${${MODULE_LC}_URL})
+ endif()
+ set(LIBDVDREAD_URL_PROVIDED TRUE)
+ endif()
+
+ SETUP_BUILD_VARS()
+
+ if(NOT LIBDVDREAD_URL_PROVIDED)
+ # override LIBDVDREAD_URL due to tar naming when retrieved from github release
+ set(LIBDVDREAD_URL ${LIBDVDREAD_BASE_URL}/archive/${LIBDVDREAD_VER}.tar.gz)
+ endif()
+
+ set(LIBDVDREAD_VERSION ${${MODULE}_VER})
+
+ 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)
+ elseif(ARCH STREQUAL x86_64)
+ set(HOST_ARCH x86_64-linux-android)
+ endif()
+ elseif(CORE_SYSTEM_NAME STREQUAL windowsstore)
+ set(LIBDVD_ADDITIONAL_ARGS "-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}" "-DCMAKE_SYSTEM_VERSION=${CMAKE_SYSTEM_VERSION}")
+ endif()
+
+ string(APPEND LIBDVDREAD_CFLAGS "-D_XBMC")
+
+ if(APPLE)
+ set(LIBDVDREAD_LDFLAGS "-framework CoreFoundation")
+ string(APPEND LIBDVDREAD_CFLAGS " -D__DARWIN__")
+ if(NOT CORE_SYSTEM_NAME STREQUAL darwin_embedded)
+ string(APPEND LIBDVDREAD_LDFLAGS " -framework IOKit")
+ endif()
+ endif()
+
+ if(CORE_SYSTEM_NAME MATCHES windows)
+ set(CMAKE_ARGS -DDUMMY_DEFINE=ON
+ ${LIBDVD_ADDITIONAL_ARGS})
+ else()
+
+ if(TARGET LibDvdCSS::LibDvdCSS)
+ string(APPEND LIBDVDREAD_CFLAGS " -I$<TARGET_PROPERTY:LibDvdCSS::LibDvdCSS,INTERFACE_INCLUDE_DIRECTORIES> $<TARGET_PROPERTY:LibDvdCSS::LibDvdCSS,INTERFACE_COMPILE_DEFINITIONS>")
+ string(APPEND with-css "--with-libdvdcss")
+ endif()
+
+ find_program(AUTORECONF autoreconf REQUIRED)
+ find_program(MAKE_EXECUTABLE make REQUIRED)
+
+ set(CONFIGURE_COMMAND ${AUTORECONF} -vif
+ COMMAND ac_cv_path_GIT= ./configure
+ --target=${HOST_ARCH}
+ --host=${HOST_ARCH}
+ --enable-static
+ --disable-shared
+ --with-pic
+ --prefix=${DEPENDS_PATH}
+ --libdir=${DEPENDS_PATH}/lib
+ ${with-css}
+ "CC=${CMAKE_C_COMPILER}"
+ "CFLAGS=${CMAKE_C_FLAGS} ${LIBDVDREAD_CFLAGS}"
+ "LDFLAGS=${CMAKE_EXE_LINKER_FLAGS} ${LIBDVDREAD_LDFLAGS}"
+ "PKG_CONFIG_PATH=${DEPENDS_PATH}/lib/pkgconfig")
+
+ set(BUILD_COMMAND ${MAKE_EXECUTABLE})
+ set(INSTALL_COMMAND ${MAKE_EXECUTABLE} install)
+ set(BUILD_IN_SOURCE 1)
+ endif()
+
+ BUILD_DEP_TARGET()
+
+ if(TARGET LibDvdCSS::LibDvdCSS)
+ add_dependencies(libdvdread LibDvdCSS::LibDvdCSS)
+ endif()
+endif()
+
+include(SelectLibraryConfigurations)
+select_library_configurations(LibDvdRead)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(LibDvdRead
+ REQUIRED_VARS LIBDVDREAD_LIBRARY LIBDVDREAD_INCLUDE_DIR
+ VERSION_VAR LIBDVDREAD_VERSION)
+
+if(LIBDVDREAD_FOUND)
+ set(LIBDVDREAD_INCLUDE_DIRS ${LIBDVDREAD_INCLUDE_DIR})
+ set(LIBDVDREAD_LIBRARIES ${LIBDVDREAD_LIBRARY})
+ set(LIBDVDREAD_DEFINITIONS -D_XBMC)
+
+ if(APPLE)
+ string(APPEND LIBDVDREAD_DEFINITIONS " -D__DARWIN__")
+ endif()
+
+ if(NOT TARGET LibDvdRead::LibDvdRead)
+ add_library(LibDvdRead::LibDvdRead UNKNOWN IMPORTED)
+
+ set_target_properties(LibDvdRead::LibDvdRead PROPERTIES
+ IMPORTED_LOCATION "${LIBDVDREAD_LIBRARY}"
+ INTERFACE_COMPILE_DEFINITIONS "${LIBDVDREAD_DEFINITIONS}"
+ INTERFACE_INCLUDE_DIRECTORIES "${LIBDVDREAD_INCLUDE_DIR}")
+
+ if(TARGET libdvdread)
+ add_dependencies(LibDvdRead::LibDvdRead libdvdread)
+ endif()
+ if(TARGET LibDvdCSS::LibDvdCSS)
+ add_dependencies(LibDvdRead::LibDvdRead LibDvdCSS::LibDvdCSS)
+ set_target_properties(LibDvdRead::LibDvdRead PROPERTIES
+ INTERFACE_LINK_LIBRARIES "-ldvdcss")
+ endif()
+ endif()
+
+else()
+ if(LIBDVDREAD_FIND_REQUIRED)
+ message(FATAL_ERROR "Libdvdread not found")
+ endif()
+endif()
+
+mark_as_advanced(LIBDVDREAD_INCLUDE_DIR LIBDVDREAD_LIBRARY)
diff --git a/cmake/modules/FindLibInput.cmake b/cmake/modules/FindLibInput.cmake
new file mode 100644
index 0000000..069df5f
--- /dev/null
+++ b/cmake/modules/FindLibInput.cmake
@@ -0,0 +1,36 @@
+#.rst:
+# FindLibinput
+# --------
+# Finds the libinput library
+#
+# This will define the following variables::
+#
+# LIBINPUT_FOUND - system has libinput
+# LIBINPUT_INCLUDE_DIRS - the libinput include directory
+# LIBINPUT_LIBRARIES - the libinput libraries
+# LIBINPUT_DEFINITIONS - the libinput compile definitions
+#
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_LIBINPUT libinput QUIET)
+endif()
+
+find_path(LIBINPUT_INCLUDE_DIR NAMES libinput.h
+ PATHS ${PC_LIBINPUT_INCLUDEDIR})
+
+find_library(LIBINPUT_LIBRARY NAMES input
+ PATHS ${PC_LIBINPUT_LIBDIR})
+
+set(LIBINPUT_VERSION ${PC_LIBINPUT_VERSION})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(LibInput
+ REQUIRED_VARS LIBINPUT_LIBRARY LIBINPUT_INCLUDE_DIR
+ VERSION_VAR LIBINPUT_VERSION)
+
+if(LIBINPUT_FOUND)
+ set(LIBINPUT_INCLUDE_DIRS ${LIBINPUT_INCLUDE_DIR})
+ set(LIBINPUT_LIBRARIES ${LIBINPUT_LIBRARY})
+endif()
+
+mark_as_advanced(LIBINPUT_INCLUDE_DIR LIBINPUT_LIBRARY)
diff --git a/cmake/modules/FindLibUSB.cmake b/cmake/modules/FindLibUSB.cmake
new file mode 100644
index 0000000..7bf3a92
--- /dev/null
+++ b/cmake/modules/FindLibUSB.cmake
@@ -0,0 +1,45 @@
+#.rst:
+# FindLibUSB
+# ----------
+# Finds the USB library
+#
+# This 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 0000000..d6e389a
--- /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 appropriate
+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/FindLibZip.cmake b/cmake/modules/FindLibZip.cmake
new file mode 100644
index 0000000..df2d042
--- /dev/null
+++ b/cmake/modules/FindLibZip.cmake
@@ -0,0 +1,74 @@
+#.rst:
+# FindLibZip
+# -----------
+# Finds the LibZip library
+#
+# This will define the following variables::
+#
+# LIBZIP_FOUND - system has LibZip
+# LIBZIP_INCLUDE_DIRS - the LibZip include directory
+# LIBZIP_LIBRARIES - the LibZip libraries
+#
+# and the following imported targets:
+#
+# libzip::zip - The LibZip library
+
+include(cmake/scripts/common/ModuleHelpers.cmake)
+
+set(MODULE_LC libzip)
+SETUP_BUILD_VARS()
+
+# Check for existing lib
+find_package(LIBZIP CONFIG QUIET)
+
+if(NOT LIBZIP_FOUND OR LIBZIP_VERSION VERSION_LESS ${${MODULE}_VER})
+ # Check for dependencies
+ find_package(GnuTLS MODULE REQUIRED)
+
+ # Eventually we will want Find modules for the following deps
+ # bzip2
+ # ZLIB
+
+ set(CMAKE_ARGS -DBUILD_DOC=OFF
+ -DBUILD_EXAMPLES=OFF
+ -DBUILD_REGRESS=OFF
+ -DBUILD_SHARED_LIBS=OFF
+ -DBUILD_TOOLS=OFF)
+
+ set(LIBZIP_VERSION ${${MODULE}_VER})
+
+ BUILD_DEP_TARGET()
+else()
+ find_path(LIBZIP_INCLUDE_DIR NAMES zip.h)
+
+ find_library(LIBZIP_LIBRARY NAMES zip)
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(LibZip
+ REQUIRED_VARS LIBZIP_LIBRARY LIBZIP_INCLUDE_DIR
+ VERSION_VAR LIBZIP_VERSION)
+
+if(LIBZIP_FOUND)
+ set(LIBZIP_LIBRARIES ${LIBZIP_LIBRARY})
+ set(LIBZIP_INCLUDE_DIRS ${LIBZIP_INCLUDE_DIR})
+
+ if(NOT TARGET libzip::zip)
+ add_library(libzip::zip UNKNOWN IMPORTED)
+
+ set_target_properties(libzip::zip PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${LIBZIP_INCLUDE_DIR}"
+ IMPORTED_LOCATION "${LIBZIP_LIBRARY}")
+
+ if(TARGET libzip)
+ add_dependencies(libzip::zip libzip)
+ endif()
+ endif()
+ set_property(GLOBAL APPEND PROPERTY INTERNAL_DEPS_PROP libzip::zip)
+else()
+ if(LIBZIP_FIND_REQUIRED)
+ message(FATAL_ERROR "LibZip not found.")
+ endif()
+endif()
+
+mark_as_advanced(LIBZIP_INCLUDE_DIR LIBZIP_LIBRARY)
diff --git a/cmake/modules/FindLircClient.cmake b/cmake/modules/FindLircClient.cmake
new file mode 100644
index 0000000..c469af5
--- /dev/null
+++ b/cmake/modules/FindLircClient.cmake
@@ -0,0 +1,36 @@
+# FindLircClient
+# -----------
+# Finds the liblirc_client library
+#
+# This will define the following variables::
+#
+# LIRCCLIENT_FOUND - if false, do not try to link to lirc_client
+# LIRCCLIENT_INCLUDE_DIRS - where to find lirc/lirc_client.h
+# LIRCCLIENT_LIBRARYS - the library to link against
+# LIRCCLIENT_DEFINITIONS - the lirc definitions
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_LIRC lirc QUIET)
+endif()
+
+find_path(LIRCCLIENT_INCLUDE_DIR lirc/lirc_client.h PATHS ${PC_LIRC_INCLUDEDIR})
+find_library(LIRCCLIENT_LIBRARY lirc_client PATHS ${PC_LIRC_LIBDIR})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(LircClient
+ REQUIRED_VARS LIRCCLIENT_LIBRARY LIRCCLIENT_INCLUDE_DIR)
+
+if(LIRCCLIENT_FOUND)
+ set(LIRCCLIENT_LIBRARIES ${LIRCCLIENT_LIBRARY})
+ set(LIRCCLIENT_INCLUDE_DIRS ${LIRCCLIENT_INCLUDE_DIR})
+ set(LIRCCLIENT_DEFINITIONS -DHAS_LIRC=1)
+
+ if(NOT TARGET LIRCCLIENT::LIRCCLIENT)
+ add_library(LIRCCLIENT::LIRCCLIENT UNKNOWN IMPORTED)
+ set_target_properties(LIRCCLIENT::LIRCCLIENT PROPERTIES
+ IMPORTED_LOCATION "${LIRCCLIENT_LIBRARYS}"
+ INTERFACE_INCLUDE_DIRECTORIES "${LIRCCLIENT_INCLUDE_DIRS}")
+ endif()
+endif()
+
+mark_as_advanced(LIRCCLIENT_LIBRARY LIRCCLIENT_INCLUDE_DIR) \ No newline at end of file
diff --git a/cmake/modules/FindLzo2.cmake b/cmake/modules/FindLzo2.cmake
new file mode 100644
index 0000000..5e3e686
--- /dev/null
+++ b/cmake/modules/FindLzo2.cmake
@@ -0,0 +1,37 @@
+#.rst:
+# FindLzo2
+# --------
+# Finds the Lzo2 library
+#
+# This 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/FindMDNS.cmake b/cmake/modules/FindMDNS.cmake
new file mode 100644
index 0000000..c2574c8
--- /dev/null
+++ b/cmake/modules/FindMDNS.cmake
@@ -0,0 +1,47 @@
+#.rst:
+# FindMDNS
+# --------
+# Finds the mDNS library
+#
+# This will define the following variables::
+#
+# MDNS_FOUND - system has mDNS
+# MDNS_INCLUDE_DIRS - the mDNS include directory
+# MDNS_LIBRARIES - the mDNS libraries
+# MDNS_DEFINITIONS - the mDNS definitions
+#
+# and the following imported targets::
+#
+# MDNS::MDNS - The mDNSlibrary
+
+find_path(MDNS_INCLUDE_DIR NAMES dmDnsEmbedded.h dns_sd.h)
+find_library(MDNS_LIBRARY NAMES mDNSEmbedded dnssd)
+
+find_path(MDNS_EMBEDDED_INCLUDE_DIR NAMES mDnsEmbedded.h)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(MDNS
+ REQUIRED_VARS MDNS_LIBRARY MDNS_INCLUDE_DIR)
+
+if(MDNS_FOUND)
+ set(MDNS_INCLUDE_DIRS ${MDNS_INCLUDE_DIR})
+ set(MDNS_LIBRARIES ${MDNS_LIBRARY})
+ set(MDNS_DEFINITIONS -DHAS_MDNS=1 -DHAS_ZEROCONF=1)
+ if(MDNS_EMBEDDED_INCLUDE_DIR)
+ list(APPEND MDNS_DEFINITIONS -DHAS_MDNS_EMBEDDED=1)
+ endif()
+
+ if(NOT TARGET MDNS::MDNS)
+ add_library(MDNS::MDNS UNKNOWN IMPORTED)
+ set_target_properties(MDNS::MDNS PROPERTIES
+ IMPORTED_LOCATION "${MDNS_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${MDNS_INCLUDE_DIR}"
+ INTERFACE_COMPILE_DEFINITIONS HAS_MDNS=1)
+ if(MDNS_EMBEDDED_INCLUDE_DIR)
+ set_target_properties(MDNS::MDNS PROPERTIES
+ INTERFACE_COMPILE_DEFINITIONS HAS_MDNS_EMBEDDED=1)
+ endif()
+ endif()
+endif()
+
+mark_as_advanced(MDNS_INCLUDE_DIR MDNS_EMBEDDED_INCLUDE_DIR MDNS_LIBRARY)
diff --git a/cmake/modules/FindMariaDBClient.cmake b/cmake/modules/FindMariaDBClient.cmake
new file mode 100644
index 0000000..1160e26
--- /dev/null
+++ b/cmake/modules/FindMariaDBClient.cmake
@@ -0,0 +1,83 @@
+#.rst:
+# FindMariaDBClient
+# ---------------
+# Finds the MariaDBClient library
+#
+# This will define the following variables::
+#
+# MARIADBCLIENT_FOUND - system has MariaDBClient
+# MARIADBCLIENT_INCLUDE_DIRS - the MariaDBClient include directory
+# MARIADBCLIENT_LIBRARIES - the MariaDBClient libraries
+# MARIADBCLIENT_DEFINITIONS - the MariaDBClient compile definitions
+#
+# and the following imported targets::
+#
+# MariaDBClient::MariaDBClient - The MariaDBClient 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()
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_MARIADBCLIENT mariadb QUIET)
+endif()
+
+
+find_path(MARIADBCLIENT_INCLUDE_DIR NAMES mariadb/mysql.h mariadb/server/mysql.h
+ PATHS ${PC_MARIADBCLIENT_INCLUDEDIR})
+find_library(MARIADBCLIENT_LIBRARY_RELEASE NAMES mariadbclient mariadb libmariadb
+ PATHS ${PC_MARIADBCLIENT_LIBDIR}
+ PATH_SUFFIXES mariadb
+ ${EXTRA_FIND_ARGS})
+find_library(MARIADBCLIENT_LIBRARY_DEBUG NAMES mariadbclient mariadb libmariadbd
+ PATHS ${PC_MARIADBCLIENT_LIBDIR}
+ PATH_SUFFIXES mariadb
+ ${EXTRA_FIND_ARGS})
+
+if(PC_MARIADBCLIENT_VERSION)
+ set(MARIADBCLIENT_VERSION_STRING ${PC_MARIADBCLIENT_VERSION})
+elseif(MARIADBCLIENT_INCLUDE_DIR AND EXISTS "${MARIADBCLIENT_INCLUDE_DIR}/mariadb/mariadb_version.h")
+ file(STRINGS "${MARIADBCLIENT_INCLUDE_DIR}/mariadb/mariadb_version.h" mariadb_version_str REGEX "^#define[\t ]+MARIADB_CLIENT_VERSION_STR[\t ]+\".*\".*")
+ string(REGEX REPLACE "^#define[\t ]+MARIADB_CLIENT_VERSION_STR[\t ]+\"([^\"]+)\".*" "\\1" MARIADBCLIENT_VERSION_STRING "${mariadb_version_str}")
+ unset(mariadb_version_str)
+endif()
+
+include(SelectLibraryConfigurations)
+select_library_configurations(MARIADBCLIENT)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(MariaDBClient
+ REQUIRED_VARS MARIADBCLIENT_LIBRARY MARIADBCLIENT_INCLUDE_DIR
+ VERSION_VAR MARIADBCLIENT_VERSION_STRING)
+
+if(MARIADBCLIENT_FOUND)
+ set(MARIADBCLIENT_LIBRARIES ${MARIADBCLIENT_LIBRARY})
+ set(MARIADBCLIENT_INCLUDE_DIRS ${MARIADBCLIENT_INCLUDE_DIR})
+ set(MARIADBCLIENT_DEFINITIONS -DHAS_MARIADB=1)
+
+ if(CORE_SYSTEM_NAME STREQUAL osx)
+ list(APPEND DEPLIBS "-lgssapi_krb5")
+ endif()
+
+ if(NOT TARGET MariaDBClient::MariaDBClient)
+ add_library(MariaDBClient::MariaDBClient UNKNOWN IMPORTED)
+ if(MARIADBCLIENT_LIBRARY_RELEASE)
+ set_target_properties(MariaDBClient::MariaDBClient PROPERTIES
+ IMPORTED_CONFIGURATIONS RELEASE
+ IMPORTED_LOCATION "${MARIADBCLIENT_LIBRARY_RELEASE}")
+ endif()
+ if(MARIADBCLIENT_LIBRARY_DEBUG)
+ set_target_properties(MariaDBClient::MariaDBClient PROPERTIES
+ IMPORTED_CONFIGURATIONS DEBUG
+ IMPORTED_LOCATION "${MARIADBCLIENT_LIBRARY_DEBUG}")
+ endif()
+ set_target_properties(MariaDBClient::MariaDBClient PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${MARIADBCLIENT_INCLUDE_DIR}"
+ INTERFACE_COMPILE_DEFINITIONS HAS_MARIADB=1)
+ endif()
+endif()
+
+mark_as_advanced(MARIADBCLIENT_INCLUDE_DIR MARIADBCLIENT_LIBRARY)
diff --git a/cmake/modules/FindMicroHttpd.cmake b/cmake/modules/FindMicroHttpd.cmake
new file mode 100644
index 0000000..a0b91a0
--- /dev/null
+++ b/cmake/modules/FindMicroHttpd.cmake
@@ -0,0 +1,43 @@
+#.rst:
+# FindMicroHttpd
+# --------------
+# Finds the MicroHttpd library
+#
+# This 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.9.40 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 -DHAS_WEB_SERVER=1 -DHAS_WEB_INTERFACE=1)
+
+ if(${MICROHTTPD_LIBRARY} MATCHES ".+\.a$" AND PC_MICROHTTPD_STATIC_LIBRARIES)
+ list(APPEND MICROHTTPD_LIBRARIES ${PC_MICROHTTPD_STATIC_LIBRARIES})
+ endif()
+endif()
+
+mark_as_advanced(MICROHTTPD_LIBRARY MICROHTTPD_INCLUDE_DIR)
diff --git a/cmake/modules/FindMySqlClient.cmake b/cmake/modules/FindMySqlClient.cmake
new file mode 100644
index 0000000..05d3f57
--- /dev/null
+++ b/cmake/modules/FindMySqlClient.cmake
@@ -0,0 +1,69 @@
+#.rst:
+# FindMySqlClient
+# ---------------
+# Finds the MySqlClient library
+#
+# This 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 NAMES mysql/mysql.h mysql/server/mysql.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 -DHAS_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 HAS_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 0000000..11767fc
--- /dev/null
+++ b/cmake/modules/FindNFS.cmake
@@ -0,0 +1,117 @@
+#.rst:
+# FindNFS
+# -------
+# Finds the libnfs library
+#
+# This 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
+
+include(cmake/scripts/common/ModuleHelpers.cmake)
+
+set(MODULE_LC libnfs)
+
+SETUP_BUILD_VARS()
+
+# Search for cmake config. Suitable for all platforms including windows
+find_package(LIBNFS CONFIG QUIET)
+
+if(NOT LIBNFS_FOUND)
+ if(ENABLE_INTERNAL_NFS)
+ set(CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF
+ -DENABLE_TESTS=OFF
+ -DENABLE_DOCUMENTATION=OFF
+ -DENABLE_UTILS=OFF
+ -DENABLE_EXAMPLES=OFF)
+
+ BUILD_DEP_TARGET()
+
+ set(NFS_LIBRARY ${${MODULE}_LIBRARY})
+ set(NFS_INCLUDE_DIR ${${MODULE}_INCLUDE_DIR})
+ else()
+ # Try pkgconfig based search. Linux may not have a version with cmake config installed
+ if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_NFS libnfs>=3.0.0 QUIET)
+ endif()
+
+ find_path(NFS_INCLUDE_DIR nfsc/libnfs.h
+ PATHS ${PC_NFS_INCLUDEDIR})
+
+ set(LIBNFS_VERSION ${PC_NFS_VERSION})
+
+ find_library(NFS_LIBRARY NAMES nfs libnfs
+ PATHS ${PC_NFS_LIBDIR})
+ endif()
+else()
+ # Find lib and path as we cant easily rely on cmake-config
+ find_library(NFS_LIBRARY NAMES nfs libnfs
+ PATHS ${DEPENDS_PATH}/lib)
+ find_path(NFS_INCLUDE_DIR nfsc/libnfs.h PATHS ${DEPENDS_PATH}/include)
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(NFS
+ REQUIRED_VARS NFS_LIBRARY NFS_INCLUDE_DIR
+ VERSION_VAR LIBNFS_VERSION)
+
+if(NFS_FOUND)
+ set(NFS_LIBRARIES ${NFS_LIBRARY})
+ set(NFS_INCLUDE_DIRS ${NFS_INCLUDE_DIR})
+ set(NFS_DEFINITIONS -DHAS_FILESYSTEM_NFS=1)
+
+ set(CMAKE_REQUIRED_INCLUDES "${NFS_INCLUDE_DIR}")
+ set(CMAKE_REQUIRED_LIBRARIES ${NFS_LIBRARY})
+
+ # Check for nfs_set_timeout
+ check_cxx_source_compiles("
+ ${NFS_CXX_INCLUDE}
+ #include <nfsc/libnfs.h>
+ int main()
+ {
+ nfs_set_timeout(NULL, 0);
+ }
+ " NFS_SET_TIMEOUT)
+
+ if(NFS_SET_TIMEOUT)
+ list(APPEND NFS_DEFINITIONS -DHAS_NFS_SET_TIMEOUT)
+ endif()
+
+ # Check for mount_getexports_timeout
+ check_cxx_source_compiles("
+ ${NFS_CXX_INCLUDE}
+ #include <nfsc/libnfs.h>
+ int main()
+ {
+ mount_getexports_timeout(NULL, 0);
+ }
+ " NFS_MOUNT_GETEXPORTS_TIMEOUT)
+
+ if(NFS_MOUNT_GETEXPORTS_TIMEOUT)
+ list(APPEND NFS_DEFINITIONS -DHAS_NFS_MOUNT_GETEXPORTS_TIMEOUT)
+ endif()
+
+ unset(CMAKE_REQUIRED_INCLUDES)
+ unset(CMAKE_REQUIRED_LIBRARIES)
+
+ if(NOT TARGET NFS::NFS)
+ add_library(NFS::NFS UNKNOWN IMPORTED)
+
+ set_target_properties(NFS::NFS PROPERTIES
+ IMPORTED_LOCATION "${NFS_LIBRARY_RELEASE}"
+ INTERFACE_INCLUDE_DIRECTORIES "${NFS_INCLUDE_DIR}"
+ INTERFACE_COMPILE_DEFINITIONS "${NFS_DEFINITIONS}")
+ if(TARGET libnfs)
+ add_dependencies(NFS::NFS libnfs)
+ endif()
+ endif()
+ set_property(GLOBAL APPEND PROPERTY INTERNAL_DEPS_PROP NFS::NFS)
+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 0000000..3dbaa44
--- /dev/null
+++ b/cmake/modules/FindOpenGLES.cmake
@@ -0,0 +1,50 @@
+#.rst:
+# FindOpenGLES
+# ------------
+# Finds the OpenGLES2 library
+#
+# This 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
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_OPENGLES glesv2 QUIET)
+endif()
+
+if(NOT CORE_SYSTEM_NAME STREQUAL darwin_embedded)
+ find_path(OPENGLES_INCLUDE_DIR GLES2/gl2.h
+ PATHS ${PC_OPENGLES_INCLUDEDIR})
+ find_library(OPENGLES_gl_LIBRARY NAMES GLESv2
+ 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)
+endif()
+
+find_path(OPENGLES3_INCLUDE_DIR GLES3/gl3.h)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(OpenGLES
+ REQUIRED_VARS OPENGLES_gl_LIBRARY OPENGLES_INCLUDE_DIR)
+
+find_path(OPENGLES3_INCLUDE_DIR GLES3/gl3.h
+ PATHS ${PC_OPENGLES_INCLUDEDIR})
+
+if(OPENGLES_FOUND)
+ set(OPENGLES_LIBRARIES ${OPENGLES_gl_LIBRARY})
+ if(OPENGLES3_INCLUDE_DIR)
+ set(OPENGLES_INCLUDE_DIRS ${OPENGLES_INCLUDE_DIR} ${OPENGLES3_INCLUDE_DIR})
+ set(OPENGLES_DEFINITIONS -DHAS_GLES=3)
+ mark_as_advanced(OPENGLES_INCLUDE_DIR OPENGLES3_INCLUDE_DIR OPENGLES_gl_LIBRARY)
+ else()
+ set(OPENGLES_INCLUDE_DIRS ${OPENGLES_INCLUDE_DIR})
+ set(OPENGLES_DEFINITIONS -DHAS_GLES=2)
+ mark_as_advanced(OPENGLES_INCLUDE_DIR OPENGLES_gl_LIBRARY)
+ endif()
+endif()
diff --git a/cmake/modules/FindOpenGl.cmake b/cmake/modules/FindOpenGl.cmake
new file mode 100644
index 0000000..e155cda
--- /dev/null
+++ b/cmake/modules/FindOpenGl.cmake
@@ -0,0 +1,40 @@
+#.rst:
+# FindOpenGl
+# ----------
+# Finds the FindOpenGl library
+#
+# This 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 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})
+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)
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(OpenGl
+ REQUIRED_VARS OPENGL_gl_LIBRARY OPENGL_INCLUDE_DIR)
+
+if(OPENGL_FOUND)
+ set(OPENGL_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR})
+ set(OPENGL_LIBRARIES ${OPENGL_gl_LIBRARY})
+ set(OPENGL_DEFINITIONS -DHAS_GL=1)
+endif()
+
+mark_as_advanced(OPENGL_INCLUDE_DIR OPENGL_gl_LIBRARY)
diff --git a/cmake/modules/FindPCRE.cmake b/cmake/modules/FindPCRE.cmake
new file mode 100644
index 0000000..b2707ab
--- /dev/null
+++ b/cmake/modules/FindPCRE.cmake
@@ -0,0 +1,170 @@
+#.rst:
+# FindPCRE
+# --------
+# Finds the PCRECPP library
+#
+# This 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(NOT PCRE::PCRE)
+ if(ENABLE_INTERNAL_PCRE)
+ include(cmake/scripts/common/ModuleHelpers.cmake)
+
+ set(MODULE_LC pcre)
+
+ SETUP_BUILD_VARS()
+
+ # Check for existing PCRE. If version >= PCRE-VERSION file version, dont build
+ find_package(PCRE CONFIG QUIET)
+
+ if(PCRE_VERSION VERSION_LESS ${${MODULE}_VER})
+
+ set(PCRE_VERSION ${${MODULE}_VER})
+ set(PCRE_DEBUG_POSTFIX d)
+
+ set(patches "${CORE_SOURCE_DIR}/tools/depends/target/${MODULE_LC}/001-all-cmakeconfig.patch"
+ "${CORE_SOURCE_DIR}/tools/depends/target/${MODULE_LC}/002-all-enable_docs_pc.patch"
+ "${CORE_SOURCE_DIR}/tools/depends/target/${MODULE_LC}/003-all-postfix.patch"
+ "${CORE_SOURCE_DIR}/tools/depends/target/${MODULE_LC}/004-win-pdb.patch"
+ "${CORE_SOURCE_DIR}/tools/depends/target/${MODULE_LC}/jit_aarch64.patch")
+
+ if(CORE_SYSTEM_NAME STREQUAL darwin_embedded)
+ list(APPEND patches "${CORE_SOURCE_DIR}/tools/depends/target/${MODULE_LC}/tvos-bitcode-fix.patch"
+ "${CORE_SOURCE_DIR}/tools/depends/target/${MODULE_LC}/ios-clear_cache.patch")
+ endif()
+
+ generate_patchcommand("${patches}")
+
+ set(CMAKE_ARGS -DPCRE_NEWLINE=ANYCRLF
+ -DPCRE_NO_RECURSE=ON
+ -DPCRE_MATCH_LIMIT_RECURSION=1500
+ -DPCRE_SUPPORT_JIT=ON
+ -DPCRE_SUPPORT_PCREGREP_JIT=ON
+ -DPCRE_SUPPORT_UTF=ON
+ -DPCRE_SUPPORT_UNICODE_PROPERTIES=ON
+ -DPCRE_SUPPORT_LIBZ=OFF
+ -DPCRE_SUPPORT_LIBBZ2=OFF
+ -DPCRE_BUILD_PCREGREP=OFF
+ -DPCRE_BUILD_TESTS=OFF)
+
+ if(WIN32 OR WINDOWS_STORE)
+ list(APPEND CMAKE_ARGS -DINSTALL_MSVC_PDB=ON)
+ elseif(CORE_SYSTEM_NAME STREQUAL android)
+ # CMake CheckFunctionExists incorrectly detects strtoq for android
+ list(APPEND CMAKE_ARGS -DHAVE_STRTOQ=0)
+ endif()
+
+ # populate PCRECPP lib without a separate module
+ if(NOT CORE_SYSTEM_NAME MATCHES windows)
+ # Non windows platforms have a lib prefix for the lib artifact
+ set(_libprefix "lib")
+ endif()
+ # regex used to get platform extension (eg lib for windows, .a for unix)
+ string(REGEX REPLACE "^.*\\." "" _LIBEXT ${${MODULE}_BYPRODUCT})
+ set(PCRECPP_LIBRARY_DEBUG ${DEP_LOCATION}/lib/${_libprefix}pcrecpp${${MODULE}_DEBUG_POSTFIX}.${_LIBEXT})
+ set(PCRECPP_LIBRARY_RELEASE ${DEP_LOCATION}/lib/${_libprefix}pcrecpp.${_LIBEXT})
+
+ BUILD_DEP_TARGET()
+
+ else()
+ # Populate paths for find_package_handle_standard_args
+ find_path(PCRE_INCLUDE_DIR pcre.h)
+
+ find_library(PCRECPP_LIBRARY_RELEASE NAMES pcrecpp)
+ find_library(PCRECPP_LIBRARY_DEBUG NAMES pcrecppd)
+
+ find_library(PCRE_LIBRARY_RELEASE NAMES pcre)
+ find_library(PCRE_LIBRARY_DEBUG NAMES pcred)
+ endif()
+ else()
+
+ 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})
+
+ endif()
+
+ 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()
+ if(TARGET pcre)
+ add_dependencies(PCRE::PCRE pcre)
+ endif()
+ set_property(GLOBAL APPEND PROPERTY INTERNAL_DEPS_PROP PCRE::PCRE)
+ else()
+ if(PCRE_FIND_REQUIRED)
+ message(FATAL_ERROR "PCRE not found. Possibly use -DENABLE_INTERNAL_PCRE=ON to build PCRE")
+ endif()
+ endif()
+
+ mark_as_advanced(PCRE_INCLUDE_DIR PCRECPP_LIBRARY PCRE_LIBRARY)
+endif()
diff --git a/cmake/modules/FindPipewire.cmake b/cmake/modules/FindPipewire.cmake
new file mode 100644
index 0000000..4fff9b0
--- /dev/null
+++ b/cmake/modules/FindPipewire.cmake
@@ -0,0 +1,54 @@
+#.rst:
+# FindPipewire
+# --------------
+# Finds the Pipewire library
+#
+# This will define the following variables::
+#
+# PIPEWIRE_FOUND - system has the Pipewire library
+# PIPEWIRE_INCLUDE_DIRS - the Pipewire include directory
+# PIPEWIRE_LIBRARIES - the libraries needed to use Pipewire
+# PIPEWIRE_DEFINITIONS - the definitions needed to use Pipewire
+#
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_PIPEWIRE libpipewire-0.3>=0.3.24 QUIET)
+ pkg_check_modules(PC_SPA libspa-0.2>=0.2 QUIET)
+endif()
+
+find_path(PIPEWIRE_INCLUDE_DIR NAMES pipewire/pipewire.h
+ PATHS ${PC_PIPEWIRE_INCLUDEDIR}
+ PATH_SUFFIXES pipewire-0.3)
+
+find_path(SPA_INCLUDE_DIR NAMES spa/support/plugin.h
+ PATHS ${PC_SPA_INCLUDEDIR}
+ PATH_SUFFIXES spa-0.2)
+
+find_library(PIPEWIRE_LIBRARY NAMES pipewire-0.3
+ PATHS ${PC_PIPEWIRE_LIBDIR})
+
+if(PC_PIPEWIRE_VERSION)
+ set(PIPEWIRE_VERSION_STRING ${PC_PIPEWIRE_VERSION})
+elseif(PIPEWIRE_INCLUDE_DIR AND EXISTS ${PIPEWIRE_INCLUDE_DIR}/pipewire/version.h)
+ file(STRINGS ${PIPEWIRE_INCLUDE_DIR}/pipewire/version.h PIPEWIRE_STRINGS)
+ string(REGEX MATCH "#define PW_MAJOR \([0-9]+\)" MAJOR_VERSION "${PIPEWIRE_STRINGS}")
+ set(MAJOR_VERSION ${CMAKE_MATCH_1})
+ string(REGEX MATCH "#define PW_MINOR \([0-9]+\)" MINOR_VERSION "${PIPEWIRE_STRINGS}")
+ set(MINOR_VERSION ${CMAKE_MATCH_1})
+ string(REGEX MATCH "#define PW_MICRO \([0-9]+\)" MICRO_VERSION "${PIPEWIRE_STRINGS}")
+ set(MICRO_VERSION ${CMAKE_MATCH_1})
+ set(PIPEWIRE_VERSION_STRING ${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION})
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Pipewire
+ REQUIRED_VARS PIPEWIRE_LIBRARY PIPEWIRE_INCLUDE_DIR SPA_INCLUDE_DIR
+ VERSION_VAR PIPEWIRE_VERSION_STRING)
+
+if(PIPEWIRE_FOUND)
+ set(PIPEWIRE_INCLUDE_DIRS ${PIPEWIRE_INCLUDE_DIR} ${SPA_INCLUDE_DIR})
+ set(PIPEWIRE_LIBRARIES ${PIPEWIRE_LIBRARY})
+ set(PIPEWIRE_DEFINITIONS -DHAS_PIPEWIRE=1)
+endif()
+
+mark_as_advanced(PIPEWIRE_INCLUDE_DIR PIPEWIRE_LIBRARY)
diff --git a/cmake/modules/FindPlist.cmake b/cmake/modules/FindPlist.cmake
new file mode 100644
index 0000000..8f9b2d6
--- /dev/null
+++ b/cmake/modules/FindPlist.cmake
@@ -0,0 +1,51 @@
+#.rst:
+# FindPlist
+# ---------
+# Finds the Plist library
+#
+# This 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_search_module(PC_PLIST libplist-2.0 libplist QUIET)
+endif()
+
+find_path(PLIST_INCLUDE_DIR plist/plist.h
+ PATHS ${PC_PLIST_INCLUDEDIR})
+
+set(PLIST_VERSION ${PC_PLIST_VERSION})
+
+find_library(PLIST_LIBRARY NAMES plist-2.0 plist libplist-2.0 libplist
+ PATHS ${PC_PLIST_LIBDIR})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Plist
+ REQUIRED_VARS PLIST_LIBRARY PLIST_INCLUDE_DIR
+ VERSION_VAR PLIST_VERSION)
+
+if(PLIST_FOUND)
+ set(PLIST_LIBRARIES ${PLIST_LIBRARY})
+ set(PLIST_INCLUDE_DIRS ${PLIST_INCLUDE_DIR})
+ set(PLIST_DEFINITIONS -DHAS_AIRPLAY=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 HAS_AIRPLAY=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 0000000..829a2d8
--- /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(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_PULSEAUDIO libpulse>=11.0.0 QUIET)
+ pkg_check_modules(PC_PULSEAUDIO_MAINLOOP libpulse-mainloop-glib>=11.0.0 QUIET)
+ pkg_check_modules(PC_PULSEAUDIO_SIMPLE libpulse-simple>=11.0.0 QUIET)
+endif()
+
+find_path(PULSEAUDIO_INCLUDE_DIR NAMES pulse/pulseaudio.h pulse/simple.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_SIMPLE_LIBRARY NAMES pulse-simple libpulse-simple
+ 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_SIMPLE_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} ${PULSEAUDIO_SIMPLE_LIBRARY})
+ set(PULSEAUDIO_DEFINITIONS -DHAS_PULSEAUDIO=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 PULSEAUDIO_SIMPLE_LIBRARY)
diff --git a/cmake/modules/FindPython.cmake b/cmake/modules/FindPython.cmake
new file mode 100644
index 0000000..782c0f5
--- /dev/null
+++ b/cmake/modules/FindPython.cmake
@@ -0,0 +1,101 @@
+# FindPython
+# --------
+# Finds Python3 libraries
+#
+# This module will search for the required python libraries on the system
+# If multiple versions are found, the highest version will be used.
+#
+# --------
+#
+# the following variables influence behaviour:
+#
+# PYTHON_PATH - use external python not found in system paths
+# usage: -DPYTHON_PATH=/path/to/python/lib
+# PYTHON_VER - use exact python version, fail if not found
+# usage: -DPYTHON_VER=3.8
+#
+# --------
+#
+# This module will define the following variables:
+#
+# PYTHON_FOUND - system has PYTHON
+# PYTHON_VERSION - Python version number (Major.Minor)
+# PYTHON_EXECUTABLE - Python interpreter binary
+# PYTHON_INCLUDE_DIRS - the python include directory
+# PYTHON_LIBRARIES - The python libraries
+# PYTHON_LDFLAGS - Python provided link options
+#
+# --------
+#
+
+# for Depends/Windows builds, set search root dir to libdir path
+if(KODI_DEPENDSBUILD
+ OR CMAKE_SYSTEM_NAME STREQUAL WINDOWS
+ OR CMAKE_SYSTEM_NAME STREQUAL WindowsStore)
+ set(Python3_USE_STATIC_LIBS TRUE)
+ set(Python3_ROOT_DIR ${libdir})
+
+ if(KODI_DEPENDSBUILD)
+ # Force set to tools/depends python version
+ set(PYTHON_VER 3.11)
+ endif()
+endif()
+
+# Provide root dir to search for Python if provided
+if(PYTHON_PATH)
+ set(Python3_ROOT_DIR ${PYTHON_PATH})
+
+ # unset cache var so we can generate again with a different dir (or none) if desired
+ unset(PYTHON_PATH CACHE)
+endif()
+
+# Set specific version of Python to find if provided
+if(PYTHON_VER)
+ set(VERSION ${PYTHON_VER})
+ set(EXACT_VER "EXACT")
+
+ # unset cache var so we can generate again with a different ver (or none) if desired
+ unset(PYTHON_VER CACHE)
+endif()
+
+find_package(Python3 ${VERSION} ${EXACT_VER} COMPONENTS Development)
+if(CORE_SYSTEM_NAME STREQUAL linux)
+ if(HOST_CAN_EXECUTE_TARGET)
+ find_package(Python3 ${VERSION} ${EXACT_VER} COMPONENTS Interpreter)
+ else()
+ find_package(Python3 COMPONENTS Interpreter)
+ endif()
+endif()
+
+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)
+ find_library(LZMA_LIBRARY lzma REQUIRED)
+
+ if(NOT CORE_SYSTEM_NAME STREQUAL android)
+ set(PYTHON_DEP_LIBRARIES pthread dl util)
+ if(CORE_SYSTEM_NAME STREQUAL linux)
+ # python archive built via depends requires librt for _posixshmem library
+ list(APPEND PYTHON_DEP_LIBRARIES rt)
+ endif()
+ endif()
+
+ list(APPEND Python3_LIBRARIES ${LZMA_LIBRARY} ${FFI_LIBRARY} ${EXPAT_LIBRARY} ${INTL_LIBRARY} ${GMP_LIBRARY} ${PYTHON_DEP_LIBRARIES})
+endif()
+
+if(Python3_FOUND)
+ list(APPEND PYTHON_DEFINITIONS -DHAS_PYTHON=1)
+ # These are all set for easy integration with the rest of our build system
+ set(PYTHON_FOUND ${Python3_FOUND})
+ if(NOT PYTHON_EXECUTABLE)
+ set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE} CACHE FILEPATH "Python interpreter" FORCE)
+ endif()
+ set(PYTHON_INCLUDE_DIRS ${Python3_INCLUDE_DIRS})
+ set(PYTHON_LIBRARIES ${Python3_LIBRARIES})
+ set(PYTHON_VERSION "${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}" CACHE INTERNAL "" FORCE)
+ set(PYTHON_LDFLAGS ${Python3_LINK_OPTIONS})
+endif()
+
+mark_as_advanced(PYTHON_EXECUTABLE PYTHON_VERSION PYTHON_INCLUDE_DIRS PYTHON_LDFLAGS LZMA_LIBRARY FFI_LIBRARY EXPAT_LIBRARY INTL_LIBRARY GMP_LIBRARY)
diff --git a/cmake/modules/FindRapidJSON.cmake b/cmake/modules/FindRapidJSON.cmake
new file mode 100644
index 0000000..2db5e68
--- /dev/null
+++ b/cmake/modules/FindRapidJSON.cmake
@@ -0,0 +1,67 @@
+#.rst:
+# FindRapidJSON
+# -----------
+# Finds the RapidJSON library
+#
+# This will define the following variables::
+#
+# RapidJSON_FOUND - system has RapidJSON parser
+# RapidJSON_INCLUDE_DIRS - the RapidJSON parser include directory
+#
+if(ENABLE_INTERNAL_RapidJSON)
+ include(cmake/scripts/common/ModuleHelpers.cmake)
+
+ set(MODULE_LC rapidjson)
+
+ SETUP_BUILD_VARS()
+
+ set(RapidJSON_VERSION ${${MODULE}_VER})
+
+ set(patches "${CORE_SOURCE_DIR}/tools/depends/target/rapidjson/001-remove_custom_cxx_flags.patch"
+ "${CORE_SOURCE_DIR}/tools/depends/target/rapidjson/002-cmake-removedocs-examples.patch"
+ "${CORE_SOURCE_DIR}/tools/depends/target/rapidjson/003-win-arm64.patch")
+
+ generate_patchcommand("${patches}")
+
+ set(CMAKE_ARGS -DRAPIDJSON_BUILD_DOC=OFF
+ -DRAPIDJSON_BUILD_EXAMPLES=OFF
+ -DRAPIDJSON_BUILD_TESTS=OFF
+ -DRAPIDJSON_BUILD_THIRDPARTY_GTEST=OFF)
+
+ set(BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/include/rapidjson/rapidjson.h)
+
+ BUILD_DEP_TARGET()
+
+ set(RapidJSON_INCLUDE_DIR ${${MODULE}_INCLUDE_DIR})
+
+ # Add dependency to libkodi to build
+ set_property(GLOBAL APPEND PROPERTY INTERNAL_DEPS_PROP rapidjson)
+else()
+ if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_RapidJSON RapidJSON>=1.0.2 QUIET)
+ endif()
+
+ if(CORE_SYSTEM_NAME STREQUAL windows OR CORE_SYSTEM_NAME STREQUAL windowsstore)
+ set(RapidJSON_VERSION 1.1.0)
+ else()
+ if(PC_RapidJSON_VERSION)
+ set(RapidJSON_VERSION ${PC_RapidJSON_VERSION})
+ else()
+ find_package(RapidJSON 1.1.0 CONFIG REQUIRED QUIET)
+ endif()
+ endif()
+
+ find_path(RapidJSON_INCLUDE_DIR NAMES rapidjson/rapidjson.h
+ PATHS ${PC_RapidJSON_INCLUDEDIR})
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(RapidJSON
+ REQUIRED_VARS RapidJSON_INCLUDE_DIR RapidJSON_VERSION
+ VERSION_VAR RapidJSON_VERSION)
+
+if(RAPIDJSON_FOUND)
+ set(RAPIDJSON_INCLUDE_DIRS ${RapidJSON_INCLUDE_DIR})
+endif()
+
+mark_as_advanced(RapidJSON_INCLUDE_DIR)
diff --git a/cmake/modules/FindSSE.cmake b/cmake/modules/FindSSE.cmake
new file mode 100644
index 0000000..d9d5c7a
--- /dev/null
+++ b/cmake/modules/FindSSE.cmake
@@ -0,0 +1,195 @@
+# 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)
+
+ # SSE3 is also known as the Prescott New Instructions (PNI)
+ # it's labeled as pni in /proc/cpuinfo
+ string(REGEX REPLACE "^.*(pni).*$" "\\1" _SSE_THERE ${CPUINFO})
+ string(COMPARE EQUAL "pni" "${_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 "FreeBSD")
+ if(CPU MATCHES "amd64" OR CPU MATCHES "i.86")
+ exec_program(cat ARGS "/var/run/dmesg.boot | grep Features" 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)
+
+ string(REGEX REPLACE "^.*(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 "Android")
+ if(CPU MATCHES "x86_64" OR CPU MATCHES "i.86")
+ set(_SSE_TRUE TRUE)
+ set(_SSE2_TRUE TRUE)
+ set(_SSE3_TRUE TRUE)
+ set(_SSSE3_TRUE TRUE)
+
+ CHECK_CXX_ACCEPTS_FLAG("-msse" _SSE_OK)
+ CHECK_CXX_ACCEPTS_FLAG("-msse2" _SSE2_OK)
+ CHECK_CXX_ACCEPTS_FLAG("-msse3" _SSE3_OK)
+ CHECK_CXX_ACCEPTS_FLAG("-mssse3" _SSSE3_OK)
+ CHECK_CXX_ACCEPTS_FLAG("-msse4.1" _SSE41_OK)
+ CHECK_CXX_ACCEPTS_FLAG("-msse4.2" _SSE42_OK)
+ CHECK_CXX_ACCEPTS_FLAG("-mavx" _AVX_OK)
+ 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
+ if(ARCH STREQUAL win32 OR ARCH STREQUAL x64)
+ set(_SSE_TRUE true)
+ set(_SSE_OK true)
+ set(_SSE2_TRUE true)
+ set(_SSE2_OK true)
+ endif()
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(SSE
+ REQUIRED_VARS _SSE_TRUE _SSE_OK
+ FAIL_MESSAGE "Could not find hardware support for SSE")
+set(FPHSA_NAME_MISMATCHED ON)
+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")
+unset(FPHSA_NAME_MISMATCHED)
+
+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/FindSdl.cmake b/cmake/modules/FindSdl.cmake
new file mode 100644
index 0000000..60959cb
--- /dev/null
+++ b/cmake/modules/FindSdl.cmake
@@ -0,0 +1,29 @@
+#.rst:
+# FindSDL
+# -------
+# Finds the SDL library
+#
+# This 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_SDL sdl QUIET)
+endif()
+
+find_path(SDL_INCLUDE_DIR SDL/SDL.h PATHS ${PC_SDL_INCLUDE_DIR})
+find_library(SDL_LIBRARY NAMES SDL PATHS ${PC_SDL_LIBDIR})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Sdl REQUIRED_VARS SDL_LIBRARY SDL_INCLUDE_DIR)
+
+if(SDL_FOUND)
+ set(SDL_LIBRARIES ${SDL_LIBRARY})
+ set(SDL_INCLUDE_DIRS ${SDL_INCLUDE_DIR})
+ set(SDL_DEFINITIONS -DHAVE_SDL=1)
+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 0000000..506cffd
--- /dev/null
+++ b/cmake/modules/FindShairplay.cmake
@@ -0,0 +1,57 @@
+#.rst:
+# FindShairplay
+# -------------
+# Finds the Shairplay library
+#
+# This 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)
+find_library(SHAIRPLAY_LIBRARY NAMES shairplay libshairplay)
+
+if(SHAIRPLAY_INCLUDE_DIR AND SHAIRPLAY_LIBRARY)
+ include(CheckCSourceCompiles)
+ set(CMAKE_REQUIRED_INCLUDES ${SHAIRPLAY_INCLUDE_DIR})
+ 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)
+
+if(SHAIRPLAY_FOUND)
+ set(SHAIRPLAY_LIBRARIES ${SHAIRPLAY_LIBRARY})
+ set(SHAIRPLAY_INCLUDE_DIRS ${SHAIRPLAY_INCLUDE_DIR})
+ set(SHAIRPLAY_DEFINITIONS -DHAS_AIRTUNES=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 HAS_AIRTUNES=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 0000000..fde48ab
--- /dev/null
+++ b/cmake/modules/FindSmbClient.cmake
@@ -0,0 +1,50 @@
+#.rst:
+# FindSmbClient
+# -------------
+# Finds the SMB Client library
+#
+# This 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})
+ if(${SMBCLIENT_LIBRARY} MATCHES ".+\.a$" AND PC_SMBCLIENT_STATIC_LIBRARIES)
+ list(APPEND SMBCLIENT_LIBRARIES ${PC_SMBCLIENT_STATIC_LIBRARIES})
+ endif()
+ set(SMBCLIENT_INCLUDE_DIRS ${SMBCLIENT_INCLUDE_DIR})
+ set(SMBCLIENT_DEFINITIONS -DHAS_FILESYSTEM_SMB=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 HAS_FILESYSTEM_SMB=1)
+ endif()
+endif()
+
+mark_as_advanced(LIBSMBCLIENT_INCLUDE_DIR LIBSMBCLIENT_LIBRARY)
diff --git a/cmake/modules/FindSndio.cmake b/cmake/modules/FindSndio.cmake
new file mode 100644
index 0000000..992c0b1
--- /dev/null
+++ b/cmake/modules/FindSndio.cmake
@@ -0,0 +1,41 @@
+#
+# FindSndio
+# ---------
+# Finds the Sndio Library
+#
+# This will define the following variables:
+#
+# SNDIO_FOUND - system has sndio
+# SNDIO_INCLUDE_DIRS - sndio include directory
+# SNDIO_DEFINITIONS - sndio definitions
+#
+# and the following imported targets::
+#
+# Sndio::Sndio - the sndio library
+#
+
+find_path(SNDIO_INCLUDE_DIR sndio.h)
+find_library(SNDIO_LIBRARY sndio)
+
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Sndio
+ REQUIRED_VARS SNDIO_LIBRARY SNDIO_INCLUDE_DIR)
+
+if(SNDIO_FOUND)
+ set(SNDIO_INCLUDE_DIRS ${SNDIO_INCLUDE_DIR})
+ set(SNDIO_LIBRARIES ${SNDIO_LIBRARY})
+ set(SNDIO_DEFINITIONS -DHAS_SNDIO=1)
+
+ if(NOT TARGET Sndio::Sndio)
+ add_library(Sndio::Sndio UNKNOWN IMPORTED)
+ set_target_properties(Sndio::Sndio PROPERTIES
+ IMPORTED_LOCATION "${SNDIO_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${SNDIO_INCLUDE_DIR}")
+ set_target_properties(Sndio::Sndio PROPERTIES
+ INTERFACE_COMPILE_DEFINITIONS -DHAS_SNDIO=1)
+ endif()
+endif()
+
+
+mark_as_advanced(SNDIO_INCLUDE_DIR SNDIO_LIBRARY)
diff --git a/cmake/modules/FindSpdlog.cmake b/cmake/modules/FindSpdlog.cmake
new file mode 100644
index 0000000..0274d14
--- /dev/null
+++ b/cmake/modules/FindSpdlog.cmake
@@ -0,0 +1,128 @@
+# FindSpdlog
+# -------
+# Finds the Spdlog library
+#
+# This will define the following variables:
+#
+# SPDLOG_FOUND - system has Spdlog
+# SPDLOG_INCLUDE_DIRS - the Spdlog include directory
+# SPDLOG_LIBRARIES - the Spdlog libraries
+# SPDLOG_DEFINITIONS - the Spdlog compile definitions
+#
+# and the following imported targets:
+#
+# Spdlog::Spdlog - The Spdlog library
+
+if(ENABLE_INTERNAL_SPDLOG)
+ include(cmake/scripts/common/ModuleHelpers.cmake)
+
+ # Check for dependencies - Must be done before SETUP_BUILD_VARS
+ get_libversion_data("fmt" "target")
+ find_package(Fmt ${LIB_FMT_VER} MODULE REQUIRED)
+
+ # Check if we want to force a build due to a dependency rebuild
+ get_property(LIB_FORCE_REBUILD TARGET fmt::fmt PROPERTY LIB_BUILD)
+
+ set(MODULE_LC spdlog)
+ SETUP_BUILD_VARS()
+
+ # Check for existing SPDLOG. If version >= SPDLOG-VERSION file version, dont build
+ find_package(SPDLOG CONFIG QUIET)
+
+ if(SPDLOG_VERSION VERSION_LESS ${${MODULE}_VER} OR LIB_FORCE_REBUILD)
+ if(APPLE)
+ set(EXTRA_ARGS "-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}")
+ endif()
+
+ if(WIN32 OR WINDOWS_STORE)
+ set(patches "${CMAKE_SOURCE_DIR}/tools/depends/target/${MODULE_LC}/001-windows-pdb-symbol-gen.patch")
+ generate_patchcommand("${patches}")
+
+ set(EXTRA_ARGS -DSPDLOG_WCHAR_SUPPORT=ON
+ -DSPDLOG_WCHAR_FILENAMES=ON)
+
+ endif()
+
+ set(SPDLOG_VERSION ${${MODULE}_VER})
+ # spdlog debug uses postfix d for all platforms
+ set(SPDLOG_DEBUG_POSTFIX d)
+
+ set(CMAKE_ARGS -DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS}
+ -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}
+ -DSPDLOG_BUILD_EXAMPLE=OFF
+ -DSPDLOG_BUILD_TESTS=OFF
+ -DSPDLOG_BUILD_BENCH=OFF
+ -DSPDLOG_FMT_EXTERNAL=ON
+ ${EXTRA_ARGS})
+
+ BUILD_DEP_TARGET()
+
+ add_dependencies(${MODULE_LC} fmt::fmt)
+ else()
+ # Populate paths for find_package_handle_standard_args
+ find_path(SPDLOG_INCLUDE_DIR NAMES spdlog/spdlog.h)
+ find_library(SPDLOG_LIBRARY_RELEASE NAMES spdlog)
+ find_library(SPDLOG_LIBRARY_DEBUG NAMES spdlogd)
+ endif()
+else()
+ find_package(spdlog 1.5.0 CONFIG REQUIRED QUIET)
+
+ if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_SPDLOG spdlog QUIET)
+ set(SPDLOG_VERSION ${PC_SPDLOG_VERSION})
+ endif()
+
+ find_path(SPDLOG_INCLUDE_DIR NAMES spdlog/spdlog.h
+ PATHS ${PC_SPDLOG_INCLUDEDIR})
+
+ find_library(SPDLOG_LIBRARY_RELEASE NAMES spdlog
+ PATHS ${PC_SPDLOG_LIBDIR})
+ find_library(SPDLOG_LIBRARY_DEBUG NAMES spdlogd
+ PATHS ${PC_SPDLOG_LIBDIR})
+endif()
+
+include(SelectLibraryConfigurations)
+select_library_configurations(SPDLOG)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Spdlog
+ REQUIRED_VARS SPDLOG_LIBRARY SPDLOG_INCLUDE_DIR
+ VERSION_VAR SPDLOG_VERSION)
+
+if(SPDLOG_FOUND)
+ set(SPDLOG_LIBRARIES ${SPDLOG_LIBRARY})
+ set(SPDLOG_INCLUDE_DIRS ${SPDLOG_INCLUDE_DIR})
+ set(SPDLOG_DEFINITIONS -DSPDLOG_FMT_EXTERNAL
+ -DSPDLOG_DEBUG_ON
+ -DSPDLOG_NO_ATOMIC_LEVELS
+ -DSPDLOG_ENABLE_PATTERN_PADDING
+ -DSPDLOG_COMPILED_LIB
+ ${PC_SPDLOG_CFLAGS})
+ if(WIN32)
+ list(APPEND SPDLOG_DEFINITIONS -DSPDLOG_WCHAR_FILENAMES
+ -DSPDLOG_WCHAR_TO_UTF8_SUPPORT)
+ endif()
+
+ if(NOT TARGET spdlog::spdlog)
+ add_library(spdlog::spdlog UNKNOWN IMPORTED)
+ if(SPDLOG_LIBRARY_RELEASE)
+ set_target_properties(spdlog::spdlog PROPERTIES
+ IMPORTED_CONFIGURATIONS RELEASE
+ IMPORTED_LOCATION "${SPDLOG_LIBRARY_RELEASE}")
+ endif()
+ if(SPDLOG_LIBRARY_DEBUG)
+ set_target_properties(spdlog::spdlog PROPERTIES
+ IMPORTED_CONFIGURATIONS DEBUG
+ IMPORTED_LOCATION "${SPDLOG_LIBRARY_DEBUG}")
+ endif()
+ set_target_properties(spdlog::spdlog PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${SPDLOG_INCLUDE_DIR}"
+ INTERFACE_COMPILE_DEFINITIONS "${SPDLOG_DEFINITIONS}")
+ endif()
+ if(TARGET spdlog)
+ add_dependencies(spdlog::spdlog spdlog)
+ endif()
+ set_property(GLOBAL APPEND PROPERTY INTERNAL_DEPS_PROP spdlog::spdlog)
+endif()
+
+mark_as_advanced(SPDLOG_INCLUDE_DIR SPDLOG_LIBRARY)
diff --git a/cmake/modules/FindSqlite3.cmake b/cmake/modules/FindSqlite3.cmake
new file mode 100644
index 0000000..8fd9719
--- /dev/null
+++ b/cmake/modules/FindSqlite3.cmake
@@ -0,0 +1,44 @@
+#.rst:
+# FindSqlite3
+# -----------
+# Finds the SQLite3 library
+#
+# This 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 0000000..84f7b8d
--- /dev/null
+++ b/cmake/modules/FindTagLib.cmake
@@ -0,0 +1,92 @@
+#.rst:
+# FindTagLib
+# ----------
+# Finds the TagLib library
+#
+# This 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(ENABLE_INTERNAL_TAGLIB)
+ include(cmake/scripts/common/ModuleHelpers.cmake)
+
+ set(MODULE_LC taglib)
+
+ SETUP_BUILD_VARS()
+
+ set(TAGLIB_VERSION ${${MODULE}_VER})
+
+ if(WIN32 OR WINDOWS_STORE)
+ set(patches "${CMAKE_SOURCE_DIR}/tools/depends/target/${MODULE_LC}/001-cmake-pdb-debug.patch")
+ generate_patchcommand("${patches}")
+ endif()
+
+ # Debug postfix only used for windows
+ if(WIN32 OR WINDOWS_STORE)
+ set(TAGLIB_DEBUG_POSTFIX "d")
+ endif()
+
+ set(CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF
+ -DBUILD_BINDINGS=OFF)
+
+ BUILD_DEP_TARGET()
+
+else()
+
+ 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})
+
+endif()
+
+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_INCLUDE_DIRS ${TAGLIB_INCLUDE_DIR})
+ set(TAGLIB_LIBRARIES ${TAGLIB_LIBRARY})
+
+ # Workaround broken .pc file
+ list(APPEND TAGLIB_LIBRARIES ${PC_TAGLIB_ZLIB_LIBRARIES})
+
+ 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}")
+ if(TARGET taglib)
+ add_dependencies(TagLib::TagLib taglib)
+ endif()
+ endif()
+ set_property(GLOBAL APPEND PROPERTY INTERNAL_DEPS_PROP TagLib::TagLib)
+endif()
+
+mark_as_advanced(TAGLIB_INCLUDE_DIR TAGLIB_LIBRARY)
diff --git a/cmake/modules/FindTinyXML.cmake b/cmake/modules/FindTinyXML.cmake
new file mode 100644
index 0000000..5e9539e
--- /dev/null
+++ b/cmake/modules/FindTinyXML.cmake
@@ -0,0 +1,68 @@
+#.rst:
+# FindTinyXML
+# -----------
+# Finds the TinyXML library
+#
+# This 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 0000000..a884025
--- /dev/null
+++ b/cmake/modules/FindUDEV.cmake
@@ -0,0 +1,47 @@
+#.rst:
+# FindUDEV
+# -------
+# Finds the UDEV library
+#
+# This 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 0000000..0c2ff5a
--- /dev/null
+++ b/cmake/modules/FindUUID.cmake
@@ -0,0 +1,43 @@
+#.rst:
+# FindUUID
+# --------
+# Finds the libuuid library
+#
+# This 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/FindUdfread.cmake b/cmake/modules/FindUdfread.cmake
new file mode 100644
index 0000000..49ec2b4
--- /dev/null
+++ b/cmake/modules/FindUdfread.cmake
@@ -0,0 +1,57 @@
+#.rst:
+# FindUdfread
+# --------
+# Finds the udfread library
+#
+# This will define the following variables::
+#
+# UDFREAD_FOUND - system has udfread
+# UDFREAD_INCLUDE_DIRS - the udfread include directory
+# UDFREAD_LIBRARIES - the udfread libraries
+# UDFREAD_DEFINITIONS - the udfread definitions
+
+if(ENABLE_INTERNAL_UDFREAD)
+ include(cmake/scripts/common/ModuleHelpers.cmake)
+
+ set(MODULE_LC udfread)
+
+ SETUP_BUILD_VARS()
+
+ set(UDFREAD_VERSION ${${MODULE}_VER})
+
+ set(CONFIGURE_COMMAND autoreconf -vif &&
+ ./configure
+ --enable-static
+ --disable-shared
+ --prefix=${DEPENDS_PATH})
+ set(BUILD_IN_SOURCE 1)
+
+ BUILD_DEP_TARGET()
+
+ set_property(GLOBAL APPEND PROPERTY INTERNAL_DEPS_PROP udfread)
+else()
+ if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_UDFREAD udfread>=1.0.0 QUIET)
+ endif()
+
+ find_path(UDFREAD_INCLUDE_DIR NAMES udfread/udfread.h
+ PATHS ${PC_UDFREAD_INCLUDEDIR})
+
+ find_library(UDFREAD_LIBRARY NAMES udfread libudfread
+ PATHS ${PC_UDFREAD_LIBDIR})
+
+ set(UDFREAD_VERSION ${PC_UDFREAD_VERSION})
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Udfread
+ REQUIRED_VARS UDFREAD_LIBRARY UDFREAD_INCLUDE_DIR
+ VERSION_VAR UDFREAD_VERSION)
+
+if(UDFREAD_FOUND)
+ set(UDFREAD_LIBRARIES ${UDFREAD_LIBRARY})
+ set(UDFREAD_INCLUDE_DIRS ${UDFREAD_INCLUDE_DIR})
+ set(UDFREAD_DEFINITIONS -DHAS_UDFREAD=1)
+endif()
+
+mark_as_advanced(UDFREAD_INCLUDE_DIR UDFREAD_LIBRARY)
diff --git a/cmake/modules/FindVAAPI.cmake b/cmake/modules/FindVAAPI.cmake
new file mode 100644
index 0000000..f0a5d05
--- /dev/null
+++ b/cmake/modules/FindVAAPI.cmake
@@ -0,0 +1,66 @@
+#.rst:
+# FindVAAPI
+# ---------
+# Finds the VAAPI library
+#
+# This 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
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_VAAPI libva libva-drm libva-wayland libva-x11 QUIET)
+endif()
+
+set(REQUIRED_VARS "VAAPI_libva_LIBRARY" "VAAPI_libva-drm_LIBRARY" "VAAPI_libva_INCLUDE_DIR" "VAAPI_libva-drm_INCLUDE_DIR")
+
+find_path(VAAPI_libva_INCLUDE_DIR va/va.h
+ PATHS ${PC_VAAPI_libva_INCLUDEDIR})
+find_library(VAAPI_libva_LIBRARY NAMES va
+ PATHS ${PC_VAAPI_libva_LIBDIR})
+find_path(VAAPI_libva-drm_INCLUDE_DIR va/va_drm.h
+ PATHS ${PC_VAAPI_libva-drm_INCLUDEDIR})
+find_library(VAAPI_libva-drm_LIBRARY NAMES va-drm
+ PATHS ${PC_VAAPI_libva-drm_LIBDIR})
+if("wayland" IN_LIST CORE_PLATFORM_NAME_LC)
+ find_path(VAAPI_libva-wayland_INCLUDE_DIR va/va_wayland.h
+ PATHS ${PC_VAAPI_libva-wayland_INCLUDEDIR})
+ find_library(VAAPI_libva-wayland_LIBRARY NAMES va-wayland
+ PATHS ${PC_VAAPI_libva-wayland_LIBDIR})
+ list(APPEND REQUIRED_VARS "VAAPI_libva-wayland_INCLUDE_DIR" "VAAPI_libva-wayland_LIBRARY")
+endif()
+if("x11" IN_LIST CORE_PLATFORM_NAME_LC)
+ find_path(VAAPI_libva-x11_INCLUDE_DIR va/va_x11.h
+ PATHS ${PC_VAAPI_libva-x11_INCLUDEDIR})
+ find_library(VAAPI_libva-x11_LIBRARY NAMES va-x11
+ PATHS ${PC_VAAPI_libva-x11_LIBDIR})
+ list(APPEND REQUIRED_VARS "VAAPI_libva-x11_INCLUDE_DIR" "VAAPI_libva-x11_LIBRARY")
+endif()
+
+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.39.0)
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(VAAPI
+ REQUIRED_VARS ${REQUIRED_VARS}
+ VERSION_VAR VAAPI_VERSION_STRING)
+
+if(VAAPI_FOUND)
+ set(VAAPI_INCLUDE_DIRS ${VAAPI_INCLUDE_DIR} ${VAAPI_DRM_INCLUDE_DIR} ${VAAPI_WAYLAND_INCLUDE_DIR} ${VAAPI_X11_INCLUDE_DIR})
+ set(VAAPI_LIBRARIES ${VAAPI_libva_LIBRARY} ${VAAPI_libva-drm_LIBRARY} ${VAAPI_libva-wayland_LIBRARY} ${VAAPI_libva-x11_LIBRARY})
+ set(VAAPI_DEFINITIONS -DHAVE_LIBVA=1)
+endif()
+
+mark_as_advanced(VAAPI_libva_INCLUDE_DIR VAAPI_libva-drm_INCLUDE_DIR VAAPI_libva-wayland_INCLUDE_DIR VAAPI_libva-x11_INCLUDE_DIR
+ VAAPI_libva_LIBRARY VAAPI_libva-drm_LIBRARY VAAPI_libva-wayland_LIBRARY VAAPI_libva-x11_LIBRARY)
diff --git a/cmake/modules/FindVDPAU.cmake b/cmake/modules/FindVDPAU.cmake
new file mode 100644
index 0000000..b2c5482
--- /dev/null
+++ b/cmake/modules/FindVDPAU.cmake
@@ -0,0 +1,47 @@
+#.rst:
+# FindVDPAU
+# ---------
+# Finds the VDPAU library
+#
+# This 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/FindWaylandProtocols.cmake b/cmake/modules/FindWaylandProtocols.cmake
new file mode 100644
index 0000000..e74bb80
--- /dev/null
+++ b/cmake/modules/FindWaylandProtocols.cmake
@@ -0,0 +1,24 @@
+# FindWaylandProtocols
+# --------------------
+# Find wayland-protocols
+#
+# This will define the following variables::
+#
+# WAYLAND_PROTOCOLS_DIR - directory containing the additional Wayland protocols
+# from the wayland-protocols package
+
+pkg_check_modules(PC_WAYLAND_PROTOCOLS wayland-protocols)
+if(PC_WAYLAND_PROTOCOLS_FOUND)
+ pkg_get_variable(WAYLAND_PROTOCOLS_DIR wayland-protocols pkgdatadir)
+endif()
+
+# Promote to cache variables so all code can access it
+set(WAYLAND_PROTOCOLS_DIR ${WAYLAND_PROTOCOLS_DIR} CACHE INTERNAL "")
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(WaylandProtocols
+ REQUIRED_VARS
+ PC_WAYLAND_PROTOCOLS_FOUND
+ WAYLAND_PROTOCOLS_DIR
+ VERSION_VAR
+ PC_WAYLAND_PROTOCOLS_VERSION)
diff --git a/cmake/modules/FindWaylandpp.cmake b/cmake/modules/FindWaylandpp.cmake
new file mode 100644
index 0000000..ba229d7
--- /dev/null
+++ b/cmake/modules/FindWaylandpp.cmake
@@ -0,0 +1,68 @@
+# FindWaylandpp
+# -------------
+# Finds the waylandpp library
+#
+# This will define the following variables::
+#
+# WAYLANDPP_FOUND - the system has waylandpp
+# WAYLANDPP_INCLUDE_DIRS - the waylandpp include directory
+# WAYLANDPP_LIBRARIES - the waylandpp libraries
+# WAYLANDPP_DEFINITIONS - the waylandpp definitions
+# WAYLANDPP_SCANNER - path to wayland-scanner++
+
+pkg_check_modules(PC_WAYLANDPP wayland-client++ wayland-egl++ wayland-cursor++ QUIET)
+
+if(PC_WAYLANDPP_FOUND)
+ pkg_get_variable(PC_WAYLANDPP_PKGDATADIR wayland-client++ pkgdatadir)
+else()
+ message(SEND_ERROR "wayland-client++ not found via pkg-config")
+endif()
+
+pkg_check_modules(PC_WAYLANDPP_SCANNER wayland-scanner++ QUIET)
+
+if(PC_WAYLANDPP_SCANNER_FOUND)
+ pkg_get_variable(PC_WAYLANDPP_SCANNER wayland-scanner++ wayland_scannerpp)
+else()
+ message(SEND_ERROR "wayland-scanner++ not found via pkg-config")
+endif()
+
+find_path(WAYLANDPP_INCLUDE_DIR wayland-client.hpp PATHS ${PC_WAYLANDPP_INCLUDEDIR})
+
+find_library(WAYLANDPP_CLIENT_LIBRARY NAMES wayland-client++
+ PATHS ${PC_WAYLANDPP_LIBRARY_DIRS})
+
+find_library(WAYLANDPP_CURSOR_LIBRARY NAMES wayland-cursor++
+ PATHS ${PC_WAYLANDPP_LIBRARY_DIRS})
+
+find_library(WAYLANDPP_EGL NAMES wayland-egl++
+ PATHS ${PC_WAYLANDPP_LIBRARY_DIRS})
+
+
+# Promote to cache variables so all code can access it
+set(WAYLANDPP_PROTOCOLS_DIR "${PC_WAYLANDPP_PKGDATADIR}/protocols" CACHE INTERNAL "")
+
+# wayland-scanner++ is from native/host system in case of cross-compilation, so
+# it's ok if we don't find it with pkgconfig
+find_program(WAYLANDPP_SCANNER wayland-scanner++ PATHS ${PC_WAYLANDPP_SCANNER})
+
+include (FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Waylandpp
+ REQUIRED_VARS WAYLANDPP_INCLUDE_DIR
+ WAYLANDPP_CLIENT_LIBRARY
+ WAYLANDPP_CURSOR_LIBRARY
+ WAYLANDPP_EGL
+ WAYLANDPP_SCANNER
+ VERSION_VAR WAYLANDPP_wayland-client++_VERSION)
+
+if(WAYLANDPP_FOUND)
+ set(WAYLANDPP_INCLUDE_DIRS ${WAYLANDPP_INCLUDE_DIR})
+ set(WAYLANDPP_LIBRARIES ${WAYLANDPP_CLIENT_LIBRARY}
+ ${WAYLANDPP_CURSOR_LIBRARY}
+ ${WAYLANDPP_EGL})
+ set(WAYLANDPP_DEFINITIONS -DHAVE_WAYLAND=1)
+endif()
+
+mark_as_advanced(WAYLANDPP_INCLUDE_DIR
+ WAYLANDPP_CLIENT_LIBRARY
+ WAYLANDPP_CURSOR_LIBRARY
+ WAYLANDPP_EGL WAYLANDPP_SCANNER)
diff --git a/cmake/modules/FindX.cmake b/cmake/modules/FindX.cmake
new file mode 100644
index 0000000..a52f86f
--- /dev/null
+++ b/cmake/modules/FindX.cmake
@@ -0,0 +1,57 @@
+#.rst:
+# FindX
+# -----
+# Finds the X11 library
+#
+# This 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 0000000..12f3478
--- /dev/null
+++ b/cmake/modules/FindXRandR.cmake
@@ -0,0 +1,47 @@
+#.rst:
+# FindXRandR
+# ----------
+# Finds the XRandR library
+#
+# This 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 0000000..3637214
--- /dev/null
+++ b/cmake/modules/FindXSLT.cmake
@@ -0,0 +1,50 @@
+#.rst:
+# FindXSLT
+# --------
+# Finds the XSLT library
+#
+# This 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/FindXkbcommon.cmake b/cmake/modules/FindXkbcommon.cmake
new file mode 100644
index 0000000..40cbb31
--- /dev/null
+++ b/cmake/modules/FindXkbcommon.cmake
@@ -0,0 +1,40 @@
+# FindXkbcommon
+# -----------
+# Finds the libxkbcommon library
+#
+# This will define the following variables::
+#
+# XKBCOMMON_FOUND - the system has libxkbcommon
+# XKBCOMMON_INCLUDE_DIRS - the libxkbcommon include directory
+# XKBCOMMON_LIBRARIES - the libxkbcommon libraries
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_XKBCOMMON xkbcommon QUIET)
+endif()
+
+
+find_path(XKBCOMMON_INCLUDE_DIR NAMES xkbcommon/xkbcommon.h
+ PATHS ${PC_XKBCOMMON_INCLUDEDIR})
+find_library(XKBCOMMON_LIBRARY NAMES xkbcommon
+ PATHS ${PC_XKBCOMMON_LIBDIR})
+
+set(XKBCOMMON_VERSION ${PC_XKBCOMMON_VERSION})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Xkbcommon
+ REQUIRED_VARS XKBCOMMON_LIBRARY XKBCOMMON_INCLUDE_DIR
+ VERSION_VAR XKBCOMMON_VERSION)
+
+if(XKBCOMMON_FOUND)
+ set(XKBCOMMON_INCLUDE_DIRS ${XKBCOMMON_INCLUDE_DIR})
+ set(XKBCOMMON_LIBRARIES ${XKBCOMMON_LIBRARY})
+
+ if(NOT TARGET XKBCOMMON::XKBCOMMON)
+ add_library(XKBCOMMON::XKBCOMMON UNKNOWN IMPORTED)
+ set_target_properties(XKBCOMMON::XKBCOMMON PROPERTIES
+ IMPORTED_LOCATION "${XKBCOMMON_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${XKBCOMMON_INCLUDE_DIR}")
+ endif()
+endif()
+
+mark_as_advanced(XKBCOMMON_INCLUDE_DIR XKBCOMMON_LIBRARY)
diff --git a/cmake/modules/buildtools/FindCCache.cmake b/cmake/modules/buildtools/FindCCache.cmake
new file mode 100644
index 0000000..34238dc
--- /dev/null
+++ b/cmake/modules/buildtools/FindCCache.cmake
@@ -0,0 +1,38 @@
+#.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)
+
+if(CCACHE_PROGRAM)
+ execute_process(COMMAND "${CCACHE_PROGRAM}" --version
+ OUTPUT_VARIABLE CCACHE_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ string(REGEX MATCH "[^\n]* version [^\n]*" CCACHE_VERSION "${CCACHE_VERSION}")
+ string(REGEX REPLACE ".* version (.*)" "\\1" CCACHE_VERSION "${CCACHE_VERSION}")
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(CCache REQUIRED_VARS CCACHE_PROGRAM
+ VERSION_VAR CCACHE_VERSION)
+
+if(CCACHE_FOUND)
+ # Supports Unix Makefiles, Ninja and Xcode
+ set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" CACHE STRING "" FORCE)
+ set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" CACHE STRING "" FORCE)
+
+ file(WRITE "${CMAKE_BINARY_DIR}/launch-c" "#!/bin/sh\nexec \"${CCACHE_PROGRAM}\" \"${CMAKE_C_COMPILER}\" \"$@\"\n")
+ file(WRITE "${CMAKE_BINARY_DIR}/launch-cxx" "#!/bin/sh\nexec \"${CCACHE_PROGRAM}\" \"${CMAKE_CXX_COMPILER}\" \"$@\"\n")
+ execute_process(COMMAND chmod +x "${CMAKE_BINARY_DIR}/launch-c" "${CMAKE_BINARY_DIR}/launch-cxx")
+
+ set(CMAKE_XCODE_ATTRIBUTE_CC "${CMAKE_BINARY_DIR}/launch-c" PARENT_SCOPE)
+ set(CMAKE_XCODE_ATTRIBUTE_CXX "${CMAKE_BINARY_DIR}/launch-cxx" PARENT_SCOPE)
+ set(CMAKE_XCODE_ATTRIBUTE_LD "${CMAKE_BINARY_DIR}/launch-c" PARENT_SCOPE)
+ set(CMAKE_XCODE_ATTRIBUTE_LDPLUSPLUS "${CMAKE_BINARY_DIR}/launch-cxx" PARENT_SCOPE)
+endif()
+
+mark_as_advanced(CCACHE_PROGRAM)
diff --git a/cmake/modules/buildtools/FindClangFormat.cmake b/cmake/modules/buildtools/FindClangFormat.cmake
new file mode 100644
index 0000000..ff052a1
--- /dev/null
+++ b/cmake/modules/buildtools/FindClangFormat.cmake
@@ -0,0 +1,19 @@
+#.rst:
+# FindClangFormat
+# ----------
+# Finds clang-format
+
+find_program(CLANG_FORMAT_EXECUTABLE clang-format)
+
+if(CLANG_FORMAT_EXECUTABLE)
+ execute_process(COMMAND "${CLANG_FORMAT_EXECUTABLE}" --version
+ OUTPUT_VARIABLE CLANG_FORMAT_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ string(REGEX REPLACE ".* version (.*)" "\\1" CLANG_FORMAT_VERSION "${CLANG_FORMAT_VERSION}")
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(ClangFormat REQUIRED_VARS CLANG_FORMAT_EXECUTABLE
+ VERSION_VAR CLANG_FORMAT_VERSION)
+
+mark_as_advanced(CLANG_FORMAT_EXECUTABLE)
diff --git a/cmake/modules/buildtools/FindClangTidy.cmake b/cmake/modules/buildtools/FindClangTidy.cmake
new file mode 100644
index 0000000..c133175
--- /dev/null
+++ b/cmake/modules/buildtools/FindClangTidy.cmake
@@ -0,0 +1,29 @@
+#.rst:
+# FindClangTidy
+# -------------
+# Finds clang-tidy and sets it up to run along with the compiler for C and CXX.
+
+find_program(CLANG_TIDY_EXECUTABLE clang-tidy)
+
+if(CLANG_TIDY_EXECUTABLE)
+ execute_process(COMMAND "${CLANG_TIDY_EXECUTABLE}" --version
+ OUTPUT_VARIABLE CLANG_TIDY_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ string(REGEX MATCH "[^\n]* version [^\n]*" CLANG_TIDY_VERSION "${CLANG_TIDY_VERSION}")
+ string(REGEX REPLACE ".* version (.*)" "\\1" CLANG_TIDY_VERSION "${CLANG_TIDY_VERSION}")
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(ClangTidy REQUIRED_VARS CLANG_TIDY_EXECUTABLE
+ VERSION_VAR CLANG_TIDY_VERSION)
+
+if(CLANGTIDY_FOUND)
+ if(CORE_SYSTEM_NAME STREQUAL android)
+ set(CLANG_TIDY_EXECUTABLE ${CLANG_TIDY_EXECUTABLE};--extra-arg-before=--target=${HOST})
+ endif()
+ # Supports Unix Makefiles and Ninja
+ set(CMAKE_C_CLANG_TIDY "${CLANG_TIDY_EXECUTABLE}" PARENT_SCOPE)
+ set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_EXECUTABLE}" PARENT_SCOPE)
+endif()
+
+mark_as_advanced(CLANG_TIDY_EXECUTABLE)
diff --git a/cmake/modules/buildtools/FindCppcheck.cmake b/cmake/modules/buildtools/FindCppcheck.cmake
new file mode 100644
index 0000000..27e2675
--- /dev/null
+++ b/cmake/modules/buildtools/FindCppcheck.cmake
@@ -0,0 +1,32 @@
+#.rst:
+# FindCppcheck
+# ------------
+# Finds cppcheck and sets it up to run along with the compiler for C and CXX.
+
+find_program(CPPCHECK_EXECUTABLE cppcheck)
+
+if(CPPCHECK_EXECUTABLE)
+ execute_process(COMMAND "${CPPCHECK_EXECUTABLE}" --version
+ OUTPUT_VARIABLE CPPCHECK_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ string(REGEX REPLACE "Cppcheck (.*)" "\\1" CPPCHECK_VERSION "${CPPCHECK_VERSION}")
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Cppcheck REQUIRED_VARS CPPCHECK_EXECUTABLE
+ VERSION_VAR CPPCHECK_VERSION)
+
+if(CPPCHECK_FOUND)
+ # CMake < 3.16 treats Objective-C (OBJC) files as C files and Objective-C++ (OBJCXX) files as C++ files,
+ # but cppcheck doesn't support Objective-C and Objective-C++.
+ # CMake >= 3.16 added support for Objective-C and Objective-C++ language,
+ # but doesn't support OBJC and OBJCXX for <LANG>_CLANG_TIDY.
+ file(WRITE "${CMAKE_BINARY_DIR}/cppcheck" "case \"$@\" in *.m|*.mm) exit 0; esac\nexec \"${CPPCHECK_EXECUTABLE}\" --enable=performance --quiet --relative-paths=\"${CMAKE_SOURCE_DIR}\" \"$@\"\n")
+ execute_process(COMMAND chmod +x "${CMAKE_BINARY_DIR}/cppcheck")
+
+ # Supports Unix Makefiles and Ninja
+ set(CMAKE_C_CPPCHECK "${CMAKE_BINARY_DIR}/cppcheck" PARENT_SCOPE)
+ set(CMAKE_CXX_CPPCHECK "${CMAKE_BINARY_DIR}/cppcheck" PARENT_SCOPE)
+endif()
+
+mark_as_advanced(CPPCHECK_EXECUTABLE)
diff --git a/cmake/modules/buildtools/FindFlatC.cmake b/cmake/modules/buildtools/FindFlatC.cmake
new file mode 100644
index 0000000..bca17e8
--- /dev/null
+++ b/cmake/modules/buildtools/FindFlatC.cmake
@@ -0,0 +1,99 @@
+# FindFlatC
+# --------
+# Find the FlatBuffers schema compiler
+#
+# This will define the following variables:
+#
+# FLATBUFFERS_FLATC_EXECUTABLE_FOUND - system has FlatBuffers compiler
+# FLATBUFFERS_FLATC_EXECUTABLE - the flatc compiler executable
+# FLATBUFFERS_FLATC_VERSION - the flatc compiler version
+#
+# and the following imported targets:
+#
+# flatbuffers::flatc - The FlatC compiler
+
+if(NOT TARGET flatbuffers::flatc)
+ include(cmake/scripts/common/ModuleHelpers.cmake)
+
+ # Check for existing FLATC.
+ find_program(FLATBUFFERS_FLATC_EXECUTABLE NAMES flatc
+ HINTS ${NATIVEPREFIX}/bin)
+
+ if(FLATBUFFERS_FLATC_EXECUTABLE)
+ execute_process(COMMAND "${FLATBUFFERS_FLATC_EXECUTABLE}" --version
+ OUTPUT_VARIABLE FLATBUFFERS_FLATC_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ string(REGEX MATCH "[^\n]* version [^\n]*" FLATBUFFERS_FLATC_VERSION "${FLATBUFFERS_FLATC_VERSION}")
+ string(REGEX REPLACE ".* version (.*)" "\\1" FLATBUFFERS_FLATC_VERSION "${FLATBUFFERS_FLATC_VERSION}")
+ endif()
+
+ set(MODULE_LC flatbuffers)
+ # Duplicate URL may exist from FindFlatbuffers.cmake
+ # unset otherwise it thinks we are providing a local file location and incorrect concatenation happens
+ unset(FLATBUFFERS_URL)
+ SETUP_BUILD_VARS()
+
+ if(NOT FLATBUFFERS_FLATC_EXECUTABLE OR (ENABLE_INTERNAL_FLATBUFFERS AND NOT "${FLATBUFFERS_FLATC_VERSION}" VERSION_EQUAL "${FLATBUFFERS_VER}"))
+
+ # Override build type detection and always build as release
+ set(FLATBUFFERS_BUILD_TYPE Release)
+
+ if(NATIVEPREFIX)
+ set(INSTALL_DIR "${NATIVEPREFIX}/bin")
+ set(FLATBUFFERS_INSTALL_PREFIX ${NATIVEPREFIX})
+ else()
+ set(INSTALL_DIR "${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/bin")
+ set(FLATBUFFERS_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR})
+ endif()
+
+ set(CMAKE_ARGS -DFLATBUFFERS_CODE_COVERAGE=OFF
+ -DFLATBUFFERS_BUILD_TESTS=OFF
+ -DFLATBUFFERS_INSTALL=ON
+ -DFLATBUFFERS_BUILD_FLATLIB=OFF
+ -DFLATBUFFERS_BUILD_FLATC=ON
+ -DFLATBUFFERS_BUILD_FLATHASH=OFF
+ -DFLATBUFFERS_BUILD_GRPCTEST=OFF
+ -DFLATBUFFERS_BUILD_SHAREDLIB=OFF)
+
+ # Set host build info for buildtool
+ if(EXISTS "${NATIVEPREFIX}/share/Toolchain-Native.cmake")
+ set(FLATBUFFERS_TOOLCHAIN_FILE "${NATIVEPREFIX}/share/Toolchain-Native.cmake")
+ endif()
+
+ if(WIN32 OR WINDOWS_STORE)
+ # Make sure we generate for host arch, not target
+ set(FLATBUFFERS_GENERATOR_PLATFORM CMAKE_GENERATOR_PLATFORM ${HOSTTOOLSET})
+ set(WIN_DISABLE_PROJECT_FLAGS 1)
+ endif()
+
+ set(FLATBUFFERS_FLATC_EXECUTABLE ${INSTALL_DIR}/flatc CACHE INTERNAL "FlatBuffer compiler")
+
+ set(BUILD_NAME flatc)
+ set(BUILD_BYPRODUCTS ${FLATBUFFERS_FLATC_EXECUTABLE})
+ set(FLATBUFFERS_FLATC_VERSION ${FLATBUFFERS_VER})
+
+ BUILD_DEP_TARGET()
+ endif()
+
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(FlatC
+ REQUIRED_VARS FLATBUFFERS_FLATC_EXECUTABLE
+ VERSION_VAR FLATBUFFERS_FLATC_VERSION)
+
+ if(FLATC_FOUND)
+
+ add_library(flatbuffers::flatc UNKNOWN IMPORTED)
+ set_target_properties(flatbuffers::flatc PROPERTIES
+ FOLDER "External Projects")
+
+ if(TARGET flatc)
+ add_dependencies(flatbuffers::flatc flatc)
+ endif()
+ else()
+ if(FLATC_FIND_REQUIRED)
+ message(FATAL_ERROR "Flatc compiler not found.")
+ endif()
+ endif()
+
+ mark_as_advanced(FLATBUFFERS_FLATC_EXECUTABLE)
+endif()
diff --git a/cmake/modules/buildtools/FindGtest.cmake b/cmake/modules/buildtools/FindGtest.cmake
new file mode 100644
index 0000000..eba6adc
--- /dev/null
+++ b/cmake/modules/buildtools/FindGtest.cmake
@@ -0,0 +1,71 @@
+#.rst:
+# FindGtest
+# --------
+# Finds the gtest library
+#
+# This will define the following variables::
+#
+# GTEST_FOUND - system has gtest
+# GTEST_INCLUDE_DIRS - the gtest include directories
+# GTEST_LIBRARIES - the gtest libraries
+#
+# and the following imported targets:
+#
+# Gtest::Gtest - The gtest library
+
+if(ENABLE_INTERNAL_GTEST)
+ include(cmake/scripts/common/ModuleHelpers.cmake)
+
+ set(MODULE_LC gtest)
+
+ SETUP_BUILD_VARS()
+
+ set(GTEST_VERSION ${${MODULE}_VER})
+
+ # Override build type detection and always build as release
+ set(GTEST_BUILD_TYPE Release)
+
+ set(CMAKE_ARGS -DBUILD_GMOCK=OFF
+ -DINSTALL_GTEST=ON
+ -DBUILD_SHARED_LIBS=OFF
+ -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>)
+
+ BUILD_DEP_TARGET()
+else()
+ if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_GTEST gtest>=1.10.0 QUIET)
+ set(GTEST_VERSION ${PC_GTEST_VERSION})
+ elseif(WIN32)
+ set(GTEST_VERSION 1.10.0)
+ endif()
+
+ find_path(GTEST_INCLUDE_DIR NAMES gtest/gtest.h
+ PATHS ${PC_GTEST_INCLUDEDIR})
+
+ find_library(GTEST_LIBRARY_RELEASE NAMES gtest
+ PATHS ${PC_GTEST_LIBDIR})
+ find_library(GTEST_LIBRARY_DEBUG NAMES gtestd
+ PATHS ${PC_GTEST_LIBDIR})
+
+ include(SelectLibraryConfigurations)
+ select_library_configurations(GTEST)
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Gtest
+ REQUIRED_VARS GTEST_LIBRARY GTEST_INCLUDE_DIR
+ VERSION_VAR GTEST_VERSION)
+
+if(GTEST_FOUND)
+ set(GTEST_LIBRARIES ${GTEST_LIBRARY})
+ set(GTEST_INCLUDE_DIRS ${GTEST_INCLUDE_DIR})
+endif()
+
+if(NOT TARGET Gtest::Gtest)
+ add_library(Gtest::Gtest UNKNOWN IMPORTED)
+ set_target_properties(Gtest::Gtest PROPERTIES
+ IMPORTED_LOCATION "${GTEST_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${GTEST_INCLUDE_DIR}")
+endif()
+
+mark_as_advanced(GTEST_INCLUDE_DIR GTEST_LIBRARY)
diff --git a/cmake/modules/buildtools/FindIncludeWhatYouUse.cmake b/cmake/modules/buildtools/FindIncludeWhatYouUse.cmake
new file mode 100644
index 0000000..b22225a
--- /dev/null
+++ b/cmake/modules/buildtools/FindIncludeWhatYouUse.cmake
@@ -0,0 +1,26 @@
+#.rst:
+# FindIncludeWhatYouUse
+# ---------------------
+# Finds include-what-you-use and sets it up to run along with the compiler for C and CXX.
+
+find_program(IWYU_EXECUTABLE NAMES include-what-you-use iwyu)
+
+if(IWYU_EXECUTABLE)
+ execute_process(COMMAND "${IWYU_EXECUTABLE}" --version
+ OUTPUT_VARIABLE IWYU_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ string(REGEX MATCH "[^\n]*include-what-you-use [^\n]*" IWYU_VERSION "${IWYU_VERSION}")
+ string(REGEX REPLACE "include-what-you-use ([^ \n\r\t]+).*" "\\1" IWYU_VERSION "${IWYU_VERSION}")
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(IncludeWhatYouUse REQUIRED_VARS IWYU_EXECUTABLE
+ VERSION_VAR IWYU_VERSION)
+
+if(INCLUDEWHATYOUUSE_FOUND)
+ # Supports Unix Makefiles and Ninja
+ set(CMAKE_C_INCLUDE_WHAT_YOU_USE "${IWYU_EXECUTABLE}" PARENT_SCOPE)
+ set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "${IWYU_EXECUTABLE}" PARENT_SCOPE)
+endif()
+
+mark_as_advanced(IWYU_EXECUTABLE)
diff --git a/cmake/modules/buildtools/FindJsonSchemaBuilder.cmake b/cmake/modules/buildtools/FindJsonSchemaBuilder.cmake
new file mode 100644
index 0000000..6f75328
--- /dev/null
+++ b/cmake/modules/buildtools/FindJsonSchemaBuilder.cmake
@@ -0,0 +1,53 @@
+#.rst:
+# FindJsonSchemaBuilder
+# ---------------------
+# Finds the JsonSchemaBuilder
+#
+# If WITH_JSONSCHEMABUILDER is defined and points to a directory,
+# this path will be used to search for the JsonSchemaBuilder binary
+#
+#
+# This will define the following (imported) targets::
+#
+# JsonSchemaBuilder::JsonSchemaBuilder - The JsonSchemaBuilder executable
+
+if(NOT TARGET JsonSchemaBuilder::JsonSchemaBuilder)
+ if(KODI_DEPENDSBUILD)
+ get_filename_component(_jsbpath "${NATIVEPREFIX}/bin" ABSOLUTE)
+ find_program(JSONSCHEMABUILDER_EXECUTABLE NAMES "${APP_NAME_LC}-JsonSchemaBuilder" JsonSchemaBuilder
+ HINTS ${_jsbpath})
+
+ add_executable(JsonSchemaBuilder::JsonSchemaBuilder IMPORTED GLOBAL)
+ set_target_properties(JsonSchemaBuilder::JsonSchemaBuilder PROPERTIES
+ IMPORTED_LOCATION "${JSONSCHEMABUILDER_EXECUTABLE}")
+ elseif(CORE_SYSTEM_NAME STREQUAL windowsstore)
+ get_filename_component(_jsbpath "${DEPENDS_PATH}/bin/json-rpc" ABSOLUTE)
+ find_program(JSONSCHEMABUILDER_EXECUTABLE NAMES "${APP_NAME_LC}-JsonSchemaBuilder" JsonSchemaBuilder
+ HINTS ${_jsbpath})
+
+ add_executable(JsonSchemaBuilder::JsonSchemaBuilder IMPORTED GLOBAL)
+ set_target_properties(JsonSchemaBuilder::JsonSchemaBuilder PROPERTIES
+ IMPORTED_LOCATION "${JSONSCHEMABUILDER_EXECUTABLE}")
+ else()
+ if(WITH_JSONSCHEMABUILDER)
+ get_filename_component(_jsbpath ${WITH_JSONSCHEMABUILDER} ABSOLUTE)
+ get_filename_component(_jsbpath ${_jsbpath} DIRECTORY)
+ find_program(JSONSCHEMABUILDER_EXECUTABLE NAMES "${APP_NAME_LC}-JsonSchemaBuilder" JsonSchemaBuilder
+ HINTS ${_jsbpath})
+
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(JsonSchemaBuilder "Could not find '${APP_NAME_LC}-JsonSchemaBuilder' or 'JsonSchemaBuilder' executable in ${_jsbpath} supplied by -DWITH_JSONSCHEMABUILDER. Make sure the executable file name matches these names!"
+ JSONSCHEMABUILDER_EXECUTABLE)
+ if(JSONSCHEMABUILDER_FOUND)
+ add_executable(JsonSchemaBuilder::JsonSchemaBuilder IMPORTED GLOBAL)
+ set_target_properties(JsonSchemaBuilder::JsonSchemaBuilder PROPERTIES
+ IMPORTED_LOCATION "${JSONSCHEMABUILDER_EXECUTABLE}")
+ endif()
+ mark_as_advanced(JSONSCHEMABUILDER)
+ else()
+ add_subdirectory(${CMAKE_SOURCE_DIR}/tools/depends/native/JsonSchemaBuilder build/jsonschemabuilder)
+ add_executable(JsonSchemaBuilder::JsonSchemaBuilder ALIAS JsonSchemaBuilder)
+ set_target_properties(JsonSchemaBuilder PROPERTIES FOLDER Tools)
+ endif()
+ endif()
+endif()
diff --git a/cmake/modules/buildtools/FindNASM.cmake b/cmake/modules/buildtools/FindNASM.cmake
new file mode 100644
index 0000000..fc9daa0
--- /dev/null
+++ b/cmake/modules/buildtools/FindNASM.cmake
@@ -0,0 +1,30 @@
+#.rst:
+# FindNASM
+# ----------
+# Finds nasm executable
+#
+# This will define the following variables::
+#
+# NASM_EXECUTABLE - nasm executable
+
+include(FindPackageHandleStandardArgs)
+
+find_program(NASM_EXECUTABLE nasm)
+
+if(NASM_EXECUTABLE)
+ execute_process(COMMAND ${NASM_EXECUTABLE} -version
+ OUTPUT_VARIABLE nasm_version
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ if(nasm_version MATCHES "^NASM version ([0-9\\.]*)")
+ set(NASM_VERSION_STRING "${CMAKE_MATCH_1}")
+ endif()
+endif()
+
+# Provide standardized success/failure messages
+find_package_handle_standard_args(NASM
+ REQUIRED_VARS NASM_EXECUTABLE
+ VERSION_VAR NASM_VERSION_STRING)
+
+mark_as_advanced(NASM_EXECUTABLE)
diff --git a/cmake/modules/buildtools/FindPatch.cmake b/cmake/modules/buildtools/FindPatch.cmake
new file mode 100644
index 0000000..669b4d2
--- /dev/null
+++ b/cmake/modules/buildtools/FindPatch.cmake
@@ -0,0 +1,84 @@
+#.rst:
+# FindPatch
+# ----------
+# Finds patch executable
+# Windows platforms will download patch zip from mirrors if not found.
+#
+# This will define the following variables::
+#
+# PATCH_EXECUTABLE - patch executable
+
+if(CMAKE_HOST_WIN32)
+
+ find_package(Git)
+ if(Git_FOUND)
+ get_filename_component(GIT_DIR ${GIT_EXECUTABLE} DIRECTORY)
+ endif()
+
+ find_program(PATCH_EXE NAMES patch.exe HINTS "${GIT_DIR}/.." PATH_SUFFIXES usr/bin)
+else()
+ # Freebsd patch is insufficient (too old) look for gnu patch first
+ find_program(PATCH_EXE NAMES gpatch patch)
+endif()
+
+if(CMAKE_HOST_WIN32 AND NOT PATCH_EXE)
+ # Set mirror for potential patch binary download
+ if(NOT KODI_MIRROR)
+ set(KODI_MIRROR "http://mirrors.kodi.tv")
+ endif()
+
+ set(PATCH_ARCHIVE_NAME "patch-2.7.6-bin")
+ set(PATCH_ARCHIVE "${PATCH_ARCHIVE_NAME}.zip")
+ set(PATCH_URL "${KODI_MIRROR}/build-deps/win32/${PATCH_ARCHIVE}")
+ set(PATCH_DOWNLOAD ${TARBALL_DIR}/${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()
+
+ # CORE_BUILD_DIR may not exist as yet, so create just in case
+ if(NOT EXISTS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR})
+ file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR})
+ endif()
+
+ # extract the archive containing patch.exe
+ execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzvf ${PATCH_DOWNLOAD}
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR})
+
+ # make sure the extraction worked and that patch.exe is there
+ set(PATCH_PATH ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${PATCH_ARCHIVE_NAME})
+ if(NOT EXISTS "${PATCH_PATH}/bin/patch.exe")
+ message(FATAL_ERROR "ERROR extracting patch utility from ${PATCH_PATH}")
+ endif()
+
+ # copy patch.exe into the output directory
+ file(INSTALL "${PATCH_PATH}/bin/patch.exe" DESTINATION ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/bin)
+ # copy patch depends
+ file(GLOB PATCH_BINARIES ${PATCH_PATH}/bin/*.dll)
+ if(NOT "${PATCH_BINARIES}" STREQUAL "")
+ file(INSTALL ${PATCH_BINARIES} DESTINATION ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/bin)
+ endif()
+
+ # make sure that cmake can find the copied patch.exe
+ find_program(PATCH_EXE NAMES patch.exe HINTS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/bin REQUIRED)
+endif()
+
+if(PATCH_EXE)
+ execute_process(COMMAND "${PATCH_EXE}" --version
+ OUTPUT_VARIABLE PATCH_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ string(REGEX MATCH "[^\n]*patch [^\n]*" PATCH_VERSION "${PATCH_VERSION}")
+ string(REGEX REPLACE ".*patch (.*)" "\\1" PATCH_VERSION "${PATCH_VERSION}")
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Patch REQUIRED_VARS PATCH_EXE VERSION_VAR PATCH_VERSION)
+
+if(PATCH_FOUND)
+ set(PATCH_EXECUTABLE "${PATCH_EXE}")
+ mark_as_advanced(PATCH_EXE)
+endif()
diff --git a/cmake/modules/buildtools/FindSWIG.cmake b/cmake/modules/buildtools/FindSWIG.cmake
new file mode 100644
index 0000000..fba544b
--- /dev/null
+++ b/cmake/modules/buildtools/FindSWIG.cmake
@@ -0,0 +1,29 @@
+#.rst:
+# FindSWIG
+# --------
+# Finds the SWIG executable
+#
+# This will define the following variables::
+#
+# SWIG_FOUND - system has SWIG
+# SWIG_EXECUTABLE - the SWIG executable
+
+find_program(SWIG_EXECUTABLE NAMES swig4.0 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/buildtools/FindTexturePacker.cmake b/cmake/modules/buildtools/FindTexturePacker.cmake
new file mode 100644
index 0000000..4817d15
--- /dev/null
+++ b/cmake/modules/buildtools/FindTexturePacker.cmake
@@ -0,0 +1,93 @@
+#.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::Executable - The TexturePacker executable participating in build
+# TexturePacker::TexturePacker::Installable - The TexturePacker executable shipped in the Kodi package
+
+if(NOT TARGET TexturePacker::TexturePacker::Executable)
+ if(KODI_DEPENDSBUILD)
+ get_filename_component(_tppath "${NATIVEPREFIX}/bin" ABSOLUTE)
+ find_program(TEXTUREPACKER_EXECUTABLE NAMES "${APP_NAME_LC}-TexturePacker" TexturePacker
+ HINTS ${_tppath})
+
+ add_executable(TexturePacker::TexturePacker::Executable IMPORTED GLOBAL)
+ set_target_properties(TexturePacker::TexturePacker::Executable PROPERTIES
+ IMPORTED_LOCATION "${TEXTUREPACKER_EXECUTABLE}")
+ message(STATUS "External TexturePacker for KODI_DEPENDSBUILD will be executed during build: ${TEXTUREPACKER_EXECUTABLE}")
+ elseif(WIN32)
+ get_filename_component(_tppath "${DEPENDS_PATH}/tools/TexturePacker" ABSOLUTE)
+ find_program(TEXTUREPACKER_EXECUTABLE NAMES "${APP_NAME_LC}-TexturePacker.exe" TexturePacker.exe
+ HINTS ${_tppath})
+
+ add_executable(TexturePacker::TexturePacker::Executable IMPORTED GLOBAL)
+ set_target_properties(TexturePacker::TexturePacker::Executable PROPERTIES
+ IMPORTED_LOCATION "${TEXTUREPACKER_EXECUTABLE}")
+ message(STATUS "External TexturePacker for WIN32 will be executed during build: ${TEXTUREPACKER_EXECUTABLE}")
+ else()
+ if(WITH_TEXTUREPACKER)
+ get_filename_component(_tppath ${WITH_TEXTUREPACKER} ABSOLUTE)
+ get_filename_component(_tppath ${_tppath} DIRECTORY)
+ find_program(TEXTUREPACKER_EXECUTABLE NAMES "${APP_NAME_LC}-TexturePacker" TexturePacker
+ HINTS ${_tppath})
+
+ # Use external TexturePacker executable if found
+ if(TEXTUREPACKER_EXECUTABLE)
+ add_executable(TexturePacker::TexturePacker::Executable IMPORTED GLOBAL)
+ set_target_properties(TexturePacker::TexturePacker::Executable PROPERTIES
+ IMPORTED_LOCATION "${TEXTUREPACKER_EXECUTABLE}")
+ message(STATUS "Found external TexturePacker: ${TEXTUREPACKER_EXECUTABLE}")
+ else()
+ # Warn about external TexturePacker supplied but not fail fatally
+ # because we might have internal TexturePacker executable built
+ # and unset TEXTUREPACKER_EXECUTABLE variable
+ message(WARNING "Could not find '${APP_NAME_LC}-TexturePacker' or 'TexturePacker' executable in ${_tppath} supplied by -DWITH_TEXTUREPACKER. Make sure the executable file name matches these names!")
+ endif()
+ endif()
+
+ # Ship TexturePacker only on Linux and FreeBSD
+ if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ # But skip shipping it if build architecture can be executed on host
+ # and TEXTUREPACKER_EXECUTABLE is found
+ if(NOT (HOST_CAN_EXECUTE_TARGET AND TEXTUREPACKER_EXECUTABLE))
+ set(INTERNAL_TEXTUREPACKER_INSTALLABLE TRUE CACHE BOOL "" FORCE)
+ endif()
+ endif()
+
+ # Use it during build if build architecture can be executed on host
+ # and TEXTUREPACKER_EXECUTABLE is not found
+ if(HOST_CAN_EXECUTE_TARGET AND NOT TEXTUREPACKER_EXECUTABLE)
+ set(INTERNAL_TEXTUREPACKER_EXECUTABLE TRUE)
+ endif()
+
+ # Build and install internal TexturePacker if needed
+ if (INTERNAL_TEXTUREPACKER_EXECUTABLE OR INTERNAL_TEXTUREPACKER_INSTALLABLE)
+ add_subdirectory(${CMAKE_SOURCE_DIR}/tools/depends/native/TexturePacker build/texturepacker)
+ message(STATUS "Building internal TexturePacker")
+ endif()
+
+ if(INTERNAL_TEXTUREPACKER_INSTALLABLE)
+ add_executable(TexturePacker::TexturePacker::Installable ALIAS TexturePacker)
+ message(STATUS "Shipping internal TexturePacker")
+ endif()
+
+ if(INTERNAL_TEXTUREPACKER_EXECUTABLE)
+ add_executable(TexturePacker::TexturePacker::Executable ALIAS TexturePacker)
+ message(STATUS "Internal TexturePacker will be executed during build")
+ else()
+ message(STATUS "External TexturePacker will be executed during build: ${TEXTUREPACKER_EXECUTABLE}")
+
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(TexturePacker DEFAULT_MSG TEXTUREPACKER_EXECUTABLE)
+ endif()
+
+ mark_as_advanced(INTERNAL_TEXTUREPACKER_EXECUTABLE INTERNAL_TEXTUREPACKER_INSTALLABLE TEXTUREPACKER)
+ endif()
+endif()
diff --git a/cmake/modules/buildtools/LDGOLD.cmake b/cmake/modules/buildtools/LDGOLD.cmake
new file mode 100644
index 0000000..cdf71bf
--- /dev/null
+++ b/cmake/modules/buildtools/LDGOLD.cmake
@@ -0,0 +1,42 @@
+if(ENABLE_GOLD)
+ 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/buildtools/LLD.cmake b/cmake/modules/buildtools/LLD.cmake
new file mode 100644
index 0000000..e77009e
--- /dev/null
+++ b/cmake/modules/buildtools/LLD.cmake
@@ -0,0 +1,22 @@
+if(ENABLE_LLD)
+ execute_process(COMMAND ${CMAKE_CXX_COMPILER} -fuse-ld=lld -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
+ if(LD_VERSION MATCHES "LLD")
+ include(FindPackageHandleStandardArgs)
+ find_program(LLD_EXECUTABLE lld)
+ find_package_handle_standard_args(LLD REQUIRED_VARS LLD_EXECUTABLE)
+
+ if(LLD_FOUND)
+ set(CMAKE_LINKER ${LLD_EXECUTABLE})
+ set(CMAKE_CXX_LINK_FLAGS -fuse-ld=lld)
+ set(CMAKE_C_LINK_FLAGS -fuse-ld=lld)
+ set(CMAKE_EXE_LINKER_FLAGS "${LD_FLAGS} -fuse-ld=lld")
+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
+ set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
+ message(STATUS "Linker: LLVM lld")
+ endif()
+ mark_as_advanced(LLD_EXECUTABLE CMAKE_LINKER)
+
+ else()
+ message(FATAL_ERROR "LLVM lld linker not found")
+ endif()
+endif()
diff --git a/cmake/modules/buildtools/MOLD.cmake b/cmake/modules/buildtools/MOLD.cmake
new file mode 100644
index 0000000..cb29ed1
--- /dev/null
+++ b/cmake/modules/buildtools/MOLD.cmake
@@ -0,0 +1,77 @@
+if(ENABLE_MOLD)
+ if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12)
+ # GCC < 12 doesn't support -fuse-ld=mold, so we have to use tools prefix path
+ # if mold is installed in a non-standard dir, users can set -DMOLD_PREFIX=/path/to/mold_install_prefix
+ find_path(MOLD_PREFIX_DIR NAMES ld
+ NO_DEFAULT_PATH # this is needed, otherwise we find /usr/bin/ld
+ PATH_SUFFIXES libexec/mold
+ PATHS ${MOLD_PREFIX} /usr /usr/local)
+ if(MOLD_PREFIX_DIR)
+ set(COMPILER_ARGS "-B${MOLD_PREFIX_DIR}")
+ else()
+ message(WARNING "Mold LD path not found, you might need to set -DMOLD_PREFIX=/path/to/mold_install_prefix")
+ endif()
+ else()
+ set(COMPILER_ARGS "-fuse-ld=mold")
+ endif()
+
+ execute_process(COMMAND ${CMAKE_CXX_COMPILER} ${COMPILER_ARGS} -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
+
+ set(DEFAULT_ENABLE_DEBUGFISSION FALSE)
+ if(CMAKE_BUILD_TYPE STREQUAL Debug OR
+ CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo)
+ set(DEFAULT_ENABLE_DEBUGFISSION TRUE)
+ endif()
+
+ include(CMakeDependentOption)
+ cmake_dependent_option(ENABLE_DEBUGFISSION "Enable Debug Fission support" ON
+ "DEFAULT_ENABLE_DEBUGFISSION" OFF)
+
+ if(ENABLE_DEBUGFISSION)
+ include(TestCXXAcceptsFlag)
+ check_cxx_accepts_flag(-gsplit-dwarf CXX_ACCEPTS_GSPLIT_DWARF)
+
+ # extract mold version
+ set(LD_VERSION_LIST ${LD_VERSION})
+ separate_arguments(LD_VERSION_LIST)
+ list(GET LD_VERSION_LIST 1 MOLD_VERSION)
+
+ set(DEBUGFISSION_AVAILABLE FALSE)
+ if(CXX_ACCEPTS_GSPLIT_DWARF)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -gsplit-dwarf")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -gsplit-dwarf")
+ if(${MOLD_VERSION} VERSION_GREATER_EQUAL "1.2.0")
+ 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_AVAILABLE TRUE)
+ endif()
+ endif()
+
+ if(DEBUGFISSION_AVAILABLE)
+ message(STATUS "Debug Fission enabled")
+ else()
+ message(WARNING "Debug Fission is not available")
+ endif()
+ endif()
+
+ if(LD_VERSION MATCHES "mold")
+ include(FindPackageHandleStandardArgs)
+ find_program(MOLD_EXECUTABLE mold)
+ find_package_handle_standard_args(MOLD REQUIRED_VARS MOLD_EXECUTABLE)
+
+ if(MOLD_FOUND)
+ set(CMAKE_LINKER ${MOLD_EXECUTABLE})
+ set(CMAKE_CXX_LINK_FLAGS ${COMPILER_ARGS})
+ set(CMAKE_C_LINK_FLAGS ${COMPILER_ARGS})
+ set(CMAKE_EXE_LINKER_FLAGS "${LD_FLAGS} ${COMPILER_ARGS} ${CMAKE_EXE_LINKER_FLAGS}")
+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
+ set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
+ message(STATUS "Linker: mold")
+ endif()
+ mark_as_advanced(MOLD_EXECUTABLE CMAKE_LINKER)
+
+ else()
+ message(FATAL_ERROR "Mold linker not found")
+ endif()
+endif()
diff --git a/cmake/modules/extra/ECMEnableSanitizers.cmake b/cmake/modules/extra/ECMEnableSanitizers.cmake
new file mode 100644
index 0000000..aa7092d
--- /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/android.cmake b/cmake/platform/android/android.cmake
new file mode 100644
index 0000000..2c4fbb4
--- /dev/null
+++ b/cmake/platform/android/android.cmake
@@ -0,0 +1,7 @@
+set(PLATFORM_REQUIRED_DEPS LibAndroidJNI OpenGLES EGL LibZip)
+set(APP_RENDER_SYSTEM gles)
+
+# Store SDK compile version
+set(TARGET_SDK 33)
+# Minimum supported SDK version
+set(TARGET_MINSDK 21)
diff --git a/cmake/platform/android/defines.txt b/cmake/platform/android/defines.txt
new file mode 100644
index 0000000..4b70e59
--- /dev/null
+++ b/cmake/platform/android/defines.txt
@@ -0,0 +1 @@
+-DTARGET_POSIX -DTARGET_LINUX -DTARGET_ANDROID
diff --git a/cmake/platform/darwin_embedded/defines.txt b/cmake/platform/darwin_embedded/defines.txt
new file mode 100644
index 0000000..603d749
--- /dev/null
+++ b/cmake/platform/darwin_embedded/defines.txt
@@ -0,0 +1 @@
+-DTARGET_POSIX -DTARGET_DARWIN -DTARGET_DARWIN_EMBEDDED
diff --git a/cmake/platform/darwin_embedded/ios.cmake b/cmake/platform/darwin_embedded/ios.cmake
new file mode 100644
index 0000000..55d7c4a
--- /dev/null
+++ b/cmake/platform/darwin_embedded/ios.cmake
@@ -0,0 +1 @@
+list(APPEND ARCH_DEFINES -DTARGET_DARWIN_IOS)
diff --git a/cmake/platform/darwin_embedded/tvos.cmake b/cmake/platform/darwin_embedded/tvos.cmake
new file mode 100644
index 0000000..8d2538c
--- /dev/null
+++ b/cmake/platform/darwin_embedded/tvos.cmake
@@ -0,0 +1,2 @@
+list(APPEND ARCH_DEFINES -DTARGET_DARWIN_TVOS)
+set(ENABLE_AIRTUNES OFF CACHE BOOL "" FORCE)
diff --git a/cmake/platform/freebsd/defines.txt b/cmake/platform/freebsd/defines.txt
new file mode 100644
index 0000000..bd23e57
--- /dev/null
+++ b/cmake/platform/freebsd/defines.txt
@@ -0,0 +1 @@
+-DTARGET_POSIX -DTARGET_FREEBSD
diff --git a/cmake/platform/freebsd/gbm.cmake b/cmake/platform/freebsd/gbm.cmake
new file mode 100644
index 0000000..2d20731
--- /dev/null
+++ b/cmake/platform/freebsd/gbm.cmake
@@ -0,0 +1,2 @@
+include(cmake/platform/linux/gbm.cmake)
+list(APPEND PLATFORM_REQUIRED_DEPS EpollShim)
diff --git a/cmake/platform/freebsd/wayland.cmake b/cmake/platform/freebsd/wayland.cmake
new file mode 100644
index 0000000..c9c1d00
--- /dev/null
+++ b/cmake/platform/freebsd/wayland.cmake
@@ -0,0 +1 @@
+include(cmake/platform/linux/wayland.cmake)
diff --git a/cmake/platform/freebsd/x11.cmake b/cmake/platform/freebsd/x11.cmake
new file mode 100644
index 0000000..307dac3
--- /dev/null
+++ b/cmake/platform/freebsd/x11.cmake
@@ -0,0 +1,2 @@
+list(APPEND PLATFORM_REQUIRED_DEPS OpenGl EGL X XRandR LibDRM)
+list(APPEND PLATFORM_OPTIONAL_DEPS VAAPI VDPAU GLX)
diff --git a/cmake/platform/linux/defines.txt b/cmake/platform/linux/defines.txt
new file mode 100644
index 0000000..88d2e6e
--- /dev/null
+++ b/cmake/platform/linux/defines.txt
@@ -0,0 +1 @@
+-DTARGET_POSIX -DTARGET_LINUX -fPIC
diff --git a/cmake/platform/linux/gbm.cmake b/cmake/platform/linux/gbm.cmake
new file mode 100644
index 0000000..5e0475a
--- /dev/null
+++ b/cmake/platform/linux/gbm.cmake
@@ -0,0 +1,8 @@
+list(APPEND PLATFORM_REQUIRED_DEPS GBM LibDRM LibInput Xkbcommon UDEV)
+list(APPEND PLATFORM_OPTIONAL_DEPS VAAPI)
+
+if(APP_RENDER_SYSTEM STREQUAL "gl")
+ list(APPEND PLATFORM_REQUIRED_DEPS OpenGl EGL)
+elseif(APP_RENDER_SYSTEM STREQUAL "gles")
+ list(APPEND PLATFORM_REQUIRED_DEPS OpenGLES EGL)
+endif()
diff --git a/cmake/platform/linux/wayland.cmake b/cmake/platform/linux/wayland.cmake
new file mode 100644
index 0000000..1adcd8f
--- /dev/null
+++ b/cmake/platform/linux/wayland.cmake
@@ -0,0 +1,14 @@
+list(APPEND PLATFORM_REQUIRED_DEPS WaylandProtocols>=1.7 Waylandpp>=0.2.2 LibDRM Xkbcommon>=0.4.1)
+list(APPEND PLATFORM_OPTIONAL_DEPS VAAPI)
+
+if(APP_RENDER_SYSTEM STREQUAL "gl")
+ list(APPEND PLATFORM_REQUIRED_DEPS OpenGl EGL)
+elseif(APP_RENDER_SYSTEM STREQUAL "gles")
+ list(APPEND PLATFORM_REQUIRED_DEPS OpenGLES EGL)
+endif()
+
+set(PLATFORM_GLOBAL_TARGET_DEPS generate-wayland-extra-protocols)
+set(WAYLAND_EXTRA_PROTOCOL_GENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}")
+
+# for wayland-extra-protocols.hpp
+include_directories("${WAYLAND_EXTRA_PROTOCOL_GENERATED_DIR}")
diff --git a/cmake/platform/linux/x11.cmake b/cmake/platform/linux/x11.cmake
new file mode 100644
index 0000000..5f5b8c2
--- /dev/null
+++ b/cmake/platform/linux/x11.cmake
@@ -0,0 +1,9 @@
+list(APPEND PLATFORM_REQUIRED_DEPS EGL X XRandR LibDRM)
+list(APPEND PLATFORM_OPTIONAL_DEPS VAAPI)
+
+if(APP_RENDER_SYSTEM STREQUAL "gl")
+ list(APPEND PLATFORM_REQUIRED_DEPS OpenGl)
+ list(APPEND PLATFORM_OPTIONAL_DEPS GLX VDPAU)
+elseif(APP_RENDER_SYSTEM STREQUAL "gles")
+ list(APPEND PLATFORM_REQUIRED_DEPS OpenGLES)
+endif()
diff --git a/cmake/platform/osx/defines.txt b/cmake/platform/osx/defines.txt
new file mode 100644
index 0000000..8ebb2ba
--- /dev/null
+++ b/cmake/platform/osx/defines.txt
@@ -0,0 +1 @@
+-DTARGET_POSIX -DTARGET_DARWIN -DTARGET_DARWIN_OSX
diff --git a/cmake/platform/osx/osx.cmake b/cmake/platform/osx/osx.cmake
new file mode 100644
index 0000000..cd3a996
--- /dev/null
+++ b/cmake/platform/osx/osx.cmake
@@ -0,0 +1,20 @@
+if(NOT APP_RENDER_SYSTEM OR APP_RENDER_SYSTEM STREQUAL "gl")
+ list(APPEND PLATFORM_REQUIRED_DEPS OpenGl)
+ set(APP_RENDER_SYSTEM gl)
+ list(APPEND SYSTEM_DEFINES -DGL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
+ -DGL_SILENCE_DEPRECATION)
+else()
+ message(SEND_ERROR "Currently only OpenGL rendering is supported. Please set APP_RENDER_SYSTEM to \"gl\"")
+endif()
+
+if(NOT APP_WINDOW_SYSTEM OR APP_WINDOW_SYSTEM STREQUAL sdl)
+ list(APPEND SYSTEM_DEFINES -DHAS_SDL)
+ list(APPEND PLATFORM_REQUIRED_DEPS Sdl)
+ list(APPEND CORE_MAIN_SOURCE ${CMAKE_SOURCE_DIR}/xbmc/platform/darwin/osx/SDL/SDLMain.mm
+ ${CMAKE_SOURCE_DIR}/xbmc/platform/posix/main.cpp)
+elseif(APP_WINDOW_SYSTEM STREQUAL native)
+ # native windowing and input
+ list(APPEND CORE_MAIN_SOURCE ${CMAKE_SOURCE_DIR}/xbmc/platform/darwin/osx/XBMCApplication.mm)
+else()
+ message(SEND_ERROR "Only SDL or native windowing options are supported.")
+endif()
diff --git a/cmake/platform/windows/defines.txt b/cmake/platform/windows/defines.txt
new file mode 100644
index 0000000..137a3d6
--- /dev/null
+++ b/cmake/platform/windows/defines.txt
@@ -0,0 +1 @@
+-DTARGET_WINDOWS -DTARGET_WINDOWS_DESKTOP -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS \ No newline at end of file
diff --git a/cmake/platform/windows/windows.cmake b/cmake/platform/windows/windows.cmake
new file mode 100644
index 0000000..b0c2992
--- /dev/null
+++ b/cmake/platform/windows/windows.cmake
@@ -0,0 +1,2 @@
+set(PLATFORM_REQUIRED_DEPS D3DX11Effects)
+set(APP_RENDER_SYSTEM dx11)
diff --git a/cmake/platform/windowsstore/defines.txt b/cmake/platform/windowsstore/defines.txt
new file mode 100644
index 0000000..09e1b08
--- /dev/null
+++ b/cmake/platform/windowsstore/defines.txt
@@ -0,0 +1 @@
+-DTARGET_WINDOWS -DTARGET_WINDOWS_STORE -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS \ No newline at end of file
diff --git a/cmake/platform/windowsstore/windowsstore.cmake b/cmake/platform/windowsstore/windowsstore.cmake
new file mode 100644
index 0000000..b0c2992
--- /dev/null
+++ b/cmake/platform/windowsstore/windowsstore.cmake
@@ -0,0 +1,2 @@
+set(PLATFORM_REQUIRED_DEPS D3DX11Effects)
+set(APP_RENDER_SYSTEM dx11)
diff --git a/cmake/scripts/android/ArchSetup.cmake b/cmake/scripts/android/ArchSetup.cmake
new file mode 100644
index 0000000..2fe85fe
--- /dev/null
+++ b/cmake/scripts/android/ArchSetup.cmake
@@ -0,0 +1,45 @@
+if(NOT CMAKE_TOOLCHAIN_FILE)
+ message(FATAL_ERROR "CMAKE_TOOLCHAIN_FILE required for android. See ${CMAKE_SOURCE_DIR}/cmake/README.md")
+endif()
+
+set(ARCH_DEFINES -DTARGET_POSIX -DTARGET_LINUX -DTARGET_ANDROID)
+set(SYSTEM_DEFINES -D__STDC_CONSTANT_MACROS -D_LARGEFILE64_SOURCE
+ -D_FILE_OFFSET_BITS=64 -D__USE_FILE_OFFSET64=1)
+
+# Main cpp
+set(CORE_MAIN_SOURCE ${CMAKE_SOURCE_DIR}/xbmc/platform/android/activity/XBMCApp.cpp)
+
+set(PLATFORM_DIR platform/linux)
+set(PLATFORMDEFS_DIR platform/posix)
+if(WITH_ARCH)
+ set(ARCH ${WITH_ARCH})
+else()
+ if(CPU STREQUAL armeabi-v7a)
+ set(ARCH arm)
+ set(NEON True)
+ set(NEON_FLAGS "-mfpu=neon")
+ if(CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX)
+ set(NEON_FLAGS "${NEON_FLAGS} -mvectorize-with-neon-quad")
+ endif()
+ elseif(CPU STREQUAL arm64-v8a)
+ set(ARCH aarch64)
+ set(NEON True)
+ elseif(CPU STREQUAL i686)
+ set(ARCH i486-linux)
+ set(NEON False)
+ elseif(CPU STREQUAL x86_64)
+ set(ARCH x86_64)
+ set(NEON False)
+ else()
+ message(SEND_ERROR "Unknown CPU: ${CPU}")
+ endif()
+endif()
+
+# Additional SYSTEM_DEFINES
+list(APPEND SYSTEM_DEFINES -DHAS_ZEROCONF)
+
+set(ENABLE_X11 OFF CACHE BOOL "" FORCE)
+set(ENABLE_OPTICAL OFF CACHE BOOL "" FORCE)
+set(ENABLE_MDNS OFF CACHE BOOL "" FORCE)
+
+list(APPEND DEPLIBS android log jnigraphics mediandk)
diff --git a/cmake/scripts/android/Install.cmake b/cmake/scripts/android/Install.cmake
new file mode 100644
index 0000000..f39b858
--- /dev/null
+++ b/cmake/scripts/android/Install.cmake
@@ -0,0 +1,174 @@
+# Android packaging
+
+if(CMAKE_BUILD_TYPE STREQUAL Debug)
+ set(ANDROID_DEBUGGABLE true)
+else()
+ set(ANDROID_DEBUGGABLE false)
+endif()
+
+# Configure files into packaging environment.
+configure_file(${CMAKE_SOURCE_DIR}/tools/android/packaging/Makefile.in
+ ${CMAKE_BINARY_DIR}/tools/android/packaging/Makefile @ONLY)
+configure_file(${CMAKE_SOURCE_DIR}/tools/android/packaging/gradle.properties
+ ${CMAKE_BINARY_DIR}/tools/android/packaging/gradle.properties COPYONLY)
+configure_file(${CMAKE_SOURCE_DIR}/tools/android/packaging/build.gradle
+ ${CMAKE_BINARY_DIR}/tools/android/packaging/build.gradle COPYONLY)
+configure_file(${CMAKE_SOURCE_DIR}/tools/android/packaging/gradlew
+ ${CMAKE_BINARY_DIR}/tools/android/packaging/gradlew COPYONLY)
+configure_file(${CMAKE_SOURCE_DIR}/tools/android/packaging/settings.gradle
+ ${CMAKE_BINARY_DIR}/tools/android/packaging/settings.gradle COPYONLY)
+configure_file(${CMAKE_SOURCE_DIR}/tools/android/packaging/gradle/wrapper/gradle-wrapper.jar
+ ${CMAKE_BINARY_DIR}/tools/android/packaging/gradle/wrapper/gradle-wrapper.jar COPYONLY)
+configure_file(${CMAKE_SOURCE_DIR}/tools/android/packaging/gradle/wrapper/gradle-wrapper.properties
+ ${CMAKE_BINARY_DIR}/tools/android/packaging/gradle/wrapper/gradle-wrapper.properties COPYONLY)
+configure_file(${CMAKE_SOURCE_DIR}/tools/android/packaging/xbmc/jni/Android.mk
+ ${CMAKE_BINARY_DIR}/tools/android/packaging/xbmc/jni/Android.mk COPYONLY)
+file(WRITE ${CMAKE_BINARY_DIR}/tools/depends/Makefile.include
+ "$(PREFIX)/lib/${APP_NAME_LC}/lib${APP_NAME_LC}.so: ;\n")
+
+string(REPLACE "." ";" APP_VERSION_CODE_LIST ${APP_VERSION_CODE})
+list(GET APP_VERSION_CODE_LIST 0 major)
+list(GET APP_VERSION_CODE_LIST 1 minor)
+list(GET APP_VERSION_CODE_LIST 2 patch)
+unset(APP_VERSION_CODE_LIST)
+math(EXPR APP_VERSION_CODE_ANDROID "(${major} * 100 + ${minor}) * 1000 + ${patch}")
+unset(major)
+unset(minor)
+if(ARCH STREQUAL aarch64 AND patch LESS 999)
+ math(EXPR APP_VERSION_CODE_ANDROID "${APP_VERSION_CODE_ANDROID} + 1")
+endif()
+unset(patch)
+
+set(package_files strings.xml
+ colors.xml
+ searchable.xml
+ AndroidManifest.xml
+ build.gradle
+ src/Splash.java
+ src/Main.java
+ src/XBMCBroadcastReceiver.java
+ src/XBMCInputDeviceListener.java
+ src/XBMCJsonRPC.java
+ src/XBMCMainView.java
+ src/XBMCMediaSession.java
+ src/XBMCRecommendationBuilder.java
+ src/XBMCSearchableActivity.java
+ src/XBMCSettingsContentObserver.java
+ src/XBMCProperties.java
+ src/XBMCVideoView.java
+ src/XBMCFile.java
+ src/XBMCURIUtils.java
+ src/channels/SyncChannelJobService.java
+ src/channels/SyncProgramsJobService.java
+ src/channels/model/XBMCDatabase.java
+ src/channels/model/Subscription.java
+ src/channels/util/SharedPreferencesHelper.java
+ src/channels/util/TvUtil.java
+ src/interfaces/XBMCAudioManagerOnAudioFocusChangeListener.java
+ src/interfaces/XBMCSurfaceTextureOnFrameAvailableListener.java
+ src/interfaces/XBMCNsdManagerResolveListener.java
+ src/interfaces/XBMCNsdManagerRegistrationListener.java
+ src/interfaces/XBMCNsdManagerDiscoveryListener.java
+ src/interfaces/XBMCMediaDrmOnEventListener.java
+ src/interfaces/XBMCDisplayManagerDisplayListener.java
+ src/interfaces/XBMCSpeechRecognitionListener.java
+ src/model/TVEpisode.java
+ src/model/Movie.java
+ src/model/TVShow.java
+ src/model/File.java
+ src/model/Album.java
+ src/model/Song.java
+ src/model/MusicVideo.java
+ src/model/Media.java
+ src/content/XBMCFileContentProvider.java
+ src/content/XBMCMediaContentProvider.java
+ src/content/XBMCContentProvider.java
+ src/content/XBMCYTDLContentProvider.java
+ )
+foreach(file IN LISTS package_files)
+ configure_file(${CMAKE_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 ${CMAKE_SOURCE_DIR}/tools/android/packaging/media
+ ${CMAKE_BINARY_DIR}/tools/android/packaging/media
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/tools/android/packaging/xbmc/res
+ ${CMAKE_BINARY_DIR}/tools/android/packaging/xbmc/res
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${DEPENDS_PATH}/lib/python${PYTHON_VERSION} ${libdir}/python${PYTHON_VERSION}
+ 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)
+ add_dependencies(bundle_files ${APP_NAME_LC})
+ 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(${ASS_LIBRARY} ${libdir} "")
+add_bundle_file(${SHAIRPLAY_LIBRARY} ${libdir} "")
+add_bundle_file(${SMBCLIENT_LIBRARY} ${libdir} "")
+
+# Main targets from Makefile.in
+if(CPU MATCHES i686)
+ set(CPU x86)
+endif()
+foreach(target apk apk-clean)
+ add_custom_target(${target}
+ COMMAND env PATH=${NATIVEPREFIX}/bin:$ENV{PATH} ${CMAKE_MAKE_PROGRAM} -j1
+ -C ${CMAKE_BINARY_DIR}/tools/android/packaging
+ CMAKE_SOURCE_DIR=${CMAKE_SOURCE_DIR}
+ CC=${CMAKE_C_COMPILER}
+ CPU=${CPU}
+ HOST=${HOST}
+ TOOLCHAIN=${TOOLCHAIN}
+ PREFIX=${prefix}
+ DEPENDS_PATH=${DEPENDS_PATH}
+ NDKROOT=${NDKROOT}
+ SDKROOT=${SDKROOT}
+ STRIP=${CMAKE_STRIP}
+ ${target}
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/tools/android/packaging
+ VERBATIM
+ )
+ 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 0000000..2fdbb25
--- /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 0000000..6115781
--- /dev/null
+++ b/cmake/scripts/android/PathSetup.cmake
@@ -0,0 +1,33 @@
+if(NOT prefix)
+ set(prefix ${DEPENDS_PATH})
+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}/${APP_NAME_LC}\"
+ -DINSTALL_PATH=\"${datarootdir}/${APP_NAME_LC}\")
diff --git a/cmake/scripts/common/AddOptions.cmake b/cmake/scripts/common/AddOptions.cmake
new file mode 100644
index 0000000..96837c1
--- /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 0000000..c541ad7
--- /dev/null
+++ b/cmake/scripts/common/AddonHelpers.cmake
@@ -0,0 +1,437 @@
+# 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.
+get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+if(_isMultiConfig)
+ add_custom_target(addon-package DEPENDS PACKAGE)
+else()
+ add_custom_target(addon-package
+ COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target package)
+endif()
+
+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 POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${PACKAGE_DIR}
+ COMMAND ${CMAKE_COMMAND} -E copy ${CPACK_PACKAGE_DIRECTORY}/addon-${target}-${version}-${PLATFORM_TAG}.${ext} ${PACKAGE_DIR}/${target}+${PLATFORM_TAG}/${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})
+
+ # Below comes the generation of a list with used sources where the includes to
+ # kodi's headers becomes checked.
+ # This goes the following steps to identify them:
+ # 1. Check headers are at own depended on addon
+ # - If so, it is checked whether the whole folder is already inserted, if
+ # not, it is added.
+ # 2. If headers are not defined independently and there is more as one source
+ # file.
+ # - If yes, it is checked whether the headers with the sources together
+ # - In case no headers are inserted and more than one source file exists,
+ # the whole addon folder is searched for headers.
+ # 3. As a last step, the actual source files are checked.
+ if(${prefix}_SOURCES)
+ # Read used headers from addon, needed to identitfy used kodi addon interface headers
+ if(${prefix}_HEADERS)
+ # Add the used header files defined with CMakeLists.txt from addon itself
+ string(FIND "${${prefix}_HEADERS}" "${PROJECT_SOURCE_DIR}" position)
+ if(position GREATER -1)
+ # include path name already complete
+ list(APPEND USED_SOURCES ${${prefix}_HEADERS})
+ else()
+ # add the complete include path to begin
+ foreach(hdr_file ${${prefix}_HEADERS})
+ list(APPEND USED_SOURCES ${PROJECT_SOURCE_DIR}/${hdr_file})
+ endforeach()
+ endif()
+ else()
+ list(LENGTH ${prefix}_SOURCES _length)
+ if(${_length} GREATER 1)
+ string(REGEX MATCHALL "[.](h)" _length ${${prefix}_SOURCES}})
+ if(NOT _length)
+ file(GLOB_RECURSE USED_SOURCES ${PROJECT_SOURCE_DIR}/*.h*)
+ if(USED_SOURCES)
+ message(AUTHOR_WARNING "Header files not defined in your CMakeLists.txt. Please consider defining ${prefix}_HEADERS as list of all headers used by this addon. Falling back to recursive scan for *.h.")
+ endif()
+ endif()
+ endif()
+ endif()
+
+ # Add the used source files defined with CMakeLists.txt from addon itself
+ string(FIND "${${prefix}_SOURCES}" "${PROJECT_SOURCE_DIR}" position)
+ if(position GREATER -1)
+ # include path name already complete
+ list(APPEND USED_SOURCES ${${prefix}_SOURCES})
+ else()
+ # add the complete include path to begin
+ foreach(src_file ${${prefix}_SOURCES})
+ list(APPEND USED_SOURCES ${PROJECT_SOURCE_DIR}/${src_file})
+ endforeach()
+ endif()
+
+ message(STATUS "Addon dependency check ...")
+ # Set defines used in addon.xml.in and read from versions.h to set add-on
+ # version parts automatically
+ file(STRINGS ${KODI_INCLUDE_DIR}/versions.h BIN_ADDON_PARTS)
+ foreach(loop_var ${BIN_ADDON_PARTS})
+ # Only pass strings with "#define ADDON_" from versions.h
+ if(loop_var MATCHES "#define ADDON_")
+ string(REGEX REPLACE "\\\n" " " loop_var ${loop_var}) # remove header line breaks
+ string(REGEX REPLACE "#define " "" loop_var ${loop_var}) # remove the #define name from string
+ string(REGEX MATCHALL "[//a-zA-Z0-9._-]+" loop_var "${loop_var}") # separate the define values to a list
+
+ # Get the definition name
+ list(GET loop_var 0 include_name)
+ # Check definition are depends who is a bigger list
+ if("${include_name}" MATCHES "_DEPENDS")
+ # Use start definition name as base for other value type
+ list(GET loop_var 0 list_name)
+ string(REPLACE "_DEPENDS" "_MIN" depends_minver ${list_name})
+ string(REPLACE "_DEPENDS" "" depends_ver ${list_name})
+ string(REPLACE "_DEPENDS" "_XML_ID" xml_entry_name ${list_name})
+ string(REPLACE "_DEPENDS" "_USED" used_type_name ${list_name})
+
+ # remove the first value, not needed and wrong on "for" loop
+ list(REMOVE_AT loop_var 0)
+
+ foreach(depend_header ${loop_var})
+ string(STRIP ${depend_header} depend_header)
+ foreach(src_file ${USED_SOURCES})
+ file(STRINGS ${src_file} BIN_ADDON_SRC_PARTS)
+ foreach(loop_var ${BIN_ADDON_SRC_PARTS})
+ string(REGEX MATCH "^[ \t]*#[ \t]*(include|import)[ \t]*[<\"](kodi\/)?(.+)[\">]" include_name "${loop_var}")
+ if(include_name AND CMAKE_MATCH_3 MATCHES ^${depend_header})
+ get_directory_property(CURRENT_DEFS COMPILE_DEFINITIONS)
+ if(NOT used_type_name IN_LIST CURRENT_DEFS)
+ set(ADDON_DEPENDS "${ADDON_DEPENDS}\n<import addon=\"${${xml_entry_name}}\" minversion=\"${${depends_minver}}\" version=\"${${depends_ver}}\"/>")
+ # Inform with them the addon header about used type, if not present before
+ add_definitions(-D${used_type_name})
+ message(STATUS " - Added API usage definition: ${used_type_name} (Version: \"${${depends_ver}}\", Min. Version: \"${${depends_minver}}\")")
+ set(FOUND_HEADER_USAGE 1)
+ endif()
+ endif()
+ endforeach()
+ if(FOUND_HEADER_USAGE EQUAL 1) # break this loop if found but not unset, needed in parts where includes muddled up on addon
+ break()
+ endif()
+ endforeach()
+ # type is found and round becomes broken for next round with other type
+ if(FOUND_HEADER_USAGE EQUAL 1)
+ unset(FOUND_HEADER_USAGE)
+ break()
+ endif()
+ endforeach()
+ else()
+ # read the definition values and make it by the on version.h defined names public
+ list(GET loop_var 1 include_variable)
+ string(REGEX REPLACE ".*\"(.*)\"" "\\1" ${include_name} ${include_variable})
+ set(${include_name} ${${include_name}})
+ endif()
+ endif()
+ endforeach()
+
+ add_library(${target} ${${prefix}_SOURCES} ${${prefix}_HEADERS})
+ target_link_libraries(${target} ${${libs}})
+ set_target_properties(${target} PROPERTIES VERSION ${${prefix}_VERSION}
+ SOVERSION ${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}
+ PREFIX ""
+ POSITION_INDEPENDENT_CODE 1)
+ 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)
+ if(CORE_SYSTEM_NAME STREQUAL android)
+ set(LIBRARY_FILENAME "lib${LIBRARY_FILENAME}")
+ endif()
+ 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)
+
+ file(READ ${PROJECT_SOURCE_DIR}/${target}/addon.xml.in addon_file)
+
+ # If sources are present must be the depends set
+ if(${prefix}_SOURCES)
+ string(FIND "${addon_file}" "\@ADDON_DEPENDS\@" matchres)
+ if("${matchres}" EQUAL -1)
+ message(FATAL_ERROR "\"\@ADDON_DEPENDS\@\" not found in addon.xml.in.")
+ endif()
+ endif()
+
+ # TODO: remove this hack after v18
+ string(REPLACE "<platform>\@PLATFORM\@</platform>" "<platform>\@PLATFORM_TAG\@</platform>" addon_file "${addon_file}")
+
+ string(CONFIGURE "${addon_file}" addon_file_conf @ONLY)
+ file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_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)
+
+ file(READ ${PROJECT_SOURCE_DIR}/${target}/resources/settings.xml.in settings_file)
+ string(CONFIGURE "${settings_file}" settings_file_conf @ONLY)
+ file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_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}-${PLATFORM_TAG})
+ # Pack files together to create an archive
+ install(DIRECTORY ${target} ${CMAKE_CURRENT_BINARY_DIR}/${target} DESTINATION ./
+ COMPONENT ${target}-${${prefix}_VERSION}-${PLATFORM_TAG}
+ REGEX ".+\\.xml\\.in(clude)?$" 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()
+
+ if(${prefix}_SOURCES)
+ # install the generated DLL file
+ install(PROGRAMS ${LIBRARY_LOCATION} DESTINATION ${target}
+ COMPONENT ${target}-${${prefix}_VERSION}-${PLATFORM_TAG})
+
+ # for debug builds also install the PDB file
+ install(FILES $<TARGET_PDB_FILE:${target}> DESTINATION ${target}
+ CONFIGURATIONS Debug RelWithDebInfo
+ COMPONENT ${target}-${${prefix}_VERSION}-${PLATFORM_TAG})
+ endif()
+ if(${prefix}_CUSTOM_BINARY)
+ install(FILES ${LIBRARY_LOCATION} DESTINATION ${target} RENAME ${LIBRARY_FILENAME}
+ COMPONENT ${target}-${${prefix}_VERSION}-${PLATFORM_TAG})
+ endif()
+ if(${prefix}_CUSTOM_DATA)
+ install(DIRECTORY ${${prefix}_CUSTOM_DATA} DESTINATION ${target}/resources
+ COMPONENT ${target}-${${prefix}_VERSION}-${PLATFORM_TAG})
+ endif()
+ if(${prefix}_ADDITIONAL_BINARY)
+ install(FILES ${${prefix}_ADDITIONAL_BINARY} DESTINATION ${target}
+ COMPONENT ${target}-${${prefix}_VERSION}-${PLATFORM_TAG})
+ endif()
+ if(${prefix}_ADDITIONAL_BINARY_EXE)
+ install(PROGRAMS ${${prefix}_ADDITIONAL_BINARY_EXE} DESTINATION ${target}
+ COMPONENT ${target}-${${prefix}_VERSION}-${PLATFORM_TAG})
+ endif()
+ if(${prefix}_ADDITIONAL_BINARY_PARTS)
+ install(FILES ${${prefix}_ADDITIONAL_BINARY_PARTS} DESTINATION ${target}
+ COMPONENT ${target}-${${prefix}_VERSION}-${PLATFORM_TAG})
+ endif()
+ if(${prefix}_ADDITIONAL_BINARY_DIRS)
+ install(DIRECTORY ${${prefix}_ADDITIONAL_BINARY_DIRS} DESTINATION ${target} USE_SOURCE_PERMISSIONS
+ COMPONENT ${target}-${${prefix}_VERSION}-${PLATFORM_TAG})
+ endif()
+ else() # NOT WIN32
+ 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}-${PLATFORM_TAG})
+ endif()
+ if(${prefix}_CUSTOM_BINARY)
+ install(FILES ${LIBRARY_LOCATION} DESTINATION ${target} RENAME ${LIBRARY_FILENAME}
+ COMPONENT ${target}-${${prefix}_VERSION}-${PLATFORM_TAG})
+ endif()
+ if(${prefix}_CUSTOM_DATA)
+ install(DIRECTORY ${${prefix}_CUSTOM_DATA} DESTINATION ${target}/resources
+ COMPONENT ${target}-${${prefix}_VERSION}-${PLATFORM_TAG})
+ endif()
+ if(${prefix}_ADDITIONAL_BINARY)
+ install(FILES ${${prefix}_ADDITIONAL_BINARY} DESTINATION ${target}
+ COMPONENT ${target}-${${prefix}_VERSION}-${PLATFORM_TAG})
+ endif()
+ if(${prefix}_ADDITIONAL_BINARY_EXE)
+ install(PROGRAMS ${${prefix}_ADDITIONAL_BINARY_EXE} DESTINATION ${target}
+ COMPONENT ${target}-${${prefix}_VERSION}-${PLATFORM_TAG})
+ endif()
+ if(${prefix}_ADDITIONAL_BINARY_PARTS)
+ install(FILES ${${prefix}_ADDITIONAL_BINARY_PARTS} DESTINATION ${target}
+ COMPONENT ${target}-${${prefix}_VERSION}-${PLATFORM_TAG})
+ endif()
+ if(${prefix}_ADDITIONAL_BINARY_DIRS)
+ install(DIRECTORY ${${prefix}_ADDITIONAL_BINARY_DIRS} DESTINATION ${target} USE_SOURCE_PERMISSIONS
+ COMPONENT ${target}-${${prefix}_VERSION}-${PLATFORM_TAG})
+ endif()
+ endif()
+ add_cpack_workaround(${target} ${${prefix}_VERSION} ${ext})
+ else()
+ if(CORE_SYSTEM_NAME STREQUAL linux 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)
+ install(FILES ${LIBRARY_LOCATION} DESTINATION ${CMAKE_INSTALL_LIBDIR}/addons/${target} RENAME ${LIBRARY_FILENAME})
+ endif()
+ install(DIRECTORY ${target} ${CMAKE_CURRENT_BINARY_DIR}/${target} DESTINATION ${CMAKE_INSTALL_DATADIR}/addons
+ REGEX ".+\\.xml\\.in(clude)?$" EXCLUDE)
+ if(${prefix}_CUSTOM_DATA)
+ install(DIRECTORY ${${prefix}_CUSTOM_DATA} DESTINATION ${CMAKE_INSTALL_DATADIR}/addons/${target}/resources)
+ endif()
+ if(${prefix}_ADDITIONAL_BINARY)
+ install(FILES ${${prefix}_ADDITIONAL_BINARY} DESTINATION ${CMAKE_INSTALL_LIBDIR}/addons/${target})
+ endif()
+ if(${prefix}_ADDITIONAL_BINARY_EXE)
+ install(PROGRAMS ${${prefix}_ADDITIONAL_BINARY_EXE} DESTINATION ${CMAKE_INSTALL_LIBDIR}/addons/${target})
+ endif()
+ if(${prefix}_ADDITIONAL_BINARY_PARTS)
+ install(FILES ${${prefix}_ADDITIONAL_BINARY_PARTS} DESTINATION ${CMAKE_INSTALL_LIBDIR}/addons/${target})
+ endif()
+ if(${prefix}_ADDITIONAL_BINARY_DIRS)
+ install(DIRECTORY ${${prefix}_ADDITIONAL_BINARY_DIRS} DESTINATION ${CMAKE_INSTALL_LIBDIR}/addons/${target} USE_SOURCE_PERMISSIONS)
+ endif()
+ endif()
+ if(${APP_NAME_UC}_BUILD_DIR)
+ file(GLOB_RECURSE files ${CMAKE_CURRENT_SOURCE_DIR}/${target}/*)
+ if(${prefix}_CUSTOM_DATA)
+ get_filename_component(dname ${${prefix}_CUSTOM_DATA} NAME)
+ add_custom_command(TARGET ${target} POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy_directory
+ ${${prefix}_CUSTOM_DATA}
+ ${${APP_NAME_UC}_BUILD_DIR}/addons/${target}/resources/${dname})
+ 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})
+ if(${prefix}_ADDITIONAL_BINARY)
+ add_custom_command(TARGET ${target} POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy
+ ${${prefix}_ADDITIONAL_BINARY}
+ ${${APP_NAME_UC}_BUILD_DIR}/addons/${target})
+ endif()
+ 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/AddonHelpers.dox b/cmake/scripts/common/AddonHelpers.dox
new file mode 100644
index 0000000..522e0e7
--- /dev/null
+++ b/cmake/scripts/common/AddonHelpers.dox
@@ -0,0 +1,59 @@
+/*!
+\addtogroup cpp_cmake
+
+Kodi which uses it as a library for its binary addons has a special build
+system for this.
+
+To implement this, a CMake macro brought by Kodi is used, this is
+"build_addon (...)". This processes various definitions passed by the addon to
+process the construction.
+
+
+--------------------------------------------------------------------------------
+
+<b>Here's a minimal example of the addon used for CMakeLists.txt:</b>
+
+~~~~~~~~~~~~~{.cmake}
+cmake_minimum_required(VERSION 3.5)
+project(example.addon)
+
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR})
+
+find_package(Kodi REQUIRED)
+
+include_directories(${KODI_INCLUDE_DIR}
+
+set(DEPLIBS ) # Here empty
+set(EXAMPLE_SOURCES src/main.cpp)
+set(EXAMPLE_HEADERS src/main.h)
+
+build_addon((example.addon EXAMPLE DEPLIBS)
+
+include(CPack)
+~~~~~~~~~~~~~
+
+
+--------------------------------------------------------------------------------
+
+This is a list of special variables that can be passed to the macro.
+The parts defined with "*" must be given the second name given to the macro.
+
+Here to define the necessary creation and installation files on addon CMakeLists.txt:
+| Name | Description
+|-----------------------------|-------------------------------------------------
+| *_SOURCES | List of source code files to be complicated.
+| *_HEADERS | List of used source code header files.
+| *_CUSTOM_BINARY | For special cases where an already created library from an external source is inserted, the <b>"* _SOURCES"</b> and <b>"* _HEADERS"</b> are unused in this case.<br>This is currently used primarily on game addons.
+| *_CUSTOM_DATA | To add additional required data from a folder, which are stored in the shared folder of the addon.<br>With a "/" at the end of the content given to the folder is used, without the folder itself.
+| *_ADDITIONAL_BINARY | In case the additional library has to be installed for the addon, the path or CMake name can be given here.
+| *_ADDITIONAL_BINARY_EXE | In case you need to addon an additional application you can give the path or CMake name, it will be in the same folder as the addon library.<br>The mode bits are set there as EXE.
+| *_ADDITIONAL_BINARY_DIRS | To add complete folders additionally to folders containing the addon library.<br>With a "/" at the end of the content given to the folder is used, without the folder itself.
+
+External creation Options, given by `-D...`:
+| Name | Description
+|-----------------------------|-------------------------------------------------
+| PACKAGE_ZIP | To create a package as a ZIP file. This is also used to install locally addon together.<br>Default is OFF.
+| PACKAGE_TGZ | To create a package as a TGZ file.<br>Default is OFF.
+| BUILD_SHARED_LIBS | To define if addon library is shared or static.<br>Default is ON to have shared.
+| USE_LTO | Use link time optimization.<br>Default is OFF.
+*/
diff --git a/cmake/scripts/common/ArchSetup.cmake b/cmake/scripts/common/ArchSetup.cmake
new file mode 100644
index 0000000..a59fcb5
--- /dev/null
+++ b/cmake/scripts/common/ArchSetup.cmake
@@ -0,0 +1,201 @@
+# 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.
+
+# workaround a bug in older cmake, where binutils wouldn't be set after deleting CMakeCache.txt
+include(CMakeFindBinUtils)
+
+include(CheckCXXSourceCompiles)
+include(CheckSymbolExists)
+include(CheckFunctionExists)
+include(CheckIncludeFile)
+include(CheckTypeSize)
+
+# 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(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)
+ if(NOT DEFINED HOST_CAN_EXECUTE_TARGET)
+ set(HOST_CAN_EXECUTE_TARGET TRUE)
+ endif()
+else()
+ if(NOT HOST_CAN_EXECUTE_TARGET)
+ set(HOST_CAN_EXECUTE_TARGET FALSE)
+ endif()
+endif()
+
+# system specific arch setup
+if(NOT EXISTS ${CMAKE_SOURCE_DIR}/cmake/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}/cmake/README.md for instructions. "
+ "Note: Specifying a toolchain requires a clean build directory!")
+endif()
+include(${CMAKE_SOURCE_DIR}/cmake/scripts/${CORE_SYSTEM_NAME}/ArchSetup.cmake)
+
+# No TARBALL_DIR given, or no arch specific default set
+if(NOT TARBALL_DIR)
+ set(TARBALL_DIR ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/download)
+endif()
+
+message(STATUS "Core system type: ${CORE_SYSTEM_NAME}")
+message(STATUS "Platform: ${CORE_PLATFORM_NAME}")
+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_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()
+check_function_exists(gmtime_r HAVE_GMTIME_R)
+if(HAVE_GMTIME_R)
+list(APPEND SYSTEM_DEFINES -DHAVE_GMTIME_R=1)
+endif()
+if(HAVE_INTTYPES_H)
+ list(APPEND SYSTEM_DEFINES -DHAVE_INTTYPES_H=1)
+endif()
+
+set(CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE")
+check_symbol_exists("STATX_BTIME" "linux/stat.h" HAVE_STATX)
+if(HAVE_STATX)
+ check_function_exists("statx" FOUND_STATX_FUNCTION)
+ if(FOUND_STATX_FUNCTION)
+ message(STATUS "statx is available")
+ list(APPEND ARCH_DEFINES "-DHAVE_STATX=1")
+ else()
+ message(STATUS "statx flags found but no linkable function : C library too old ?")
+ endif()
+else()
+ message(STATUS "statx() not found")
+endif()
+set(CMAKE_REQUIRED_DEFINITIONS "")
+
+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_definitions(-DHAS_NEON)
+ if(NEON_FLAGS)
+ add_options(ALL_LANGUAGES ALL_BUILDS ${NEON_FLAGS})
+ endif()
+ endif()
+endif()
+
+if(NOT MSVC)
+ # these options affect all code built by cmake including external projects.
+ add_options(ALL_LANGUAGES ALL_BUILDS
+ -Wall
+ -Wdouble-promotion
+ -Wmissing-field-initializers
+ -Wsign-compare
+ -Wextra
+ -Wno-unused-parameter # from -Wextra
+ )
+
+ if(CMAKE_COMPILER_IS_GNUCXX)
+ add_options(ALL_LANGUAGES ALL_BUILDS
+ -Wno-cast-function-type # from -Wextra
+ )
+ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+ add_options(ALL_LANGUAGES ALL_BUILDS
+ -Wno-bad-function-cast
+ -Wno-deprecated
+ )
+ endif()
+
+ add_options(CXX ALL_BUILDS
+ -Wnon-virtual-dtor
+ )
+
+ add_options(ALL_LANGUAGES DEBUG
+ -g
+ -D_DEBUG
+ )
+
+ # these options affect only core code
+ if(NOT CORE_COMPILE_OPTIONS)
+ set(CORE_COMPILE_OPTIONS
+ -Werror=double-promotion
+ -Werror=missing-field-initializers
+ -Werror=sign-compare
+ )
+ endif()
+endif()
+
+# set for compile info to help detect binary addons
+set(APP_SHARED_LIBRARY_SUFFIX "${CMAKE_SHARED_LIBRARY_SUFFIX}")
diff --git a/cmake/scripts/common/CMakeHelpers.cmake b/cmake/scripts/common/CMakeHelpers.cmake
new file mode 100644
index 0000000..995c38a
--- /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 0000000..304e623
--- /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 0000000..29206c0
--- /dev/null
+++ b/cmake/scripts/common/CheckTargetPlatform.cmake
@@ -0,0 +1,70 @@
+# 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(${platform} STREQUAL ${target_platform})
+ set(${build} FALSE)
+ break()
+ elseif(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 whether 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/CompilerSettings.cmake b/cmake/scripts/common/CompilerSettings.cmake
new file mode 100644
index 0000000..bb0af92
--- /dev/null
+++ b/cmake/scripts/common/CompilerSettings.cmake
@@ -0,0 +1,5 @@
+# Languages and global compiler settings
+set(CMAKE_CXX_STANDARD 17)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+set(CMAKE_CXX_EXTENSIONS OFF)
+set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS} -x assembler-with-cpp")
diff --git a/cmake/scripts/common/DependencyOptions.cmake b/cmake/scripts/common/DependencyOptions.cmake
new file mode 100644
index 0000000..a45dcec
--- /dev/null
+++ b/cmake/scripts/common/DependencyOptions.cmake
@@ -0,0 +1,23 @@
+# Set Option varname based on USE_INTERNAL_LIBS status
+#
+# Alternative to cmake_dependent_option
+# cmake_dependent_option is restrictive, in the fact that we cannot override the
+# set option value as a cache variable (-Dvar=foo)
+#
+# This allows us to have the same outcome as cmake_dependent_option whilst still allowing
+# user to override for platforms that would normally be forced ON
+#
+function(dependent_option varname optionmessage)
+
+ # If varname already set, accept that, as it was provided by the user
+ if(NOT DEFINED ${varname})
+ # Generally we only define USE_INTERNAL_LIBS as the exception for platforms
+ # we explicitly dont want to build internal libs (eg Linux/Freebsd)
+ if(NOT DEFINED USE_INTERNAL_LIBS)
+ option(${varname} ${optionmessage} ON)
+ else()
+ # Respect Value of USE_INTERNAL_LIBS for ON/OFF
+ option(${varname} ${optionmessage} ${USE_INTERNAL_LIBS})
+ endif()
+ endif()
+endfunction()
diff --git a/cmake/scripts/common/GenerateVersionedFiles.cmake b/cmake/scripts/common/GenerateVersionedFiles.cmake
new file mode 100644
index 0000000..d54b524
--- /dev/null
+++ b/cmake/scripts/common/GenerateVersionedFiles.cmake
@@ -0,0 +1,35 @@
+include(${CORE_SOURCE_DIR}/cmake/scripts/common/Macros.cmake)
+
+core_find_versions()
+
+# 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()
+
+# add-on xml's
+file(GLOB ADDON_XML_IN_FILE ${CORE_SOURCE_DIR}/addons/*/addon.xml.in)
+
+# remove 'xbmc.json', will be created from 'xbmc/interfaces/json-rpc/schema/CMakeLists.txt'
+list(REMOVE_ITEM ADDON_XML_IN_FILE ${CORE_SOURCE_DIR}/addons/xbmc.json/addon.xml.in)
+
+foreach(loop_var ${ADDON_XML_IN_FILE})
+ list(GET loop_var 0 xml_name)
+
+ string(REPLACE "/addon.xml.in" "" source_dir ${xml_name})
+ string(REPLACE ${CORE_SOURCE_DIR} ${CMAKE_BINARY_DIR} dest_dir ${source_dir})
+ file(MAKE_DIRECTORY ${dest_dir})
+
+ configure_file(${source_dir}/addon.xml.in ${dest_dir}/addon.xml @ONLY)
+
+ unset(source_dir)
+ unset(dest_dir)
+ unset(xml_name)
+endforeach()
+
+
+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 0000000..304b504
--- /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 0000000..dc022ba
--- /dev/null
+++ b/cmake/scripts/common/HandleDepends.cmake
@@ -0,0 +1,301 @@
+include(${CORE_SOURCE_DIR}/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)
+ # backward compatibility
+ if(NOT cmake_input_files AND CORE_SYSTEM_NAME STREQUAL windowsstore)
+ file(GLOB_RECURSE cmake_input_files ${searchpath}/windows/*.txt)
+ endif()
+ 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)
+ string(REPLACE " " ";" extraflags ${extraflags})
+
+ message(STATUS "${id} extraflags: ${extraflags}")
+ endif()
+
+ if(EXISTS ${dir}/flags-${CPU}.txt)
+ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${dir}/flags-${CPU}.txt)
+ file(STRINGS ${dir}/flags-${CPU}.txt archextraflags)
+ string(REPLACE " " ";" archextraflags ${archextraflags})
+
+ message(STATUS "${id} ${CPU} extraflags: ${archextraflags}")
+ list(APPEND extraflags ${archextraflags})
+ 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)
+ # windows args
+ if (CMAKE_SYSTEM_NAME STREQUAL WindowsStore OR CMAKE_SYSTEM_NAME STREQUAL Windows)
+ list(APPEND BUILD_ARGS -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
+ -DCMAKE_SYSTEM_VERSION=${CMAKE_SYSTEM_VERSION})
+ endif()
+ # 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}")
+ set(TMP_EXE_LINKER_FLAGS "-L${OUTPUT_DIR}/lib ${CMAKE_EXE_LINKER_FLAGS}")
+ list(APPEND BUILD_ARGS -DCMAKE_C_FLAGS=${TMP_C_FLAGS}
+ -DCMAKE_CXX_FLAGS=${TMP_CXX_FLAGS}
+ -DCMAKE_EXE_LINKER_FLAGS=${TMP_EXE_LINKER_FLAGS})
+ endif()
+
+ if(CMAKE_TOOLCHAIN_FILE)
+ list(APPEND BUILD_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE})
+ message("toolchain specified")
+ message(${BUILD_ARGS})
+ endif()
+
+ if(ADDON_EXTRA_ARGS)
+ string(REPLACE " " ";" ADDON_EXTRA_ARGS ${ADDON_EXTRA_ARGS})
+ list(APPEND BUILD_ARGS ${ADDON_EXTRA_ARGS})
+ message("Addon Extra Args: ${ADDON_EXTRA_ARGS}")
+ endif()
+
+ # used for addons where need special folders to store there content (if
+ # not set the addon define it byself).
+ # e.g. Google Chromium addon where his git bring:
+ # - "unable to create file" ... "Filename too long"
+ # see also WARNING by Windows on: https://bitbucket.org/chromiumembedded/cef/wiki/MasterBuildQuickStart
+ if(THIRD_PARTY_PATH)
+ message(STATUS "Third party lib path specified")
+ message(STATUS ${THIRD_PARTY_PATH})
+ list(APPEND BUILD_ARGS -DTHIRD_PARTY_PATH=${THIRD_PARTY_PATH})
+ endif()
+
+ set(PATCH_COMMAND)
+
+ # 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)
+ list(APPEND PATCH_COMMAND COMMAND ${CMAKE_COMMAND} -E copy_if_different ${dir}/CMakeLists.txt ${BUILD_DIR}/${id}/src/${id})
+ 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
+
+ if(WIN32)
+ # On Windows prioritize Git patch.exe
+ find_package(Git)
+ if(Git_FOUND)
+ get_filename_component(GIT_DIR ${GIT_EXECUTABLE} DIRECTORY)
+ get_filename_component(GIT_DIR ${GIT_DIR} DIRECTORY)
+ endif()
+ find_program(PATCH_EXECUTABLE NAMES patch.exe HINTS ${GIT_DIR} PATH_SUFFIXES usr/bin)
+ else()
+ find_program(PATCH_EXECUTABLE NAMES patch)
+ endif()
+ 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")
+ list(APPEND PATCH_PROGRAM --binary)
+ endif()
+ endif()
+ endif()
+
+ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${patch})
+ list(APPEND PATCH_COMMAND COMMAND ${PATCH_PROGRAM} -p1 -i ${patch})
+ 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}")
+ # backward compatibility
+ elseif(CORE_SYSTEM_NAME STREQUAL windowsstore AND EXISTS ${dir}/windows-deps.txt)
+ file(STRINGS ${dir}/windows-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})
+ list(APPEND PATCH_COMMAND COMMAND ${CMAKE_COMMAND} -E echo "AUTOCONF: copying ${afile} to ${BUILD_DIR}/${id}/src/${id}")
+ list(APPEND PATCH_COMMAND COMMAND ${CMAKE_COMMAND} -E copy_if_different ${afile} ${BUILD_DIR}/${id}/src/${id})
+ endforeach()
+ 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_INCLUDE_PATH=${OUTPUT_DIR}/include)
+ endif()
+
+ set(DOWNLOAD_DIR ${BUILD_DIR}/download)
+ if(EXISTS ${dir}/${id}.sha256)
+ file(STRINGS ${dir}/${id}.sha256 sha256sum)
+ list(GET sha256sum 0 sha256sum)
+ set(URL_HASH_COMMAND URL_HASH SHA256=${sha256sum})
+ if(TARBALL_DIR)
+ set(DOWNLOAD_DIR ${TARBALL_DIR})
+ endif()
+ else()
+ unset(URL_HASH_COMMAND)
+ message(AUTHOR_WARNING "${dir}/${id}.sha256 is missing")
+ endif()
+
+ externalproject_add(${id}
+ URL ${url}
+ "${URL_HASH_COMMAND}"
+ DOWNLOAD_DIR ${DOWNLOAD_DIR}
+ 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 0000000..49198a1
--- /dev/null
+++ b/cmake/scripts/common/Macros.cmake
@@ -0,0 +1,789 @@
+# This script holds the main functions used to construct the build system
+
+# Include system specific macros but only if this file is included from
+# kodi main project. It's not needed for kodi-addons project
+# If CORE_SOURCE_DIR is set, it was called from kodi-addons project
+# TODO: drop check if we ever integrate kodi-addons into kodi project
+if(NOT CORE_SOURCE_DIR)
+ include(${CMAKE_SOURCE_DIR}/cmake/scripts/${CORE_SYSTEM_NAME}/Macros.cmake)
+endif()
+
+# 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} ${GLOBAL_TARGET_DEPS})
+ set(CORE_LIBRARY ${name} PARENT_SCOPE)
+
+ if(NOT MSVC)
+ target_compile_options(${name} PUBLIC ${CORE_COMPILE_OPTIONS})
+ endif()
+
+ # Add precompiled headers to Kodi main libraries
+ if(CORE_SYSTEM_NAME MATCHES windows)
+ add_precompiled_header(${name} pch.h ${CMAKE_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} ${GLOBAL_TARGET_DEPS})
+ set(test_archives ${test_archives} ${name} CACHE STRING "" FORCE)
+
+ if(NOT MSVC)
+ target_compile_options(${name} PUBLIC ${CORE_COMPILE_OPTIONS})
+ endif()
+
+ 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 addon dev kit headers to main application
+# Arguments:
+# name name of the header part to add
+function(core_add_devkit_header name)
+ if(NOT ENABLE_STATIC_LIBS)
+ core_add_library(addons_kodi-dev-kit_include_${name})
+ endif()
+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})
+
+ if(NOT MSVC)
+ target_compile_options(${name} PUBLIC ${CORE_COMPILE_OPTIONS})
+ endif()
+ 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 CMAKE_SOURCE_DIR)
+# KEEP_DIR_STRUCTURE: preserve tree structure even when DIRECTORY is set
+# 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;KEEP_DIR_STRUCTURE" "" ${ARGN})
+ if(arg_DIRECTORY)
+ set(outdir ${arg_DIRECTORY})
+ if(arg_KEEP_DIR_STRUCTURE)
+ get_filename_component(srcdir ${arg_KEEP_DIR_STRUCTURE} DIRECTORY)
+ string(REPLACE "${CMAKE_SOURCE_DIR}/${srcdir}/" "" outfile ${file})
+ if(NOT IS_DIRECTORY ${file})
+ set(outdir ${outdir}/${outfile})
+ endif()
+ else()
+ get_filename_component(outfile ${file} NAME)
+ set(outfile ${outdir}/${outfile})
+ endif()
+ else()
+ string(REPLACE "${CMAKE_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(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows" OR NOT IS_SYMLINK "${file}")
+ 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" )
+ else()
+ if(VERBOSE)
+ message(STATUS "copy_file_to_buildtree - copying symlinked file: ${file} -> ${CMAKE_BINARY_DIR}/${outfile}")
+ endif()
+ file(APPEND ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/ExportFiles.cmake
+ "execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E copy_if_different \"${file}\" \"${CMAKE_BINARY_DIR}/${outfile}\")\n")
+ endif()
+ 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:
+# CMAKE_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(CONFIGURE ${dir} dir)
+ string(REPLACE " " ";" dir ${dir})
+ list(GET dir 0 src)
+ list(LENGTH dir len)
+ if(len EQUAL 1)
+ set(dest)
+ elseif(len EQUAL 3)
+ list(GET dir 1 opt)
+ if(opt STREQUAL "KEEP_DIR_STRUCTURE")
+ set(DIR_OPTION ${opt} ${src})
+ if(VERBOSE)
+ message(STATUS "copy_files_from_filelist_to_buildtree - DIR_OPTION: ${DIR_OPTION}")
+ endif()
+ endif()
+ list(GET dir -1 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 ${CMAKE_SOURCE_DIR}/${src} AND (NOT IS_DIRECTORY ${CMAKE_SOURCE_DIR}/${src} OR DIR_OPTION))
+ set(files ${src})
+ else()
+ file(GLOB_RECURSE files RELATIVE ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/${src})
+ endif()
+
+ foreach(file ${files})
+ if(arg_NO_INSTALL)
+ copy_file_to_buildtree(${CMAKE_SOURCE_DIR}/${file} DIRECTORY ${dest} NO_INSTALL ${DIR_OPTION})
+ else()
+ copy_file_to_buildtree(${CMAKE_SOURCE_DIR}/${file} DIRECTORY ${dest} ${DIR_OPTION})
+ endif()
+ endforeach()
+ set(DIR_OPTION)
+ 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()
+
+# split dependency specification to name and version
+# Arguments:
+# depspec dependency specification that can optionally include a required
+# package version
+# syntax: [package name], [package name]>=[version] (minimum version),
+# or [package name]=[version] (exact version)
+# name_outvar variable that should receive the package name
+# version_outvar variable that should receive the package version part (>=[version])
+# On return:
+# ${name_outvar} and ${version_outvar} in caller scope are set to respective values.
+# ${version_outvar} may be unset if there is no specific version requested.
+function(split_dependency_specification depspec name_outvar version_outvar)
+ if(${depspec} MATCHES "^([^>]*)(>?=[0-9.]+)$")
+ set(${name_outvar} ${CMAKE_MATCH_1} PARENT_SCOPE)
+ set(${version_outvar} ${CMAKE_MATCH_2} PARENT_SCOPE)
+ else()
+ set(${name_outvar} ${depspec} PARENT_SCOPE)
+ unset(${version_outvar} PARENT_SCOPE)
+ endif()
+endfunction()
+
+# helper macro to split version info from req and call find_package
+macro(find_package_with_ver package)
+ set(_find_arguments "${ARGN}")
+ if("${ARGV1}" MATCHES "^(>)?=([0-9.]+)$")
+ # We have a version spec, parse it
+ list(REMOVE_AT _find_arguments 0)
+ # ">" not present? -> exact match
+ if(NOT CMAKE_MATCH_1)
+ list(INSERT _find_arguments 0 "EXACT")
+ endif()
+ find_package(${package} ${CMAKE_MATCH_2} ${_find_arguments})
+ else()
+ find_package(${package} ${_find_arguments})
+ endif()
+ unset(_find_arguments)
+endmacro()
+
+# add required dependencies of main application
+# Arguments:
+# dep_list One or many dependency specifications (see split_dependency_specification)
+# for syntax). The dependency name is used uppercased as variable prefix.
+# On return:
+# dependencies added to ${SYSTEM_INCLUDES}, ${DEPLIBS} and ${DEP_DEFINES}
+function(core_require_dep)
+ foreach(depspec ${ARGN})
+ split_dependency_specification(${depspec} dep version)
+ find_package_with_ver(${dep} ${version} 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()
+ endforeach()
+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 optional dependencies of main application
+# Arguments:
+# dep_list One or many dependency specifications (see split_dependency_specification)
+# for syntax). The dependency name is used uppercased as variable prefix.
+# On return:
+# dependency optionally added to ${SYSTEM_INCLUDES}, ${DEPLIBS} and ${DEP_DEFINES}
+function(core_optional_dep)
+ foreach(depspec ${ARGN})
+ set(_required False)
+ split_dependency_specification(${depspec} dep version)
+ setup_enable_switch()
+ if(${enable_switch} STREQUAL AUTO)
+ find_package_with_ver(${dep} ${version})
+ elseif(${${enable_switch}})
+ find_package_with_ver(${dep} ${version} REQUIRED)
+ set(_required True)
+ 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")
+ export_dep()
+ elseif(_required)
+ message(FATAL_ERROR "${depup} enabled but not found")
+ else()
+ set(final_message ${final_message} "${depup} enabled: No")
+ endif()
+ endforeach()
+ set(final_message ${final_message} PARENT_SCOPE)
+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: ${CMAKE_SOURCE_DIR}/${subdir_src} -> ${CORE_BUILD_DIR}/${subdir_dest}")
+ endif()
+ add_subdirectory(${CMAKE_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: ${CMAKE_SOURCE_DIR}/${subdir_src} -> ${CORE_BUILD_DIR}/${subdir_dest}")
+ endif()
+ add_subdirectory(${CMAKE_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 ${CMAKE_SOURCE_DIR}/.git)
+ execute_process(COMMAND ${GIT_EXECUTABLE} config user.name
+ OUTPUT_VARIABLE username
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process(COMMAND ${GIT_EXECUTABLE} config user.email
+ OUTPUT_VARIABLE useremail
+ WORKING_DIRECTORY ${CMAKE_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)
+ string(TIMESTAMP APP_BUILD_DATE "%Y%m%d" UTC)
+ set(APP_BUILD_DATE ${APP_BUILD_DATE} PARENT_SCOPE)
+ else()
+ find_package(Git)
+ if(GIT_FOUND AND EXISTS ${CMAKE_SOURCE_DIR}/.git)
+ # get tree status i.e. clean working tree vs dirty (uncommitted or unstashed changes, etc.)
+ execute_process(COMMAND ${GIT_EXECUTABLE} update-index --ignore-submodules -q --refresh
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
+ execute_process(COMMAND ${GIT_EXECUTABLE} diff-files --ignore-submodules --quiet --
+ RESULT_VARIABLE status_code
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
+ if(NOT status_code)
+ execute_process(COMMAND ${GIT_EXECUTABLE} diff-index --ignore-submodules --quiet HEAD --
+ RESULT_VARIABLE status_code
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
+ endif()
+ # get HEAD commit SHA-1
+ execute_process(COMMAND ${GIT_EXECUTABLE} log -n 1 --pretty=format:"%h" HEAD
+ OUTPUT_VARIABLE HASH
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
+ string(REPLACE "\"" "" HASH ${HASH})
+
+ if(status_code)
+ string(CONCAT HASH ${HASH} "-dirty")
+ endif()
+
+ # get HEAD commit date
+ execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --pretty=format:"%cd" --date=short HEAD
+ OUTPUT_VARIABLE DATE
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
+ string(REPLACE "\"" "" DATE ${DATE})
+ string(REPLACE "-" "" DATE ${DATE})
+
+ # build date
+ string(TIMESTAMP APP_BUILD_DATE "%Y%m%d" UTC)
+ set(APP_BUILD_DATE ${APP_BUILD_DATE} PARENT_SCOPE)
+ else()
+ if(EXISTS ${CMAKE_SOURCE_DIR}/BUILDDATE)
+ file(STRINGS ${CMAKE_SOURCE_DIR}/BUILDDATE DATE LIMIT_INPUT 8)
+ else()
+ string(TIMESTAMP DATE "%Y%m%d" UTC)
+ endif()
+ set(APP_BUILD_DATE ${DATE} PARENT_SCOPE)
+
+ if(EXISTS ${CMAKE_SOURCE_DIR}/VERSION)
+ file(STRINGS ${CMAKE_SOURCE_DIR}/VERSION HASH LIMIT_INPUT 16)
+ else()
+ set(HASH "nogitfound")
+ endif()
+ 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 versions.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
+# APP_PACKAGE - Android full package name
+# COMPANY_NAME - company name
+# APP_WEBSITE - site url
+# 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
+# ADDON_REPOS - official addon repositories and their origin path delimited by pipe
+# - e.g. repository.xbmc.org|https://mirrors.kodi.tv -
+# (multiple repo/path-sets are delimited by comma)
+# FILE_VERSION - file version in the form of 16,9,702,0 - Windows only
+# JSONRPC_VERSION - the json api version in the form of 8.3.0
+#
+# Set various variables defined in "versions.h"
+macro(core_find_versions)
+ # kodi-addons project also calls this macro and uses CORE_SOURCE_DIR
+ # to point to core base dir
+ # Set CORE_SOURCE_DIR here, otherwise kodi main project fails
+ # TODO: drop this code block and refactor the rest to use CMAKE_SOURCE_DIR
+ # if we ever integrate kodi-addons into kodi project
+ if(NOT CORE_SOURCE_DIR)
+ set(CORE_SOURCE_DIR ${CMAKE_SOURCE_DIR})
+ endif()
+
+ include(CMakeParseArguments)
+ core_file_read_filtered(version_list ${CORE_SOURCE_DIR}/version.txt)
+ core_file_read_filtered(json_version ${CORE_SOURCE_DIR}/xbmc/interfaces/json-rpc/schema/version.txt)
+ string(REGEX REPLACE "([^ ;]*) ([^;]*)" "\\1;\\2" version_list "${version_list};${json_version}")
+ set(version_props
+ ADDON_API
+ ADDON_REPOS
+ APP_NAME
+ APP_PACKAGE
+ COMPANY_NAME
+ COPYRIGHT_YEARS
+ JSONRPC_VERSION
+ PACKAGE_DESCRIPTION
+ PACKAGE_IDENTITY
+ PACKAGE_PUBLISHER
+ VERSION_MAJOR
+ VERSION_MINOR
+ VERSION_TAG
+ VERSION_CODE
+ WEBSITE
+ )
+ cmake_parse_arguments(APP "" "${version_props}" "" ${version_list})
+
+ if(NOT ${APP_VERSION_CODE} MATCHES "^[0-9]+\\.[0-9][0-9]?\\.[0-9][0-9]?[0-9]?$")
+ message(FATAL_ERROR "VERSION_CODE was set to ${APP_VERSION_CODE} in version.txt, but it has to match '^\\d+\\.\\d{1,2}\\.\\d{1,3}$'")
+ endif()
+ 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})
+ # Let Flatpak builders etc override APP_PACKAGE
+ # NOTE: We cannot declare an option() in top-level CMakeLists.txt
+ # because of CMP0077.
+ if(NOT APP_PACKAGE)
+ set(APP_PACKAGE ${APP_APP_PACKAGE})
+ endif()
+ list(APPEND final_message "App package: ${APP_PACKAGE}")
+ 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)
+ set(ADDON_REPOS ${APP_ADDON_REPOS})
+ set(JSONRPC_VERSION ${APP_JSONRPC_VERSION})
+
+ # Set defines used in addon.xml.in and read from versions.h to set add-on
+ # version parts automatically
+ # This part is nearly identical to "AddonHelpers.cmake", except location of versions.h
+ file(STRINGS ${CORE_SOURCE_DIR}/xbmc/addons/kodi-dev-kit/include/kodi/versions.h BIN_ADDON_PARTS)
+ foreach(loop_var ${BIN_ADDON_PARTS})
+ string(FIND "${loop_var}" "#define ADDON_" matchres)
+ if("${matchres}" EQUAL 0)
+ string(REGEX MATCHALL "[A-Z0-9._]+|[A-Z0-9._]+$" loop_var "${loop_var}")
+ list(GET loop_var 0 include_name)
+ list(GET loop_var 1 include_version)
+ string(REGEX REPLACE ".*\"(.*)\"" "\\1" ${include_name} ${include_version})
+ endif()
+ endforeach(loop_var)
+
+ # unset variables not used anywhere else
+ unset(version_list)
+ unset(APP_APP_NAME)
+ unset(APP_COMPANY_NAME)
+ unset(APP_APP_PACKAGE)
+ unset(APP_JSONRPC_VERSION)
+ unset(BIN_ADDON_PARTS)
+
+ # 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()
+ if(NOT DEFINED JSONRPC_VERSION)
+ message(FATAL_ERROR "Could not determine json-rpc version! Make sure that ${CORE_SOURCE_DIR}/xbmc/interfaces/json-rpc/schema/version.txt exists")
+ endif()
+endmacro()
+
+# add-on xml's
+# find all folders containing addon.xml.in and used to define
+# ADDON_XML_OUTPUTS, ADDON_XML_DEPENDS and ADDON_INSTALL_DATA
+macro(find_addon_xml_in_files)
+ set(filter ${ARGV0})
+
+ if(filter AND VERBOSE)
+ message(STATUS "find_addon_xml_in_files: filtering ${filter}")
+ endif()
+
+ file(GLOB ADDON_XML_IN_FILE ${CMAKE_SOURCE_DIR}/addons/*/addon.xml.in)
+ foreach(loop_var ${ADDON_XML_IN_FILE})
+ list(GET loop_var 0 xml_name)
+
+ string(REPLACE "/addon.xml.in" "" xml_name ${xml_name})
+ string(REPLACE "${CORE_SOURCE_DIR}/" "" xml_name ${xml_name})
+
+ list(APPEND ADDON_XML_DEPENDS "${CORE_SOURCE_DIR}/${xml_name}/addon.xml.in")
+ if(filter AND NOT xml_name MATCHES ${filter})
+ list(APPEND ADDON_XML_OUTPUTS "${CMAKE_BINARY_DIR}/${xml_name}/addon.xml")
+ endif()
+
+ # Read content of add-on folder to have on install
+ file(GLOB ADDON_FILES "${CORE_SOURCE_DIR}/${xml_name}/*")
+ foreach(loop_var ${ADDON_FILES})
+ if(loop_var MATCHES "addon.xml.in")
+ string(REPLACE "addon.xml.in" "addon.xml" loop_var ${loop_var})
+
+ list(GET loop_var 0 file_name)
+ string(REPLACE "${CORE_SOURCE_DIR}/" "" file_name ${file_name})
+ list(APPEND ADDON_INSTALL_DATA "${file_name}")
+
+ unset(file_name)
+ endif()
+ endforeach()
+ unset(xml_name)
+ endforeach()
+
+ # Append also versions.h to depends
+ list(APPEND ADDON_XML_DEPENDS "${CORE_SOURCE_DIR}/xbmc/addons/kodi-dev-kit/include/kodi/versions.h")
+endmacro()
diff --git a/cmake/scripts/common/ModuleHelpers.cmake b/cmake/scripts/common/ModuleHelpers.cmake
new file mode 100644
index 0000000..97a3901
--- /dev/null
+++ b/cmake/scripts/common/ModuleHelpers.cmake
@@ -0,0 +1,424 @@
+# This script provides helper functions for FindModules
+
+# Parse and set variables from VERSION dependency file
+# On return:
+# MODULENAME_ARCHIVE will be set to parent scope
+# MODULENAME_VER will be set to parent scope (eg FFMPEG_VER, DAV1D_VER)
+# MODULENAME_BASE_URL will be set to parent scope if exists in VERSION file (eg FFMPEG_BASE_URL)
+# MODULENAME_HASH will be set if either SHA256 or SHA512 exists in VERSION file
+# MODULENAME_BYPRODUCT will be set to parent scope
+function(get_versionfile_data)
+
+ # Dependency path
+ set(MODULE_PATH "${PROJECTSOURCE}/tools/depends/${LIB_TYPE}/${MODULE_LC}")
+
+ if(NOT EXISTS "${MODULE_PATH}/${MODULE}-VERSION")
+ MESSAGE(FATAL_ERROR "${MODULE}-VERSION does not exist at ${MODULE_PATH}.")
+ else()
+ set(${MODULE}_FILE "${MODULE_PATH}/${MODULE}-VERSION")
+ endif()
+
+ file(STRINGS ${${MODULE}_FILE} ${MODULE}_LNAME REGEX "^[ \t]*LIBNAME=")
+ file(STRINGS ${${MODULE}_FILE} ${MODULE}_VER REGEX "^[ \t]*VERSION=")
+ file(STRINGS ${${MODULE}_FILE} ${MODULE}_ARCHIVE REGEX "^[ \t]*ARCHIVE=")
+ file(STRINGS ${${MODULE}_FILE} ${MODULE}_BASE_URL REGEX "^[ \t]*BASE_URL=")
+ if(WIN32 OR WINDOWS_STORE)
+ file(STRINGS ${${MODULE}_FILE} ${MODULE}_BYPRODUCT REGEX "^[ \t]*BYPRODUCT_WIN=")
+ else()
+ file(STRINGS ${${MODULE}_FILE} ${MODULE}_BYPRODUCT REGEX "^[ \t]*BYPRODUCT=")
+ endif()
+
+ # Tarball Hash
+ file(STRINGS ${${MODULE}_FILE} ${MODULE}_HASH_SHA256 REGEX "^[ \t]*SHA256=")
+ file(STRINGS ${${MODULE}_FILE} ${MODULE}_HASH_SHA512 REGEX "^[ \t]*SHA512=")
+
+ string(REGEX REPLACE ".*LIBNAME=([^ \t]*).*" "\\1" ${MODULE}_LNAME "${${MODULE}_LNAME}")
+ string(REGEX REPLACE ".*VERSION=([^ \t]*).*" "\\1" ${MODULE}_VER "${${MODULE}_VER}")
+ string(REGEX REPLACE ".*ARCHIVE=([^ \t]*).*" "\\1" ${MODULE}_ARCHIVE "${${MODULE}_ARCHIVE}")
+ string(REGEX REPLACE ".*BASE_URL=([^ \t]*).*" "\\1" ${MODULE}_BASE_URL "${${MODULE}_BASE_URL}")
+ if(WIN32 OR WINDOWS_STORE)
+ string(REGEX REPLACE ".*BYPRODUCT_WIN=([^ \t]*).*" "\\1" ${MODULE}_BYPRODUCT "${${MODULE}_BYPRODUCT}")
+ else()
+ string(REGEX REPLACE ".*BYPRODUCT=([^ \t]*).*" "\\1" ${MODULE}_BYPRODUCT "${${MODULE}_BYPRODUCT}")
+ endif()
+
+ string(REGEX REPLACE "\\$\\(LIBNAME\\)" "${${MODULE}_LNAME}" ${MODULE}_ARCHIVE "${${MODULE}_ARCHIVE}")
+ string(REGEX REPLACE "\\$\\(VERSION\\)" "${${MODULE}_VER}" ${MODULE}_ARCHIVE "${${MODULE}_ARCHIVE}")
+
+ set(${MODULE}_ARCHIVE ${${MODULE}_ARCHIVE} PARENT_SCOPE)
+
+ set(${MODULE}_VER ${${MODULE}_VER} PARENT_SCOPE)
+
+ if (${MODULE}_BASE_URL)
+ set(${MODULE}_BASE_URL ${${MODULE}_BASE_URL} PARENT_SCOPE)
+ else()
+ set(${MODULE}_BASE_URL "http://mirrors.kodi.tv/build-deps/sources" PARENT_SCOPE)
+ endif()
+ set(${MODULE}_BYPRODUCT ${${MODULE}_BYPRODUCT} PARENT_SCOPE)
+
+ # allow user to override the download URL hash with a local tarball hash
+ # needed for offline build envs
+ if (NOT DEFINED ${MODULE}_HASH)
+ if (${MODULE}_HASH_SHA256)
+ set(${MODULE}_HASH ${${MODULE}_HASH_SHA256} PARENT_SCOPE)
+ elseif(${MODULE}_HASH_SHA512)
+ set(${MODULE}_HASH ${${MODULE}_HASH_SHA512} PARENT_SCOPE)
+ endif()
+ endif()
+endfunction()
+
+# Parse and set Version from VERSION dependency file
+# Used for retrieving version numbers for dependency libs to allow setting
+# a required version for find_package call
+# On return:
+# LIB_MODULENAME_VER will be set to parent scope (eg LIB_FMT_VER)
+function(get_libversion_data module libtype)
+
+ # Dependency path
+ set(LIB_MODULE_PATH "${CMAKE_SOURCE_DIR}/tools/depends/${libtype}/${module}")
+ string(TOUPPER ${module} MOD_UPPER)
+
+ if(NOT EXISTS "${LIB_MODULE_PATH}/${MOD_UPPER}-VERSION")
+ MESSAGE(FATAL_ERROR "${MOD_UPPER}-VERSION does not exist at ${LIB_MODULE_PATH}.")
+ else()
+ set(${MOD_UPPER}_FILE "${LIB_MODULE_PATH}/${MOD_UPPER}-VERSION")
+ endif()
+
+ file(STRINGS ${${MOD_UPPER}_FILE} ${MOD_UPPER}_VER REGEX "^[ \t]*VERSION=")
+
+ string(REGEX REPLACE ".*VERSION=([^ \t]*).*" "\\1" ${MOD_UPPER}_VER "${${MOD_UPPER}_VER}")
+
+ set(LIB_${MOD_UPPER}_VER ${${MOD_UPPER}_VER} PARENT_SCOPE)
+endfunction()
+
+# Function to loop through list of patch files (full path)
+# Sets to a PATCH_COMMAND variable and set to parent scope (caller)
+# Used to test windows line endings and set appropriate patch commands
+function(generate_patchcommand _patchlist)
+ # find the path to the patch executable
+ find_package(Patch MODULE REQUIRED)
+
+ # Loop through patches and add to PATCH_COMMAND
+ # for windows, check CRLF/LF state
+
+ set(_count 0)
+ foreach(patch ${_patchlist})
+ if(WIN32 OR WINDOWS_STORE)
+ PATCH_LF_CHECK(${patch})
+ endif()
+ if(${_count} EQUAL "0")
+ set(_patch_command ${PATCH_EXECUTABLE} -p1 -i ${patch})
+ else()
+ list(APPEND _patch_command COMMAND ${PATCH_EXECUTABLE} -p1 -i ${patch})
+ endif()
+
+ math(EXPR _count "${_count}+1")
+ endforeach()
+ set(PATCH_COMMAND ${_patch_command} PARENT_SCOPE)
+ unset(_count)
+ unset(_patch_command)
+endfunction()
+
+# Macro to factor out the repetitive URL setup
+macro(SETUP_BUILD_VARS)
+ string(TOUPPER ${MODULE_LC} MODULE)
+
+ # Fall through to target build module dir if not explicitly set
+ if(NOT DEFINED LIB_TYPE)
+ set(LIB_TYPE "target")
+ endif()
+
+ # Location for build type, native or target
+ if(LIB_TYPE STREQUAL "target")
+ set(DEP_LOCATION "${DEPENDS_PATH}")
+ else()
+ set(DEP_LOCATION "${NATIVEPREFIX}")
+ endif()
+
+ # PROJECTSOURCE used in native toolchain to provide core project sourcedir
+ # to externalproject_add targets that have a different CMAKE_SOURCE_DIR (eg jsonschema/texturepacker in-tree)
+ if(NOT PROJECTSOURCE)
+ set(PROJECTSOURCE ${CMAKE_SOURCE_DIR})
+ endif()
+
+ # populate variables of data from VERSION file for MODULE
+ get_versionfile_data()
+
+ # allow user to override the download URL with a local tarball
+ # needed for offline build envs
+ if(${MODULE}_URL)
+ get_filename_component(${MODULE}_URL "${${MODULE}_URL}" ABSOLUTE)
+ else()
+ set(${MODULE}_URL ${${MODULE}_BASE_URL}/${${MODULE}_ARCHIVE})
+ endif()
+ if(VERBOSE)
+ message(STATUS "MODULE: ${MODULE}")
+ message(STATUS "LIB_TYPE: ${LIB_TYPE}")
+ message(STATUS "DEP_LOCATION: ${DEP_LOCATION}")
+ message(STATUS "PROJECTSOURCE: ${PROJECTSOURCE}")
+ message(STATUS "${MODULE}_URL: ${${MODULE}_URL}")
+ endif()
+endmacro()
+
+macro(CLEAR_BUILD_VARS)
+ # unset all generic variables to insure clean state between macro calls
+ # Potentially an issue with scope when a macro is used inside a dep that uses a macro
+ unset(PROJECTSOURCE)
+ unset(LIB_TYPE)
+ unset(BUILD_NAME)
+ unset(INSTALL_DIR)
+ unset(CMAKE_ARGS)
+ unset(PATCH_COMMAND)
+ unset(CONFIGURE_COMMAND)
+ unset(BUILD_COMMAND)
+ unset(INSTALL_COMMAND)
+ unset(BUILD_IN_SOURCE)
+ unset(BUILD_BYPRODUCTS)
+ unset(WIN_DISABLE_PROJECT_FLAGS)
+
+ # unset all module specific variables to insure clean state between macro calls
+ # potentially an issue when a native and a target of the same module exists
+ unset(${MODULE}_LIST_SEPARATOR)
+ unset(${MODULE}_GENERATOR)
+ unset(${MODULE}_GENERATOR_PLATFORM)
+ unset(${MODULE}_INSTALL_PREFIX)
+ unset(${MODULE}_TOOLCHAIN_FILE)
+endmacro()
+
+# Macro to create externalproject_add target
+#
+# Common usage
+#
+# CMAKE_ARGS: cmake(required)
+# PATCH_COMMAND: ALL(optional)
+# CONFIGURE_COMMAND: autoconf(required), meson(required)
+# BUILD_COMMAND: autoconf(required), meson(required), cmake(optional)
+# INSTALL_COMMAND: autoconf(required), meson(required), cmake(optional)
+# BUILD_IN_SOURCE: ALL(optional)
+# BUILD_BYPRODUCTS: ALL(optional)
+#
+# Windows Specific
+# WIN_DISABLE_PROJECT_FLAGS - Set to not use core compiler flags for externalproject_add target
+# This removes CMAKE_C_FLAGS CMAKE_CXX_FLAGS CMAKE_EXE_LINKER_FLAGS
+# from the externalproject_add target. Primarily used for HOST build
+# tools that may have different arch/build requirements to the core app
+# target (eg flatc)
+#
+macro(BUILD_DEP_TARGET)
+ include(ExternalProject)
+
+ # Remove cmake warning when Xcode generator used with "New" build system
+ if(CMAKE_GENERATOR STREQUAL Xcode)
+ # Policy CMP0114 is not set to NEW. In order to support the Xcode "new build
+ # system", this project must be updated to set policy CMP0114 to NEW.
+ if(CMAKE_XCODE_BUILD_SYSTEM STREQUAL 12)
+ cmake_policy(SET CMP0114 NEW)
+ else()
+ cmake_policy(SET CMP0114 OLD)
+ endif()
+ endif()
+
+ if(CMAKE_ARGS)
+ set(CMAKE_ARGS CMAKE_ARGS ${CMAKE_ARGS}
+ -DCMAKE_INSTALL_LIBDIR=lib
+ -DPROJECTSOURCE=${PROJECTSOURCE}
+ "-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}")
+
+ # We dont have a toolchain for windows, so manually add all the cmake
+ # build arguments we may want
+ # We can disable adding them with WIN_DISABLE_PROJECT_FLAGS. This is potentially required
+ # for host build tools (eg flatc) that may be a different arch to the core app
+ if(WIN32 OR WINDOWS_STORE)
+ if(NOT DEFINED WIN_DISABLE_PROJECT_FLAGS)
+ list(APPEND CMAKE_ARGS "-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} $<$<CONFIG:Debug>:${CMAKE_C_FLAGS_DEBUG}> $<$<CONFIG:Release>:${CMAKE_C_FLAGS_RELEASE}> ${${MODULE}_C_FLAGS}"
+ "-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} $<$<CONFIG:Debug>:${CMAKE_CXX_FLAGS_DEBUG}> $<$<CONFIG:Release>:${CMAKE_CXX_FLAGS_RELEASE}> ${${MODULE}_CXX_FLAGS}"
+ "-DCMAKE_EXE_LINKER_FLAGS=${CMAKE_EXE_LINKER_FLAGS} $<$<CONFIG:Debug>:${CMAKE_EXE_LINKER_FLAGS_DEBUG}> $<$<CONFIG:Release>:${CMAKE_EXE_LINKER_FLAGS_RELEASE}> ${${MODULE}_EXE_LINKER_FLAGS}")
+ endif()
+ endif()
+
+ if(${MODULE}_INSTALL_PREFIX)
+ list(APPEND CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${${MODULE}_INSTALL_PREFIX})
+ else()
+ list(APPEND CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${DEP_LOCATION})
+ endif()
+
+ if(DEFINED ${MODULE}_TOOLCHAIN_FILE)
+ list(APPEND CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${${MODULE}_TOOLCHAIN_FILE})
+ elseif(CMAKE_TOOLCHAIN_FILE)
+ list(APPEND CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE})
+ endif()
+
+ # Set build type for dep build.
+ # if MODULE has set a manual build type, use it, otherwise use project build type
+ if(${MODULE}_BUILD_TYPE)
+ list(APPEND CMAKE_ARGS "-DCMAKE_BUILD_TYPE=${${MODULE}_BUILD_TYPE}")
+ # Build_type is forced, so unset the opposite <MODULE>_LIBRARY_<TYPE> to only give
+ # select_library_configurations one library name to choose from
+ if(${MODULE}_BUILD_TYPE STREQUAL "Release")
+ unset(${MODULE}_LIBRARY_DEBUG)
+ else()
+ unset(${MODULE}_LIBRARY_RELEASE)
+ endif()
+ else()
+ # single config generator (ie Make, Ninja)
+ if(CMAKE_BUILD_TYPE)
+ list(APPEND CMAKE_ARGS "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}")
+ else()
+ # Multi-config generators (eg VS, Xcode, Ninja Multi-Config) will not have CMAKE_BUILD_TYPE
+ # Use config genex to generate the types
+ # Potential issue if Build type isnt supported by lib project
+ # eg lib supports Debug/Release, however users selects RelWithDebInfo in project
+ list(APPEND CMAKE_ARGS "-DCMAKE_BUILD_TYPE=$<CONFIG>")
+ endif()
+ endif()
+
+ # Xcode - Default sub projects to makefile builds. More consistent
+ # Windows - Default to same generator version used in parent
+ if(CMAKE_GENERATOR STREQUAL Xcode)
+ if(NOT ${MODULE}_GENERATOR)
+ set(${MODULE}_GENERATOR CMAKE_GENERATOR "Unix Makefiles")
+ endif()
+ elseif(MSVC)
+ if(NOT ${MODULE}_GENERATOR)
+ set(${MODULE}_GENERATOR CMAKE_GENERATOR "${CMAKE_GENERATOR}")
+ endif()
+ if(NOT ${MODULE}_GENERATOR_PLATFORM)
+ set(${MODULE}_GENERATOR_PLATFORM CMAKE_GENERATOR_PLATFORM ${CMAKE_GENERATOR_PLATFORM})
+ endif()
+ endif()
+ endif()
+
+ if(PATCH_COMMAND)
+ set(PATCH_COMMAND PATCH_COMMAND ${PATCH_COMMAND})
+ endif()
+
+ if(CONFIGURE_COMMAND)
+ if(NOT CMAKE_ARGS AND DEP_BUILDENV)
+ # DEP_BUILDENV only used for non cmake externalproject_add builds
+ # iterate through CONFIGURE_COMMAND looking for multiple COMMAND, we need to
+ # add DEP_BUILDENV for each distinct COMMAND
+ set(tmp_config_command ${DEP_BUILDENV})
+ foreach(item ${CONFIGURE_COMMAND})
+ list(APPEND tmp_config_command ${item})
+ if(item STREQUAL "COMMAND")
+ list(APPEND tmp_config_command ${DEP_BUILDENV})
+ endif()
+ endforeach()
+ set(CONFIGURE_COMMAND CONFIGURE_COMMAND ${tmp_config_command})
+ unset(tmp_config_command)
+ else()
+ set(CONFIGURE_COMMAND CONFIGURE_COMMAND ${CONFIGURE_COMMAND})
+ endif()
+ endif()
+
+ if(BUILD_COMMAND)
+ set(BUILD_COMMAND BUILD_COMMAND ${BUILD_COMMAND})
+ endif()
+
+ if(INSTALL_COMMAND)
+ set(INSTALL_COMMAND INSTALL_COMMAND ${INSTALL_COMMAND})
+ endif()
+
+ if(BUILD_IN_SOURCE)
+ set(BUILD_IN_SOURCE BUILD_IN_SOURCE ${BUILD_IN_SOURCE})
+ endif()
+
+ # Set Library names.
+ if(DEFINED ${MODULE}_DEBUG_POSTFIX)
+ set(_POSTFIX ${${MODULE}_DEBUG_POSTFIX})
+ string(REGEX REPLACE "\\.[^.]*$" "" _LIBNAME ${${MODULE}_BYPRODUCT})
+ string(REGEX REPLACE "^.*\\." "" _LIBEXT ${${MODULE}_BYPRODUCT})
+ set(${MODULE}_LIBRARY_DEBUG ${DEP_LOCATION}/lib/${_LIBNAME}${${MODULE}_DEBUG_POSTFIX}.${_LIBEXT})
+ endif()
+ # set <MODULE>_LIBRARY_RELEASE for use of select_library_configurations
+ # any modules that dont use select_library_configurations, we set <MODULE>_LIBRARY
+ # No harm in having either set for both potential paths
+ set(${MODULE}_LIBRARY_RELEASE ${DEP_LOCATION}/lib/${${MODULE}_BYPRODUCT})
+ set(${MODULE}_LIBRARY ${${MODULE}_LIBRARY_RELEASE})
+
+ if(NOT ${MODULE}_INCLUDE_DIR)
+ set(${MODULE}_INCLUDE_DIR ${DEP_LOCATION}/include)
+ endif()
+
+ if(BUILD_BYPRODUCTS)
+ set(BUILD_BYPRODUCTS BUILD_BYPRODUCTS ${BUILD_BYPRODUCTS})
+ else()
+ if(DEFINED ${MODULE}_LIBRARY_DEBUG)
+ if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.20")
+ set(BUILD_BYPRODUCTS BUILD_BYPRODUCTS "$<IF:$<CONFIG:Debug,RelWithDebInfo>,${${MODULE}_LIBRARY_DEBUG},${${MODULE}_LIBRARY_RELEASE}>")
+ else()
+ if(DEFINED CMAKE_BUILD_TYPE)
+ if(NOT CMAKE_BUILD_TYPE STREQUAL "Release" AND DEFINED ${MODULE}_LIBRARY_DEBUG)
+ set(BUILD_BYPRODUCTS BUILD_BYPRODUCTS "${${MODULE}_LIBRARY_DEBUG}")
+ else()
+ set(BUILD_BYPRODUCTS BUILD_BYPRODUCTS "${${MODULE}_LIBRARY}")
+ endif()
+ else()
+ message(FATAL_ERROR "MultiConfig Generator usage requires CMake >= 3.20.0 - Generator Expressions in BYPRODUCT option")
+ endif()
+ endif()
+ else()
+ set(BUILD_BYPRODUCTS BUILD_BYPRODUCTS "${${MODULE}_LIBRARY}")
+ endif()
+ endif()
+
+ if(NOT BUILD_NAME)
+ set(BUILD_NAME ${MODULE_LC})
+ endif()
+
+ if(NOT INSTALL_DIR)
+ set(INSTALL_DIR ${DEP_LOCATION})
+ endif()
+
+ # Allow a target to supply in-tree source location. eg TexturePacker, JsonSchemaBuilder
+ if(${MODULE}_SOURCE_DIR)
+ set(BUILD_DOWNLOAD_STEPS SOURCE_DIR "${${MODULE}_SOURCE_DIR}")
+ else()
+ set(BUILD_DOWNLOAD_STEPS URL ${${MODULE}_URL}
+ URL_HASH ${${MODULE}_HASH}
+ DOWNLOAD_DIR ${TARBALL_DIR}
+ DOWNLOAD_NAME ${${MODULE}_ARCHIVE})
+ endif()
+
+ externalproject_add(${BUILD_NAME}
+ ${BUILD_DOWNLOAD_STEPS}
+ PREFIX ${CORE_BUILD_DIR}/${BUILD_NAME}
+ INSTALL_DIR ${INSTALL_DIR}
+ ${${MODULE}_LIST_SEPARATOR}
+ ${CMAKE_ARGS}
+ ${${MODULE}_GENERATOR}
+ ${${MODULE}_GENERATOR_PLATFORM}
+ ${PATCH_COMMAND}
+ ${CONFIGURE_COMMAND}
+ ${BUILD_COMMAND}
+ ${INSTALL_COMMAND}
+ ${BUILD_BYPRODUCTS}
+ ${BUILD_IN_SOURCE})
+
+ set_target_properties(${BUILD_NAME} PROPERTIES FOLDER "External Projects")
+
+ CLEAR_BUILD_VARS()
+endmacro()
+
+# Macro to test format of line endings of a patch
+# Windows Specific
+macro(PATCH_LF_CHECK patch)
+ if(CMAKE_HOST_WIN32)
+ # 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.
+ file(READ ${ARGV0} patch_content_hex HEX)
+ # Force handle LF-only line endings
+ if(NOT patch_content_hex MATCHES "0d0a")
+ if (NOT "--binary" IN_LIST PATCH_EXECUTABLE)
+ list(APPEND PATCH_EXECUTABLE --binary)
+ endif()
+ else()
+ if ("--binary" IN_LIST PATCH_EXECUTABLE)
+ list(REMOVE_ITEM PATCH_EXECUTABLE --binary)
+ endif()
+ endif()
+ endif()
+ unset(patch_content_hex)
+endmacro()
diff --git a/cmake/scripts/common/PathSetup.cmake b/cmake/scripts/common/PathSetup.cmake
new file mode 100644
index 0000000..4fc888e
--- /dev/null
+++ b/cmake/scripts/common/PathSetup.cmake
@@ -0,0 +1,13 @@
+# Platform path setup
+include(cmake/scripts/${CORE_SYSTEM_NAME}/PathSetup.cmake)
+
+# Fallback install location for dependencies built
+if(NOT DEPENDS_PATH)
+ set(DEPENDS_PATH "${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}")
+endif()
+
+# If a platform sets a Depends_path for libs, prepend to cmake prefix path
+# for when searching for libs (eg find_package)
+if(DEPENDS_PATH)
+ list(PREPEND CMAKE_PREFIX_PATH ${DEPENDS_PATH})
+endif()
diff --git a/cmake/scripts/common/Platform.cmake b/cmake/scripts/common/Platform.cmake
new file mode 100644
index 0000000..397d8d4
--- /dev/null
+++ b/cmake/scripts/common/Platform.cmake
@@ -0,0 +1,57 @@
+if(NOT CORE_SYSTEM_NAME)
+ string(TOLOWER ${CMAKE_SYSTEM_NAME} CORE_SYSTEM_NAME)
+endif()
+
+if(CORE_SYSTEM_NAME STREQUAL linux OR CORE_SYSTEM_NAME STREQUAL freebsd)
+ # Set default CORE_PLATFORM_NAME to X11 WAYLAND GBM
+ # This is overridden by user setting -DCORE_PLATFORM_NAME=<platform>
+ set(_DEFAULT_PLATFORM X11 WAYLAND GBM)
+
+ if(NOT APP_RENDER_SYSTEM)
+ message(SEND_ERROR "You need to decide whether you want to use GL- or GLES-based rendering. Please set APP_RENDER_SYSTEM to either \"gl\" or \"gles\". For normal desktop systems, you will usually want to use \"gl\".")
+ endif()
+else()
+ string(TOLOWER ${CORE_SYSTEM_NAME} _DEFAULT_PLATFORM)
+endif()
+
+set(APP_BINARY_SUFFIX ".bin")
+
+#
+# Note: please do not use CORE_PLATFORM_NAME in any checks,
+# use the normalized to lower case CORE_PLATFORM_NAME_LC (see below) instead
+#
+if(NOT CORE_PLATFORM_NAME)
+ set(CORE_PLATFORM_NAME ${_DEFAULT_PLATFORM})
+endif()
+set(CORE_PLATFORM_NAME ${CORE_PLATFORM_NAME} CACHE STRING "Platform port to build" FORCE)
+unset(_DEFAULT_PLATFORM)
+
+string(REPLACE " " ";" CORE_PLATFORM_NAME "${CORE_PLATFORM_NAME}")
+foreach(platform IN LISTS CORE_PLATFORM_NAME)
+ string(TOLOWER ${platform} platform)
+ list(APPEND CORE_PLATFORM_NAME_LC ${platform})
+endforeach()
+
+string(REPLACE ";" " " CORE_PLATFORM_STRING "${CORE_PLATFORM_NAME_LC}")
+list(APPEND final_message "Platforms: ${CORE_PLATFORM_STRING}")
+
+if(CORE_SYSTEM_NAME STREQUAL linux OR CORE_SYSTEM_NAME STREQUAL freebsd)
+ list(LENGTH CORE_PLATFORM_NAME_LC PLATFORM_COUNT)
+ if(PLATFORM_COUNT EQUAL 1)
+ option(ENABLE_APP_AUTONAME "Enable renaming the binary according to windowing?" ON)
+ if(ENABLE_APP_AUTONAME)
+ set(APP_BINARY_SUFFIX "-${CORE_PLATFORM_NAME_LC}")
+ endif()
+ endif()
+endif()
+
+foreach(CORE_PLATFORM_LC IN LISTS CORE_PLATFORM_NAME_LC)
+ if(EXISTS ${CMAKE_SOURCE_DIR}/cmake/platform/${CORE_SYSTEM_NAME}/${CORE_PLATFORM_LC}.cmake)
+ include(${CMAKE_SOURCE_DIR}/cmake/platform/${CORE_SYSTEM_NAME}/${CORE_PLATFORM_LC}.cmake)
+ else()
+ file(GLOB _platformnames RELATIVE ${CMAKE_SOURCE_DIR}/cmake/platform/${CORE_SYSTEM_NAME}/
+ ${CMAKE_SOURCE_DIR}/cmake/platform/${CORE_SYSTEM_NAME}/*.cmake)
+ string(REPLACE ".cmake" " " _platformnames ${_platformnames})
+ message(FATAL_ERROR "invalid CORE_PLATFORM_NAME: ${CORE_PLATFORM_NAME_LC}\nValid platforms: ${_platformnames}")
+ endif()
+endforeach()
diff --git a/cmake/scripts/common/PrepareEnv.cmake b/cmake/scripts/common/PrepareEnv.cmake
new file mode 100644
index 0000000..559788f
--- /dev/null
+++ b/cmake/scripts/common/PrepareEnv.cmake
@@ -0,0 +1,107 @@
+# parse version.txt and versions.h to get the version and API info
+include(${CORE_SOURCE_DIR}/cmake/scripts/common/Macros.cmake)
+core_find_versions()
+
+# in case we need to download something, set KODI_MIRROR to the default if not already 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()
+
+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()
+
+set(PLATFORM_TAG ${CORE_SYSTEM_NAME})
+
+# The CPU variable is given either by ./tools/depends or by the
+# ./cmake/scripts/common/ArchSetup.cmake (which refers to the Kodi building
+# itself). However, this file is only used by addons, so CPU can not always
+# be defined, so in this case, if empty, the base CPU will be used.
+if(NOT CPU)
+ set(CPU ${CMAKE_SYSTEM_PROCESSOR})
+endif()
+
+if(CORE_SYSTEM_NAME STREQUAL android)
+ if (CPU MATCHES "v7a")
+ set(PLATFORM_TAG ${PLATFORM_TAG}-armv7)
+ elseif (CPU MATCHES "arm64")
+ set(PLATFORM_TAG ${PLATFORM_TAG}-aarch64)
+ elseif (CPU MATCHES "i686")
+ set(PLATFORM_TAG ${PLATFORM_TAG}-i686)
+ elseif (CPU MATCHES "x86_64")
+ set(PLATFORM_TAG ${PLATFORM_TAG}-x86_64)
+ else()
+ message(FATAL_ERROR "Unsupported architecture")
+ endif()
+elseif(CORE_SYSTEM_NAME STREQUAL darwin_embedded)
+ set(PLATFORM_TAG ${CORE_PLATFORM_NAME})
+ if (CPU MATCHES arm64)
+ set(PLATFORM_TAG ${PLATFORM_TAG}-aarch64)
+ else()
+ message(FATAL_ERROR "Unsupported architecture")
+ endif()
+elseif(CORE_SYSTEM_NAME STREQUAL osx)
+ set(PLATFORM_TAG ${PLATFORM_TAG}-${CPU})
+elseif(CORE_SYSTEM_NAME STREQUAL windows)
+ include(CheckSymbolExists)
+ check_symbol_exists(_X86_ "Windows.h" _X86_)
+ check_symbol_exists(_AMD64_ "Windows.h" _AMD64_)
+
+ if(_X86_)
+ set(PLATFORM_TAG ${PLATFORM_TAG}-i686)
+ elseif(_AMD64_)
+ set(PLATFORM_TAG ${PLATFORM_TAG}-x86_64)
+ else()
+ message(FATAL_ERROR "Unsupported architecture")
+ endif()
+
+ unset(_X86_)
+ unset(_AMD64_)
+endif()
+
+# generate the proper KodiConfig.cmake file
+configure_file(${CORE_SOURCE_DIR}/cmake/KodiConfig.cmake.in ${APP_LIB_DIR}/KodiConfig.cmake @ONLY)
+
+# copy cmake helpers to lib/kodi
+file(COPY ${CORE_SOURCE_DIR}/cmake/scripts/common/AddonHelpers.cmake
+ ${CORE_SOURCE_DIR}/cmake/scripts/common/AddOptions.cmake
+ DESTINATION ${APP_LIB_DIR})
+
+### copy all the addon binding header files to include/kodi
+include(${CORE_SOURCE_DIR}/xbmc/addons/AddonBindings.cmake)
+file(COPY ${CORE_ADDON_BINDINGS_FILES} ${CORE_ADDON_BINDINGS_DIRS}/
+ DESTINATION ${APP_INCLUDE_DIR}
+ REGEX ".txt" EXCLUDE)
+
+### processing additional tools required by the platform
+if(EXISTS ${CORE_SOURCE_DIR}/cmake/scripts/${CORE_SYSTEM_NAME}/tools/)
+ file(GLOB platform_tools ${CORE_SOURCE_DIR}/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 0000000..3a1910c
--- /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 output 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::Executable
+ 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 "${CMAKE_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/StaticAnalysis.cmake b/cmake/scripts/common/StaticAnalysis.cmake
new file mode 100644
index 0000000..f7ffa39
--- /dev/null
+++ b/cmake/scripts/common/StaticAnalysis.cmake
@@ -0,0 +1,39 @@
+include(ProcessorCount)
+ProcessorCount(CPU_CORES)
+
+find_program(CPPCHECK_EXECUTABLE cppcheck)
+
+if(CPPCHECK_EXECUTABLE)
+ add_custom_target(analyze-cppcheck
+ DEPENDS ${APP_NAME_LC} ${APP_NAME_LC}-test
+ COMMAND ${CPPCHECK_EXECUTABLE}
+ -j${CPU_CORES}
+ --project=${CMAKE_BINARY_DIR}/compile_commands.json
+ --std=c++${CMAKE_CXX_STANDARD}
+ --enable=all
+ --xml
+ --xml-version=2
+ --language=c++
+ --relative-paths=${CMAKE_SOURCE_DIR}
+ --rule-file=${CMAKE_SOURCE_DIR}/tools/static-analysis/cppcheck/cppcheck-rules.xml
+ --suppress-xml=${CMAKE_SOURCE_DIR}/tools/static-analysis/cppcheck/cppcheck-suppressions.xml
+ --output-file=${CMAKE_BINARY_DIR}/cppcheck-result.xml
+ COMMENT "Static code analysis using cppcheck")
+endif()
+
+find_program(CLANG_TIDY_EXECUTABLE NAMES clang-tidy)
+find_program(RUN_CLANG_TIDY NAMES run-clang-tidy.py run-clang-tidy
+ PATHS /usr/share/clang /usr/bin)
+
+if(RUN_CLANG_TIDY AND CLANG_TIDY_EXECUTABLE)
+ add_custom_target(analyze-clang-tidy
+ DEPENDS ${APP_NAME_LC} ${APP_NAME_LC}-test
+ COMMAND ${RUN_CLANG_TIDY}
+ -j${CPU_CORES}
+ -clang-tidy-binary=${CLANG_TIDY_EXECUTABLE}
+ -p=${CMAKE_BINARY_DIR}
+ -header-filter='${CMAKE_BINARY_DIR}/.*/include/.*'
+ | tee ${CMAKE_BINARY_DIR}/clangtidy-result.xml
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ COMMENT "Static code analysis using clang-tidy")
+endif()
diff --git a/cmake/scripts/common/Uninstall.cmake b/cmake/scripts/common/Uninstall.cmake
new file mode 100644
index 0000000..5753857
--- /dev/null
+++ b/cmake/scripts/common/Uninstall.cmake
@@ -0,0 +1,58 @@
+macro(remove_empty_dirs)
+ list(REMOVE_DUPLICATES DIRECTORIES)
+ unset(PDIRECTORIES)
+ foreach(dir IN LISTS DIRECTORIES)
+ if(EXISTS $ENV{DESTDIR}${dir})
+ file(GLOB _res $ENV{DESTDIR}${dir}/*)
+ list(LENGTH _res _len)
+ if(_len EQUAL 0 AND EXISTS $ENV{DESTDIR}${dir})
+ message(STATUS "Removing empty dir: ${dir}")
+ execute_process(
+ COMMAND ${CMAKE_COMMAND} -E remove_directory $ENV{DESTDIR}${dir}
+ OUTPUT_VARIABLE rm_out
+ RESULT_VARIABLE rm_retval
+ )
+ if(NOT "${rm_retval}" STREQUAL 0)
+ message(FATAL_ERROR "Failed to remove directory: $ENV{DESTDIR}${dir}")
+ endif()
+ get_filename_component(_pdir $ENV{DESTDIR}${dir} DIRECTORY)
+ list(APPEND PDIRECTORIES ${_pdir})
+ endif()
+ endif()
+ endforeach()
+ list(LENGTH PDIRECTORIES _plen)
+ if(_plen GREATER 0)
+ set(DIRECTORIES ${PDIRECTORIES})
+ remove_empty_dirs()
+ endif()
+endmacro()
+
+# 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})
+ get_filename_component(_dir $ENV{DESTDIR}${file} DIRECTORY)
+ list(APPEND DIRECTORIES $ENV{DESTDIR}${_dir})
+ 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)
+
+ # delete empty dirs
+ if(DIRECTORIES)
+ remove_empty_dirs()
+ endif()
+else()
+ message(STATUS "Cannot find install manifest: '${MANIFEST}'")
+endif()
diff --git a/cmake/scripts/darwin/Macros.cmake b/cmake/scripts/darwin/Macros.cmake
new file mode 100644
index 0000000..9a805c4
--- /dev/null
+++ b/cmake/scripts/darwin/Macros.cmake
@@ -0,0 +1,8 @@
+macro(enable_arc)
+ if(CMAKE_GENERATOR STREQUAL Xcode)
+ set(CMAKE_XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES)
+ else()
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fobjc-arc")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fobjc-arc")
+ endif()
+endmacro()
diff --git a/cmake/scripts/darwin_embedded/ArchSetup.cmake b/cmake/scripts/darwin_embedded/ArchSetup.cmake
new file mode 100644
index 0000000..b3258be
--- /dev/null
+++ b/cmake/scripts/darwin_embedded/ArchSetup.cmake
@@ -0,0 +1,68 @@
+if(NOT CMAKE_TOOLCHAIN_FILE)
+ message(FATAL_ERROR "CMAKE_TOOLCHAIN_FILE required for ios/tvos. See ${CMAKE_SOURCE_DIR}/cmake/README.md")
+endif()
+
+set(CORE_MAIN_SOURCE ${CMAKE_SOURCE_DIR}/xbmc/platform/darwin/${CORE_PLATFORM_NAME_LC}/XBMCApplication.mm)
+set(PLATFORM_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/xbmc/platform/darwin/${CORE_PLATFORM_NAME_LC}/Info.plist.in)
+
+list(APPEND ARCH_DEFINES -DTARGET_POSIX -DTARGET_DARWIN -DTARGET_DARWIN_EMBEDDED)
+set(SYSTEM_DEFINES -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
+ -D__STDC_CONSTANT_MACROS -DHAS_IOS_NETWORK -DHAS_ZEROCONF)
+set(PLATFORM_DIR platform/darwin)
+set(PLATFORMDEFS_DIR platform/posix)
+set(CMAKE_SYSTEM_NAME Darwin)
+if(WITH_ARCH)
+ set(ARCH ${WITH_ARCH})
+else()
+ if(CPU STREQUAL arm64)
+ set(ARCH aarch64)
+ else()
+ message(SEND_ERROR "Unknown CPU: ${CPU}")
+ endif()
+ set(CMAKE_OSX_ARCHITECTURES ${CPU})
+ set(NEON True)
+endif()
+
+if(NOT APP_RENDER_SYSTEM OR APP_RENDER_SYSTEM STREQUAL "gles")
+ set(PLATFORM_REQUIRED_DEPS OpenGLES)
+ set(APP_RENDER_SYSTEM gles)
+ list(APPEND SYSTEM_DEFINES -DGL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED)
+else()
+ message(SEND_ERROR "Currently only OpenGLES rendering is supported. Please set APP_RENDER_SYSTEM to \"gles\"")
+endif()
+
+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" "-lresolv" "-ObjC"
+ "-framework AVKit" "-framework GameController")
+
+# Speech not available on tvOS
+if(NOT CORE_PLATFORM_NAME_LC STREQUAL tvos)
+ list(APPEND DEPLIBS "-framework Speech")
+endif()
+
+set(ENABLE_OPTICAL OFF CACHE BOOL "" FORCE)
+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)
+
+include(cmake/scripts/darwin/Macros.cmake)
+enable_arc()
+
+# Xcode strips dead code by default which breaks wrapping
+set(CMAKE_XCODE_ATTRIBUTE_DEAD_CODE_STRIPPING OFF)
+
+option(ENABLE_XCODE_ADDONBUILD "Enable Xcode automatic addon building?" OFF)
+
+# Unify output directories for iOS/tvOS packaging scripts
+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/darwin_embedded/ExtraTargets.cmake b/cmake/scripts/darwin_embedded/ExtraTargets.cmake
new file mode 100644
index 0000000..01ab632
--- /dev/null
+++ b/cmake/scripts/darwin_embedded/ExtraTargets.cmake
@@ -0,0 +1,32 @@
+if(CORE_PLATFORM_NAME_LC STREQUAL tvos)
+ # top shelf extension
+ set(TOPSHELF_EXTENSION_NAME "${APP_NAME_LC}-topshelf")
+ set(TOPSHELF_BUNDLE_EXTENSION appex)
+ set(TOPSHELF_DIR "${CMAKE_SOURCE_DIR}/xbmc/platform/darwin/tvos/TopShelf")
+ # same path as the output Info.plist, taken from cmGlobalXCodeGenerator::ComputeInfoPListLocation()
+ set(ENTITLEMENTS_OUT_PATH "${CMAKE_BINARY_DIR}/CMakeFiles/${TOPSHELF_EXTENSION_NAME}.dir/TopShelf.entitlements")
+
+ set(SOURCES
+ ${TOPSHELF_DIR}/../../ios-common/DarwinEmbedUtils.mm
+ ${TOPSHELF_DIR}/ServiceProvider.mm
+ ${TOPSHELF_DIR}/../tvosShared.mm)
+ set(HEADERS
+ ${TOPSHELF_DIR}/../../ios-common/DarwinEmbedUtils.h
+ ${TOPSHELF_DIR}/ServiceProvider.h
+ ${TOPSHELF_DIR}/../tvosShared.h)
+ add_executable(${TOPSHELF_EXTENSION_NAME} MACOSX_BUNDLE ${SOURCES} ${HEADERS})
+
+ configure_file(${TOPSHELF_DIR}/TopShelf.entitlements.in ${ENTITLEMENTS_OUT_PATH} @ONLY)
+ set_target_properties(${TOPSHELF_EXTENSION_NAME} PROPERTIES BUNDLE_EXTENSION ${TOPSHELF_BUNDLE_EXTENSION}
+ MACOSX_BUNDLE_INFO_PLIST ${TOPSHELF_DIR}/Info.plist.in
+ XCODE_PRODUCT_TYPE com.apple.product-type.tv-app-extension
+ XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS ${ENTITLEMENTS_OUT_PATH})
+ target_link_libraries(${TOPSHELF_EXTENSION_NAME} "-framework TVServices" "-framework Foundation")
+
+ add_custom_command(TARGET ${TOPSHELF_EXTENSION_NAME} POST_BUILD
+ COMMAND "NATIVEPREFIX=${NATIVEPREFIX}"
+ ${CMAKE_SOURCE_DIR}/tools/darwin/Support/Codesign-topshelf.command
+ )
+
+ add_dependencies(${APP_NAME_LC} ${TOPSHELF_EXTENSION_NAME})
+endif()
diff --git a/cmake/scripts/darwin_embedded/Install.cmake b/cmake/scripts/darwin_embedded/Install.cmake
new file mode 100644
index 0000000..02464ee
--- /dev/null
+++ b/cmake/scripts/darwin_embedded/Install.cmake
@@ -0,0 +1,130 @@
+# IOS/TVOS packaging
+if(CORE_PLATFORM_NAME_LC STREQUAL tvos)
+ # asset catalog
+ set(ASSET_CATALOG "${CMAKE_SOURCE_DIR}/xbmc/platform/darwin/tvos/Assets.xcassets")
+ set(ASSET_CATALOG_ASSETS Assets)
+ set(ASSET_CATALOG_LAUNCH_IMAGE LaunchImage)
+
+ message("generating missing asset catalog images...")
+ execute_process(COMMAND ${CMAKE_SOURCE_DIR}/tools/darwin/Support/GenerateMissingImages-tvos.py "${ASSET_CATALOG}" ${ASSET_CATALOG_ASSETS} ${ASSET_CATALOG_LAUNCH_IMAGE})
+
+ target_sources(${APP_NAME_LC} PRIVATE "${ASSET_CATALOG}")
+ set_source_files_properties("${ASSET_CATALOG}" PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") # adds to Copy Bundle Resources build phase
+
+ # entitlements
+ set(ENTITLEMENTS_OUT_PATH "${CMAKE_BINARY_DIR}/CMakeFiles/${APP_NAME_LC}.dir/Kodi.entitlements")
+ configure_file(${CMAKE_SOURCE_DIR}/xbmc/platform/darwin/tvos/Kodi.entitlements.in ${ENTITLEMENTS_OUT_PATH} @ONLY)
+
+ set_target_properties(${APP_NAME_LC} PROPERTIES XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME ${ASSET_CATALOG_ASSETS}
+ XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME ${ASSET_CATALOG_LAUNCH_IMAGE}
+ XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS ${ENTITLEMENTS_OUT_PATH})
+
+else()
+ set(BUNDLE_RESOURCES ${CMAKE_SOURCE_DIR}/media/splash.jpg
+ ${CMAKE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon29x29.png
+ ${CMAKE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon29x29@2x.png
+ ${CMAKE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon40x40.png
+ ${CMAKE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon40x40@2x.png
+ ${CMAKE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon50x50.png
+ ${CMAKE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon50x50@2x.png
+ ${CMAKE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon57x57.png
+ ${CMAKE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon57x57@2x.png
+ ${CMAKE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon60x60.png
+ ${CMAKE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon60x60@2x.png
+ ${CMAKE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon72x72.png
+ ${CMAKE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon72x72@2x.png
+ ${CMAKE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon76x76.png
+ ${CMAKE_SOURCE_DIR}/tools/darwin/packaging/media/ios/rounded/AppIcon76x76@2x.png)
+
+ target_sources(${APP_NAME_LC} PRIVATE ${BUNDLE_RESOURCES})
+ foreach(file IN LISTS BUNDLE_RESOURCES)
+ set_source_files_properties(${file} PROPERTIES MACOSX_PACKAGE_LOCATION .)
+ endforeach()
+
+ target_sources(${APP_NAME_LC} PRIVATE ${CMAKE_SOURCE_DIR}/xbmc/platform/darwin/ios/LaunchScreen.storyboard)
+ set_source_files_properties(${CMAKE_SOURCE_DIR}/xbmc/platform/darwin/ios/LaunchScreen.storyboard PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
+
+endif()
+
+# setup code signing
+# dev team ID / identity (certificate)
+set(DEVELOPMENT_TEAM "" CACHE STRING "Development Team")
+set(CODE_SIGN_IDENTITY $<IF:$<BOOL:${DEVELOPMENT_TEAM}>,iPhone\ Developer,> CACHE STRING "Code Sign Identity")
+
+# app provisioning profile
+set(CODE_SIGN_STYLE_APP Automatic)
+set(PROVISIONING_PROFILE_APP "" CACHE STRING "Provisioning profile name for the Kodi app")
+if(PROVISIONING_PROFILE_APP)
+ set(CODE_SIGN_STYLE_APP Manual)
+endif()
+
+# top shelf provisioning profile
+if(CORE_PLATFORM_NAME_LC STREQUAL tvos)
+ set(CODE_SIGN_STYLE_TOPSHELF Automatic)
+ set(PROVISIONING_PROFILE_TOPSHELF "" CACHE STRING "Provisioning profile name for the Top Shelf")
+ if(PROVISIONING_PROFILE_TOPSHELF)
+ set(CODE_SIGN_STYLE_TOPSHELF Manual)
+ endif()
+ set_target_properties(${TOPSHELF_EXTENSION_NAME} PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "${CODE_SIGN_IDENTITY}"
+ XCODE_ATTRIBUTE_CODE_SIGN_STYLE ${CODE_SIGN_STYLE_TOPSHELF}
+ XCODE_ATTRIBUTE_DEVELOPMENT_TEAM "${DEVELOPMENT_TEAM}"
+ XCODE_ATTRIBUTE_PROVISIONING_PROFILE_SPECIFIER "${PROVISIONING_PROFILE_TOPSHELF}")
+ # copy extension inside PlugIns dir of the app bundle
+ add_custom_command(TARGET ${APP_NAME_LC} POST_BUILD
+ COMMAND ${CMAKE_COMMAND} ARGS -E copy_directory $<TARGET_BUNDLE_DIR:${TOPSHELF_EXTENSION_NAME}>
+ $<TARGET_BUNDLE_DIR:${APP_NAME_LC}>/PlugIns/${TOPSHELF_EXTENSION_NAME}.${TOPSHELF_BUNDLE_EXTENSION}
+ MAIN_DEPENDENCY ${TOPSHELF_EXTENSION_NAME})
+endif()
+set_target_properties(${APP_NAME_LC} PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "${CODE_SIGN_IDENTITY}"
+ XCODE_ATTRIBUTE_CODE_SIGN_STYLE ${CODE_SIGN_STYLE_APP}
+ XCODE_ATTRIBUTE_DEVELOPMENT_TEAM "${DEVELOPMENT_TEAM}"
+ XCODE_ATTRIBUTE_PROVISIONING_PROFILE_SPECIFIER "${PROVISIONING_PROFILE_APP}")
+
+# Create xcode target that allows to build binary-addons.
+if(ADDONS_TO_BUILD)
+ set(_addons "ADDONS=${ADDONS_TO_BUILD}")
+endif()
+add_custom_target(binary-addons
+ COMMAND $(MAKE) -C ${CMAKE_SOURCE_DIR}/tools/depends/target/binary-addons clean
+ COMMAND $(MAKE) -C ${CMAKE_SOURCE_DIR}/tools/depends/target/binary-addons VERBOSE=1 V=99
+ INSTALL_PREFIX="${CMAKE_BINARY_DIR}/addons" CROSS_COMPILING=yes ${_addons})
+if(ENABLE_XCODE_ADDONBUILD)
+ add_dependencies(${APP_NAME_LC} binary-addons)
+endif()
+unset(_addons)
+
+add_custom_command(TARGET ${APP_NAME_LC} POST_BUILD
+ # TODO: Remove in sync with CopyRootFiles-darwin_embedded 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"
+ "APP_NAME=${APP_NAME}"
+ "XBMC_DEPENDS=${DEPENDS_PATH}"
+ ${CMAKE_SOURCE_DIR}/tools/darwin/Support/CopyRootFiles-darwin_embedded.command
+ COMMAND "XBMC_DEPENDS=${DEPENDS_PATH}"
+ "PYTHON_VERSION=${PYTHON_VERSION}"
+ ${CMAKE_SOURCE_DIR}/tools/darwin/Support/copyframeworks-darwin_embedded.command
+ COMMAND ${CMAKE_SOURCE_DIR}/tools/darwin/Support/copyframeworks-dylibs2frameworks.command
+ COMMAND "XBMC_DEPENDS=${DEPENDS_PATH}"
+ "NATIVEPREFIX=${NATIVEPREFIX}"
+ ${CMAKE_SOURCE_DIR}/tools/darwin/Support/Codesign.command
+)
+
+if(CORE_PLATFORM_NAME_LC STREQUAL tvos)
+ add_custom_command(TARGET ${APP_NAME_LC} POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${DEPENDS_PATH}/share/${APP_NAME_LC} $<TARGET_FILE_DIR:${APP_NAME_LC}>/AppData/AppHome
+ )
+endif()
+
+set(DEPENDS_ROOT_FOR_XCODE ${NATIVEPREFIX}/..)
+configure_file(${CMAKE_SOURCE_DIR}/tools/darwin/packaging/darwin_embedded/mkdeb-darwin_embedded.sh.in
+ ${CMAKE_BINARY_DIR}/tools/darwin/packaging/darwin_embedded/mkdeb-darwin_embedded.sh @ONLY)
+
+add_custom_target(deb
+ COMMAND sh ./mkdeb-darwin_embedded.sh ${CORE_BUILD_CONFIG}
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/tools/darwin/packaging/darwin_embedded)
+add_dependencies(deb ${APP_NAME_LC})
+
diff --git a/cmake/scripts/darwin_embedded/Macros.cmake b/cmake/scripts/darwin_embedded/Macros.cmake
new file mode 100644
index 0000000..3e58b0d
--- /dev/null
+++ b/cmake/scripts/darwin_embedded/Macros.cmake
@@ -0,0 +1,119 @@
+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")
+ # CURRENT_VARIANT is an Xcode env var
+ # CPU is a project cmake var
+ # Xcode new build system (CMAKE_XCODE_BUILD_SYSTEM=12) requires the env var CURRENT_VARIANT to be passed WITHOUT brackets
+ # Xcode Legacy build system (CMAKE_XCODE_BUILD_SYSTEM=1) requires the env var CURRENT_VARIANT to be passed WITH brackets
+ if(CMAKE_XCODE_BUILD_SYSTEM STREQUAL 12)
+ set(wrapper_obj cores/dll-loader/exports/kodi.build/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/wrapper.build/Objects-$CURRENT_VARIANT/${CPU}/wrapper.o)
+ else()
+ set(wrapper_obj cores/dll-loader/exports/kodi.build/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/wrapper.build/Objects-$(CURRENT_VARIANT)/${CPU}/wrapper.o)
+ endif()
+ else()
+ message(FATAL_ERROR "Unsupported generator in core_link_library")
+ endif()
+
+ set(export -bundle -undefined dynamic_lookup
+ -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})
+
+ 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)
+
+ 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/darwin_embedded/PathSetup.cmake b/cmake/scripts/darwin_embedded/PathSetup.cmake
new file mode 100644
index 0000000..efaca0b
--- /dev/null
+++ b/cmake/scripts/darwin_embedded/PathSetup.cmake
@@ -0,0 +1,7 @@
+set(BUNDLE_IDENTIFIER_DESC "Bundle ID")
+if(CORE_PLATFORM_NAME_LC STREQUAL tvos)
+ string(CONCAT BUNDLE_IDENTIFIER_DESC "${BUNDLE_IDENTIFIER_DESC}" " (app, top shelf, group ID)")
+endif()
+set(PLATFORM_BUNDLE_IDENTIFIER "${APP_PACKAGE}-${CORE_PLATFORM_NAME_LC}" CACHE STRING "${BUNDLE_IDENTIFIER_DESC}")
+list(APPEND final_message "Bundle ID: ${PLATFORM_BUNDLE_IDENTIFIER}")
+include(cmake/scripts/osx/PathSetup.cmake)
diff --git a/cmake/scripts/freebsd/ArchSetup.cmake b/cmake/scripts/freebsd/ArchSetup.cmake
new file mode 100644
index 0000000..87f4f0c
--- /dev/null
+++ b/cmake/scripts/freebsd/ArchSetup.cmake
@@ -0,0 +1,46 @@
+# Main cpp
+set(CORE_MAIN_SOURCE ${CMAKE_SOURCE_DIR}/xbmc/platform/posix/main.cpp)
+
+set(ARCH_DEFINES -DTARGET_POSIX -DTARGET_FREEBSD)
+set(SYSTEM_DEFINES -D__STDC_CONSTANT_MACROS -D_LARGEFILE64_SOURCE
+ -D_FILE_OFFSET_BITS=64 -DHAS_OSS)
+set(PLATFORM_DIR platform/linux)
+set(PLATFORMDEFS_DIR platform/posix)
+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)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL armv6)
+ set(ARCH armv6-freebsd)
+ set(NEON True)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL armv7)
+ set(ARCH armv7-freebsd)
+ set(NEON True)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64)
+ set(ARCH aarch64-freebsd)
+ set(NEON True)
+ else()
+ message(WARNING "unknown CPU: ${CPU}")
+ endif()
+endif()
+
+# Disable ALSA by default
+if(NOT ENABLE_ALSA)
+ option(ENABLE_ALSA "Enable alsa support?" OFF)
+endif()
+
+# Additional SYSTEM_DEFINES
+list(APPEND SYSTEM_DEFINES -DHAS_POSIX_NETWORK -DHAS_FREEBSD_NETWORK)
+
+# Build internal libs
+if(NOT USE_INTERNAL_LIBS)
+ if(KODI_DEPENDSBUILD)
+ set(USE_INTERNAL_LIBS ON)
+ else()
+ set(USE_INTERNAL_LIBS OFF)
+ endif()
+endif()
diff --git a/cmake/scripts/freebsd/ExtraTargets.cmake b/cmake/scripts/freebsd/ExtraTargets.cmake
new file mode 100644
index 0000000..9d5d214
--- /dev/null
+++ b/cmake/scripts/freebsd/ExtraTargets.cmake
@@ -0,0 +1 @@
+include(cmake/scripts/linux/ExtraTargets.cmake)
diff --git a/cmake/scripts/freebsd/Install.cmake b/cmake/scripts/freebsd/Install.cmake
new file mode 120000
index 0000000..28ce012
--- /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 100644
index 0000000..ef5aed3
--- /dev/null
+++ b/cmake/scripts/freebsd/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}
+ ERROR_QUIET
+ OUTPUT_VARIABLE _TMP_FILENAME)
+ string(REGEX MATCH ".*lib${liblow}.so" ${lib}_FILENAME ${_TMP_FILENAME})
+ endif()
+ if(${lib}_FILENAME)
+ execute_process(COMMAND ${CMAKE_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/freebsd/PathSetup.cmake b/cmake/scripts/freebsd/PathSetup.cmake
new file mode 120000
index 0000000..6786c1c
--- /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/linux/ArchSetup.cmake b/cmake/scripts/linux/ArchSetup.cmake
new file mode 100644
index 0000000..4083483
--- /dev/null
+++ b/cmake/scripts/linux/ArchSetup.cmake
@@ -0,0 +1,207 @@
+include(cmake/scripts/linux/Linkers.txt)
+
+# Main cpp
+set(CORE_MAIN_SOURCE ${CMAKE_SOURCE_DIR}/xbmc/platform/posix/main.cpp)
+
+# we always want to use GNU features if available, so set _GNU_SOURCE
+set(ARCH_DEFINES -DTARGET_POSIX -DTARGET_LINUX -D_GNU_SOURCE)
+set(SYSTEM_DEFINES -D__STDC_CONSTANT_MACROS -D_FILE_OFFSET_BITS=64)
+set(PLATFORM_DIR platform/linux)
+set(PLATFORMDEFS_DIR platform/posix)
+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 STREQUAL arm1176jzf-s)
+ set(ARCH arm)
+ set(NEON False)
+ set(NEON_FLAGS "-mcpu=arm1176jzf-s -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=vfp")
+ elseif(CPU MATCHES "cortex-a7")
+ set(ARCH arm)
+ set(NEON True)
+ set(NEON_FLAGS "-fPIC -mcpu=cortex-a7")
+ elseif(CPU MATCHES "cortex-a53")
+ set(ARCH arm)
+ set(NEON True)
+ set(NEON_FLAGS "-fPIC -mcpu=cortex-a53")
+ elseif(CPU MATCHES arm)
+ set(ARCH arm)
+ set(NEON True)
+ elseif(CPU MATCHES aarch64 OR CPU MATCHES arm64)
+ set(ARCH aarch64)
+ set(NEON True)
+ elseif(CPU MATCHES riscv64)
+ set(ARCH riscv64)
+ set(NEON False)
+ elseif(CPU MATCHES ppc64le)
+ set(ARCH ppc64le)
+ set(NEON False)
+ elseif(CPU MATCHES loongarch64)
+ set(ARCH loongarch64)
+ set(NEON False)
+ else()
+ message(SEND_ERROR "Unknown CPU: ${CPU}")
+ endif()
+endif()
+
+# disable the default gold linker when an alternative was enabled by the user
+if(ENABLE_LLD OR ENABLE_MOLD)
+ set(ENABLE_GOLD OFF CACHE BOOL "" FORCE)
+elseif(ENABLE_GOLD)
+ include(LDGOLD)
+endif()
+if(ENABLE_LLD)
+ set(ENABLE_MOLD OFF CACHE BOOL "" FORCE)
+ include(LLD)
+elseif(ENABLE_MOLD)
+ set(ENABLE_LLD OFF CACHE BOOL "" FORCE)
+ include(MOLD)
+endif()
+
+
+if(CMAKE_BUILD_TYPE STREQUAL Release OR CMAKE_BUILD_TYPE STREQUAL MinSizeRel)
+
+ # LTO Support, requires cmake >= 3.9
+ if(CMAKE_VERSION VERSION_EQUAL 3.9.0 OR CMAKE_VERSION VERSION_GREATER 3.9.0)
+ option(USE_LTO "Enable link time optimization. Specify an int for number of parallel jobs" OFF)
+ if(USE_LTO)
+ include(CheckIPOSupported)
+ check_ipo_supported(RESULT HAVE_LTO OUTPUT _output)
+ if(HAVE_LTO)
+ set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
+
+ # override flags to enable parallel processing
+ set(NJOBS 2)
+ if(USE_LTO MATCHES "^[0-9]+$")
+ set(NJOBS ${USE_LTO})
+ endif()
+
+ if(CMAKE_COMPILER_IS_GNUCXX)
+ # GCC
+ # Make sure we strip binaries in Release build
+ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s")
+ set(CMAKE_CXX_COMPILE_OPTIONS_IPO -flto=${NJOBS} -fno-fat-lto-objects)
+ set(CMAKE_C_COMPILE_OPTIONS_IPO -flto=${NJOBS} -fno-fat-lto-objects)
+ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+ # CLANG
+ set(ENABLE_GOLD OFF CACHE BOOL "gold linker forced to off" FORCE)
+
+ find_package(LLVM REQUIRED)
+
+ if(NOT CLANG_LTO_CACHE)
+ set(CLANG_LTO_CACHE ${PROJECT_BINARY_DIR}/.clang-lto.cache)
+ endif()
+ if(USE_LTO STREQUAL "all")
+ set(NJOBS ${USE_LTO})
+ endif()
+
+ set(CMAKE_CXX_COMPILE_OPTIONS_IPO -flto=thin)
+ set(CMAKE_C_COMPILE_OPTIONS_IPO -flto=thin)
+ if(LLD_FOUND)
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--thinlto-jobs=${NJOBS},--thinlto-cache-dir=${CLANG_LTO_CACHE}")
+ elseif(MOLD_FOUND)
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--plugin-opt=jobs=${NJOBS},--plugin-opt=cache-dir=${CLANG_LTO_CACHE}")
+ endif()
+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
+ set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
+ endif()
+ else()
+ message(WARNING "LTO optimization not supported: ${_output}")
+ unset(_output)
+ endif()
+ endif()
+ endif()
+endif()
+
+if(KODI_DEPENDSBUILD)
+ # Binaries should be directly runnable from host, so include rpath to depends
+ set(CMAKE_INSTALL_RPATH "${DEPENDS_PATH}/lib")
+ set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
+endif()
+
+include(CheckIncludeFiles)
+check_include_files("linux/udmabuf.h" HAVE_LINUX_UDMABUF)
+if(HAVE_LINUX_UDMABUF)
+ list(APPEND ARCH_DEFINES "-DHAVE_LINUX_UDMABUF=1")
+else()
+ message(STATUS "include/linux/udmabuf.h not found")
+endif()
+
+check_include_files("linux/dma-heap.h" HAVE_LINUX_DMA_HEAP)
+if(HAVE_LINUX_DMA_HEAP)
+ list(APPEND ARCH_DEFINES "-DHAVE_LINUX_DMA_HEAP=1")
+else()
+ message(STATUS "include/linux/dma-heap.h not found")
+endif()
+
+check_include_files("linux/dma-buf.h" HAVE_LINUX_DMA_BUF)
+if(HAVE_LINUX_DMA_BUF)
+ list(APPEND ARCH_DEFINES "-DHAVE_LINUX_DMA_BUF=1")
+else()
+ message(STATUS "include/linux/dma-buf.h not found")
+endif()
+
+include(CheckSymbolExists)
+set(CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE")
+check_symbol_exists("mkostemp" "stdlib.h" HAVE_MKOSTEMP)
+set(CMAKE_REQUIRED_DEFINITIONS "")
+if(HAVE_MKOSTEMP)
+ list(APPEND ARCH_DEFINES "-DHAVE_MKOSTEMP=1")
+endif()
+
+set(CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE")
+check_symbol_exists("memfd_create" "sys/mman.h" HAVE_LINUX_MEMFD)
+set(CMAKE_REQUIRED_DEFINITIONS "")
+if(HAVE_LINUX_MEMFD)
+ list(APPEND ARCH_DEFINES "-DHAVE_LINUX_MEMFD=1")
+else()
+ message(STATUS "memfd_create() not found")
+endif()
+
+# Additional SYSTEM_DEFINES
+list(APPEND SYSTEM_DEFINES -DHAS_POSIX_NETWORK -DHAS_LINUX_NETWORK)
+
+# Code Coverage
+if(CMAKE_BUILD_TYPE STREQUAL Coverage)
+ set(COVERAGE_TEST_BINARY ${APP_NAME_LC}-test)
+ set(COVERAGE_SOURCE_DIR ${CMAKE_SOURCE_DIR})
+ set(COVERAGE_DEPENDS "\${APP_NAME_LC}" "\${APP_NAME_LC}-test")
+ set(COVERAGE_EXCLUDES */test/* lib/* */lib/*)
+endif()
+
+if(NOT "x11" IN_LIST CORE_PLATFORM_NAME_LC)
+ set(ENABLE_VDPAU OFF CACHE BOOL "Disabling VDPAU" FORCE)
+endif()
+
+if("x11" IN_LIST CORE_PLATFORM_NAME_LC AND ENABLE_VDPAU)
+ set(ENABLE_GLX ON CACHE BOOL "Enabling GLX" FORCE)
+endif()
+
+# Architecture endianness detector
+include(TestBigEndian)
+TEST_BIG_ENDIAN(ARCH_IS_BIGENDIAN)
+if(ARCH_IS_BIGENDIAN)
+ message(STATUS "Host architecture is big-endian")
+ list(APPEND ARCH_DEFINES "-DWORDS_BIGENDIAN=1")
+else()
+ message(STATUS "Host architecture is little-endian")
+endif()
+
+# Build internal libs
+if(NOT USE_INTERNAL_LIBS)
+ if(KODI_DEPENDSBUILD)
+ set(USE_INTERNAL_LIBS ON)
+ else()
+ set(USE_INTERNAL_LIBS OFF)
+ endif()
+endif()
+
+# Atomic library
+list(APPEND PLATFORM_REQUIRED_DEPS Atomic)
diff --git a/cmake/scripts/linux/CodeCoverage.cmake b/cmake/scripts/linux/CodeCoverage.cmake
new file mode 100644
index 0000000..f0a36fc
--- /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
+
+# Compiler 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 0000000..4f5078b
--- /dev/null
+++ b/cmake/scripts/linux/ExtraTargets.cmake
@@ -0,0 +1,32 @@
+# xrandr
+if(X_FOUND AND XRANDR_FOUND)
+ find_package(X QUIET)
+ find_package(XRandR QUIET)
+ add_executable(${APP_NAME_LC}-xrandr ${CMAKE_SOURCE_DIR}/xbmc-xrandr.c)
+ target_link_libraries(${APP_NAME_LC}-xrandr ${SYSTEM_LDFLAGS} ${X_LIBRARIES} m ${XRANDR_LIBRARIES})
+endif()
+
+# WiiRemote
+if(ENABLE_EVENTCLIENTS AND BLUETOOTH_FOUND)
+ find_package(CWiid QUIET)
+ find_package(GLU QUIET)
+ if(CWIID_FOUND AND GLU_FOUND)
+ add_subdirectory(${CMAKE_SOURCE_DIR}/tools/EventClients/Clients/WiiRemote build/WiiRemote)
+ endif()
+endif()
+
+if("wayland" IN_LIST CORE_PLATFORM_NAME_LC)
+ # This cannot go into wayland.cmake since it requires the Wayland dependencies
+ # to already be resolved
+ set(PROTOCOL_XMLS "${WAYLANDPP_PROTOCOLS_DIR}/presentation-time.xml"
+ "${WAYLANDPP_PROTOCOLS_DIR}/xdg-shell.xml"
+ "${WAYLAND_PROTOCOLS_DIR}/unstable/xdg-shell/xdg-shell-unstable-v6.xml"
+ "${WAYLAND_PROTOCOLS_DIR}/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml")
+ add_custom_command(OUTPUT "${WAYLAND_EXTRA_PROTOCOL_GENERATED_DIR}/wayland-extra-protocols.hpp" "${WAYLAND_EXTRA_PROTOCOL_GENERATED_DIR}/wayland-extra-protocols.cpp"
+ COMMAND "${WAYLANDPP_SCANNER}" ${PROTOCOL_XMLS} "${WAYLAND_EXTRA_PROTOCOL_GENERATED_DIR}/wayland-extra-protocols.hpp" "${WAYLAND_EXTRA_PROTOCOL_GENERATED_DIR}/wayland-extra-protocols.cpp"
+ DEPENDS "${WAYLANDPP_SCANNER}" ${PROTOCOL_XMLS}
+ COMMENT "Generating wayland-protocols C++ wrappers")
+
+ # Dummy target for dependencies
+ add_custom_target(generate-wayland-extra-protocols DEPENDS wayland-extra-protocols.hpp)
+endif()
diff --git a/cmake/scripts/linux/Install.cmake b/cmake/scripts/linux/Install.cmake
new file mode 100644
index 0000000..331722c
--- /dev/null
+++ b/cmake/scripts/linux/Install.cmake
@@ -0,0 +1,329 @@
+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_BINARY ${APP_NAME_LC}${APP_BINARY_SUFFIX})
+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 XBMC_STANDALONE_SH_PULSE so we can insert PulseAudio block into kodi-standalone
+if(EXISTS ${CMAKE_SOURCE_DIR}/tools/Linux/kodi-standalone.sh.pulse)
+ if(ENABLE_PULSEAUDIO AND PULSEAUDIO_FOUND)
+ file(READ "${CMAKE_SOURCE_DIR}/tools/Linux/kodi-standalone.sh.pulse" pulse_content)
+ set(XBMC_STANDALONE_SH_PULSE ${pulse_content})
+ endif()
+endif()
+
+# Configure startup scripts
+configure_file(${CMAKE_SOURCE_DIR}/tools/Linux/kodi.sh.in
+ ${CORE_BUILD_DIR}/scripts/${APP_NAME_LC} @ONLY)
+configure_file(${CMAKE_SOURCE_DIR}/tools/Linux/kodi-standalone.sh.in
+ ${CORE_BUILD_DIR}/scripts/${APP_NAME_LC}-standalone @ONLY)
+
+# Configure cmake files
+configure_file(${CMAKE_SOURCE_DIR}/cmake/KodiConfig.cmake.in
+ ${CORE_BUILD_DIR}/scripts/${APP_NAME}Config.cmake @ONLY)
+
+# Configure xsession entry
+configure_file(${CMAKE_SOURCE_DIR}/tools/Linux/kodi-xsession.desktop.in
+ ${CORE_BUILD_DIR}/${APP_NAME_LC}-xsession.desktop @ONLY)
+
+# Configure desktop entry
+configure_file(${CMAKE_SOURCE_DIR}/tools/Linux/kodi.desktop.in
+ ${CORE_BUILD_DIR}/${APP_NAME_LC}.desktop @ONLY)
+
+# Configure metainfo
+configure_file(${CMAKE_SOURCE_DIR}/tools/Linux/kodi.metainfo.xml.in
+ ${CORE_BUILD_DIR}/${APP_PACKAGE}.metainfo.xml @ONLY)
+
+# Install app
+install(TARGETS ${APP_NAME_LC}
+ DESTINATION ${libdir}/${APP_NAME_LC}
+ COMPONENT kodi-bin)
+if(X_FOUND 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}-xsession.desktop
+ RENAME ${APP_NAME_LC}.desktop
+ DESTINATION ${datarootdir}/xsessions
+ COMPONENT kodi)
+
+# Install desktop entry
+install(FILES ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${APP_NAME_LC}.desktop
+ DESTINATION ${datarootdir}/applications
+ COMPONENT kodi)
+
+# Install metainfo
+install(FILES ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${APP_PACKAGE}.metainfo.xml
+ DESTINATION ${datarootdir}/metainfo
+ COMPONENT kodi)
+
+# Install icons
+install(FILES ${CMAKE_SOURCE_DIR}/tools/Linux/packaging/media/icon16x16.png
+ RENAME ${APP_NAME_LC}.png
+ DESTINATION ${datarootdir}/icons/hicolor/16x16/apps
+ COMPONENT kodi)
+install(FILES ${CMAKE_SOURCE_DIR}/tools/Linux/packaging/media/icon22x22.png
+ RENAME ${APP_NAME_LC}.png
+ DESTINATION ${datarootdir}/icons/hicolor/22x22/apps
+ COMPONENT kodi)
+install(FILES ${CMAKE_SOURCE_DIR}/tools/Linux/packaging/media/icon24x24.png
+ RENAME ${APP_NAME_LC}.png
+ DESTINATION ${datarootdir}/icons/hicolor/24x24/apps
+ COMPONENT kodi)
+install(FILES ${CMAKE_SOURCE_DIR}/tools/Linux/packaging/media/icon32x32.png
+ RENAME ${APP_NAME_LC}.png
+ DESTINATION ${datarootdir}/icons/hicolor/32x32/apps
+ COMPONENT kodi)
+install(FILES ${CMAKE_SOURCE_DIR}/tools/Linux/packaging/media/icon48x48.png
+ RENAME ${APP_NAME_LC}.png
+ DESTINATION ${datarootdir}/icons/hicolor/48x48/apps
+ COMPONENT kodi)
+install(FILES ${CMAKE_SOURCE_DIR}/tools/Linux/packaging/media/icon64x64.png
+ RENAME ${APP_NAME_LC}.png
+ DESTINATION ${datarootdir}/icons/hicolor/64x64/apps
+ COMPONENT kodi)
+install(FILES ${CMAKE_SOURCE_DIR}/tools/Linux/packaging/media/icon128x128.png
+ RENAME ${APP_NAME_LC}.png
+ DESTINATION ${datarootdir}/icons/hicolor/128x128/apps
+ COMPONENT kodi)
+install(FILES ${CMAKE_SOURCE_DIR}/tools/Linux/packaging/media/icon256x256.png
+ RENAME ${APP_NAME_LC}.png
+ DESTINATION ${datarootdir}/icons/hicolor/256x256/apps
+ COMPONENT kodi)
+
+# Install firewalld service definitions
+install(FILES ${CMAKE_SOURCE_DIR}/tools/Linux/firewalld-services/kodi-eventserver.xml
+ ${CMAKE_SOURCE_DIR}/tools/Linux/firewalld-services/kodi-http.xml
+ ${CMAKE_SOURCE_DIR}/tools/Linux/firewalld-services/kodi-jsonrpc.xml
+ DESTINATION ${prefix}/lib/firewalld/services
+ COMPONENT kodi)
+
+# Install docs
+install(FILES ${CMAKE_SOURCE_DIR}/LICENSE.md
+ ${CMAKE_SOURCE_DIR}/version.txt
+ ${CMAKE_SOURCE_DIR}/docs/README.Linux.md
+ DESTINATION ${docdir}
+ COMPONENT kodi)
+
+install(FILES ${CMAKE_SOURCE_DIR}/privacy-policy.txt
+ DESTINATION ${datarootdir}/${APP_NAME_LC}
+ COMPONENT kodi)
+
+# Install kodi-tools-texturepacker
+if(INTERNAL_TEXTUREPACKER_INSTALLABLE)
+ install(PROGRAMS $<TARGET_FILE:TexturePacker::TexturePacker::Installable>
+ DESTINATION ${bindir}
+ RENAME "${APP_NAME_LC}-TexturePacker"
+ COMPONENT kodi-tools-texturepacker)
+endif()
+
+# Install kodi-addon-dev headers
+include(${CMAKE_SOURCE_DIR}/xbmc/addons/AddonBindings.cmake)
+install(DIRECTORY ${CORE_ADDON_BINDINGS_DIRS}/
+ DESTINATION ${includedir}/${APP_NAME_LC}
+ COMPONENT kodi-addon-dev
+ REGEX ".txt" EXCLUDE)
+
+install(FILES ${CORE_ADDON_BINDINGS_FILES}
+ DESTINATION ${includedir}/${APP_NAME_LC}
+ COMPONENT kodi-addon-dev)
+
+# Install kodi-addon-dev add-on bindings
+install(FILES ${CMAKE_SOURCE_DIR}/cmake/scripts/common/AddonHelpers.cmake
+ ${CMAKE_SOURCE_DIR}/cmake/scripts/common/AddOptions.cmake
+ ${CMAKE_SOURCE_DIR}/cmake/scripts/common/ArchSetup.cmake
+ ${CMAKE_SOURCE_DIR}/cmake/scripts/common/CheckCommits.cmake
+ ${CMAKE_SOURCE_DIR}/cmake/scripts/common/CheckTargetPlatform.cmake
+ ${CMAKE_SOURCE_DIR}/cmake/scripts/common/GenerateVersionedFiles.cmake
+ ${CMAKE_SOURCE_DIR}/cmake/scripts/common/GeneratorSetup.cmake
+ ${CMAKE_SOURCE_DIR}/cmake/scripts/common/HandleDepends.cmake
+ ${CMAKE_SOURCE_DIR}/cmake/scripts/common/Macros.cmake
+ ${CMAKE_SOURCE_DIR}/cmake/scripts/common/PrepareEnv.cmake
+ ${CMAKE_SOURCE_DIR}/cmake/scripts/common/ProjectMacros.cmake
+ ${CMAKE_SOURCE_DIR}/cmake/scripts/linux/PathSetup.cmake
+ DESTINATION ${datarootdir}/${APP_NAME_LC}/cmake
+ COMPONENT kodi-addon-dev)
+# ${APP_NAME}Config.cmake contains architecture-specific paths so it
+# should be installed in ${libdir}/${APP_NAME_LC}/${dir}
+install(FILES ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/scripts/${APP_NAME}Config.cmake
+ DESTINATION ${libdir}/${APP_NAME_LC}/cmake
+ COMPONENT kodi-addon-dev)
+
+if(ENABLE_EVENTCLIENTS)
+ execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(prefix=''))"
+ OUTPUT_VARIABLE PYTHON_LIB_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
+ # Install kodi-eventclients-common BT python files
+ install(PROGRAMS ${CMAKE_SOURCE_DIR}/tools/EventClients/lib/python/bt/__init__.py
+ ${CMAKE_SOURCE_DIR}/tools/EventClients/lib/python/bt/bt.py
+ ${CMAKE_SOURCE_DIR}/tools/EventClients/lib/python/bt/hid.py
+ DESTINATION ${PYTHON_LIB_PATH}/${APP_NAME_LC}/bt
+ COMPONENT kodi-eventclients-common)
+
+ # Install kodi-eventclients-common PS3 python files
+ install(PROGRAMS ${CMAKE_SOURCE_DIR}/tools/EventClients/lib/python/ps3/__init__.py
+ ${CMAKE_SOURCE_DIR}/tools/EventClients/lib/python/ps3/keymaps.py
+ ${CMAKE_SOURCE_DIR}/tools/EventClients/lib/python/ps3/sixaxis.py
+ ${CMAKE_SOURCE_DIR}/tools/EventClients/lib/python/ps3/sixpair.py
+ ${CMAKE_SOURCE_DIR}/tools/EventClients/lib/python/ps3/sixwatch.py
+ DESTINATION ${PYTHON_LIB_PATH}/${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
+ ${CMAKE_SOURCE_DIR}/tools/EventClients/lib/python/__init__.py
+ ${CMAKE_SOURCE_DIR}/tools/EventClients/Clients/PS3BDRemote/ps3_remote.py
+ ${CMAKE_SOURCE_DIR}/tools/EventClients/lib/python/xbmcclient.py
+ ${CMAKE_SOURCE_DIR}/tools/EventClients/lib/python/zeroconf.py
+ DESTINATION ${PYTHON_LIB_PATH}/${APP_NAME_LC}
+ COMPONENT kodi-eventclients-common)
+
+ # Install kodi-eventclients-common icons
+ install(FILES ${CMAKE_SOURCE_DIR}/tools/EventClients/icons/bluetooth.png
+ ${CMAKE_SOURCE_DIR}/tools/EventClients/icons/phone.png
+ ${CMAKE_SOURCE_DIR}/tools/EventClients/icons/mail.png
+ ${CMAKE_SOURCE_DIR}/tools/EventClients/icons/mouse.png
+ DESTINATION ${datarootdir}/pixmaps/${APP_NAME_LC}
+ COMPONENT kodi-eventclients-common)
+
+ # Install kodi-eventclients-dev headers
+ install(FILES ${CMAKE_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 "${CMAKE_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 ${CMAKE_SOURCE_DIR}/tools/EventClients/examples/c++/example_notification.cpp
+ ${CMAKE_SOURCE_DIR}/tools/EventClients/examples/c++/example_log.cpp
+ ${CMAKE_SOURCE_DIR}/tools/EventClients/examples/c++/example_button1.cpp
+ ${CMAKE_SOURCE_DIR}/tools/EventClients/examples/c++/example_mouse.cpp
+ ${CMAKE_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 ${CMAKE_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 ${CMAKE_SOURCE_DIR}/tools/EventClients/examples/python/example_mouse.py
+ ${CMAKE_SOURCE_DIR}/tools/EventClients/examples/python/example_button1.py
+ ${CMAKE_SOURCE_DIR}/tools/EventClients/examples/python/example_notification.py
+ ${CMAKE_SOURCE_DIR}/tools/EventClients/examples/python/example_action.py
+ ${CMAKE_SOURCE_DIR}/tools/EventClients/examples/python/example_button2.py
+ ${CMAKE_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 ${CMAKE_SOURCE_DIR}/tools/EventClients/Clients/PS3BDRemote/ps3_remote.py
+ RENAME ${APP_NAME_LC}-ps3remote
+ DESTINATION ${bindir}
+ COMPONENT kodi-eventclients-ps3)
+
+ if(BLUETOOTH_FOUND AND CWIID_FOUND AND GLU_FOUND)
+ # Install kodi-eventclients-wiiremote
+ install(PROGRAMS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/WiiRemote/${APP_NAME_LC}-wiiremote
+ DESTINATION ${bindir}
+ COMPONENT kodi-eventclients-wiiremote)
+ endif()
+
+ # Install kodi-eventclients-kodi-send
+ install(PROGRAMS ${CMAKE_SOURCE_DIR}/tools/EventClients/Clients/KodiSend/kodi-send.py
+ RENAME ${APP_NAME_LC}-send
+ DESTINATION ${bindir}
+ COMPONENT kodi-eventclients-kodi-send)
+endif()
+
+# 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(${CMAKE_SOURCE_DIR}/cmake/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/Linkers.txt b/cmake/scripts/linux/Linkers.txt
new file mode 100644
index 0000000..c947ec4
--- /dev/null
+++ b/cmake/scripts/linux/Linkers.txt
@@ -0,0 +1,4 @@
+# Linkers
+option(ENABLE_GOLD "Enable gnu gold linker?" ON)
+option(ENABLE_LLD "Enable llvm lld linker?" OFF)
+option(ENABLE_MOLD "Enable mold linker?" OFF)
diff --git a/cmake/scripts/linux/Macros.cmake b/cmake/scripts/linux/Macros.cmake
new file mode 100644
index 0000000..37243a7
--- /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 ${CMAKE_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 0000000..f9f78ba
--- /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}/${APP_NAME_LC}\"
+ -DINSTALL_PATH=\"${datarootdir}/${APP_NAME_LC}\")
diff --git a/cmake/scripts/osx/ArchSetup.cmake b/cmake/scripts/osx/ArchSetup.cmake
new file mode 100644
index 0000000..17f8583
--- /dev/null
+++ b/cmake/scripts/osx/ArchSetup.cmake
@@ -0,0 +1,56 @@
+if(NOT CMAKE_TOOLCHAIN_FILE)
+ message(FATAL_ERROR "CMAKE_TOOLCHAIN_FILE required for osx. See ${CMAKE_SOURCE_DIR}/cmake/README.md")
+endif()
+
+list(APPEND CORE_MAIN_SOURCE ${CMAKE_SOURCE_DIR}/xbmc/platform/darwin/osx/XBMCApplication.h)
+
+set(ARCH_DEFINES -DTARGET_POSIX -DTARGET_DARWIN -DTARGET_DARWIN_OSX)
+list(APPEND SYSTEM_DEFINES -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
+ -D__STDC_CONSTANT_MACROS)
+set(PLATFORM_DIR platform/darwin)
+set(PLATFORMDEFS_DIR platform/posix)
+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)
+ elseif(CPU STREQUAL arm64)
+ set(ARCH aarch64)
+ else()
+ message(SEND_ERROR "Unknown CPU: ${CPU}")
+ endif()
+endif()
+
+# m1 macs can execute x86_64 code via rosetta
+if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "arm64" AND
+ CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
+ set(HOST_CAN_EXECUTE_TARGET TRUE)
+endif()
+
+set(CMAKE_OSX_ARCHITECTURES ${CPU})
+
+# Additional SYSTEM_DEFINES
+list(APPEND SYSTEM_DEFINES -DHAS_POSIX_NETWORK -DHAS_OSX_NETWORK -DHAS_ZEROCONF)
+
+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" "-framework Security"
+ "-framework GameController" "-framework Speech"
+ "-framework AVFoundation")
+
+if(ARCH STREQUAL aarch64)
+ set(CMAKE_OSX_DEPLOYMENT_TARGET 11.0)
+else()
+ set(CMAKE_OSX_DEPLOYMENT_TARGET 10.13)
+endif()
+set(CMAKE_XCODE_ATTRIBUTE_CLANG_LINK_OBJC_RUNTIME OFF)
+
+include(cmake/scripts/darwin/Macros.cmake)
+enable_arc()
diff --git a/cmake/scripts/osx/ExtraTargets.cmake b/cmake/scripts/osx/ExtraTargets.cmake
new file mode 100644
index 0000000..28c1e74
--- /dev/null
+++ b/cmake/scripts/osx/ExtraTargets.cmake
@@ -0,0 +1,3 @@
+# XBMCHelper
+add_subdirectory(${CMAKE_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 0000000..b4c4cc8
--- /dev/null
+++ b/cmake/scripts/osx/Install.cmake
@@ -0,0 +1,73 @@
+# OSX packaging
+
+set(PACKAGE_OUTPUT_DIR ${CMAKE_BINARY_DIR}/build/${CORE_BUILD_CONFIG})
+
+configure_file(${CMAKE_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)
+
+# Create xcode target that allows to build binary-addons.
+if(CMAKE_GENERATOR MATCHES "Xcode")
+ if(ADDONS_TO_BUILD)
+ set(_addons "ADDONS=${ADDONS_TO_BUILD}")
+ endif()
+ add_custom_target(binary-addons
+ COMMAND $(MAKE) -C ${CMAKE_SOURCE_DIR}/tools/depends/target/binary-addons clean
+ COMMAND $(MAKE) -C ${CMAKE_SOURCE_DIR}/tools/depends/target/binary-addons VERBOSE=1 V=99
+ INSTALL_PREFIX="${CMAKE_BINARY_DIR}/addons" CROSS_COMPILING=yes ${_addons})
+ if(ENABLE_XCODE_ADDONBUILD)
+ add_dependencies(${APP_NAME_LC} binary-addons)
+ endif()
+ unset(_addons)
+endif()
+
+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}"
+ ${CMAKE_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}"
+ "PYTHON_VERSION=${PYTHON_VERSION}"
+ ${CMAKE_SOURCE_DIR}/tools/darwin/Support/copyframeworks-osx.command)
+set_target_properties(bundle PROPERTIES FOLDER "Build Utilities")
+add_dependencies(bundle ${APP_NAME_LC})
+
+configure_file(${CMAKE_SOURCE_DIR}/tools/darwin/packaging/osx/mkdmg-osx.sh.in
+ ${CMAKE_BINARY_DIR}/tools/darwin/packaging/osx/mkdmg-osx.sh @ONLY)
+
+string(TOLOWER ${CORE_BUILD_CONFIG} CORE_BUILD_CONFIG_LOWERCASED)
+if(${CORE_BUILD_CONFIG_LOWERCASED} STREQUAL "release")
+ set(ALLOW_DEBUGGER "false")
+else()
+ set(ALLOW_DEBUGGER "true")
+endif()
+configure_file(${CMAKE_SOURCE_DIR}/tools/darwin/packaging/osx/Kodi.entitlements.in
+ ${CMAKE_BINARY_DIR}/tools/darwin/packaging/osx/Kodi.entitlements @ONLY)
+
+add_custom_target(dmg
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/tools/darwin/packaging/osx/
+ ${CMAKE_BINARY_DIR}/tools/darwin/packaging/osx/
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/tools/darwin/packaging/media/osx/
+ ${CMAKE_BINARY_DIR}/tools/darwin/packaging/media/osx/
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/tools/darwin/Support/Codesign.command
+ ${CMAKE_BINARY_DIR}/tools/darwin/packaging/osx/Codesign.command
+ COMMAND "CODESIGNING_FOLDER_PATH=${PACKAGE_OUTPUT_DIR}/${APP_NAME}.app"
+ "NOTARYTOOL_KEYCHAIN_PROFILE=${NOTARYTOOL_KEYCHAIN_PROFILE}"
+ "NOTARYTOOL_KEYCHAIN_PATH=${NOTARYTOOL_KEYCHAIN_PATH}"
+ "EXPANDED_CODE_SIGN_IDENTITY_NAME=${CODE_SIGN_IDENTITY}"
+ "PLATFORM_NAME=${PLATFORM}"
+ "XCODE_BUILDTYPE=${CMAKE_CFG_INTDIR}"
+ ./mkdmg-osx.sh ${CORE_BUILD_CONFIG_LOWERCASED}
+ 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 0000000..f81e218
--- /dev/null
+++ b/cmake/scripts/osx/Macros.cmake
@@ -0,0 +1,119 @@
+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")
+ # CURRENT_VARIANT is an Xcode env var
+ # CPU is a project cmake var
+ # Xcode new build system (CMAKE_XCODE_BUILD_SYSTEM=12) requires the env var CURRENT_VARIANT to be passed WITHOUT brackets
+ # Xcode Legacy build system (CMAKE_XCODE_BUILD_SYSTEM=1) requires the env var CURRENT_VARIANT to be passed WITH brackets
+ if(CMAKE_XCODE_BUILD_SYSTEM STREQUAL 12)
+ set(wrapper_obj cores/dll-loader/exports/kodi.build/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/wrapper.build/Objects-$CURRENT_VARIANT/${CPU}/wrapper.o)
+ else()
+ set(wrapper_obj cores/dll-loader/exports/kodi.build/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/wrapper.build/Objects-$(CURRENT_VARIANT)/${CPU}/wrapper.o)
+ endif()
+ 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})
+
+ 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)
+
+ 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 0000000..ddb4176
--- /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}/${APP_NAME_LC}\"
+ -DINSTALL_PATH=\"${datarootdir}/${APP_NAME_LC}\")
diff --git a/cmake/scripts/windows/ArchSetup.cmake b/cmake/scripts/windows/ArchSetup.cmake
new file mode 100644
index 0000000..f0f8a08
--- /dev/null
+++ b/cmake/scripts/windows/ArchSetup.cmake
@@ -0,0 +1,128 @@
+# Minimum SDK version we support
+set(VS_MINIMUM_SDK_VERSION 10.0.14393.0)
+
+if(CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION VERSION_LESS VS_MINIMUM_SDK_VERSION)
+ message(FATAL_ERROR "Detected Windows SDK version is ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}.\n"
+ "Windows SDK ${VS_MINIMUM_SDK_VERSION} or higher is required.\n"
+ "INFO: Windows SDKs can be installed from the Visual Studio installer.")
+endif()
+
+# -------- Host Settings ---------
+
+set(_gentoolset ${CMAKE_GENERATOR_TOOLSET})
+string(REPLACE "host=" "" HOSTTOOLSET "${_gentoolset}")
+unset(_gentoolset)
+
+# -------- Architecture settings ---------
+
+if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ set(ARCH win32)
+ set(SDK_TARGET_ARCH x86)
+elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(ARCH x64)
+ set(SDK_TARGET_ARCH x64)
+endif()
+
+
+# -------- Paths (mainly for find_package) ---------
+
+set(PLATFORM_DIR platform/win32)
+set(APP_RENDER_SYSTEM dx11)
+
+set(CORE_MAIN_SOURCE ${CMAKE_SOURCE_DIR}/xbmc/platform/win32/WinMain.cpp)
+
+# 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)
+set(DEPS_FOLDER_RELATIVE project/BuildDependencies)
+set(NATIVEPREFIX ${CMAKE_SOURCE_DIR}/${DEPS_FOLDER_RELATIVE}/tools)
+set(DEPENDS_PATH ${CMAKE_SOURCE_DIR}/${DEPS_FOLDER_RELATIVE}/${ARCH})
+set(MINGW_LIBS_DIR ${CMAKE_SOURCE_DIR}/${DEPS_FOLDER_RELATIVE}/mingwlibs/${ARCH})
+
+# mingw libs
+list(APPEND CMAKE_PREFIX_PATH ${MINGW_LIBS_DIR})
+list(APPEND CMAKE_LIBRARY_PATH ${MINGW_LIBS_DIR}/bin)
+
+if(NOT TARBALL_DIR)
+ set(TARBALL_DIR "${CMAKE_SOURCE_DIR}/project/BuildDependencies/downloads")
+endif()
+
+# -------- Compiler options ---------
+
+add_options(CXX ALL_BUILDS "/wd\"4996\"")
+set(ARCH_DEFINES -D_WINDOWS -DTARGET_WINDOWS -DTARGET_WINDOWS_DESKTOP -D__SSE__ -D__SSE2__)
+set(SYSTEM_DEFINES -DWIN32_LEAN_AND_MEAN -DNOMINMAX -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"
+ -DUNICODE -D_UNICODE
+ -DFRIBIDI_STATIC
+ $<$<CONFIG:Debug>:-DD3D_DEBUG_INFO>)
+
+# Additional SYSTEM_DEFINES
+list(APPEND SYSTEM_DEFINES -DHAS_WIN32_NETWORK -DHAS_FILESYSTEM_SMB)
+
+# The /MP option enables /FS by default.
+if(CMAKE_GENERATOR MATCHES "Visual Studio")
+ if(DEFINED ENV{MAXTHREADS})
+ set(MP_FLAG "/MP$ENV{MAXTHREADS}")
+ else()
+ set(MP_FLAG "/MP")
+ endif()
+
+ set(CMAKE_CXX_FLAGS "/permissive- ${MP_FLAG} ${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(${DEPENDS_PATH}/lib)
+
+# Additional libraries
+list(APPEND DEPLIBS bcrypt.lib d3d11.lib DInput8.lib DSound.lib winmm.lib Mpr.lib Iphlpapi.lib WS2_32.lib
+ PowrProf.lib setupapi.lib Shlwapi.lib dwmapi.lib dxguid.lib DelayImp.lib version.lib
+ crypt32.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 libmariadb.dll libxslt.dll dnssd.dll dwmapi.dll sqlite3.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"
+ "set PreferredToolArchitecture=x64\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 0000000..cd96689
--- /dev/null
+++ b/cmake/scripts/windows/CFlagOverrides.cmake
@@ -0,0 +1,10 @@
+if(MSVC)
+ if(DEFINED ENV{MAXTHREADS})
+ set(MP_FLAG "/MP$ENV{MAXTHREADS}")
+ else()
+ set(MP_FLAG "/MP")
+ endif()
+ set(CMAKE_C_FLAGS "/D_UNICODE /DUNICODE /DRPC_USE_NATIVE_WCHAR ${MP_FLAG} /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 0000000..72df9de
--- /dev/null
+++ b/cmake/scripts/windows/CXXFlagOverrides.cmake
@@ -0,0 +1,10 @@
+if(MSVC)
+ if(DEFINED ENV{MAXTHREADS})
+ set(MP_FLAG "/MP$ENV{MAXTHREADS}")
+ else()
+ set(MP_FLAG "/MP")
+ endif()
+ set(CMAKE_CXX_FLAGS "/D_UNICODE /DUNICODE /DRPC_USE_NATIVE_WCHAR ${MP_FLAG} /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 0000000..e69de29
--- /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 0000000..2d3500d
--- /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 0000000..f6defde
--- /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}/${APP_NAME_LC}\"
+ -DINSTALL_PATH=\"${datarootdir}/${APP_NAME_LC}\")
diff --git a/cmake/scripts/windows/tools/patch.cmake b/cmake/scripts/windows/tools/patch.cmake
new file mode 100644
index 0000000..451fc66
--- /dev/null
+++ b/cmake/scripts/windows/tools/patch.cmake
@@ -0,0 +1,50 @@
+# prioritize Git patch.exe
+find_package(Git)
+if(Git_FOUND)
+ get_filename_component(GIT_DIR ${GIT_EXECUTABLE} DIRECTORY)
+ get_filename_component(GIT_DIR ${GIT_DIR} DIRECTORY)
+endif()
+
+find_program(PATCH_FOUND NAMES patch.exe HINTS ${GIT_DIR} PATH_SUFFIXES usr/bin)
+
+if(PATCH_FOUND)
+ message(STATUS "patch utility found at ${PATCH_FOUND}")
+else()
+ set(PATCH_ARCHIVE_NAME "patch-2.7.6-bin")
+ 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)
+ # copy patch depends
+ file(GLOB PATCH_BINARIES ${PATCH_PATH}/bin/*.dll)
+ if(NOT "${PATCH_BINARIES}" STREQUAL "")
+ file(INSTALL ${PATCH_BINARIES} DESTINATION ${ADDON_DEPENDS_PATH}/bin)
+ endif()
+
+ # 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/scripts/windowsstore/ArchSetup.cmake b/cmake/scripts/windowsstore/ArchSetup.cmake
new file mode 100644
index 0000000..f71ca7a
--- /dev/null
+++ b/cmake/scripts/windowsstore/ArchSetup.cmake
@@ -0,0 +1,127 @@
+# Minimum SDK version we support
+set(VS_MINIMUM_SDK_VERSION 10.0.17763.0)
+
+if(CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION VERSION_LESS VS_MINIMUM_SDK_VERSION)
+ message(FATAL_ERROR "Detected Windows SDK version is ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}.\n"
+ "Windows SDK ${VS_MINIMUM_SDK_VERSION} or higher is required.\n"
+ "INFO: Windows SDKs can be installed from the Visual Studio installer.")
+endif()
+
+# -------- Host Settings ---------
+
+set(_gentoolset ${CMAKE_GENERATOR_TOOLSET})
+string(REPLACE "host=" "" HOSTTOOLSET ${_gentoolset})
+unset(_gentoolset)
+
+# -------- Architecture settings ---------
+
+check_symbol_exists(_X86_ "Windows.h" _X86_)
+check_symbol_exists(_AMD64_ "Windows.h" _AMD64_)
+check_symbol_exists(_ARM_ "Windows.h" _ARM_)
+
+if(_X86_)
+ set(ARCH win32)
+ set(SDK_TARGET_ARCH x86)
+elseif(_AMD64_)
+ set(ARCH x64)
+ set(SDK_TARGET_ARCH x64)
+elseif(_ARM_)
+ set(ARCH arm)
+ set(SDK_TARGET_ARCH arm)
+else()
+ message(FATAL_ERROR "Unsupported architecture")
+endif()
+
+unset(_X86_)
+unset(_AMD64_)
+unset(_ARM_)
+
+# -------- Paths (mainly for find_package) ---------
+
+set(PLATFORM_DIR platform/win32)
+set(APP_RENDER_SYSTEM dx11)
+set(CORE_MAIN_SOURCE ${CMAKE_SOURCE_DIR}/xbmc/platform/win10/main.cpp)
+
+# 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 WindowsStore)
+set(CORE_SYSTEM_NAME "windowsstore")
+set(PACKAGE_GUID "281d668b-5739-4abd-b3c2-ed1cda572ed2")
+set(APP_MANIFEST_NAME package.appxmanifest)
+set(DEPS_FOLDER_RELATIVE project/BuildDependencies)
+
+set(NATIVEPREFIX ${CMAKE_SOURCE_DIR}/${DEPS_FOLDER_RELATIVE}/tools)
+set(DEPENDS_PATH ${CMAKE_SOURCE_DIR}/${DEPS_FOLDER_RELATIVE}/win10-${ARCH})
+set(MINGW_LIBS_DIR ${CMAKE_SOURCE_DIR}/${DEPS_FOLDER_RELATIVE}/mingwlibs/win10-${ARCH})
+
+# mingw libs
+list(APPEND CMAKE_PREFIX_PATH ${MINGW_LIBS_DIR})
+list(APPEND CMAKE_LIBRARY_PATH ${MINGW_LIBS_DIR}/bin)
+
+if(NOT TARBALL_DIR)
+ set(TARBALL_DIR "${CMAKE_SOURCE_DIR}/project/BuildDependencies/downloads")
+endif()
+
+# -------- Compiler options ---------
+
+add_options(CXX ALL_BUILDS "/wd\"4996\"")
+add_options(CXX ALL_BUILDS "/wd\"4146\"")
+add_options(CXX ALL_BUILDS "/wd\"4251\"")
+add_options(CXX ALL_BUILDS "/wd\"4668\"")
+add_options(CXX ALL_BUILDS "/wd\"5033\"")
+set(ARCH_DEFINES -D_WINDOWS -DTARGET_WINDOWS -DTARGET_WINDOWS_STORE -DXBMC_EXPORT -DMS_UWP -DMS_STORE)
+if(NOT SDK_TARGET_ARCH STREQUAL arm)
+ list(APPEND ARCH_DEFINES -D__SSE__ -D__SSE2__)
+endif()
+set(SYSTEM_DEFINES -DWIN32_LEAN_AND_MEAN -DNOMINMAX -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"
+ -DUNICODE -D_UNICODE
+ -DFRIBIDI_STATIC
+ $<$<CONFIG:Debug>:-DD3D_DEBUG_INFO>)
+
+# Additional SYSTEM_DEFINES
+list(APPEND SYSTEM_DEFINES -DHAS_WIN10_NETWORK)
+
+# The /MP option enables /FS by default.
+if(DEFINED ENV{MAXTHREADS})
+ set(MP_FLAG "/MP$ENV{MAXTHREADS}")
+else()
+ set(MP_FLAG "/MP")
+endif()
+set(CMAKE_CXX_FLAGS "${MP_FLAG} ${CMAKE_CXX_FLAGS} /EHsc /await /permissive-")
+# Google Test needs to use shared version of runtime libraries
+set(gtest_force_shared_crt ON CACHE STRING "" FORCE)
+
+
+# -------- Linker options ---------
+
+# For #pragma comment(lib X)
+# TODO: It would certainly be better to handle these libraries via CMake modules.
+link_directories(${MINGW_LIBS_DIR}/lib
+ ${DEPENDS_PATH}/lib)
+
+list(APPEND DEPLIBS bcrypt.lib d3d11.lib WS2_32.lib dxguid.lib dloadhelper.lib WindowsApp.lib)
+
+set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /WINMD:NO")
+set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:msvcrt /DEBUG:FASTLINK /OPT:NOREF /OPT:NOICF")
+
+# 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")
+# remove warning
+set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4264")
+
+
+# -------- Visual Studio options ---------
+
+if(CMAKE_GENERATOR MATCHES "Visual Studio")
+ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+endif()
+
+# -------- Build options ---------
+
+set(ENABLE_OPTICAL OFF CACHE BOOL "" FORCE)
diff --git a/cmake/scripts/windowsstore/CFlagOverrides.cmake b/cmake/scripts/windowsstore/CFlagOverrides.cmake
new file mode 100644
index 0000000..ab2f59c
--- /dev/null
+++ b/cmake/scripts/windowsstore/CFlagOverrides.cmake
@@ -0,0 +1,17 @@
+# compiler flags
+if(DEFINED ENV{MAXTHREADS})
+ set(MP_FLAG "/MP$ENV{MAXTHREADS}")
+else()
+ set(MP_FLAG "/MP")
+endif()
+string(APPEND CMAKE_C_FLAGS_INIT " /D_UNICODE /DUNICODE ${MP_FLAG} /DWIN32 /D_WINDOWS /W3 /Zi /DTARGET_WINDOWS")
+string(APPEND CMAKE_C_FLAGS_INIT " /DWINAPI_FAMILY=2 /DTARGET_WINDOWS_STORE /D_WINSOCK_DEPRECATED_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE")
+string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " /D_DEBUG /MDd /Ob0 /Od /RTC1 /D_ITERATOR_DEBUG_LEVEL=0")
+string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " /MD /Ox /Ob2 /Oi /Ot /Oy /GL /DNDEBUG")
+# linker flags
+string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " /DYNAMICBASE /NXCOMPAT /APPCONTAINER")
+# win32 specific flags
+if("$ENV{Platform}" STREQUAL X86)
+ string(APPEND CMAKE_C_FLAGS_INIT " /arch:SSE2")
+ string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " /SAFESEH")
+endif()
diff --git a/cmake/scripts/windowsstore/CXXFlagOverrides.cmake b/cmake/scripts/windowsstore/CXXFlagOverrides.cmake
new file mode 100644
index 0000000..4ae3ac3
--- /dev/null
+++ b/cmake/scripts/windowsstore/CXXFlagOverrides.cmake
@@ -0,0 +1,17 @@
+# compiler flags
+if(DEFINED ENV{MAXTHREADS})
+ set(MP_FLAG "/MP$ENV{MAXTHREADS}")
+else()
+ set(MP_FLAG "/MP")
+endif()
+string(APPEND CMAKE_CXX_FLAGS_INIT " /D_UNICODE /DUNICODE ${MP_FLAG} /DWIN32 /D_WINDOWS /W3 /GR /Zi /EHsc /DTARGET_WINDOWS")
+string(APPEND CMAKE_CXX_FLAGS_INIT " /DWINAPI_FAMILY=2 /DTARGET_WINDOWS_STORE /D_WINSOCK_DEPRECATED_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE")
+string(APPEND CMAKE_CXX_FLAGS_DEBUG_INIT " /D_DEBUG /MDd /Ob0 /Od /RTC1 /D_ITERATOR_DEBUG_LEVEL=0")
+string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " /MD /Ox /Ob2 /Oi /Ot /Oy /GL /DNDEBUG")
+# linker flags
+string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " /DYNAMICBASE /NXCOMPAT /APPCONTAINER")
+# win32 specific flags
+if("$ENV{Platform}" STREQUAL X86)
+ string(APPEND CMAKE_CXX_FLAGS_INIT " /arch:SSE2")
+ string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " /SAFESEH")
+endif()
diff --git a/cmake/scripts/windowsstore/Install.cmake b/cmake/scripts/windowsstore/Install.cmake
new file mode 100644
index 0000000..a0522d3
--- /dev/null
+++ b/cmake/scripts/windowsstore/Install.cmake
@@ -0,0 +1,10 @@
+# Fix UWP addons security issue caused by empty __init__.py Python Lib files packaged with Kodi
+set(uwp_pythonlibinit_filepattern "${DEPENDS_PATH}/bin/Python/Lib/__init__.py")
+file(GLOB_RECURSE uwp_pythonlibinit_foundfiles "${uwp_pythonlibinit_filepattern}")
+foreach(uwp_pythonlibinit_file ${uwp_pythonlibinit_foundfiles})
+ file(SIZE "${uwp_pythonlibinit_file}" uwp_pythonlibinit_filesize)
+ if(${uwp_pythonlibinit_filesize} EQUAL 0)
+ message("Adding hash comment character in the following empty file: ${uwp_pythonlibinit_file}")
+ file(APPEND ${uwp_pythonlibinit_file} "#")
+ endif()
+endforeach()
diff --git a/cmake/scripts/windowsstore/Macros.cmake b/cmake/scripts/windowsstore/Macros.cmake
new file mode 100644
index 0000000..713e878
--- /dev/null
+++ b/cmake/scripts/windowsstore/Macros.cmake
@@ -0,0 +1,182 @@
+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()
+
+macro(winstore_set_assets target)
+ file(GLOB ASSET_FILES "${CMAKE_SOURCE_DIR}/tools/windows/packaging/uwp/media/*.png")
+ set_property(SOURCE ${ASSET_FILES} PROPERTY VS_DEPLOYMENT_CONTENT 1)
+ set_property(SOURCE ${ASSET_FILES} PROPERTY VS_DEPLOYMENT_LOCATION "media")
+ source_group("media" FILES ${ASSET_FILES})
+ set(RESOURCES ${RESOURCES} ${ASSET_FILES}
+ "${CMAKE_SOURCE_DIR}/tools/windows/packaging/uwp/kodi_temp_key.pfx")
+
+ set(LICENSE_FILES
+ ${CMAKE_SOURCE_DIR}/LICENSE.md
+ ${CMAKE_SOURCE_DIR}/privacy-policy.txt)
+ if(EXISTS "${CMAKE_SOURCE_DIR}/known_issues.txt")
+ list(APPEND LICENSE_FILES ${CMAKE_SOURCE_DIR}/known_issues.txt)
+ endif()
+ set_property(SOURCE ${LICENSE_FILES} PROPERTY VS_DEPLOYMENT_CONTENT 1)
+ list(APPEND RESOURCES ${LICENSE_FILES})
+endmacro()
+
+macro(winstore_generate_manifest target)
+ configure_file(
+ ${CMAKE_SOURCE_DIR}/tools/windows/packaging/uwp/${APP_MANIFEST_NAME}.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${APP_MANIFEST_NAME}
+ @ONLY)
+ set(RESOURCES ${RESOURCES} ${CMAKE_CURRENT_BINARY_DIR}/${APP_MANIFEST_NAME})
+endmacro()
+
+macro(add_deployment_content_group path link match exclude)
+ set(_link "")
+ set(_exclude "")
+ file(TO_NATIVE_PATH ${path} _path)
+ file(TO_NATIVE_PATH ${match} _match)
+ if (NOT "${link}" STREQUAL "")
+ file(TO_NATIVE_PATH ${link} _link)
+ set(_link "${_link}\\")
+ endif()
+ if(NOT "${exclude}" STREQUAL "")
+ string(REPLACE "/" "\\" _exclude ${exclude})
+ endif()
+ string(CONCAT UWP_DEPLOYMENT_CONTENT_STR "${UWP_DEPLOYMENT_CONTENT_STR}"
+ " <EmbedResources Include=\"${_path}\\${_match}\" Exclude=\"${_exclude}\">\n"
+ " <Link>${_link}%(RecursiveDir)%(FileName)%(Extension)</Link>\n"
+ " <DeploymentContent>true</DeploymentContent>\n"
+ " </EmbedResources>\n")
+endmacro()
+
+macro(winstore_append_props target)
+ # exclude debug dlls from packaging
+ set(DEBUG_DLLS zlibd.dll)
+ foreach(_dll ${DEBUG_DLLS})
+ if (DEBUG_DLLS_EXCLUDE)
+ list(APPEND DEBUG_DLLS_EXCLUDE "\;$(BuildRootPath)/dlls/${_dll}")
+ else()
+ list(APPEND DEBUG_DLLS_EXCLUDE "$(BuildRootPath)/dlls/${_dll}")
+ endif()
+ string(CONCAT DEBUG_DLLS_LINKAGE_PROPS "${DEBUG_DLLS_LINKAGE_PROPS}"
+ " <ItemGroup Label=\"Binaries\">\n"
+ " <None Include=\"$(BinPath)\\${_dll}\" Condition=\"'$(Configuration)'=='Debug'\">\n"
+ " <DeploymentContent>true</DeploymentContent>\n"
+ " </None>\n"
+ " </ItemGroup>\n")
+ endforeach(_dll DEBUG_DLLS)
+
+ add_deployment_content_group($(BuildRootPath)/dlls "" *.dll "${DEBUG_DLLS_EXCLUDE}")
+ add_deployment_content_group($(BuildRootPath)/system system **/* "$(BuildRootPath)/**/shaders/**")
+ add_deployment_content_group($(BuildRootPath)/system/shaders system/shaders **/*.fx "")
+ add_deployment_content_group($(BuildRootPath)/media media **/* "")
+ add_deployment_content_group($(BuildRootPath)/userdata userdata **/* "")
+ add_deployment_content_group($(BuildRootPath)/addons addons **/* "")
+ add_deployment_content_group($(BinaryAddonsPath) addons **/* "")
+
+ foreach(xbt_file ${XBT_FILES})
+ file(RELATIVE_PATH relative ${CMAKE_CURRENT_BINARY_DIR} ${xbt_file})
+ file(TO_NATIVE_PATH ${relative} relative)
+ string(CONCAT XBT_FILE_PROPS "${XBT_FILE_PROPS}"
+ " <ItemGroup Label=\"SkinsMedia\">\n"
+ " <None Include=\"$(BuildRootPath)\\${relative}\">\n"
+ " <Link>${relative}</Link>\n"
+ " <DeploymentContent>true</DeploymentContent>\n"
+ " </None>\n"
+ " </ItemGroup>\n")
+ endforeach()
+
+ set(VCPROJECT_PROPS_FILE "${CMAKE_CURRENT_BINARY_DIR}/${target}.props")
+ file(TO_NATIVE_PATH ${DEPENDS_PATH} DEPENDENCIES_DIR_NATIVE)
+ file(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR} CMAKE_CURRENT_BINARY_DIR_NATIVE)
+ file(TO_NATIVE_PATH ${CMAKE_SOURCE_DIR}/project/Win32BuildSetup/BUILD_WIN32/addons BINARY_ADDONS_DIR_NATIVE)
+
+ file(WRITE ${VCPROJECT_PROPS_FILE}
+ "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
+ "<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n"
+ " <ImportGroup Label=\"PropertySheets\" />\n"
+ " <PropertyGroup Label=\"APP_DLLS\">\n"
+ " <BinPath>${DEPENDENCIES_DIR_NATIVE}\\bin</BinPath>\n"
+ " <BuildRootPath>${CMAKE_CURRENT_BINARY_DIR_NATIVE}</BuildRootPath>\n"
+ " <BinaryAddonsPath>${BINARY_ADDONS_DIR_NATIVE}</BinaryAddonsPath>\n"
+ " </PropertyGroup>\n"
+ "${DEBUG_DLLS_LINKAGE_PROPS}"
+ "${XBT_FILE_PROPS}"
+ " <ItemGroup>\n"
+ "${UWP_DEPLOYMENT_CONTENT_STR}"
+ " </ItemGroup>\n"
+ " <Target Name=\"_CollectCustomResources\" Inputs=\"@(EmbedResources)\" Outputs=\"@(EmbedResources->'$(OutputPath)\\PackageLayout\\%(Link)')\" BeforeTargets=\"AssignTargetPaths\">\n"
+ " <Message Text=\"Collecting package resources...\"/>\n"
+ " <ItemGroup>\n"
+ " <None Include=\"@(EmbedResources)\" />\n"
+ " </ItemGroup>\n"
+ " </Target>\n"
+ "</Project>")
+endmacro()
+
+macro(winstore_add_target_properties target)
+ winstore_set_assets(${target})
+ winstore_generate_manifest(${target})
+ winstore_append_props(${target})
+endmacro()
diff --git a/cmake/scripts/windowsstore/PathSetup.cmake b/cmake/scripts/windowsstore/PathSetup.cmake
new file mode 100644
index 0000000..8550616
--- /dev/null
+++ b/cmake/scripts/windowsstore/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/windowsstore/tools/patch.cmake b/cmake/scripts/windowsstore/tools/patch.cmake
new file mode 100644
index 0000000..451fc66
--- /dev/null
+++ b/cmake/scripts/windowsstore/tools/patch.cmake
@@ -0,0 +1,50 @@
+# prioritize Git patch.exe
+find_package(Git)
+if(Git_FOUND)
+ get_filename_component(GIT_DIR ${GIT_EXECUTABLE} DIRECTORY)
+ get_filename_component(GIT_DIR ${GIT_DIR} DIRECTORY)
+endif()
+
+find_program(PATCH_FOUND NAMES patch.exe HINTS ${GIT_DIR} PATH_SUFFIXES usr/bin)
+
+if(PATCH_FOUND)
+ message(STATUS "patch utility found at ${PATCH_FOUND}")
+else()
+ set(PATCH_ARCHIVE_NAME "patch-2.7.6-bin")
+ 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)
+ # copy patch depends
+ file(GLOB PATCH_BINARIES ${PATCH_PATH}/bin/*.dll)
+ if(NOT "${PATCH_BINARIES}" STREQUAL "")
+ file(INSTALL ${PATCH_BINARIES} DESTINATION ${ADDON_DEPENDS_PATH}/bin)
+ endif()
+
+ # 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 0000000..08e318a
--- /dev/null
+++ b/cmake/treedata/android/subdirs.txt
@@ -0,0 +1,24 @@
+xbmc/cores/RetroPlayer/process/android cores/RetroPlayer/process/android
+xbmc/cores/VideoPlayer/Process/android cores/VideoPlayer/Process/android
+xbmc/input/touch input/touch
+xbmc/input/touch/generic input/touch/generic
+xbmc/media/decoderfilter media/decoderfilter
+xbmc/platform/android platform/android
+xbmc/platform/android/activity platform/android/activity
+xbmc/platform/android/bionic_supplement platform/android/bionicsupplement
+xbmc/platform/android/filesystem platform/android/filesystem
+xbmc/platform/android/media/decoderfilter platform/android/media/decoderfilter
+xbmc/platform/android/media/drm platform/android/media/drm
+xbmc/platform/android/network platform/android/network
+xbmc/platform/android/peripherals platform/android/peripherals
+xbmc/platform/android/powermanagement platform/android/powermanagement
+xbmc/platform/android/speech platform/android/speech
+xbmc/platform/android/storage platform/android/storage
+xbmc/platform/android/utils platform/android/utils
+xbmc/platform/linux/peripherals platform/linux/peripherals
+xbmc/platform/linux/threads platform/linux/threads
+xbmc/platform/posix platform/posix
+xbmc/platform/posix/filesystem platform/posix/filesystem
+xbmc/platform/posix/threads platform/posix/threads
+xbmc/platform/posix/utils platform/posix/utils
+xbmc/windowing/android windowing/android
diff --git a/cmake/treedata/common/addon_dev_kit.txt b/cmake/treedata/common/addon_dev_kit.txt
new file mode 100644
index 0000000..ba39702
--- /dev/null
+++ b/cmake/treedata/common/addon_dev_kit.txt
@@ -0,0 +1,26 @@
+# Auto generated cmake/treedata/common/addon_dev_kit.txt.
+# See xbmc/addons/kodi-dev-kit/tools/code-generator.py.
+
+xbmc/addons/kodi-dev-kit/include/kodi addons_kodi-dev-kit_include_kodi
+xbmc/addons/kodi-dev-kit/include/kodi/c-api addons_kodi-dev-kit_include_kodi_c-api
+xbmc/addons/kodi-dev-kit/include/kodi/c-api/platform addons_kodi-dev-kit_include_kodi_c-api_platform
+xbmc/addons/kodi-dev-kit/include/kodi/c-api/platform/android addons_kodi-dev-kit_include_kodi_c-api_platform_android
+xbmc/addons/kodi-dev-kit/include/kodi/c-api/addon-instance addons_kodi-dev-kit_include_kodi_c-api_addon-instance
+xbmc/addons/kodi-dev-kit/include/kodi/c-api/addon-instance/inputstream addons_kodi-dev-kit_include_kodi_c-api_addon-instance_inputstream
+xbmc/addons/kodi-dev-kit/include/kodi/c-api/addon-instance/pvr addons_kodi-dev-kit_include_kodi_c-api_addon-instance_pvr
+xbmc/addons/kodi-dev-kit/include/kodi/c-api/gui addons_kodi-dev-kit_include_kodi_c-api_gui
+xbmc/addons/kodi-dev-kit/include/kodi/c-api/gui/dialogs addons_kodi-dev-kit_include_kodi_c-api_gui_dialogs
+xbmc/addons/kodi-dev-kit/include/kodi/c-api/gui/controls addons_kodi-dev-kit_include_kodi_c-api_gui_controls
+xbmc/addons/kodi-dev-kit/include/kodi/c-api/gui/input addons_kodi-dev-kit_include_kodi_c-api_gui_input
+xbmc/addons/kodi-dev-kit/include/kodi/platform addons_kodi-dev-kit_include_kodi_platform
+xbmc/addons/kodi-dev-kit/include/kodi/platform/android addons_kodi-dev-kit_include_kodi_platform_android
+xbmc/addons/kodi-dev-kit/include/kodi/addon-instance addons_kodi-dev-kit_include_kodi_addon-instance
+xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/peripheral addons_kodi-dev-kit_include_kodi_addon-instance_peripheral
+xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/inputstream addons_kodi-dev-kit_include_kodi_addon-instance_inputstream
+xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr addons_kodi-dev-kit_include_kodi_addon-instance_pvr
+xbmc/addons/kodi-dev-kit/include/kodi/gui addons_kodi-dev-kit_include_kodi_gui
+xbmc/addons/kodi-dev-kit/include/kodi/gui/dialogs addons_kodi-dev-kit_include_kodi_gui_dialogs
+xbmc/addons/kodi-dev-kit/include/kodi/gui/controls addons_kodi-dev-kit_include_kodi_gui_controls
+xbmc/addons/kodi-dev-kit/include/kodi/gui/input addons_kodi-dev-kit_include_kodi_gui_input
+xbmc/addons/kodi-dev-kit/include/kodi/gui/gl addons_kodi-dev-kit_include_kodi_gui_gl
+xbmc/addons/kodi-dev-kit/include/kodi/tools addons_kodi-dev-kit_include_kodi_tools
diff --git a/cmake/treedata/common/addons.txt b/cmake/treedata/common/addons.txt
new file mode 100644
index 0000000..e69de29
--- /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 0000000..d23939d
--- /dev/null
+++ b/cmake/treedata/common/cores.txt
@@ -0,0 +1,8 @@
+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
diff --git a/cmake/treedata/common/events.txt b/cmake/treedata/common/events.txt
new file mode 100644
index 0000000..0adeb08
--- /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 0000000..812bebc
--- /dev/null
+++ b/cmake/treedata/common/externals.txt
@@ -0,0 +1 @@
+xbmc/contrib/kissfft kissfft
diff --git a/cmake/treedata/common/filesystem.txt b/cmake/treedata/common/filesystem.txt
new file mode 100644
index 0000000..37a2536
--- /dev/null
+++ b/cmake/treedata/common/filesystem.txt
@@ -0,0 +1,3 @@
+xbmc/filesystem filesystem
+xbmc/filesystem/MusicDatabaseDirectory filesystem/musicdatabase
+xbmc/filesystem/VideoDatabaseDirectory filesystem/videodatabase
diff --git a/cmake/treedata/common/games.txt b/cmake/treedata/common/games.txt
new file mode 100644
index 0000000..6f9b842
--- /dev/null
+++ b/cmake/treedata/common/games.txt
@@ -0,0 +1,19 @@
+xbmc/games games
+xbmc/games/addons games/addons
+xbmc/games/addons/cheevos games/addons/cheevos
+xbmc/games/addons/input games/addons/input
+xbmc/games/addons/streams games/addons/streams
+xbmc/games/agents games/agents
+xbmc/games/controllers games/controllers
+xbmc/games/controllers/dialogs games/controllers/dialogs
+xbmc/games/controllers/guicontrols games/controllers/guicontrols
+xbmc/games/controllers/input games/controllers/input
+xbmc/games/controllers/types games/controllers/types
+xbmc/games/controllers/windows games/controllers/windows
+xbmc/games/dialogs games/dialogs
+xbmc/games/dialogs/osd games/dialogs/osd
+xbmc/games/ports/input games/ports/input
+xbmc/games/ports/types games/ports/types
+xbmc/games/ports/windows games/ports/windows
+xbmc/games/tags games/tags
+xbmc/games/windows games/windows
diff --git a/cmake/treedata/common/gbm/gbm.txt b/cmake/treedata/common/gbm/gbm.txt
new file mode 100644
index 0000000..113c47b
--- /dev/null
+++ b/cmake/treedata/common/gbm/gbm.txt
@@ -0,0 +1,3 @@
+xbmc/cores/RetroPlayer/process/gbm cores/RetroPlayer/process/gbm
+xbmc/cores/VideoPlayer/Process/gbm cores/VideoPlayer/Process/gbm
+xbmc/windowing/gbm windowing/gbm
diff --git a/cmake/treedata/common/interfaces.txt b/cmake/treedata/common/interfaces.txt
new file mode 100644
index 0000000..705697e
--- /dev/null
+++ b/cmake/treedata/common/interfaces.txt
@@ -0,0 +1,6 @@
+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
diff --git a/cmake/treedata/common/media.txt b/cmake/treedata/common/media.txt
new file mode 100644
index 0000000..519fece
--- /dev/null
+++ b/cmake/treedata/common/media.txt
@@ -0,0 +1,2 @@
+xbmc/media media
+xbmc/media/drm drm
diff --git a/cmake/treedata/common/music.txt b/cmake/treedata/common/music.txt
new file mode 100644
index 0000000..29aae7b
--- /dev/null
+++ b/cmake/treedata/common/music.txt
@@ -0,0 +1,6 @@
+xbmc/music music
+xbmc/music/dialogs music/dialogs
+xbmc/music/infoscanner music/infoscanner
+xbmc/music/jobs music/jobs
+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 0000000..46da314
--- /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 0000000..903b537
--- /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 0000000..fae570b
--- /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 0000000..b656415
--- /dev/null
+++ b/cmake/treedata/common/pvr.txt
@@ -0,0 +1,13 @@
+xbmc/pvr pvr
+xbmc/pvr/addons pvr/addons
+xbmc/pvr/channels pvr/channels
+xbmc/pvr/dialogs pvr/dialogs
+xbmc/pvr/epg pvr/epg
+xbmc/pvr/filesystem pvr/filesystem
+xbmc/pvr/guilib pvr/guilib
+xbmc/pvr/guilib/guiinfo pvr/guilib/guiinfo
+xbmc/pvr/providers pvr/providers
+xbmc/pvr/recordings pvr/recordings
+xbmc/pvr/settings pvr/settings
+xbmc/pvr/timers pvr/timers
+xbmc/pvr/windows pvr/windows
diff --git a/cmake/treedata/common/retroplayer.txt b/cmake/treedata/common/retroplayer.txt
new file mode 100644
index 0000000..fd2c7f5
--- /dev/null
+++ b/cmake/treedata/common/retroplayer.txt
@@ -0,0 +1,17 @@
+xbmc/cores/RetroPlayer cores/RetroPlayer
+xbmc/cores/RetroPlayer/audio cores/RetroPlayer/audio
+xbmc/cores/RetroPlayer/buffers cores/RetroPlayer/buffers
+xbmc/cores/RetroPlayer/buffers/video cores/RetroPlayer/buffers/video
+xbmc/cores/RetroPlayer/cheevos cores/RetroPlayer/cheevos
+xbmc/cores/RetroPlayer/guibridge cores/RetroPlayer/guibridge
+xbmc/cores/RetroPlayer/guicontrols cores/RetroPlayer/guicontrols
+xbmc/cores/RetroPlayer/guiplayback cores/RetroPlayer/guiplayback
+xbmc/cores/RetroPlayer/guiwindows cores/RetroPlayer/guiwindows
+xbmc/cores/RetroPlayer/playback cores/RetroPlayer/playback
+xbmc/cores/RetroPlayer/process cores/RetroPlayer/process
+xbmc/cores/RetroPlayer/rendering cores/RetroPlayer/rendering
+xbmc/cores/RetroPlayer/rendering/VideoRenderers cores/RetroPlayer/rendering/VideoRenderers
+xbmc/cores/RetroPlayer/rendering/VideoShaders cores/RetroPlayer/rendering/VideoShaders
+xbmc/cores/RetroPlayer/savestates cores/RetroPlayer/savestates
+xbmc/cores/RetroPlayer/streams cores/RetroPlayer/streams
+xbmc/cores/RetroPlayer/streams/memory cores/RetroPlayer/streams/memory
diff --git a/cmake/treedata/common/settings.txt b/cmake/treedata/common/settings.txt
new file mode 100644
index 0000000..c5aa2ae
--- /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 0000000..006c7ab
--- /dev/null
+++ b/cmake/treedata/common/subdirs.txt
@@ -0,0 +1,46 @@
+xbmc xbmc
+xbmc/addons addons
+xbmc/addons/addoninfo addons_addoninfo
+xbmc/addons/binary-addons addons_binary-addons
+xbmc/addons/gui addons_gui
+xbmc/addons/gui/skin addons_gui_skin
+xbmc/addons/interfaces addons_interfaces
+xbmc/addons/interfaces/gui addons_interfaces_gui
+xbmc/addons/interfaces/gui/controls addons_interfaces_gui_controls
+xbmc/addons/interfaces/gui/dialogs addons_interfaces_gui_dialogs
+xbmc/addons/settings addons_settings
+xbmc/application application
+xbmc/commons commons
+xbmc/dbwrappers dbwrappers
+xbmc/dialogs dialogs
+xbmc/favourites favourites
+xbmc/guilib guilib
+xbmc/guilib/guiinfo guilib_guiinfo
+xbmc/input input
+xbmc/input/actions input/actions
+xbmc/input/button input/button
+xbmc/input/joysticks input/joysticks
+xbmc/input/joysticks/dialogs input/joysticks/dialogs
+xbmc/input/joysticks/generic input/joysticks/generic
+xbmc/input/joysticks/keymaps input/joysticks/keymaps
+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/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/speech speech
+xbmc/storage storage
+xbmc/threads threads
+xbmc/utils utils
+xbmc/view view
+xbmc/weather weather
+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 0000000..784a2bc
--- /dev/null
+++ b/cmake/treedata/common/tests.txt
@@ -0,0 +1,14 @@
+xbmc/addons/test test/addons
+xbmc/cores/AudioEngine/Sinks/test test/audioengine_sinks
+xbmc/cores/VideoPlayer/test/edl test/edl
+xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/test test/videoshaders
+xbmc/filesystem/test test/filesystem
+xbmc/interfaces/python/test test/python
+xbmc/music/tags/test test/music_tags
+xbmc/network/test test/network
+xbmc/playlists/test test/playlists
+xbmc/pvr/channels/test test/pvrchannels
+xbmc/test test
+xbmc/threads/test test/threads
+xbmc/utils/test test/utils
+xbmc/video/test test/video
diff --git a/cmake/treedata/common/video.txt b/cmake/treedata/common/video.txt
new file mode 100644
index 0000000..ab53453
--- /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/tags video/tags
+xbmc/video/windows video/windows
diff --git a/cmake/treedata/common/videoplayer.txt b/cmake/treedata/common/videoplayer.txt
new file mode 100644
index 0000000..ed804c8
--- /dev/null
+++ b/cmake/treedata/common/videoplayer.txt
@@ -0,0 +1,14 @@
+xbmc/cores/VideoPlayer cores/VideoPlayer
+xbmc/cores/VideoPlayer/Buffers cores/VideoPlayer/Buffers
+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/DVDSubtitles/webvtt cores/VideoPlayer/subtitles/webvtt
+xbmc/cores/VideoPlayer/Process cores/VideoPlayer/process
+xbmc/cores/VideoPlayer/VideoRenderers cores/VideoPlayer/videorenderers
+xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender cores/VideoPlayer/videorenderers/hwdec
+xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders cores/VideoPlayer/videorenderers/shaders
diff --git a/cmake/treedata/common/wayland/wayland.txt b/cmake/treedata/common/wayland/wayland.txt
new file mode 100644
index 0000000..bbbb14e
--- /dev/null
+++ b/cmake/treedata/common/wayland/wayland.txt
@@ -0,0 +1,3 @@
+xbmc/cores/RetroPlayer/process/wayland cores/RetroPlayer/process/wayland
+xbmc/cores/VideoPlayer/Process/wayland cores/VideoPlayer/Process/wayland
+xbmc/windowing/wayland windowing/wayland
diff --git a/cmake/treedata/common/x11/X.txt b/cmake/treedata/common/x11/X.txt
new file mode 100644
index 0000000..548c9dd
--- /dev/null
+++ b/cmake/treedata/common/x11/X.txt
@@ -0,0 +1,3 @@
+xbmc/cores/RetroPlayer/process/X11 cores/RetroPlayer/process/X11
+xbmc/cores/VideoPlayer/Process/X11 cores/VideoPlayer/Process/X11
+xbmc/windowing/X11 windowing/X11
diff --git a/cmake/treedata/darwin_embedded/ios/ios.txt b/cmake/treedata/darwin_embedded/ios/ios.txt
new file mode 100644
index 0000000..b5a5dcf
--- /dev/null
+++ b/cmake/treedata/darwin_embedded/ios/ios.txt
@@ -0,0 +1,3 @@
+xbmc/platform/darwin/ios platform/ios
+xbmc/platform/darwin/speech platform/darwin/speech
+xbmc/windowing/ios windowing/ios
diff --git a/cmake/treedata/darwin_embedded/subdirs.txt b/cmake/treedata/darwin_embedded/subdirs.txt
new file mode 100644
index 0000000..52892f4
--- /dev/null
+++ b/cmake/treedata/darwin_embedded/subdirs.txt
@@ -0,0 +1,15 @@
+xbmc/cores/RetroPlayer/process/ios cores/RetroPlayer/process/ios
+xbmc/cores/VideoPlayer/Process/ios cores/VideoPlayer/Process/ios
+xbmc/input/touch input/touch
+xbmc/input/touch/generic input/touch/generic
+xbmc/platform/darwin platform/darwin
+xbmc/platform/darwin/ios-common platform/ios-common
+xbmc/platform/darwin/ios-common/network platform/ios-common/network
+xbmc/platform/darwin/ios-common/storage platform/ios-common/storage
+xbmc/platform/darwin/network platform/darwin/network
+xbmc/platform/darwin/peripherals platform/darwin/peripherals
+xbmc/platform/darwin/utils platform/darwin/utils
+xbmc/platform/posix posix
+xbmc/platform/posix/filesystem platform/posix/filesystem
+xbmc/platform/posix/threads platform/posix/threads
+xbmc/platform/posix/utils platform/posix/utils
diff --git a/cmake/treedata/darwin_embedded/tvos/tvos.txt b/cmake/treedata/darwin_embedded/tvos/tvos.txt
new file mode 100644
index 0000000..da2e107
--- /dev/null
+++ b/cmake/treedata/darwin_embedded/tvos/tvos.txt
@@ -0,0 +1,6 @@
+xbmc/platform/common/speech platform/common/speech
+xbmc/platform/darwin/tvos platform/tvos
+xbmc/platform/darwin/tvos/filesystem platform/darwin/tvos/filesystem
+xbmc/platform/darwin/tvos/input platform/darwin/tvos/input
+xbmc/platform/darwin/tvos/powermanagement platform/darwin/tvos/powermanagement
+xbmc/windowing/tvos windowing/tvos
diff --git a/cmake/treedata/freebsd/subdirs.txt b/cmake/treedata/freebsd/subdirs.txt
new file mode 100644
index 0000000..d7d954e
--- /dev/null
+++ b/cmake/treedata/freebsd/subdirs.txt
@@ -0,0 +1,17 @@
+xbmc/input/touch input/touch
+xbmc/input/touch/generic input/touch/generic
+xbmc/platform/common/speech platform/common/speech
+xbmc/platform/freebsd platform/freebsd
+xbmc/platform/freebsd/network platform/freebsd/network
+xbmc/platform/linux/input platform/linux/input
+xbmc/platform/linux/peripherals platform/linux/peripherals
+xbmc/platform/linux/powermanagement platform/linux/powermanagement
+xbmc/platform/linux/sse4 platform/linux/sse4
+xbmc/platform/linux/storage platform/linux/storage
+xbmc/platform/posix platform/posix
+xbmc/platform/posix/filesystem platform/posix/filesystem
+xbmc/platform/posix/network platform/posix/network
+xbmc/platform/posix/storage/discs platform/posix/storage/discs
+xbmc/platform/posix/threads platform/posix/threads
+xbmc/platform/posix/utils platform/posix/utils
+xbmc/windowing/linux windowing/linux
diff --git a/cmake/treedata/linux/subdirs.txt b/cmake/treedata/linux/subdirs.txt
new file mode 100644
index 0000000..a8e8194
--- /dev/null
+++ b/cmake/treedata/linux/subdirs.txt
@@ -0,0 +1,18 @@
+xbmc/input/touch input/touch
+xbmc/input/touch/generic input/touch/generic
+xbmc/platform/common/speech platform/common/speech
+xbmc/platform/linux platform/linux
+xbmc/platform/linux/input platform/linux/input
+xbmc/platform/linux/network platform/linux/network
+xbmc/platform/linux/peripherals platform/linux/peripherals
+xbmc/platform/linux/powermanagement platform/linux/powermanagement
+xbmc/platform/linux/sse4 platform/linux/sse4
+xbmc/platform/linux/storage platform/linux/storage
+xbmc/platform/linux/threads platform/linux/threads
+xbmc/platform/posix platform/posix
+xbmc/platform/posix/filesystem platform/posix/filesystem
+xbmc/platform/posix/network platform/posix/network
+xbmc/platform/posix/storage/discs platform/posix/storage/discs
+xbmc/platform/posix/threads platform/posix/threads
+xbmc/platform/posix/utils platform/posix/utils
+xbmc/windowing/linux windowing/linux
diff --git a/cmake/treedata/linux/tests.txt b/cmake/treedata/linux/tests.txt
new file mode 100644
index 0000000..3f3a3e3
--- /dev/null
+++ b/cmake/treedata/linux/tests.txt
@@ -0,0 +1 @@
+xbmc/platform/linux/test platform/linux/test
diff --git a/cmake/treedata/optional/common/avahi.txt b/cmake/treedata/optional/common/avahi.txt
new file mode 100644
index 0000000..41b82b9
--- /dev/null
+++ b/cmake/treedata/optional/common/avahi.txt
@@ -0,0 +1 @@
+xbmc/platform/linux/network/zeroconf platform/linux/network/zeroconf # AVAHI
diff --git a/cmake/treedata/optional/common/cdrip.txt b/cmake/treedata/optional/common/cdrip.txt
new file mode 100644
index 0000000..79b5390
--- /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 0000000..fd225c2
--- /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/mdns.txt b/cmake/treedata/optional/common/mdns.txt
new file mode 100644
index 0000000..9bebb89
--- /dev/null
+++ b/cmake/treedata/optional/common/mdns.txt
@@ -0,0 +1 @@
+xbmc/network/mdns mdns # MDNS
diff --git a/cmake/treedata/optional/common/opengl.txt b/cmake/treedata/optional/common/opengl.txt
new file mode 100644
index 0000000..b88ad7a
--- /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 0000000..6a223a1
--- /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/python.txt b/cmake/treedata/optional/common/python.txt
new file mode 100644
index 0000000..c381a18
--- /dev/null
+++ b/cmake/treedata/optional/common/python.txt
@@ -0,0 +1,4 @@
+xbmc/interfaces/legacy interfaces/legacy # PYTHON
+xbmc/interfaces/legacy/wsgi interfaces/legacy/wsgi # PYTHON
+xbmc/interfaces/python interfaces/python # PYTHON
+xbmc/interfaces/swig swig # PYTHON
diff --git a/cmake/treedata/optional/common/upnp.txt b/cmake/treedata/optional/common/upnp.txt
new file mode 100644
index 0000000..5589b80
--- /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 0000000..b492006
--- /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 0000000..b56f268
--- /dev/null
+++ b/cmake/treedata/osx/subdirs.txt
@@ -0,0 +1,22 @@
+xbmc/cores/RetroPlayer/process/osx cores/RetroPlayer/process/osx
+xbmc/cores/VideoPlayer/Process/osx cores/VideoPlayer/Process/osx
+xbmc/platform/darwin platform/darwin
+xbmc/platform/darwin/network platform/darwin/network
+xbmc/platform/darwin/speech platform/darwin/speech
+xbmc/platform/darwin/osx platform/osx
+xbmc/platform/darwin/osx/network platform/darwin/osx/network
+xbmc/platform/darwin/osx/peripherals platform/osx/peripherals
+xbmc/platform/darwin/osx/powermanagement platform/darwin/osx/powermanagement
+xbmc/platform/darwin/osx/SDL platform/osx/SDL
+xbmc/platform/darwin/osx/storage platform/osx/storage
+xbmc/platform/darwin/peripherals platform/darwin/peripherals
+xbmc/platform/darwin/utils platform/darwin/utils
+xbmc/platform/posix posix
+xbmc/platform/posix/filesystem platform/posix/filesystem
+xbmc/platform/posix/network platform/posix/network
+xbmc/platform/posix/storage/discs platform/posix/storage/discs
+xbmc/platform/posix/threads platform/posix/threads
+xbmc/platform/posix/utils platform/posix/utils
+xbmc/windowing/osx windowing/osx
+xbmc/windowing/osx/OpenGL windowing/osx/OpenGL
+xbmc/windowing/osx/SDL windowing/osx/SDL
diff --git a/cmake/treedata/windows/externals.txt b/cmake/treedata/windows/externals.txt
new file mode 100644
index 0000000..989677e
--- /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 0000000..c81ca86
--- /dev/null
+++ b/cmake/treedata/windows/subdirs.txt
@@ -0,0 +1,20 @@
+xbmc/cores/RetroPlayer/process/windows cores/RetroPlayer/process/windows
+xbmc/cores/RetroPlayer/rendering/VideoShaders/windows cores/RetroPlayer/rendering/VideoShaders/windows
+xbmc/cores/VideoPlayer/Process/windows cores/VideoPlayer/Process/windows
+xbmc/cores/VideoPlayer/VideoRenderers/windows cores/VideoPlayer/VideoRenderers/windows
+xbmc/input/touch input/touch
+xbmc/input/touch/generic input/touch/generic
+xbmc/network/mdns network/mdns
+xbmc/platform/common/speech platform/common/speech
+xbmc/platform/win32 platform/win32
+xbmc/platform/win32/filesystem platform/win32/filesystem
+xbmc/platform/win32/input platform/win32/input
+xbmc/platform/win32/network platform/win32/network
+xbmc/platform/win32/peripherals platform/win32/peripherals
+xbmc/platform/win32/powermanagement platform/win32/powermanagement
+xbmc/platform/win32/storage platform/win32/storage
+xbmc/platform/win32/storage/discs platform/win32/storage/discs
+xbmc/platform/win32/threads platform/win32/threads
+xbmc/platform/win32/utils platform/win32/utils
+xbmc/rendering/dx rendering/dx
+xbmc/windowing/windows windowing/windows
diff --git a/cmake/treedata/windowsstore/externals.txt b/cmake/treedata/windowsstore/externals.txt
new file mode 100644
index 0000000..989677e
--- /dev/null
+++ b/cmake/treedata/windowsstore/externals.txt
@@ -0,0 +1 @@
+lib/win32/Effects11 Effects11
diff --git a/cmake/treedata/windowsstore/subdirs.txt b/cmake/treedata/windowsstore/subdirs.txt
new file mode 100644
index 0000000..16299fc
--- /dev/null
+++ b/cmake/treedata/windowsstore/subdirs.txt
@@ -0,0 +1,17 @@
+xbmc/cores/VideoPlayer/Process/windows cores/VideoPlayer/Process/windows
+xbmc/cores/VideoPlayer/VideoRenderers/windows cores/VideoPlayer/VideoRenderers/windows
+xbmc/input/touch input/touch
+xbmc/input/touch/generic input/touch/generic
+xbmc/network/mdns network/mdns
+xbmc/platform/common/speech platform/common/speech
+xbmc/platform/win10 platform/win10
+xbmc/platform/win10/filesystem platform/win10/filesystem
+xbmc/platform/win10/network platform/win10/network
+xbmc/platform/win10/peripherals platform/win10/peripherals
+xbmc/platform/win10/powermanagement platform/win10/powermanagement
+xbmc/platform/win10/storage platform/win10/storage
+xbmc/platform/win10/threads platform/win10/threads
+xbmc/platform/win32/filesystem platform/win32/filesystem
+xbmc/platform/win32/utils platform/win32/utils
+xbmc/rendering/dx rendering/dx
+xbmc/windowing/win10 windowing/win10