Changeset 207311 in webkit


Ignore:
Timestamp:
Oct 13, 2016 2:48:43 PM (8 years ago)
Author:
BJ Burg
Message:

[CMake] Split the definition of CODE_GENERATOR_PREPROCESSOR so it can be used in a custom command
https://bugs.webkit.org/show_bug.cgi?id=163401

Reviewed by Michael Catanzaro.

In another patch, we need to use CODE_GENERATOR_PREPROCESSOR as the COMMAND argument
when defining an add_custom_command. Previously, it has only been used as a quoted argument
to various Perl code generation scripts.

To support both use cases, we need to be able to provide the executable and its arguments as
an unbroken quoted string, and as a CMake list suitable for passing as an argument to COMMAND.

  • Source/cmake/OptionsCommon.cmake:

Split out the executable and argument string into separate variables that can be used elsewhere.
Compute the final unbroken quoted string using the two separate variables to arrive at the same result.

  • Source/cmake/WebKitMacros.cmake:

Drive-by cleanup to add quotes around the use of CODE_GENERATOR_PREPROCESSOR so it matches other uses.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r207279 r207311  
     12016-10-13  Brian Burg  <bburg@apple.com>
     2
     3        [CMake] Split the definition of CODE_GENERATOR_PREPROCESSOR so it can be used in a custom command
     4        https://bugs.webkit.org/show_bug.cgi?id=163401
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        In another patch, we need to use CODE_GENERATOR_PREPROCESSOR as the COMMAND argument
     9        when defining an add_custom_command. Previously, it has only been used as a quoted argument
     10        to various Perl code generation scripts.
     11
     12        To support both use cases, we need to be able to provide the executable and its arguments as
     13        an unbroken quoted string, and as a CMake list suitable for passing as an argument to COMMAND.
     14
     15        * Source/cmake/OptionsCommon.cmake:
     16        Split out the executable and argument string into separate variables that can be used elsewhere.
     17        Compute the final unbroken quoted string using the two separate variables to arrive at the same result.
     18
     19        * Source/cmake/WebKitMacros.cmake:
     20        Drive-by cleanup to add quotes around the use of CODE_GENERATOR_PREPROCESSOR so it matches other uses.
     21
    1222016-10-12  Chris Dumez  <cdumez@apple.com>
    223
  • trunk/Source/cmake/OptionsCommon.cmake

    r206496 r207311  
    99    # FIXME: Some codegenerators don't support paths with spaces. So use the executable name only.
    1010    get_filename_component(CODE_GENERATOR_PREPROCESSOR_EXECUTABLE ${CMAKE_CXX_COMPILER} ABSOLUTE)
    11     set(CODE_GENERATOR_PREPROCESSOR "\"${CODE_GENERATOR_PREPROCESSOR_EXECUTABLE}\" /nologo /EP")
    12     set(CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS "${CODE_GENERATOR_PREPROCESSOR}")
     11
     12    set(CODE_GENERATOR_PREPROCESSOR_ARGUMENTS "/nologo /EP")
     13    set(CODE_GENERATOR_PREPROCESSOR "\"${CODE_GENERATOR_PREPROCESSOR_EXECUTABLE}\" ${CODE_GENERATOR_PREPROCESSOR_ARGUMENTS}")
     14
     15    set(CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS ${CODE_GENERATOR_PREPROCESSOR})
    1316else ()
    14     set(CODE_GENERATOR_PREPROCESSOR "${CMAKE_CXX_COMPILER} -E -P -x c++")
    15     set(CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS "${CMAKE_CXX_COMPILER} -E -x c++")
     17    set(CODE_GENERATOR_PREPROCESSOR_EXECUTABLE ${CMAKE_CXX_COMPILER})
     18
     19    set(CODE_GENERATOR_PREPROCESSOR_ARGUMENTS "-E -P -x c++")
     20    set(CODE_GENERATOR_PREPROCESSOR "${CODE_GENERATOR_PREPROCESSOR_EXECUTABLE} ${CODE_GENERATOR_PREPROCESSOR_ARGUMENTS}")
     21
     22    set(CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS_ARGUMENTS "-E -x c++")
     23    set(CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS "${CODE_GENERATOR_PREPROCESSOR_EXECUTABLE} ${CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS_ARGUMENTS}")
    1624endif ()
    1725
  • trunk/Source/cmake/WebKitMacros.cmake

    r207009 r207311  
    118118            MAIN_DEPENDENCY ${_file}
    119119            DEPENDS ${common_generator_dependencies}
    120             COMMAND ${PERL_EXECUTABLE} ${binding_generator} --defines ${arg_FEATURES} --generator ${arg_GENERATOR} ${idl_includes} --outputDir ${arg_DESTINATION} --preprocessor ${CODE_GENERATOR_PREPROCESSOR} --idlAttributesFile ${idl_attributes_file} ${_supplemental_dependency} ${_file}
     120            COMMAND ${PERL_EXECUTABLE} ${binding_generator} --defines ${arg_FEATURES} --generator ${arg_GENERATOR} ${idl_includes} --outputDir ${arg_DESTINATION} --preprocessor "${CODE_GENERATOR_PREPROCESSOR}" --idlAttributesFile ${idl_attributes_file} ${_supplemental_dependency} ${_file}
    121121            WORKING_DIRECTORY ${arg_BASE_DIR}
    122122            VERBATIM)
Note: See TracChangeset for help on using the changeset viewer.