Skip to content

Commit

Permalink
cmake: fall back to full libsndfile support
Browse files Browse the repository at this point in the history
in case `libsndfile` could not be found via `pkg-config` - e.g. when installed via `brew` in our macOS build pipeline - we can not use version information to determine the support file formats. We assume ideal conditions since version 1.1.0 of libsndfile was released a while ago
  • Loading branch information
theGreatWhiteShark committed Nov 24, 2024
1 parent c4ee123 commit 4bc8b74
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,21 @@ set(LIBSNDFILE_VERSION_FLAC_OGG "1.0.17")
set(LIBSNDFILE_VERSION_OPUS "1.0.28")
set(LIBSNDFILE_VERSION_MP3 "1.0.31")

string(COMPARE GREATER "${PC_LIBSNDFILE_VERSION}" "${LIBSNDFILE_VERSION_FLAC_OGG}" H2CORE_HAVE_FLAC_SUPPORT)
string(COMPARE GREATER "${PC_LIBSNDFILE_VERSION}" "${LIBSNDFILE_VERSION_OPUS}" H2CORE_HAVE_OPUS_SUPPORT)
string(COMPARE GREATER "${PC_LIBSNDFILE_VERSION}" "${LIBSNDFILE_VERSION_MP3}" H2CORE_HAVE_MP3_SUPPORT)
if (DEFINED PC_LIBSNDFILE_VERSION)
string(COMPARE GREATER "${PC_LIBSNDFILE_VERSION}" "${LIBSNDFILE_VERSION_FLAC_OGG}" H2CORE_HAVE_FLAC_SUPPORT)
string(COMPARE GREATER "${PC_LIBSNDFILE_VERSION}" "${LIBSNDFILE_VERSION_OPUS}" H2CORE_HAVE_OPUS_SUPPORT)
string(COMPARE GREATER "${PC_LIBSNDFILE_VERSION}" "${LIBSNDFILE_VERSION_MP3}" H2CORE_HAVE_MP3_SUPPORT)
else()
# Depending on how libsndfile was built and packaged, we can find it using
# pkg-config and use the provided version or have to fall back to another
# discovery scheme with no version information available. But since the
# libsndfile offers MP3 support for quite a while, we are optimistic and
# assume support for all formats in case we have no version.
set(H2CORE_HAVE_FLAC_SUPPORT TRUE)
set(H2CORE_HAVE_OPUS_SUPPORT TRUE)
set(H2CORE_HAVE_MP3_SUPPORT TRUE)
endif()

if(H2CORE_HAVE_FLAC_SUPPORT)
set(LIBSNDFILE_MSG "FLAC: supported, OGG/Vorbis: supported")
else()
Expand Down

0 comments on commit 4bc8b74

Please sign in to comment.