mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-25 15:21:54 +00:00
Use Cmake to find Python and Sphinx-doc.
Signed-off-by: Vitaly Zaitsev <vitaly@easycoding.org>
This commit is contained in:
parent
c090569751
commit
638db5ca5e
@ -4,10 +4,15 @@ if (NOT DOXYGEN)
|
|||||||
return ()
|
return ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
find_package(PythonInterp QUIET REQUIRED)
|
||||||
|
find_program(SPHINX_EXECUTABLE NAMES sphinx-build sphinx-build-3)
|
||||||
|
|
||||||
add_custom_target(doc
|
add_custom_target(doc
|
||||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build.py ${FMT_VERSION}
|
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/build.py
|
||||||
|
${SPHINX_EXECUTABLE} ${FMT_VERSION}
|
||||||
SOURCES api.rst syntax.rst usage.rst build.py conf.py _templates/layout.html)
|
SOURCES api.rst syntax.rst usage.rst build.py conf.py _templates/layout.html)
|
||||||
|
|
||||||
|
include(GNUInstallDirs)
|
||||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/
|
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/
|
||||||
DESTINATION share/doc/fmt OPTIONAL
|
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/doc/fmt OPTIONAL
|
||||||
PATTERN ".doctrees" EXCLUDE)
|
PATTERN ".doctrees" EXCLUDE)
|
||||||
|
@ -59,7 +59,7 @@ def create_build_env(dirname='virtualenv'):
|
|||||||
'129222318f7c8f865d2631e7da7b033567e7f56a',
|
'129222318f7c8f865d2631e7da7b033567e7f56a',
|
||||||
min_version='4.2.0')
|
min_version='4.2.0')
|
||||||
|
|
||||||
def build_docs(version='dev', **kwargs):
|
def build_docs(sphinx_executable='sphinx-build', version='dev', **kwargs):
|
||||||
doc_dir = kwargs.get('doc_dir', os.path.dirname(os.path.realpath(__file__)))
|
doc_dir = kwargs.get('doc_dir', os.path.dirname(os.path.realpath(__file__)))
|
||||||
work_dir = kwargs.get('work_dir', '.')
|
work_dir = kwargs.get('work_dir', '.')
|
||||||
include_dir = kwargs.get(
|
include_dir = kwargs.get(
|
||||||
@ -101,7 +101,7 @@ def build_docs(version='dev', **kwargs):
|
|||||||
raise CalledProcessError(p.returncode, cmd)
|
raise CalledProcessError(p.returncode, cmd)
|
||||||
html_dir = os.path.join(work_dir, 'html')
|
html_dir = os.path.join(work_dir, 'html')
|
||||||
main_versions = reversed(versions[-3:])
|
main_versions = reversed(versions[-3:])
|
||||||
check_call(['sphinx-build',
|
check_call([sphinx_executable,
|
||||||
'-Dbreathe_projects.format=' + os.path.abspath(doxyxml_dir),
|
'-Dbreathe_projects.format=' + os.path.abspath(doxyxml_dir),
|
||||||
'-Dversion=' + version, '-Drelease=' + version,
|
'-Dversion=' + version, '-Drelease=' + version,
|
||||||
'-Aversion=' + version, '-Aversions=' + ','.join(main_versions),
|
'-Aversion=' + version, '-Aversions=' + ','.join(main_versions),
|
||||||
@ -121,4 +121,4 @@ def build_docs(version='dev', **kwargs):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
create_build_env()
|
create_build_env()
|
||||||
build_docs(sys.argv[1])
|
build_docs(sys.argv[1], sys.argv[2])
|
||||||
|
Loading…
Reference in New Issue
Block a user