Separate GLSLANG_WEB (min-size build) and Emscripten options

Allows building non-min-size builds with Emscripten.
Adds ENABLE_GLSLANG_WEB_DEVEL.
Moves the glslang.js files to OSDependent/Web.
Small cleanups and docs update.
This commit is contained in:
Kai Ninomiya 2019-09-17 23:08:45 -07:00
parent be467db7bd
commit 4391924ac5
7 changed files with 70 additions and 62 deletions

View file

@ -6,6 +6,10 @@ else(WIN32)
message("unknown platform")
endif(WIN32)
if(EMSCRIPTEN OR ENABLE_GLSLANG_WEB)
add_subdirectory(OSDependent/Web)
endif(EMSCRIPTEN OR ENABLE_GLSLANG_WEB)
set(SOURCES
MachineIndependent/glslang.m4
MachineIndependent/glslang.y
@ -114,16 +118,3 @@ 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 -s EXPORT_NAME=\"glslangModule\"")
em_link_pre_js(glslang.js ${CMAKE_CURRENT_SOURCE_DIR}/glslang.pre.js)
endif(EMSCRIPTEN)
endif(ENABLE_GLSLANG_WEB)

View file

@ -0,0 +1,10 @@
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 -s EXPORT_NAME=\"glslangModule\"")
em_link_pre_js(glslang.js "${CMAKE_CURRENT_SOURCE_DIR}/glslang.pre.js")
endif(EMSCRIPTEN)

View file

@ -35,17 +35,16 @@
#include <cstdio>
#include <cstdint>
#include <memory>
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#endif // __EMSCRIPTEN__
#include <memory>
#endif
#include "../SPIRV/GlslangToSpv.h"
#include "../SPIRV/doc.h"
#include "./../glslang/Public/ShaderLang.h"
#include "../../../SPIRV/GlslangToSpv.h"
#include "../../../glslang/Public/ShaderLang.h"
#ifndef EMSCRIPTEN_KEEPALIVE
#ifndef __EMSCRIPTEN__
#define EMSCRIPTEN_KEEPALIVE
#endif

View file

@ -1,4 +1,4 @@
#!/usr/bin/bash
#!/bin/bash
if [ "$1" = 'web' ]
then