diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 57af432..1b0a909 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -9,6 +9,12 @@ endif() find_package(LATEX) +# For Apple silicon, pyenchant (used by sphinxcontrib.spelling) may fail to find the enchant library. +# https://github.com/pyenchant/pyenchant/issues/265 +find_library(ENCHANT_LIBRARIES + NAMES enchant-2 + ) + add_subdirectory(en) add_subdirectory(jp) diff --git a/doc/en/CMakeLists.txt b/doc/en/CMakeLists.txt index 12ba5c3..27b896e 100644 --- a/doc/en/CMakeLists.txt +++ b/doc/en/CMakeLists.txt @@ -6,25 +6,40 @@ set(DSQSS_DOC_DIR share/dsqss/${DSQSS_VERSION}/doc/en) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/conf.py ${CMAKE_CURRENT_BINARY_DIR}) +set(cmd_list + env PYTHONPATH="${pythonpath_build}:$ENV{PYTHONPATH}" + ${SPHINX_EXECUTABLE} + -b html + -d ${SPHINX_CACHE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${SPHINX_HTML_DIR} +) + +if(ENCHANT_LIBRARIES) + list(INSERT cmd_list 0 env PYENCHANT_LIBRARY_PATH=${ENCHANT_LIBRARIES}) +endif() + add_custom_target(doc-en-html ALL COMMAND - env PYTHONPATH="${pythonpath_build}:$ENV{PYTHONPATH}" - ${SPHINX_EXECUTABLE} - -b html - -d ${SPHINX_CACHE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR} - ${SPHINX_HTML_DIR} + ${cmd_list} ) if(LATEX_FOUND) - add_custom_target(doc-en-pdf ALL - COMMAND + set(cmd_list env PYTHONPATH="${pythonpath_build}:$ENV{PYTHONPATH}" + ${ENC_ENV} ${SPHINX_EXECUTABLE} -b latex -d ${SPHINX_CACHE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${SPHINX_PDF_DIR} + ) + if(ENCHANT_LIBRARIES) + list(INSERT cmd_list 0 env PYENCHANT_LIBRARY_PATH=${ENCHANT_LIBRARIES}) + endif() + add_custom_target(doc-en-pdf ALL + COMMAND + ${cmd_list} COMMAND cd pdf && make ) diff --git a/doc/jp/CMakeLists.txt b/doc/jp/CMakeLists.txt index 4798d32..a457194 100644 --- a/doc/jp/CMakeLists.txt +++ b/doc/jp/CMakeLists.txt @@ -6,25 +6,42 @@ set(DSQSS_DOC_DIR_JP share/dsqss/${DSQSS_VERSION}/doc/jp) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/conf.py ${CMAKE_CURRENT_BINARY_DIR}) +set(cmd_list + env PYTHONPATH="${pythonpath_build}:$ENV{PYTHONPATH}" + ${SPHINX_EXECUTABLE} + -b html + -d ${SPHINX_CACHE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${SPHINX_HTML_DIR} +) + +if(ENCHANT_LIBRARIES) + list(INSERT cmd_list 0 env PYENCHANT_LIBRARY_PATH=${ENCHANT_LIBRARIES}) +endif() + add_custom_target(doc-jp-html ALL COMMAND - env PYTHONPATH="${pythonpath_build}:$ENV{PYTHONPATH}" - ${SPHINX_EXECUTABLE} - -b html - -d ${SPHINX_CACHE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR} - ${SPHINX_HTML_DIR} + ${cmd_list} ) if(LATEX_FOUND) - add_custom_target(doc-jp-pdf ALL - COMMAND + + set(cmd_list env PYTHONPATH="${pythonpath_build}:$ENV{PYTHONPATH}" + ${ENC_ENV} ${SPHINX_EXECUTABLE} -b latex -d ${SPHINX_CACHE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${SPHINX_PDF_DIR} + ) + if(ENCHANT_LIBRARIES) + list(INSERT cmd_list 0 env PYENCHANT_LIBRARY_PATH=${ENCHANT_LIBRARIES}) + endif() + + add_custom_target(doc-jp-pdf ALL + COMMAND + ${cmd_list} COMMAND cd pdf && make )