mirror of
https://github.com/ZDoom/zdoom-macos-deps.git
synced 2025-01-21 07:30:47 +00:00
wip
This commit is contained in:
parent
589b09fc1e
commit
4cb1d44dbe
6 changed files with 134 additions and 21 deletions
|
@ -287,7 +287,11 @@ class Sdl2MixerTarget(base.CMakeStaticDependencyTarget):
|
|||
base_url = 'https://github.com/libsdl-org/SDL_mixer/releases/download'
|
||||
state.download_source(
|
||||
f'{base_url}/release-{self.version}/SDL2_mixer-{self.version}.tar.gz',
|
||||
'7a6ba86a478648ce617e3a5e9277181bc67f7ce9876605eea6affd4a0d6eea8f')
|
||||
'7a6ba86a478648ce617e3a5e9277181bc67f7ce9876605eea6affd4a0d6eea8f',
|
||||
patches='sdl2_mixer-fix-opusfile')
|
||||
|
||||
os.unlink(state.source / 'cmake/Findopusfile.cmake')
|
||||
shutil.copy2(state.patch_path / 'FindOpusFile.cmake', state.source / 'cmake/FindOpusFile.cmake')
|
||||
|
||||
def configure(self, state: BuildState):
|
||||
opts = state.options
|
||||
|
|
|
@ -1,37 +1,37 @@
|
|||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_library(opusfile_LIBRARY
|
||||
find_library(OpusFile_LIBRARY
|
||||
NAMES opusfile
|
||||
)
|
||||
|
||||
set(opusfile_COMPILE_OPTIONS "" CACHE STRING "Extra compile options of opusfile")
|
||||
set(OpusFile_COMPILE_OPTIONS "" CACHE STRING "Extra compile options of opusfile")
|
||||
|
||||
set(opusfile_LINK_LIBRARIES "" CACHE STRING "Extra link libraries of opusfile")
|
||||
set(OpusFile_LINK_LIBRARIES "" CACHE STRING "Extra link libraries of opusfile")
|
||||
|
||||
set(opusfile_LINK_FLAGS "" CACHE STRING "Extra link flags of opusfile")
|
||||
set(OpusFile_LINK_FLAGS "" CACHE STRING "Extra link flags of opusfile")
|
||||
|
||||
find_path(opusfile_INCLUDE_PATH
|
||||
find_path(OpusFile_INCLUDE_PATH
|
||||
NAMES opusfile.h
|
||||
PATH_SUFFIXES opus
|
||||
)
|
||||
|
||||
find_package_handle_standard_args(opusfile
|
||||
REQUIRED_VARS opusfile_LIBRARY opusfile_INCLUDE_PATH
|
||||
find_package_handle_standard_args(OpusFile
|
||||
REQUIRED_VARS OpusFile_LIBRARY OpusFile_INCLUDE_PATH
|
||||
)
|
||||
|
||||
if (opusfile_FOUND)
|
||||
set(opusfile_dirs ${opusfile_INCLUDE_PATH})
|
||||
if(EXISTS "${opusfile_INCLUDE_PATH}/opus")
|
||||
list(APPEND opusfile_dirs "${opusfile_INCLUDE_PATH}/opus")
|
||||
if (OpusFile_FOUND)
|
||||
set(OpusFile_dirs ${OpusFile_INCLUDE_PATH})
|
||||
if(EXISTS "${OpusFile_INCLUDE_PATH}/opus")
|
||||
list(APPEND OpusFile_dirs "${OpusFile_INCLUDE_PATH}/opus")
|
||||
endif()
|
||||
if (NOT TARGET opusfile::opusfile)
|
||||
add_library(opusfile::opusfile UNKNOWN IMPORTED)
|
||||
set_target_properties(opusfile::opusfile PROPERTIES
|
||||
IMPORTED_LOCATION "${opusfile_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${opusfile_dirs}"
|
||||
INTERFACE_COMPILE_OPTIONS "${opusfile_COMPILE_OPTIONS}"
|
||||
INTERFACE_LINK_LIBRARIES "${opusfile_LINK_LIBRARIES}"
|
||||
INTERFACE_LINK_FLAGS "${opusfile_LINK_FLAGS}"
|
||||
if (NOT TARGET OpusFile::opusfile)
|
||||
add_library(OpusFile::opusfile UNKNOWN IMPORTED)
|
||||
set_target_properties(OpusFile::opusfile PROPERTIES
|
||||
IMPORTED_LOCATION "${OpusFile_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${OpusFile_dirs}"
|
||||
INTERFACE_COMPILE_OPTIONS "${OpusFile_COMPILE_OPTIONS}"
|
||||
INTERFACE_LINK_LIBRARIES "${OpusFile_LINK_LIBRARIES}"
|
||||
INTERFACE_LINK_FLAGS "${OpusFile_LINK_FLAGS}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
@ -60,7 +60,7 @@ add_library(SDL2_mixer::SDL2_mixer-static STATIC IMPORTED)
|
|||
|
||||
set_target_properties(SDL2_mixer::SDL2_mixer-static PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include/SDL2"
|
||||
INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:>;\$<LINK_ONLY:opusfile::opusfile>;\$<LINK_ONLY:vorbisfile::vorbisfile>;\$<LINK_ONLY:FLAC>;\$<LINK_ONLY:modplug::modplug>;\$<LINK_ONLY:libxmp::libxmp>;\$<LINK_ONLY:MPG123::mpg123>;\$<LINK_ONLY:FluidSynth::FluidSynth>"
|
||||
INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:>;\$<LINK_ONLY:OpusFile::opusfile>;\$<LINK_ONLY:vorbisfile::vorbisfile>;\$<LINK_ONLY:FLAC>;\$<LINK_ONLY:modplug::modplug>;\$<LINK_ONLY:libxmp::libxmp>;\$<LINK_ONLY:MPG123::mpg123>;\$<LINK_ONLY:FluidSynth::FluidSynth>"
|
||||
)
|
||||
|
||||
if(CMAKE_VERSION VERSION_LESS 2.8.12)
|
||||
|
|
|
@ -85,6 +85,10 @@ include(CMakeFindDependencyMacro)
|
|||
find_dependency(vorbisfile)
|
||||
endif()
|
||||
|
||||
if(SDL2MIXER_OPUS AND NOT SDL2MIXER_VENDORED AND NOT TARGET opusfile::opusfile)
|
||||
find_dependency(OpusFile)
|
||||
endif()
|
||||
|
||||
if((NOT SDL2MIXER_VENDORED AND SDL2MIXER_MOD_MODPLUG) OR (HAIKU AND SDL2MIXER_MIDI_NATIVE))
|
||||
include(CheckLanguage)
|
||||
check_language(CXX)
|
||||
|
|
37
patch/FindOpusFile.cmake
Normal file
37
patch/FindOpusFile.cmake
Normal file
|
@ -0,0 +1,37 @@
|
|||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_library(OpusFile_LIBRARY
|
||||
NAMES opusfile
|
||||
)
|
||||
|
||||
set(OpusFile_COMPILE_OPTIONS "" CACHE STRING "Extra compile options of opusfile")
|
||||
|
||||
set(OpusFile_LINK_LIBRARIES "" CACHE STRING "Extra link libraries of opusfile")
|
||||
|
||||
set(OpusFile_LINK_FLAGS "" CACHE STRING "Extra link flags of opusfile")
|
||||
|
||||
find_path(OpusFile_INCLUDE_PATH
|
||||
NAMES opusfile.h
|
||||
PATH_SUFFIXES opus
|
||||
)
|
||||
|
||||
find_package_handle_standard_args(OpusFile
|
||||
REQUIRED_VARS OpusFile_LIBRARY OpusFile_INCLUDE_PATH
|
||||
)
|
||||
|
||||
if (OpusFile_FOUND)
|
||||
set(OpusFile_dirs ${OpusFile_INCLUDE_PATH})
|
||||
if(EXISTS "${OpusFile_INCLUDE_PATH}/opus")
|
||||
list(APPEND OpusFile_dirs "${OpusFile_INCLUDE_PATH}/opus")
|
||||
endif()
|
||||
if (NOT TARGET OpusFile::opusfile)
|
||||
add_library(OpusFile::opusfile UNKNOWN IMPORTED)
|
||||
set_target_properties(OpusFile::opusfile PROPERTIES
|
||||
IMPORTED_LOCATION "${OpusFile_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${OpusFile_dirs}"
|
||||
INTERFACE_COMPILE_OPTIONS "${OpusFile_COMPILE_OPTIONS}"
|
||||
INTERFACE_LINK_LIBRARIES "${OpusFile_LINK_LIBRARIES}"
|
||||
INTERFACE_LINK_FLAGS "${OpusFile_LINK_FLAGS}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
68
patch/sdl2_mixer-fix-opusfile.diff
Normal file
68
patch/sdl2_mixer-fix-opusfile.diff
Normal file
|
@ -0,0 +1,68 @@
|
|||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -369,8 +369,8 @@
|
||||
)
|
||||
target_include_directories(SDL2_mixer PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
|
||||
- if(NOT TARGET opusfile::opusfile)
|
||||
- add_library(opusfile::opusfile ALIAS opusfile)
|
||||
+ if(NOT TARGET OpusFile::opusfile)
|
||||
+ add_library(OpusFile::opusfile ALIAS opusfile)
|
||||
endif()
|
||||
if(SDL2MIXER_OPUS_SHARED OR NOT SDL2MIXER_BUILD_SHARED_LIBS)
|
||||
list(APPEND INSTALL_EXTRA_TARGETS opus opusfile)
|
||||
@@ -380,25 +380,25 @@
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Using system opusfile")
|
||||
- find_package(opusfile REQUIRED)
|
||||
+ find_package(OpusFile REQUIRED)
|
||||
if(NOT SDL2MIXER_OPUS_SHARED)
|
||||
list(APPEND PC_REQUIRES opusfile)
|
||||
endif()
|
||||
endif()
|
||||
if(SDL2MIXER_OPUS_SHARED)
|
||||
target_include_directories(SDL2_mixer PRIVATE
|
||||
- $<TARGET_PROPERTY:opusfile::opusfile,INCLUDE_DIRECTORIES>
|
||||
- $<TARGET_PROPERTY:opusfile::opusfile,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
- $<TARGET_PROPERTY:opusfile::opusfile,INTERFACE_SYSTEM_INCLUDE_DIRECTORIES>
|
||||
+ $<TARGET_PROPERTY:OpusFile::opusfile,INCLUDE_DIRECTORIES>
|
||||
+ $<TARGET_PROPERTY:OpusFile::opusfile,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
+ $<TARGET_PROPERTY:OpusFile::opusfile,INTERFACE_SYSTEM_INCLUDE_DIRECTORIES>
|
||||
)
|
||||
- target_get_dynamic_library(dynamic_opusfile opusfile::opusfile)
|
||||
+ target_get_dynamic_library(dynamic_opusfile OpusFile::opusfile)
|
||||
message(STATUS "Dynamic opus (opusfile): ${dynamic_opusfile}")
|
||||
target_compile_definitions(SDL2_mixer PRIVATE "OPUS_DYNAMIC=\"${dynamic_opusfile}\"")
|
||||
if(SDL2MIXER_VENDORED)
|
||||
- add_dependencies(SDL2_mixer opusfile::opusfile)
|
||||
+ add_dependencies(SDL2_mixer OpusFile::opusfile)
|
||||
endif()
|
||||
else()
|
||||
- target_link_libraries(SDL2_mixer PRIVATE opusfile::opusfile)
|
||||
+ target_link_libraries(SDL2_mixer PRIVATE OpusFile::opusfile)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -851,7 +851,7 @@
|
||||
cmake/Findlibxmp.cmake
|
||||
cmake/Findlibxmp-lite.cmake
|
||||
cmake/Findmodplug.cmake
|
||||
- cmake/Findopusfile.cmake
|
||||
+ cmake/FindOpusFile.cmake
|
||||
cmake/FindMPG123.cmake
|
||||
cmake/FindVorbis.cmake
|
||||
cmake/Findtremor.cmake
|
||||
--- a/SDL2_mixerConfig.cmake.in
|
||||
+++ b/SDL2_mixerConfig.cmake.in
|
||||
@@ -85,6 +85,10 @@
|
||||
find_dependency(vorbisfile)
|
||||
endif()
|
||||
|
||||
+ if(SDL2MIXER_OPUS AND NOT SDL2MIXER_VENDORED AND NOT TARGET opusfile::opusfile)
|
||||
+ find_dependency(OpusFile)
|
||||
+ endif()
|
||||
+
|
||||
if((NOT SDL2MIXER_VENDORED AND SDL2MIXER_MOD_MODPLUG) OR (HAIKU AND SDL2MIXER_MIDI_NATIVE))
|
||||
include(CheckLanguage)
|
||||
check_language(CXX)
|
Loading…
Reference in a new issue