Skip to content

Commit

Permalink
[CMake] Link OpenAL publicly in lib/sound
Browse files Browse the repository at this point in the history
  • Loading branch information
past-due committed Jun 21, 2024
1 parent 4fcfa47 commit 1e6c7ac
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ add_subdirectory(gamelib)
add_subdirectory(ivis_opengl)
add_subdirectory(netplay)
add_subdirectory(sdl)
add_subdirectory(sequence)
add_subdirectory(sound)
add_subdirectory(sequence)
add_subdirectory(widget)
6 changes: 2 additions & 4 deletions lib/sequence/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
file(GLOB HEADERS "*.h")
file(GLOB SRC "*.cpp")

find_package(OpenAL REQUIRED)
find_package(OggVorbis REQUIRED)
find_package(Theora REQUIRED)

add_library(sequence STATIC ${HEADERS} ${SRC})
set_property(TARGET sequence PROPERTY FOLDER "lib")
include(WZTargetConfiguration)
WZ_TARGET_CONFIGURATION(sequence)
target_compile_definitions(sequence PRIVATE "AL_LIBTYPE_STATIC")
target_include_directories(sequence PRIVATE "${OPENAL_INCLUDE_DIR}" ivis-opengl "${OGGVORBIS_INCLUDE_DIR}")
target_link_libraries(sequence PRIVATE framework ${OGGVORBIS_LIBRARIES} theora::dec)
target_include_directories(sequence PRIVATE ivis-opengl "${OGGVORBIS_INCLUDE_DIR}")
target_link_libraries(sequence PRIVATE framework sound ${OGGVORBIS_LIBRARIES} theora::dec)
5 changes: 3 additions & 2 deletions lib/sound/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ endif()
find_package(OpenAL CONFIG ${_openal_config_quiet} ${_openal_config_required}) # explicitly try via CONFIG mode first
if (NOT TARGET OpenAL::OpenAL)
find_package(OpenAL MODULE REQUIRED)
message(STATUS "Found OpenAL using FindModule")
# Since FindOpenAL.cmake may not define an imported target, do it here
if (NOT TARGET OpenAL::OpenAL)
add_library(OpenAL::OpenAL UNKNOWN IMPORTED)
Expand All @@ -37,14 +38,14 @@ add_library(sound STATIC ${HEADERS} ${SRC})
set_property(TARGET sound PROPERTY FOLDER "lib")
include(WZTargetConfiguration)
WZ_TARGET_CONFIGURATION(sound)
target_compile_definitions(sound PRIVATE "-DAL_LIBTYPE_STATIC")
if (HAVE_OPENAL_ALEXT_H)
target_compile_definitions(sound PRIVATE "-DHAVE_OPENAL_ALEXT_H")
endif()
target_include_directories(sound PRIVATE "${OGGVORBIS_INCLUDE_DIR}")
target_link_libraries(sound PRIVATE framework nlohmann_json OpenAL::OpenAL ${OGGVORBIS_LIBRARIES})
target_link_libraries(sound PRIVATE framework nlohmann_json ${OGGVORBIS_LIBRARIES})
target_link_libraries(sound PRIVATE Ogg::ogg Opus::opus)
target_link_libraries(sound PUBLIC optional-lite)
target_link_libraries(sound PUBLIC OpenAL::OpenAL)

# Opusfile
find_package(Opusfile QUIET)
Expand Down

0 comments on commit 1e6c7ac

Please sign in to comment.