Install
Binaries
Binary packages are available from our Release Page
Source
Clone the MrDocs repository with:
git clone https://github.com/cppalliance/mrdocs
Also create and go to the third-party
directory, where we are going to download and install our dependencies:
mkdir third-party
cd third-party
These instructions assume all dependencies are installed in the |
Installing LLVM
MrDocs uses LLVM to parse C++ code and extract documentation from it. It depends on a recent version of LLVM: 29b20829
Binaries:
Because building LLVM may take many hours to complete, we provide pre-built binaries for Windows and Linux:
CMake Preset | CMake Build | Debug Info | Optimized | MSVC Build | |
---|---|---|---|---|---|
🚀 Release |
🚀 Release |
❌ |
✅ |
🚀 Release |
|
🐞 Debug |
🐞 Debug |
✅ |
❌ |
🐞 Debug |
|
🕵️♂️ RelWithDebInfo |
🕵️♂️ RelWithDebInfo |
✅ |
✅ |
🚀 Release |
|
🔬 DebWithOpt |
🐞 Debug |
✅ |
✅ |
🐞 Debug |
|
🚀 Release |
🚀 Release |
❌ |
✅ |
N/A |
|
🐞 Debug |
🐞 Debug |
✅ |
❌ |
N/A |
|
🕵️♂️ RelWithDebInfo |
🕵️♂️ RelWithDebInfo |
✅ |
✅ |
N/A |
|
🔬 DebWithOpt |
🐞 Debug |
✅ |
✅ |
N/A |
The Linux binaries are built on Ubuntu 22.04 and may not work on other distributions. |
You can download the binaries and uncompress them in the ./third-party/llvm+clang
directory we created in the previous step.
LLVM binaries are provided in a number of preset configurations. Here is a brief description of each preset:
-
Release
: this is the preset users will typically use. It is optimized for speed and does not include debug information. -
Debug
: this is a preset developers can use. It includes debug information and no optimizations. However, using aDebug
build of LLVM to debug MrDocs might be too slow. In this case, you can link MrDocs withRelWithDebInfo
orDebWithOpt
. -
RelWithDebInfo
: this is a release build with debug information. It is optimized for speed and includes debug information. However, if you are working with Windows+MSVC, this preset has aRelease
build type at the MSVC level. This means you can have conflicts with MrDocs inDebug
mode because of LLVM setting flags such as the_ITERATOR_DEBUG_LEVEL
and/MDd
. In this case, you can useDebWithOpt
instead to avoid the conflict and subsequent workarounds. -
DebWithOpt
: this is a debug build with optimizations. It includes all the default Debug flags for LLVM, it’s optimized for speed, includes debug information, and causes no conflicts with MrDocs inDebug
mode.
If you chose to use the provided binaries instead of building LLVM from source, you can skip to the [duktape] section.
Download:
Alternatively, if building LLVM from source, you can clone the project from the official repository:
git clone https://github.com/llvm/llvm-project.git
cd llvm-project
git checkout 29b20829cc6ce3e6d9c3809164994c1659e0da56
cd llvm
Configure:
There are two ways to configure LLVM: using CMake presets or using CMake directly.
Configure with CMake Presets
We recommend using CMake presets to build LLVM. Preset files contain a replicable set of CMake configuration values that can be used to configure a project.
Instead of passing all CMake configuration values on the command line, a template for the CMakePresets.json
and CMakeUserPresets.json
files is provided in the repository’s third-party/llvm
directory.
Copy these files to the llvm-project/llvm
directory and run a command such as the following to configure LLVM:
cmake -preset=relwithdebinfo-win
In the example above, we configure a RelWithDebInfo
version of LLVM for MrDocs: a release build with debug information.
Choose one of the presets from CMakePresets.json
or edit the variants in CMakeUserPresets.json
to customize the configurations.
The CMakeUserPresets.json
file comes with presets for all the configurations described in the Binaries section.
Developers might also want to build a custom This should give you an optimized build with all debug features and flags, such as an appropriate |
Configure with Command Line Arguments:
You can also configure LLVM directly with the settings required by MrDocs:
Windows (from administrator cmd.exe
, after running vcvars64.bat
):
cmake -S llvm -B build/MSVC/RelWithDebInfo -G "Ninja" -A x64 -D LLVM_ENABLE_PROJECTS="clang" -D CMAKE_CONFIGURATION_TYPES="RelWithDebInfo" -D LLVM_ENABLE_RTTI=ON -D CMAKE_INSTALL_PREFIX=../llvm+clang/RelWithDebInfo -D LLVM_ENABLE_IDE=OFF -D LLVM_ENABLE_DIA_SDK=OFF
Unix variants:
cmake -S llvm -B build/Linux/RelWithDebInfo -D LLVM_ENABLE_PROJECTS="clang" -D CMAKE_BUILD_TYPE=RelWithDebInfo -D LLVM_ENABLE_RTTI=ON -D CMAKE_INSTALL_PREFIX=../llvm+clang/RelWithDebInfo
Unlike the CMake presets, this command does not a number of parameters that removes features that are not required by MrDocs, thus increasing the build time and size of the installation.
Build:
Build and install the configured version of LLVM with:
cd build
cmake --build . --config RelWithDebInfo
cmake --install . --prefix ../../llvm+clang/RelWithDebInfo" --config RelWithDebInfo
If you prefer using the provided CMake presets, you can also use the --preset
option for the build
command:
cd build
cmake --build --preset=relwithdebinfo-win
cmake --install MSVC/RelWithDebInfo --config RelWithDebInfo
Return from ./third-party/llvm-project/build
to the parent third-party
directory to install other dependencies:
cd ../..
CMake dependencies
All other dependencies provide CMake integration scripts and can be obtained from vcpkg or installed manually.
-
fmt
>= 10 -
duktape
For development builds, which include tests, you will also need:
-
libxml2[tools]
The instructions in this documentation will use vcpkg for these.
Installing vcpkg:
If you don’t have vcpkg installed, clone the repository:
git clone https://github.com/microsoft/vcpkg.git -b master
cd vcpkg
and bootstrap it:
Windows:
bootstrap-vcpkg.bat
Unix variants:
./bootstrap-vcpkg.sh
Installing dependencies:
vcpkg has two operation modes with which you can install these dependencies: classic mode and manifest mode.
Classic mode:
In vcpkg classic mode, vcpkg maintains a central installed tree inside the vcpkg instance built up by individual vcpkg install
and vcpkg remove
commands.
This central set of packages can then be shared by any number of projects.
However, each instance of vcpkg (a separate git clone) will have its own set of packages installed.
To install these dependencies with vcpkg in classic mode:
Windows:
vcpkg.exe fmt zlib libxml2[tools] --triplet x64-windows
Unix variants:
./vcpkg fmt zlib libxml2[tools]
Manifest mode:
In manifest mode, you declare your project’s direct dependencies in a manifest file named vcpkg.json
.
MrDocs includes a vcpkg.json.example
file you can duplicate or create a symlink as vcpkg.json
to use this mode.
MrDocs is a CMake project that then already includes a vcpkg.json
file, there’s nothing else you need to run to install the dependencies.
In this mode, vcpkg will create separate installed trees for each project and configuration. This is the recommended vcpkg mode for most users according to the vcpkg documentation.
MrDocs
Return from ./third-party/vcpkg
to the parent directory of third-party
(the one containing the mrdocs
directory) to build and install MrDocs:
cd ../..
Configure:
You can also configure MrDocs with command line arguments or CMake presets.
Configure with Command Line Arguments:
With the dependencies are available in third-party
, you can configure MrDocs with:
Windows:
cmake -S mrdocs -B build -G "Visual Studio 17 2022" -A x64 -D CMAKE_CONFIGURATION_TYPES="RelWithDebInfo" -D CMAKE_EXPORT_COMPILE_COMMANDS=ON -D LLVM_ROOT="%cd%/third-party/llvm+clang/RelWithDebInfo" -D DUKTAPE_SOURCE_ROOT="%cd%/third-party/duktape-2.7.0" -D CMAKE_TOOLCHAIN_FILE="%cd%/third-party/vcpkg/scripts/buildsystems/vcpkg.cmake"
Unix variants:
cmake -S mrdocs -B build -D CMAKE_BUILD_TYPE=RelWithDebInfo -D CMAKE_EXPORT_COMPILE_COMMANDS=ON -D LLVM_ROOT="$(pwd)/third-party/llvm+clang/RelWithDebInfo" -D DUKTAPE_SOURCE_ROOT="$(pwd)/third-party/duktape-2.7.0" -D CMAKE_TOOLCHAIN_FILE="$(pwd)/third-party/vcpkg/scripts/buildsystems/vcpkg.cmake"
Configure with CMake Presets:
The MrDocs repository also includes a CMakePresets.json
file that contains the parameters to configure MrDocs with CMake.
To specify the installation directories, you can use the LLVM_ROOT
, DUKTAPE_SOURCE_ROOT
, CMAKE_TOOLCHAIN_FILE
environment variables.
To specify a generator (-G
) and platform name (-A
), you can use the CMAKE_GENERATOR
and CMAKE_GENERATOR_PLATFORM
environment variables.
You can also customize the presets by duplicating and editing the CMakeUserPresets.json.example
file in the mrdocs
directory.
This is typically more convenient than using environment variables.
Build:
Then build and install MrDocs with:
cd build
cmake --build .
cmake --install .
To customize the installation directory, use the CMAKE_INSTALL_PREFIX
option or use the --prefix
option for the cmake --install .
command.
To customize the C and C++ compilers, use the CMAKE_C_COMPILER
and CMAKE_CXX_COMPILER
options.
Developers should also enable |
Package layout
The MrDocs installation directory follows the "Filesystem Hierarchy Standard" (FHS) layout:
-
bin
: the MrDocs executable intended to be used by users or invoked from the command line. -
share
: resource files installed by MrDocs -
doc
: the MrDocs documentation -
include
: the MrDocs headers -
lib
: the MrDocs library
The FHS layout provides a directory structure that also serves as a widely accepted convention for organizing files and directories in Unix-like systems, but that can be used in any operating system.