diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2019-09-20 09:23:51 +0200 |
---|---|---|
committer | Johan Helsing <johan.helsing@qt.io> | 2019-09-24 08:58:18 +0000 |
commit | 0bcd50b40a747329932fb2823e494575082cd150 (patch) | |
tree | e293664fe7715f5b501f61ffff897d4e61729cd6 /util | |
parent | 2cc3720a573e982c20a0f01f8db4dd8efe4f31c0 (diff) |
pro2cmake.py: generate code for WAYLAND*SOURCES
WAYLANDCLIENTSOURCES and WAYLANDSERVERSOURCES is used heavily throughout
QtWayland.
Task-number: QTBUG-78177
Change-Id: I4507447054c435f78e82c2ca3e9404288db6c1f6
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'util')
-rwxr-xr-x | util/cmake/pro2cmake.py | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py index 8765c870f6..84dc344d2b 100755 --- a/util/cmake/pro2cmake.py +++ b/util/cmake/pro2cmake.py @@ -1839,6 +1839,7 @@ def write_list( *, header: str = "", footer: str = "", + prefix: str = "", ): if not entries: return @@ -1853,7 +1854,7 @@ def write_list( cm_fh.write(f"{ind}{extra_indent}{cmake_parameter}\n") extra_indent += " " for s in sort_sources(entries): - cm_fh.write(f"{ind}{extra_indent}{s}\n") + cm_fh.write(f"{ind}{extra_indent}{prefix}{s}\n") if footer: cm_fh.write(f"{ind}{footer}\n") @@ -2545,6 +2546,32 @@ def write_android_part(cm_fh: IO[str], target: str, scope: Scope, indent: int = cm_fh.write(f"{spaces(indent)}endif()\n") +def write_wayland_part(cm_fh: typing.IO[str], target: str, scope:Scope, indent: int = 0): + client_sources = scope.get_files('WAYLANDCLIENTSOURCES', use_vpath=True) + server_sources = scope.get_files('WAYLANDSERVERSOURCES', use_vpath=True) + if len(client_sources) == 0 and len(server_sources) == 0: + return + + condition = map_to_cmake_condition(scope.total_condition) + if condition != "ON": + cm_fh.write(f"\n{spaces(indent)}if({condition})\n") + indent += 1 + + if len(client_sources) != 0: + cm_fh.write(f"\n{spaces(indent)}qt6_generate_wayland_protocol_client_sources({target}\n") + write_list(cm_fh, client_sources, 'FILES', indent + 1, prefix='${CMAKE_CURRENT_SOURCE_DIR}/') + cm_fh.write(f"{spaces(indent)})\n") + + if len(server_sources) != 0: + cm_fh.write(f"\n{spaces(indent)}qt6_generate_wayland_protocol_server_sources({target}\n") + write_list(cm_fh, server_sources, 'FILES', indent + 1, prefix='${CMAKE_CURRENT_SOURCE_DIR}/') + cm_fh.write(f"{spaces(indent)})\n") + + if condition != "ON": + indent -= 1 + cm_fh.write(f"\n{spaces(indent)}endif()\n") + + def write_main_part( cm_fh: IO[str], name: str, @@ -2630,6 +2657,8 @@ def write_main_part( write_android_part(cm_fh, name, scopes[0], indent) + write_wayland_part(cm_fh, name, scopes[0], indent) + ignored_keys_report = write_ignored_keys(scopes[0], spaces(indent)) if ignored_keys_report: cm_fh.write(ignored_keys_report) @@ -2643,6 +2672,7 @@ def write_main_part( for c in scopes[1:]: c.reset_visited_keys() write_android_part(cm_fh, name, c, indent=indent) + write_wayland_part(cm_fh, name, c, indent=indent) write_extend_target(cm_fh, name, c, indent=indent) ignored_keys_report = write_ignored_keys(c, spaces(indent)) if ignored_keys_report: |