docs: build and package new Sphinx docs on macOS

This commit is contained in:
Eric Wasylishen 2022-01-29 17:09:15 -07:00
parent aa71025970
commit ebf385d382
6 changed files with 42 additions and 4 deletions

View File

@ -26,8 +26,6 @@ jobs:
- name: Linux Build - name: Linux Build
if: runner.os == 'Linux' if: runner.os == 'Linux'
run: | run: |
sudo apt-get update
sudo apt-get install -y groff
./build-linux-64.sh ./build-linux-64.sh
- name: macOS Build - name: macOS Build

View File

@ -3,6 +3,8 @@ cmake_policy(SET CMP0028 NEW)
project (ericw-tools) project (ericw-tools)
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
# Grab the git describe output and store it in GIT_DESCRIBE # Grab the git describe output and store it in GIT_DESCRIBE
# Thanks to http://xit0.org/2013/04/cmake-use-git-branch-and-commit-details-in-project/ # Thanks to http://xit0.org/2013/04/cmake-use-git-branch-and-commit-details-in-project/
execute_process( execute_process(
@ -92,6 +94,7 @@ endif ()
add_subdirectory(qbsp) add_subdirectory(qbsp)
add_subdirectory(vis) add_subdirectory(vis)
add_subdirectory(docs)
install(FILES README.md DESTINATION bin) install(FILES README.md DESTINATION bin)
install(FILES changelog.md DESTINATION bin) install(FILES changelog.md DESTINATION bin)

View File

@ -40,12 +40,12 @@ source code.
## Compiling ## Compiling
Dependencies: Embree 3.0+, TBB (TODO: version?), groff (for building manuals) Dependencies: Embree 3.0+, TBB (TODO: version?), Sphinx (for building manuals)
### Ubuntu ### Ubuntu
``` ```
sudo apt install libembree-dev libtbb-dev groff cmake build-essential g++ sudo apt install libembree-dev libtbb-dev python3-sphinx cmake build-essential g++
git clone --recursive https://github.com/ericwa/ericw-tools git clone --recursive https://github.com/ericwa/ericw-tools
cd ericw-tools cd ericw-tools
mkdir build mkdir build
@ -58,6 +58,8 @@ cmake ..
Example using vcpkg (32-bit build): Example using vcpkg (32-bit build):
``` ```
# TODO: sphinx installation
git clone --recursive https://github.com/ericwa/ericw-tools git clone --recursive https://github.com/ericwa/ericw-tools
cd ericw-tools cd ericw-tools
git clone https://github.com/microsoft/vcpkg git clone https://github.com/microsoft/vcpkg
@ -78,6 +80,7 @@ cmake .. -DCMAKE_TOOLCHAIN_FILE="$(pwd)/../vcpkg/scripts/buildsystems/vcpkg.cmak
``` ```
brew install embree tbb brew install embree tbb
python3 -m pip install sphinx_rtd_theme
git clone --recursive https://github.com/ericwa/ericw-tools git clone --recursive https://github.com/ericwa/ericw-tools
cd ericw-tools cd ericw-tools
mkdir build mkdir build

View File

@ -3,6 +3,8 @@
# for sha256sum, used by the tests # for sha256sum, used by the tests
brew install coreutils brew install coreutils
python3 -m pip install sphinx_rtd_theme
BUILD_DIR=build-osx BUILD_DIR=build-osx
EMBREE_ZIP="https://github.com/embree/embree/releases/download/v3.13.0/embree-3.13.0.x86_64.macosx.zip" EMBREE_ZIP="https://github.com/embree/embree/releases/download/v3.13.0/embree-3.13.0.x86_64.macosx.zip"

14
cmake/FindSphinx.cmake Normal file
View File

@ -0,0 +1,14 @@
# From:
# https://devblogs.microsoft.com/cppblog/clear-functional-c-documentation-with-sphinx-breathe-doxygen-cmake/
#Look for an executable called sphinx-build
find_program(SPHINX_EXECUTABLE
NAMES sphinx-build
DOC "Path to sphinx-build executable")
include(FindPackageHandleStandardArgs)
#Handle standard arguments to find_package like REQUIRED and QUIET
find_package_handle_standard_args(Sphinx
"Failed to find sphinx-build executable"
SPHINX_EXECUTABLE)

18
docs/CMakeLists.txt Normal file
View File

@ -0,0 +1,18 @@
# From:
# https://devblogs.microsoft.com/cppblog/clear-functional-c-documentation-with-sphinx-breathe-doxygen-cmake/
find_package(Sphinx REQUIRED)
if (Sphinx_FOUND)
set(SPHINX_SOURCE ${CMAKE_CURRENT_SOURCE_DIR})
set(SPHINX_BUILD ${CMAKE_CURRENT_BINARY_DIR}/docs/sphinx)
add_custom_target(Sphinx ALL
COMMAND
${SPHINX_EXECUTABLE} -b html
${SPHINX_SOURCE} ${SPHINX_BUILD}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating documentation with Sphinx")
install(DIRECTORY ${SPHINX_BUILD}/ DESTINATION doc)
endif()