summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorIvan Komissarov <abbapoh@gmail.com>2021-09-04 14:22:12 +0300
committerIvan Komissarov <ABBAPOH@gmail.com>2021-09-07 10:40:40 +0000
commit1acd941b42e6f99b55312bef93cfd448945409cb (patch)
tree6d7bc055a0433d64f4be5d26b28bd85e72be12b5 /doc
parent117393c7adf0dbbdefba0a274073831da96ba5dc (diff)
downloadqbs-1acd941b42e6f99b55312bef93cfd448945409cb.tar.gz
cmake: Build docs without Qbs
Fixes: QBS-1671 Change-Id: I3f0522d6990caa661997dd773d9b3af662bd2ed8 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'doc')
-rw-r--r--doc/CMakeLists.txt84
1 files changed, 1 insertions, 83 deletions
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index 96cdab897..57dcbe33e 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -1,83 +1 @@
-if (QBS_INSTALL_HTML_DOCS OR QBS_INSTALL_QCH_DOCS)
-
- find_package(Python3 COMPONENTS Interpreter)
-
- function(find_python_module module)
- string(TOUPPER ${module} module_upper)
- if (NOT PY_${module_upper})
- if (ARGC GREATER 1 AND ARGV1 STREQUAL "REQUIRED")
- set(${module}_FIND_REQUIRED TRUE)
- endif()
- # A module's location is usually a directory, but for binary modules
- # it's a .so file.
- execute_process(COMMAND "${Python3_EXECUTABLE}" "-c"
- "import re, ${module}; print(re.compile('/__init__.py.*').sub('',${module}.__file__))"
- RESULT_VARIABLE _${module}_status
- OUTPUT_VARIABLE _${module}_location
- ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
- if (NOT _${module}_status)
- set(PY_${module_upper} ${_${module}_location} CACHE STRING
- "Location of Python module ${module}")
- endif()
- endif()
- find_package_handle_standard_args(PY_${module} DEFAULT_MSG PY_${module_upper})
- endfunction()
-
- if (Python3_Interpreter_FOUND)
- find_python_module(lxml)
- find_python_module(bs4)
- if (PY_LXML AND PY_BS4)
-
- get_target_property(_QBS_OUTPUT_DIR qbs RUNTIME_OUTPUT_DIRECTORY)
-
- if (QBS_INSTALL_HTML_DOCS)
- set(_INSTALL_HTML_DOCS true)
- else()
- set(_INSTALL_HTML_DOCS false)
- endif()
-
- if (QBS_INSTALL_QCH_DOCS)
- set(_INSTALL_QCH_DOCS true)
- else()
- set(_INSTALL_QCH_DOCS false)
- endif()
-
- get_target_property(_QT_QMAKE_EXECUTABLE Qt${QT_VERSION_MAJOR}::qmake IMPORTED_LOCATION)
- get_update_path_command(UPDATE_PATH_COMMAND)
- add_custom_target(
- BuildQbsDocumentation ALL
- COMMAND ${CMAKE_COMMAND} -E env "${UPDATE_PATH_COMMAND}" ${_QBS_OUTPUT_DIR}/qbs
- resolve
- --settings-dir ${PROJECT_BINARY_DIR}/settings
- -f ${PROJECT_SOURCE_DIR}/qbs.qbs
- -d ${PROJECT_BINARY_DIR}/
- config:doc-build
- qbs.installPrefix:undefined
- qbs.buildVariant:release
- project.withCode:false
- project.withDocumentation:true
- profile:none
- "products.qbs documentation.pythonPath:${Python3_EXECUTABLE}"
- modules.qbsbuildconfig.installHtml:${_INSTALL_HTML_DOCS}
- modules.qbsbuildconfig.installQch:${_INSTALL_QCH_DOCS}
- moduleProviders.Qt.qmakeFilePaths:${_QT_QMAKE_EXECUTABLE}
- COMMAND ${CMAKE_COMMAND} -E env "${UPDATE_PATH_COMMAND}" ${_QBS_OUTPUT_DIR}/qbs
- build
- --settings-dir ${PROJECT_BINARY_DIR}/settings
- -f ${PROJECT_SOURCE_DIR}/qbs.qbs
- -d ${PROJECT_BINARY_DIR}/
- config:doc-build
- -p "qbs documentation"
- DEPENDS qbs copy-runtime-files-qbs qbs_processlauncher
- )
- install(
- DIRECTORY ${PROJECT_BINARY_DIR}/doc-build/install-root/share/doc/qbs/html/
- DESTINATION "${QBS_DOC_INSTALL_DIR}"
- )
- else()
- message(WARNING "Cannot import lxml and bs4 python modules. Qbs documentation will not be built.")
- endif()
- else()
- message(WARNING "Cannot find python3 binary. Qbs documentation will not be built.")
- endif()
-endif()
+add_qbs_documentation("qbs.qdocconf")