Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
glslang
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
glslang
Commits
ae594356
Unverified
Commit
ae594356
authored
Feb 07, 2020
by
John Kessenich
Committed by
GitHub
Feb 07, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2081 from kainino0x/split-emscripten-from-glslang.js
CMake: Split "is emscripten" config from "enable glslang.js"
parents
95c414ff
5166bc18
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
56 additions
and
42 deletions
+56
-42
CMakeLists.txt
CMakeLists.txt
+29
-27
README.md
README.md
+2
-1
CMakeLists.txt
glslang/CMakeLists.txt
+3
-2
CMakeLists.txt
glslang/OSDependent/Web/CMakeLists.txt
+21
-11
glslang.js.cpp
glslang/OSDependent/Web/glslang.js.cpp
+1
-1
No files found.
CMakeLists.txt
View file @
ae594356
...
...
@@ -32,12 +32,29 @@ option(ENABLE_SPVREMAPPER "Enables building of SPVRemapper" ON)
option
(
ENABLE_GLSLANG_BINARIES
"Builds glslangValidator and spirv-remap"
ON
)
option
(
ENABLE_GLSLANG_WEB
"Reduces glslang to minimum needed for web use"
OFF
)
option
(
ENABLE_GLSLANG_WEB_DEVEL
"For ENABLE_GLSLANG_WEB builds, enables compilation error messages"
OFF
)
option
(
ENABLE_EMSCRIPTEN_SINGLE_FILE
"If using Emscripten, enables SINGLE_FILE build"
OFF
)
option
(
ENABLE_EMSCRIPTEN_ENVIRONMENT_NODE
"If using Emscripten, builds to run on Node instead of Web"
OFF
)
CMAKE_DEPENDENT_OPTION
(
ENABLE_HLSL
"Enables HLSL input support"
ON
"NOT ENABLE_GLSLANG_WEB"
OFF
)
option
(
ENABLE_GLSLANG_JS
"If using Emscripten, build glslang.js. Otherwise, builds a sample executable for binary-size testing."
OFF
)
CMAKE_DEPENDENT_OPTION
(
ENABLE_GLSLANG_WEBMIN
"Reduces glslang to minimum needed for web use"
OFF
"ENABLE_GLSLANG_JS"
OFF
)
CMAKE_DEPENDENT_OPTION
(
ENABLE_GLSLANG_WEBMIN_DEVEL
"For ENABLE_GLSLANG_WEBMIN builds, enables compilation error messages"
OFF
"ENABLE_GLSLANG_WEBMIN"
OFF
)
CMAKE_DEPENDENT_OPTION
(
ENABLE_EMSCRIPTEN_SINGLE_FILE
"If using Emscripten, enables SINGLE_FILE build"
OFF
"ENABLE_GLSLANG_JS AND EMSCRIPTEN"
OFF
)
CMAKE_DEPENDENT_OPTION
(
ENABLE_EMSCRIPTEN_ENVIRONMENT_NODE
"If using Emscripten, builds to run on Node instead of Web"
OFF
"ENABLE_GLSLANG_JS AND EMSCRIPTEN"
OFF
)
CMAKE_DEPENDENT_OPTION
(
ENABLE_HLSL
"Enables HLSL input support"
ON
"NOT ENABLE_GLSLANG_WEBMIN"
OFF
)
option
(
ENABLE_OPT
"Enables spirv-opt capability if present"
ON
)
option
(
ENABLE_PCH
"Enables Precompiled header"
ON
)
...
...
@@ -77,12 +94,12 @@ if(ENABLE_HLSL)
add_definitions
(
-DENABLE_HLSL
)
endif
(
ENABLE_HLSL
)
if
(
ENABLE_GLSLANG_WEB
)
if
(
ENABLE_GLSLANG_WEB
MIN
)
add_definitions
(
-DGLSLANG_WEB
)
if
(
ENABLE_GLSLANG_WEB_DEVEL
)
if
(
ENABLE_GLSLANG_WEB
MIN
_DEVEL
)
add_definitions
(
-DGLSLANG_WEB_DEVEL
)
endif
(
ENABLE_GLSLANG_WEB_DEVEL
)
endif
(
ENABLE_GLSLANG_WEB
)
endif
(
ENABLE_GLSLANG_WEB
MIN
_DEVEL
)
endif
(
ENABLE_GLSLANG_WEB
MIN
)
if
(
WIN32
)
set
(
CMAKE_DEBUG_POSTFIX
"d"
)
...
...
@@ -113,29 +130,14 @@ elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "MSVC")
add_compile_options
(
/GR-
)
# Disable RTTI
endif
()
if
(
EMSCRIPTEN
)
add_compile_options
(
-Os -fno-exceptions
)
add_compile_options
(
"SHELL: -s WASM=1"
)
add_compile_options
(
"SHELL: -s WASM_OBJECT_FILES=0"
)
add_link_options
(
-Os
)
add_link_options
(
"SHELL: -s FILESYSTEM=0"
)
add_link_options
(
"SHELL: --llvm-lto 1"
)
add_link_options
(
"SHELL: --closure 1"
)
add_link_options
(
"SHELL: -s ALLOW_MEMORY_GROWTH=1"
)
if
(
ENABLE_EMSCRIPTEN_SINGLE_FILE
)
add_link_options
(
"SHELL: -s SINGLE_FILE=1"
)
endif
(
ENABLE_EMSCRIPTEN_SINGLE_FILE
)
else
()
if
(
ENABLE_GLSLANG_WEB
)
if
(
ENABLE_GLSLANG_JS
)
if
(
MSVC
)
add_compile_options
(
/Os /GR-
)
else
()
add_compile_options
(
-Os -fno-exceptions
)
add_link_options
(
-Os
)
endif
()
endif
(
ENABLE_GLSLANG_WEB
)
endif
(
EMSCRIPTEN
)
endif
(
ENABLE_GLSLANG_JS
)
# Request C++11
if
(
${
CMAKE_VERSION
}
VERSION_LESS 3.1
)
...
...
README.md
View file @
ae594356
...
...
@@ -182,7 +182,8 @@ Use the steps in [Build Steps](#build-steps), with the following notes/exception
+
execute
`updateGrammar web`
from the glslang subdirectory
(or if using your own scripts,
`m4`
needs a
`-DGLSLANG_WEB`
argument)
+
set
`-DENABLE_HLSL=OFF -DBUILD_TESTING=OFF -DENABLE_OPT=OFF -DINSTALL_GTEST=OFF`
+
turn on
`-DENABLE_GLSLANG_WEB=ON`
+
turn on
`-DENABLE_GLSLANG_JS=ON`
+
optionally, for a minimum-size binary, turn on
`-DENABLE_GLSLANG_WEBMIN=ON`
+
optionally, for GLSL compilation error messages, turn on
`-DENABLE_GLSLANG_WEB_DEVEL=ON`
*
`emsdk`
needs to be present in your executable search path,
*PATH*
for
Bash-like environments
...
...
glslang/CMakeLists.txt
View file @
ae594356
...
...
@@ -6,9 +6,10 @@ else(WIN32)
message
(
"unknown platform"
)
endif
(
WIN32
)
if
(
EMSCRIPTEN OR ENABLE_GLSLANG_WEB
)
if
(
EMSCRIPTEN OR ENABLE_GLSLANG_JS
)
# May be enabled on non-Emscripten builds for binary-size testing.
add_subdirectory
(
OSDependent/Web
)
endif
(
EMSCRIPTEN OR ENABLE_GLSLANG_
WEB
)
endif
(
EMSCRIPTEN OR ENABLE_GLSLANG_
JS
)
set
(
SOURCES
MachineIndependent/glslang.m4
...
...
glslang/OSDependent/Web/CMakeLists.txt
View file @
ae594356
add_executable
(
glslang.js
"glslang.js.cpp"
)
glslang_set_link_args
(
glslang.js
)
target_link_libraries
(
glslang.js glslang SPIRV
)
if
(
EMSCRIPTEN
)
if
(
ENABLE_GLSLANG_JS
)
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"
)
em_link_pre_js
(
glslang.js
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/glslang.pre.js"
)
target_link_options
(
glslang.js PRIVATE
"SHELL:--bind -s MODULARIZE=1"
)
target_link_options
(
glslang.js PRIVATE
"SHELL: -Os"
)
target_link_options
(
glslang.js PRIVATE
"SHELL: --llvm-lto 1"
)
target_link_options
(
glslang.js PRIVATE
"SHELL: --closure 1"
)
target_link_options
(
glslang.js PRIVATE
"SHELL: -s MODULARIZE=1"
)
target_link_options
(
glslang.js PRIVATE
"SHELL: -s ALLOW_MEMORY_GROWTH=1"
)
target_link_options
(
glslang.js PRIVATE
"SHELL: -s FILESYSTEM=0"
)
if
(
ENABLE_EMSCRIPTEN_SINGLE_FILE
)
target_link_options
(
glslang.js
"SHELL: -s SINGLE_FILE=1"
)
endif
(
ENABLE_EMSCRIPTEN_SINGLE_FILE
)
if
(
ENABLE_EMSCRIPTEN_ENVIRONMENT_NODE
)
target_link_options
(
glslang.js PRIVATE
"SHELL:-s ENVIRONMENT=node -s BINARYEN_ASYNC_COMPILATION=0"
)
target_link_options
(
glslang.js PRIVATE
"SHELL: -s ENVIRONMENT=node -s BINARYEN_ASYNC_COMPILATION=0"
)
else
()
target_link_options
(
glslang.js PRIVATE
"SHELL:-s ENVIRONMENT=web,worker"
)
target_link_options
(
glslang.js PRIVATE
"SHELL: -s ENVIRONMENT=web,worker"
)
endif
()
if
(
NOT ENABLE_EMSCRIPTEN_ENVIRONMENT_NODE
)
add_custom_command
(
TARGET glslang.js POST_BUILD
COMMAND cat
${
CMAKE_CURRENT_SOURCE_DIR
}
/glslang.after.js >>
${
CMAKE_CURRENT_BINARY_DIR
}
/glslang.js
)
endif
()
endif
(
EMSCRIPTEN
)
endif
(
EMSCRIPTEN
)
endif
(
ENABLE_GLSLANG_JS
)
glslang/OSDependent/Web/glslang.js.cpp
View file @
ae594356
...
...
@@ -277,7 +277,7 @@ void main() { })";
uint32_t
*
output
;
size_t
output_len
;
void
*
id
=
convert_glsl_to_spirv
(
input
,
4
,
false
,
&
output
,
&
output_len
);
void
*
id
=
convert_glsl_to_spirv
(
input
,
4
,
false
,
glslang
::
EShTargetSpv_1_0
,
&
output
,
&
output_len
);
assert
(
output
!=
nullptr
);
assert
(
output_len
!=
0
);
destroy_output_buffer
(
id
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment