summaryrefslogtreecommitdiffstats
path: root/Utilities
diff options
context:
space:
mode:
Diffstat (limited to 'Utilities')
-rw-r--r--Utilities/Sphinx/cmake.py49
-rw-r--r--Utilities/Sphinx/conf.py.in4
-rwxr-xr-xUtilities/Sphinx/create_identifiers.py2
-rw-r--r--Utilities/cmliblzma/CMakeLists.txt1
-rw-r--r--Utilities/cmliblzma/common/sysdefs.h4
-rw-r--r--Utilities/cmliblzma/config.h.in4
6 files changed, 55 insertions, 9 deletions
diff --git a/Utilities/Sphinx/cmake.py b/Utilities/Sphinx/cmake.py
index 2629bb3..e20679a 100644
--- a/Utilities/Sphinx/cmake.py
+++ b/Utilities/Sphinx/cmake.py
@@ -130,8 +130,8 @@ class _cmake_index_entry:
def __init__(self, desc):
self.desc = desc
- def __call__(self, title, targetid):
- return ('pair', u'%s ; %s' % (self.desc, title), targetid, 'main')
+ def __call__(self, title, targetid, main = 'main'):
+ return ('pair', u'%s ; %s' % (self.desc, title), targetid, main)
_cmake_index_objs = {
'command': _cmake_index_entry('command'),
@@ -203,6 +203,7 @@ class CMakeTransform(Transform):
# Insert the object link target.
targetid = '%s:%s' % (objtype, title)
targetnode = nodes.target('', '', ids=[targetid])
+ self.document.note_explicit_target(targetnode)
self.document.insert(0, targetnode)
# Insert the object index entry.
indexnode = addnodes.index()
@@ -257,6 +258,49 @@ class CMakeXRefRole(XRefRole):
break
return XRefRole.__call__(self, typ, rawtext, text, *args, **keys)
+ # We cannot insert index nodes using the result_nodes method
+ # because CMakeXRefRole is processed before substitution_reference
+ # nodes are evaluated so target nodes (with 'ids' fields) would be
+ # duplicated in each evaluted substitution replacement. The
+ # docutils substitution transform does not allow this. Instead we
+ # use our own CMakeXRefTransform below to add index entries after
+ # substitutions are completed.
+ #
+ # def result_nodes(self, document, env, node, is_ref):
+ # pass
+
+class CMakeXRefTransform(Transform):
+
+ # Run this transform early since we insert nodes we want
+ # treated as if they were written in the documents, but
+ # after the sphinx (210) and docutils (220) substitutions.
+ default_priority = 221
+
+ def apply(self):
+ env = self.document.settings.env
+
+ # Find CMake cross-reference nodes and add index and target
+ # nodes for them.
+ for ref in self.document.traverse(addnodes.pending_xref):
+ if not ref['refdomain'] == 'cmake':
+ continue
+
+ objtype = ref['reftype']
+ make_index_entry = _cmake_index_objs.get(objtype)
+ if not make_index_entry:
+ continue
+
+ objname = ref['reftarget']
+ targetnum = env.new_serialno('index-%s:%s' % (objtype, objname))
+
+ targetid = 'index-%s-%s:%s' % (targetnum, objtype, objname)
+ targetnode = nodes.target('', '', ids=[targetid])
+ self.document.note_explicit_target(targetnode)
+
+ indexnode = addnodes.index()
+ indexnode['entries'] = [make_index_entry(objname, targetid, '')]
+ ref.replace_self([indexnode, targetnode, ref])
+
class CMakeDomain(Domain):
"""CMake domain."""
name = 'cmake'
@@ -336,4 +380,5 @@ class CMakeDomain(Domain):
def setup(app):
app.add_directive('cmake-module', CMakeModule)
app.add_transform(CMakeTransform)
+ app.add_transform(CMakeXRefTransform)
app.add_domain(CMakeDomain)
diff --git a/Utilities/Sphinx/conf.py.in b/Utilities/Sphinx/conf.py.in
index d81bbcf..eb24a6e 100644
--- a/Utilities/Sphinx/conf.py.in
+++ b/Utilities/Sphinx/conf.py.in
@@ -31,6 +31,8 @@ exclude_patterns = []
extensions = ['cmake']
templates_path = ['@conf_path@/templates']
+nitpicky = True
+
cmake_manuals = sorted(glob.glob(r'@conf_docs@/manual/*.rst'))
cmake_manual_description = re.compile('^\.\. cmake-manual-description:(.*)$')
man_pages = []
@@ -60,7 +62,7 @@ html_style = 'cmake.css'
html_theme = 'default'
html_title = 'CMake %s Documentation' % release
html_short_title = '%s Documentation' % release
-html_favicon = 'cmake-favicon.ico'
+html_favicon = '@conf_path@/static/cmake-favicon.ico'
# Not supported yet by sphinx:
# https://bitbucket.org/birkenfeld/sphinx/issue/1448/make-qthelp-more-configurable
# qthelp_namespace = "org.cmake"
diff --git a/Utilities/Sphinx/create_identifiers.py b/Utilities/Sphinx/create_identifiers.py
index 7715e53..3fe3fcb 100755
--- a/Utilities/Sphinx/create_identifiers.py
+++ b/Utilities/Sphinx/create_identifiers.py
@@ -34,7 +34,7 @@ for line in lines:
for domain_object_string, domain_object_type in mapping:
if "<keyword name=\"" + domain_object_string + "\"" in line:
- if not "id=\"" in line:
+ if not "id=\"" in line and not "#index-" in line:
prefix = "<keyword name=\"" + domain_object_string + "\" "
part1, part2 = line.split(prefix)
head, tail = part2.split("#" + domain_object_type + ":")
diff --git a/Utilities/cmliblzma/CMakeLists.txt b/Utilities/cmliblzma/CMakeLists.txt
index c03147f..d991438 100644
--- a/Utilities/cmliblzma/CMakeLists.txt
+++ b/Utilities/cmliblzma/CMakeLists.txt
@@ -95,6 +95,7 @@ CHECK_TYPE_SIZE("unsigned short" SIZE_OF_UNSIGNED_SHORT)
CHECK_TYPE_SIZE("unsigned" SIZE_OF_UNSIGNED)
CHECK_TYPE_SIZE("unsigned long" SIZE_OF_UNSIGNED_LONG)
CHECK_TYPE_SIZE("unsigned long long" SIZE_OF_UNSIGNED_LONG_LONG)
+CHECK_TYPE_SIZE("size_t" SIZE_OF_SIZE_T)
CHECK_TYPE_SIZE("__int64" __INT64)
CHECK_TYPE_SIZE("unsigned __int64" UNSIGNED___INT64)
diff --git a/Utilities/cmliblzma/common/sysdefs.h b/Utilities/cmliblzma/common/sysdefs.h
index c84f01c..a6edea8 100644
--- a/Utilities/cmliblzma/common/sysdefs.h
+++ b/Utilities/cmliblzma/common/sysdefs.h
@@ -124,9 +124,9 @@
// The code currently assumes that size_t is either 32-bit or 64-bit.
#ifndef SIZE_MAX
-# if SIZEOF_SIZE_T == 4
+# if SIZE_OF_SIZE_T == 4
# define SIZE_MAX UINT32_MAX
-# elif SIZEOF_SIZE_T == 8
+# elif SIZE_OF_SIZE_T == 8
# define SIZE_MAX UINT64_MAX
# else
# error size_t is not 32-bit or 64-bit
diff --git a/Utilities/cmliblzma/config.h.in b/Utilities/cmliblzma/config.h.in
index b197f27..017c435 100644
--- a/Utilities/cmliblzma/config.h.in
+++ b/Utilities/cmliblzma/config.h.in
@@ -29,6 +29,7 @@
@SIZE_OF_UNSIGNED_CODE@
@SIZE_OF_UNSIGNED_LONG_CODE@
@SIZE_OF_UNSIGNED_LONG_LONG_CODE@
+@SIZE_OF_SIZE_T_CODE@
/*
* If we lack int64_t, define it to the first of __int64, int, long, and long long
@@ -277,9 +278,6 @@ typedef uint64_t uintmax_t;
/* Define to 1 if the system has the type `_Bool'. */
#cmakedefine HAVE__BOOL 1
-/* The size of `size_t', as computed by sizeof. */
-#cmakedefine SIZEOF_SIZE_T @SIZEOF_SIZE_T@
-
/* Define to 1 if the system supports fast unaligned access to 16-bit and
32-bit integers. */
#define TUKLIB_FAST_UNALIGNED_ACCESS 1