Skip to content

Commit

Permalink
Apply the set of system JS libraries based on the link settings via a…
Browse files Browse the repository at this point in the history
… code path in shared.Building.
  • Loading branch information
juj committed Dec 7, 2016
1 parent 1b4e784 commit 11e4634
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
7 changes: 2 additions & 5 deletions emcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -943,11 +943,8 @@ def detect_fixed_language_mode(args):
system_js_libraries += shared.Building.path_to_system_js_libraries(lib)

# Certain linker flags imply some link libraries to be pulled in by default.
if 'EMTERPRETIFY_ASYNC=1' in settings_changes: system_js_libraries += ['library_async.js']
if 'ASYNCIFY=1' in settings_changes: system_js_libraries += ['library_async.js']
if 'LZ4=1' in settings_changes: system_js_libraries += ['library_lz4.js']
if 'USE_SDL=1' in settings_changes: system_js_libraries += ['library_sdl.js']
if 'USE_SDL=2' in settings_changes: system_js_libraries += ['library_egl.js', 'library_glut.js', 'library_gl.js']
system_js_libraries += shared.Building.path_to_system_js_libraries_for_settings(settings_changes)

settings_changes.append('SYSTEM_JS_LIBRARIES="' + ','.join(system_js_libraries) + '"')

# If not compiling to JS, then we are compiling to an intermediate bitcode objects or library, so
Expand Down
12 changes: 12 additions & 0 deletions tools/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -2043,6 +2043,18 @@ def path_to_system_js_libraries(library_name):

return library_files

@staticmethod
# Given a list of Emscripten link settings, returns a list of paths to system JS libraries
# that should get linked automatically in to the build when those link settings are present.
def path_to_system_js_libraries_for_settings(link_settings):
system_js_libraries =[]
if 'EMTERPRETIFY_ASYNC=1' in link_settings: system_js_libraries += ['library_async.js']
if 'ASYNCIFY=1' in link_settings: system_js_libraries += ['library_async.js']
if 'LZ4=1' in link_settings: system_js_libraries += ['library_lz4.js']
if 'USE_SDL=1' in link_settings: system_js_libraries += ['library_sdl.js']
if 'USE_SDL=2' in link_settings: system_js_libraries += ['library_egl.js', 'library_glut.js', 'library_gl.js']
return system_js_libraries

# compatibility with existing emcc, etc. scripts
Cache = cache.Cache(debug=DEBUG_CACHE)
chunkify = cache.chunkify
Expand Down

0 comments on commit 11e4634

Please sign in to comment.