Skip to content

Commit

Permalink
Can prepare, build, and upload docs using CMake -G "Unix Makefiles"
Browse files Browse the repository at this point in the history
Confuses Ninja for some reason.
  • Loading branch information
tov committed May 10, 2020
1 parent bef0b8c commit 1adfcb1
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 2,516 deletions.
5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,3 @@
build/
builds/
cmake-build-*/

# Documentation:
doc/
doxygen/cppreference.xml
doxygen/FRONTMATTER.md
19 changes: 17 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,24 @@ add_subdirectory(src)
### DOCUMENTATION
###

find_package(Doxygen QUIET)
find_package(Doxygen)
if(DOXYGEN_FOUND)
include(Ge211Docs)
option(BUILD_DOCUMENTATION
"Create the HTML-based API documentation (requires Doxygen)"
On)
option(DOWNLOAD_STDLIB_TAGS
"Download tags for linking to standard library docs"
On)
set(GIT_PUSH_DOCS_URI
"https://github.com/tov/ge211.git"
CACHE STRING "Repo to push documentation to.")
set(GIT_PUSH_DOCS_BRANCH
"gh-pages"
CACHE STRING "Branch to push documentation to.")

if(BUILD_DOCUMENTATION)
add_subdirectory(doc)
endif()
endif()

###
Expand Down
26 changes: 0 additions & 26 deletions cmake/Ge211Docs.cmake

This file was deleted.

60 changes: 60 additions & 0 deletions doc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
set(STDLIB_DOC_ROOT "http://en.cppreference.com/w/")
set(STDLIB_TAG_FILE "cppreference.xml")
set(STDLIB_TAG_URL "http://upload.cppreference.com/mwiki/images/f/f8/cppreference-doxygen-web.tag.xml")

set(readme_md ${CMAKE_CURRENT_SOURCE_DIR}/../README.md)
set(frontmatter_md ${CMAKE_CURRENT_BINARY_DIR}/FRONTMATTER.md)

set(DOXYGEN_OUTPUT_DIRECTORY doc)
set(DOXYGEN_JAVADOC_AUTOBRIEF YES)
set(DOXYGEN_ALIASES [=[preconditions=#### Preconditions: ]=])
set(DOXYGEN_HIDE_FRIEND_COMPOUNDS YES)
set(DOXYGEN_HIDE_SCOPE_NAMES YES)
set(DOXYGEN_SHOW_INCLUDE_FILES NO)
set(DOXYGEN_LAYOUT_FILE DoxygenLayout.xml)
set(DOXYGEN_EXCLUDE_SYMBOLS detail)
set(DOXYGEN_USE_MDFILE_AS_MAINPAGE ${frontmatter_md})
set(DOXYGEN_SOURCE_BROWSER YES)
set(DOXYGEN_HTML_DYNAMIC_SECTIONS YES)
set(DOXYGEN_DISABLE_INDEX YES)
set(DOXYGEN_GENERATE_TREEVIEW YES)
set(DOXYGEN_ENABLE_PREPROCESSING YES)
set(DOXYGEN_PREDEFINED NO_NOEXCEPT)
set(DOXYGEN_MACRO_EXPANSION YES)
set(DOXYGEN_EXPAND_ONLY_PREDEF YES)
set(DOXYGEN_EXPAND_AS_DEFINED NOEXCEPT NOEXCEPT_)

execute_process(COMMAND "sed;-E;/^\\[.*\\]: *$$/,/^ *$$/d\; s/[][]//g"
INPUT_FILE ${readme_md}
OUTPUT_FILE ${frontmatter_md})
file(GLOB_RECURSE ge211_srcs
LIST_DIRECTORIES false
../include/*.hxx
../src/*.cxx)
doxygen_add_docs(Build-GE211-Docs
${ge211_srcs}
${frontmatter_md}
USE_STAMP_FILE)

if (DOWNLOAD_STDLIB_TAGS)
include(ExternalProject)
ExternalProject_Add(Fetch-StdLib-Tags
PREFIX ${CMAKE_CURRENT_BINARY_DIR}
URL ${STDLIB_TAG_URL}
DOWNLOAD_NAME ${STDLIB_TAG_FILE}
DOWNLOAD_NO_EXTRACT True
TIMEOUT 10
DOWNLOAD_NO_PROGRESS True
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND "")
set(DOXYGEN_TAGFILES
"${STDLIB_TAG_FILE}=${CMAKE_CURRENT_BINARY_DIR}/${STDLIB_TAGFILE}")
add_dependencies(Build-GE211-Docs Fetch-StdLib-Tags)
endif()

add_custom_target(Upload-GE211-Docs
COMMAND ghp-import -n doc/html
COMMAND git push --force ${GIT_PUSH_DOCS_URI} ${GIT_PUSH_DOCS_BRANCH}
COMMENT "Publishing to GitHub Pages")
add_dependencies(Upload-GE211-Docs Build-GE211-Docs)
File renamed without changes.
Loading

0 comments on commit 1adfcb1

Please sign in to comment.