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 Google 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}>)
45 set(SOURCES StandAlone.cpp DirStackFileIncluder.h)
47 add_executable(glslangValidator ${SOURCES})
48 set_property(TARGET glslangValidator PROPERTY FOLDER tools)
49 glslang_set_link_args(glslangValidator)
54 glslang-default-resource-limits)
56 if(ENABLE_SPVREMAPPER)
57 set(LIBRARIES ${LIBRARIES} SPVRemapper)
61 set(LIBRARIES ${LIBRARIES} psapi)
64 set(LIBRARIES ${LIBRARIES} pthread)
68 target_link_libraries(glslangValidator ${LIBRARIES})
69 target_include_directories(glslangValidator PUBLIC
70 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../External>
71 $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/External>)
73 if(ENABLE_SPVREMAPPER)
74 set(REMAPPER_SOURCES spirv-remap.cpp)
75 add_executable(spirv-remap ${REMAPPER_SOURCES})
76 set_property(TARGET spirv-remap PROPERTY FOLDER tools)
77 glslang_set_link_args(spirv-remap)
78 target_link_libraries(spirv-remap ${LIBRARIES})
82 source_group("Source" FILES ${SOURCES})
85 if(ENABLE_GLSLANG_INSTALL)
86 install(TARGETS glslangValidator EXPORT glslangValidatorTargets
87 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
88 install(EXPORT glslangValidatorTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
90 if(ENABLE_SPVREMAPPER)
91 install(TARGETS spirv-remap EXPORT spirv-remapTargets
92 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
93 install(EXPORT spirv-remapTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
97 install(TARGETS glslang-default-resource-limits EXPORT glslang-default-resource-limitsTargets
98 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
99 install(EXPORT glslang-default-resource-limitsTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
101 endif(ENABLE_GLSLANG_INSTALL)