CMake: Only require SPIRV-Cross when enabling OpenGL backend

Change-Id: Ie6be1301c3f2f9877a9dfb04ab5025559b90d926
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64741
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton 2021-09-23 19:24:43 +00:00 committed by Dawn LUCI CQ
parent 999cc24209
commit c19329c832
3 changed files with 14 additions and 5 deletions

View File

@ -107,6 +107,12 @@ if (${DAWN_ENABLE_DESKTOP_GL} OR ${DAWN_ENABLE_OPENGLES})
set(DAWN_ENABLE_OPENGL ON)
endif()
# OpenGL backend requires SPIRV-Cross
set(DAWN_REQUIRES_SPIRV_CROSS OFF)
if (DAWN_ENABLE_OPENGL)
set(DAWN_REQUIRES_SPIRV_CROSS ON)
endif()
################################################################################
# Dawn's public and internal "configs"
################################################################################

View File

@ -185,13 +185,16 @@ target_link_libraries(dawn_native
dawn_platform
dawn_internal_config
libtint
spirv-cross-core
spirv-cross-glsl
spirv-cross-hlsl
spirv-cross-msl
SPIRV-Tools-opt
)
if (DAWN_REQUIRES_SPIRV_CROSS)
target_link_libraries(dawn_native PRIVATE spirv-cross-core)
if (DAWN_ENABLE_OPENGL)
target_link_libraries(dawn_native PRIVATE spirv-cross-glsl)
endif()
endif()
if (DAWN_USE_X11)
find_package(X11 REQUIRED)
target_link_libraries(dawn_native PRIVATE ${X11_LIBRARIES})

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
if (NOT TARGET spirv-cross)
if (DAWN_REQUIRES_SPIRV_CROSS AND NOT TARGET spirv-cross)
set(SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS ON CACHE BOOL "" FORCE)
set(SPIRV_CROSS_ENABLE_TESTS OFF CACHE BOOL "" FORCE)
set(SPIRV_CROSS_SKIP_INSTALL ON CACHE BOOL "" FORCE)