Warning, /plasma/kwin/cmake/modules/Qt6WaylandClientMacrosKde.cmake is written in an unsupported language. File is not indexed.
0001 # Copyright (C) 2022 The Qt Company Ltd. 0002 # SPDX-License-Identifier: BSD-3-Clause 0003 0004 function(qt6_generate_wayland_protocol_client_sources target) 0005 cmake_parse_arguments(arg "NO_INCLUDE_CORE_ONLY" "__QT_INTERNAL_WAYLAND_INCLUDE_DIR" "FILES" ${ARGN}) 0006 if(DEFINED arg_UNPARSED_ARGUMENTS) 0007 message(FATAL_ERROR "Unknown arguments were passed to qt6_generate_wayland_protocol_client_sources: (${arg_UNPARSED_ARGUMENTS}).") 0008 endif() 0009 0010 get_target_property(target_binary_dir ${target} BINARY_DIR) 0011 0012 if(NOT TARGET Wayland::Scanner) 0013 message(FATAL_ERROR "Wayland::Scanner target not found. You might be missing the WaylandScanner CMake package.") 0014 endif() 0015 0016 if(NOT TARGET Qt6::qtwaylandscanner) 0017 message(FATAL_ERROR "qtwaylandscanner executable not found. Most likely there is an issue with your Qt installation.") 0018 endif() 0019 0020 string(TOUPPER "${target}" module_define_infix) 0021 string(REPLACE "-" "_" module_define_infix "${module_define_infix}") 0022 string(REPLACE "." "_" module_define_infix "${module_define_infix}") 0023 set(build_macro "QT_BUILD_${module_define_infix}_LIB") 0024 0025 foreach(protocol_file IN LISTS arg_FILES) 0026 get_filename_component(protocol_name "${protocol_file}" NAME_WLE) 0027 0028 set(waylandscanner_header_output "${target_binary_dir}/wayland-${protocol_name}-client-protocol.h") 0029 set(waylandscanner_code_output "${target_binary_dir}/wayland-${protocol_name}-protocol.c") 0030 # TODO: Maybe add "client" prefix or suffix to these in Qt6? 0031 set(qtwaylandscanner_header_output "${target_binary_dir}/qwayland-${protocol_name}.h") 0032 set(qtwaylandscanner_code_output "${target_binary_dir}/qwayland-${protocol_name}.cpp") 0033 0034 if (NOT arg_NO_INCLUDE_CORE_ONLY) 0035 set(waylandscanner_extra_args "--include-core-only") 0036 endif() 0037 add_custom_command( 0038 OUTPUT "${waylandscanner_header_output}" 0039 #TODO: Maybe put the files in ${CMAKE_CURRENT_BINARY_DIR/wayland_generated instead? 0040 COMMAND Wayland::Scanner --strict ${waylandscanner_extra_args} client-header < "${protocol_file}" > "${waylandscanner_header_output}" 0041 ) 0042 0043 add_custom_command( 0044 OUTPUT "${waylandscanner_code_output}" 0045 COMMAND Wayland::Scanner --strict ${waylandscanner_extra_args} public-code < "${protocol_file}" > "${waylandscanner_code_output}" 0046 ) 0047 0048 set(wayland_include_dir "") 0049 if(arg___QT_INTERNAL_WAYLAND_INCLUDE_DIR) 0050 set(wayland_include_dir "${arg___QT_INTERNAL_WAYLAND_INCLUDE_DIR}") 0051 else() 0052 get_target_property(qt_module ${target} _qt_module_interface_name) 0053 get_target_property(is_for_module "${target}" _qt_module_has_headers) 0054 if (qt_module) 0055 set(wayland_include_dir "Qt${qt_module}/private") 0056 elseif (is_for_module) 0057 set(wayland_include_dir "QtWaylandClient/private") 0058 endif() 0059 endif() 0060 0061 add_custom_command( 0062 OUTPUT "${qtwaylandscanner_header_output}" 0063 COMMAND Qt6::qtwaylandscanner client-header 0064 "${protocol_file}" 0065 --build-macro=${build_macro} 0066 --header-path="${wayland_include_dir}" 0067 > "${qtwaylandscanner_header_output}" 0068 DEPENDS ${protocol_file} Qt6::qtwaylandscanner 0069 ) 0070 0071 set(qtwaylandscanner_code_include "") 0072 if (is_for_module) 0073 set(qtwaylandscanner_code_include "<QtWaylandClient/private/wayland-wayland-client-protocol.h>") 0074 endif() 0075 0076 add_custom_command( 0077 OUTPUT "${qtwaylandscanner_code_output}" 0078 COMMAND Qt6::qtwaylandscanner client-code 0079 "${protocol_file}" 0080 --build-macro=${build_macro} 0081 --header-path='${wayland_include_dir}' 0082 --add-include='${qtwaylandscanner_code_include}' 0083 > "${qtwaylandscanner_code_output}" 0084 DEPENDS ${protocol_file} Qt6::qtwaylandscanner 0085 ) 0086 0087 target_sources(${target} PRIVATE 0088 "${waylandscanner_header_output}" 0089 "${waylandscanner_code_output}" 0090 "${qtwaylandscanner_header_output}" 0091 "${qtwaylandscanner_code_output}" 0092 ) 0093 endforeach() 0094 target_include_directories(${target} PRIVATE ${target_binary_dir}) 0095 endfunction() 0096 0097 if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS) 0098 function(qt_generate_wayland_protocol_client_sources) 0099 qt6_generate_wayland_protocol_client_sources(${ARGV}) 0100 endfunction() 0101 endif()