summaryrefslogtreecommitdiffstats
path: root/cmake/modules
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/modules')
-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
95 files changed, 6042 insertions, 0 deletions
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 ()