[waffle] [PATCH 4/7] cmake: Add option waffle_has_surfaceless_egl
Emil Velikov
emil.l.velikov at gmail.com
Tue Oct 18 23:24:44 UTC 2016
On 18 October 2016 at 18:33, Chad Versace <chadversary at chromium.org> wrote:
> This patch contains just the CMake changes for the new surfaceless_egl
> platform. Code will come in the following patches.
>
> Cc: Gurchetan Singh <gurchetansingh at chromium.org>
> Cc: Haixia Shi <hshi at chromium.org>
> ---
> Options.cmake | 3 +++
> cmake/Modules/WaffleDefineCompilerFlags.cmake | 4 ++++
> cmake/Modules/WaffleDefineInternalOptions.cmake | 3 ++-
> cmake/Modules/WafflePrintConfigurationSummary.cmake | 3 +++
> cmake/Modules/WaffleValidateOptions.cmake | 15 ++++++++++++++-
> 5 files changed, 26 insertions(+), 2 deletions(-)
>
> diff --git a/Options.cmake b/Options.cmake
> index 4f097a0..699ec59 100644
> --- a/Options.cmake
> +++ b/Options.cmake
> @@ -23,11 +23,14 @@ if(waffle_on_linux)
> set(gbm_default OFF)
> endif()
>
> + set(surfaceless_egl_default ${egl_FOUND})
> +
> # On Linux, you must enable at least one of the below options.
> option(waffle_has_glx "Build support for GLX" ${glx_default})
> option(waffle_has_wayland "Build support for Wayland" ${wayland_default})
> option(waffle_has_x11_egl "Build support for X11/EGL" ${x11_egl_default})
> option(waffle_has_gbm "Build support for GBM" ${gbm_default})
> + option(waffle_has_surfaceless_egl "Build support for EGL_MESA_platform_surfaceless" ${surfaceless_egl_default})
> option(waffle_has_nacl "Build support for NaCl" OFF)
>
> # NaCl specific settings.
> diff --git a/cmake/Modules/WaffleDefineCompilerFlags.cmake b/cmake/Modules/WaffleDefineCompilerFlags.cmake
> index 7b67325..4eb4392 100644
> --- a/cmake/Modules/WaffleDefineCompilerFlags.cmake
> +++ b/cmake/Modules/WaffleDefineCompilerFlags.cmake
> @@ -122,6 +122,10 @@ if(waffle_on_linux)
> add_definitions(-DWAFFLE_HAS_GBM)
> endif()
>
> + if(waffle_has_surfaceless_egl)
> + add_definitions(-DWAFFLE_HAS_SURFACELESS_EGL)
> + endif()
> +
> if(waffle_has_tls)
> add_definitions(-DWAFFLE_HAS_TLS)
> endif()
> diff --git a/cmake/Modules/WaffleDefineInternalOptions.cmake b/cmake/Modules/WaffleDefineInternalOptions.cmake
> index 3ef7a25..b3a4f7b 100644
> --- a/cmake/Modules/WaffleDefineInternalOptions.cmake
> +++ b/cmake/Modules/WaffleDefineInternalOptions.cmake
> @@ -1,4 +1,5 @@
> -if(waffle_has_wayland OR waffle_has_x11_egl OR waffle_has_gbm)
> +if(waffle_has_wayland OR waffle_has_x11_egl OR waffle_has_gbm OR
> + waffle_has_surfaceless_egl)
> set(waffle_has_egl TRUE)
> else(waffle_has_wayland OR waffle_has_x11_egl)
IIRC expressions in the else statements are meaningless in cmake.
Can we drop the above one (which seems to be the only such case in
waffle) ? Be that here or as separate commit ?
> set(waffle_has_egl FALSE)
> diff --git a/cmake/Modules/WafflePrintConfigurationSummary.cmake b/cmake/Modules/WafflePrintConfigurationSummary.cmake
> index 1199ea3..f36555c 100644
> --- a/cmake/Modules/WafflePrintConfigurationSummary.cmake
> +++ b/cmake/Modules/WafflePrintConfigurationSummary.cmake
> @@ -47,6 +47,9 @@ endif()
> if(waffle_has_gbm)
> message(" gbm")
> endif()
> +if(waffle_has_surfaceless_egl)
> + message(" surfaceless_egl")
> +endif()
> if(waffle_on_windows)
> message(" wgl")
> endif()
> diff --git a/cmake/Modules/WaffleValidateOptions.cmake b/cmake/Modules/WaffleValidateOptions.cmake
> index 1275463..8f83338 100644
> --- a/cmake/Modules/WaffleValidateOptions.cmake
> +++ b/cmake/Modules/WaffleValidateOptions.cmake
> @@ -47,12 +47,14 @@ endif()
> if(waffle_on_linux)
> if(NOT waffle_has_glx AND NOT waffle_has_wayland AND
> NOT waffle_has_x11_egl AND NOT waffle_has_gbm AND
> + NOT waffle_has_surfaceless_egl AND
> NOT waffle_has_nacl)
> message(FATAL_ERROR
> "Must enable at least one of: "
> "waffle_has_glx, waffle_has_wayland, "
> "waffle_has_x11_egl, waffle_has_gbm, "
> - "waffle_has_nacl.")
> + "waffle_has_surfaceless_egl, "
> + "waffle_has_nacl")
> endif()
> if(waffle_has_nacl)
> if(NOT EXISTS ${nacl_sdk_path})
> @@ -149,6 +151,11 @@ if(waffle_on_linux)
> message(FATAL_ERROR "x11_egl dependency is missing: ${x11_egl_missing_deps}")
> endif()
> endif()
> + if(waffle_has_surfaceless_egl)
> + if(NOT egl_FOUND)
> + message(FATAL_ERROR "surfaceless_egl dependency is missing: egl")
> + endif()
> + endif()
I'm wondering if we cannot rework these (or the whole file in general)
to minimise the boilerplate.
Sadly no wise ideas come to mind :-(
> elseif(waffle_on_mac)
> if(waffle_has_gbm)
> message(FATAL_ERROR "Option is not supported on Darwin: waffle_has_gbm.")
> @@ -162,6 +169,9 @@ elseif(waffle_on_mac)
> if(waffle_has_x11_egl)
> message(FATAL_ERROR "Option is not supported on Darwin: waffle_has_x11_egl.")
> endif()
> + if(waffle_has_surfaceless_egl)
> + message(FATAL_ERROR "Option is not supported on Darwin: waffle_has_surfaceless_egl.")
> + endif()
> elseif(waffle_on_windows)
> if(waffle_has_gbm)
> message(FATAL_ERROR "Option is not supported on Windows: waffle_has_gbm.")
> @@ -175,4 +185,7 @@ elseif(waffle_on_windows)
> if(waffle_has_x11_egl)
> message(FATAL_ERROR "Option is not supported on Windows: waffle_has_x11_egl.")
> endif()
> + if(waffle_has_surfaceless_egl)
> + message(FATAL_ERROR "Option is not supported on Darwin: waffle_has_surfaceless_egl.")
... because the about should read s/Darwin/Windows/
-Emil
More information about the waffle
mailing list