Permalink
Browse files

Merge remote-tracking branch 'templates/c-template' into develop

* templates/c-template:
  Removing lingering reference to waf
  Better OS X defaults
  Addition build directory in .gitignore
  CMake magic for finding local intersphinx docs
  Adding default index reference link
  Default intro blurb and contents heading
  • Loading branch information...
2 parents 45f9545 + 4751969 commit 9ea27d2750fdf0102d8ee0b390443dd411f01ced Douglas Creager committed Jan 25, 2012
Showing with 81 additions and 13 deletions.
  1. +1 −2 .gitignore
  2. +6 −2 CMakeLists.txt
  3. +31 −0 docs/CMakeLists.txt
  4. +24 −1 docs/conf.py
  5. +6 −8 docs/index.rst
  6. +13 −0 src/APPNAME.pc.in
View
@@ -1,6 +1,5 @@
-/.lock-wscript
-/.build/
/build/
+/.build/
RELEASE-VERSION
View
@@ -37,8 +37,12 @@ find_package(PkgConfig)
# Set some options
if(APPLE)
- set(CMAKE_OSX_ARCHITECTURES "i386;x86_64"
- CACHE STRING "Build architectures for Mac OS X")
+ if (NOT CMAKE_OSX_ARCHITECTURES)
+ set(CMAKE_OSX_ARCHITECTURES "i386;x86_64" CACHE STRING "Build architectures for Mac OS X")
+ endif (NOT CMAKE_OSX_ARCHITECTURES)
+ if (NOT CMAKE_INSTALL_NAME_DIR)
+ set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
+ endif (NOT CMAKE_INSTALL_NAME_DIR)
endif(APPLE)
if(NOT CMAKE_BUILD_TYPE)
View
@@ -22,14 +22,45 @@ if (NOT SPHINX_EXECUTABLE)
set(GENERATE_DOC FALSE)
endif (NOT SPHINX_EXECUTABLE)
+set(INTERSPHINX_OVERRIDES "")
+
+macro(find_prereq_doc LIB_NAME)
+ execute_process(
+ COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=sphinxdir ${LIB_NAME}
+ OUTPUT_VARIABLE LIB_SPHINX_DIR
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+
+ if (LIB_SPHINX_DIR)
+ message(STATUS "Using ${LIB_NAME} docs in ${LIB_SPHINX_DIR}")
+ set(
+ INTERSPHINX_OVERRIDES
+ "${INTERSPHINX_OVERRIDES}\nintersphinx_mapping['${LIB_NAME}'] = ('${LIB_SPHINX_DIR}', None)"
+ )
+ endif (LIB_SPHINX_DIR)
+endmacro(find_prereq_doc)
+
if (GENERATE_DOC)
+ set(SPHINX_SRC_CONF_FILE "${CMAKE_CURRENT_SOURCE_DIR}/conf.py")
+ set(SPHINX_CONF_FILE "${CMAKE_CURRENT_BINARY_DIR}/conf.py")
set(SPHINX_CACHE_DIR "${CMAKE_CURRENT_BINARY_DIR}/_doctrees")
set(SPHINX_HTML_DIR "${CMAKE_CURRENT_BINARY_DIR}/html")
+ # If your Sphinx documentation references the Sphinx documentation of
+ # any of your prerequisite libraries, add some calls to
+ # find_prereq_doc here:
+ #
+ # find_prereq_doc(libcork)
+
+ configure_file(${SPHINX_SRC_CONF_FILE} ${SPHINX_CONF_FILE} @ONLY)
+ file(COPY _static DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+ file(COPY _templates DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+
add_custom_target(doc ALL
${SPHINX_EXECUTABLE}
-b html
-d "${SPHINX_CACHE_DIR}"
+ -c "${CMAKE_CURRENT_BINARY_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}"
"${SPHINX_HTML_DIR}"
COMMENT "Building HTML documentation with Sphinx"
View
@@ -13,14 +13,37 @@
default_role = 'c:func'
primary_domain = 'c'
+rst_epilog = """
+.. |project_name| replace:: """ + project_name + """
+"""
+
+# Intersphinx stuff
+
+# If your documentation uses intersphinx to link to other Sphinx
+# documentation sets, uncomment and fill in the following.
+#
+#intersphinx_mapping = {
+# 'libcork': ('http://libcork.readthedocs.org/en/latest/', None),
+#}
+
+# Our CMake build scripts will insert overrides below if the prereq
+# libraries have installed their Sphinx documentation locally. DO NOT
+# uncomment out the last line of this block; we need it commented so
+# that this conf.py file still works if CMake doesn't do its
+# substitution thing.
+# @INTERSPHINX_OVERRIDES@
+
+#----------------------------------------------------------------------
+# Everything below here shouldn't need to be changed.
+
# Grab version from git
import re
import subprocess
release = subprocess.check_output(["git", "describe"]).rstrip()
version = re.sub(r"-dev.*$", "-dev", release)
-# Stuff below here probably doesn't need to be changed
+# Project details
project = project_name
copyright = copyright_years+u', '+company
View
@@ -1,12 +1,10 @@
-.. libcork documentation master file, created by
- sphinx-quickstart on Thu Nov 10 15:10:57 2011.
- You can adapt this file completely to your liking, but it should at least
- contain the root `toctree` directive.
+.. _index:
-libcork documentation
-=====================
+|project_name| documentation
+============================
-This is the documentation for libcork |release|, last updated |today|.
+This is the documentation for |project_name| |release|, last updated
+|today|.
Introduction
@@ -47,7 +45,7 @@ Contents
Indices and tables
-==================
+------------------
* :ref:`genindex`
* :ref:`search`
View
@@ -0,0 +1,13 @@
+prefix=@prefix@
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+sharedir=${prefix}/share
+sphinxdir=${sharedir}/doc/APPNAME/html
+
+Name: APPNAME
+Description: FILL_THIS_IN
+Version: @VERSION@
+URL: FILL_THIS_IN
+Libs: -L${libdir} -lAPPNAME
+Cflags: -I${includedir}

0 comments on commit 9ea27d2

Please sign in to comment.