1 | macro(MAKE_HASH_TOOLS _source)
|
---|
2 | get_filename_component(_name ${_source} NAME_WE)
|
---|
3 |
|
---|
4 | if (${_source} STREQUAL "DocTypeStrings")
|
---|
5 | set(_hash_tools_h "${WebCore_DERIVED_SOURCES_DIR}/HashTools.h")
|
---|
6 | else ()
|
---|
7 | set(_hash_tools_h "")
|
---|
8 | endif ()
|
---|
9 |
|
---|
10 | add_custom_command(
|
---|
11 | OUTPUT ${WebCore_DERIVED_SOURCES_DIR}/${_name}.cpp ${_hash_tools_h}
|
---|
12 | MAIN_DEPENDENCY ${_source}.gperf
|
---|
13 | COMMAND ${PERL_EXECUTABLE} ${WEBCORE_DIR}/make-hash-tools.pl ${WebCore_DERIVED_SOURCES_DIR} ${_source}.gperf ${GPERF_EXECUTABLE}
|
---|
14 | VERBATIM)
|
---|
15 |
|
---|
16 | unset(_name)
|
---|
17 | unset(_hash_tools_h)
|
---|
18 | endmacro()
|
---|
19 |
|
---|
20 |
|
---|
21 | # Append the given dependencies to the source file
|
---|
22 | # This one consider the given dependencies are in ${WebCore_DERIVED_SOURCES_DIR}
|
---|
23 | # and prepends this to every member of dependencies list
|
---|
24 | macro(ADD_SOURCE_WEBCORE_DERIVED_DEPENDENCIES _source _deps)
|
---|
25 | set(_tmp "")
|
---|
26 | foreach (f ${_deps})
|
---|
27 | list(APPEND _tmp "${WebCore_DERIVED_SOURCES_DIR}/${f}")
|
---|
28 | endforeach ()
|
---|
29 |
|
---|
30 | WEBKIT_ADD_SOURCE_DEPENDENCIES(${_source} ${_tmp})
|
---|
31 | unset(_tmp)
|
---|
32 | endmacro()
|
---|
33 |
|
---|
34 |
|
---|
35 | macro(MAKE_JS_FILE_ARRAYS _output_cpp _output_h _namespace _scripts _scripts_dependencies)
|
---|
36 | add_custom_command(
|
---|
37 | OUTPUT ${_output_h} ${_output_cpp}
|
---|
38 | DEPENDS ${JavaScriptCore_SCRIPTS_DIR}/make-js-file-arrays.py ${${_scripts}}
|
---|
39 | COMMAND ${PYTHON_EXECUTABLE} ${JavaScriptCore_SCRIPTS_DIR}/make-js-file-arrays.py --fail-if-non-ascii -n ${_namespace} ${_output_h} ${_output_cpp} ${${_scripts}}
|
---|
40 | VERBATIM)
|
---|
41 | WEBKIT_ADD_SOURCE_DEPENDENCIES(${${_scripts_dependencies}} ${_output_h} ${_output_cpp})
|
---|
42 | endmacro()
|
---|
43 |
|
---|
44 |
|
---|
45 | option(SHOW_BINDINGS_GENERATION_PROGRESS "Show progress of generating bindings" OFF)
|
---|
46 |
|
---|
47 | # Helper macro which wraps generate-bindings-all.pl script.
|
---|
48 | # target is a new target name to be added
|
---|
49 | # OUTPUT_SOURCE is a list name which will contain generated sources.(eg. WebCore_SOURCES)
|
---|
50 | # INPUT_FILES are IDL files to generate.
|
---|
51 | # PP_INPUT_FILES are IDL files to preprocess.
|
---|
52 | # BASE_DIR is base directory where script is called.
|
---|
53 | # IDL_INCLUDES is value of --include argument. (eg. ${WEBCORE_DIR}/bindings/js)
|
---|
54 | # FEATURES is a value of --defines argument.
|
---|
55 | # DESTINATION is a value of --outputDir argument.
|
---|
56 | # GENERATOR is a value of --generator argument.
|
---|
57 | # SUPPLEMENTAL_DEPFILE is a value of --supplementalDependencyFile. (optional)
|
---|
58 | # PP_EXTRA_OUTPUT is extra outputs of preprocess-idls.pl. (optional)
|
---|
59 | # PP_EXTRA_ARGS is extra arguments for preprocess-idls.pl. (optional)
|
---|
60 | function(GENERATE_BINDINGS target)
|
---|
61 | set(options)
|
---|
62 | set(oneValueArgs OUTPUT_SOURCE BASE_DIR FEATURES DESTINATION GENERATOR SUPPLEMENTAL_DEPFILE)
|
---|
63 | set(multiValueArgs INPUT_FILES PP_INPUT_FILES IDL_INCLUDES PP_EXTRA_OUTPUT PP_EXTRA_ARGS)
|
---|
64 | cmake_parse_arguments(arg "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
---|
65 | set(binding_generator ${WEBCORE_DIR}/bindings/scripts/generate-bindings-all.pl)
|
---|
66 | set(idl_attributes_file ${WEBCORE_DIR}/bindings/scripts/IDLAttributes.json)
|
---|
67 | set(idl_files_list ${CMAKE_CURRENT_BINARY_DIR}/idl_files_${target}.tmp)
|
---|
68 | set(pp_idl_files_list ${CMAKE_CURRENT_BINARY_DIR}/pp_idl_files_${target}.tmp)
|
---|
69 | set(_supplemental_dependency)
|
---|
70 |
|
---|
71 | set(content)
|
---|
72 | foreach (f ${arg_INPUT_FILES})
|
---|
73 | if (NOT IS_ABSOLUTE ${f})
|
---|
74 | set(f ${CMAKE_CURRENT_SOURCE_DIR}/${f})
|
---|
75 | endif ()
|
---|
76 | set(content "${content}${f}\n")
|
---|
77 | endforeach ()
|
---|
78 | file(WRITE ${idl_files_list} ${content})
|
---|
79 |
|
---|
80 | set(pp_content)
|
---|
81 | foreach (f ${arg_PP_INPUT_FILES})
|
---|
82 | if (NOT IS_ABSOLUTE ${f})
|
---|
83 | set(f ${CMAKE_CURRENT_SOURCE_DIR}/${f})
|
---|
84 | endif ()
|
---|
85 | set(pp_content "${pp_content}${f}\n")
|
---|
86 | endforeach ()
|
---|
87 | file(WRITE ${pp_idl_files_list} ${pp_content})
|
---|
88 |
|
---|
89 | set(args
|
---|
90 | --defines ${arg_FEATURES}
|
---|
91 | --generator ${arg_GENERATOR}
|
---|
92 | --outputDir ${arg_DESTINATION}
|
---|
93 | --idlFilesList ${idl_files_list}
|
---|
94 | --ppIDLFilesList ${pp_idl_files_list}
|
---|
95 | --preprocessor "${CODE_GENERATOR_PREPROCESSOR}"
|
---|
96 | --idlAttributesFile ${idl_attributes_file}
|
---|
97 | )
|
---|
98 | if (arg_SUPPLEMENTAL_DEPFILE)
|
---|
99 | list(APPEND args --supplementalDependencyFile ${arg_SUPPLEMENTAL_DEPFILE})
|
---|
100 | endif ()
|
---|
101 | ProcessorCount(PROCESSOR_COUNT)
|
---|
102 | if (PROCESSOR_COUNT)
|
---|
103 | list(APPEND args --numOfJobs ${PROCESSOR_COUNT})
|
---|
104 | endif ()
|
---|
105 | foreach (i IN LISTS arg_IDL_INCLUDES)
|
---|
106 | if (IS_ABSOLUTE ${i})
|
---|
107 | list(APPEND args --include ${i})
|
---|
108 | else ()
|
---|
109 | list(APPEND args --include ${CMAKE_CURRENT_SOURCE_DIR}/${i})
|
---|
110 | endif ()
|
---|
111 | endforeach ()
|
---|
112 | foreach (i IN LISTS arg_PP_EXTRA_OUTPUT)
|
---|
113 | list(APPEND args --ppExtraOutput ${i})
|
---|
114 | endforeach ()
|
---|
115 | foreach (i IN LISTS arg_PP_EXTRA_ARGS)
|
---|
116 | list(APPEND args --ppExtraArgs ${i})
|
---|
117 | endforeach ()
|
---|
118 |
|
---|
119 | set(common_generator_dependencies
|
---|
120 | ${WEBCORE_DIR}/bindings/scripts/generate-bindings.pl
|
---|
121 | ${SCRIPTS_BINDINGS}
|
---|
122 | # Changing enabled features should trigger recompiling all IDL files
|
---|
123 | # because some of them use #if.
|
---|
124 | ${CMAKE_BINARY_DIR}/cmakeconfig.h
|
---|
125 | )
|
---|
126 | if (EXISTS ${WEBCORE_DIR}/bindings/scripts/CodeGenerator${arg_GENERATOR}.pm)
|
---|
127 | list(APPEND common_generator_dependencies ${WEBCORE_DIR}/bindings/scripts/CodeGenerator${arg_GENERATOR}.pm)
|
---|
128 | endif ()
|
---|
129 | if (EXISTS ${arg_BASE_DIR}/CodeGenerator${arg_GENERATOR}.pm)
|
---|
130 | list(APPEND common_generator_dependencies ${arg_BASE_DIR}/CodeGenerator${arg_GENERATOR}.pm)
|
---|
131 | endif ()
|
---|
132 | foreach (i IN LISTS common_generator_dependencies)
|
---|
133 | list(APPEND args --generatorDependency ${i})
|
---|
134 | endforeach ()
|
---|
135 |
|
---|
136 | set(gen_sources)
|
---|
137 | set(gen_headers)
|
---|
138 | foreach (_file ${arg_INPUT_FILES})
|
---|
139 | get_filename_component(_name ${_file} NAME_WE)
|
---|
140 | list(APPEND gen_sources ${arg_DESTINATION}/JS${_name}.cpp)
|
---|
141 | list(APPEND gen_headers ${arg_DESTINATION}/JS${_name}.h)
|
---|
142 | endforeach ()
|
---|
143 | set(${arg_OUTPUT_SOURCE} ${${arg_OUTPUT_SOURCE}} ${gen_sources} PARENT_SCOPE)
|
---|
144 | set(act_args)
|
---|
145 | if (SHOW_BINDINGS_GENERATION_PROGRESS)
|
---|
146 | list(APPEND args --showProgress)
|
---|
147 | endif ()
|
---|
148 | list(APPEND act_args BYPRODUCTS ${gen_sources} ${gen_headers})
|
---|
149 | if (SHOW_BINDINGS_GENERATION_PROGRESS)
|
---|
150 | list(APPEND act_args USES_TERMINAL)
|
---|
151 | endif ()
|
---|
152 | add_custom_target(${target}
|
---|
153 | COMMAND ${PERL_EXECUTABLE} ${binding_generator} ${args}
|
---|
154 | DEPENDS ${arg_INPUT_FILES} ${arg_PP_INPUT_FILES}
|
---|
155 | WORKING_DIRECTORY ${arg_BASE_DIR}
|
---|
156 | COMMENT "Generate bindings (${target})"
|
---|
157 | VERBATIM ${act_args})
|
---|
158 | endfunction()
|
---|
159 |
|
---|
160 |
|
---|
161 | macro(GENERATE_FONT_NAMES _infile)
|
---|
162 | set(NAMES_GENERATOR ${WEBCORE_DIR}/dom/make_names.pl)
|
---|
163 | set(_arguments --fonts ${_infile})
|
---|
164 | set(_outputfiles ${WebCore_DERIVED_SOURCES_DIR}/WebKitFontFamilyNames.cpp ${WebCore_DERIVED_SOURCES_DIR}/WebKitFontFamilyNames.h)
|
---|
165 |
|
---|
166 | add_custom_command(
|
---|
167 | OUTPUT ${_outputfiles}
|
---|
168 | MAIN_DEPENDENCY ${_infile}
|
---|
169 | DEPENDS ${MAKE_NAMES_DEPENDENCIES} ${NAMES_GENERATOR} ${SCRIPTS_BINDINGS}
|
---|
170 | COMMAND ${PERL_EXECUTABLE} ${NAMES_GENERATOR} --outputDir ${WebCore_DERIVED_SOURCES_DIR} ${_arguments}
|
---|
171 | VERBATIM)
|
---|
172 | endmacro()
|
---|
173 |
|
---|
174 |
|
---|
175 | macro(GENERATE_EVENT_FACTORY _infile _namespace)
|
---|
176 | set(NAMES_GENERATOR ${WEBCORE_DIR}/dom/make_event_factory.pl)
|
---|
177 | set(_outputfiles ${WebCore_DERIVED_SOURCES_DIR}/${_namespace}Interfaces.h ${WebCore_DERIVED_SOURCES_DIR}/${_namespace}Factory.cpp)
|
---|
178 |
|
---|
179 | add_custom_command(
|
---|
180 | OUTPUT ${_outputfiles}
|
---|
181 | MAIN_DEPENDENCY ${_infile}
|
---|
182 | DEPENDS ${NAMES_GENERATOR} ${SCRIPTS_BINDINGS}
|
---|
183 | COMMAND ${PERL_EXECUTABLE} ${NAMES_GENERATOR} --input ${_infile} --outputDir ${WebCore_DERIVED_SOURCES_DIR}
|
---|
184 | VERBATIM)
|
---|
185 | endmacro()
|
---|
186 |
|
---|
187 |
|
---|
188 | macro(GENERATE_SETTINGS_MACROS _infile _outfile)
|
---|
189 | set(NAMES_GENERATOR ${WEBCORE_DIR}/Scripts/GenerateSettings.rb)
|
---|
190 |
|
---|
191 | set(_extra_output
|
---|
192 | ${WebCore_DERIVED_SOURCES_DIR}/Settings.cpp
|
---|
193 | ${WebCore_DERIVED_SOURCES_DIR}/InternalSettingsGenerated.h
|
---|
194 | ${WebCore_DERIVED_SOURCES_DIR}/InternalSettingsGenerated.cpp
|
---|
195 | ${WebCore_DERIVED_SOURCES_DIR}/InternalSettingsGenerated.idl
|
---|
196 | )
|
---|
197 |
|
---|
198 | set(GENERATE_SETTINGS_SCRIPTS
|
---|
199 | ${WEBCORE_DIR}/Scripts/SettingsTemplates/InternalSettingsGenerated.cpp.erb
|
---|
200 | ${WEBCORE_DIR}/Scripts/SettingsTemplates/InternalSettingsGenerated.idl.erb
|
---|
201 | ${WEBCORE_DIR}/Scripts/SettingsTemplates/InternalSettingsGenerated.h.erb
|
---|
202 | ${WEBCORE_DIR}/Scripts/SettingsTemplates/Settings.cpp.erb
|
---|
203 | ${WEBCORE_DIR}/Scripts/SettingsTemplates/Settings.h.erb
|
---|
204 | )
|
---|
205 |
|
---|
206 | set(WTF_WEB_PREFERENCES
|
---|
207 | ${WTF_SCRIPTS_DIR}/Preferences/WebPreferences.yaml
|
---|
208 | ${WTF_SCRIPTS_DIR}/Preferences/WebPreferencesDebug.yaml
|
---|
209 | ${WTF_SCRIPTS_DIR}/Preferences/WebPreferencesExperimental.yaml
|
---|
210 | ${WTF_SCRIPTS_DIR}/Preferences/WebPreferencesInternal.yaml
|
---|
211 | )
|
---|
212 |
|
---|
213 | set_source_files_properties(${WTF_WEB_PREFERENCES} PROPERTIES GENERATED TRUE)
|
---|
214 |
|
---|
215 | add_custom_command(
|
---|
216 | OUTPUT ${WebCore_DERIVED_SOURCES_DIR}/${_outfile} ${_extra_output}
|
---|
217 | MAIN_DEPENDENCY ${_infile}
|
---|
218 | DEPENDS ${NAMES_GENERATOR} ${GENERATE_SETTINGS_SCRIPTS} ${SCRIPTS_BINDINGS} ${WTF_WEB_PREFERENCES} WTF_CopyPreferences
|
---|
219 | COMMAND ${RUBY_EXECUTABLE} ${NAMES_GENERATOR} --additionalSettings ${_infile} --base ${WTF_SCRIPTS_DIR}/Preferences/WebPreferences.yaml --debug ${WTF_SCRIPTS_DIR}/Preferences/WebPreferencesDebug.yaml --experimental ${WTF_SCRIPTS_DIR}/Preferences/WebPreferencesExperimental.yaml --internal ${WTF_SCRIPTS_DIR}/Preferences/WebPreferencesInternal.yaml --outputDir ${WebCore_DERIVED_SOURCES_DIR} --template ${WEBCORE_DIR}/Scripts/SettingsTemplates/InternalSettingsGenerated.cpp.erb --template ${WEBCORE_DIR}/Scripts/SettingsTemplates/InternalSettingsGenerated.idl.erb --template ${WEBCORE_DIR}/Scripts/SettingsTemplates/InternalSettingsGenerated.h.erb --template ${WEBCORE_DIR}/Scripts/SettingsTemplates/Settings.cpp.erb --template ${WEBCORE_DIR}/Scripts/SettingsTemplates/Settings.h.erb
|
---|
220 | VERBATIM ${_args})
|
---|
221 | endmacro()
|
---|
222 |
|
---|
223 |
|
---|
224 | function(GENERATE_DOM_NAMES _namespace _attrs)
|
---|
225 | if (ARGN)
|
---|
226 | list(GET ARGN 0 _tags)
|
---|
227 | list(REMOVE_AT ARGN 0)
|
---|
228 | endif ()
|
---|
229 | set(NAMES_GENERATOR ${WEBCORE_DIR}/dom/make_names.pl)
|
---|
230 | set(_arguments --attrs ${_attrs})
|
---|
231 | set(_outputfiles ${WebCore_DERIVED_SOURCES_DIR}/${_namespace}Names.cpp ${WebCore_DERIVED_SOURCES_DIR}/${_namespace}Names.h)
|
---|
232 |
|
---|
233 | if (_tags)
|
---|
234 | set(_arguments "${_arguments}" --tags ${_tags} --factory --wrapperFactory)
|
---|
235 | 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)
|
---|
236 | endif ()
|
---|
237 |
|
---|
238 | add_custom_command(
|
---|
239 | OUTPUT ${_outputfiles}
|
---|
240 | DEPENDS ${MAKE_NAMES_DEPENDENCIES} ${NAMES_GENERATOR} ${SCRIPTS_BINDINGS} ${_attrs} ${_tags}
|
---|
241 | COMMAND ${PERL_EXECUTABLE} ${NAMES_GENERATOR} --outputDir ${WebCore_DERIVED_SOURCES_DIR} ${_arguments} ${_additionArguments}
|
---|
242 | VERBATIM)
|
---|
243 | endfunction()
|
---|