Add support for building docs
This commit add targets to build op documentation to both BUILD
and CMake configurations. On the CMake side, we additionall
add an iree-doc master target to drive the generation of all
documentation. The generated documentation will all be placed
under <build-dir>/doc/Dialects/ for now.
Closes https://github.com/google/iree/pull/1283
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/iree/pull/1283 from antiagainst:build-doc 2934d4b2dd0d9117e66ac905d64cea43ea71bc7d
PiperOrigin-RevId: 303793736
diff --git a/CMakeLists.txt b/CMakeLists.txt
index db4d78f..b71703b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -37,6 +37,7 @@
option(IREE_BUILD_COMPILER "Builds the IREE compiler." ON)
option(IREE_BUILD_TESTS "Builds IREE unit tests." ON)
+option(IREE_BUILD_DOCS "Builds IREE docs." OFF)
option(IREE_BUILD_SAMPLES "Builds IREE sample projects." ON)
option(IREE_BUILD_DEBUGGER "Builds the IREE debugger app." OFF)
option(IREE_BUILD_PYTHON_BINDINGS "Builds the IREE python bindings" OFF)
@@ -66,6 +67,7 @@
include(iree_cc_library)
include(iree_cc_test)
include(iree_tablegen_library)
+include(iree_tablegen_doc)
include(iree_cc_embed_data)
include(iree_bytecode_module)
include(iree_glslang)
@@ -169,6 +171,17 @@
endif()
#-------------------------------------------------------------------------------
+# IREE top-level targets
+#-------------------------------------------------------------------------------
+
+if(${IREE_BUILD_DOCS})
+ # Add a top-level custom target to drive generating all documentation.
+ # Register it to the default target given that IREE_BUILD_DOCS is explicitly
+ # requested.
+ add_custom_target(iree-doc ALL)
+endif()
+
+#-------------------------------------------------------------------------------
# IREE top-level libraries
#-------------------------------------------------------------------------------