Skip to content

Commit

Permalink
[temp] Manually find Ogg/Vorbis when using system libs
Browse files Browse the repository at this point in the history
Revert once resolved:

ValveSoftware/steam-runtime#735
  • Loading branch information
Gelmo committed Jan 10, 2025
1 parent d403e5b commit 56a20dc
Showing 1 changed file with 50 additions and 3 deletions.
53 changes: 50 additions & 3 deletions source/extern/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,23 @@ endif()


if(USE_SYSTEM_OGG)
find_package(Ogg REQUIRED GLOBAL)
if(OGG_INCLUDE_DIR)
# Already in cache, be silent
set(OGG_FIND_QUIETLY TRUE)
endif(OGG_INCLUDE_DIR)
find_path(OGG_INCLUDE_DIR ogg/ogg.h PATH_SUFFIXES include)
# 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)
# 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 DEFAULT_MSG OGG_INCLUDE_DIR OGG_LIBRARY)

set(OGG_LIBRARIES ${OGG_LIBRARY})

mark_as_advanced(OGG_INCLUDE_DIR)
mark_as_advanced(OGG_LIBRARY)
else()
add_subdirectory(ogg)
set_target_properties(ogg PROPERTIES FOLDER extern)
Expand All @@ -53,15 +69,46 @@ endif()


if(USE_SYSTEM_VORBIS)
find_package(Vorbis REQUIRED GLOBAL)
if(VORBIS_INCLUDE_DIR)
# Already in cache, be silent
set(VORBIS_FIND_QUIETLY TRUE)
endif(VORBIS_INCLUDE_DIR)

find_package(Ogg)
if(OGG_FOUND)
find_path(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h PATH_SUFFIXES include)
# MSVC built vorbis may be named vorbis_static
# The provided project files name the library with the lib prefix.
find_library(VORBIS_LIBRARY NAMES vorbis vorbis_static libvorbis libvorbis_static)
if (NOT ${VORBIS_LIBRARY} MATCHES ".framework")
find_library(VORBISFILE_LIBRARY NAMES vorbisfile vorbisfile_static libvorbisfile libvorbisfile_static)
else()
set(VORBISFILE_LIBRARY ${VORBIS_LIBRARY})
endif()
# Handle the QUIETLY and REQUIRED arguments and set VORBIS_FOUND
# to TRUE if all listed variables are TRUE.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Vorbis DEFAULT_MSG
VORBIS_INCLUDE_DIR
VORBIS_LIBRARY VORBISFILE_LIBRARY)
endif(OGG_FOUND)

if(VORBIS_FOUND)
set(VORBIS_LIBRARIES ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY}
${OGG_LIBRARY})
else(VORBIS_FOUND)
set(VORBIS_LIBRARIES)
endif(VORBIS_FOUND)

mark_as_advanced(VORBIS_INCLUDE_DIR)
mark_as_advanced(VORBIS_LIBRARY VORBISFILE_LIBRARY)
else()
if(NOT USE_SYSTEM_OGG)
set(OGG_LIBRARY ogg)
set(OGG_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ogg/include)
endif()
add_subdirectory(vorbis)
endif()


if (USE_SYSTEM_OPENAL)
find_package(OpenAL REQUIRED GLOBAL)
Expand Down

0 comments on commit 56a20dc

Please sign in to comment.