diff --git a/system/bin/sdl2-config b/system/bin/sdl2-config new file mode 100755 index 000000000..f155153fd --- /dev/null +++ b/system/bin/sdl2-config @@ -0,0 +1,13 @@ +#!/usr/bin/env python2 + +import sys + +print >> sys.stderr, 'emscripten sdl2-config called with', ' '.join(sys.argv) + +args = sys.argv[1:] + +if '--cflags' in args or '--libs' in args: + print '-s USE_SDL=2' +elif '--version' in args: + print '2.0.0' + diff --git a/tests/test_other.py b/tests/test_other.py index f2f57c132..c7fee9a39 100644 --- a/tests/test_other.py +++ b/tests/test_other.py @@ -4759,3 +4759,14 @@ Descriptor desc; check('emconfigure', ['./configure'], fail=False) check('emconfigure', ['cmake'], fail=False) + def test_sdl2_config(self): + for args, expected in [ + [['--version'], '2.0.0'], + [['--cflags'], '-s USE_SDL=2'], + [['--libs'], '-s USE_SDL=2'], + [['--cflags', '--libs'], '-s USE_SDL=2'], + ]: + print args, expected + out, err = Popen([PYTHON, path_from_root('system', 'bin', 'sdl2-config')] + args, stdout=PIPE, stderr=PIPE).communicate() + assert expected in out, out +