aedi: ability to build sdl2 with metal and vulkan support

This commit is contained in:
alexey.lysiuk 2021-09-12 10:55:57 +03:00
parent 43e9451e64
commit 9a2c979cd4

View file

@ -460,21 +460,34 @@ class Sdl2Target(CMakeStaticDependencyTarget):
'https://libsdl.org/release/SDL2-2.0.16.tar.gz', 'https://libsdl.org/release/SDL2-2.0.16.tar.gz',
'65be9ff6004034b5b2ce9927b5a4db1814930f169c4b2dae0a1e4697075f287b') '65be9ff6004034b5b2ce9927b5a4db1814930f169c4b2dae0a1e4697075f287b')
FRAMEWORKS = None
LINKER_FLAGS = None
def configure(self, state: BuildState): def configure(self, state: BuildState):
# Need to have uniform settings for x86_64 and arm64 because of linking with Metal framework if not Sdl2Target.FRAMEWORKS:
# TODO: Remove this when default target for x64 will become 10.11+ # Need to have uniform settings for x86_64 and arm64 because of linking with Metal framework
opts = state.options Sdl2Target.FRAMEWORKS = '-framework AudioToolbox -framework AVFoundation -framework Carbon' \
opts['VIDEO_VULKAN'] = 'NO' ' -framework Cocoa -framework CoreAudio -framework CoreVideo' \
opts['VIDEO_METAL'] = 'NO' ' -framework ForceFeedback -framework Foundation -framework IOKit'
opts['RENDER_METAL'] = 'NO'
support_metal = False
if sdk_version := state.sdk_version():
if sdk_version >= StrictVersion('10.11'):
support_metal = True
if support_metal:
Sdl2Target.FRAMEWORKS += ' -weak_framework Metal -weak_framework QuartzCore'
else:
opts = state.options
opts['VIDEO_VULKAN'] = 'NO'
opts['VIDEO_METAL'] = 'NO'
opts['RENDER_METAL'] = 'NO'
Sdl2Target.LINKER_FLAGS = ' -L${libdir} -lSDL2 ' + Sdl2Target.FRAMEWORKS + os.linesep
super().configure(state) super().configure(state)
FRAMEWORKS = '-framework AudioToolbox -framework AVFoundation -framework Carbon' \
' -framework Cocoa -framework CoreAudio -framework CoreVideo' \
' -framework ForceFeedback -framework Foundation -framework IOKit'
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)