2016-01-07 21:44:22 +03:00
# Copyright (c) 2015-2016 The Khronos Group Inc.
2015-05-22 20:26:19 +03:00
#
2016-09-01 22:33:59 +03: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
2015-05-22 20:26:19 +03:00
#
2016-09-01 22:33:59 +03:00
# http://www.apache.org/licenses/LICENSE-2.0
2015-05-22 20:26:19 +03:00
#
2016-09-01 22:33:59 +03:00
# 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.
2015-05-22 20:26:19 +03:00
2016-03-14 15:41:32 +03:00
cmake_minimum_required ( VERSION 2.8.12 )
2017-10-10 15:23:42 +03:00
if ( POLICY CMP0048 )
cmake_policy ( SET CMP0048 NEW )
endif ( )
2016-08-08 05:49:00 +03:00
if ( POLICY CMP0054 )
# Avoid dereferencing variables or interpret keywords that have been
# quoted or bracketed.
# https://cmake.org/cmake/help/v3.1/policy/CMP0054.html
cmake_policy ( SET CMP0054 NEW )
endif ( )
2017-04-06 00:32:39 +03:00
set_property ( GLOBAL PROPERTY USE_FOLDERS ON )
2016-08-08 05:49:00 +03:00
2015-07-29 22:22:09 +03:00
project ( spirv-tools )
2016-02-02 22:41:35 +03:00
enable_testing ( )
2015-11-18 17:22:10 +03:00
set ( SPIRV_TOOLS "SPIRV-Tools" )
2015-05-22 20:26:19 +03:00
2017-07-04 16:11:40 +03:00
include ( GNUInstallDirs )
2016-04-04 01:21:35 +03:00
set ( CMAKE_POSITION_INDEPENDENT_CODE ON )
2018-09-27 16:44:01 +03:00
set ( CMAKE_CXX_STANDARD 11 )
2016-04-04 01:21:35 +03:00
2018-11-23 19:47:37 +03:00
option ( SPIRV_ALLOW_TIMERS "Allow timers via clock_gettime on supported platforms" ON )
2015-05-22 20:26:19 +03:00
if ( "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" )
add_definitions ( -DSPIRV_LINUX )
2018-11-23 19:47:37 +03:00
set ( SPIRV_TIMER_ENABLED ${ SPIRV_ALLOW_TIMERS } )
2019-10-09 18:45:11 +03:00
elseif ( "${CMAKE_SYSTEM_NAME}" STREQUAL "Emscripten" )
add_definitions ( -DSPIRV_EMSCRIPTEN )
2020-05-19 18:43:35 +03:00
elseif ( "${CMAKE_SYSTEM_NAME}" MATCHES "Windows" )
2015-05-22 20:26:19 +03:00
add_definitions ( -DSPIRV_WINDOWS )
2016-12-19 21:26:42 +03:00
elseif ( "${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN" )
add_definitions ( -DSPIRV_WINDOWS )
2015-05-22 20:26:19 +03:00
elseif ( "${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin" )
add_definitions ( -DSPIRV_MAC )
2019-11-01 20:46:25 +03:00
elseif ( "${CMAKE_SYSTEM_NAME}" STREQUAL "iOS" )
add_definitions ( -DSPIRV_IOS )
2016-04-18 17:59:47 +03:00
elseif ( "${CMAKE_SYSTEM_NAME}" STREQUAL "Android" )
add_definitions ( -DSPIRV_ANDROID )
2018-11-23 19:47:37 +03:00
set ( SPIRV_TIMER_ENABLED ${ SPIRV_ALLOW_TIMERS } )
2017-05-29 00:19:58 +03:00
elseif ( "${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD" )
add_definitions ( -DSPIRV_FREEBSD )
2019-11-27 00:22:59 +03:00
elseif ( "${CMAKE_SYSTEM_NAME}" STREQUAL "Fuchsia" )
add_definitions ( -DSPIRV_FUCHSIA )
2015-05-22 20:26:19 +03:00
else ( )
message ( FATAL_ERROR "Your platform '${CMAKE_SYSTEM_NAME}' is not supported!" )
endif ( )
2018-03-07 17:25:51 +03:00
if ( ${ SPIRV_TIMER_ENABLED } )
add_definitions ( -DSPIRV_TIMER_ENABLED )
endif ( )
2017-11-23 01:03:55 +03:00
2015-11-18 17:22:10 +03:00
if ( "${CMAKE_BUILD_TYPE}" STREQUAL "" )
2015-05-22 20:26:19 +03:00
message ( STATUS "No build type selected, default to Debug" )
set ( CMAKE_BUILD_TYPE "Debug" )
endif ( )
2017-07-04 16:11:40 +03:00
option ( SKIP_SPIRV_TOOLS_INSTALL "Skip installation" ${ SKIP_SPIRV_TOOLS_INSTALL } )
if ( NOT ${ SKIP_SPIRV_TOOLS_INSTALL } )
set ( ENABLE_SPIRV_TOOLS_INSTALL ON )
endif ( )
2017-09-25 19:45:48 +03:00
option ( SPIRV_BUILD_COMPRESSION "Build SPIR-V compressing codec" OFF )
2019-05-24 22:43:59 +03:00
if ( SPIRV_BUILD_COMPRESSION )
message ( FATAL_ERROR "SPIR-V compression codec has been removed from SPIR-V tools. "
" P l e a s e r e m o v e S P I R V _ B U I L D _ C O M P R E S S I O N f r o m y o u r b u i l d o p t i o n s . " )
endif ( SPIRV_BUILD_COMPRESSION )
2017-09-25 19:45:48 +03:00
2020-09-09 11:56:32 +03:00
option ( SPIRV_BUILD_FUZZER "Build spirv-fuzz" OFF )
2015-11-19 17:22:53 +03:00
option ( SPIRV_WERROR "Enable error on warning" ON )
2018-08-07 16:15:20 +03:00
if ( ( "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" ) OR ( ( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" ) AND ( NOT CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC" ) ) )
2016-02-29 09:01:04 +03:00
set ( COMPILER_IS_LIKE_GNU TRUE )
endif ( )
if ( ${ COMPILER_IS_LIKE_GNU } )
2018-08-03 15:06:07 +03:00
set ( SPIRV_WARNINGS -Wall -Wextra -Wnon-virtual-dtor -Wno-missing-field-initializers )
if ( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
set ( SPIRV_WARNINGS ${ SPIRV_WARNINGS } -Wno-self-assign )
endif ( )
2015-10-15 23:43:14 +03:00
2015-12-09 19:40:56 +03:00
option ( SPIRV_WARN_EVERYTHING "Enable -Weverything" ${ SPIRV_WARN_EVERYTHING } )
2015-11-18 17:22:10 +03:00
if ( ${ SPIRV_WARN_EVERYTHING } )
2015-12-09 19:40:56 +03:00
if ( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" )
set ( SPIRV_WARNINGS ${ SPIRV_WARNINGS }
- W e v e r y t h i n g - W n o - c + + 9 8 - c o m p a t - W n o - c + + 9 8 - c o m p a t - p e d a n t i c - W n o - p a d d e d )
elseif ( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" )
set ( SPIRV_WARNINGS ${ SPIRV_WARNINGS } -Wpedantic -pedantic-errors )
else ( )
message ( STATUS "Unknown compiler ${CMAKE_CXX_COMPILER_ID}, "
" s o S P I R V _ W A R N _ E V E R Y T H I N G h a s n o e f f e c t " )
endif ( )
2015-10-15 23:43:14 +03:00
endif ( )
2015-11-18 17:22:10 +03:00
if ( ${ SPIRV_WERROR } )
set ( SPIRV_WARNINGS ${ SPIRV_WARNINGS } -Werror )
2015-05-22 20:26:19 +03:00
endif ( )
2016-02-29 09:01:04 +03:00
elseif ( MSVC )
2018-01-10 22:23:47 +03:00
set ( SPIRV_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS /wd4800 )
2015-11-19 17:22:53 +03:00
if ( ${ SPIRV_WERROR } )
set ( SPIRV_WARNINGS ${ SPIRV_WARNINGS } /WX )
endif ( )
2015-05-22 20:26:19 +03:00
endif ( )
2018-07-11 17:27:34 +03:00
include_directories ( ${ CMAKE_CURRENT_SOURCE_DIR } / )
2016-06-03 01:51:05 +03:00
2015-11-12 19:44:42 +03:00
option ( SPIRV_COLOR_TERMINAL "Enable color terminal output" ON )
if ( ${ SPIRV_COLOR_TERMINAL } )
add_definitions ( -DSPIRV_COLOR_TERMINAL )
2015-05-22 20:26:19 +03:00
endif ( )
2016-09-08 18:43:48 +03:00
option ( SPIRV_LOG_DEBUG "Enable excessive debug output" OFF )
if ( ${ SPIRV_LOG_DEBUG } )
add_definitions ( -DSPIRV_LOG_DEBUG )
endif ( )
2017-08-16 23:42:50 +03:00
if ( DEFINED SPIRV_TOOLS_EXTRA_DEFINITIONS )
add_definitions ( ${ SPIRV_TOOLS_EXTRA_DEFINITIONS } )
endif ( )
2020-10-29 16:25:26 +03:00
# Library build setting definitions:
#
# * SPIRV_TOOLS_BUILD_STATIC - ON or OFF - Defaults to ON.
# If enabled the following targets will be created:
# ${SPIRV_TOOLS}-static - STATIC library.
# Has full public symbol visibility.
# ${SPIRV_TOOLS}-shared - SHARED library.
# Has default-hidden symbol visibility.
# ${SPIRV_TOOLS} - will alias to one of above, based on BUILD_SHARED_LIBS.
# If disabled the following targets will be created:
# ${SPIRV_TOOLS} - either STATIC or SHARED based on SPIRV_TOOLS_LIBRARY_TYPE.
# Has full public symbol visibility.
# ${SPIRV_TOOLS}-shared - SHARED library.
# Has default-hidden symbol visibility.
#
# * SPIRV_TOOLS_LIBRARY_TYPE - SHARED or STATIC.
# Specifies the library type used for building SPIRV-Tools libraries.
# Defaults to SHARED when BUILD_SHARED_LIBS=1, otherwise STATIC.
#
# * SPIRV_TOOLS_FULL_VISIBILITY - "${SPIRV_TOOLS}-static" or "${SPIRV_TOOLS}"
# Evaluates to the SPIRV_TOOLS target library name that has no hidden symbols.
# This is used by internal targets for accessing symbols that are non-public.
# Note this target provides no API stability guarantees.
#
# Ideally, all of these will go away - see https://github.com/KhronosGroup/SPIRV-Tools/issues/3909.
option ( SPIRV_TOOLS_BUILD_STATIC "Build ${SPIRV_TOOLS}-static target. ${SPIRV_TOOLS} will alias to ${SPIRV_TOOLS}-static or ${SPIRV_TOOLS}-shared based on BUILD_SHARED_LIBS" ON )
if ( SPIRV_TOOLS_BUILD_STATIC )
set ( SPIRV_TOOLS_FULL_VISIBILITY ${ SPIRV_TOOLS } -static )
set ( SPIRV_TOOLS_LIBRARY_TYPE "STATIC" )
else ( SPIRV_TOOLS_BUILD_STATIC )
set ( SPIRV_TOOLS_FULL_VISIBILITY ${ SPIRV_TOOLS } )
if ( NOT DEFINED SPIRV_TOOLS_LIBRARY_TYPE )
if ( BUILD_SHARED_LIBS )
set ( SPIRV_TOOLS_LIBRARY_TYPE "SHARED" )
else ( )
set ( SPIRV_TOOLS_LIBRARY_TYPE "STATIC" )
endif ( )
endif ( )
endif ( SPIRV_TOOLS_BUILD_STATIC )
2016-01-27 02:04:55 +03:00
function ( spvtools_default_compile_options TARGET )
2015-11-18 17:22:10 +03:00
target_compile_options ( ${ TARGET } PRIVATE ${ SPIRV_WARNINGS } )
2016-02-29 09:01:04 +03:00
if ( ${ COMPILER_IS_LIKE_GNU } )
2015-11-18 17:22:10 +03:00
target_compile_options ( ${ TARGET } PRIVATE
- s t d = c + + 1 1 - f n o - e x c e p t i o n s - f n o - r t t i )
2016-01-11 18:54:20 +03:00
target_compile_options ( ${ TARGET } PRIVATE
- W a l l - W e x t r a - W n o - l o n g - l o n g - W s h a d o w - W u n d e f - W c o n v e r s i o n
- W n o - s i g n - c o n v e r s i o n )
2015-11-18 17:22:10 +03:00
# For good call stacks in profiles, keep the frame pointers.
if ( NOT "${SPIRV_PERF}" STREQUAL "" )
target_compile_options ( ${ TARGET } PRIVATE -fno-omit-frame-pointer )
endif ( )
if ( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" )
set ( SPIRV_USE_SANITIZER "" CACHE STRING
" U s e t h e c l a n g s a n i t i z e r [ a d d r e s s | m e m o r y | t h r e a d | . . . ] " )
if ( NOT "${SPIRV_USE_SANITIZER}" STREQUAL "" )
target_compile_options ( ${ TARGET } PRIVATE
- f s a n i t i z e = $ { S P I R V _ U S E _ S A N I T I Z E R } )
2019-04-11 23:33:26 +03:00
set_target_properties ( ${ TARGET } PROPERTIES
L I N K _ F L A G S - f s a n i t i z e = $ { S P I R V _ U S E _ S A N I T I Z E R } )
2015-11-18 17:22:10 +03:00
endif ( )
2018-10-19 18:59:01 +03:00
target_compile_options ( ${ TARGET } PRIVATE
- f t e m p l a t e - d e p t h = 1 0 2 4 )
2016-01-11 18:54:20 +03:00
else ( )
target_compile_options ( ${ TARGET } PRIVATE
- W n o - m i s s i n g - f i e l d - i n i t i a l i z e r s )
2015-11-18 17:22:10 +03:00
endif ( )
2015-05-22 20:26:19 +03:00
endif ( )
2016-02-29 09:01:04 +03:00
2017-04-03 20:41:20 +03:00
if ( MSVC )
# Specify /EHs for exception handling. This makes using SPIRV-Tools as
# dependencies in other projects easier.
target_compile_options ( ${ TARGET } PRIVATE /EHs )
endif ( )
2016-02-29 09:01:04 +03:00
# For MinGW cross compile, statically link to the C++ runtime.
# But it still depends on MSVCRT.dll.
if ( ${ CMAKE_SYSTEM_NAME } MATCHES "Windows" )
if ( ${ CMAKE_CXX_COMPILER_ID } MATCHES "GNU" )
2016-08-05 20:46:45 +03:00
set_target_properties ( ${ TARGET } PROPERTIES
L I N K _ F L A G S - s t a t i c - s t a t i c - l i b g c c - s t a t i c - l i b s t d c + + )
2016-02-29 09:01:04 +03:00
endif ( )
endif ( )
2015-11-18 17:22:10 +03:00
endfunction ( )
2015-05-22 20:26:19 +03:00
2016-02-24 18:11:07 +03:00
if ( NOT COMMAND find_host_package )
macro ( find_host_package )
find_package ( ${ ARGN } )
endmacro ( )
endif ( )
if ( NOT COMMAND find_host_program )
macro ( find_host_program )
find_program ( ${ ARGN } )
endmacro ( )
endif ( )
2019-04-12 15:23:19 +03:00
# Tests require Python3
find_host_package ( PythonInterp 3 REQUIRED )
2016-02-24 18:11:07 +03:00
2018-07-19 17:27:12 +03:00
# Check for symbol exports on Linux.
# At the moment, this check will fail on the OSX build machines for the Android NDK.
# It appears they don't have objdump.
if ( "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" )
2017-11-23 01:03:55 +03:00
macro ( spvtools_check_symbol_exports TARGET )
2018-07-04 21:20:52 +03:00
if ( NOT "${SPIRV_SKIP_TESTS}" )
add_test ( NAME spirv-tools-symbol-exports- ${ TARGET }
C O M M A N D $ { P Y T H O N _ E X E C U T A B L E }
$ { s p i r v - t o o l s _ S O U R C E _ D I R } / u t i l s / c h e c k _ s y m b o l _ e x p o r t s . p y " $ < T A R G E T _ F I L E : $ { T A R G E T } > " )
endif ( )
2017-11-23 01:03:55 +03:00
endmacro ( )
else ( )
macro ( spvtools_check_symbol_exports TARGET )
2018-07-04 21:20:52 +03:00
if ( NOT "${SPIRV_SKIP_TESTS}" )
message ( "Skipping symbol exports test for ${TARGET}" )
endif ( )
2017-11-23 01:03:55 +03:00
endmacro ( )
endif ( )
2016-02-23 00:07:19 +03:00
2019-10-17 18:36:55 +03:00
if ( ENABLE_SPIRV_TOOLS_INSTALL )
if ( WIN32 )
macro ( spvtools_config_package_dir TARGET PATH )
set ( ${ PATH } ${ TARGET } /cmake )
endmacro ( )
else ( )
macro ( spvtools_config_package_dir TARGET PATH )
2019-11-22 19:02:25 +03:00
set ( ${ PATH } ${ CMAKE_INSTALL_LIBDIR } /cmake/ ${ TARGET } )
2019-10-17 18:36:55 +03:00
endmacro ( )
endif ( )
macro ( spvtools_generate_config_file TARGET )
file ( WRITE ${ CMAKE_BINARY_DIR } / ${ TARGET } Config.cmake
" include ( CMakeFindDependencyMacro ) \ n "
" find_dependency ( ${ SPIRV_TOOLS } ) \ n "
" include ( \${CMAKE_CURRENT_LIST_DIR}/${TARGET}Targets.cmake)\n"
" set ( ${ TARGET } _LIBRARIES ${ TARGET } ) \ n "
" get_target_property ( ${ TARGET } _INCLUDE_DIRS ${ TARGET } INTERFACE_INCLUDE_DIRECTORIES ) \ n " )
endmacro ( )
endif ( )
2015-12-09 19:40:56 +03:00
# Defaults to OFF if the user didn't set it.
2015-11-18 17:22:10 +03:00
option ( SPIRV_SKIP_EXECUTABLES
2016-08-05 20:46:45 +03:00
" S k i p b u i l d i n g t h e e x e c u t a b l e a n d t e s t s a l o n g w i t h t h e l i b r a r y "
$ { S P I R V _ S K I P _ E X E C U T A B L E S } )
option ( SPIRV_SKIP_TESTS
" S k i p b u i l d i n g t e s t s a l o n g w i t h t h e l i b r a r y " $ { S P I R V _ S K I P _ T E S T S } )
if ( "${SPIRV_SKIP_EXECUTABLES}" )
set ( SPIRV_SKIP_TESTS ON )
endif ( )
2015-09-04 22:13:57 +03:00
2017-11-09 19:24:41 +03:00
# Defaults to ON. The checks can be time consuming.
# Turn off if they take too long.
option ( SPIRV_CHECK_CONTEXT "In a debug build, check if the IR context is in a valid state." ON )
if ( ${ SPIRV_CHECK_CONTEXT } )
add_definitions ( -DSPIRV_CHECK_CONTEXT )
endif ( )
2018-11-06 17:26:23 +03:00
# Precompiled header macro. Parameters are source file list and filename for pch cpp file.
2018-11-07 17:15:04 +03:00
macro ( spvtools_pch SRCS PCHPREFIX )
2020-04-09 21:46:08 +03:00
if ( MSVC AND CMAKE_GENERATOR MATCHES "^Visual Studio" AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
2018-11-06 17:26:23 +03:00
set ( PCH_NAME "$(IntDir)\\${PCHPREFIX}.pch" )
# make source files use/depend on PCH_NAME
set_source_files_properties ( ${ ${SRCS } } PROPERTIES COMPILE_FLAGS "/Yu${PCHPREFIX}.h /FI${PCHPREFIX}.h /Fp${PCH_NAME} /Zm300" OBJECT_DEPENDS "${PCH_NAME}" )
# make PCHPREFIX.cpp file compile and generate PCH_NAME
set_source_files_properties ( "${PCHPREFIX}.cpp" PROPERTIES COMPILE_FLAGS "/Yc${PCHPREFIX}.h /Fp${PCH_NAME} /Zm300" OBJECT_OUTPUTS "${PCH_NAME}" )
list ( APPEND ${ SRCS } "${PCHPREFIX}.cpp" )
endif ( )
2018-11-07 17:15:04 +03:00
endmacro ( spvtools_pch )
2018-11-06 17:26:23 +03:00
2016-03-17 05:43:31 +03:00
add_subdirectory ( external )
2015-11-18 17:22:10 +03:00
2019-08-07 18:09:55 +03:00
# Warning about extra semi-colons.
#
# This is not supported on all compilers/versions. so enabling only
# for clang, since that works for all versions that our bots run.
#
# This is intentionally done after adding the external subdirectory,
# so we don't enforce this flag on our dependencies, some of which do
# not pass it.
#
# If the minimum version of CMake supported is updated to 3.0 or
# later, then check_cxx_compiler_flag could be used instead.
if ( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
add_compile_options ( "-Wextra-semi" )
endif ( )
2016-03-17 05:43:31 +03:00
add_subdirectory ( source )
add_subdirectory ( tools )
2015-05-22 20:26:19 +03:00
2016-03-17 05:43:31 +03:00
add_subdirectory ( test )
2016-09-28 17:50:43 +03:00
add_subdirectory ( examples )
2015-05-22 20:26:19 +03:00
2017-07-04 16:11:40 +03:00
if ( ENABLE_SPIRV_TOOLS_INSTALL )
install (
F I L E S
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / i n c l u d e / s p i r v - t o o l s / l i b 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 } / i n c l u d e / s p i r v - t o o l s / l i b 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 } / i n c l u d e / s p i r v - t o o l s / o p t i m i z e r . h p p
2017-07-13 03:16:51 +03:00
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / i n c l u d e / s p i r v - t o o l s / l i n k e r . h p p
2018-11-08 21:54:54 +03:00
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / i n c l u d e / s p i r v - t o o l s / i n s t r u m e n t . h p p
2017-07-04 16:11:40 +03:00
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 - t o o l s / )
endif ( ENABLE_SPIRV_TOOLS_INSTALL )
2016-09-02 16:29:52 +03:00
2017-09-28 04:22:05 +03:00
if ( NOT "${SPIRV_SKIP_TESTS}" )
add_test ( NAME spirv-tools-copyrights
C O M M A N D $ { P Y T H O N _ E X E C U T A B L E } u t i l s / c h e c k _ c o p y r i g h t . p y
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 } )
2017-11-23 01:03:55 +03:00
endif ( )
2017-11-25 20:58:50 +03:00
2020-02-20 18:54:54 +03:00
set ( SPIRV_LIBRARIES "-lSPIRV-Tools-opt -lSPIRV-Tools -lSPIRV-Tools-link" )
2018-02-03 01:37:14 +03:00
set ( SPIRV_SHARED_LIBRARIES "-lSPIRV-Tools-shared" )
2017-11-25 20:58:50 +03:00
# Build pkg-config file
# Use a first-class target so it's regenerated when relevant files are updated.
add_custom_target ( spirv-tools-pkg-config ALL
2018-02-15 02:27:22 +03:00
C O M M A N D $ { C M A K E _ C O M M A N D }
- D C H A N G E S _ F I L E = $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / C H A N G E S
2017-11-25 20:58:50 +03:00
- D T E M P L A T E _ F I L E = $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / c m a k e / S P I R V - T o o l s . p c . i n
- D O U T _ F I L E = $ { 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 - T o o l s . p c
- D C M A K E _ I N S T A L L _ P R E F I X = $ { C M A K E _ I N S T A L L _ P R E F I X }
2018-02-09 14:30:08 +03:00
- D C M A K E _ I N S T A L L _ L I B D I R = $ { C M A K E _ I N S T A L L _ L I B D I R }
- D C M A K E _ I N S T A L L _ I N C L U D E D I R = $ { C M A K E _ I N S T A L L _ I N C L U D E D I R }
2017-11-25 20:58:50 +03:00
- D S P I R V _ L I B R A R I E S = $ { S P I R V _ L I B R A R I E S }
- P $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / c m a k e / w r i t e _ p k g _ c o n f i g . c m a k e
D E P E N D S " C H A N G E S " " c m a k e / S P I R V - T o o l s . p c . i n " " c m a k e / w r i t e _ p k g _ c o n f i g . c m a k e " )
2018-02-03 01:37:14 +03:00
add_custom_target ( spirv-tools-shared-pkg-config ALL
2018-02-15 02:27:22 +03:00
C O M M A N D $ { C M A K E _ C O M M A N D }
- D C H A N G E S _ F I L E = $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / C H A N G E S
2018-02-03 01:37:14 +03:00
- D T E M P L A T E _ F I L E = $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / c m a k e / S P I R V - T o o l s - s h a r e d . p c . i n
- D O U T _ F I L E = $ { 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 - T o o l s - s h a r e d . p c
- D C M A K E _ I N S T A L L _ P R E F I X = $ { C M A K E _ I N S T A L L _ P R E F I X }
2018-02-09 14:30:08 +03:00
- D C M A K E _ I N S T A L L _ L I B D I R = $ { C M A K E _ I N S T A L L _ L I B D I R }
- D C M A K E _ I N S T A L L _ I N C L U D E D I R = $ { C M A K E _ I N S T A L L _ I N C L U D E D I R }
2018-02-03 01:37:14 +03:00
- D S P I R V _ S H A R E D _ L I B R A R I E S = $ { S P I R V _ S H A R E D _ L I B R A R I E S }
- P $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / c m a k e / w r i t e _ p k g _ c o n f i g . c m a k e
D E P E N D S " C H A N G E S " " c m a k e / S P I R V - T o o l s - s h a r e d . p c . i n " " c m a k e / w r i t e _ p k g _ c o n f i g . c m a k e " )
2017-11-25 20:58:50 +03:00
# Install pkg-config file
if ( ENABLE_SPIRV_TOOLS_INSTALL )
install (
F I L E S
$ { 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 - T o o l s . p c
2018-02-03 01:37:14 +03:00
$ { 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 - T o o l s - s h a r e d . p c
2017-11-25 20:58:50 +03:00
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 k g c o n f i g )
endif ( )