Unreviewed, reverting r260672.
[WebKit.git] / Source / WebKit / InspectorGResources.cmake
1 macro(WEBKIT_BUILD_INSPECTOR_GRESOURCES _derived_sources_dir)
2     set(InspectorFiles
3         ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/*.html
4         ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Base/*.js
5         ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Controllers/*.css
6         ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Controllers/*.js
7         ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Debug/*.css
8         ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Debug/*.js
9         ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/External/CodeMirror/*.css
10         ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/External/CodeMirror/*.js
11         ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/External/Esprima/*.js
12         ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/External/three.js/*.js
13         ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Models/*.js
14         ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Protocol/*.js
15         ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Proxies/*.js
16         ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Test/*.js
17         ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Views/*.css
18         ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Views/*.js
19         ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Workers/Formatter/*.js
20         ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Workers/HeapSnapshot/*.js
21         ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Images/*.png
22         ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/UserInterface/Images/*.svg
23         ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
24     )
25
26     file(GLOB InspectorFilesDependencies
27         ${InspectorFiles}
28     )
29
30     set(InspectorResourceScripts
31         ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/Scripts/combine-resources.pl
32         ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/Scripts/copy-user-interface-resources.pl
33         ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/Scripts/fix-worker-imports-for-optimized-builds.pl
34         ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/Scripts/remove-console-asserts.pl
35         ${JavaScriptCore_SCRIPTS_DIR}/cssmin.py
36         ${JavaScriptCore_SCRIPTS_DIR}/jsmin.py
37     )
38
39     # DerivedSources/JavaScriptCore/inspector/InspectorBackendCommands.js is
40     # expected in DerivedSources/WebInspectorUI/UserInterface/Protocol/.
41     add_custom_command(
42         OUTPUT ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/UserInterface/Protocol/InspectorBackendCommands.js
43         DEPENDS ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector/InspectorBackendCommands.js
44         COMMAND cp ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector/InspectorBackendCommands.js ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/UserInterface/Protocol/InspectorBackendCommands.js
45         VERBATIM
46     )
47
48     if (NOT DEFINED COMBINE_INSPECTOR_RESOURCES)
49         if (CMAKE_BUILD_TYPE STREQUAL "Debug")
50             set(COMBINE_INSPECTOR_RESOURCES NO)
51         else ()
52             set(COMBINE_INSPECTOR_RESOURCES YES)
53         endif ()
54     endif ()
55     if (NOT DEFINED COMBINE_TEST_RESOURCES)
56         if (CMAKE_BUILD_TYPE STREQUAL "Debug" OR DEVELOPER_MODE)
57             set(COMBINE_TEST_RESOURCES YES)
58         else ()
59             set(COMBINE_TEST_RESOURCES NO)
60         endif ()
61     endif ()
62
63     add_custom_command(
64         OUTPUT ${CMAKE_BINARY_DIR}/inspector-resources.stamp
65         DEPENDS ${InspectorFilesDependencies}
66                 ${InspectorResourceScripts}
67                 ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/UserInterface/Protocol/InspectorBackendCommands.js
68         COMMAND cp ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/UserInterface/Protocol/InspectorBackendCommands.js ${FORWARDING_HEADERS_DIR}/JavaScriptCore/Scripts
69         COMMAND ${CMAKE_COMMAND} -E env "DERIVED_SOURCES_DIR=${DERIVED_SOURCES_WEBINSPECTORUI_DIR}" "SRCROOT=${CMAKE_SOURCE_DIR}/Source/WebInspectorUI" "JAVASCRIPTCORE_PRIVATE_HEADERS_DIR=${FORWARDING_HEADERS_DIR}/JavaScriptCore/Scripts" "TARGET_BUILD_DIR=${_derived_sources_dir}/InspectorResources" "UNLOCALIZED_RESOURCES_FOLDER_PATH=WebInspectorUI" "COMBINE_INSPECTOR_RESOURCES=${COMBINE_INSPECTOR_RESOURCES}" "COMBINE_TEST_RESOURCES=${COMBINE_TEST_RESOURCES}" PYTHON=${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/Scripts/copy-user-interface-resources.pl
70         COMMAND mkdir -p ${_derived_sources_dir}/InspectorResources/WebInspectorUI/Localizations/en.lproj
71         COMMAND cp ${CMAKE_SOURCE_DIR}/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js ${_derived_sources_dir}/InspectorResources/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
72         COMMAND touch ${CMAKE_BINARY_DIR}/inspector-resources.stamp
73         VERBATIM
74     )
75
76     add_custom_command(
77         OUTPUT ${_derived_sources_dir}/InspectorGResourceBundle.xml
78         DEPENDS ${CMAKE_BINARY_DIR}/inspector-resources.stamp
79                 ${TOOLS_DIR}/glib/generate-inspector-gresource-manifest.py
80         COMMAND ${PYTHON_EXECUTABLE} ${TOOLS_DIR}/glib/generate-inspector-gresource-manifest.py --input=${_derived_sources_dir}/InspectorResources --output=${_derived_sources_dir}/InspectorGResourceBundle.xml
81         VERBATIM
82     )
83
84     add_custom_command(
85         OUTPUT ${_derived_sources_dir}/InspectorGResourceBundle.c
86         DEPENDS ${_derived_sources_dir}/InspectorGResourceBundle.xml
87         COMMAND glib-compile-resources --generate --sourcedir=${_derived_sources_dir}/InspectorResources/WebInspectorUI --target=${_derived_sources_dir}/InspectorGResourceBundle.c ${_derived_sources_dir}/InspectorGResourceBundle.xml
88         VERBATIM
89     )
90 endmacro()