Bug 143839 - [CMake] Should be possible for an option to depend on multiple options
Summary: [CMake] Should be possible for an option to depend on multiple options
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Enhancement
Assignee: Michael Catanzaro
URL:
Keywords:
Depends on: 143831
Blocks: 143956
  Show dependency treegraph
 
Reported: 2015-04-16 12:27 PDT by Michael Catanzaro
Modified: 2015-04-23 12:57 PDT (History)
4 users (show)

See Also:


Attachments
Patch (2.59 KB, patch)
2015-04-16 12:39 PDT, Michael Catanzaro
no flags Details | Formatted Diff | Diff
[CMake] Should be possible for an option to depend on multiple options (2.94 KB, patch)
2015-04-20 11:50 PDT, Michael Catanzaro
no flags Details | Formatted Diff | Diff
Patch (3.67 KB, patch)
2015-04-22 08:30 PDT, Michael Catanzaro
no flags Details | Formatted Diff | Diff
[CMake] Should be possible for an option to conflict with other options (4.41 KB, patch)
2015-04-23 08:57 PDT, Michael Catanzaro
no flags Details | Formatted Diff | Diff
[CMake] Should be possible for an option to depend on multiple options (3.52 KB, patch)
2015-04-23 09:00 PDT, Michael Catanzaro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Catanzaro 2015-04-16 12:27:40 PDT
Currently it's not possible for an option to depend on more than one other option. This makes it awkward to manually check whether the combination of available options is valid. For example, my patch in bug #143558 uses the following code:

WEBKIT_OPTION_DEPEND(USE_GSTREAMER_GL ENABLE_VIDEO)
WEBKIT_OPTION_DEPEND(USE_GSTREAMER_GL USE_OPENGL)
WEBKIT_OPTION_DEPEND(USE_REDIRECTED_XCOMPOSITE_WINDOW ENABLE_X11_TARGET)
WEBKIT_OPTION_DEPEND(USE_REDIRECTED_XCOMPOSITE_WINDOW USE_OPENGL)

It would be nice if that worked as expected. The current behavior is that the most recent call to WEBKIT_OPTION_DEPEND overrides the previous call.
Comment 1 Michael Catanzaro 2015-04-16 12:39:22 PDT
Created attachment 250939 [details]
Patch
Comment 2 Michael Catanzaro 2015-04-20 11:50:02 PDT
Created attachment 251177 [details]
[CMake] Should be possible for an option to depend on multiple options
Comment 3 Michael Catanzaro 2015-04-22 08:30:07 PDT
Created attachment 251318 [details]
Patch
Comment 4 Martin Robinson 2015-04-22 11:42:02 PDT
Comment on attachment 251318 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=251318&action=review

Looks good to me. Small suggestion for a cleanup:

> Source/cmake/WebKitFeatures.cmake:185
> +macro(_WEBKIT_OPTION_ENFORCE_DEPENDS)
> +    set(_OPTION_CHANGED TRUE)
> +    while (${_OPTION_CHANGED})
> +        set(_OPTION_CHANGED FALSE)
> +        foreach (_name ${_WEBKIT_AVAILABLE_OPTIONS})
> +            if (${_name})
> +                foreach (_dependency ${_WEBKIT_AVAILABLE_OPTIONS_${_name}_DEPENDENCIES})
> +                    if (NOT ${_dependency})
> +                        message(STATUS "Disabling ${_name} since ${_dependency} is disabled.")
> +                        set(${_name} OFF)
> +                        set(_OPTION_CHANGED TRUE)
> +                        break ()
> +                    endif ()
> +                endforeach ()
> +            endif ()
> +        endforeach ()
> +    endwhile ()
> +endmacro()

You could eliminate the outer loop by running this macro for every option and passing the option name as an argument. I think that would simplify things quite a bit.

> Source/cmake/WebKitFeatures.cmake:190
>      list(SORT _WEBKIT_AVAILABLE_OPTIONS)
> +
>      set(_MAX_FEATURE_LENGTH 0)

This newline looks unrelated.
Comment 5 Michael Catanzaro 2015-04-23 08:57:52 PDT
Created attachment 251440 [details]
[CMake] Should be possible for an option to conflict with other options
Comment 6 Michael Catanzaro 2015-04-23 09:00:11 PDT
Created attachment 251442 [details]
[CMake] Should be possible for an option to depend on multiple options
Comment 7 Michael Catanzaro 2015-04-23 12:43:43 PDT
Comment on attachment 251442 [details]
[CMake] Should be possible for an option to depend on multiple options

Clearing flags on attachment: 251442

Committed r183202: <http://trac.webkit.org/changeset/183202>
Comment 8 Michael Catanzaro 2015-04-23 12:43:48 PDT
All reviewed patches have been landed.  Closing bug.