summaryrefslogtreecommitdiff
path: root/externals/find-modules
diff options
context:
space:
mode:
Diffstat (limited to 'externals/find-modules')
-rw-r--r--externals/find-modules/FindCatch2.cmake49
-rw-r--r--externals/find-modules/FindFFmpeg.cmake100
-rw-r--r--externals/find-modules/FindLibUSB.cmake43
-rw-r--r--externals/find-modules/FindLibzip.cmake72
-rw-r--r--externals/find-modules/FindUnicorn.cmake18
-rw-r--r--externals/find-modules/Findfmt.cmake69
-rw-r--r--externals/find-modules/Findlz4.cmake54
-rw-r--r--externals/find-modules/Findnlohmann_json.cmake49
-rw-r--r--externals/find-modules/Findopus.cmake42
-rw-r--r--externals/find-modules/Findzstd.cmake55
10 files changed, 551 insertions, 0 deletions
diff --git a/externals/find-modules/FindCatch2.cmake b/externals/find-modules/FindCatch2.cmake
new file mode 100644
index 000000000..ce1d40bae
--- /dev/null
+++ b/externals/find-modules/FindCatch2.cmake
@@ -0,0 +1,49 @@
+
+find_package(PkgConfig QUIET)
+pkg_check_modules(PC_Catch2 QUIET Catch2)
+
+find_path(Catch2_INCLUDE_DIR
+ NAMES catch.hpp
+ PATHS ${PC_Catch2_INCLUDE_DIRS} ${CONAN_CATCH2_ROOT}
+ PATH_SUFFIXES catch2
+)
+
+if(Catch2_INCLUDE_DIR)
+ file(STRINGS "${Catch2_INCLUDE_DIR}/catch.hpp" _Catch2_version_lines
+ REGEX "#define[ \t]+CATCH_VERSION_(MAJOR|MINOR|PATCH)")
+ string(REGEX REPLACE ".*CATCH_VERSION_MAJOR +\([0-9]+\).*" "\\1" _Catch2_version_major "${_Catch2_version_lines}")
+ string(REGEX REPLACE ".*CATCH_VERSION_MINOR +\([0-9]+\).*" "\\1" _Catch2_version_minor "${_Catch2_version_lines}")
+ string(REGEX REPLACE ".*CATCH_VERSION_PATCH +\([0-9]+\).*" "\\1" _Catch2_version_patch "${_Catch2_version_lines}")
+ set(Catch2_VERSION "${_Catch2_version_major}.${_Catch2_version_minor}.${_Catch2_version_patch}")
+ unset(_Catch2_version_major)
+ unset(_Catch2_version_minor)
+ unset(_Catch2_version_patch)
+ unset(_Catch2_version_lines)
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Catch2
+ FOUND_VAR Catch2_FOUND
+ REQUIRED_VARS
+ Catch2_INCLUDE_DIR
+ Catch2_VERSION
+ VERSION_VAR Catch2_VERSION
+)
+
+if(Catch2_FOUND)
+ set(Catch2_INCLUDE_DIRS ${Catch2_INCLUDE_DIR})
+ set(Catch2_DEFINITIONS ${PC_Catch2_CFLAGS_OTHER})
+endif()
+
+if(Catch2_FOUND AND NOT TARGET Catch2::Catch2)
+ add_library(Catch2::Catch2 UNKNOWN IMPORTED)
+ set_target_properties(Catch2::Catch2 PROPERTIES
+ IMPORTED_LOCATION "${Catch2_LIBRARY}"
+ INTERFACE_COMPILE_OPTIONS "${PC_Catch2_CFLAGS_OTHER}"
+ INTERFACE_INCLUDE_DIRECTORIES "${Catch2_INCLUDE_DIR}"
+ )
+endif()
+
+mark_as_advanced(
+ Catch2_INCLUDE_DIR
+)
diff --git a/externals/find-modules/FindFFmpeg.cmake b/externals/find-modules/FindFFmpeg.cmake
new file mode 100644
index 000000000..77b331e00
--- /dev/null
+++ b/externals/find-modules/FindFFmpeg.cmake
@@ -0,0 +1,100 @@
+# - Try to find ffmpeg libraries (libavcodec, libavformat and libavutil)
+# Once done this will define
+#
+# FFMPEG_FOUND - system has ffmpeg or libav
+# FFMPEG_INCLUDE_DIR - the ffmpeg include directory
+# FFMPEG_LIBRARIES - Link these to use ffmpeg
+# FFMPEG_LIBAVCODEC
+# FFMPEG_LIBAVFORMAT
+# FFMPEG_LIBAVUTIL
+#
+# Copyright (c) 2008 Andreas Schneider <mail@cynapses.org>
+# Modified for other libraries by Lasse Kärkkäinen <tronic>
+# Modified for Hedgewars by Stepik777
+# Modified for FFmpeg-example Tuukka Pasanen 2018
+# Modified for yuzu toastUnlimted 2020
+#
+# Redistribution and use is allowed according to the terms of the New
+# BSD license.
+#
+
+include(FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args(FFMPEG
+ FOUND_VAR FFMPEG_FOUND
+ REQUIRED_VARS
+ FFMPEG_LIBRARY
+ FFMPEG_INCLUDE_DIR
+ VERSION_VAR FFMPEG_VERSION
+)
+
+if(FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR)
+ # in cache already
+ set(FFMPEG_FOUND TRUE)
+else()
+ # use pkg-config to get the directories and then use these values
+ # in the FIND_PATH() and FIND_LIBRARY() calls
+ find_package(PkgConfig)
+ if(PKG_CONFIG_FOUND)
+ pkg_check_modules(_FFMPEG_AVCODEC libavcodec)
+ pkg_check_modules(_FFMPEG_AVUTIL libavutil)
+ pkg_check_modules(_FFMPEG_SWSCALE libswscale)
+ endif()
+
+ find_path(FFMPEG_AVCODEC_INCLUDE_DIR
+ NAMES libavcodec/avcodec.h
+ PATHS ${_FFMPEG_AVCODEC_INCLUDE_DIRS}
+ /usr/include
+ /usr/local/include
+ /opt/local/include
+ /sw/include
+ PATH_SUFFIXES ffmpeg libav)
+
+ find_library(FFMPEG_LIBAVCODEC
+ NAMES avcodec
+ PATHS ${_FFMPEG_AVCODEC_LIBRARY_DIRS}
+ /usr/lib
+ /usr/local/lib
+ /opt/local/lib
+ /sw/lib)
+
+ find_library(FFMPEG_LIBAVUTIL
+ NAMES avutil
+ PATHS ${_FFMPEG_AVUTIL_LIBRARY_DIRS}
+ /usr/lib
+ /usr/local/lib
+ /opt/local/lib
+ /sw/lib)
+
+ find_library(FFMPEG_LIBSWSCALE
+ NAMES swscale
+ PATHS ${_FFMPEG_SWSCALE_LIBRARY_DIRS}
+ /usr/lib
+ /usr/local/lib
+ /opt/local/lib
+ /sw/lib)
+
+ if(FFMPEG_LIBAVCODEC AND FFMPEG_LIBAVUTIL AND FFMPEG_LIBSWSCALE)
+ set(FFMPEG_FOUND TRUE)
+ endif()
+
+ if(FFMPEG_FOUND)
+ set(FFMPEG_INCLUDE_DIR ${FFMPEG_AVCODEC_INCLUDE_DIR})
+ set(FFMPEG_LIBRARIES
+ ${FFMPEG_LIBAVCODEC}
+ ${FFMPEG_LIBAVUTIL}
+ ${FFMPEG_LIBSWSCALE})
+ endif()
+
+ if(FFMPEG_FOUND)
+ if(NOT FFMPEG_FIND_QUIETLY)
+ message(STATUS
+ "Found FFMPEG or Libav: ${FFMPEG_LIBRARIES}, ${FFMPEG_INCLUDE_DIR}")
+ endif()
+ else()
+ if(FFMPEG_FIND_REQUIRED)
+ message(FATAL_ERROR
+ "Could not find libavcodec or libavutil or libswscale")
+ endif()
+ endif()
+endif()
diff --git a/externals/find-modules/FindLibUSB.cmake b/externals/find-modules/FindLibUSB.cmake
new file mode 100644
index 000000000..dec0b98b0
--- /dev/null
+++ b/externals/find-modules/FindLibUSB.cmake
@@ -0,0 +1,43 @@
+# - Find libusb-1.0 library
+# This module defines
+# LIBUSB_INCLUDE_DIR, where to find bluetooth.h
+# LIBUSB_LIBRARIES, the libraries needed to use libusb-1.0.
+# LIBUSB_FOUND, If false, do not try to use libusb-1.0.
+#
+# Copyright (c) 2009, Michal Cihar, <michal@cihar.com>
+#
+# vim: expandtab sw=4 ts=4 sts=4:
+
+if(ANDROID)
+ set(LIBUSB_FOUND FALSE CACHE INTERNAL "libusb-1.0 found")
+ message(STATUS "libusb-1.0 not found.")
+elseif (NOT LIBUSB_FOUND)
+ pkg_check_modules (LIBUSB_PKG libusb-1.0)
+
+ find_path(LIBUSB_INCLUDE_DIR NAMES libusb.h
+ PATHS
+ ${LIBUSB_PKG_INCLUDE_DIRS}
+ /usr/include/libusb-1.0
+ /usr/include
+ /usr/local/include/libusb-1.0
+ /usr/local/include
+ )
+
+ find_library(LIBUSB_LIBRARIES NAMES usb-1.0 usb
+ PATHS
+ ${LIBUSB_PKG_LIBRARY_DIRS}
+ /usr/lib
+ /usr/local/lib
+ )
+
+ if(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
+ set(LIBUSB_FOUND TRUE CACHE INTERNAL "libusb-1.0 found")
+ message(STATUS "Found libusb-1.0: ${LIBUSB_INCLUDE_DIR}, ${LIBUSB_LIBRARIES}")
+ else(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
+ set(LIBUSB_FOUND FALSE CACHE INTERNAL "libusb-1.0 found")
+ message(STATUS "libusb-1.0 not found.")
+ endif(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
+
+ mark_as_advanced(LIBUSB_INCLUDE_DIR LIBUSB_LIBRARIES)
+endif ()
+
diff --git a/externals/find-modules/FindLibzip.cmake b/externals/find-modules/FindLibzip.cmake
new file mode 100644
index 000000000..f36b1687a
--- /dev/null
+++ b/externals/find-modules/FindLibzip.cmake
@@ -0,0 +1,72 @@
+
+find_package(PkgConfig QUIET)
+pkg_check_modules(PC_LIBZIP QUIET libzip)
+
+find_path(LIBZIP_INCLUDE_DIR
+ NAMES zip.h
+ PATHS ${PC_LIBZIP_INCLUDE_DIRS}
+ "$ENV{LIB_DIR}/include"
+ "$ENV{INCLUDE}"
+ /usr/local/include
+ /usr/include
+)
+find_path(LIBZIP_INCLUDE_DIR_ZIPCONF
+ NAMES zipconf.h
+ HINTS ${PC_LIBZIP_INCLUDE_DIRS}
+ "$ENV{LIB_DIR}/include"
+ "$ENV{LIB_DIR}/lib/libzip/include"
+ "$ENV{LIB}/lib/libzip/include"
+ /usr/local/lib/libzip/include
+ /usr/lib/libzip/include
+ /usr/local/include
+ /usr/include
+ "$ENV{INCLUDE}"
+)
+find_library(LIBZIP_LIBRARY
+ NAMES zip
+ PATHS ${PC_LIBZIP_LIBRARY_DIRS}
+ "$ENV{LIB_DIR}/lib" "$ENV{LIB}" /usr/local/lib /usr/lib
+)
+
+if (LIBZIP_INCLUDE_DIR_ZIPCONF)
+ FILE(READ "${LIBZIP_INCLUDE_DIR_ZIPCONF}/zipconf.h" _LIBZIP_VERSION_CONTENTS)
+ if (_LIBZIP_VERSION_CONTENTS)
+ STRING(REGEX REPLACE ".*#define LIBZIP_VERSION \"([0-9.]+)\".*" "\\1" LIBZIP_VERSION "${_LIBZIP_VERSION_CONTENTS}")
+ endif()
+ unset(_LIBZIP_VERSION_CONTENTS)
+endif()
+
+set(LIBZIP_VERSION ${LIBZIP_VERSION} CACHE STRING "Version number of libzip")
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Libzip
+ FOUND_VAR LIBZIP_FOUND
+ REQUIRED_VARS
+ LIBZIP_LIBRARY
+ LIBZIP_INCLUDE_DIR
+ LIBZIP_INCLUDE_DIR_ZIPCONF
+ LIBZIP_VERSION
+ VERSION_VAR LIBZIP_VERSION
+)
+
+if(LIBZIP_FOUND)
+ set(LIBZIP_LIBRARIES ${LIBZIP_LIBRARY})
+ set(LIBZIP_INCLUDE_DIRS ${LIBZIP_INCLUDE_DIR})
+ set(LIBZIP_DEFINITIONS ${PC_LIBZIP_CFLAGS_OTHER})
+endif()
+
+if(LIBZIP_FOUND AND NOT TARGET libzip::libzip)
+ add_library(libzip::libzip UNKNOWN IMPORTED)
+ set_target_properties(libzip::libzip PROPERTIES
+ IMPORTED_LOCATION "${LIBZIP_LIBRARY}"
+ INTERFACE_COMPILE_OPTIONS "${PC_LIBZIP_CFLAGS_OTHER}"
+ INTERFACE_INCLUDE_DIRECTORIES "${LIBZIP_INCLUDE_DIR}"
+ )
+endif()
+
+mark_as_advanced(
+ LIBZIP_INCLUDE_DIR
+ LIBZIP_INCLUDE_DIR_ZIPCONF
+ LIBZIP_LIBRARY
+ LIBZIP_VERSION
+)
diff --git a/externals/find-modules/FindUnicorn.cmake b/externals/find-modules/FindUnicorn.cmake
new file mode 100644
index 000000000..a0f2a71f6
--- /dev/null
+++ b/externals/find-modules/FindUnicorn.cmake
@@ -0,0 +1,18 @@
+# Exports:
+# LIBUNICORN_FOUND
+# LIBUNICORN_INCLUDE_DIR
+# LIBUNICORN_LIBRARY
+
+find_path(LIBUNICORN_INCLUDE_DIR
+ unicorn/unicorn.h
+ HINTS $ENV{UNICORNDIR}
+ PATH_SUFFIXES include)
+
+find_library(LIBUNICORN_LIBRARY
+ NAMES unicorn
+ HINTS $ENV{UNICORNDIR})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(unicorn DEFAULT_MSG
+ LIBUNICORN_LIBRARY LIBUNICORN_INCLUDE_DIR)
+mark_as_advanced(LIBUNICORN_INCLUDE_DIR LIBUNICORN_LIBRARY)
diff --git a/externals/find-modules/Findfmt.cmake b/externals/find-modules/Findfmt.cmake
new file mode 100644
index 000000000..8ba51cbea
--- /dev/null
+++ b/externals/find-modules/Findfmt.cmake
@@ -0,0 +1,69 @@
+
+find_package(PkgConfig QUIET)
+pkg_check_modules(PC_fmt QUIET fmt)
+
+find_path(fmt_INCLUDE_DIR
+ NAMES format.h
+ PATHS ${PC_fmt_INCLUDE_DIRS} ${CONAN_INCLUDE_DIRS_fmt}
+ PATH_SUFFIXES fmt
+)
+
+find_library(fmt_LIBRARY
+ NAMES fmt
+ PATHS ${PC_fmt_LIBRARY_DIRS} ${CONAN_LIB_DIRS_fmt}
+)
+
+if(fmt_INCLUDE_DIR)
+ set(_fmt_version_file "${fmt_INCLUDE_DIR}/core.h")
+ if(NOT EXISTS "${_fmt_version_file}")
+ set(_fmt_version_file "${fmt_INCLUDE_DIR}/format.h")
+ endif()
+ if(EXISTS "${_fmt_version_file}")
+ # parse "#define FMT_VERSION 60200" to 6.2.0
+ file(STRINGS "${_fmt_version_file}" fmt_VERSION_LINE
+ REGEX "^#define[ \t]+FMT_VERSION[ \t]+[0-9]+$")
+ string(REGEX REPLACE "^#define[ \t]+FMT_VERSION[ \t]+([0-9]+)$"
+ "\\1" fmt_VERSION "${fmt_VERSION_LINE}")
+ foreach(ver "fmt_VERSION_PATCH" "fmt_VERSION_MINOR" "fmt_VERSION_MAJOR")
+ math(EXPR ${ver} "${fmt_VERSION} % 100")
+ math(EXPR fmt_VERSION "(${fmt_VERSION} - ${${ver}}) / 100")
+ endforeach()
+ set(fmt_VERSION
+ "${fmt_VERSION_MAJOR}.${fmt_VERSION_MINOR}.${fmt_VERSION_PATCH}")
+ endif()
+ unset(_fmt_version_file)
+ unset(fmt_VERSION_LINE)
+ unset(fmt_VERSION_MAJOR)
+ unset(fmt_VERSION_MINOR)
+ unset(fmt_VERSION_PATCH)
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(fmt
+ FOUND_VAR fmt_FOUND
+ REQUIRED_VARS
+ fmt_LIBRARY
+ fmt_INCLUDE_DIR
+ fmt_VERSION
+ VERSION_VAR fmt_VERSION
+)
+
+if(fmt_FOUND)
+ set(fmt_LIBRARIES ${fmt_LIBRARY})
+ set(fmt_INCLUDE_DIRS ${fmt_INCLUDE_DIR})
+ set(fmt_DEFINITIONS ${PC_fmt_CFLAGS_OTHER})
+endif()
+
+if(fmt_FOUND AND NOT TARGET fmt::fmt)
+ add_library(fmt::fmt UNKNOWN IMPORTED)
+ set_target_properties(fmt::fmt PROPERTIES
+ IMPORTED_LOCATION "${fmt_LIBRARY}"
+ INTERFACE_COMPILE_OPTIONS "${PC_fmt_CFLAGS_OTHER}"
+ INTERFACE_INCLUDE_DIRECTORIES "${fmt_INCLUDE_DIR}"
+ )
+endif()
+
+mark_as_advanced(
+ fmt_INCLUDE_DIR
+ fmt_LIBRARY
+)
diff --git a/externals/find-modules/Findlz4.cmake b/externals/find-modules/Findlz4.cmake
new file mode 100644
index 000000000..6279854c0
--- /dev/null
+++ b/externals/find-modules/Findlz4.cmake
@@ -0,0 +1,54 @@
+
+find_package(PkgConfig QUIET)
+pkg_check_modules(PC_lz4 QUIET lz4)
+
+find_path(lz4_INCLUDE_DIR
+ NAMES lz4.h
+ PATHS ${PC_lz4_INCLUDE_DIRS}
+)
+find_library(lz4_LIBRARY
+ NAMES lz4
+ PATHS ${PC_lz4_LIBRARY_DIRS}
+)
+
+if(lz4_INCLUDE_DIR)
+ file(STRINGS "${lz4_INCLUDE_DIR}/lz4.h" _lz4_version_lines
+ REGEX "#define[ \t]+LZ4_VERSION_(MAJOR|MINOR|RELEASE)")
+ string(REGEX REPLACE ".*LZ4_VERSION_MAJOR *\([0-9]*\).*" "\\1" _lz4_version_major "${_lz4_version_lines}")
+ string(REGEX REPLACE ".*LZ4_VERSION_MINOR *\([0-9]*\).*" "\\1" _lz4_version_minor "${_lz4_version_lines}")
+ string(REGEX REPLACE ".*LZ4_VERSION_RELEASE *\([0-9]*\).*" "\\1" _lz4_version_release "${_lz4_version_lines}")
+ set(lz4_VERSION "${_lz4_version_major}.${_lz4_version_minor}.${_lz4_version_release}")
+ unset(_lz4_version_major)
+ unset(_lz4_version_minor)
+ unset(_lz4_version_release)
+ unset(_lz4_version_lines)
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(lz4
+ FOUND_VAR lz4_FOUND
+ REQUIRED_VARS
+ lz4_LIBRARY
+ lz4_INCLUDE_DIR
+ VERSION_VAR lz4_VERSION
+)
+
+if(lz4_FOUND)
+ set(lz4_LIBRARIES ${lz4_LIBRARY})
+ set(lz4_INCLUDE_DIRS ${lz4_INCLUDE_DIR})
+ set(lz4_DEFINITIONS ${PC_lz4_CFLAGS_OTHER})
+endif()
+
+if(lz4_FOUND AND NOT TARGET lz4::lz4)
+ add_library(lz4::lz4 UNKNOWN IMPORTED)
+ set_target_properties(lz4::lz4 PROPERTIES
+ IMPORTED_LOCATION "${lz4_LIBRARY}"
+ INTERFACE_COMPILE_OPTIONS "${PC_lz4_CFLAGS_OTHER}"
+ INTERFACE_INCLUDE_DIRECTORIES "${lz4_INCLUDE_DIR}"
+ )
+endif()
+
+mark_as_advanced(
+ lz4_INCLUDE_DIR
+ lz4_LIBRARY
+)
diff --git a/externals/find-modules/Findnlohmann_json.cmake b/externals/find-modules/Findnlohmann_json.cmake
new file mode 100644
index 000000000..b0c5b3e4e
--- /dev/null
+++ b/externals/find-modules/Findnlohmann_json.cmake
@@ -0,0 +1,49 @@
+
+find_package(PkgConfig QUIET)
+pkg_check_modules(PC_nlohmann_json QUIET nlohmann_json)
+
+find_path(nlohmann_json_INCLUDE_DIR
+ NAMES json.hpp
+ PATHS ${PC_nlohmann_json_INCLUDE_DIRS}
+ PATH_SUFFIXES nlohmann
+)
+
+if(nlohmann_json_INCLUDE_DIR)
+ file(STRINGS "${nlohmann_json_INCLUDE_DIR}/json.hpp" _nlohmann_json_version_lines
+ REGEX "#define[ \t]+NLOHMANN_JSON_VERSION_(MAJOR|MINOR|PATCH)")
+ string(REGEX REPLACE ".*NLOHMANN_JSON_VERSION_MAJOR +\([0-9]+\).*" "\\1" _nlohmann_json_version_major "${_nlohmann_json_version_lines}")
+ string(REGEX REPLACE ".*NLOHMANN_JSON_VERSION_MINOR +\([0-9]+\).*" "\\1" _nlohmann_json_version_minor "${_nlohmann_json_version_lines}")
+ string(REGEX REPLACE ".*NLOHMANN_JSON_VERSION_PATCH +\([0-9]+\).*" "\\1" _nlohmann_json_version_patch "${_nlohmann_json_version_lines}")
+ set(nlohmann_json_VERSION "${_nlohmann_json_version_major}.${_nlohmann_json_version_minor}.${_nlohmann_json_version_patch}")
+ unset(_nlohmann_json_version_major)
+ unset(_nlohmann_json_version_minor)
+ unset(_nlohmann_json_version_patch)
+ unset(_nlohmann_json_version_lines)
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(nlohmann_json
+ FOUND_VAR nlohmann_json_FOUND
+ REQUIRED_VARS
+ nlohmann_json_INCLUDE_DIR
+ nlohmann_json_VERSION
+ VERSION_VAR nlohmann_json_VERSION
+)
+
+if(nlohmann_json_FOUND)
+ set(nlohmann_json_INCLUDE_DIRS ${nlohmann_json_INCLUDE_DIR})
+ set(nlohmann_json_DEFINITIONS ${PC_nlohmann_json_CFLAGS_OTHER})
+endif()
+
+if(nlohmann_json_FOUND AND NOT TARGET nlohmann_json::nlohmann_json)
+ add_library(nlohmann_json::nlohmann_json UNKNOWN IMPORTED)
+ set_target_properties(nlohmann_json::nlohmann_json PROPERTIES
+ IMPORTED_LOCATION "${nlohmann_json_LIBRARY}"
+ INTERFACE_COMPILE_OPTIONS "${PC_nlohmann_json_CFLAGS_OTHER}"
+ INTERFACE_INCLUDE_DIRECTORIES "${nlohmann_json_INCLUDE_DIR}"
+ )
+endif()
+
+mark_as_advanced(
+ nlohmann_json_INCLUDE_DIR
+)
diff --git a/externals/find-modules/Findopus.cmake b/externals/find-modules/Findopus.cmake
new file mode 100644
index 000000000..de84bd995
--- /dev/null
+++ b/externals/find-modules/Findopus.cmake
@@ -0,0 +1,42 @@
+
+find_package(PkgConfig QUIET)
+pkg_check_modules(PC_opus QUIET opus)
+
+find_path(opus_INCLUDE_DIR
+ NAMES opus.h
+ PATHS ${PC_opus_INCLUDE_DIRS}
+ PATH_SUFFIXES opus
+)
+find_library(opus_LIBRARY
+ NAMES opus
+ PATHS ${PC_opus_LIBRARY_DIRS}
+)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(opus
+ FOUND_VAR opus_FOUND
+ REQUIRED_VARS
+ opus_LIBRARY
+ opus_INCLUDE_DIR
+ VERSION_VAR opus_VERSION
+)
+
+if(opus_FOUND)
+ set(Opus_LIBRARIES ${opus_LIBRARY})
+ set(Opus_INCLUDE_DIRS ${opus_INCLUDE_DIR})
+ set(Opus_DEFINITIONS ${PC_opus_CFLAGS_OTHER})
+endif()
+
+if(opus_FOUND AND NOT TARGET Opus::Opus)
+ add_library(Opus::Opus UNKNOWN IMPORTED)
+ set_target_properties(Opus::Opus PROPERTIES
+ IMPORTED_LOCATION "${opus_LIBRARY}"
+ INTERFACE_COMPILE_OPTIONS "${PC_opus_CFLAGS_OTHER}"
+ INTERFACE_INCLUDE_DIRECTORIES "${opus_INCLUDE_DIR}"
+ )
+endif()
+
+mark_as_advanced(
+ opus_INCLUDE_DIR
+ opus_LIBRARY
+)
diff --git a/externals/find-modules/Findzstd.cmake b/externals/find-modules/Findzstd.cmake
new file mode 100644
index 000000000..539abbafc
--- /dev/null
+++ b/externals/find-modules/Findzstd.cmake
@@ -0,0 +1,55 @@
+
+find_package(PkgConfig QUIET)
+pkg_check_modules(PC_zstd QUIET libzstd)
+
+find_path(zstd_INCLUDE_DIR
+ NAMES zstd.h
+ PATHS ${PC_zstd_INCLUDE_DIRS}
+)
+find_library(zstd_LIBRARY
+ NAMES zstd
+ PATHS ${PC_zstd_LIBRARY_DIRS}
+)
+
+if(zstd_INCLUDE_DIR)
+ file(STRINGS "${zstd_INCLUDE_DIR}/zstd.h" _zstd_version_lines
+ REGEX "#define[ \t]+ZSTD_VERSION_(MAJOR|MINOR|RELEASE)")
+ string(REGEX REPLACE ".*ZSTD_VERSION_MAJOR *\([0-9]*\).*" "\\1" _zstd_version_major "${_zstd_version_lines}")
+ string(REGEX REPLACE ".*ZSTD_VERSION_MINOR *\([0-9]*\).*" "\\1" _zstd_version_minor "${_zstd_version_lines}")
+ string(REGEX REPLACE ".*ZSTD_VERSION_RELEASE *\([0-9]*\).*" "\\1" _zstd_version_release "${_zstd_version_lines}")
+ set(zstd_VERSION "${_zstd_version_major}.${_zstd_version_minor}.${_zstd_version_release}")
+ unset(_zstd_version_major)
+ unset(_zstd_version_minor)
+ unset(_zstd_version_release)
+ unset(_zstd_version_lines)
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(zstd
+ FOUND_VAR zstd_FOUND
+ REQUIRED_VARS
+ zstd_LIBRARY
+ zstd_INCLUDE_DIR
+ zstd_VERSION
+ VERSION_VAR zstd_VERSION
+)
+
+if(zstd_FOUND)
+ set(zstd_LIBRARIES ${zstd_LIBRARY})
+ set(zstd_INCLUDE_DIRS ${zstd_INCLUDE_DIR})
+ set(zstd_DEFINITIONS ${PC_zstd_CFLAGS_OTHER})
+endif()
+
+if(zstd_FOUND AND NOT TARGET zstd::zstd)
+ add_library(zstd::zstd UNKNOWN IMPORTED)
+ set_target_properties(zstd::zstd PROPERTIES
+ IMPORTED_LOCATION "${zstd_LIBRARY}"
+ INTERFACE_COMPILE_OPTIONS "${PC_zstd_CFLAGS_OTHER}"
+ INTERFACE_INCLUDE_DIRECTORIES "${zstd_INCLUDE_DIR}"
+ )
+endif()
+
+mark_as_advanced(
+ zstd_INCLUDE_DIR
+ zstd_LIBRARY
+)