Skip to content

Instantly share code, notes, and snippets.

@broadwaylamb
Last active September 9, 2024 14:15
Show Gist options
  • Save broadwaylamb/aeef39ec6f041be081b2100392d889b9 to your computer and use it in GitHub Desktop.
Save broadwaylamb/aeef39ec6f041be081b2100392d889b9 to your computer and use it in GitHub Desktop.
How to generate an LLVM docset for Dash

How to generate an LLVM docset for Dash

Assuming that we've already checked out LLVM from the git repo into a directory named e. g. llvm-project, we're gonna need to run the CMake configuration.

Inside the llvm-project directory let's create the build folder, and then run CMake from that folder:

$ cd llvm-project
$ mkdir build
$ cmake ../llvm \
-DLLVM_BUILD_DOC=ON \
-DLLVM_ENABLE_DOXYGEN=ON \
-DLLVM_DOXYGEN_SVG=ON

The latter one (LLVM_DOXYGEN_SVG=ON) is optional and is needed only if you want the class diagrams to be saved as SVGs instead of PNGs. You'll need the dot tool for that. This tool is part of Graphviz.

After executing these commands a Makefile and a doxygen.cfg will be generated in the build/docs folder.

We need to change some variables in doxygen.cfg to have the following values:

GENERATE_DOCSET = YES
DOCSET_BUNDLE_ID = org.doxygen.LLVM.docs
DOCSET_PUBLISHER_ID = org.doxygen.LLVM
DISABLE_INDEX = YES
GENERATE_TREEVIEW = NO
SEARCHENGINE = NO

If you've decided to generate diagrams in SVG format, make sure to also seth these:

HAVE_DOT = YES
DOT_IMAGE_FORMAT = svg
INTERACTIVE_SVG = YES
DOT_PATH = /usr/local/bin/dot
DOT_TRANSPARENT = YES

Run the Makefile in the build/docs directory:

$ cd docs
$ make doxygen-llvm

The HTML documentation will be generated, but we're not done yet.

Now you need to get the docsetutil tool. It used to be a part of Xcode until Xcode 9.3. See this comment on GitHub.

Assuming that you've downloaded docsetutil from the link above into a directory DocSetUtil (that directory must contains subdirectories Developer, SharedFrameworks and Frameworks), go to the build/docs/doxygen/html directory and run:

$ cd doxygen/html
$ make XCODE_INSTALL=DocSetUtil/Developer all

The docset will be generated. This will take quite some time and disk space (~13 GB).

When the docset is ready, the .docset file will be generated in the html directory.

We need to add an 32x32 icon to it (which can be obtained from the LLVM website).

cp <path-to-icon> org.doxygen.LLVM.docs.docset/[email protected]

Let's support online redirection:

Set the DashDocSetFallbackURL key in the docset's Info.plist to http://llvm.org/doxygen/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment