1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-22 21:10:01 +00:00

cmake: opus is now optional + libsndfile only when using openal

This commit is contained in:
Anonymous Maarten 2021-01-11 01:29:43 +01:00 committed by shfil
parent d9f6a05b7e
commit b375e20c75
3 changed files with 32 additions and 22 deletions

View file

@ -12,6 +12,7 @@ endif()
set(RE3_AUDIO "OAL" CACHE STRING "Audio") set(RE3_AUDIO "OAL" CACHE STRING "Audio")
option(RE3_WITH_OPUS "Build re3 with opus support" ON) option(RE3_WITH_OPUS "Build re3 with opus support" ON)
option(RE3_WITH_LIBSNDFILE "Build re3 with libsndfile (instead of internal decoder)" OFF)
set_property(CACHE RE3_AUDIO PROPERTY STRINGS ${RE3_AUDIOS}) set_property(CACHE RE3_AUDIO PROPERTY STRINGS ${RE3_AUDIOS})
message(STATUS "RE3_AUDIO = ${RE3_AUDIO} (choices=${RE3_AUDIOS})") message(STATUS "RE3_AUDIO = ${RE3_AUDIO} (choices=${RE3_AUDIOS})")

View file

@ -13,25 +13,26 @@ class Re3Conan(ConanFile):
generators = "cmake", "cmake_find_package" generators = "cmake", "cmake_find_package"
options = { options = {
"audio": ["openal", "miles"], "audio": ["openal", "miles"],
"with_libsndfile": [True, False],
"with_opus": [True, False], "with_opus": [True, False],
} }
default_options = { default_options = {
"audio": "openal", "audio": "openal",
"with_libsndfile": False,
"with_opus": True, "with_opus": True,
"libsndfile:with_external_libs": False, # "libsndfile:with_external_libs": False,
"mpg123:flexible_resampling": False, # "mpg123:flexible_resampling": False,
"mpg123:network": False, # "mpg123:network": False,
"mpg123:icy": False, # "mpg123:icy": False,
"mpg123:id3v2": False, # "mpg123:id3v2": False,
"mpg123:ieeefloat": False, # "mpg123:ieeefloat": False,
"mpg123:layer1": False, # "mpg123:layer1": False,
"mpg123:layer2": False, # "mpg123:layer2": False,
"mpg123:layer3": False, # "mpg123:layer3": False,
"mpg123:moreinfo": False, # "mpg123:moreinfo": False,
"mpg123:seektable": False, # "sdl2:vulkan": False,
"sdl2:vulkan": False, # "sdl2:opengl": True,
"sdl2:opengl": True, # "sdl2:sdl2main": True,
"sdl2:sdl2main": True,
} }
no_copy_source = True no_copy_source = True
@ -42,17 +43,21 @@ class Re3Conan(ConanFile):
except ConanException: except ConanException:
return False return False
def configure(self):
if self.options.audio != "openal":
self.options.with_libsndfile = False
def requirements(self): def requirements(self):
self.requires("librw/{}".format(self.version)) self.requires("librw/{}".format(self.version))
self.requires("mpg123/1.26.4")
if self.options.audio == "openal": if self.options.audio == "openal":
self.requires("openal/1.21.0") self.requires("openal/1.21.0")
elif self.options.audio == "miles":
self.requires("miles-sdk/{}".format(self.version))
if self.options.with_libsndfile:
self.requires("libsndfile/1.0.30")
if self.options.with_opus: if self.options.with_opus:
self.requires("opusfile/0.12") self.requires("opusfile/0.12")
else:
self.requires("mpg123/1.26.4")
self.requires("libsndfile/1.0.30")
if self.options.audio == "miles":
self.requires("miles-sdk/{}".format(self.version))
def export_sources(self): def export_sources(self):
for d in ("cmake", "src"): for d in ("cmake", "src"):

View file

@ -55,19 +55,23 @@ elseif(RE3_AUDIO STREQUAL "MSS")
target_link_libraries(re3 PRIVATE MilesSDK::MilesSDK) target_link_libraries(re3 PRIVATE MilesSDK::MilesSDK)
endif() endif()
find_package(mpg123 REQUIRED)
target_link_libraries(re3 PRIVATE
MPG123::libmpg123
)
if(RE3_WITH_OPUS) if(RE3_WITH_OPUS)
find_package(opusfile REQUIRED) find_package(opusfile REQUIRED)
target_link_libraries(re3 PRIVATE target_link_libraries(re3 PRIVATE
opusfile::opusfile opusfile::opusfile
) )
target_compile_definitions(re3 PRIVATE AUDIO_OPUS) target_compile_definitions(re3 PRIVATE AUDIO_OPUS)
else() endif()
find_package(mpg123 REQUIRED) if(RE3_WITH_LIBSNDFILE)
find_package(SndFile REQUIRED) find_package(SndFile REQUIRED)
target_link_libraries(re3 PRIVATE target_link_libraries(re3 PRIVATE
MPG123::libmpg123
SndFile::SndFile SndFile::SndFile
) )
target_compile_definitions(re3 PRIVATE AUDIO_OAL_USE_SNDFILE)
endif() endif()
target_compile_definitions(re3 PRIVATE ) target_compile_definitions(re3 PRIVATE )