Add CMake support for also building Markdown docs in parallel (#49)
This commit is contained in:
+10
-11
@@ -1,15 +1,14 @@
|
||||
version: 2
|
||||
|
||||
build:
|
||||
os: "ubuntu-20.04"
|
||||
os: ubuntu-24.04
|
||||
tools:
|
||||
python: "3.10"
|
||||
|
||||
sphinx:
|
||||
configuration: docs/source/conf.py
|
||||
|
||||
python:
|
||||
install:
|
||||
- requirements: docs/requirements.txt
|
||||
- method: pip
|
||||
path: .
|
||||
python: "3.13"
|
||||
commands:
|
||||
- pip install cmake
|
||||
- pip install -r docs/requirements.txt
|
||||
- pip install -e .
|
||||
- cmake --workflow --preset documentation-workflow
|
||||
# Copy built documentation to Read the Docs output directory
|
||||
- mkdir -p $READTHEDOCS_OUTPUT/html
|
||||
- cp -r build/* $READTHEDOCS_OUTPUT/html/
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
project(SphinxLLMsTxt VERSION 1.0.0 LANGUAGES NONE)
|
||||
|
||||
# Add CMake module path
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
|
||||
# Add documentation
|
||||
add_subdirectory(docs)
|
||||
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"version": 6,
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "documentation",
|
||||
"displayName": "Documentation Build",
|
||||
"description": "Configure project with documentation environment setup",
|
||||
"binaryDir": "${sourceDir}/build"
|
||||
}
|
||||
],
|
||||
"buildPresets": [
|
||||
{
|
||||
"name": "html",
|
||||
"displayName": "Build HTML Documentation",
|
||||
"configurePreset": "documentation",
|
||||
"targets": ["html"]
|
||||
},
|
||||
{
|
||||
"name": "markdown",
|
||||
"displayName": "Build Markdown Documentation",
|
||||
"configurePreset": "documentation",
|
||||
"targets": ["markdown"]
|
||||
},
|
||||
{
|
||||
"name": "docs-parallel",
|
||||
"displayName": "Build HTML and Markdown in parallel",
|
||||
"configurePreset": "documentation",
|
||||
"targets": ["html", "markdown"]
|
||||
}
|
||||
],
|
||||
"workflowPresets": [
|
||||
{
|
||||
"name": "documentation-workflow",
|
||||
"displayName": "Documentation Build Workflow",
|
||||
"steps": [
|
||||
{
|
||||
"type": "configure",
|
||||
"name": "documentation"
|
||||
},
|
||||
{
|
||||
"type": "build",
|
||||
"name": "docs-parallel"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
# SetupSphinx.cmake - Find Sphinx for CI environments
|
||||
|
||||
# Function to find Sphinx in the system
|
||||
function(setup_sphinx_environment)
|
||||
# Find sphinx-build executable in system
|
||||
find_program(SPHINX_EXECUTABLE
|
||||
NAMES sphinx-build
|
||||
DOC "Sphinx documentation generator"
|
||||
)
|
||||
|
||||
if(NOT SPHINX_EXECUTABLE)
|
||||
message(FATAL_ERROR "sphinx-build not found. Please install Sphinx.")
|
||||
endif()
|
||||
|
||||
# Get Sphinx version
|
||||
execute_process(
|
||||
COMMAND ${SPHINX_EXECUTABLE} --version
|
||||
OUTPUT_VARIABLE SPHINX_VERSION_OUTPUT
|
||||
ERROR_VARIABLE SPHINX_VERSION_OUTPUT
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
message(STATUS "Found Sphinx: ${SPHINX_EXECUTABLE}")
|
||||
message(STATUS "${SPHINX_VERSION_OUTPUT}")
|
||||
|
||||
# Export to parent scope
|
||||
set(SPHINX_EXECUTABLE "${SPHINX_EXECUTABLE}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
@@ -0,0 +1,24 @@
|
||||
# Find Sphinx
|
||||
include(SetupSphinx)
|
||||
setup_sphinx_environment()
|
||||
|
||||
set(SPHINX_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/source)
|
||||
set(SPHINX_BUILD ${CMAKE_BINARY_DIR})
|
||||
|
||||
# Build HTML documentation
|
||||
add_custom_target(html
|
||||
COMMAND ${SPHINX_EXECUTABLE} -b html ${SPHINX_SOURCE} ${SPHINX_BUILD}
|
||||
COMMENT "Building HTML documentation"
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
# Build markdown documentation
|
||||
add_custom_target(markdown
|
||||
COMMAND ${SPHINX_EXECUTABLE} -b markdown ${SPHINX_SOURCE} ${SPHINX_BUILD}
|
||||
COMMENT "Building Markdown documentation"
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
# Build both formats
|
||||
add_custom_target(docs ALL)
|
||||
add_dependencies(docs html markdown)
|
||||
@@ -4,3 +4,4 @@ sphinx-contributors
|
||||
sphinx
|
||||
sphinx-llms-txt
|
||||
sphinxext-opengraph
|
||||
sphinx-markdown-builder
|
||||
|
||||
@@ -48,6 +48,8 @@ test = [
|
||||
"pytest>=7.0.0",
|
||||
]
|
||||
|
||||
[tool.setuptools]
|
||||
packages = ["sphinx_llms_txt"]
|
||||
|
||||
[tool.setuptools.dynamic]
|
||||
version = {attr = "sphinx_llms_txt.__version__"}
|
||||
|
||||
Reference in New Issue
Block a user