Web Inspector: Better handling for large arrays and collections in Object Trees
[WebKit-https.git] / Source / WebCore / WebCoreMacros.cmake
index 7a0561e..93a449f 100644 (file)
@@ -1,47 +1,16 @@
-# Helper macro for using all-in-one builds
-# This macro removes the sources included in the _all_in_one_file from the input _file_list.
-# _file_list is a list of source files
-# _all_in_one_file is an all-in-one cpp file includes other cpp files
-# _result_file_list is the output file list
-macro(PROCESS_ALLINONE_FILE _file_list _all_in_one_file _result_file_list _no_compile)
-    file(STRINGS ${_all_in_one_file} _all_in_one_file_content)
-    set(${_result_file_list} ${_file_list})
-    set(_allins "")
-    foreach (_line ${_all_in_one_file_content})
-        string(REGEX MATCH "^#include [\"<](.*)[\">]" _found ${_line})
-        if (_found)
-            list(APPEND _allins ${CMAKE_MATCH_1})
-        endif ()
-    endforeach ()
-
-    foreach (_allin ${_allins})
-        if (${_no_compile})
-            # For DerivedSources.cpp, we still need the derived sources to be generated, but we do not want them to be compiled
-            # individually. We add the header to the result file list so that CMake knows to keep generating the files.
-            string(REGEX REPLACE "(.*)\\.cpp" "\\1" _allin_no_ext ${_allin})
-            string(REGEX REPLACE ";([^;]*/)${_allin_no_ext}\\.cpp;" ";\\1${_allin_no_ext}.h;" _new_result "${${_result_file_list}};")
-        else ()
-            string(REGEX REPLACE ";[^;]*/${_allin};" ";" _new_result "${${_result_file_list}};")
-        endif ()
-        set(${_result_file_list} ${_new_result})
-    endforeach ()
-
-endmacro()
-
-
 macro(MAKE_HASH_TOOLS _source)
     get_filename_component(_name ${_source} NAME_WE)
 
     if (${_source} STREQUAL "DocTypeStrings")
-        set(_hash_tools_h "${DERIVED_SOURCES_WEBCORE_DIR}/HashTools.h")
+        set(_hash_tools_h "${WebCore_DERIVED_SOURCES_DIR}/HashTools.h")
     else ()
         set(_hash_tools_h "")
     endif ()
 
     add_custom_command(
-        OUTPUT ${DERIVED_SOURCES_WEBCORE_DIR}/${_name}.cpp ${_hash_tools_h}
+        OUTPUT ${WebCore_DERIVED_SOURCES_DIR}/${_name}.cpp ${_hash_tools_h}
         MAIN_DEPENDENCY ${_source}.gperf
-        COMMAND ${PERL_EXECUTABLE} ${WEBCORE_DIR}/make-hash-tools.pl ${DERIVED_SOURCES_WEBCORE_DIR} ${_source}.gperf ${GPERF_EXECUTABLE}
+        COMMAND ${PERL_EXECUTABLE} ${WEBCORE_DIR}/make-hash-tools.pl ${WebCore_DERIVED_SOURCES_DIR} ${_source}.gperf ${GPERF_EXECUTABLE}
         VERBATIM)
 
     unset(_name)
@@ -50,12 +19,12 @@ endmacro()
 
 
 # Append the given dependencies to the source file
-# This one consider the given dependencies are in ${DERIVED_SOURCES_WEBCORE_DIR}
+# This one consider the given dependencies are in ${WebCore_DERIVED_SOURCES_DIR}
 # and prepends this to every member of dependencies list
 macro(ADD_SOURCE_WEBCORE_DERIVED_DEPENDENCIES _source _deps)
     set(_tmp "")
     foreach (f ${_deps})
-        list(APPEND _tmp "${DERIVED_SOURCES_WEBCORE_DIR}/${f}")
+        list(APPEND _tmp "${WebCore_DERIVED_SOURCES_DIR}/${f}")
     endforeach ()
 
     WEBKIT_ADD_SOURCE_DEPENDENCIES(${_source} ${_tmp})
@@ -179,59 +148,57 @@ endfunction()
 macro(GENERATE_FONT_NAMES _infile)
     set(NAMES_GENERATOR ${WEBCORE_DIR}/dom/make_names.pl)
     set(_arguments  --fonts ${_infile})
-    set(_outputfiles ${DERIVED_SOURCES_WEBCORE_DIR}/WebKitFontFamilyNames.cpp ${DERIVED_SOURCES_WEBCORE_DIR}/WebKitFontFamilyNames.h)
+    set(_outputfiles ${WebCore_DERIVED_SOURCES_DIR}/WebKitFontFamilyNames.cpp ${WebCore_DERIVED_SOURCES_DIR}/WebKitFontFamilyNames.h)
 
     add_custom_command(
         OUTPUT  ${_outputfiles}
         MAIN_DEPENDENCY ${_infile}
         DEPENDS ${MAKE_NAMES_DEPENDENCIES} ${NAMES_GENERATOR} ${SCRIPTS_BINDINGS}
-        COMMAND ${PERL_EXECUTABLE} ${NAMES_GENERATOR} --outputDir ${DERIVED_SOURCES_WEBCORE_DIR} ${_arguments}
+        COMMAND ${PERL_EXECUTABLE} ${NAMES_GENERATOR} --outputDir ${WebCore_DERIVED_SOURCES_DIR} ${_arguments}
         VERBATIM)
 endmacro()
 
 
-macro(GENERATE_EVENT_FACTORY _infile _outfile)
+macro(GENERATE_EVENT_FACTORY _infile _namespace)
     set(NAMES_GENERATOR ${WEBCORE_DIR}/dom/make_event_factory.pl)
+    set(_outputfiles ${WebCore_DERIVED_SOURCES_DIR}/${_namespace}Interfaces.h ${WebCore_DERIVED_SOURCES_DIR}/${_namespace}Factory.cpp)
 
     add_custom_command(
-        OUTPUT  ${DERIVED_SOURCES_WEBCORE_DIR}/${_outfile}
+        OUTPUT  ${_outputfiles}
         MAIN_DEPENDENCY ${_infile}
         DEPENDS ${NAMES_GENERATOR} ${SCRIPTS_BINDINGS}
-        COMMAND ${PERL_EXECUTABLE} ${NAMES_GENERATOR} --input ${_infile} --outputDir ${DERIVED_SOURCES_WEBCORE_DIR}
+        COMMAND ${PERL_EXECUTABLE} ${NAMES_GENERATOR} --input ${_infile} --outputDir ${WebCore_DERIVED_SOURCES_DIR}
         VERBATIM)
 endmacro()
 
 
 macro(GENERATE_SETTINGS_MACROS _infile _outfile)
-    set(NAMES_GENERATOR ${WEBCORE_DIR}/Scripts/GenerateSettings.py)
+    set(NAMES_GENERATOR ${WEBCORE_DIR}/Scripts/GenerateSettings.rb)
 
     # Do not list the output in more than one independent target that may
     # build in parallel or the two instances of the rule may conflict.
     # <https://cmake.org/cmake/help/v3.0/command/add_custom_command.html>
     set(_extra_output
-        ${DERIVED_SOURCES_WEBCORE_DIR}/SettingsGenerated.cpp
-        ${DERIVED_SOURCES_WEBCORE_DIR}/InternalSettingsGenerated.h
-        ${DERIVED_SOURCES_WEBCORE_DIR}/InternalSettingsGenerated.cpp
-        ${DERIVED_SOURCES_WEBCORE_DIR}/InternalSettingsGenerated.idl
+        ${WebCore_DERIVED_SOURCES_DIR}/Settings.cpp
+        ${WebCore_DERIVED_SOURCES_DIR}/InternalSettingsGenerated.h
+        ${WebCore_DERIVED_SOURCES_DIR}/InternalSettingsGenerated.cpp
+        ${WebCore_DERIVED_SOURCES_DIR}/InternalSettingsGenerated.idl
     )
 
     set(GENERATE_SETTINGS_SCRIPTS
-        ${WEBCORE_DIR}/Scripts/GenerateSettings/GenerateInternalSettingsHeaderFile.py
-        ${WEBCORE_DIR}/Scripts/GenerateSettings/GenerateInternalSettingsIDLFile.py
-        ${WEBCORE_DIR}/Scripts/GenerateSettings/GenerateInternalSettingsImplementationFile.py
-        ${WEBCORE_DIR}/Scripts/GenerateSettings/GenerateSettingsHeaderFile.py
-        ${WEBCORE_DIR}/Scripts/GenerateSettings/GenerateSettingsImplementationFile.py
-        ${WEBCORE_DIR}/Scripts/GenerateSettings/GenerateSettings.py
-        ${WEBCORE_DIR}/Scripts/GenerateSettings/Settings.py
-        ${WEBCORE_DIR}/Scripts/GenerateSettings/__init__.py
+        ${WEBCORE_DIR}/Scripts/SettingsTemplates/InternalSettingsGenerated.cpp.erb
+        ${WEBCORE_DIR}/Scripts/SettingsTemplates/InternalSettingsGenerated.idl.erb
+        ${WEBCORE_DIR}/Scripts/SettingsTemplates/InternalSettingsGenerated.h.erb
+        ${WEBCORE_DIR}/Scripts/SettingsTemplates/Settings.cpp.erb
+        ${WEBCORE_DIR}/Scripts/SettingsTemplates/Settings.h.erb
     )
 
     set(_args BYPRODUCTS ${_extra_output})
     add_custom_command(
-        OUTPUT ${DERIVED_SOURCES_WEBCORE_DIR}/${_outfile}
+        OUTPUT ${WebCore_DERIVED_SOURCES_DIR}/${_outfile}
         MAIN_DEPENDENCY ${_infile}
         DEPENDS ${NAMES_GENERATOR} ${GENERATE_SETTINGS_SCRIPTS} ${SCRIPTS_BINDINGS}
-        COMMAND ${PYTHON_EXECUTABLE} ${NAMES_GENERATOR} --input ${_infile} --outputDir ${DERIVED_SOURCES_WEBCORE_DIR}
+        COMMAND ${RUBY_EXECUTABLE} ${NAMES_GENERATOR} --input ${_infile} --outputDir ${WebCore_DERIVED_SOURCES_DIR}
         VERBATIM ${_args})
 endmacro()
 
@@ -239,7 +206,7 @@ endmacro()
 macro(GENERATE_DOM_NAMES _namespace _attrs)
     set(NAMES_GENERATOR ${WEBCORE_DIR}/dom/make_names.pl)
     set(_arguments  --attrs ${_attrs})
-    set(_outputfiles ${DERIVED_SOURCES_WEBCORE_DIR}/${_namespace}Names.cpp ${DERIVED_SOURCES_WEBCORE_DIR}/${_namespace}Names.h)
+    set(_outputfiles ${WebCore_DERIVED_SOURCES_DIR}/${_namespace}Names.cpp ${WebCore_DERIVED_SOURCES_DIR}/${_namespace}Names.h)
     set(_extradef)
     set(_tags)
 
@@ -253,7 +220,7 @@ macro(GENERATE_DOM_NAMES _namespace _attrs)
 
     if (_tags)
         set(_arguments "${_arguments}" --tags ${_tags} --factory --wrapperFactory)
-        set(_outputfiles "${_outputfiles}" ${DERIVED_SOURCES_WEBCORE_DIR}/${_namespace}ElementFactory.cpp ${DERIVED_SOURCES_WEBCORE_DIR}/${_namespace}ElementFactory.h ${DERIVED_SOURCES_WEBCORE_DIR}/JS${_namespace}ElementWrapperFactory.cpp ${DERIVED_SOURCES_WEBCORE_DIR}/JS${_namespace}ElementWrapperFactory.h)
+        set(_outputfiles "${_outputfiles}" ${WebCore_DERIVED_SOURCES_DIR}/${_namespace}ElementFactory.cpp ${WebCore_DERIVED_SOURCES_DIR}/${_namespace}ElementFactory.h ${WebCore_DERIVED_SOURCES_DIR}/${_namespace}ElementTypeHelpers.h ${WebCore_DERIVED_SOURCES_DIR}/JS${_namespace}ElementWrapperFactory.cpp ${WebCore_DERIVED_SOURCES_DIR}/JS${_namespace}ElementWrapperFactory.h)
     endif ()
 
     if (_extradef)
@@ -263,6 +230,6 @@ macro(GENERATE_DOM_NAMES _namespace _attrs)
     add_custom_command(
         OUTPUT  ${_outputfiles}
         DEPENDS ${MAKE_NAMES_DEPENDENCIES} ${NAMES_GENERATOR} ${SCRIPTS_BINDINGS} ${_attrs} ${_tags}
-        COMMAND ${PERL_EXECUTABLE} ${NAMES_GENERATOR} --preprocessor "${CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS}" --outputDir ${DERIVED_SOURCES_WEBCORE_DIR} ${_arguments} ${_additionArguments}
+        COMMAND ${PERL_EXECUTABLE} ${NAMES_GENERATOR} --preprocessor "${CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS}" --outputDir ${WebCore_DERIVED_SOURCES_DIR} ${_arguments} ${_additionArguments}
         VERBATIM)
 endmacro()