Add an option to force a custom search path for SDL2 frameworks + fixes ARCHFLAGS (#7711)

* Allow to force a custom search path for SDL2 frameworks + fixes ARCHFLAGS

* Removes additional flags that were preventing to build a universal2 wheel.
This commit is contained in:
Mirko Galimberti 2021-12-09 18:15:25 +01:00 committed by GitHub
parent 6fcf41729c
commit 6475495300
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 20 deletions

View File

@ -103,11 +103,6 @@ build_examples = build_examples or \
platform = sys.platform
if sys.platform == 'darwin':
from platform import machine
osx_arch = machine()
# Detect Python for android project (http://github.com/kivy/python-for-android)
ndkplatform = environ.get('NDKPLATFORM')
if ndkplatform is not None and environ.get('LIBLINK'):
@ -419,15 +414,6 @@ if platform == 'ios':
elif platform == 'android':
c_options['use_android'] = True
elif platform == 'darwin':
if c_options['use_osx_frameworks']:
if osx_arch == "i386":
print("Warning: building with frameworks fail on i386")
else:
print(f"OSX framework used, force to {osx_arch} only")
environ["ARCHFLAGS"] = environ.get("ARCHFLAGS", f"-arch {osx_arch}")
print("OSX ARCHFLAGS are: {}".format(environ["ARCHFLAGS"]))
# detect gstreamer, only on desktop
# works if we forced the options or in autodetection
if platform not in ('ios', 'android') and (c_options['use_gstreamer']
@ -490,19 +476,22 @@ if c_options['use_sdl2'] or (
sdl2_valid = False
if c_options['use_osx_frameworks'] and platform == 'darwin':
# check the existence of frameworks
sdl2_frameworks_search_path = environ.get(
"KIVY_SDL2_FRAMEWORKS_SEARCH_PATH", "/Library/Frameworks"
)
sdl2_valid = True
sdl2_flags = {
'extra_link_args': [
'-F/Library/Frameworks',
'-F{}'.format(sdl2_frameworks_search_path),
'-Xlinker', '-rpath',
'-Xlinker', '/Library/Frameworks',
'-Xlinker', sdl2_frameworks_search_path,
'-Xlinker', '-headerpad',
'-Xlinker', '190'],
'include_dirs': [],
'extra_compile_args': ['-F/Library/Frameworks']
'extra_compile_args': ['-F{}'.format(sdl2_frameworks_search_path)]
}
for name in ('SDL2', 'SDL2_ttf', 'SDL2_image', 'SDL2_mixer'):
f_path = '/Library/Frameworks/{}.framework'.format(name)
f_path = '{}/{}.framework'.format(sdl2_frameworks_search_path, name)
if not exists(f_path):
print('Missing framework {}'.format(f_path))
sdl2_valid = False
@ -628,8 +617,7 @@ def determine_gl_flags():
flags['libraries'] = ['GLESv2']
flags['extra_link_args'] = ['-framework', 'OpenGLES']
elif platform == 'darwin':
flags['extra_link_args'] = ['-framework', 'OpenGL', '-arch', osx_arch]
flags['extra_compile_args'] = ['-arch', osx_arch]
flags['extra_link_args'] = ['-framework', 'OpenGL']
elif platform.startswith('freebsd'):
flags['libraries'] = ['GL']
elif platform.startswith('openbsd'):