compositor: Add CMake options to control visibility of generated symbols

This exposes the public-code / private-code options for the
waylandscanner. It is the server-side version of
2962aa9ed9487bc6aa54810ed4ace114b4f7d723.

Task-number: QTBUG-126301
Change-Id: I32490f6cbc9cac876c1f07c3930e8bafbc395e75
Reviewed-by: David Redondo <qt@david-redondo.de>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2024-08-08 11:32:22 +02:00
parent 8754c9fe83
commit 7062695de7

View File

@ -2,7 +2,7 @@
# SPDX-License-Identifier: BSD-3-Clause
function(qt6_generate_wayland_protocol_server_sources target)
cmake_parse_arguments(arg "" "__QT_INTERNAL_WAYLAND_INCLUDE_DIR" "FILES" ${ARGN})
cmake_parse_arguments(arg "PUBLIC_CODE;PRIVATE_CODE" "__QT_INTERNAL_WAYLAND_INCLUDE_DIR" "FILES" ${ARGN})
if(DEFINED arg_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "Unknown arguments were passed to qt6_generate_wayland_protocol_server_sources: (${arg_UNPARSED_ARGUMENTS}).")
endif()
@ -22,6 +22,12 @@ function(qt6_generate_wayland_protocol_server_sources target)
string(REPLACE "." "_" module_define_infix "${module_define_infix}")
set(build_macro "QT_BUILD_${module_define_infix}_LIB")
if (arg_PRIVATE_CODE)
set(wayland_scanner_code_option "private-code")
else()
set(wayland_scanner_code_option "public-code")
endif()
foreach(protocol_file IN LISTS arg_FILES)
get_filename_component(protocol_name "${protocol_file}" NAME_WLE)
@ -38,7 +44,7 @@ function(qt6_generate_wayland_protocol_server_sources target)
)
add_custom_command(
OUTPUT "${waylandscanner_code_output}"
COMMAND Wayland::Scanner --include-core-only public-code < "${protocol_file}" > "${waylandscanner_code_output}"
COMMAND Wayland::Scanner --include-core-only ${wayland_scanner_code_option} < "${protocol_file}" > "${waylandscanner_code_output}"
DEPENDS ${protocol_file} Wayland::Scanner
)