[GTK] [CMake] Add support for generating gtkdoc
[WebKit-https.git] / Source / PlatformGTK.cmake
index 390daffc22b7559bcf10a7db8f7036018b6c32e7..686fb3e6fe936585a915142e24375bddf3041a5d 100644 (file)
@@ -1,7 +1,40 @@
+set(DocumentationDependencies
+    "${CMAKE_SOURCE_DIR}/Source/WebKit/gtk/docs/webkitenvironment.xml"
+)
+
+if (ENABLE_WEBKIT)
+    list(APPEND DocumentationDependencies
+        WebKit
+        "${CMAKE_SOURCE_DIR}/Source/WebKit/gtk/docs/webkitgtk-docs.sgml"
+        "${CMAKE_SOURCE_DIR}/Source/WebKit/gtk/docs/webkitgtk-sections.txt"
+    )
+endif ()
+
+if (ENABLE_WEBKIT2)
+    list(APPEND DocumentationDependencies
+        WebKit2
+        "${CMAKE_SOURCE_DIR}/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml"
+        "${CMAKE_SOURCE_DIR}/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt"
+    )
+endif ()
+
+add_custom_command(
+    OUTPUT docs-build.stamp
+    DEPENDS ${DocumentationDependencies}
+    COMMAND CC="${CMAKE_C_COMPILER}" ${CMAKE_SOURCE_DIR}/Tools/gtk/generate-gtkdoc
+    COMMAND touch docs-build.stamp
+    WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
+)
+
+add_custom_target(fake-docs-target ALL
+    DEPENDS docs-build.stamp
+)
+
 if (ENABLE_WEBKIT)
-    add_subdirectory(${WEBKIT_DIR}/gtk/tests)
+    add_dependencies(fake-docs-target WebKit)
 endif ()
 
 if (ENABLE_WEBKIT2)
-    add_subdirectory(${WEBKIT2_DIR}/UIProcess/API/gtk/tests)
+    add_dependencies(fake-docs-target WebKit2)
 endif ()
+