Changeset 207617 in webkit


Ignore:
Timestamp:
Oct 20, 2016 7:34:24 AM (8 years ago)
Author:
commit-queue@webkit.org
Message:

[CMake] CMake does not support the dep files for implicit dependency
https://bugs.webkit.org/show_bug.cgi?id=161433

Patch by Fujii Hironori <Fujii Hironori> on 2016-10-20
Reviewed by Brent Fulgham.

Created a Perl script to generate all IDL bindings for CMake.
This script can regenerate outdated bindings by based on the
supplemental dependency and dep files created by
'--write-dependencies' switch of generate-bindings.pl.

add_custom_target is used to invoke the script instead of
add_custom_command because Ninja deletes all output files before
executing the command in case of add_custom_command.

USES_TERMINAL option of add_custom_target has two effects:
1) Not buffering output of the command
2) Invoking the command in the special Ninja pool which inhibits parallel build
One needs to use CMake 3.2 or later to enable this feature.

.:

  • Source/cmake/WebKitMacros.cmake (GENERATE_BINDINGS): Included

ProcessorCount. Added a new argument 'target'. Use
add_custom_target instead of add_custom_command. Invoke the new
script.

Source/WebCore:

  • CMakeLists.txt: Specified target names for

GENERATE_BINDINGS. Added dependency for the targets.

  • bindings/scripts/generate-bindings-all.pl: Added.

Tools:

  • DumpRenderTree/CMakeLists.txt: Specified a target name for

GENERATE_BINDINGS. Added dependency for the target.

  • WebKitTestRunner/CMakeLists.txt: Ditto.
Location:
trunk
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r207585 r207617  
     12016-10-20  Fujii Hironori  <Hironori.Fujii@sony.com>
     2
     3        [CMake] CMake does not support the dep files for implicit dependency
     4        https://bugs.webkit.org/show_bug.cgi?id=161433
     5
     6        Reviewed by Brent Fulgham.
     7
     8        Created a Perl script to generate all IDL bindings for CMake.
     9        This script can regenerate outdated bindings by based on the
     10        supplemental dependency and dep files created by
     11        '--write-dependencies' switch of generate-bindings.pl.
     12
     13        add_custom_target is used to invoke the script instead of
     14        add_custom_command because Ninja deletes all output files before
     15        executing the command in case of add_custom_command.
     16
     17        USES_TERMINAL option of add_custom_target has two effects:
     18        1) Not buffering output of the command
     19        2) Invoking the command in the special Ninja pool which inhibits parallel build
     20        One needs to use CMake 3.2 or later to enable this feature.
     21
     22        * Source/cmake/WebKitMacros.cmake (GENERATE_BINDINGS): Included
     23        ProcessorCount.  Added a new argument 'target'.  Use
     24        add_custom_target instead of add_custom_command.  Invoke the new
     25        script.
     26
    1272016-10-19  Alex Christensen  <achristensen@webkit.org>
    228
  • trunk/Source/WebCore/CMakeLists.txt

    r207479 r207617  
    36423642list(APPEND WebCoreTestSupport_IDL_FILES ${DERIVED_SOURCES_WEBCORE_DIR}/InternalSettingsGenerated.idl)
    36433643
    3644 GENERATE_BINDINGS(
     3644GENERATE_BINDINGS(WebCoreBindings
    36453645    OUTPUT_SOURCE WebCore_DERIVED_SOURCES
    36463646    INPUT_FILES ${WebCore_IDL_FILES}
     
    36583658        --dedicatedWorkerGlobalScopeConstructorsFile ${DEDICATEDWORKERGLOBALSCOPE_CONSTRUCTORS_FILE})
    36593659
    3660 GENERATE_BINDINGS(
     3660GENERATE_BINDINGS(WebCoreTestSupportBindings
    36613661    OUTPUT_SOURCE WebCoreTestSupport_SOURCES
    36623662    INPUT_FILES ${WebCoreTestSupport_IDL_FILES}
     
    36663666    DESTINATION ${DERIVED_SOURCES_WEBCORE_DIR}
    36673667    GENERATOR JS)
     3668
     3669# WebCoreTestSupportBindings needs InternalSettingsGenerated.idl
     3670add_dependencies(WebCoreTestSupportBindings WebCoreDerivedSources)
    36683671
    36693672# WebCore JS Builtins
     
    38123815add_library(WebCoreDerivedSources STATIC ${WebCore_DERIVED_SOURCES})
    38133816set_target_properties(WebCoreDerivedSources PROPERTIES OUTPUT_NAME WebCoreDerivedSources${DEBUG_SUFFIX})
    3814 add_dependencies(WebCoreDerivedSources JavaScriptCore)
     3817add_dependencies(WebCoreDerivedSources JavaScriptCore WebCoreBindings)
    38153818if (NOT WIN32)
    38163819    list(APPEND WebCore_LIBRARIES WebCoreDerivedSources)
     
    38433846include_directories(${WebCoreTestSupport_INCLUDE_DIRECTORIES})
    38443847add_library(WebCoreTestSupport ${WebCoreTestSupport_LIBRARY_TYPE} ${WebCoreTestSupport_SOURCES})
    3845 add_dependencies(WebCoreTestSupport WebCore)
     3848add_dependencies(WebCoreTestSupport WebCore WebCoreTestSupportBindings)
    38463849target_link_libraries(WebCoreTestSupport ${WebCoreTestSupport_LIBRARIES})
    38473850
  • trunk/Source/WebCore/ChangeLog

    r207616 r207617  
     12016-10-20  Fujii Hironori  <Hironori.Fujii@sony.com>
     2
     3        [CMake] CMake does not support the dep files for implicit dependency
     4        https://bugs.webkit.org/show_bug.cgi?id=161433
     5
     6        Reviewed by Brent Fulgham.
     7
     8        Created a Perl script to generate all IDL bindings for CMake.
     9        This script can regenerate outdated bindings by based on the
     10        supplemental dependency and dep files created by
     11        '--write-dependencies' switch of generate-bindings.pl.
     12
     13        add_custom_target is used to invoke the script instead of
     14        add_custom_command because Ninja deletes all output files before
     15        executing the command in case of add_custom_command.
     16
     17        USES_TERMINAL option of add_custom_target has two effects:
     18        1) Not buffering output of the command
     19        2) Invoking the command in the special Ninja pool which inhibits parallel build
     20        One needs to use CMake 3.2 or later to enable this feature.
     21
     22        * CMakeLists.txt: Specified target names for
     23        GENERATE_BINDINGS. Added dependency for the targets.
     24        * bindings/scripts/generate-bindings-all.pl: Added.
     25
    1262016-10-20  Adam Jackson  <ajax@redhat.com>
    227
  • trunk/Source/cmake/WebKitMacros.cmake

    r207311 r207617  
    11include(CMakeParseArguments)
     2include(ProcessorCount)
     3ProcessorCount(PROCESSOR_COUNT)
    24
    35macro(WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS)
     
    4446endmacro()
    4547
    46 # Helper macro which wraps preprocess-idls.pl and generate-bindings.pl scripts.
     48# Helper macro which wraps generate-bindings-all.pl script.
     49#   target is a new target name to be added
    4750#   OUTPUT_SOURCE is a list name which will contain generated sources.(eg. WebCore_SOURCES)
    4851#   INPUT_FILES are IDL files to generate.
     
    5558#   PP_EXTRA_OUTPUT is extra outputs of preprocess-idls.pl. (optional)
    5659#   PP_EXTRA_ARGS is extra arguments for preprocess-idls.pl. (optional)
    57 function(GENERATE_BINDINGS)
     60function(GENERATE_BINDINGS target)
    5861    set(options)
    5962    set(oneValueArgs OUTPUT_SOURCE BASE_DIR FEATURES DESTINATION GENERATOR SUPPLEMENTAL_DEPFILE)
    6063    set(multiValueArgs INPUT_FILES IDL_INCLUDES PP_EXTRA_OUTPUT PP_EXTRA_ARGS)
    6164    cmake_parse_arguments(arg "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
    62     set(binding_generator ${WEBCORE_DIR}/bindings/scripts/generate-bindings.pl)
     65    set(binding_generator ${WEBCORE_DIR}/bindings/scripts/generate-bindings-all.pl)
    6366    set(idl_attributes_file ${WEBCORE_DIR}/bindings/scripts/IDLAttributes.txt)
    64     set(id ${arg_OUTPUT_SOURCE})
    65     set(idl_files_list ${CMAKE_CURRENT_BINARY_DIR}/idl_files_${id}.tmp)
     67    set(idl_files_list ${CMAKE_CURRENT_BINARY_DIR}/idl_files_${target}.tmp)
    6668    set(_supplemental_dependency)
    6769
     
    7577    file(WRITE ${idl_files_list} ${content})
    7678
     79    set(args
     80        --defines ${arg_FEATURES}
     81        --generator ${arg_GENERATOR}
     82        --outputDir ${arg_DESTINATION}
     83        --idlFilesList ${idl_files_list}
     84        --preprocessor "${CODE_GENERATOR_PREPROCESSOR}"
     85        --idlAttributesFile ${idl_attributes_file})
    7786    if (arg_SUPPLEMENTAL_DEPFILE)
    78         set(_supplemental_dependency --supplementalDependencyFile ${arg_SUPPLEMENTAL_DEPFILE})
    79 
    80         add_custom_command(
    81             OUTPUT ${arg_SUPPLEMENTAL_DEPFILE} ${arg_PP_EXTRA_OUTPUT}
    82             DEPENDS ${WEBCORE_DIR}/bindings/scripts/preprocess-idls.pl ${arg_INPUT_FILES}
    83             COMMAND ${PERL_EXECUTABLE} ${WEBCORE_DIR}/bindings/scripts/preprocess-idls.pl --defines ${arg_FEATURES} --idlFilesList ${idl_files_list} --supplementalDependencyFile ${arg_SUPPLEMENTAL_DEPFILE} ${arg_PP_EXTRA_ARGS}
    84             VERBATIM)
    85     endif ()
    86 
    87     set(idl_includes)
    88     foreach (dir ${arg_IDL_INCLUDES})
    89         if (IS_ABSOLUTE ${dir})
    90             list(APPEND idl_includes --include=${dir})
     87        list(APPEND args --supplementalDependencyFile ${arg_SUPPLEMENTAL_DEPFILE})
     88    endif ()
     89    if (PROCESSOR_COUNT)
     90        list(APPEND args --numOfJobs ${PROCESSOR_COUNT})
     91    endif ()
     92    foreach (i IN LISTS arg_IDL_INCLUDES)
     93        if (IS_ABSOLUTE ${i})
     94            list(APPEND args --include ${i})
    9195        else ()
    92             list(APPEND idl_includes --include=${CMAKE_CURRENT_SOURCE_DIR}/${dir})
    93         endif ()
     96            list(APPEND args --include ${CMAKE_CURRENT_SOURCE_DIR}/${i})
     97        endif ()
     98    endforeach ()
     99    foreach (i IN LISTS arg_PP_EXTRA_OUTPUT)
     100        list(APPEND args --ppExtraOutput ${i})
     101    endforeach ()
     102    foreach (i IN LISTS arg_PP_EXTRA_ARGS)
     103        list(APPEND args --ppExtraArgs ${i})
    94104    endforeach ()
    95105
    96106    set(common_generator_dependencies
    97         ${binding_generator}
    98         ${WEBCORE_DIR}/bindings/scripts/CodeGenerator.pm
     107        ${WEBCORE_DIR}/bindings/scripts/generate-bindings.pl
    99108        ${SCRIPTS_BINDINGS}
    100         ${arg_SUPPLEMENTAL_DEPFILE}
    101         ${idl_attributes_file}
    102109    )
    103     list(APPEND common_generator_dependencies ${arg_PP_EXTRA_OUTPUT})
    104 
    105110    if (EXISTS ${WEBCORE_DIR}/bindings/scripts/CodeGenerator${arg_GENERATOR}.pm)
    106111        list(APPEND common_generator_dependencies ${WEBCORE_DIR}/bindings/scripts/CodeGenerator${arg_GENERATOR}.pm)
     
    109114        list(APPEND common_generator_dependencies ${arg_BASE_DIR}/CodeGenerator${arg_GENERATOR}.pm)
    110115    endif ()
     116    foreach (i IN LISTS common_generator_dependencies)
     117        list(APPEND args --generatorDependency ${i})
     118    endforeach ()
    111119
    112120    set(gen_sources)
     121    set(gen_headers)
    113122    foreach (_file ${arg_INPUT_FILES})
    114123        get_filename_component(_name ${_file} NAME_WE)
    115 
    116         add_custom_command(
    117             OUTPUT ${arg_DESTINATION}/JS${_name}.cpp ${arg_DESTINATION}/JS${_name}.h
    118             MAIN_DEPENDENCY ${_file}
    119             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}
    121             WORKING_DIRECTORY ${arg_BASE_DIR}
    122             VERBATIM)
    123124        list(APPEND gen_sources ${arg_DESTINATION}/JS${_name}.cpp)
     125        list(APPEND gen_headers ${arg_DESTINATION}/JS${_name}.h)
    124126    endforeach ()
    125127    set(${arg_OUTPUT_SOURCE} ${${arg_OUTPUT_SOURCE}} ${gen_sources} PARENT_SCOPE)
     128    set(act_args)
     129    if (${CMAKE_VERSION} VERSION_LESS 3.2)
     130        set_source_files_properties(${gen_sources} ${gen_headers} PROPERTIES GENERATED 1)
     131    else ()
     132        list(APPEND act_args
     133            BYPRODUCTS ${gen_sources} ${gen_headers}
     134            USES_TERMINAL
     135        )
     136    endif ()
     137    add_custom_target(${target}
     138        COMMAND ${PERL_EXECUTABLE} ${binding_generator} ${args}
     139        WORKING_DIRECTORY ${arg_BASE_DIR}
     140        COMMENT "Generate bindings (${target})"
     141        VERBATIM ${act_args})
    126142endfunction()
    127143
  • trunk/Tools/ChangeLog

    r207609 r207617  
     12016-10-20  Fujii Hironori  <Hironori.Fujii@sony.com>
     2
     3        [CMake] CMake does not support the dep files for implicit dependency
     4        https://bugs.webkit.org/show_bug.cgi?id=161433
     5
     6        Reviewed by Brent Fulgham.
     7
     8        Created a Perl script to generate all IDL bindings for CMake.
     9        This script can regenerate outdated bindings by based on the
     10        supplemental dependency and dep files created by
     11        '--write-dependencies' switch of generate-bindings.pl.
     12
     13        add_custom_target is used to invoke the script instead of
     14        add_custom_command because Ninja deletes all output files before
     15        executing the command in case of add_custom_command.
     16
     17        USES_TERMINAL option of add_custom_target has two effects:
     18        1) Not buffering output of the command
     19        2) Invoking the command in the special Ninja pool which inhibits parallel build
     20        One needs to use CMake 3.2 or later to enable this feature.
     21
     22        * DumpRenderTree/CMakeLists.txt: Specified a target name for
     23        GENERATE_BINDINGS. Added dependency for the target.
     24        * WebKitTestRunner/CMakeLists.txt: Ditto.
     25
    1262016-10-20  Manuel Rego Casasnovas  <rego@igalia.com>
    227
  • trunk/Tools/DumpRenderTree/CMakeLists.txt

    r207009 r207617  
    121121)
    122122
    123 GENERATE_BINDINGS(
     123GENERATE_BINDINGS(DumpRenderTreeBindings
    124124    OUTPUT_SOURCE DumpRenderTree_SOURCES
    125125    INPUT_FILES ${DumpRenderTree_IDL_FILES}
     
    136136add_executable(DumpRenderTree ${DumpRenderTree_SOURCES})
    137137target_link_libraries(DumpRenderTree ${DumpRenderTree_LIBRARIES})
     138add_dependencies(DumpRenderTree DumpRenderTreeBindings)
    138139
    139140if (ENABLE_NETSCAPE_PLUGIN_API)
  • trunk/Tools/WebKitTestRunner/CMakeLists.txt

    r207009 r207617  
    9898)
    9999
    100 GENERATE_BINDINGS(
     100GENERATE_BINDINGS(WebKitTestRunnerInjectedBundleBindings
    101101    OUTPUT_SOURCE WebKitTestRunnerInjectedBundle_SOURCES
    102102    INPUT_FILES ${WebKitTestRunnerInjectedBundle_IDL_FILES}
     
    107107    GENERATOR TestRunner)
    108108
    109 GENERATE_BINDINGS(
     109GENERATE_BINDINGS(WebKitTestRunnerBindings
    110110    OUTPUT_SOURCE WebKitTestRunner_SOURCES
    111111    INPUT_FILES ${WebKitTestRunner_IDL_FILES}
     
    123123add_library(TestRunnerInjectedBundle SHARED ${WebKitTestRunnerInjectedBundle_SOURCES})
    124124target_link_libraries(TestRunnerInjectedBundle ${WebKitTestRunner_LIBRARIES})
     125add_dependencies(TestRunnerInjectedBundle WebKitTestRunnerInjectedBundleBindings)
    125126
    126127add_executable(WebKitTestRunner ${WebKitTestRunner_SOURCES})
    127128target_link_libraries(WebKitTestRunner ${WebKitTestRunner_LIBRARIES})
     129add_dependencies(WebKitTestRunner WebKitTestRunnerBindings)
    128130
    129131if (NOT APPLE)
Note: See TracChangeset for help on using the changeset viewer.