SCsub 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/usr/bin/env python
  2. Import('env')
  3. javascript_files = [
  4. 'audio_driver_javascript.cpp',
  5. 'http_client_javascript.cpp',
  6. 'javascript_eval.cpp',
  7. 'javascript_main.cpp',
  8. 'os_javascript.cpp',
  9. ]
  10. build = env.add_program(['#bin/godot${PROGSUFFIX}.js', '#bin/godot${PROGSUFFIX}.wasm'], javascript_files);
  11. js, wasm = build
  12. js_libraries = [
  13. 'http_request.js',
  14. ]
  15. for lib in js_libraries:
  16. env.Append(LINKFLAGS=['--js-library', env.File(lib).path])
  17. env.Depends(build, js_libraries)
  18. wrapper_start = env.File('pre.js')
  19. wrapper_end = env.File('engine.js')
  20. js_wrapped = env.Textfile('#bin/godot', [wrapper_start, js, wrapper_end], TEXTFILESUFFIX='${PROGSUFFIX}.wrapped.js')
  21. zip_dir = env.Dir('#bin/.javascript_zip')
  22. zip_files = env.InstallAs([
  23. zip_dir.File('godot.js'),
  24. zip_dir.File('godot.wasm'),
  25. zip_dir.File('godot.html')
  26. ], [
  27. js_wrapped,
  28. wasm,
  29. '#misc/dist/html/full-size.html'
  30. ])
  31. env.Zip('#bin/godot', zip_files, ZIPROOT=zip_dir, ZIPSUFFIX='${PROGSUFFIX}${ZIPSUFFIX}', ZIPCOMSTR='Archving $SOURCES as $TARGET')