mirror of
https://github.com/ZDoom/zdoom-macos-deps.git
synced 2024-11-10 14:41:43 +00:00
aedi: improve sdl2 cmake files patching
This commit is contained in:
parent
2f1246c190
commit
f8935b4f1d
1 changed files with 16 additions and 10 deletions
|
@ -227,29 +227,35 @@ class Sdl2Target(CMakeStaticDependencyTarget):
|
||||||
def detect(self, state: BuildState) -> bool:
|
def detect(self, state: BuildState) -> bool:
|
||||||
return os.path.exists(state.source + 'sdl2.pc.in')
|
return os.path.exists(state.source + 'sdl2.pc.in')
|
||||||
|
|
||||||
LINKER_FLAGS = ' -L${libdir} -lSDL2'\
|
FRAMEWORKS = '-framework AudioToolbox -framework AVFoundation -framework Carbon -framework Cocoa' \
|
||||||
' -framework AudioToolbox -framework AVFoundation -framework Carbon -framework Cocoa'\
|
' -framework CoreAudio -framework CoreFoundation -framework CoreVideo' \
|
||||||
' -framework CoreAudio -framework CoreFoundation -framework CoreVideo'\
|
' -framework ForceFeedback -framework Foundation -framework IOKit'
|
||||||
' -framework ForceFeedback -framework Foundation -framework IOKit\n'
|
LINKER_FLAGS = ' -L${libdir} -lSDL2 ' + FRAMEWORKS + os.linesep
|
||||||
|
|
||||||
def post_build(self, state: BuildState):
|
def post_build(self, state: BuildState):
|
||||||
super().post_build(state)
|
super().post_build(state)
|
||||||
|
|
||||||
def update_libs_sdl2_config(line: str):
|
self.make_platform_header(state, 'SDL2/SDL_config.h')
|
||||||
|
|
||||||
|
def update_sdl2_config(line: str):
|
||||||
if line.startswith(' echo -L${exec_prefix}/lib'):
|
if line.startswith(' echo -L${exec_prefix}/lib'):
|
||||||
return ' echo' + Sdl2Target.LINKER_FLAGS
|
return ' echo' + Sdl2Target.LINKER_FLAGS
|
||||||
|
|
||||||
return line
|
return line
|
||||||
|
|
||||||
def update_libs_targets_cmake(line: str):
|
self.update_prefix_shell_script(state.install_path + '/bin/sdl2-config', update_sdl2_config)
|
||||||
|
|
||||||
|
def update_targets_cmake(line: str):
|
||||||
if line.startswith(' INTERFACE_LINK_LIBRARIES '):
|
if line.startswith(' INTERFACE_LINK_LIBRARIES '):
|
||||||
return ' INTERFACE_LINK_LIBRARIES ' + Sdl2Target.LINKER_FLAGS
|
return f' INTERFACE_LINK_LIBRARIES "{Sdl2Target.FRAMEWORKS}"\n'
|
||||||
|
else:
|
||||||
|
line = line.replace('SDL2::SDL2-static', 'SDL2::SDL2')
|
||||||
|
|
||||||
return line
|
return line
|
||||||
|
|
||||||
self.update_prefix_shell_script(state.install_path + '/bin/sdl2-config', update_libs_sdl2_config)
|
for suffix in ('', '-release'):
|
||||||
self.update_text_file(state.install_path + '/lib/cmake/SDL2/SDL2Targets.cmake', update_libs_targets_cmake)
|
file_path = f'{state.install_path}/lib/cmake/SDL2/SDL2Targets{suffix}.cmake'
|
||||||
self.make_platform_header(state, 'SDL2/SDL_config.h')
|
self.update_text_file(file_path, update_targets_cmake)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _process_pkg_config(pcfile: str, line: str) -> str:
|
def _process_pkg_config(pcfile: str, line: str) -> str:
|
||||||
|
|
Loading…
Reference in a new issue