CMake: Fix a possible build error relating to the SteamAudio example.

Public issue https://github.com/mackron/miniaudio/pull/1135
This commit is contained in:
David Reid
2026-07-11 10:31:50 +10:00
parent 21349ce158
commit a3a0005fca
+12 -6
View File
@@ -414,22 +414,25 @@ endif()
# SteamAudio has an annoying SDK setup. In the lib folder there is a folder for each platform. We need to specify the # SteamAudio has an annoying SDK setup. In the lib folder there is a folder for each platform. We need to specify the
# platform we're compiling for. # platform we're compiling for.
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" MINIAUDIO_PROCESSOR_LOWER)
# Assume 64-bit. Now we need to check if it's for Windows or Linux.
set(STEAMAUDIO_ARCH "")
if(MINIAUDIO_PROCESSOR_LOWER MATCHES "^(x86_64|amd64)$")
if(WIN32) if(WIN32)
set(STEAMAUDIO_ARCH windows-x64) set(STEAMAUDIO_ARCH windows-x64)
else() elseif(UNIX AND NOT APPLE)
set(STEAMAUDIO_ARCH linux-x64) set(STEAMAUDIO_ARCH linux-x64)
endif() endif()
else() elseif(MINIAUDIO_PROCESSOR_LOWER MATCHES "^(x86|i[3-6]86)$")
# Assume 32-bit. Now we need to check if it's for Windows or Linux.
if(WIN32) if(WIN32)
set(STEAMAUDIO_ARCH windows-x86) set(STEAMAUDIO_ARCH windows-x86)
else() elseif(UNIX AND NOT APPLE)
set(STEAMAUDIO_ARCH linux-x86) set(STEAMAUDIO_ARCH linux-x86)
endif() endif()
endif() endif()
if(STEAMAUDIO_ARCH)
# When searching for SteamAudio, we'll support installing it in the external/steamaudio directory. # When searching for SteamAudio, we'll support installing it in the external/steamaudio directory.
set(STEAMAUDIO_FIND_LIBRARY_HINTS) set(STEAMAUDIO_FIND_LIBRARY_HINTS)
list(APPEND STEAMAUDIO_FIND_LIBRARY_HINTS ${CMAKE_CURRENT_SOURCE_DIR}/external/steamaudio/lib/${STEAMAUDIO_ARCH}) list(APPEND STEAMAUDIO_FIND_LIBRARY_HINTS ${CMAKE_CURRENT_SOURCE_DIR}/external/steamaudio/lib/${STEAMAUDIO_ARCH})
@@ -467,6 +470,9 @@ if(STEAMAUDIO_LIBRARY)
else() else()
message(STATUS "SteamAudio not found. miniaudio_engine_steamaudio will be excluded.") message(STATUS "SteamAudio not found. miniaudio_engine_steamaudio will be excluded.")
endif() endif()
else()
message(STATUS "SteamAudio is not supported on ${CMAKE_SYSTEM_PROCESSOR}. miniaudio_engine_steamaudio will be excluded.")
endif()
# Link libraries # Link libraries