Skip to content

Commit

Permalink
[doc] find enchant library explicitly in cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
yomichi committed Oct 5, 2023
1 parent 374a894 commit 2f6cd5d
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 16 deletions.
6 changes: 6 additions & 0 deletions doc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
31 changes: 23 additions & 8 deletions doc/en/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
33 changes: 25 additions & 8 deletions doc/jp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down

0 comments on commit 2f6cd5d

Please sign in to comment.