Bug 144394 - [CMake] Automatically expose WTF_USE_FOO to the build when USE_FOO is exposed
Summary: [CMake] Automatically expose WTF_USE_FOO to the build when USE_FOO is exposed
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Martin Robinson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-29 09:58 PDT by Martin Robinson
Modified: 2015-04-30 09:18 PDT (History)
4 users (show)

See Also:


Attachments
Patch (3.74 KB, patch)
2015-04-29 10:22 PDT, Martin Robinson
no flags Details | Formatted Diff | Diff
Patch (3.99 KB, patch)
2015-04-29 10:35 PDT, Martin Robinson
no flags Details | Formatted Diff | Diff
Patch (4.15 KB, patch)
2015-04-30 08:53 PDT, Martin Robinson
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Robinson 2015-04-29 09:58:35 PDT
When options are presented to the user they are presented in the form USE_FOO, but the WTF USE(...) macro expects WTF_USE_FOO. We can automatically expose WTF_USE_FOO to make some things simpler.
Comment 1 Martin Robinson 2015-04-29 10:22:22 PDT
Created attachment 251964 [details]
Patch
Comment 2 Michael Catanzaro 2015-04-29 10:28:24 PDT
Nits:

You should mention in the changelog that this fixes USE_REDIRECTED_XCOMPOSITE_WINDOW after yesterday's commit, since that's a significant consequence of the change.

Also, the comment "when we forget" implies that exposing WTF_USE_WHATEVER is best practice, but after this change I don't see any reason to do that anymore.
Comment 3 Martin Robinson 2015-04-29 10:35:29 PDT
Created attachment 251966 [details]
Patch
Comment 4 Martin Robinson 2015-04-29 16:34:58 PDT
(In reply to comment #2)
> Nits:
> 
> You should mention in the changelog that this fixes
> USE_REDIRECTED_XCOMPOSITE_WINDOW after yesterday's commit, since that's a
> significant consequence of the change.
> 
> Also, the comment "when we forget" implies that exposing WTF_USE_WHATEVER is
> best practice, but after this change I don't see any reason to do that
> anymore.

Thanks for the comments. I have updated the patch with your suggestions.
Comment 5 Carlos Garcia Campos 2015-04-30 00:44:04 PDT
Comment on attachment 251966 [details]
Patch

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

> Source/cmake/OptionsGTK.cmake:378
>  set(DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR ${DERIVED_SOURCES_DIR}/webkitdom)

I guess you can remove SET_AND_EXPOSE_TO_BUILD(WTF_USE_LIBHYPHEN 1)

> Source/cmake/WebKitFeatures.cmake:314
> +        _ADD_CONFIGURATION_LINE_TO_HEADER_STRING(_file_contents ${_variable_name} ${_variable_name})
> +
> +        # WebKit looks for WTF_USE_FOO when calling the USE(FOO) macro. Automatically exposing
> +        # this definition when USE_FOO is exposed, prevents us from having to expose both (or
> +        # forgetting to do so).
> +        string(FIND ${_variable_name} "USE_" _use_string_location)
> +        if (${_use_string_location} EQUAL 0)
> +            _ADD_CONFIGURATION_LINE_TO_HEADER_STRING(_file_contents ${_variable_name} "WTF_${_variable_name}")

This duplicates the USE macros in the cmakeconfig.h, with and without the WTF prefix, but I guess only the prefixed one is useful. I guess we could move the previous _ADD_CONFIGURATION_LINE_TO_HEADER_STRING to and else() here.
Comment 6 Martin Robinson 2015-04-30 08:47:04 PDT
(In reply to comment #5)
> Comment on attachment 251966 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=251966&action=review
> 
> > Source/cmake/OptionsGTK.cmake:378
> >  set(DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR ${DERIVED_SOURCES_DIR}/webkitdom)
> 
> I guess you can remove SET_AND_EXPOSE_TO_BUILD(WTF_USE_LIBHYPHEN 1)
> 
Yes, this patch was written before libhyphen integration was complete. :)

> > Source/cmake/WebKitFeatures.cmake:314
> > +        _ADD_CONFIGURATION_LINE_TO_HEADER_STRING(_file_contents ${_variable_name} ${_variable_name})
> > +
> > +        # WebKit looks for WTF_USE_FOO when calling the USE(FOO) macro. Automatically exposing
> > +        # this definition when USE_FOO is exposed, prevents us from having to expose both (or
> > +        # forgetting to do so).
> > +        string(FIND ${_variable_name} "USE_" _use_string_location)
> > +        if (${_use_string_location} EQUAL 0)
> > +            _ADD_CONFIGURATION_LINE_TO_HEADER_STRING(_file_contents ${_variable_name} "WTF_${_variable_name}")
> 
> This duplicates the USE macros in the cmakeconfig.h, with and without the
> WTF prefix, but I guess only the prefixed one is useful. I guess we could
> move the previous _ADD_CONFIGURATION_LINE_TO_HEADER_STRING to and else()
> here.

I waffled a bit on this, so your approach is probably fine too.
Comment 7 Martin Robinson 2015-04-30 08:53:21 PDT
(In reply to comment #6)

> > This duplicates the USE macros in the cmakeconfig.h, with and without the
> > WTF prefix, but I guess only the prefixed one is useful. I guess we could
> > move the previous _ADD_CONFIGURATION_LINE_TO_HEADER_STRING to and else()
> > here.
> 
> I waffled a bit on this, so your approach is probably fine too.

Actually, this isn't possible because there is at least one exception. USE_SYSTEM_MALLOC shouldn't have the prefix. I think it's safer to expose both for now.
Comment 8 Martin Robinson 2015-04-30 08:53:43 PDT
Created attachment 252060 [details]
Patch
Comment 9 Carlos Garcia Campos 2015-04-30 09:01:31 PDT
Comment on attachment 252060 [details]
Patch

Hopefully USE won't require the WTF prefix eventually.
Comment 10 Martin Robinson 2015-04-30 09:18:22 PDT
Comment on attachment 252060 [details]
Patch

Clearing flags on attachment: 252060

Committed r183626: <http://trac.webkit.org/changeset/183626>
Comment 11 Martin Robinson 2015-04-30 09:18:26 PDT
All reviewed patches have been landed.  Closing bug.