bgfx/3rdparty/glslang/SPIRV/CMakeLists.txt

139 lines
4.7 KiB
CMake
Raw Normal View History

2020-07-04 04:29:05 +03:00
# Copyright (C) 2020 The Khronos Group Inc.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
#
# Neither the name of The Khronos Group Inc. nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
2016-12-16 01:19:54 +03:00
set(SOURCES
GlslangToSpv.cpp
InReadableOrder.cpp
Logger.cpp
SpvBuilder.cpp
2018-08-18 07:20:54 +03:00
SpvPostProcess.cpp
2016-12-16 01:19:54 +03:00
doc.cpp
2018-09-03 07:14:20 +03:00
SpvTools.cpp
2020-06-19 07:45:42 +03:00
disassemble.cpp
CInterface/spirv_c_interface.cpp)
2016-12-16 01:19:54 +03:00
set(SPVREMAP_SOURCES
SPVRemapper.cpp
doc.cpp)
set(HEADERS
bitutils.h
spirv.hpp
GLSL.std.450.h
2018-03-03 22:26:07 +03:00
GLSL.ext.EXT.h
2016-12-16 01:19:54 +03:00
GLSL.ext.KHR.h
GlslangToSpv.h
hex_float.h
Logger.h
SpvBuilder.h
spvIR.h
doc.h
2018-09-03 07:14:20 +03:00
SpvTools.h
2019-08-23 05:50:36 +03:00
disassemble.h
GLSL.ext.AMD.h
2020-03-14 22:58:54 +03:00
GLSL.ext.NV.h
NonSemanticDebugPrintf.h)
2016-12-16 01:19:54 +03:00
set(SPVREMAP_HEADERS
SPVRemapper.h
doc.h)
2018-04-14 05:31:28 +03:00
add_library(SPIRV ${LIB_TYPE} ${SOURCES} ${HEADERS})
2017-07-08 07:19:36 +03:00
set_property(TARGET SPIRV PROPERTY FOLDER glslang)
set_property(TARGET SPIRV PROPERTY POSITION_INDEPENDENT_CODE ON)
2019-11-24 05:09:22 +03:00
target_include_directories(SPIRV PUBLIC
2020-07-11 03:17:00 +03:00
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
glslang_add_build_info_dependency(SPIRV)
2016-12-16 01:19:54 +03:00
2018-07-21 04:19:21 +03:00
if (ENABLE_SPVREMAPPER)
add_library(SPVRemapper ${LIB_TYPE} ${SPVREMAP_SOURCES} ${SPVREMAP_HEADERS})
set_property(TARGET SPVRemapper PROPERTY FOLDER glslang)
set_property(TARGET SPVRemapper PROPERTY POSITION_INDEPENDENT_CODE ON)
endif()
2016-12-16 01:19:54 +03:00
2018-04-14 05:31:28 +03:00
if(WIN32 AND BUILD_SHARED_LIBS)
set_target_properties(SPIRV PROPERTIES PREFIX "")
2018-07-21 04:19:21 +03:00
if (ENABLE_SPVREMAPPER)
set_target_properties(SPVRemapper PROPERTIES PREFIX "")
endif()
2018-04-14 05:31:28 +03:00
endif()
2017-09-23 08:36:46 +03:00
if(ENABLE_OPT)
target_include_directories(SPIRV
PRIVATE ${spirv-tools_SOURCE_DIR}/include
PRIVATE ${spirv-tools_SOURCE_DIR}/source
)
2020-07-04 04:29:05 +03:00
target_link_libraries(SPIRV PRIVATE MachineIndependent SPIRV-Tools-opt)
2019-10-20 08:28:32 +03:00
target_include_directories(SPIRV PUBLIC
2020-07-11 03:17:00 +03:00
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../External>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/External>)
2017-09-23 08:36:46 +03:00
else()
2020-07-04 04:29:05 +03:00
target_link_libraries(SPIRV PRIVATE MachineIndependent)
2017-09-23 08:36:46 +03:00
endif(ENABLE_OPT)
2016-12-16 01:19:54 +03:00
if(WIN32)
source_group("Source" FILES ${SOURCES} ${HEADERS})
source_group("Source" FILES ${SPVREMAP_SOURCES} ${SPVREMAP_HEADERS})
endif(WIN32)
2017-07-08 07:19:36 +03:00
if(ENABLE_GLSLANG_INSTALL)
2018-05-05 05:56:50 +03:00
if(BUILD_SHARED_LIBS)
2018-07-21 04:19:21 +03:00
if (ENABLE_SPVREMAPPER)
2019-10-20 08:28:32 +03:00
install(TARGETS SPVRemapper EXPORT SPVRemapperTargets
2018-07-21 04:19:21 +03:00
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
2019-10-20 08:28:32 +03:00
install(TARGETS SPIRV EXPORT SPIRVTargets
2018-05-05 05:56:50 +03:00
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
2019-06-07 08:11:01 +03:00
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
2018-05-05 05:56:50 +03:00
else()
2018-07-21 04:19:21 +03:00
if (ENABLE_SPVREMAPPER)
2019-10-20 08:28:32 +03:00
install(TARGETS SPVRemapper EXPORT SPVRemapperTargets
2018-07-21 04:19:21 +03:00
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
2019-10-20 08:28:32 +03:00
install(TARGETS SPIRV EXPORT SPIRVTargets
2018-05-05 05:56:50 +03:00
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
2017-02-04 06:32:35 +03:00
2019-11-24 05:09:22 +03:00
if (ENABLE_SPVREMAPPER)
install(EXPORT SPVRemapperTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
endif()
install(EXPORT SPIRVTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
2019-11-09 07:06:35 +03:00
2019-10-12 06:18:23 +03:00
install(FILES ${HEADERS} ${SPVREMAP_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/glslang/SPIRV/)
2017-07-08 07:19:36 +03:00
endif(ENABLE_GLSLANG_INSTALL)