[CMake] Add support for building with various sanitizer tools
[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 if (ENABLE_INTROSPECTION)
5     add_custom_target(gir ALL DEPENDS ${GObjectIntrospectionTargets})
6 endif ()
7
8 list(APPEND DocumentationDependencies
9     GObjectDOMBindings
10     WebKit2
11     "${CMAKE_SOURCE_DIR}/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml"
12     "${CMAKE_SOURCE_DIR}/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-${WEBKITGTK_API_VERSION}-sections.txt"
13 )
14
15 if (ENABLE_GTKDOC)
16     install(DIRECTORY ${CMAKE_BINARY_DIR}/Documentation/webkit2gtk-${WEBKITGTK_API_VERSION}/html/
17             DESTINATION "${CMAKE_INSTALL_DATADIR}/gtk-doc/html/webkit2gtk-${WEBKITGTK_API_VERSION}"
18     )
19     install(DIRECTORY ${CMAKE_BINARY_DIR}/Documentation/webkitdomgtk-${WEBKITGTK_API_VERSION}/html/
20             DESTINATION "${CMAKE_INSTALL_DATADIR}/gtk-doc/html/webkitdomgtk-${WEBKITGTK_API_VERSION}"
21     )
22 endif ()
23
24 macro(ADD_GTKDOC_GENERATOR _stamp_name _extra_args)
25     add_custom_command(
26         OUTPUT "${CMAKE_BINARY_DIR}/${_stamp_name}"
27         DEPENDS ${DocumentationDependencies}
28         COMMAND CC=${CMAKE_C_COMPILER} CFLAGS=${CMAKE_C_FLAGS} ${CMAKE_SOURCE_DIR}/Tools/gtk/generate-gtkdoc ${_extra_args}
29         COMMAND touch ${_stamp_name}
30         WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
31     )
32 endmacro()
33
34 add_gtkdoc_generator("docs-build.stamp" "")
35 if (ENABLE_GTKDOC)
36     add_custom_target(gtkdoc ALL DEPENDS "${CMAKE_BINARY_DIR}/docs-build.stamp")
37 elseif (NOT ENABLED_COMPILER_SANITIZERS)
38     add_custom_target(gtkdoc DEPENDS "${CMAKE_BINARY_DIR}/docs-build.stamp")
39
40     # Add a default build step which check that documentation does not have any warnings
41     # or errors. This is useful to prevent breaking documentation inadvertently during
42     # the course of development.
43     if (DEVELOPER_MODE)
44         add_gtkdoc_generator("docs-build-no-html.stamp" "--skip-html")
45         add_custom_target(gtkdoc-no-html ALL DEPENDS "${CMAKE_BINARY_DIR}/docs-build-no-html.stamp")
46     endif ()
47 endif ()
48
49 add_custom_target(check
50     COMMAND ${TOOLS_DIR}/Scripts/run-gtk-tests
51     COMMAND ${TOOLS_DIR}/gtk/check-for-webkitdom-api-breaks
52 )
53
54 if (DEVELOPER_MODE)
55     configure_file(
56         ${TOOLS_DIR}/gtk/manifest.txt.in
57         ${CMAKE_BINARY_DIR}/manifest.txt
58     )
59
60     add_custom_command(
61         OUTPUT ${CMAKE_BINARY_DIR}/webkitgtk-${PROJECT_VERSION}.tar
62         DEPENDS ${TOOLS_DIR}/gtk/make-dist.py
63         DEPENDS ${CMAKE_BINARY_DIR}/manifest.txt
64         DEPENDS WebKit2
65         DEPENDS gtkdoc
66         COMMAND ${TOOLS_DIR}/gtk/make-dist.py
67                 --source-dir=${CMAKE_SOURCE_DIR}
68                 --build-dir=${CMAKE_BINARY_DIR}
69                 --version=${PROJECT_VERSION}
70                 ${CMAKE_BINARY_DIR}/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
83     add_custom_target(distcheck
84         DEPENDS ${TOOLS_DIR}/gtk/make-dist.py
85         DEPENDS ${CMAKE_BINARY_DIR}/manifest.txt
86         DEPENDS WebKit2
87         DEPENDS gtkdoc
88         COMMAND ${TOOLS_DIR}/gtk/make-dist.py
89                 --check
90                 --source-dir=${CMAKE_SOURCE_DIR}
91                 --build-dir=${CMAKE_BINARY_DIR}
92                 --version=${PROJECT_VERSION}
93                 ${CMAKE_BINARY_DIR}/manifest.txt
94         COMMAND xz -f ${CMAKE_BINARY_DIR}/webkitgtk-${PROJECT_VERSION}.tar
95     )
96 endif ()