Skip to content

Commit 15ebcea

Browse files
committed
Print an error when SPIR-V is requested and ENABLE_SPIRV=0 is set
This case fails slightly less silently now. Also make ENABLE_OPT depend on ENABLE_SPIRV, since when there's no SPIR-V optimization doesn't really make sense.
1 parent 467ce01 commit 15ebcea

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ CMAKE_DEPENDENT_OPTION(ENABLE_EMSCRIPTEN_ENVIRONMENT_NODE
115115
option(ENABLE_HLSL "Enables HLSL input support" ON)
116116
option(ENABLE_RTTI "Enables RTTI")
117117
option(ENABLE_EXCEPTIONS "Enables Exceptions")
118-
option(ENABLE_OPT "Enables spirv-opt capability if present" ON)
118+
CMAKE_DEPENDENT_OPTION(ENABLE_OPT "Enables spirv-opt capability if present" ON "ENABLE_SPIRV" OFF)
119119

120120
if(MINGW OR (APPLE AND ${CMAKE_CXX_COMPILER_ID} MATCHES "GNU"))
121121
# Workaround for CMake behavior on Mac OS with gcc, cmake generates -Xarch_* arguments

StandAlone/StandAlone.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,9 +1507,9 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
15071507

15081508
std::vector<std::string> outputFiles;
15091509

1510-
#ifdef ENABLE_SPIRV
15111510
// Dump SPIR-V
15121511
if (Options & EOptionSpv) {
1512+
#ifdef ENABLE_SPIRV
15131513
CompileOrLinkFailed.fetch_or(CompileFailed);
15141514
CompileOrLinkFailed.fetch_or(LinkFailed);
15151515
if (static_cast<bool>(CompileOrLinkFailed.load()))
@@ -1569,8 +1569,10 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
15691569
}
15701570
}
15711571
}
1572-
}
1572+
#else
1573+
Error("This configuration of glslang does not have SPIR-V support");
15731574
#endif
1575+
}
15741576

15751577
CompileOrLinkFailed.fetch_or(CompileFailed);
15761578
CompileOrLinkFailed.fetch_or(LinkFailed);

0 commit comments

Comments
 (0)