add SDL_PATH env var

This commit is contained in:
dessant 2014-11-08 14:40:41 +02:00
parent 420e468df9
commit 4d31d35b1d
2 changed files with 12 additions and 5 deletions

View File

@ -33,7 +33,7 @@ __version__ = '1.9.0-dev'
import sys
import shutil
from getopt import getopt, GetoptError
from os import environ, mkdir
from os import environ, mkdir, pathsep
from os.path import dirname, join, basename, exists, expanduser
from kivy.logger import Logger, LOG_LEVELS
from kivy.utils import platform
@ -41,6 +41,11 @@ from kivy.utils import platform
# internals for post-configuration
__kivy_post_configuration = []
# Use custom SDL2 libraries and headers if SDL_PATH is set, not the ones
# installed system-wide.
if 'SDL_PATH' in environ:
environ['PATH'] = pathsep.join((environ['SDL_PATH'], environ['PATH']))
if platform == 'macosx' and sys.maxsize < 9223372036854775807:
r = '''Unsupported Python version detected!:

View File

@ -394,14 +394,16 @@ def determine_sdl2():
if not c_options['use_sdl2']:
return flags
sdl2_portable_path = join(dirname(__file__), 'kivy', 'lib', 'sdl2')
sdl2_path = environ['SDL_PATH'] if 'SDL_PATH' in environ else None
flags['libraries'] = ['SDL2', 'SDL2_ttf', 'SDL2_image', 'SDL2_mixer']
flags['include_dirs'] = ['/usr/local/include/SDL2', '/usr/include/SDL2',
sdl2_portable_path]
flags['include_dirs'] = ([sdl2_path] if sdl2_path else
['/usr/local/include/SDL2', '/usr/include/SDL2'])
flags['extra_link_args'] = []
flags['extra_compile_args'] = []
flags['extra_link_args'] += ['-L/usr/local/lib/', '-L' + sdl2_portable_path]
flags['extra_link_args'] += (['-L' + sdl2_path] if sdl2_path else
['-L/usr/local/lib/'])
# ensure headers for all the SDL2 and sub libraries are available
libs_to_check = ['SDL', 'SDL_mixer', 'SDL_ttf', 'SDL_image']