From 7062695de7973f0682da181c8b6124bc57afcc6e Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 8 Aug 2024 11:32:22 +0200 Subject: [PATCH] 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 --- .../qtwaylandscanner/Qt6WaylandCompositorMacros.cmake | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake index 05d16af6cb0..bf23bb727c0 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake @@ -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 )