New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve how CMake looks for wayland-scanner #39
Conversation
This improves FindWaylandScanner.cmake to allow it to find the wayland-scanner tool in any of the following ways (in order of preference): 1. By passing -DWAYLAND_SCANNER=path/to/wayland-scanner to CMake. 2. Looking for wayland-scanner in the current $PATH 3. Figuring out the location from pkg-config (as before). This will make the package friendlier to cross-compilation, and then build systems can either prepend their locations for host tools to $PATH (covered by 2. above), or they can specify the tool path in the command line (covered by 1. above) if they need to be more specific. The motivation for this patch is to avoid kludges like the following: https://patchwork.ozlabs.org/comment/2172010/
if (WAYLAND_SCANNER_PC_FOUND) | ||
pkg_get_variable(WAYLAND_SCANNER_PC_EXECUTABLE wayland-scanner wayland_scanner) | ||
if (WAYLAND_SCANNER_PC_EXECUTABLE) | ||
wayland_scanner_get_version(WAYLAND_SCANNER_VERSION "${WAYLAND_SCANNER_PC_EXECUTABLE}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the case of pkg-config we already have the version here, we don't need to execute the scanner to get its version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better to try and run it to extract the version, to avoid the case in which the path returned by pkg-config
points to a binary which cannot be executed on the host used for compilation… which would be useless, and was precisely what was happening when cross-building with Buildroot.
In this case I think it is better execute the program and to report failure (if it fails to run) when trying to find an usable wayland-scanner
at configuration time than to pretend things are fine and fail later during compilation in mysterious ways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok!
I have double checked with Buildroot that having this patch applied indeed makes it pick the correct
Note how the configuration log output copied above picked Let's merge this 👍 |
I have also cherry picked this into the |
Add an API to get the EGL platform identifier
This improves
FindWaylandScanner.cmake
to allow it to find thewayland-scanner
tool in any of the following ways (in order of preference):-DWAYLAND_SCANNER=path/to/wayland-scanner
to CMake.$PATH
.pkg-config
(as before).This will make the package friendlier to cross-compilation, and then build systems can either prepend their locations for host tools to
$PATH
(covered by 2. above), or they can specify the tool path in the command line (covered by 1. above) if they need to be more specific.The motivation for this patch is to avoid kludges like the following:
https://patchwork.ozlabs.org/comment/2172010/