1617a3babSopenharmony_ci# Copyright (C) 2020 The Khronos Group Inc. 2617a3babSopenharmony_ci# 3617a3babSopenharmony_ci# All rights reserved. 4617a3babSopenharmony_ci# 5617a3babSopenharmony_ci# Redistribution and use in source and binary forms, with or without 6617a3babSopenharmony_ci# modification, are permitted provided that the following conditions 7617a3babSopenharmony_ci# are met: 8617a3babSopenharmony_ci# 9617a3babSopenharmony_ci# Redistributions of source code must retain the above copyright 10617a3babSopenharmony_ci# notice, this list of conditions and the following disclaimer. 11617a3babSopenharmony_ci# 12617a3babSopenharmony_ci# Redistributions in binary form must reproduce the above 13617a3babSopenharmony_ci# copyright notice, this list of conditions and the following 14617a3babSopenharmony_ci# disclaimer in the documentation and/or other materials provided 15617a3babSopenharmony_ci# with the distribution. 16617a3babSopenharmony_ci# 17617a3babSopenharmony_ci# Neither the name of The Khronos Group Inc. nor the names of its 18617a3babSopenharmony_ci# contributors may be used to endorse or promote products derived 19617a3babSopenharmony_ci# from this software without specific prior written permission. 20617a3babSopenharmony_ci# 21617a3babSopenharmony_ci# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22617a3babSopenharmony_ci# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23617a3babSopenharmony_ci# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 24617a3babSopenharmony_ci# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 25617a3babSopenharmony_ci# COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26617a3babSopenharmony_ci# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 27617a3babSopenharmony_ci# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28617a3babSopenharmony_ci# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29617a3babSopenharmony_ci# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30617a3babSopenharmony_ci# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 31617a3babSopenharmony_ci# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32617a3babSopenharmony_ci# POSSIBILITY OF SUCH DAMAGE. 33617a3babSopenharmony_ci 34617a3babSopenharmony_ciset(SOURCES 35617a3babSopenharmony_ci GlslangToSpv.cpp 36617a3babSopenharmony_ci InReadableOrder.cpp 37617a3babSopenharmony_ci Logger.cpp 38617a3babSopenharmony_ci SpvBuilder.cpp 39617a3babSopenharmony_ci SpvPostProcess.cpp 40617a3babSopenharmony_ci doc.cpp 41617a3babSopenharmony_ci SpvTools.cpp 42617a3babSopenharmony_ci disassemble.cpp 43617a3babSopenharmony_ci CInterface/spirv_c_interface.cpp) 44617a3babSopenharmony_ci 45617a3babSopenharmony_ciset(SPVREMAP_SOURCES 46617a3babSopenharmony_ci SPVRemapper.cpp 47617a3babSopenharmony_ci doc.cpp) 48617a3babSopenharmony_ci 49617a3babSopenharmony_ciset(HEADERS 50617a3babSopenharmony_ci bitutils.h 51617a3babSopenharmony_ci spirv.hpp 52617a3babSopenharmony_ci GLSL.std.450.h 53617a3babSopenharmony_ci GLSL.ext.EXT.h 54617a3babSopenharmony_ci GLSL.ext.KHR.h 55617a3babSopenharmony_ci GlslangToSpv.h 56617a3babSopenharmony_ci hex_float.h 57617a3babSopenharmony_ci Logger.h 58617a3babSopenharmony_ci SpvBuilder.h 59617a3babSopenharmony_ci spvIR.h 60617a3babSopenharmony_ci doc.h 61617a3babSopenharmony_ci SpvTools.h 62617a3babSopenharmony_ci disassemble.h 63617a3babSopenharmony_ci GLSL.ext.AMD.h 64617a3babSopenharmony_ci GLSL.ext.NV.h 65617a3babSopenharmony_ci GLSL.ext.ARM.h 66617a3babSopenharmony_ci NonSemanticDebugPrintf.h 67617a3babSopenharmony_ci NonSemanticShaderDebugInfo100.h) 68617a3babSopenharmony_ci 69617a3babSopenharmony_ciset(SPVREMAP_HEADERS 70617a3babSopenharmony_ci SPVRemapper.h 71617a3babSopenharmony_ci doc.h) 72617a3babSopenharmony_ci 73617a3babSopenharmony_ciset(PUBLIC_HEADERS 74617a3babSopenharmony_ci GlslangToSpv.h 75617a3babSopenharmony_ci disassemble.h 76617a3babSopenharmony_ci Logger.h 77617a3babSopenharmony_ci spirv.hpp 78617a3babSopenharmony_ci SPVRemapper.h) 79617a3babSopenharmony_ci 80617a3babSopenharmony_ciadd_library(SPIRV ${LIB_TYPE} ${SOURCES} ${HEADERS}) 81617a3babSopenharmony_ciset_target_properties(SPIRV PROPERTIES 82617a3babSopenharmony_ci FOLDER glslang 83617a3babSopenharmony_ci POSITION_INDEPENDENT_CODE ON 84617a3babSopenharmony_ci VERSION "${GLSLANG_VERSION}" 85617a3babSopenharmony_ci SOVERSION "${GLSLANG_VERSION_MAJOR}") 86617a3babSopenharmony_citarget_include_directories(SPIRV PUBLIC 87617a3babSopenharmony_ci $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..> 88617a3babSopenharmony_ci $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) 89617a3babSopenharmony_ci 90617a3babSopenharmony_ciglslang_add_build_info_dependency(SPIRV) 91617a3babSopenharmony_ci 92617a3babSopenharmony_ciif (ENABLE_SPVREMAPPER) 93617a3babSopenharmony_ci add_library(SPVRemapper ${LIB_TYPE} ${SPVREMAP_SOURCES} ${SPVREMAP_HEADERS}) 94617a3babSopenharmony_ci set_target_properties(SPVRemapper PROPERTIES 95617a3babSopenharmony_ci FOLDER glslang 96617a3babSopenharmony_ci POSITION_INDEPENDENT_CODE ON 97617a3babSopenharmony_ci VERSION "${GLSLANG_VERSION}" 98617a3babSopenharmony_ci SOVERSION "${GLSLANG_VERSION_MAJOR}") 99617a3babSopenharmony_ciendif() 100617a3babSopenharmony_ci 101617a3babSopenharmony_ciif(WIN32 AND BUILD_SHARED_LIBS) 102617a3babSopenharmony_ci set_target_properties(SPIRV PROPERTIES PREFIX "") 103617a3babSopenharmony_ci if (ENABLE_SPVREMAPPER) 104617a3babSopenharmony_ci set_target_properties(SPVRemapper PROPERTIES PREFIX "") 105617a3babSopenharmony_ci endif() 106617a3babSopenharmony_ciendif() 107617a3babSopenharmony_ci 108617a3babSopenharmony_ciif(ENABLE_OPT) 109617a3babSopenharmony_ci target_link_libraries(SPIRV PRIVATE MachineIndependent PUBLIC SPIRV-Tools-opt) 110617a3babSopenharmony_ci target_include_directories(SPIRV PUBLIC 111617a3babSopenharmony_ci $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../External>) 112617a3babSopenharmony_cielse() 113617a3babSopenharmony_ci target_link_libraries(SPIRV PRIVATE MachineIndependent) 114617a3babSopenharmony_ciendif() 115617a3babSopenharmony_ci 116617a3babSopenharmony_ciif(WIN32) 117617a3babSopenharmony_ci source_group("Source" FILES ${SOURCES} ${HEADERS}) 118617a3babSopenharmony_ci source_group("Source" FILES ${SPVREMAP_SOURCES} ${SPVREMAP_HEADERS}) 119617a3babSopenharmony_ciendif() 120617a3babSopenharmony_ci 121617a3babSopenharmony_ciif(PROJECT_IS_TOP_LEVEL) 122617a3babSopenharmony_ci if (ENABLE_SPVREMAPPER) 123617a3babSopenharmony_ci install(TARGETS SPVRemapper EXPORT glslang-targets) 124617a3babSopenharmony_ci endif() 125617a3babSopenharmony_ci 126617a3babSopenharmony_ci install(TARGETS SPIRV EXPORT glslang-targets) 127617a3babSopenharmony_ci 128617a3babSopenharmony_ci # Backward compatibility 129617a3babSopenharmony_ci if (ENABLE_SPVREMAPPER) 130617a3babSopenharmony_ci file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/SPVRemapperTargets.cmake" " 131617a3babSopenharmony_ci message(WARNING \"Using `SPVRemapperTargets.cmake` is deprecated: use `find_package(glslang)` to find glslang CMake targets.\") 132617a3babSopenharmony_ci 133617a3babSopenharmony_ci if (NOT TARGET glslang::SPVRemapper) 134617a3babSopenharmony_ci include(\"${CMAKE_INSTALL_FULL_LIBDIR}/cmake/${PROJECT_NAME}/glslang-targets.cmake\") 135617a3babSopenharmony_ci endif() 136617a3babSopenharmony_ci 137617a3babSopenharmony_ci add_library(SPVRemapper ALIAS glslang::SPVRemapper) 138617a3babSopenharmony_ci ") 139617a3babSopenharmony_ci install(FILES "${CMAKE_CURRENT_BINARY_DIR}/SPVRemapperTargets.cmake" DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake) 140617a3babSopenharmony_ci endif() 141617a3babSopenharmony_ci 142617a3babSopenharmony_ci file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/SPIRVTargets.cmake" " 143617a3babSopenharmony_ci message(WARNING \"Using `SPIRVTargets.cmake` is deprecated: use `find_package(glslang)` to find glslang CMake targets.\") 144617a3babSopenharmony_ci 145617a3babSopenharmony_ci if (NOT TARGET glslang::SPIRV) 146617a3babSopenharmony_ci include(\"${CMAKE_INSTALL_FULL_LIBDIR}/cmake/${PROJECT_NAME}/glslang-targets.cmake\") 147617a3babSopenharmony_ci endif() 148617a3babSopenharmony_ci 149617a3babSopenharmony_ci add_library(SPIRV ALIAS glslang::SPIRV) 150617a3babSopenharmony_ci ") 151617a3babSopenharmony_ci install(FILES "${CMAKE_CURRENT_BINARY_DIR}/SPIRVTargets.cmake" DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake) 152617a3babSopenharmony_ci 153617a3babSopenharmony_ci install(FILES ${PUBLIC_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/glslang/SPIRV/) 154617a3babSopenharmony_ciendif() 155