From 55626711df57e3f675935fb816022da242d023a6 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Tue, 30 Jul 2013 15:53:47 -0700 Subject: [PATCH] disable asm in embind mode, and add a test for what embind cannot do in asm mode yet; issue #1447 --- emcc | 4 ++++ tests/runner.py | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/emcc b/emcc index 91b109b6e..46dca960d 100755 --- a/emcc +++ b/emcc @@ -1030,6 +1030,10 @@ try: exec('shared.Settings.' + key + ' = ' + value) # Apply effects from settings + if bind and shared.Settings.ASM_JS: + logging.warning('disabling asm.js since embind is not ready for it yet') + shared.Settings.ASM_JS = 0 + if shared.Settings.ASM_JS: assert opt_level >= 1, 'asm.js requires -O1 or above' diff --git a/tests/runner.py b/tests/runner.py index 47e18ed7e..976772ce8 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -9332,6 +9332,26 @@ def process(filename): ''' self.do_run(src, 'abs(-10): 10\nabs(-11): 11'); + def test_embind_2(self): + if self.emcc_args is None: return self.skip('requires emcc') + Building.COMPILER_TEST_OPTS += ['--bind', '--post-js', 'post.js'] + open('post.js', 'w').write(''' + Module.print('lerp ' + Module.lerp(1, 2, 0.66) + '.'); + ''') + src = r''' + #include + #include + #include + using namespace emscripten; + float lerp(float a, float b, float t) { + return (1 - t) * a + t * b; + } + EMSCRIPTEN_BINDINGS(my_module) { + function("lerp", &lerp); + } + ''' + self.do_run(src, 'lerp 1.66'); + def test_scriptaclass(self): if self.emcc_args is None: return self.skip('requires emcc')