[GTK][CMAKE] gtk-doc HTML documentation is generated by default when building with...
[WebKit-https.git] / Source / PlatformGTK.cmake
1 add_subdirectory(${WEBCORE_DIR}/platform/gtk/po)
2
3 # This allows exposing a 'gir' target which builds all GObject introspection files.
4 add_custom_target(gir ALL DEPENDS ${GObjectIntrospectionTargets})
5
6 set(DocumentationDependencies
7     "${CMAKE_SOURCE_DIR}/Source/WebKit/gtk/docs/webkitenvironment.xml"
8 )
9
10 if (ENABLE_WEBKIT)
11     list(APPEND DocumentationDependencies
12         WebKit
13         "${CMAKE_SOURCE_DIR}/Source/WebKit/gtk/docs/webkitgtk-docs.sgml"
14         "${CMAKE_SOURCE_DIR}/Source/WebKit/gtk/docs/webkitgtk-sections.txt"
15     )
16     install(DIRECTORY ${CMAKE_BINARY_DIR}/Documentation/webkitgtk/html/
17             DESTINATION ${CMAKE_INSTALL_DATADIR}/gtk-doc/html/webkitgtk
18     )
19 endif ()
20
21 if (ENABLE_WEBKIT2)
22     list(APPEND DocumentationDependencies
23         WebKit2
24         "${CMAKE_SOURCE_DIR}/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml"
25         "${CMAKE_SOURCE_DIR}/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt"
26     )
27     install(DIRECTORY ${CMAKE_BINARY_DIR}/Documentation/webkit2gtk/html/
28             DESTINATION ${CMAKE_INSTALL_DATADIR}/gtk-doc/html/webkit2gtk
29     )
30 endif ()
31
32 macro(ADD_GTKDOC_GENERATOR _stamp_name _extra_args)
33     add_custom_command(
34         OUTPUT "${CMAKE_BINARY_DIR}/${_stamp_name}"
35         DEPENDS ${DocumentationDependencies}
36         COMMAND CC="${CMAKE_C_COMPILER}" ${CMAKE_SOURCE_DIR}/Tools/gtk/generate-gtkdoc ${_extra_args}
37         COMMAND touch ${_stamp_name}
38         WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
39     )
40 endmacro()
41
42 add_gtkdoc_generator("docs-build-no-html.stamp" "--skip-html")
43 add_custom_target(gtkdoc-no-html ALL
44     DEPENDS "${CMAKE_BINARY_DIR}/docs-build-no-html.stamp"
45 )
46
47 add_gtkdoc_generator("docs-build.stamp" "")
48 add_custom_target(gtkdoc
49     DEPENDS "${CMAKE_BINARY_DIR}/docs-build.stamp"
50 )
51
52 add_custom_target(check
53     COMMAND ${TOOLS_DIR}/Scripts/run-gtk-tests
54     COMMAND ${TOOLS_DIR}/gtk/check-for-webkitdom-api-breaks
55 )
56
57 if (ENABLE_WEBKIT AND ENABLE_WEBKIT2)
58     add_custom_command(
59         OUTPUT ${CMAKE_BINARY_DIR}/webkitgtk-${PROJECT_VERSION}.tar
60         DEPENDS ${TOOLS_DIR}/gtk/make-dist.py
61         DEPENDS ${TOOLS_DIR}/gtk/manifest.txt
62         DEPENDS WebKit
63         DEPENDS WebKit2
64         DEPENDS gtkdoc
65         COMMAND ${TOOLS_DIR}/gtk/make-dist.py
66                 --source-dir=${CMAKE_SOURCE_DIR}
67                 --build-dir=${CMAKE_BINARY_DIR}
68                 --tarball-root=/webkitgtk-${PROJECT_VERSION}
69                 -o ${CMAKE_BINARY_DIR}/webkitgtk-${PROJECT_VERSION}.tar
70                 ${TOOLS_DIR}/gtk/manifest.txt
71     )
72
73     add_custom_command(
74         OUTPUT ${CMAKE_BINARY_DIR}/webkitgtk-${PROJECT_VERSION}.tar.xz
75         DEPENDS ${CMAKE_BINARY_DIR}/webkitgtk-${PROJECT_VERSION}.tar
76         COMMAND xz -f ${CMAKE_BINARY_DIR}/webkitgtk-${PROJECT_VERSION}.tar
77     )
78
79     add_custom_target(dist
80         DEPENDS ${CMAKE_BINARY_DIR}/webkitgtk-${PROJECT_VERSION}.tar.xz
81     )
82 endif ()