Add cmake flag to use system-provided miniaudio (#4867)

Example usage: `cmake -DUSE_SYSTEM_MINIAUDIO=ON ..`
This commit is contained in:
Christian 2023-10-04 15:38:53 +02:00 committed by GitHub
parent 86c2a070cc
commit 5d5d265ae0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 1 deletions

View file

@ -31,6 +31,7 @@
- Dev: Fixed flickering when running with Direct2D on Windows. (#4851)
- Dev: Fix qtkeychain include for Qt6 users. (#4863)
- Dev: Add a compile-time flag `CHATTERINO_UPDATER` which can be turned off to disable update checks. (#4854)
- Dev: Add a compile-time flag `USE_SYSTEM_MINIAUDIO` which can be turned on to use the system miniaudio. (#4867)
## 2.4.6

View file

@ -17,6 +17,7 @@ option(USE_SYSTEM_PAJLADA_SETTINGS "Use system pajlada settings library" OFF)
option(USE_SYSTEM_LIBCOMMUNI "Use system communi library" OFF)
option(USE_SYSTEM_QTKEYCHAIN "Use system QtKeychain library" OFF)
option(BUILD_WITH_QTKEYCHAIN "Build Chatterino with support for your system key chain" ON)
option(USE_SYSTEM_MINIAUDIO "Build Chatterino with your system miniaudio" OFF)
option(BUILD_WITH_CRASHPAD "Build chatterino with crashpad" OFF)
option(USE_PRECOMPILED_HEADERS "Use precompiled headers" ON)
option(BUILD_WITH_QT6 "Use Qt6 instead of default Qt5" OFF)

View file

@ -912,7 +912,16 @@ target_include_directories(${LIBRARY_PROJECT} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
target_include_directories(${LIBRARY_PROJECT} PUBLIC ${CMAKE_SOURCE_DIR}/lib/semver/include)
# miniaudio dependency https://github.com/mackron/miniaudio
if (USE_SYSTEM_MINIAUDIO)
message(STATUS "Building with system miniaudio")
include(CheckIncludeFileCXX)
CHECK_INCLUDE_FILE_CXX("miniaudio.h" MINIAUDIO_FOUND)
if (NOT MINIAUDIO_FOUND)
message(FATAL_ERROR "miniaudio.h not found on your system")
endif()
else ()
target_include_directories(${LIBRARY_PROJECT} PUBLIC ${CMAKE_SOURCE_DIR}/lib/miniaudio)
endif ()
if (UNIX)
if (CMAKE_DL_LIBS)