CMake: use the --build-macro option to qtwaylandscanner

So we get correct exports different from imports, which are required for
GCC 12 with -mno-direct-extern-access and protected visibility.

Change-Id: If05aeeb7176e4f13af9afffd16e856de1f4f68d6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Thiago Macieira 2022-04-22 14:59:35 -07:00
parent 949b3f731c
commit 737c940ebb
2 changed files with 31 additions and 4 deletions

View File

@ -14,6 +14,11 @@ function(qt6_generate_wayland_protocol_client_sources target)
message(FATAL_ERROR "qtwaylandscanner executable not found. Most likely there is an issue with your Qt installation.")
endif()
string(TOUPPER "${target}" module_define_infix)
string(REPLACE "-" "_" module_define_infix "${module_define_infix}")
string(REPLACE "." "_" module_define_infix "${module_define_infix}")
set(build_macro "QT_BUILD_${module_define_infix}_LIB")
foreach(protocol_file IN LISTS arg_FILES)
get_filename_component(protocol_name "${protocol_file}" NAME_WLE)
@ -49,7 +54,11 @@ function(qt6_generate_wayland_protocol_client_sources target)
add_custom_command(
OUTPUT "${qtwaylandscanner_header_output}"
COMMAND Qt6::qtwaylandscanner client-header "${protocol_file}" "${wayland_include_dir}" > "${qtwaylandscanner_header_output}"
COMMAND Qt6::qtwaylandscanner client-header
"${protocol_file}"
--build-macro=${build_macro}
--header-path="${wayland_include_dir}"
> "${qtwaylandscanner_header_output}"
DEPENDS ${protocol_file} Qt6::qtwaylandscanner
)
@ -60,7 +69,12 @@ function(qt6_generate_wayland_protocol_client_sources target)
add_custom_command(
OUTPUT "${qtwaylandscanner_code_output}"
COMMAND Qt6::qtwaylandscanner client-code "${protocol_file}" --header-path='${wayland_include_dir}' --add-include='${qtwaylandscanner_code_include}' > "${qtwaylandscanner_code_output}"
COMMAND Qt6::qtwaylandscanner client-code
"${protocol_file}"
--build-macro=${build_macro}
--header-path='${wayland_include_dir}'
--add-include='${qtwaylandscanner_code_include}'
> "${qtwaylandscanner_code_output}"
DEPENDS ${protocol_file} Qt6::qtwaylandscanner
)

View File

@ -14,6 +14,11 @@ function(qt6_generate_wayland_protocol_server_sources target)
message(FATAL_ERROR "qtwaylandscanner executable not found. Most likely there is an issue with your Qt installation.")
endif()
string(TOUPPER "${target}" module_define_infix)
string(REPLACE "-" "_" module_define_infix "${module_define_infix}")
string(REPLACE "." "_" module_define_infix "${module_define_infix}")
set(build_macro "QT_BUILD_${module_define_infix}_LIB")
foreach(protocol_file IN LISTS arg_FILES)
get_filename_component(protocol_name "${protocol_file}" NAME_WLE)
@ -47,12 +52,20 @@ function(qt6_generate_wayland_protocol_server_sources target)
add_custom_command(
OUTPUT "${qtwaylandscanner_header_output}"
COMMAND Qt6::qtwaylandscanner server-header "${protocol_file}" "${wayland_include_dir}" > "${qtwaylandscanner_header_output}"
COMMAND Qt6::qtwaylandscanner server-header
"${protocol_file}"
--build-macro=${build_macro}
--header-path='${wayland_include_dir}'
> "${qtwaylandscanner_header_output}"
)
add_custom_command(
OUTPUT "${qtwaylandscanner_code_output}"
COMMAND Qt6::qtwaylandscanner server-code "${protocol_file}" "${wayland_include_dir}" > "${qtwaylandscanner_code_output}"
COMMAND Qt6::qtwaylandscanner server-code
"${protocol_file}"
--build-macro=${build_macro}
--header-path='${wayland_include_dir}'
> "${qtwaylandscanner_code_output}"
)
target_sources(${target} PRIVATE