CMake changes for HLSL legalization

Cmake now looks for External/spirv-tools. If found, it links in
SPIRV-Tools-opt and SPVRemapper, and adds -DENABLE_OPT to build.
This commit is contained in:
GregF
2017-09-21 16:50:39 -06:00
parent 5f77d864f3
commit fd34f0e602
3 changed files with 30 additions and 1 deletions

View File

@@ -18,6 +18,8 @@ option(ENABLE_NV_EXTENSIONS "Enables support of Nvidia-specific extensions" ON)
option(ENABLE_HLSL "Enables HLSL input support" ON)
option(ENABLE_OPT "Enables spirv-opt capability if present" ON)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND WIN32)
set(CMAKE_INSTALL_PREFIX "install" CACHE STRING "..." FORCE)
endif()
@@ -83,6 +85,17 @@ endfunction(glslang_set_link_args)
# We depend on these for later projects, so they should come first.
add_subdirectory(External)
if(NOT TARGET SPIRV-Tools-opt)
set(ENABLE_OPT OFF)
endif()
if(ENABLE_OPT)
message(STATUS "optimizer enabled")
add_definitions(-DENABLE_OPT)
elseif(ENABLE_HLSL)
message(STATUS "spirv-tools not linked - illegal SPIRV may be generated for HLSL")
endif()
add_subdirectory(glslang)
add_subdirectory(OGLCompilersDLL)
if(ENABLE_GLSLANG_BINARIES)