Add WASM build target for Web version of glslang

This adds build rules to support generating a WASM binary to be used
on the web. The API exposed to web applications is definated in the
new glslang.js.cpp file.
This commit is contained in:
Ryan Harrison 2019-08-08 13:50:13 -04:00
parent 3cea2e5882
commit c96e42dca8
4 changed files with 336 additions and 0 deletions

View file

@ -122,3 +122,15 @@ if(ENABLE_GLSLANG_INSTALL)
install(FILES ${file} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/glslang/${dir})
endforeach()
endif(ENABLE_GLSLANG_INSTALL)
if(ENABLE_GLSLANG_WEB)
add_executable(glslang.js glslang.js.cpp)
glslang_set_link_args(glslang.js)
target_link_libraries(glslang.js glslang SPIRV)
if(EMSCRIPTEN)
set_target_properties(glslang.js PROPERTIES
OUTPUT_NAME "glslang"
SUFFIX ".js"
LINK_FLAGS "--bind")
endif(EMSCRIPTEN)
endif(ENABLE_GLSLANG_WEB)