yum-mirror/glslang
git clone https://git.yummers.dev/yum-mirror/glslang
3a7f7875
main
1# Copyright (C) 2020-2025 The Khronos Group Inc. 2# 3# All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions 7# are met: 8# 9# Redistributions of source code must retain the above copyright 10# notice, this list of conditions and the following disclaimer. 11# 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. 16# 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. 20# 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. 33 34find_package ( Python3 REQUIRED ) 35 36set ( GLSLANG_INTRINSIC_H " ${ GLSLANG_GENERATED_INCLUDEDIR } /glslang/glsl_intrinsic_header.h" ) 37set ( GLSLANG_INTRINSIC_PY " ${ CMAKE_CURRENT_SOURCE_DIR } /../gen_extension_headers.py" ) 38set ( GLSLANG_INTRINSIC_HEADER_DIR " ${ CMAKE_CURRENT_SOURCE_DIR } /../glslang/ExtensionHeaders" ) 39 40add_custom_command ( 41OUTPUT ${ GLSLANG_INTRINSIC_H } 42COMMAND Python3::Interpreter " ${ GLSLANG_INTRINSIC_PY } " 43"-i" ${ GLSLANG_INTRINSIC_HEADER_DIR } 44"-o" ${ GLSLANG_INTRINSIC_H } 45DEPENDS ${ GLSLANG_INTRINSIC_PY } 46COMMENT "Generating ${ GLSLANG_INTRINSIC_H } " ) 47 48set ( SOURCES StandAlone.cpp DirStackFileIncluder.h ${ GLSLANG_INTRINSIC_H }) 49 50add_executable ( glslang-standalone ${ SOURCES }) 51if (${ CMAKE_CXX_COMPILER_ID } MATCHES "GNU" ) 52target_compile_options ( glslang-standalone PRIVATE -Wconversion ) 53elseif (${ CMAKE_CXX_COMPILER_ID } MATCHES "Clang" AND NOT MSVC) 54target_compile_options ( glslang-standalone PRIVATE -Wshorten-64-to-32 ) 55endif () 56set_property ( TARGET glslang-standalone PROPERTY FOLDER tools ) 57set_property ( TARGET glslang-standalone PROPERTY OUTPUT_NAME glslang ) 58glslang_set_link_args ( glslang-standalone ) 59 60set ( LIBRARIES 61glslang 62glslang-default-resource-limits 63$ < $ <AND: $ <CXX_COMPILER_ID:GNU>, $ <VERSION_LESS: $ <CXX_COMPILER_VERSION>,9.0>>:stdc++fs> ) 64 65if ( WIN32) 66set ( LIBRARIES ${ LIBRARIES } psapi ) 67elseif ( UNIX) 68if ( NOT ANDROIDAND NOT QNX) 69set ( LIBRARIES ${ LIBRARIES } pthread ) 70endif () 71endif () 72 73target_link_libraries ( glslang-standalone ${ LIBRARIES }) 74target_include_directories ( glslang-standalone PUBLIC 75$ <BUILD_INTERFACE: ${ CMAKE_CURRENT_SOURCE_DIR } /../External> ) 76 77if ( WIN32) 78source_group ( "Source" FILES ${ SOURCES }) 79endif () 80 81# Create a symbolic link to glslang named glslangValidator for backwards compatibility 82set ( legacy_glslang_name "glslangValidator ${ CMAKE_EXECUTABLE_SUFFIX } " ) 83set ( link_method create_symlink ) 84if ( WIN32OR MINGW) 85set ( link_method copy_if_different ) 86endif () 87 88add_custom_command ( 89TARGET glslang-standalone POST_BUILD 90COMMAND " ${ CMAKE_COMMAND } " -E " ${ link_method } " "\$<TARGET_FILE_NAME:glslang-standalone>" " ${ legacy_glslang_name } " 91WORKING_DIRECTORY "\$<TARGET_FILE_DIR:glslang-standalone>" 92VERBATIM 93) 94 95if ( GLSLANG_ENABLE_INSTALL) 96install ( TARGETS glslang-standalone EXPORT glslang-targets ) 97 98# Create the same symlink at install time 99install ( CODE "\ 100message(STATUS \"Installing ( ${ link_method } ): \$<TARGET_FILE_NAME:glslang-standalone> -> \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/ ${ CMAKE_INSTALL_BINDIR } \") 101execute_process( 102COMMAND \"\${CMAKE_COMMAND}\" -E ${ link_method } [=[\$<TARGET_FILE_NAME:glslang-standalone>]=] [=[ ${ legacy_glslang_name } ]=] 103WORKING_DIRECTORY \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/ ${ CMAKE_INSTALL_BINDIR } \" 104) 105" ) 106 107endif ()