Explorar o código

Add new CMake module to detect PulseAudio development library.
[ccache clear] [ci only: RPI]

Yao Wei Tjong 姚伟忠 %!s(int64=10) %!d(string=hai) anos
pai
achega
510f7e31df
Modificáronse 2 ficheiros con 50 adicións e 8 borrados
  1. 44 0
      CMake/Modules/FindPulseAudio.cmake
  2. 6 8
      Source/ThirdParty/SDL/CMakeLists.txt

+ 44 - 0
CMake/Modules/FindPulseAudio.cmake

@@ -0,0 +1,44 @@
+#
+# Copyright (c) 2008-2015 the Urho3D project.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+
+# Find PulseAudio development library
+#
+#  PA_FOUND
+#  PA_INCLUDE_DIRS
+#  PA_LIBRARIES
+#  PA_VERSION
+#
+
+find_path (PA_INCLUDE_DIRS NAMES pulse/pulseaudio.h DOC "PulseAudio include directories")
+find_library (PA_LIBRARIES NAMES pulse-simple DOC "PulseAudio libraries")
+
+if (PA_INCLUDE_DIRS AND PA_LIBRARIES)
+    set (PA_FOUND 1)
+endif ()
+if (PA_FOUND)
+    include (FindPackageMessage)
+    find_package_message (BCM_VC "Found PulseAudio: ${PA_LIBRARIES} ${PA_INCLUDE_DIRS}" "[${PA_LIBRARIES}][${PA_INCLUDE_DIRS}]")
+elseif (PulseAudio_FIND_REQUIRED)
+    message (FATAL_ERROR "Could not find PulseAudio")
+endif ()
+
+mark_as_advanced (PA_INCLUDE_DIRS PA_LIBRARIES PA_VERSION)

+ 6 - 8
Source/ThirdParty/SDL/CMakeLists.txt

@@ -127,14 +127,12 @@ else ()
     # end todo
     include_directories (${ALSA_INCLUDE_DIRS})
 
-    # FIXME: There is a flaw in the current detection logic for PulseAudio development library as it actually only detects its presense in the host/build system which does not mean anything when we are cross-compiling
-    if (NOT CMAKE_CROSSCOMPILING)
-        include (FindPkgConfig)
-        pkg_check_modules (PKG_PULSEAUDIO libpulse-simple)
-        if (PKG_PULSEAUDIO_FOUND)
-          add_definitions (-DSDL_AUDIO_DRIVER_PULSEAUDIO=1 -DSDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC="libpulse-simple.so")
-          file (GLOB PULSEAUDIO_SOURCES src/audio/pulseaudio/*.c)
-        endif ()
+    find_package (PulseAudio)
+    if (PA_FOUND)
+      include_directories (${PA_INCLUDE_DIRS})
+      get_filename_component (PA_SIMPLE ${PA_LIBRARIES} NAME)
+      add_definitions (-DSDL_AUDIO_DRIVER_PULSEAUDIO=1 -DSDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC="${PA_SIMPLE}")
+      file (GLOB PULSEAUDIO_SOURCES src/audio/pulseaudio/*.c)
     endif ()
 
     file (GLOB SYS_C_FILES