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
393c564a
Unverified
Commit
393c564a
authored
Mar 24, 2020
by
John Kessenich
Committed by
GitHub
Mar 24, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2149 from kainino0x/web-fix-cmake2.8
Fix build on CMake 2.8, and fix Web build
parents
1f0fcbe5
817d0f63
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
24 deletions
+33
-24
CMakeLists.txt
CMakeLists.txt
+5
-2
README.md
README.md
+13
-11
Types.h
glslang/Include/Types.h
+1
-1
localintermediate.h
glslang/MachineIndependent/localintermediate.h
+1
-1
CMakeLists.txt
glslang/OSDependent/Web/CMakeLists.txt
+13
-9
No files found.
CMakeLists.txt
View file @
393c564a
...
@@ -142,7 +142,10 @@ if(ENABLE_GLSLANG_JS)
...
@@ -142,7 +142,10 @@ if(ENABLE_GLSLANG_JS)
add_compile_options
(
/Os /GR-
)
add_compile_options
(
/Os /GR-
)
else
()
else
()
add_compile_options
(
-Os -fno-exceptions
)
add_compile_options
(
-Os -fno-exceptions
)
add_link_options
(
-Os
)
if
(
${
CMAKE_CXX_COMPILER_ID
}
MATCHES
"Clang"
)
add_compile_options
(
-Wno-unused-parameter
)
add_compile_options
(
-Wno-unused-variable -Wno-unused-const-variable
)
endif
()
endif
()
endif
()
endif
(
ENABLE_GLSLANG_JS
)
endif
(
ENABLE_GLSLANG_JS
)
...
@@ -150,7 +153,7 @@ endif(ENABLE_GLSLANG_JS)
...
@@ -150,7 +153,7 @@ endif(ENABLE_GLSLANG_JS)
if
(
${
CMAKE_VERSION
}
VERSION_LESS 3.1
)
if
(
${
CMAKE_VERSION
}
VERSION_LESS 3.1
)
# CMake versions before 3.1 do not understand CMAKE_CXX_STANDARD
# CMake versions before 3.1 do not understand CMAKE_CXX_STANDARD
# remove this block once CMake >=3.1 has fixated in the ecosystem
# remove this block once CMake >=3.1 has fixated in the ecosystem
add_compile_options
(
-std=c++11
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-std=c++11"
)
else
()
else
()
set
(
CMAKE_CXX_STANDARD 11
)
set
(
CMAKE_CXX_STANDARD 11
)
set
(
CMAKE_CXX_STANDARD_REQUIRED ON
)
set
(
CMAKE_CXX_STANDARD_REQUIRED ON
)
...
...
README.md
View file @
393c564a
...
@@ -209,27 +209,29 @@ With no arguments it builds the full grammar, and with a "web" argument,
...
@@ -209,27 +209,29 @@ With no arguments it builds the full grammar, and with a "web" argument,
the web grammar subset (see more about the web subset in the next section).
the web grammar subset (see more about the web subset in the next section).
### Building to WASM for the Web and Node
### Building to WASM for the Web and Node
### Building a standalone JS/WASM library for the Web and Node
Use the steps in
[
Build Steps
](
#build-steps
)
, with the following notes/exceptions:
Use the steps in
[
Build Steps
](
#build-steps
)
, with the following notes/exceptions:
*
For building the web subset of core glslang:
+
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_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
*
`emsdk`
needs to be present in your executable search path,
*PATH*
for
Bash-like environments
Bash-like environments:
+
[
Instructions located
+
[
Instructions located here
](
https://emscripten.org/docs/getting_started/downloads.html#sdk-download-and-install
)
here](https://emscripten.org/docs/getting_started/downloads.html#sdk-download-and-install)
*
Wrap cmake call:
`emcmake cmake`
*
Wrap cmake call:
`emcmake cmake`
*
Set
`-DBUILD_TESTING=OFF -DENABLE_OPT=OFF -DINSTALL_GTEST=OFF`
.
*
Set
`-DENABLE_HLSL=OFF`
if HLSL is not needed.
*
For a standalone JS/WASM library, turn on
`-DENABLE_GLSLANG_JS=ON`
.
*
For building a minimum-size web subset of core glslang:
+
turn on
`-DENABLE_GLSLANG_WEBMIN=ON`
(disables HLSL)
+
execute
`updateGrammar web`
from the glslang subdirectory
(or if using your own scripts,
`m4`
needs a
`-DGLSLANG_WEB`
argument)
+
optionally, for GLSL compilation error messages, turn on
`-DENABLE_GLSLANG_WEBMIN_DEVEL=ON`
*
To get a fully minimized build, make sure to use
`brotli`
to compress the .js
*
To get a fully minimized build, make sure to use
`brotli`
to compress the .js
and .wasm files
and .wasm files
Example:
Example:
```
sh
```
sh
emcmake cmake
-DCMAKE_BUILD_TYPE
=
Release
-DENABLE_GLSLANG_
WEB
=
ON
\
emcmake cmake
-DCMAKE_BUILD_TYPE
=
Release
-DENABLE_GLSLANG_
JS
=
ON
\
-DENABLE_HLSL
=
OFF
-DBUILD_TESTING
=
OFF
-DENABLE_OPT
=
OFF
-DINSTALL_GTEST
=
OFF ..
-DENABLE_HLSL
=
OFF
-DBUILD_TESTING
=
OFF
-DENABLE_OPT
=
OFF
-DINSTALL_GTEST
=
OFF ..
```
```
...
...
glslang/Include/Types.h
View file @
393c564a
...
@@ -945,7 +945,7 @@ public:
...
@@ -945,7 +945,7 @@ public:
bool
hasAttachment
()
const
{
return
false
;
}
bool
hasAttachment
()
const
{
return
false
;
}
TLayoutFormat
getFormat
()
const
{
return
ElfNone
;
}
TLayoutFormat
getFormat
()
const
{
return
ElfNone
;
}
bool
isPushConstant
()
const
{
return
false
;
}
bool
isPushConstant
()
const
{
return
false
;
}
bool
isShaderRecord
NV
()
const
{
return
false
;
}
bool
isShaderRecord
()
const
{
return
false
;
}
bool
hasBufferReference
()
const
{
return
false
;
}
bool
hasBufferReference
()
const
{
return
false
;
}
bool
hasBufferReferenceAlign
()
const
{
return
false
;
}
bool
hasBufferReferenceAlign
()
const
{
return
false
;
}
bool
isNonUniform
()
const
{
return
false
;
}
bool
isNonUniform
()
const
{
return
false
;
}
...
...
glslang/MachineIndependent/localintermediate.h
View file @
393c564a
...
@@ -503,7 +503,7 @@ public:
...
@@ -503,7 +503,7 @@ public:
bool
getAutoMapBindings
()
const
{
return
false
;
}
bool
getAutoMapBindings
()
const
{
return
false
;
}
bool
getAutoMapLocations
()
const
{
return
false
;
}
bool
getAutoMapLocations
()
const
{
return
false
;
}
int
getNumPushConstants
()
const
{
return
0
;
}
int
getNumPushConstants
()
const
{
return
0
;
}
void
addShaderRecord
NV
Count
()
{
}
void
addShaderRecordCount
()
{
}
void
addTaskNVCount
()
{
}
void
addTaskNVCount
()
{
}
void
setUseVulkanMemoryModel
()
{
}
void
setUseVulkanMemoryModel
()
{
}
bool
usingVulkanMemoryModel
()
const
{
return
false
;
}
bool
usingVulkanMemoryModel
()
const
{
return
false
;
}
...
...
glslang/OSDependent/Web/CMakeLists.txt
View file @
393c564a
...
@@ -3,27 +3,31 @@ if(ENABLE_GLSLANG_JS)
...
@@ -3,27 +3,31 @@ if(ENABLE_GLSLANG_JS)
glslang_set_link_args
(
glslang.js
)
glslang_set_link_args
(
glslang.js
)
target_link_libraries
(
glslang.js glslang SPIRV
)
target_link_libraries
(
glslang.js glslang SPIRV
)
# Link library names that start with "-" are treated as link flags.
# "-Os" should be OK in MSVC; don't use /Os because CMake won't
# treat it as a link flag.
target_link_libraries
(
glslang.js
"-Os"
)
if
(
EMSCRIPTEN
)
if
(
EMSCRIPTEN
)
set_target_properties
(
glslang.js PROPERTIES
set_target_properties
(
glslang.js PROPERTIES
OUTPUT_NAME
"glslang"
OUTPUT_NAME
"glslang"
SUFFIX
".js"
)
SUFFIX
".js"
)
em_link_pre_js
(
glslang.js
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/glslang.pre.js"
)
em_link_pre_js
(
glslang.js
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/glslang.pre.js"
)
target_link_options
(
glslang.js PRIVATE
"SHELL: -Os"
)
target_link_libraries
(
glslang.js
"--llvm-lto 1"
)
target_link_options
(
glslang.js PRIVATE
"SHELL: --llvm-lto 1"
)
target_link_libraries
(
glslang.js
"--closure 1"
)
target_link_options
(
glslang.js PRIVATE
"SHELL: --closure 1"
)
target_link_libraries
(
glslang.js
"-s MODULARIZE=1"
)
target_link_options
(
glslang.js PRIVATE
"SHELL: -s MODULARIZE=1"
)
target_link_libraries
(
glslang.js
"-s ALLOW_MEMORY_GROWTH=1"
)
target_link_options
(
glslang.js PRIVATE
"SHELL: -s ALLOW_MEMORY_GROWTH=1"
)
target_link_libraries
(
glslang.js
"-s FILESYSTEM=0"
)
target_link_options
(
glslang.js PRIVATE
"SHELL: -s FILESYSTEM=0"
)
if
(
ENABLE_EMSCRIPTEN_SINGLE_FILE
)
if
(
ENABLE_EMSCRIPTEN_SINGLE_FILE
)
target_link_
options
(
glslang.js PRIVATE
"SHELL:
-s SINGLE_FILE=1"
)
target_link_
libraries
(
glslang.js
"
-s SINGLE_FILE=1"
)
endif
(
ENABLE_EMSCRIPTEN_SINGLE_FILE
)
endif
(
ENABLE_EMSCRIPTEN_SINGLE_FILE
)
if
(
ENABLE_EMSCRIPTEN_ENVIRONMENT_NODE
)
if
(
ENABLE_EMSCRIPTEN_ENVIRONMENT_NODE
)
target_link_
options
(
glslang.js PRIVATE
"SHELL:
-s ENVIRONMENT=node -s BINARYEN_ASYNC_COMPILATION=0"
)
target_link_
libraries
(
glslang.js
"
-s ENVIRONMENT=node -s BINARYEN_ASYNC_COMPILATION=0"
)
else
()
else
()
target_link_
options
(
glslang.js PRIVATE
"SHELL:
-s ENVIRONMENT=web,worker"
)
target_link_
libraries
(
glslang.js
"
-s ENVIRONMENT=web,worker"
)
endif
()
endif
()
if
(
NOT ENABLE_EMSCRIPTEN_ENVIRONMENT_NODE
)
if
(
NOT ENABLE_EMSCRIPTEN_ENVIRONMENT_NODE
)
...
...
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