2016-01-07 18:44:22 +00:00
|
|
|
# Copyright (c) 2015-2016 The Khronos Group Inc.
|
2015-05-22 17:26:19 +00:00
|
|
|
#
|
2016-09-01 19:33:59 +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
|
2015-05-22 17:26:19 +00:00
|
|
|
#
|
2016-09-01 19:33:59 +00:00
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
2015-05-22 17:26:19 +00:00
|
|
|
#
|
2016-09-01 19:33:59 +00: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 17:26:19 +00:00
|
|
|
|
2016-03-14 12:41:32 +00:00
|
|
|
cmake_minimum_required(VERSION 2.8.12)
|
2017-10-10 12:23:42 +00:00
|
|
|
if (POLICY CMP0048)
|
|
|
|
cmake_policy(SET CMP0048 NEW)
|
|
|
|
endif()
|
2016-08-08 02:49:00 +00: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-05 21:32:39 +00:00
|
|
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
2016-08-08 02:49:00 +00:00
|
|
|
|
2015-07-29 19:22:09 +00:00
|
|
|
project(spirv-tools)
|
2016-02-02 19:41:35 +00:00
|
|
|
enable_testing()
|
2015-11-18 14:22:10 +00:00
|
|
|
set(SPIRV_TOOLS "SPIRV-Tools")
|
2015-05-22 17:26:19 +00:00
|
|
|
|
2017-07-04 13:11:40 +00:00
|
|
|
include(GNUInstallDirs)
|
|
|
|
|
2016-04-03 22:21:35 +00:00
|
|
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
2018-09-27 13:44:01 +00:00
|
|
|
set(CMAKE_CXX_STANDARD 11)
|
2016-04-03 22:21:35 +00:00
|
|
|
|
2018-11-23 16:47:37 +00:00
|
|
|
option(SPIRV_ALLOW_TIMERS "Allow timers via clock_gettime on supported platforms" ON)
|
|
|
|
|
2015-05-22 17:26:19 +00:00
|
|
|
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
|
|
|
|
add_definitions(-DSPIRV_LINUX)
|
2018-11-23 16:47:37 +00:00
|
|
|
set(SPIRV_TIMER_ENABLED ${SPIRV_ALLOW_TIMERS})
|
2019-10-09 15:45:11 +00:00
|
|
|
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Emscripten")
|
|
|
|
add_definitions(-DSPIRV_EMSCRIPTEN)
|
2020-05-19 15:43:35 +00:00
|
|
|
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Windows")
|
2015-05-22 17:26:19 +00:00
|
|
|
add_definitions(-DSPIRV_WINDOWS)
|
2016-12-19 18:26:42 +00:00
|
|
|
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
|
|
|
|
add_definitions(-DSPIRV_WINDOWS)
|
2015-05-22 17:26:19 +00:00
|
|
|
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
|
|
|
|
add_definitions(-DSPIRV_MAC)
|
2019-11-01 17:46:25 +00:00
|
|
|
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "iOS")
|
|
|
|
add_definitions(-DSPIRV_IOS)
|
2016-04-18 14:59:47 +00:00
|
|
|
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Android")
|
|
|
|
add_definitions(-DSPIRV_ANDROID)
|
2018-11-23 16:47:37 +00:00
|
|
|
set(SPIRV_TIMER_ENABLED ${SPIRV_ALLOW_TIMERS})
|
2017-05-28 21:19:58 +00:00
|
|
|
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD")
|
|
|
|
add_definitions(-DSPIRV_FREEBSD)
|
2019-11-26 21:22:59 +00:00
|
|
|
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Fuchsia")
|
|
|
|
add_definitions(-DSPIRV_FUCHSIA)
|
2015-05-22 17:26:19 +00:00
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Your platform '${CMAKE_SYSTEM_NAME}' is not supported!")
|
|
|
|
endif()
|
|
|
|
|
2018-03-07 14:25:51 +00:00
|
|
|
if (${SPIRV_TIMER_ENABLED})
|
|
|
|
add_definitions(-DSPIRV_TIMER_ENABLED)
|
|
|
|
endif()
|
2017-11-22 22:03:55 +00:00
|
|
|
|
2015-11-18 14:22:10 +00:00
|
|
|
if ("${CMAKE_BUILD_TYPE}" STREQUAL "")
|
2015-05-22 17:26:19 +00:00
|
|
|
message(STATUS "No build type selected, default to Debug")
|
|
|
|
set(CMAKE_BUILD_TYPE "Debug")
|
|
|
|
endif()
|
|
|
|
|
2017-07-04 13:11:40 +00: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 16:45:48 +00:00
|
|
|
|
|
|
|
option(SPIRV_BUILD_COMPRESSION "Build SPIR-V compressing codec" OFF)
|
2019-05-24 19:43:59 +00:00
|
|
|
if(SPIRV_BUILD_COMPRESSION)
|
|
|
|
message(FATAL_ERROR "SPIR-V compression codec has been removed from SPIR-V tools. "
|
|
|
|
"Please remove SPIRV_BUILD_COMPRESSION from your build options.")
|
|
|
|
endif(SPIRV_BUILD_COMPRESSION)
|
2017-09-25 16:45:48 +00:00
|
|
|
|
2020-09-09 08:56:32 +00:00
|
|
|
option(SPIRV_BUILD_FUZZER "Build spirv-fuzz" OFF)
|
|
|
|
|
2015-11-19 14:22:53 +00:00
|
|
|
option(SPIRV_WERROR "Enable error on warning" ON)
|
2018-08-07 13:15:20 +00: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 06:01:04 +00:00
|
|
|
set(COMPILER_IS_LIKE_GNU TRUE)
|
|
|
|
endif()
|
|
|
|
if(${COMPILER_IS_LIKE_GNU})
|
2018-08-03 12:06:07 +00: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 20:43:14 +00:00
|
|
|
|
2015-12-09 16:40:56 +00:00
|
|
|
option(SPIRV_WARN_EVERYTHING "Enable -Weverything" ${SPIRV_WARN_EVERYTHING})
|
2015-11-18 14:22:10 +00:00
|
|
|
if(${SPIRV_WARN_EVERYTHING})
|
2015-12-09 16:40:56 +00:00
|
|
|
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
|
|
|
set(SPIRV_WARNINGS ${SPIRV_WARNINGS}
|
|
|
|
-Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-padded)
|
|
|
|
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
|
|
|
set(SPIRV_WARNINGS ${SPIRV_WARNINGS} -Wpedantic -pedantic-errors)
|
|
|
|
else()
|
|
|
|
message(STATUS "Unknown compiler ${CMAKE_CXX_COMPILER_ID}, "
|
|
|
|
"so SPIRV_WARN_EVERYTHING has no effect")
|
|
|
|
endif()
|
2015-10-15 20:43:14 +00:00
|
|
|
endif()
|
|
|
|
|
2015-11-18 14:22:10 +00:00
|
|
|
if(${SPIRV_WERROR})
|
|
|
|
set(SPIRV_WARNINGS ${SPIRV_WARNINGS} -Werror)
|
2015-05-22 17:26:19 +00:00
|
|
|
endif()
|
2016-02-29 06:01:04 +00:00
|
|
|
elseif(MSVC)
|
2018-01-10 19:23:47 +00:00
|
|
|
set(SPIRV_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS /wd4800)
|
2015-11-19 14:22:53 +00:00
|
|
|
|
|
|
|
if(${SPIRV_WERROR})
|
|
|
|
set(SPIRV_WARNINGS ${SPIRV_WARNINGS} /WX)
|
|
|
|
endif()
|
2015-05-22 17:26:19 +00:00
|
|
|
endif()
|
|
|
|
|
2018-07-11 14:27:34 +00:00
|
|
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/)
|
2016-06-02 22:51:05 +00:00
|
|
|
|
2015-11-12 16:44:42 +00:00
|
|
|
option(SPIRV_COLOR_TERMINAL "Enable color terminal output" ON)
|
|
|
|
if(${SPIRV_COLOR_TERMINAL})
|
|
|
|
add_definitions(-DSPIRV_COLOR_TERMINAL)
|
2015-05-22 17:26:19 +00:00
|
|
|
endif()
|
|
|
|
|
2016-09-08 15:43:48 +00:00
|
|
|
option(SPIRV_LOG_DEBUG "Enable excessive debug output" OFF)
|
|
|
|
if(${SPIRV_LOG_DEBUG})
|
|
|
|
add_definitions(-DSPIRV_LOG_DEBUG)
|
|
|
|
endif()
|
|
|
|
|
2017-08-16 20:42:50 +00:00
|
|
|
if (DEFINED SPIRV_TOOLS_EXTRA_DEFINITIONS)
|
|
|
|
add_definitions(${SPIRV_TOOLS_EXTRA_DEFINITIONS})
|
|
|
|
endif()
|
|
|
|
|
2016-01-26 23:04:55 +00:00
|
|
|
function(spvtools_default_compile_options TARGET)
|
2015-11-18 14:22:10 +00:00
|
|
|
target_compile_options(${TARGET} PRIVATE ${SPIRV_WARNINGS})
|
2016-02-29 06:01:04 +00:00
|
|
|
|
|
|
|
if (${COMPILER_IS_LIKE_GNU})
|
2015-11-18 14:22:10 +00:00
|
|
|
target_compile_options(${TARGET} PRIVATE
|
|
|
|
-std=c++11 -fno-exceptions -fno-rtti)
|
2016-01-11 15:54:20 +00:00
|
|
|
target_compile_options(${TARGET} PRIVATE
|
|
|
|
-Wall -Wextra -Wno-long-long -Wshadow -Wundef -Wconversion
|
|
|
|
-Wno-sign-conversion)
|
2015-11-18 14:22:10 +00: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
|
|
|
|
"Use the clang sanitizer [address|memory|thread|...]")
|
|
|
|
if(NOT "${SPIRV_USE_SANITIZER}" STREQUAL "")
|
|
|
|
target_compile_options(${TARGET} PRIVATE
|
|
|
|
-fsanitize=${SPIRV_USE_SANITIZER})
|
2019-04-11 20:33:26 +00:00
|
|
|
set_target_properties(${TARGET} PROPERTIES
|
|
|
|
LINK_FLAGS -fsanitize=${SPIRV_USE_SANITIZER})
|
2015-11-18 14:22:10 +00:00
|
|
|
endif()
|
2018-10-19 15:59:01 +00:00
|
|
|
target_compile_options(${TARGET} PRIVATE
|
|
|
|
-ftemplate-depth=1024)
|
2016-01-11 15:54:20 +00:00
|
|
|
else()
|
|
|
|
target_compile_options(${TARGET} PRIVATE
|
|
|
|
-Wno-missing-field-initializers)
|
2015-11-18 14:22:10 +00:00
|
|
|
endif()
|
2015-05-22 17:26:19 +00:00
|
|
|
endif()
|
2016-02-29 06:01:04 +00:00
|
|
|
|
2017-04-03 17:41:20 +00: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 06:01:04 +00: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 17:46:45 +00:00
|
|
|
set_target_properties(${TARGET} PROPERTIES
|
|
|
|
LINK_FLAGS -static -static-libgcc -static-libstdc++)
|
2016-02-29 06:01:04 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
2015-11-18 14:22:10 +00:00
|
|
|
endfunction()
|
2015-05-22 17:26:19 +00:00
|
|
|
|
2016-02-24 15:11:07 +00: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 12:23:19 +00:00
|
|
|
# Tests require Python3
|
|
|
|
find_host_package(PythonInterp 3 REQUIRED)
|
2016-02-24 15:11:07 +00:00
|
|
|
|
2018-07-19 14:27:12 +00: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-22 22:03:55 +00:00
|
|
|
macro(spvtools_check_symbol_exports TARGET)
|
2018-07-04 18:20:52 +00:00
|
|
|
if (NOT "${SPIRV_SKIP_TESTS}")
|
|
|
|
add_test(NAME spirv-tools-symbol-exports-${TARGET}
|
|
|
|
COMMAND ${PYTHON_EXECUTABLE}
|
|
|
|
${spirv-tools_SOURCE_DIR}/utils/check_symbol_exports.py "$<TARGET_FILE:${TARGET}>")
|
|
|
|
endif()
|
2017-11-22 22:03:55 +00:00
|
|
|
endmacro()
|
|
|
|
else()
|
|
|
|
macro(spvtools_check_symbol_exports TARGET)
|
2018-07-04 18:20:52 +00:00
|
|
|
if (NOT "${SPIRV_SKIP_TESTS}")
|
|
|
|
message("Skipping symbol exports test for ${TARGET}")
|
|
|
|
endif()
|
2017-11-22 22:03:55 +00:00
|
|
|
endmacro()
|
|
|
|
endif()
|
2016-02-22 21:07:19 +00:00
|
|
|
|
2019-10-17 15:36:55 +00: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 16:02:25 +00:00
|
|
|
set(${PATH} ${CMAKE_INSTALL_LIBDIR}/cmake/${TARGET})
|
2019-10-17 15:36:55 +00: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 16:40:56 +00:00
|
|
|
# Defaults to OFF if the user didn't set it.
|
2015-11-18 14:22:10 +00:00
|
|
|
option(SPIRV_SKIP_EXECUTABLES
|
2016-08-05 17:46:45 +00:00
|
|
|
"Skip building the executable and tests along with the library"
|
|
|
|
${SPIRV_SKIP_EXECUTABLES})
|
|
|
|
option(SPIRV_SKIP_TESTS
|
|
|
|
"Skip building tests along with the library" ${SPIRV_SKIP_TESTS})
|
|
|
|
if ("${SPIRV_SKIP_EXECUTABLES}")
|
|
|
|
set(SPIRV_SKIP_TESTS ON)
|
|
|
|
endif()
|
2015-09-04 19:13:57 +00:00
|
|
|
|
2017-11-09 16:24:41 +00: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 14:26:23 +00:00
|
|
|
# Precompiled header macro. Parameters are source file list and filename for pch cpp file.
|
2018-11-07 14:15:04 +00:00
|
|
|
macro(spvtools_pch SRCS PCHPREFIX)
|
2020-04-09 18:46:08 +00:00
|
|
|
if(MSVC AND CMAKE_GENERATOR MATCHES "^Visual Studio" AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
2018-11-06 14:26:23 +00: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 14:15:04 +00:00
|
|
|
endmacro(spvtools_pch)
|
2018-11-06 14:26:23 +00:00
|
|
|
|
2016-03-17 02:43:31 +00:00
|
|
|
add_subdirectory(external)
|
2015-11-18 14:22:10 +00:00
|
|
|
|
2019-08-07 15:09:55 +00: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 02:43:31 +00:00
|
|
|
add_subdirectory(source)
|
|
|
|
add_subdirectory(tools)
|
2015-05-22 17:26:19 +00:00
|
|
|
|
2016-03-17 02:43:31 +00:00
|
|
|
add_subdirectory(test)
|
2016-09-28 14:50:43 +00:00
|
|
|
add_subdirectory(examples)
|
2015-05-22 17:26:19 +00:00
|
|
|
|
2017-07-04 13:11:40 +00:00
|
|
|
if(ENABLE_SPIRV_TOOLS_INSTALL)
|
|
|
|
install(
|
|
|
|
FILES
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/include/spirv-tools/libspirv.h
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/include/spirv-tools/libspirv.hpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/include/spirv-tools/optimizer.hpp
|
2017-07-13 00:16:51 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/include/spirv-tools/linker.hpp
|
2018-11-08 18:54:54 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/include/spirv-tools/instrument.hpp
|
2017-07-04 13:11:40 +00:00
|
|
|
DESTINATION
|
|
|
|
${CMAKE_INSTALL_INCLUDEDIR}/spirv-tools/)
|
|
|
|
endif(ENABLE_SPIRV_TOOLS_INSTALL)
|
2016-09-02 13:29:52 +00:00
|
|
|
|
2017-09-28 01:22:05 +00:00
|
|
|
if (NOT "${SPIRV_SKIP_TESTS}")
|
|
|
|
add_test(NAME spirv-tools-copyrights
|
|
|
|
COMMAND ${PYTHON_EXECUTABLE} utils/check_copyright.py
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
2017-11-22 22:03:55 +00:00
|
|
|
endif()
|
2017-11-25 17:58:50 +00:00
|
|
|
|
2020-02-20 15:54:54 +00:00
|
|
|
set(SPIRV_LIBRARIES "-lSPIRV-Tools-opt -lSPIRV-Tools -lSPIRV-Tools-link")
|
2018-02-02 22:37:14 +00:00
|
|
|
set(SPIRV_SHARED_LIBRARIES "-lSPIRV-Tools-shared")
|
2017-11-25 17:58:50 +00: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-14 23:27:22 +00:00
|
|
|
COMMAND ${CMAKE_COMMAND}
|
|
|
|
-DCHANGES_FILE=${CMAKE_CURRENT_SOURCE_DIR}/CHANGES
|
2017-11-25 17:58:50 +00:00
|
|
|
-DTEMPLATE_FILE=${CMAKE_CURRENT_SOURCE_DIR}/cmake/SPIRV-Tools.pc.in
|
|
|
|
-DOUT_FILE=${CMAKE_CURRENT_BINARY_DIR}/SPIRV-Tools.pc
|
|
|
|
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
|
2018-02-09 11:30:08 +00:00
|
|
|
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
|
|
|
|
-DCMAKE_INSTALL_INCLUDEDIR=${CMAKE_INSTALL_INCLUDEDIR}
|
2017-11-25 17:58:50 +00:00
|
|
|
-DSPIRV_LIBRARIES=${SPIRV_LIBRARIES}
|
|
|
|
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/write_pkg_config.cmake
|
|
|
|
DEPENDS "CHANGES" "cmake/SPIRV-Tools.pc.in" "cmake/write_pkg_config.cmake")
|
2018-02-02 22:37:14 +00:00
|
|
|
add_custom_target(spirv-tools-shared-pkg-config ALL
|
2018-02-14 23:27:22 +00:00
|
|
|
COMMAND ${CMAKE_COMMAND}
|
|
|
|
-DCHANGES_FILE=${CMAKE_CURRENT_SOURCE_DIR}/CHANGES
|
2018-02-02 22:37:14 +00:00
|
|
|
-DTEMPLATE_FILE=${CMAKE_CURRENT_SOURCE_DIR}/cmake/SPIRV-Tools-shared.pc.in
|
|
|
|
-DOUT_FILE=${CMAKE_CURRENT_BINARY_DIR}/SPIRV-Tools-shared.pc
|
|
|
|
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
|
2018-02-09 11:30:08 +00:00
|
|
|
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
|
|
|
|
-DCMAKE_INSTALL_INCLUDEDIR=${CMAKE_INSTALL_INCLUDEDIR}
|
2018-02-02 22:37:14 +00:00
|
|
|
-DSPIRV_SHARED_LIBRARIES=${SPIRV_SHARED_LIBRARIES}
|
|
|
|
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/write_pkg_config.cmake
|
|
|
|
DEPENDS "CHANGES" "cmake/SPIRV-Tools-shared.pc.in" "cmake/write_pkg_config.cmake")
|
2017-11-25 17:58:50 +00:00
|
|
|
|
|
|
|
# Install pkg-config file
|
|
|
|
if (ENABLE_SPIRV_TOOLS_INSTALL)
|
|
|
|
install(
|
|
|
|
FILES
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/SPIRV-Tools.pc
|
2018-02-02 22:37:14 +00:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/SPIRV-Tools-shared.pc
|
2017-11-25 17:58:50 +00:00
|
|
|
DESTINATION
|
|
|
|
${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
|
|
|
endif()
|