summaryrefslogtreecommitdiff
path: root/cmake/modules
diff options
context:
space:
mode:
authorKiritoDv <kiritodev01@gmail.com>2025-02-08 10:54:19 -0600
committerKiritoDv <kiritodev01@gmail.com>2025-02-08 10:54:19 -0600
commit91292d37574d8a5f8542a3cb4bb8fd36bd3da200 (patch)
treef314fdd14beeeefe5891c0ec5ce33d1d387d87eb /cmake/modules
parent844777c39990e160fd89df99735e52835c972cb3 (diff)
Updated cmake again
Diffstat (limited to 'cmake/modules')
-rw-r--r--cmake/modules/FindOgg.cmake61
-rw-r--r--cmake/modules/FindPulseAudio.cmake34
-rw-r--r--cmake/modules/FindVorbis.cmake197
-rw-r--r--cmake/modules/FindlibUsb.cmake48
-rw-r--r--cmake/modules/Findudev.cmake84
5 files changed, 424 insertions, 0 deletions
diff --git a/cmake/modules/FindOgg.cmake b/cmake/modules/FindOgg.cmake
new file mode 100644
index 000000000..f606144f6
--- /dev/null
+++ b/cmake/modules/FindOgg.cmake
@@ -0,0 +1,61 @@
+# - Find ogg
+# Find the native ogg includes and libraries
+#
+# OGG_INCLUDE_DIRS - where to find ogg.h, etc.
+# OGG_LIBRARIES - List of libraries when using ogg.
+# OGG_FOUND - True if ogg found.
+
+if (OGG_INCLUDE_DIR)
+ # Already in cache, be silent
+ set(OGG_FIND_QUIETLY TRUE)
+endif ()
+
+find_package (PkgConfig QUIET)
+pkg_check_modules (PC_OGG QUIET ogg>=1.3.0)
+
+set (OGG_VERSION ${PC_OGG_VERSION})
+
+find_path (OGG_INCLUDE_DIR ogg/ogg.h
+ HINTS
+ ${PC_OGG_INCLUDEDIR}
+ ${PC_OGG_INCLUDE_DIRS}
+ ${OGG_ROOT}
+ )
+# MSVC built ogg may be named ogg_static.
+# The provided project files name the library with the lib prefix.
+find_library (OGG_LIBRARY
+ NAMES
+ ogg
+ ogg_static
+ libogg
+ libogg_static
+ HINTS
+ ${PC_OGG_LIBDIR}
+ ${PC_OGG_LIBRARY_DIRS}
+ ${OGG_ROOT}
+ )
+# Handle the QUIETLY and REQUIRED arguments and set OGG_FOUND
+# to TRUE if all listed variables are TRUE.
+include (FindPackageHandleStandardArgs)
+find_package_handle_standard_args (Ogg
+ REQUIRED_VARS
+ OGG_LIBRARY
+ OGG_INCLUDE_DIR
+ VERSION_VAR
+ OGG_VERSION
+ )
+
+if (OGG_FOUND)
+ set (OGG_LIBRARIES ${OGG_LIBRARY})
+ set (OGG_INCLUDE_DIRS ${OGG_INCLUDE_DIR})
+
+ if(NOT TARGET Ogg::ogg)
+ add_library(Ogg::ogg UNKNOWN IMPORTED)
+ set_target_properties(Ogg::ogg PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${OGG_INCLUDE_DIRS}"
+ IMPORTED_LOCATION "${OGG_LIBRARIES}"
+ )
+ endif ()
+endif ()
+
+mark_as_advanced (OGG_INCLUDE_DIR OGG_LIBRARY) \ No newline at end of file
diff --git a/cmake/modules/FindPulseAudio.cmake b/cmake/modules/FindPulseAudio.cmake
new file mode 100644
index 000000000..fdcbc20ff
--- /dev/null
+++ b/cmake/modules/FindPulseAudio.cmake
@@ -0,0 +1,34 @@
+# - Find PulseAudio includes and libraries
+#
+# PULSEAUDIO_FOUND - True if PULSEAUDIO_INCLUDE_DIR &
+# PULSEAUDIO_LIBRARY are found
+#
+# PULSEAUDIO_INCLUDE_DIR - where to find pulse/pulseaudio.h, etc.
+# PULSEAUDIO_LIBRARY - the pulse library
+# PULSEAUDIO_VERSION_STRING - the version of PulseAudio found
+#
+
+find_path(PULSEAUDIO_INCLUDE_DIR
+ NAMES pulse/pulseaudio.h
+ DOC "The PulseAudio include directory"
+)
+
+find_library(PULSEAUDIO_LIBRARY
+ NAMES pulse
+ DOC "The PulseAudio library"
+)
+
+if(PULSEAUDIO_INCLUDE_DIR AND EXISTS "${PULSEAUDIO_INCLUDE_DIR}/pulse/version.h")
+ file(STRINGS "${PULSEAUDIO_INCLUDE_DIR}/pulse/version.h" pulse_version_str
+ REGEX "^#define[\t ]+pa_get_headers_version\\(\\)[\t ]+\\(\".*\"\\)")
+
+ string(REGEX REPLACE "^.*pa_get_headers_version\\(\\)[\t ]+\\(\"([^\"]*)\"\\).*$" "\\1"
+ PULSEAUDIO_VERSION_STRING "${pulse_version_str}")
+ unset(pulse_version_str)
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(PulseAudio
+ REQUIRED_VARS PULSEAUDIO_LIBRARY PULSEAUDIO_INCLUDE_DIR
+ VERSION_VAR PULSEAUDIO_VERSION_STRING
+)
diff --git a/cmake/modules/FindVorbis.cmake b/cmake/modules/FindVorbis.cmake
new file mode 100644
index 000000000..0d3d66244
--- /dev/null
+++ b/cmake/modules/FindVorbis.cmake
@@ -0,0 +1,197 @@
+#[=======================================================================[.rst:
+FindVorbis
+----------
+Finds the native vorbis, vorbisenc amd vorbisfile includes and libraries.
+Imported Targets
+^^^^^^^^^^^^^^^^
+This module provides the following imported targets, if found:
+``Vorbis::vorbis``
+ The Vorbis library
+``Vorbis::vorbisenc``
+ The VorbisEnc library
+``Vorbis::vorbisfile``
+ The VorbisFile library
+Result Variables
+^^^^^^^^^^^^^^^^
+This will define the following variables:
+``Vorbis_Vorbis_INCLUDE_DIRS``
+ List of include directories when using vorbis.
+``Vorbis_Enc_INCLUDE_DIRS``
+ List of include directories when using vorbisenc.
+``Vorbis_File_INCLUDE_DIRS``
+ List of include directories when using vorbisfile.
+``Vorbis_Vorbis_LIBRARIES``
+ List of libraries when using vorbis.
+``Vorbis_Enc_LIBRARIES``
+ List of libraries when using vorbisenc.
+``Vorbis_File_LIBRARIES``
+ List of libraries when using vorbisfile.
+``Vorbis_FOUND``
+ True if vorbis and requested components found.
+``Vorbis_Vorbis_FOUND``
+ True if vorbis found.
+``Vorbis_Enc_FOUND``
+ True if vorbisenc found.
+``Vorbis_Enc_FOUND``
+ True if vorbisfile found.
+Cache variables
+^^^^^^^^^^^^^^^
+The following cache variables may also be set:
+``Vorbis_Vorbis_INCLUDE_DIR``
+ The directory containing ``vorbis/vorbis.h``.
+``Vorbis_Enc_INCLUDE_DIR``
+ The directory containing ``vorbis/vorbisenc.h``.
+``Vorbis_File_INCLUDE_DIR``
+ The directory containing ``vorbis/vorbisenc.h``.
+``Vorbis_Vorbis_LIBRARY``
+ The path to the vorbis library.
+``Vorbis_Enc_LIBRARY``
+ The path to the vorbisenc library.
+``Vorbis_File_LIBRARY``
+ The path to the vorbisfile library.
+Hints
+^^^^^
+A user may set ``Vorbis_ROOT`` to a vorbis installation root to tell this module where to look.
+#]=======================================================================]
+
+if (Vorbis_Vorbis_INCLUDE_DIR)
+ # Already in cache, be silent
+ set (Vorbis_FIND_QUIETLY TRUE)
+endif ()
+
+set (Vorbis_Vorbis_FIND_QUIETLY TRUE)
+set (Vorbis_Enc_FIND_QUIETLY TRUE)
+set (Vorbis_File_FIND_QUIETLY TRUE)
+
+find_package (Ogg QUIET)
+
+find_package (PkgConfig QUIET)
+pkg_check_modules (PC_Vorbis_Vorbis QUIET vorbis)
+pkg_check_modules (PC_Vorbis_Enc QUIET vorbisenc)
+pkg_check_modules (PC_Vorbis_File QUIET vorbisfile)
+
+set (Vorbis_VERSION ${PC_Vorbis_Vorbis_VERSION})
+
+find_path (Vorbis_Vorbis_INCLUDE_DIR vorbis/codec.h
+ HINTS
+ ${PC_Vorbis_Vorbis_INCLUDEDIR}
+ ${PC_Vorbis_Vorbis_INCLUDE_DIRS}
+ ${Vorbis_ROOT}
+ )
+
+find_path (Vorbis_Enc_INCLUDE_DIR vorbis/vorbisenc.h
+ HINTS
+ ${PC_Vorbis_Enc_INCLUDEDIR}
+ ${PC_Vorbis_Enc_INCLUDE_DIRS}
+ ${Vorbis_ROOT}
+ )
+
+find_path (Vorbis_File_INCLUDE_DIR vorbis/vorbisfile.h
+ HINTS
+ ${PC_Vorbis_File_INCLUDEDIR}
+ ${PC_Vorbis_File_INCLUDE_DIRS}
+ ${Vorbis_ROOT}
+ )
+
+find_library (Vorbis_Vorbis_LIBRARY
+ NAMES
+ vorbis
+ vorbis_static
+ libvorbis
+ libvorbis_static
+ HINTS
+ ${PC_Vorbis_Vorbis_LIBDIR}
+ ${PC_Vorbis_Vorbis_LIBRARY_DIRS}
+ ${Vorbis_ROOT}
+ )
+
+find_library (Vorbis_Enc_LIBRARY
+ NAMES
+ vorbisenc
+ vorbisenc_static
+ libvorbisenc
+ libvorbisenc_static
+ HINTS
+ ${PC_Vorbis_Enc_LIBDIR}
+ ${PC_Vorbis_Enc_LIBRARY_DIRS}
+ ${Vorbis_ROOT}
+ )
+
+find_library (Vorbis_File_LIBRARY
+ NAMES
+ vorbisfile
+ vorbisfile_static
+ libvorbisfile
+ libvorbisfile_static
+ HINTS
+ ${PC_Vorbis_File_LIBDIR}
+ ${PC_Vorbis_File_LIBRARY_DIRS}
+ ${Vorbis_ROOT}
+ )
+
+include (FindPackageHandleStandardArgs)
+
+if (Vorbis_Vorbis_LIBRARY AND Vorbis_Vorbis_INCLUDE_DIR AND Ogg_FOUND)
+ set (Vorbis_Vorbis_FOUND TRUE)
+endif ()
+
+if (Vorbis_Enc_LIBRARY AND Vorbis_Enc_INCLUDE_DIR AND Vorbis_Vorbis_FOUND)
+ set (Vorbis_Enc_FOUND TRUE)
+endif ()
+
+if (Vorbis_Vorbis_FOUND AND Vorbis_File_LIBRARY AND Vorbis_File_INCLUDE_DIR)
+ set (Vorbis_File_FOUND TRUE)
+endif ()
+
+find_package_handle_standard_args (Vorbis
+ REQUIRED_VARS
+ Vorbis_Vorbis_LIBRARY
+ Vorbis_Vorbis_INCLUDE_DIR
+ Ogg_FOUND
+ HANDLE_COMPONENTS
+ VERSION_VAR Vorbis_VERSION)
+
+
+if (Vorbis_Vorbis_FOUND)
+ set (Vorbis_Vorbis_INCLUDE_DIRS ${VORBIS_INCLUDE_DIR})
+ set (Vorbis_Vorbis_LIBRARIES ${VORBIS_LIBRARY} ${OGG_LIBRARIES})
+ if (NOT TARGET Vorbis::vorbis)
+ add_library (Vorbis::vorbis UNKNOWN IMPORTED)
+ set_target_properties (Vorbis::vorbis PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${Vorbis_Vorbis_INCLUDE_DIR}"
+ IMPORTED_LOCATION "${Vorbis_Vorbis_LIBRARY}"
+ INTERFACE_LINK_LIBRARIES Ogg::ogg
+ )
+ endif ()
+
+ if (Vorbis_Enc_FOUND)
+ set (Vorbis_Enc_INCLUDE_DIRS ${Vorbis_Enc_INCLUDE_DIR})
+ set (Vorbis_Enc_LIBRARIES ${Vorbis_Enc_LIBRARY} ${Vorbis_Enc_LIBRARIES})
+ if (NOT TARGET Vorbis::vorbisenc)
+ add_library (Vorbis::vorbisenc UNKNOWN IMPORTED)
+ set_target_properties (Vorbis::vorbisenc PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${Vorbis_Enc_INCLUDE_DIR}"
+ IMPORTED_LOCATION "${Vorbis_Enc_LIBRARY}"
+ INTERFACE_LINK_LIBRARIES Vorbis::vorbis
+ )
+ endif ()
+ endif ()
+
+ if (Vorbis_File_FOUND)
+ set (Vorbis_File_INCLUDE_DIRS ${Vorbis_File_INCLUDE_DIR})
+ set (Vorbis_File_LIBRARIES ${Vorbis_File_LIBRARY} ${Vorbis_File_LIBRARIES})
+ if (NOT TARGET Vorbis::vorbisfile)
+ add_library (Vorbis::vorbisfile UNKNOWN IMPORTED)
+ set_target_properties (Vorbis::vorbisfile PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${Vorbis_File_INCLUDE_DIR}"
+ IMPORTED_LOCATION "${Vorbis_File_LIBRARY}"
+ INTERFACE_LINK_LIBRARIES Vorbis::vorbis
+ )
+ endif ()
+ endif ()
+
+endif ()
+
+mark_as_advanced (Vorbis_Vorbis_INCLUDE_DIR Vorbis_Vorbis_LIBRARY)
+mark_as_advanced (Vorbis_Enc_INCLUDE_DIR Vorbis_Enc_LIBRARY)
+mark_as_advanced (Vorbis_File_INCLUDE_DIR Vorbis_File_LIBRARY) \ No newline at end of file
diff --git a/cmake/modules/FindlibUsb.cmake b/cmake/modules/FindlibUsb.cmake
new file mode 100644
index 000000000..3dea9f6c9
--- /dev/null
+++ b/cmake/modules/FindlibUsb.cmake
@@ -0,0 +1,48 @@
+if (MSVC)
+ set(WINDOWS_LIBUSB_PATH "$ENV{LIBUSB_PATH}/VS2019/MS64/static")
+
+ # check if we're using something else than 64bit..
+ if (NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
+ set(WINDOWS_LIBUSB_PATH "$ENV{LIBUSB_PATH}/VS2019/MS32/static")
+ endif()
+endif()
+
+if (MINGW)
+ set(WINDOWS_LIBUSB_PATH "$ENV{LIBUSB_PATH}/MinGW64/static")
+ # check if we're using something else than 64bit..
+ if (NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
+ set(WINDOWS_LIBUSB_PATH "$ENV{LIBUSB_PATH}/MinGW32/static")
+ endif()
+endif()
+
+find_library (LIBUSB_LIBRARY
+ NAMES libusb libusb-1.0 usb-1.0
+ PATHS "/usr/lib" "/usr/local/lib/" "${WINDOWS_LIBUSB_PATH}")
+
+find_path (LIBUSB_INCLUDEDIR
+ NAMES libusb.h libusb-1.0.h
+ PATHS "/usr/local/include/" "$ENV{LIBUSB_PATH}/include/libusb-1.0"
+ PATH_SUFFIXES "include" "libusb" "libusb-1.0")
+
+include(FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args(libUsb DEFAULT_MSG
+ LIBUSB_LIBRARY
+ LIBUSB_INCLUDEDIR)
+
+if (LIBUSB_FOUND AND NOT TARGET libUsb::libUsb)
+ add_library(libUsb::libUsb STATIC IMPORTED)
+ set_target_properties(
+ libUsb::libUsb
+ PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${LIBUSB_INCLUDEDIR}"
+ IMPORTED_LOCATION "${LIBUSB_LIBRARY}")
+ if (MSVC OR MINGW)
+ set_target_properties(
+ libUsb::libUsb
+ PROPERTIES
+ IMPORTED_IMPLIB "${LIBUSB_LIBRARY}"
+ )
+ endif()
+endif()
+
diff --git a/cmake/modules/Findudev.cmake b/cmake/modules/Findudev.cmake
new file mode 100644
index 000000000..568cc9ce4
--- /dev/null
+++ b/cmake/modules/Findudev.cmake
@@ -0,0 +1,84 @@
+# - try to find the udev library
+#
+# Cache Variables: (probably not for direct use in your scripts)
+# UDEV_INCLUDE_DIR
+# UDEV_SOURCE_DIR
+# UDEV_LIBRARY
+#
+# Non-cache variables you might use in your CMakeLists.txt:
+# UDEV_FOUND
+# UDEV_INCLUDE_DIRS
+# UDEV_LIBRARIES
+#
+# Requires these CMake modules:
+# FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
+#
+# Original Authors:
+# 2014, Kevin M. Godby <kevin@godby.org>
+# 2021, Ryan Pavlik <ryan.pavlik@collabora.com> <abiryan@ryand.net>
+#
+# Copyright 2014, Kevin M. Godby <kevin@godby.org>
+# Copyright 2021, Collabora, Ltd.
+#
+# SPDX-License-Identifier: BSL-1.0
+#
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+set(UDEV_ROOT_DIR
+ "${UDEV_ROOT_DIR}"
+ CACHE
+ PATH
+ "Directory to search for udev")
+
+if(NOT ANDROID)
+ find_package(PkgConfig QUIET)
+ if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_LIBUDEV QUIET libudev)
+ endif()
+endif()
+
+find_library(UDEV_LIBRARY
+ NAMES
+ udev
+ PATHS
+ ${PC_LIBUDEV_LIBRARY_DIRS}
+ ${PC_LIBUDEV_LIBDIR}
+ HINTS
+ "${UDEV_ROOT_DIR}"
+ PATH_SUFFIXES
+ lib
+ )
+
+get_filename_component(_libdir "${UDEV_LIBRARY}" PATH)
+
+find_path(UDEV_INCLUDE_DIR
+ NAMES
+ libudev.h
+ PATHS
+ ${PC_LIBUDEV_INCLUDE_DIRS}
+ ${PC_LIBUDEV_INCLUDEDIR}
+ HINTS
+ "${_libdir}"
+ "${_libdir}/.."
+ "${UDEV_ROOT_DIR}"
+ PATH_SUFFIXES
+ include
+ )
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(udev
+ DEFAULT_MSG
+ UDEV_LIBRARY
+ UDEV_INCLUDE_DIR
+ )
+
+if(UDEV_FOUND)
+ list(APPEND UDEV_LIBRARIES ${UDEV_LIBRARY})
+ list(APPEND UDEV_INCLUDE_DIRS ${UDEV_INCLUDE_DIR})
+ mark_as_advanced(UDEV_ROOT_DIR)
+endif()
+
+mark_as_advanced(UDEV_INCLUDE_DIR
+ UDEV_LIBRARY)