Add a CMake option to disable compilation of HLSL input support.
This commit is contained in:
parent
5d89d4d483
commit
84eabf7ea7
@ -6,6 +6,8 @@ option(ENABLE_GLSLANG_BINARIES "Builds glslangValidator and spirv-remap" ON)
|
|||||||
|
|
||||||
option(ENABLE_NV_EXTENSIONS "Enables support of Nvidia-specific extensions" ON)
|
option(ENABLE_NV_EXTENSIONS "Enables support of Nvidia-specific extensions" ON)
|
||||||
|
|
||||||
|
option(DISABLE_HLSL "Disables HLSL input support" OFF)
|
||||||
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
|
||||||
set(CMAKE_INSTALL_PREFIX "install" CACHE STRING "prefix")
|
set(CMAKE_INSTALL_PREFIX "install" CACHE STRING "prefix")
|
||||||
@ -20,6 +22,10 @@ if(ENABLE_NV_EXTENSIONS)
|
|||||||
add_definitions(-DNV_EXTENSIONS)
|
add_definitions(-DNV_EXTENSIONS)
|
||||||
endif(ENABLE_NV_EXTENSIONS)
|
endif(ENABLE_NV_EXTENSIONS)
|
||||||
|
|
||||||
|
if(DISABLE_HLSL)
|
||||||
|
add_definitions(-DDISABLE_HLSL)
|
||||||
|
endif(DISABLE_HLSL)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(CMAKE_DEBUG_POSTFIX "d")
|
set(CMAKE_DEBUG_POSTFIX "d")
|
||||||
include(ChooseMSVCCRT.cmake)
|
include(ChooseMSVCCRT.cmake)
|
||||||
@ -63,5 +69,7 @@ if(ENABLE_GLSLANG_BINARIES)
|
|||||||
add_subdirectory(StandAlone)
|
add_subdirectory(StandAlone)
|
||||||
endif()
|
endif()
|
||||||
add_subdirectory(SPIRV)
|
add_subdirectory(SPIRV)
|
||||||
|
if(NOT DISABLE_HLSL)
|
||||||
add_subdirectory(hlsl)
|
add_subdirectory(hlsl)
|
||||||
|
endif()
|
||||||
add_subdirectory(gtests)
|
add_subdirectory(gtests)
|
||||||
|
@ -22,11 +22,14 @@ set(LIBRARIES
|
|||||||
glslang
|
glslang
|
||||||
OGLCompiler
|
OGLCompiler
|
||||||
OSDependent
|
OSDependent
|
||||||
HLSL
|
|
||||||
SPIRV
|
SPIRV
|
||||||
SPVRemapper
|
SPVRemapper
|
||||||
glslang-default-resource-limits)
|
glslang-default-resource-limits)
|
||||||
|
|
||||||
|
if(NOT DISABLE_HLSL)
|
||||||
|
set(LIBRARIES ${LIBRARIES} HLSL)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(LIBRARIES ${LIBRARIES} psapi)
|
set(LIBRARIES ${LIBRARIES} psapi)
|
||||||
elseif(UNIX)
|
elseif(UNIX)
|
||||||
|
@ -47,11 +47,14 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include "SymbolTable.h"
|
#include "SymbolTable.h"
|
||||||
#include "ParseHelper.h"
|
#include "ParseHelper.h"
|
||||||
#include "../../hlsl/hlslParseHelper.h"
|
|
||||||
#include "../../hlsl/hlslParseables.h"
|
|
||||||
#include "Scan.h"
|
#include "Scan.h"
|
||||||
#include "ScanContext.h"
|
#include "ScanContext.h"
|
||||||
|
|
||||||
|
#ifndef DISABLE_HLSL
|
||||||
|
#include "../../hlsl/hlslParseHelper.h"
|
||||||
|
#include "../../hlsl/hlslParseables.h"
|
||||||
#include "../../hlsl/hlslScanContext.h"
|
#include "../../hlsl/hlslScanContext.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "../Include/ShHandle.h"
|
#include "../Include/ShHandle.h"
|
||||||
#include "../../OGLCompilersDLL/InitializeDll.h"
|
#include "../../OGLCompilersDLL/InitializeDll.h"
|
||||||
@ -73,7 +76,9 @@ TBuiltInParseables* CreateBuiltInParseables(TInfoSink& infoSink, EShSource sourc
|
|||||||
{
|
{
|
||||||
switch (source) {
|
switch (source) {
|
||||||
case EShSourceGlsl: return new TBuiltIns(); // GLSL builtIns
|
case EShSourceGlsl: return new TBuiltIns(); // GLSL builtIns
|
||||||
|
#ifndef DISABLE_HLSL
|
||||||
case EShSourceHlsl: return new TBuiltInParseablesHlsl(); // HLSL intrinsics
|
case EShSourceHlsl: return new TBuiltInParseablesHlsl(); // HLSL intrinsics
|
||||||
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
infoSink.info.message(EPrefixInternalError, "Unable to determine source language");
|
infoSink.info.message(EPrefixInternalError, "Unable to determine source language");
|
||||||
@ -88,15 +93,21 @@ TParseContextBase* CreateParseContext(TSymbolTable& symbolTable, TIntermediate&
|
|||||||
SpvVersion spvVersion, bool forwardCompatible, EShMessages messages,
|
SpvVersion spvVersion, bool forwardCompatible, EShMessages messages,
|
||||||
bool parsingBuiltIns, const std::string sourceEntryPointName = "")
|
bool parsingBuiltIns, const std::string sourceEntryPointName = "")
|
||||||
{
|
{
|
||||||
|
#ifdef DISABLE_HLSL
|
||||||
|
(void)sourceEntryPointName; // Unused argument.
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (source) {
|
switch (source) {
|
||||||
case EShSourceGlsl:
|
case EShSourceGlsl:
|
||||||
intermediate.setEntryPointName("main");
|
intermediate.setEntryPointName("main");
|
||||||
return new TParseContext(symbolTable, intermediate, parsingBuiltIns, version, profile, spvVersion,
|
return new TParseContext(symbolTable, intermediate, parsingBuiltIns, version, profile, spvVersion,
|
||||||
language, infoSink, forwardCompatible, messages);
|
language, infoSink, forwardCompatible, messages);
|
||||||
|
|
||||||
|
#ifndef DISABLE_HLSL
|
||||||
case EShSourceHlsl:
|
case EShSourceHlsl:
|
||||||
return new HlslParseContext(symbolTable, intermediate, parsingBuiltIns, version, profile, spvVersion,
|
return new HlslParseContext(symbolTable, intermediate, parsingBuiltIns, version, profile, spvVersion,
|
||||||
language, infoSink, sourceEntryPointName.c_str(), forwardCompatible, messages);
|
language, infoSink, sourceEntryPointName.c_str(), forwardCompatible, messages);
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
infoSink.info.message(EPrefixInternalError, "Unable to determine source language");
|
infoSink.info.message(EPrefixInternalError, "Unable to determine source language");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -1085,7 +1096,9 @@ int ShInitialize()
|
|||||||
PerProcessGPA = new TPoolAllocator();
|
PerProcessGPA = new TPoolAllocator();
|
||||||
|
|
||||||
glslang::TScanContext::fillInKeywordMap();
|
glslang::TScanContext::fillInKeywordMap();
|
||||||
|
#ifndef DISABLE_HLSL
|
||||||
glslang::HlslScanContext::fillInKeywordMap();
|
glslang::HlslScanContext::fillInKeywordMap();
|
||||||
|
#endif
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1178,7 +1191,9 @@ int __fastcall ShFinalize()
|
|||||||
}
|
}
|
||||||
|
|
||||||
glslang::TScanContext::deleteKeywordMap();
|
glslang::TScanContext::deleteKeywordMap();
|
||||||
|
#ifndef DISABLE_HLSL
|
||||||
glslang::HlslScanContext::deleteKeywordMap();
|
glslang::HlslScanContext::deleteKeywordMap();
|
||||||
|
#endif
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user