1 # Copyright (C) 2020 The Khronos Group Inc.
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions
9 # Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
12 # Redistributions in binary form must reproduce the above
13 # copyright notice, this list of conditions and the following
14 # disclaimer in the documentation and/or other materials provided
15 # with the distribution.
17 # Neither the name of The Khronos Group Inc. nor the names of its
18 # contributors may be used to endorse or promote products derived
19 # from this software without specific prior written permission.
21 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 # COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 # POSSIBILITY OF SUCH DAMAGE.
34 add_library(glslang-default-resource-limits
35 ${CMAKE_CURRENT_SOURCE_DIR}/ResourceLimits.cpp
36 ${CMAKE_CURRENT_SOURCE_DIR}/resource_limits_c.cpp)
37 set_property(TARGET glslang-default-resource-limits PROPERTY FOLDER glslang)
38 set_property(TARGET glslang-default-resource-limits PROPERTY POSITION_INDEPENDENT_CODE ON)
40 target_include_directories(glslang-default-resource-limits
41 PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
42 PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>)
44 set(SOURCES StandAlone.cpp DirStackFileIncluder.h)
46 add_executable(glslangValidator ${SOURCES})
47 set_property(TARGET glslangValidator PROPERTY FOLDER tools)
48 glslang_set_link_args(glslangValidator)
53 glslang-default-resource-limits)
55 if(ENABLE_SPVREMAPPER)
56 set(LIBRARIES ${LIBRARIES} SPVRemapper)
60 set(LIBRARIES ${LIBRARIES} psapi)
63 set(LIBRARIES ${LIBRARIES} pthread)
67 target_link_libraries(glslangValidator ${LIBRARIES})
68 target_include_directories(glslangValidator PUBLIC
69 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../External>
70 $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/External>)
73 target_include_directories(glslangValidator
74 PRIVATE ${spirv-tools_SOURCE_DIR}/include
78 if(ENABLE_SPVREMAPPER)
79 set(REMAPPER_SOURCES spirv-remap.cpp)
80 add_executable(spirv-remap ${REMAPPER_SOURCES})
81 set_property(TARGET spirv-remap PROPERTY FOLDER tools)
82 glslang_set_link_args(spirv-remap)
83 target_link_libraries(spirv-remap ${LIBRARIES})
87 source_group("Source" FILES ${SOURCES})
90 if(ENABLE_GLSLANG_INSTALL)
91 install(TARGETS glslangValidator EXPORT glslangValidatorTargets
92 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
93 install(EXPORT glslangValidatorTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
95 if(ENABLE_SPVREMAPPER)
96 install(TARGETS spirv-remap EXPORT spirv-remapTargets
97 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
98 install(EXPORT spirv-remapTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
101 install(TARGETS glslang-default-resource-limits EXPORT glslang-default-resource-limitsTargets
102 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
103 install(EXPORT glslang-default-resource-limitsTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
104 endif(ENABLE_GLSLANG_INSTALL)