2021-01-14 15:07:49 +00:00
# Copyright 2016-2021 Google Inc.
2021-05-08 08:47:48 +00:00
# SPDX-License-Identifier: Apache-2.0 OR MIT
2016-03-19 21:13:06 +00:00
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
2020-11-25 14:22:08 +00:00
#
# At your option, you may choose to accept this material under either:
# 1. The Apache License, Version 2.0, found at <http://www.apache.org/licenses/LICENSE-2.0>, or
# 2. The MIT License, found at <http://opensource.org/licenses/MIT>.
#
2024-01-16 12:54:10 +00:00
cmake_minimum_required ( VERSION 3.6 )
2019-02-12 10:11:29 +00:00
set ( CMAKE_CXX_STANDARD 11 )
2021-01-04 09:17:24 +00:00
set ( CMAKE_CXX_EXTENSIONS OFF )
2020-02-01 22:14:06 +00:00
# Avoid a warning if parent project sets VERSION in project().
if ( ${ CMAKE_VERSION } VERSION_GREATER "3.0.1" )
cmake_policy ( SET CMP0048 NEW )
endif ( )
2019-03-04 10:13:41 +00:00
project ( SPIRV-Cross LANGUAGES CXX C )
2016-03-19 21:13:06 +00:00
enable_testing ( )
2020-02-02 01:53:56 +00:00
include ( GNUInstallDirs )
2016-12-15 19:46:10 +00:00
option ( SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS "Instead of throwing exceptions assert" OFF )
2019-02-12 10:11:29 +00:00
option ( SPIRV_CROSS_SHARED "Build the C API as a single shared library." OFF )
option ( SPIRV_CROSS_STATIC "Build the C and C++ API as static libraries." ON )
option ( SPIRV_CROSS_CLI "Build the CLI binary. Requires SPIRV_CROSS_STATIC." ON )
2019-03-07 09:22:58 +00:00
option ( SPIRV_CROSS_ENABLE_TESTS "Enable SPIRV-Cross tests." ON )
2016-12-12 21:33:22 +00:00
2019-03-27 12:21:11 +00:00
option ( SPIRV_CROSS_ENABLE_GLSL "Enable GLSL support." ON )
option ( SPIRV_CROSS_ENABLE_HLSL "Enable HLSL target support." ON )
option ( SPIRV_CROSS_ENABLE_MSL "Enable MSL target support." ON )
option ( SPIRV_CROSS_ENABLE_CPP "Enable C++ target support." ON )
option ( SPIRV_CROSS_ENABLE_REFLECT "Enable JSON reflection target support." ON )
option ( SPIRV_CROSS_ENABLE_C_API "Enable C API wrapper support in static library." ON )
option ( SPIRV_CROSS_ENABLE_UTIL "Enable util module support." ON )
2019-03-05 09:11:04 +00:00
option ( SPIRV_CROSS_SANITIZE_ADDRESS "Sanitize address" OFF )
2019-03-05 10:15:08 +00:00
option ( SPIRV_CROSS_SANITIZE_MEMORY "Sanitize memory" OFF )
2019-03-05 09:11:04 +00:00
option ( SPIRV_CROSS_SANITIZE_THREADS "Sanitize threads" OFF )
2019-03-05 10:15:08 +00:00
option ( SPIRV_CROSS_SANITIZE_UNDEFINED "Sanitize undefined" OFF )
2019-03-05 09:11:04 +00:00
2019-03-29 09:29:44 +00:00
option ( SPIRV_CROSS_NAMESPACE_OVERRIDE "" "Override the namespace used in the C++ API." )
2019-04-09 11:07:30 +00:00
option ( SPIRV_CROSS_FORCE_STL_TYPES "Force use of STL types instead of STL replacements in certain places. Might reduce performance." OFF )
2019-03-29 09:29:44 +00:00
2019-09-16 08:20:34 +00:00
option ( SPIRV_CROSS_SKIP_INSTALL "Skips installation targets." OFF )
2019-09-17 08:16:47 +00:00
option ( SPIRV_CROSS_WERROR "Fail build on warnings." OFF )
option ( SPIRV_CROSS_MISC_WARNINGS "Misc warnings useful for Travis runs." OFF )
2019-09-18 08:00:25 +00:00
option ( SPIRV_CROSS_FORCE_PIC "Force position-independent code for all targets." OFF )
2016-03-19 21:13:06 +00:00
if ( ${ CMAKE_GENERATOR } MATCHES "Makefile" )
2019-02-12 10:11:29 +00:00
if ( ${ CMAKE_CURRENT_SOURCE_DIR } STREQUAL ${ CMAKE_CURRENT_BINARY_DIR } )
message ( FATAL_ERROR "Build out of tree to avoid overwriting Makefile" )
endif ( )
2016-03-19 21:13:06 +00:00
endif ( )
2016-12-15 19:46:10 +00:00
set ( spirv-compiler-options "" )
set ( spirv-compiler-defines "" )
2019-03-05 09:11:04 +00:00
set ( spirv-cross-link-flags "" )
2016-12-15 19:46:10 +00:00
2019-11-12 15:14:26 +00:00
message ( STATUS "SPIRV-Cross: Finding Git version for SPIRV-Cross." )
2019-05-24 13:23:29 +00:00
set ( spirv-cross-build-version "unknown" )
find_package ( Git )
if ( GIT_FOUND )
execute_process (
2024-01-23 11:01:32 +00:00
C O M M A N D $ { G I T _ E X E C U T A B L E } d e s c r i b e - - a l w a y s - - t a g s - - d i r t y = +
2019-05-24 13:23:29 +00:00
W O R K I N G _ D I R E C T O R Y $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R }
O U T P U T _ V A R I A B L E s p i r v - c r o s s - b u i l d - v e r s i o n
E R R O R _ Q U I E T
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E
)
2019-11-12 15:14:26 +00:00
message ( STATUS "SPIRV-Cross: Git hash: ${spirv-cross-build-version}" )
2019-05-24 13:23:29 +00:00
else ( )
2019-11-12 15:14:26 +00:00
message ( STATUS "SPIRV-Cross: Git not found, using unknown build version." )
2019-05-24 13:23:29 +00:00
endif ( )
string ( TIMESTAMP spirv-cross-timestamp )
configure_file ( ${ CMAKE_CURRENT_SOURCE_DIR } /cmake/gitversion.in.h ${ CMAKE_CURRENT_BINARY_DIR } /gitversion.h @ONLY )
2020-01-23 09:49:43 +00:00
if ( SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS )
2019-02-12 10:11:29 +00:00
set ( spirv-compiler-defines ${ spirv-compiler-defines } SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS )
2020-01-23 09:49:43 +00:00
if ( NOT MSVC )
set ( spirv-compiler-options ${ spirv-compiler-options } -fno-exceptions )
endif ( )
2016-12-15 19:46:10 +00:00
endif ( )
2020-01-23 09:49:43 +00:00
if ( SPIRV_CROSS_FORCE_STL_TYPES )
2019-04-09 11:07:30 +00:00
set ( spirv-compiler-defines ${ spirv-compiler-defines } SPIRV_CROSS_FORCE_STL_TYPES )
endif ( )
2019-12-20 23:59:03 +00:00
if ( WIN32 )
set ( CMAKE_DEBUG_POSTFIX "d" )
endif ( )
2020-04-09 15:30:20 +00:00
if ( CMAKE_COMPILER_IS_GNUCXX OR ( ( ${ CMAKE_CXX_COMPILER_ID } MATCHES "Clang" ) AND NOT MSVC ) )
2020-06-14 04:03:30 +00:00
set ( spirv-compiler-options ${ spirv-compiler-options } -Wall -Wextra -Wshadow -Wno-deprecated-declarations )
2019-09-17 08:16:47 +00:00
if ( SPIRV_CROSS_MISC_WARNINGS )
if ( ${ CMAKE_CXX_COMPILER_ID } MATCHES "Clang" )
set ( spirv-compiler-options ${ spirv-compiler-options } -Wshorten-64-to-32 )
endif ( )
endif ( )
if ( SPIRV_CROSS_WERROR )
set ( spirv-compiler-options ${ spirv-compiler-options } -Werror )
endif ( )
2016-12-12 21:33:22 +00:00
2019-03-05 09:11:04 +00:00
if ( SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS )
2019-02-12 10:11:29 +00:00
set ( spirv-compiler-options ${ spirv-compiler-options } -fno-exceptions )
endif ( )
2019-03-05 09:11:04 +00:00
if ( SPIRV_CROSS_SANITIZE_ADDRESS )
set ( spirv-compiler-options ${ spirv-compiler-options } -fsanitize=address )
set ( spirv-cross-link-flags "${spirv-cross-link-flags} -fsanitize=address" )
endif ( )
2019-03-05 10:15:08 +00:00
if ( SPIRV_CROSS_SANITIZE_UNDEFINED )
set ( spirv-compiler-options ${ spirv-compiler-options } -fsanitize=undefined )
set ( spirv-cross-link-flags "${spirv-cross-link-flags} -fsanitize=undefined" )
endif ( )
if ( SPIRV_CROSS_SANITIZE_MEMORY )
set ( spirv-compiler-options ${ spirv-compiler-options } -fsanitize=memory )
set ( spirv-cross-link-flags "${spirv-cross-link-flags} -fsanitize=memory" )
endif ( )
2019-03-05 09:11:04 +00:00
if ( SPIRV_CROSS_SANITIZE_THREADS )
set ( spirv-compiler-options ${ spirv-compiler-options } -fsanitize=thread )
set ( spirv-cross-link-flags "${spirv-cross-link-flags} -fsanitize=thread" )
endif ( )
2019-02-12 10:11:29 +00:00
elseif ( MSVC )
2021-04-06 12:59:53 +00:00
# AppVeyor spuriously fails in debug build on older MSVC without /bigobj.
set ( spirv-compiler-options ${ spirv-compiler-options } /wd4267 /wd4996 $< $<CONFIG:DEBUG > :/bigobj> )
2016-12-12 21:33:22 +00:00
endif ( )
2016-03-19 21:13:06 +00:00
2017-01-24 00:49:16 +00:00
macro ( extract_headers out_abs file_list )
2019-02-12 10:11:29 +00:00
set ( ${ out_abs } ) # absolute paths
foreach ( _a ${ file_list } )
# get_filename_component only returns the longest extension, so use a regex
string ( REGEX REPLACE ".*\\.(h|hpp)" "\\1" ext ${ _a } )
# For shared library, we are only interested in the C header.
if ( SPIRV_CROSS_STATIC )
if ( ( "${ext}" STREQUAL "h" ) OR ( "${ext}" STREQUAL "hpp" ) )
list ( APPEND ${ out_abs } "${_a}" )
endif ( )
else ( )
if ( "${ext}" STREQUAL "h" )
list ( APPEND ${ out_abs } "${_a}" )
endif ( )
endif ( )
endforeach ( )
2017-01-24 00:49:16 +00:00
endmacro ( )
2019-03-29 09:29:44 +00:00
macro ( spirv_cross_add_library name config_name library_type )
add_library ( ${ name } ${ library_type } ${ ARGN } )
2019-02-12 10:11:29 +00:00
extract_headers ( hdrs "${ARGN}" )
target_include_directories ( ${ name } PUBLIC
2019-03-27 12:21:11 +00:00
$ < B U I L D _ I N T E R F A C E : $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } >
2020-02-03 09:53:30 +00:00
$ < I N S T A L L _ I N T E R F A C E : $ { C M A K E _ I N S T A L L _ I N C L U D E D I R } / s p i r v _ c r o s s > )
2019-02-12 10:11:29 +00:00
set_target_properties ( ${ name } PROPERTIES
2019-03-27 12:21:11 +00:00
P U B L I C _ H E A D E R S " $ { h d r s } " )
2019-09-18 08:00:25 +00:00
if ( SPIRV_CROSS_FORCE_PIC )
set_target_properties ( ${ name } PROPERTIES POSITION_INDEPENDENT_CODE ON )
endif ( )
2019-02-12 10:11:29 +00:00
target_compile_options ( ${ name } PRIVATE ${ spirv-compiler-options } )
target_compile_definitions ( ${ name } PRIVATE ${ spirv-compiler-defines } )
2019-03-29 09:29:44 +00:00
if ( SPIRV_CROSS_NAMESPACE_OVERRIDE )
if ( ${ library_type } MATCHES "STATIC" )
target_compile_definitions ( ${ name } PUBLIC SPIRV_CROSS_NAMESPACE_OVERRIDE= ${ SPIRV_CROSS_NAMESPACE_OVERRIDE } )
else ( )
target_compile_definitions ( ${ name } PRIVATE SPIRV_CROSS_NAMESPACE_OVERRIDE= ${ SPIRV_CROSS_NAMESPACE_OVERRIDE } )
endif ( )
endif ( )
2019-09-16 08:20:34 +00:00
if ( NOT SPIRV_CROSS_SKIP_INSTALL )
install ( TARGETS ${ name }
2019-03-27 12:21:11 +00:00
E X P O R T $ { c o n f i g _ n a m e } C o n f i g
2020-02-02 01:53:56 +00:00
R U N T I M E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ B I N D I R }
L I B R A R Y D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
A R C H I V E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
P U B L I C _ H E A D E R D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ I N C L U D E D I R } / s p i r v _ c r o s s )
install ( FILES ${ hdrs } DESTINATION ${ CMAKE_INSTALL_INCLUDEDIR } /spirv_cross )
install ( EXPORT ${ config_name } Config DESTINATION ${ CMAKE_INSTALL_DATAROOTDIR } / ${ config_name } /cmake )
2019-09-16 08:20:34 +00:00
export ( TARGETS ${ name } FILE ${ config_name } Config.cmake )
endif ( )
2017-01-24 00:49:16 +00:00
endmacro ( )
2019-02-12 10:11:29 +00:00
set ( spirv-cross-core-sources
2019-03-27 12:21:11 +00:00
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / G L S L . s t d . 4 5 0 . h
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s p i r v _ c o m m o n . h p p
2019-04-09 11:07:30 +00:00
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s p i r v _ c r o s s _ c o n t a i n e r s . h p p
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s p i r v _ c r o s s _ e r r o r _ h a n d l i n g . h p p
2019-03-27 12:21:11 +00:00
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s p i r v . h p p
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s p i r v _ c r o s s . h p p
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s p i r v _ c r o s s . c p p
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s p i r v _ p a r s e r . h p p
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s p i r v _ p a r s e r . c p p
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s p i r v _ c r o s s _ p a r s e d _ i r . h p p
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s p i r v _ c r o s s _ p a r s e d _ i r . c p p
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s p i r v _ c f g . h p p
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s p i r v _ c f g . c p p )
2019-02-12 10:11:29 +00:00
set ( spirv-cross-c-sources
2019-03-27 12:21:11 +00:00
s p i r v . h
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s p i r v _ c r o s s _ c . c p p
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s p i r v _ c r o s s _ c . h )
2019-02-12 10:11:29 +00:00
set ( spirv-cross-glsl-sources
2019-03-27 12:21:11 +00:00
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s p i r v _ g l s l . c p p
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s p i r v _ g l s l . h p p )
2019-02-12 10:11:29 +00:00
set ( spirv-cross-cpp-sources
2019-03-27 12:21:11 +00:00
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s p i r v _ c p p . c p p
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s p i r v _ c p p . h p p )
2019-02-12 10:11:29 +00:00
set ( spirv-cross-msl-sources
2019-03-27 12:21:11 +00:00
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s p i r v _ m s l . c p p
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s p i r v _ m s l . h p p )
2019-02-12 10:11:29 +00:00
set ( spirv-cross-hlsl-sources
2019-03-27 12:21:11 +00:00
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s p i r v _ h l s l . c p p
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s p i r v _ h l s l . h p p )
2019-02-12 10:11:29 +00:00
set ( spirv-cross-reflect-sources
2019-03-27 12:21:11 +00:00
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s p i r v _ r e f l e c t . c p p
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s p i r v _ r e f l e c t . h p p )
2019-02-12 10:11:29 +00:00
set ( spirv-cross-util-sources
2019-03-27 12:21:11 +00:00
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s p i r v _ c r o s s _ u t i l . c p p
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s p i r v _ c r o s s _ u t i l . h p p )
2019-02-12 10:11:29 +00:00
2023-05-30 04:09:04 +00:00
set ( spirv-cross-abi-major 0 )
2024-06-17 11:19:53 +00:00
set ( spirv-cross-abi-minor 61 )
2023-05-30 04:09:04 +00:00
set ( spirv-cross-abi-patch 0 )
set ( SPIRV_CROSS_VERSION ${ spirv-cross-abi-major } . ${ spirv-cross-abi-minor } . ${ spirv-cross-abi-patch } )
2023-05-30 03:57:59 +00:00
2023-05-30 04:09:04 +00:00
if ( SPIRV_CROSS_STATIC )
2023-05-30 03:57:59 +00:00
if ( NOT SPIRV_CROSS_SKIP_INSTALL )
configure_file (
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / p k g - c o n f i g / s p i r v - c r o s s - c . p c . i n
$ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / s p i r v - c r o s s - c . p c @ O N L Y )
install ( FILES ${ CMAKE_CURRENT_BINARY_DIR } /spirv-cross-c.pc DESTINATION ${ CMAKE_INSTALL_LIBDIR } /pkgconfig )
endif ( )
2019-02-12 10:11:29 +00:00
spirv_cross_add_library ( spirv-cross-core spirv_cross_core STATIC
2019-03-27 12:21:11 +00:00
$ { s p i r v - c r o s s - c o r e - s o u r c e s } )
2019-02-12 10:11:29 +00:00
2019-03-27 12:21:11 +00:00
if ( SPIRV_CROSS_ENABLE_GLSL )
spirv_cross_add_library ( spirv-cross-glsl spirv_cross_glsl STATIC
$ { s p i r v - c r o s s - g l s l - s o u r c e s } )
target_link_libraries ( spirv-cross-glsl PRIVATE spirv-cross-core )
endif ( )
2019-02-12 10:11:29 +00:00
2019-03-27 12:21:11 +00:00
if ( SPIRV_CROSS_ENABLE_CPP )
spirv_cross_add_library ( spirv-cross-cpp spirv_cross_cpp STATIC
$ { s p i r v - c r o s s - c p p - s o u r c e s } )
2019-02-12 10:11:29 +00:00
2019-03-27 12:21:11 +00:00
if ( SPIRV_CROSS_ENABLE_GLSL )
target_link_libraries ( spirv-cross-cpp PRIVATE spirv-cross-glsl )
else ( )
message ( FATAL_ERROR "Must enable GLSL support to enable C++ support." )
endif ( )
endif ( )
2019-02-12 10:11:29 +00:00
2019-03-27 12:21:11 +00:00
if ( SPIRV_CROSS_ENABLE_REFLECT )
2019-03-29 09:29:44 +00:00
if ( SPIRV_CROSS_ENABLE_GLSL )
spirv_cross_add_library ( spirv-cross-reflect spirv_cross_reflect STATIC
$ { s p i r v - c r o s s - r e f l e c t - s o u r c e s } )
else ( )
message ( FATAL_ERROR "Must enable GLSL support to enable JSON reflection support." )
endif ( )
2019-03-27 12:21:11 +00:00
endif ( )
2019-02-12 10:11:29 +00:00
2019-03-27 12:21:11 +00:00
if ( SPIRV_CROSS_ENABLE_MSL )
spirv_cross_add_library ( spirv-cross-msl spirv_cross_msl STATIC
$ { s p i r v - c r o s s - m s l - s o u r c e s } )
if ( SPIRV_CROSS_ENABLE_GLSL )
target_link_libraries ( spirv-cross-msl PRIVATE spirv-cross-glsl )
else ( )
message ( FATAL_ERROR "Must enable GLSL support to enable MSL support." )
endif ( )
endif ( )
2019-02-12 10:11:29 +00:00
2019-03-27 12:21:11 +00:00
if ( SPIRV_CROSS_ENABLE_HLSL )
spirv_cross_add_library ( spirv-cross-hlsl spirv_cross_hlsl STATIC
$ { s p i r v - c r o s s - h l s l - s o u r c e s } )
if ( SPIRV_CROSS_ENABLE_GLSL )
target_link_libraries ( spirv-cross-hlsl PRIVATE spirv-cross-glsl )
else ( )
message ( FATAL_ERROR "Must enable GLSL support to enable HLSL support." )
endif ( )
endif ( )
2019-02-12 10:11:29 +00:00
2019-03-27 12:21:11 +00:00
if ( SPIRV_CROSS_ENABLE_UTIL )
spirv_cross_add_library ( spirv-cross-util spirv_cross_util STATIC
$ { s p i r v - c r o s s - u t i l - s o u r c e s } )
target_link_libraries ( spirv-cross-util PRIVATE spirv-cross-core )
endif ( )
2019-02-12 10:11:29 +00:00
2019-03-27 12:21:11 +00:00
if ( SPIRV_CROSS_ENABLE_C_API )
spirv_cross_add_library ( spirv-cross-c spirv_cross_c STATIC
$ { s p i r v - c r o s s - c - s o u r c e s } )
2019-05-24 13:23:29 +00:00
target_include_directories ( spirv-cross-c PRIVATE ${ CMAKE_CURRENT_BINARY_DIR } )
target_compile_definitions ( spirv-cross-c PRIVATE HAVE_SPIRV_CROSS_GIT_VERSION )
2019-03-27 12:21:11 +00:00
if ( SPIRV_CROSS_ENABLE_GLSL )
target_link_libraries ( spirv-cross-c PRIVATE spirv-cross-glsl )
target_compile_definitions ( spirv-cross-c PRIVATE SPIRV_CROSS_C_API_GLSL=1 )
endif ( )
if ( SPIRV_CROSS_ENABLE_HLSL )
target_link_libraries ( spirv-cross-c PRIVATE spirv-cross-hlsl )
target_compile_definitions ( spirv-cross-c PRIVATE SPIRV_CROSS_C_API_HLSL=1 )
endif ( )
if ( SPIRV_CROSS_ENABLE_MSL )
target_link_libraries ( spirv-cross-c PRIVATE spirv-cross-msl )
target_compile_definitions ( spirv-cross-c PRIVATE SPIRV_CROSS_C_API_MSL=1 )
endif ( )
if ( SPIRV_CROSS_ENABLE_CPP )
target_link_libraries ( spirv-cross-c PRIVATE spirv-cross-cpp )
target_compile_definitions ( spirv-cross-c PRIVATE SPIRV_CROSS_C_API_CPP=1 )
endif ( )
if ( SPIRV_CROSS_ENABLE_REFLECT )
target_link_libraries ( spirv-cross-c PRIVATE spirv-cross-reflect )
target_compile_definitions ( spirv-cross-c PRIVATE SPIRV_CROSS_C_API_REFLECT=1 )
endif ( )
endif ( )
2019-02-12 10:11:29 +00:00
endif ( )
if ( SPIRV_CROSS_SHARED )
2019-09-16 08:20:34 +00:00
if ( NOT SPIRV_CROSS_SKIP_INSTALL )
configure_file (
2019-03-27 12:21:11 +00:00
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / p k g - c o n f i g / s p i r v - c r o s s - c - s h a r e d . p c . i n
$ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / s p i r v - c r o s s - c - s h a r e d . p c @ O N L Y )
2020-02-02 02:02:33 +00:00
install ( FILES ${ CMAKE_CURRENT_BINARY_DIR } /spirv-cross-c-shared.pc DESTINATION ${ CMAKE_INSTALL_LIBDIR } /pkgconfig )
2019-09-16 08:20:34 +00:00
endif ( )
2019-02-12 10:11:29 +00:00
spirv_cross_add_library ( spirv-cross-c-shared spirv_cross_c_shared SHARED
2019-03-27 12:21:11 +00:00
$ { s p i r v - c r o s s - c o r e - s o u r c e s }
$ { s p i r v - c r o s s - c - s o u r c e s } )
2019-05-24 13:23:29 +00:00
target_include_directories ( spirv-cross-c-shared PRIVATE ${ CMAKE_CURRENT_BINARY_DIR } )
target_compile_definitions ( spirv-cross-c-shared PRIVATE HAVE_SPIRV_CROSS_GIT_VERSION )
2019-03-27 12:21:11 +00:00
if ( SPIRV_CROSS_ENABLE_GLSL )
target_sources ( spirv-cross-c-shared PRIVATE ${ spirv-cross-glsl-sources } )
target_compile_definitions ( spirv-cross-c-shared PRIVATE SPIRV_CROSS_C_API_GLSL=1 )
endif ( )
if ( SPIRV_CROSS_ENABLE_HLSL )
if ( SPIRV_CROSS_ENABLE_GLSL )
target_sources ( spirv-cross-c-shared PRIVATE ${ spirv-cross-hlsl-sources } )
else ( )
message ( FATAL_ERROR "Must enable GLSL support to enable HLSL support." )
endif ( )
target_compile_definitions ( spirv-cross-c-shared PRIVATE SPIRV_CROSS_C_API_HLSL=1 )
endif ( )
if ( SPIRV_CROSS_ENABLE_MSL )
if ( SPIRV_CROSS_ENABLE_GLSL )
target_sources ( spirv-cross-c-shared PRIVATE ${ spirv-cross-msl-sources } )
else ( )
message ( FATAL_ERROR "Must enable GLSL support to enable MSL support." )
endif ( )
target_compile_definitions ( spirv-cross-c-shared PRIVATE SPIRV_CROSS_C_API_MSL=1 )
endif ( )
if ( SPIRV_CROSS_ENABLE_CPP )
if ( SPIRV_CROSS_ENABLE_GLSL )
target_sources ( spirv-cross-c-shared PRIVATE ${ spirv-cross-cpp-sources } )
else ( )
message ( FATAL_ERROR "Must enable GLSL support to enable C++ support." )
endif ( )
target_compile_definitions ( spirv-cross-c-shared PRIVATE SPIRV_CROSS_C_API_CPP=1 )
endif ( )
if ( SPIRV_CROSS_ENABLE_REFLECT )
2019-03-29 09:29:44 +00:00
if ( SPIRV_CROSS_ENABLE_GLSL )
target_sources ( spirv-cross-c-shared PRIVATE ${ spirv-cross-reflect-sources } )
else ( )
message ( FATAL_ERROR "Must enable GLSL support to enable JSON reflection support." )
endif ( )
2019-03-27 12:21:11 +00:00
target_compile_definitions ( spirv-cross-c-shared PRIVATE SPIRV_CROSS_C_API_REFLECT=1 )
endif ( )
2019-02-12 10:11:29 +00:00
if ( CMAKE_COMPILER_IS_GNUCXX OR ( ${ CMAKE_CXX_COMPILER_ID } MATCHES "Clang" ) )
# Only export the C API.
target_compile_options ( spirv-cross-c-shared PRIVATE -fvisibility=hidden )
if ( NOT APPLE )
2019-03-05 09:11:04 +00:00
set_target_properties ( spirv-cross-c-shared PROPERTIES LINK_FLAGS "${spirv-cross-link-flags}" )
2019-02-12 10:11:29 +00:00
endif ( )
endif ( )
2019-03-04 09:08:31 +00:00
target_compile_definitions ( spirv-cross-c-shared PRIVATE SPVC_EXPORT_SYMBOLS )
2019-02-12 10:11:29 +00:00
set_target_properties ( spirv-cross-c-shared PROPERTIES
2019-03-27 12:21:11 +00:00
V E R S I O N $ { S P I R V _ C R O S S _ V E R S I O N }
S O V E R S I O N $ { s p i r v - c r o s s - a b i - m a j o r } )
2019-02-12 10:11:29 +00:00
endif ( )
if ( SPIRV_CROSS_CLI )
2019-03-27 12:21:11 +00:00
if ( NOT SPIRV_CROSS_ENABLE_GLSL )
message ( FATAL_ERROR "Must enable GLSL if building CLI." )
endif ( )
if ( NOT SPIRV_CROSS_ENABLE_HLSL )
message ( FATAL_ERROR "Must enable HLSL if building CLI." )
endif ( )
if ( NOT SPIRV_CROSS_ENABLE_MSL )
message ( FATAL_ERROR "Must enable MSL if building CLI." )
endif ( )
if ( NOT SPIRV_CROSS_ENABLE_CPP )
message ( FATAL_ERROR "Must enable C++ if building CLI." )
endif ( )
if ( NOT SPIRV_CROSS_ENABLE_REFLECT )
message ( FATAL_ERROR "Must enable reflection if building CLI." )
endif ( )
if ( NOT SPIRV_CROSS_ENABLE_UTIL )
message ( FATAL_ERROR "Must enable utils if building CLI." )
endif ( )
2019-02-12 10:11:29 +00:00
if ( NOT SPIRV_CROSS_STATIC )
message ( FATAL_ERROR "Must build static libraries if building CLI." )
endif ( )
add_executable ( spirv-cross main.cpp )
target_compile_options ( spirv-cross PRIVATE ${ spirv-compiler-options } )
2019-05-24 13:23:29 +00:00
target_include_directories ( spirv-cross PRIVATE ${ CMAKE_CURRENT_BINARY_DIR } )
target_compile_definitions ( spirv-cross PRIVATE ${ spirv-compiler-defines } HAVE_SPIRV_CROSS_GIT_VERSION )
2019-03-05 10:15:08 +00:00
set_target_properties ( spirv-cross PROPERTIES LINK_FLAGS "${spirv-cross-link-flags}" )
2019-09-16 08:20:34 +00:00
if ( NOT SPIRV_CROSS_SKIP_INSTALL )
2021-07-11 13:22:43 +00:00
install ( TARGETS spirv-cross DESTINATION ${ CMAKE_INSTALL_BINDIR } )
2019-09-16 08:20:34 +00:00
endif ( )
2019-02-12 10:11:29 +00:00
target_link_libraries ( spirv-cross PRIVATE
2019-03-27 12:21:11 +00:00
s p i r v - c r o s s - g l s l
s p i r v - c r o s s - h l s l
s p i r v - c r o s s - c p p
s p i r v - c r o s s - r e f l e c t
s p i r v - c r o s s - m s l
s p i r v - c r o s s - u t i l
s p i r v - c r o s s - c o r e )
2017-01-24 00:49:16 +00:00
2019-03-07 09:22:58 +00:00
if ( SPIRV_CROSS_ENABLE_TESTS )
# Set up tests, using only the simplest modes of the test_shaders
# script. You have to invoke the script manually to:
# - Update the reference files
# - Get cycle counts from malisc
# - Keep failing outputs
2024-01-16 12:54:10 +00:00
if ( ${ CMAKE_VERSION } VERSION_GREATER "3.12" )
find_package ( Python3 )
if ( ${ PYTHON3_FOUND } )
set ( PYTHONINTERP_FOUND ON )
set ( PYTHON_VERSION_MAJOR 3 )
set ( PYTHON_EXECUTABLE ${ Python3_EXECUTABLE } )
else ( )
set ( PYTHONINTERP_FOUND OFF )
endif ( )
else ( )
find_package ( PythonInterp )
endif ( )
2019-03-07 09:22:58 +00:00
find_program ( spirv-cross-glslang NAMES glslangValidator
2019-03-27 12:21:11 +00:00
P A T H S $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / e x t e r n a l / g l s l a n g - b u i l d / o u t p u t / b i n
N O _ D E F A U L T _ P A T H )
2019-03-07 09:22:58 +00:00
find_program ( spirv-cross-spirv-as NAMES spirv-as
2019-03-27 12:21:11 +00:00
P A T H S $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / e x t e r n a l / s p i r v - t o o l s - b u i l d / o u t p u t / b i n
N O _ D E F A U L T _ P A T H )
2019-03-07 09:22:58 +00:00
find_program ( spirv-cross-spirv-val NAMES spirv-val
2019-03-27 12:21:11 +00:00
P A T H S $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / e x t e r n a l / s p i r v - t o o l s - b u i l d / o u t p u t / b i n
N O _ D E F A U L T _ P A T H )
2019-03-07 11:36:16 +00:00
find_program ( spirv-cross-spirv-opt NAMES spirv-opt
2019-03-27 12:21:11 +00:00
P A T H S $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / e x t e r n a l / s p i r v - t o o l s - b u i l d / o u t p u t / b i n
N O _ D E F A U L T _ P A T H )
2019-03-07 09:22:58 +00:00
2019-03-07 11:36:16 +00:00
if ( ( ${ spirv-cross-glslang } MATCHES "NOTFOUND" ) OR ( ${ spirv-cross-spirv-as } MATCHES "NOTFOUND" ) OR ( ${ spirv-cross-spirv-val } MATCHES "NOTFOUND" ) OR ( ${ spirv-cross-spirv-opt } MATCHES "NOTFOUND" ) )
2019-03-07 09:22:58 +00:00
set ( SPIRV_CROSS_ENABLE_TESTS OFF )
2019-11-12 15:14:26 +00:00
message ( "SPIRV-Cross: Testing will be disabled for SPIRV-Cross. Could not find glslang or SPIRV-Tools build under external/. To enable testing, run ./checkout_glslang_spirv_tools.sh and ./build_glslang_spirv_tools.sh first." )
2019-03-07 09:22:58 +00:00
else ( )
set ( SPIRV_CROSS_ENABLE_TESTS ON )
2019-11-12 15:14:26 +00:00
message ( "SPIRV-Cross: Found glslang and SPIRV-Tools. Enabling test suite." )
message ( "SPIRV-Cross: Found glslangValidator in: ${spirv-cross-glslang}." )
message ( "SPIRV-Cross: Found spirv-as in: ${spirv-cross-spirv-as}." )
message ( "SPIRV-Cross: Found spirv-val in: ${spirv-cross-spirv-val}." )
message ( "SPIRV-Cross: Found spirv-opt in: ${spirv-cross-spirv-opt}." )
2019-03-07 09:22:58 +00:00
endif ( )
2019-03-07 11:36:16 +00:00
set ( spirv-cross-externals
2019-03-27 12:21:11 +00:00
- - g l s l a n g " $ { s p i r v - c r o s s - g l s l a n g } "
- - s p i r v - a s " $ { s p i r v - c r o s s - s p i r v - a s } "
- - s p i r v - o p t " $ { s p i r v - c r o s s - s p i r v - o p t } "
- - s p i r v - v a l " $ { s p i r v - c r o s s - s p i r v - v a l } " )
2019-03-07 11:36:16 +00:00
2019-03-07 09:22:58 +00:00
if ( ${ PYTHONINTERP_FOUND } AND SPIRV_CROSS_ENABLE_TESTS )
if ( ${ PYTHON_VERSION_MAJOR } GREATER 2 )
add_executable ( spirv-cross-c-api-test tests-other/c_api_test.c )
target_link_libraries ( spirv-cross-c-api-test spirv-cross-c )
set_target_properties ( spirv-cross-c-api-test PROPERTIES LINK_FLAGS "${spirv-cross-link-flags}" )
2019-04-08 13:22:22 +00:00
add_executable ( spirv-cross-small-vector-test tests-other/small_vector.cpp )
target_link_libraries ( spirv-cross-small-vector-test spirv-cross-core )
set_target_properties ( spirv-cross-small-vector-test PROPERTIES LINK_FLAGS "${spirv-cross-link-flags}" )
2019-06-10 13:41:36 +00:00
add_executable ( spirv-cross-msl-constexpr-test tests-other/msl_constexpr_test.cpp )
target_link_libraries ( spirv-cross-msl-constexpr-test spirv-cross-c )
set_target_properties ( spirv-cross-msl-constexpr-test PROPERTIES LINK_FLAGS "${spirv-cross-link-flags}" )
2019-06-24 08:45:13 +00:00
add_executable ( spirv-cross-msl-resource-binding-test tests-other/msl_resource_bindings.cpp )
target_link_libraries ( spirv-cross-msl-resource-binding-test spirv-cross-c )
set_target_properties ( spirv-cross-msl-resource-binding-test PROPERTIES LINK_FLAGS "${spirv-cross-link-flags}" )
2020-01-09 10:18:14 +00:00
add_executable ( spirv-cross-hlsl-resource-binding-test tests-other/hlsl_resource_bindings.cpp )
target_link_libraries ( spirv-cross-hlsl-resource-binding-test spirv-cross-c )
set_target_properties ( spirv-cross-hlsl-resource-binding-test PROPERTIES LINK_FLAGS "${spirv-cross-link-flags}" )
MSL: Add support for sampler Y'CbCr conversion.
This change introduces functions and in one case, a class, to support
the `VK_KHR_sampler_ycbcr_conversion` extension. Except in the case of
GBGR8 and BGRG8 formats, for which Metal natively supports implicit
chroma reconstruction, we're on our own here. We have to do everything
ourselves. Much of the complexity comes from the need to support
multiple planes, which must now be passed to functions that use the
corresponding combined image-samplers. The rest is from the actual
Y'CbCr conversion itself, which requires additional post-processing of
the sample retrieved from the image.
Passing sampled images to a function was a particular problem. To
support this, I've added a new class which is emitted to MSL shaders
that pass sampled images with Y'CbCr conversions attached around. It
can handle sampled images with or without Y'CbCr conversion. This is an
awful abomination that should not exist, but I'm worried that there's
some shader out there which does this. This support requires Metal 2.0
to work properly, because it uses default-constructed texture objects,
which were only added in MSL 2. I'm not even going to get into arrays of
combined image-samplers--that's a whole other can of worms. They are
deliberately unsupported in this change.
I've taken the liberty of refactoring the support for texture swizzling
while I'm at it. It's now treated as a post-processing step similar to
Y'CbCr conversion. I'd like to think this is cleaner than having
everything in `to_function_name()`/`to_function_args()`. It still looks
really hairy, though. I did, however, get rid of the explicit type
arguments to `spvGatherSwizzle()`/`spvGatherCompareSwizzle()`.
Update the C API. In addition to supporting this new functionality, add
some compiler options that I added in previous changes, but for which I
neglected to update the C API.
2019-08-02 20:11:19 +00:00
add_executable ( spirv-cross-msl-ycbcr-conversion-test tests-other/msl_ycbcr_conversion_test.cpp )
target_link_libraries ( spirv-cross-msl-ycbcr-conversion-test spirv-cross-c )
set_target_properties ( spirv-cross-msl-ycbcr-conversion-test PROPERTIES LINK_FLAGS "${spirv-cross-link-flags}" )
2019-09-05 10:43:40 +00:00
add_executable ( spirv-cross-typed-id-test tests-other/typed_id_test.cpp )
target_link_libraries ( spirv-cross-typed-id-test spirv-cross-core )
set_target_properties ( spirv-cross-typed-id-test PROPERTIES LINK_FLAGS "${spirv-cross-link-flags}" )
2019-03-07 09:22:58 +00:00
if ( CMAKE_COMPILER_IS_GNUCXX OR ( ${ CMAKE_CXX_COMPILER_ID } MATCHES "Clang" ) )
target_compile_options ( spirv-cross-c-api-test PRIVATE -std=c89 -Wall -Wextra )
endif ( )
2019-03-07 11:36:16 +00:00
add_test ( NAME spirv-cross-c-api-test
2019-05-14 08:06:33 +00:00
C O M M A N D $ < T A R G E T _ F I L E : s p i r v - c r o s s - c - a p i - t e s t > $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / t e s t s - o t h e r / c _ a p i _ t e s t . s p v
$ { s p i r v - c r o s s - a b i - m a j o r }
$ { s p i r v - c r o s s - a b i - m i n o r }
$ { s p i r v - c r o s s - a b i - p a t c h } )
2019-04-08 13:22:22 +00:00
add_test ( NAME spirv-cross-small-vector-test
C O M M A N D $ < T A R G E T _ F I L E : s p i r v - c r o s s - s m a l l - v e c t o r - t e s t > )
2019-06-10 13:41:36 +00:00
add_test ( NAME spirv-cross-msl-constexpr-test
C O M M A N D $ < T A R G E T _ F I L E : s p i r v - c r o s s - m s l - c o n s t e x p r - t e s t > $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / t e s t s - o t h e r / m s l _ c o n s t e x p r _ t e s t . s p v )
2019-06-24 08:45:13 +00:00
add_test ( NAME spirv-cross-msl-resource-binding-test
C O M M A N D $ < T A R G E T _ F I L E : s p i r v - c r o s s - m s l - r e s o u r c e - b i n d i n g - t e s t > $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / t e s t s - o t h e r / m s l _ r e s o u r c e _ b i n d i n g . s p v )
2020-01-09 10:18:14 +00:00
add_test ( NAME spirv-cross-hlsl-resource-binding-test
C O M M A N D $ < T A R G E T _ F I L E : s p i r v - c r o s s - h l s l - r e s o u r c e - b i n d i n g - t e s t > $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / t e s t s - o t h e r / h l s l _ r e s o u r c e _ b i n d i n g . s p v )
MSL: Add support for sampler Y'CbCr conversion.
This change introduces functions and in one case, a class, to support
the `VK_KHR_sampler_ycbcr_conversion` extension. Except in the case of
GBGR8 and BGRG8 formats, for which Metal natively supports implicit
chroma reconstruction, we're on our own here. We have to do everything
ourselves. Much of the complexity comes from the need to support
multiple planes, which must now be passed to functions that use the
corresponding combined image-samplers. The rest is from the actual
Y'CbCr conversion itself, which requires additional post-processing of
the sample retrieved from the image.
Passing sampled images to a function was a particular problem. To
support this, I've added a new class which is emitted to MSL shaders
that pass sampled images with Y'CbCr conversions attached around. It
can handle sampled images with or without Y'CbCr conversion. This is an
awful abomination that should not exist, but I'm worried that there's
some shader out there which does this. This support requires Metal 2.0
to work properly, because it uses default-constructed texture objects,
which were only added in MSL 2. I'm not even going to get into arrays of
combined image-samplers--that's a whole other can of worms. They are
deliberately unsupported in this change.
I've taken the liberty of refactoring the support for texture swizzling
while I'm at it. It's now treated as a post-processing step similar to
Y'CbCr conversion. I'd like to think this is cleaner than having
everything in `to_function_name()`/`to_function_args()`. It still looks
really hairy, though. I did, however, get rid of the explicit type
arguments to `spvGatherSwizzle()`/`spvGatherCompareSwizzle()`.
Update the C API. In addition to supporting this new functionality, add
some compiler options that I added in previous changes, but for which I
neglected to update the C API.
2019-08-02 20:11:19 +00:00
add_test ( NAME spirv-cross-msl-ycbcr-conversion-test
C O M M A N D $ < T A R G E T _ F I L E : s p i r v - c r o s s - m s l - y c b c r - c o n v e r s i o n - t e s t > $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / t e s t s - o t h e r / m s l _ y c b c r _ c o n v e r s i o n _ t e s t . s p v )
add_test ( NAME spirv-cross-msl-ycbcr-conversion-test-2
C O M M A N D $ < T A R G E T _ F I L E : s p i r v - c r o s s - m s l - y c b c r - c o n v e r s i o n - t e s t > $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / t e s t s - o t h e r / m s l _ y c b c r _ c o n v e r s i o n _ t e s t _ 2 . s p v )
2019-09-05 10:43:40 +00:00
add_test ( NAME spirv-cross-typed-id-test
C O M M A N D $ < T A R G E T _ F I L E : s p i r v - c r o s s - t y p e d - i d - t e s t > )
2019-03-07 11:36:16 +00:00
add_test ( NAME spirv-cross-test
2019-03-27 12:21:11 +00:00
C O M M A N D $ { P Y T H O N _ E X E C U T A B L E } $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / t e s t _ s h a d e r s . p y - - p a r a l l e l
$ { s p i r v - c r o s s - e x t e r n a l s }
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s h a d e r s
W O R K I N G _ D I R E C T O R Y $ < T A R G E T _ F I L E _ D I R : s p i r v - c r o s s > )
2019-03-07 11:36:16 +00:00
add_test ( NAME spirv-cross-test-no-opt
2019-03-27 12:21:11 +00:00
C O M M A N D $ { P Y T H O N _ E X E C U T A B L E } $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / t e s t _ s h a d e r s . p y - - p a r a l l e l
$ { s p i r v - c r o s s - e x t e r n a l s }
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s h a d e r s - n o - o p t
W O R K I N G _ D I R E C T O R Y $ < T A R G E T _ F I L E _ D I R : s p i r v - c r o s s > )
2019-03-07 11:36:16 +00:00
add_test ( NAME spirv-cross-test-metal
2019-03-27 12:21:11 +00:00
C O M M A N D $ { P Y T H O N _ E X E C U T A B L E } $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / t e s t _ s h a d e r s . p y - - m e t a l - - p a r a l l e l
$ { s p i r v - c r o s s - e x t e r n a l s }
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s h a d e r s - m s l
W O R K I N G _ D I R E C T O R Y $ < T A R G E T _ F I L E _ D I R : s p i r v - c r o s s > )
2019-03-07 11:36:16 +00:00
add_test ( NAME spirv-cross-test-metal-no-opt
2019-03-27 12:21:11 +00:00
C O M M A N D $ { P Y T H O N _ E X E C U T A B L E } $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / t e s t _ s h a d e r s . p y - - m e t a l - - p a r a l l e l
$ { s p i r v - c r o s s - e x t e r n a l s }
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s h a d e r s - m s l - n o - o p t
W O R K I N G _ D I R E C T O R Y $ < T A R G E T _ F I L E _ D I R : s p i r v - c r o s s > )
2019-03-07 11:36:16 +00:00
add_test ( NAME spirv-cross-test-hlsl
2019-03-27 12:21:11 +00:00
C O M M A N D $ { P Y T H O N _ E X E C U T A B L E } $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / t e s t _ s h a d e r s . p y - - h l s l - - p a r a l l e l
$ { s p i r v - c r o s s - e x t e r n a l s }
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s h a d e r s - h l s l
W O R K I N G _ D I R E C T O R Y $ < T A R G E T _ F I L E _ D I R : s p i r v - c r o s s > )
2019-03-07 11:36:16 +00:00
add_test ( NAME spirv-cross-test-hlsl-no-opt
2019-03-27 12:21:11 +00:00
C O M M A N D $ { P Y T H O N _ E X E C U T A B L E } $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / t e s t _ s h a d e r s . p y - - h l s l - - p a r a l l e l
$ { s p i r v - c r o s s - e x t e r n a l s }
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s h a d e r s - h l s l - n o - o p t
W O R K I N G _ D I R E C T O R Y $ < T A R G E T _ F I L E _ D I R : s p i r v - c r o s s > )
2019-03-07 11:36:16 +00:00
add_test ( NAME spirv-cross-test-opt
2019-03-27 12:21:11 +00:00
C O M M A N D $ { P Y T H O N _ E X E C U T A B L E } $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / t e s t _ s h a d e r s . p y - - o p t - - p a r a l l e l
$ { s p i r v - c r o s s - e x t e r n a l s }
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s h a d e r s
W O R K I N G _ D I R E C T O R Y $ < T A R G E T _ F I L E _ D I R : s p i r v - c r o s s > )
2019-03-07 11:36:16 +00:00
add_test ( NAME spirv-cross-test-metal-opt
2019-03-27 12:21:11 +00:00
C O M M A N D $ { P Y T H O N _ E X E C U T A B L E } $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / t e s t _ s h a d e r s . p y - - m e t a l - - o p t - - p a r a l l e l
$ { s p i r v - c r o s s - e x t e r n a l s }
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s h a d e r s - m s l
W O R K I N G _ D I R E C T O R Y $ < T A R G E T _ F I L E _ D I R : s p i r v - c r o s s > )
2019-03-07 11:36:16 +00:00
add_test ( NAME spirv-cross-test-hlsl-opt
2019-03-27 12:21:11 +00:00
C O M M A N D $ { P Y T H O N _ E X E C U T A B L E } $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / t e s t _ s h a d e r s . p y - - h l s l - - o p t - - p a r a l l e l
$ { s p i r v - c r o s s - e x t e r n a l s }
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s h a d e r s - h l s l
W O R K I N G _ D I R E C T O R Y $ < T A R G E T _ F I L E _ D I R : s p i r v - c r o s s > )
2019-03-07 11:36:16 +00:00
add_test ( NAME spirv-cross-test-reflection
2019-03-27 12:21:11 +00:00
C O M M A N D $ { P Y T H O N _ E X E C U T A B L E } $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / t e s t _ s h a d e r s . p y - - r e f l e c t - - p a r a l l e l
$ { s p i r v - c r o s s - e x t e r n a l s }
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s h a d e r s - r e f l e c t i o n
W O R K I N G _ D I R E C T O R Y $ < T A R G E T _ F I L E _ D I R : s p i r v - c r o s s > )
2019-10-24 08:54:32 +00:00
add_test ( NAME spirv-cross-test-ue4
C O M M A N D $ { P Y T H O N _ E X E C U T A B L E } $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / t e s t _ s h a d e r s . p y - - m s l - - p a r a l l e l
$ { s p i r v - c r o s s - e x t e r n a l s }
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s h a d e r s - u e 4
W O R K I N G _ D I R E C T O R Y $ < T A R G E T _ F I L E _ D I R : s p i r v - c r o s s > )
add_test ( NAME spirv-cross-test-ue4-opt
C O M M A N D $ { P Y T H O N _ E X E C U T A B L E } $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / t e s t _ s h a d e r s . p y - - m s l - - o p t - - p a r a l l e l
$ { s p i r v - c r o s s - e x t e r n a l s }
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s h a d e r s - u e 4
W O R K I N G _ D I R E C T O R Y $ < T A R G E T _ F I L E _ D I R : s p i r v - c r o s s > )
2019-12-02 21:17:21 +00:00
add_test ( NAME spirv-cross-test-ue4-no-opt
C O M M A N D $ { P Y T H O N _ E X E C U T A B L E } $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / t e s t _ s h a d e r s . p y - - m s l - - p a r a l l e l
$ { s p i r v - c r o s s - e x t e r n a l s }
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / s h a d e r s - u e 4 - n o - o p t
W O R K I N G _ D I R E C T O R Y $ < T A R G E T _ F I L E _ D I R : s p i r v - c r o s s > )
2019-03-04 10:13:41 +00:00
endif ( )
2019-03-07 09:22:58 +00:00
elseif ( NOT ${ PYTHONINTERP_FOUND } )
2019-11-12 15:14:26 +00:00
message ( WARNING "SPIRV-Cross: Testing disabled. Could not find python3. If you have python3 installed try running "
2019-03-27 12:21:11 +00:00
" c m a k e w i t h - D P Y T H O N _ E X E C U T A B L E : F I L E P A T H = / p a t h / t o / p y t h o n 3 t o h e l p i t f i n d t h e e x e c u t a b l e " )
2019-02-12 10:11:29 +00:00
endif ( )
endif ( )
2016-03-19 21:13:06 +00:00
endif ( )