Skip to content

Commit 6c6d641

Browse files
committed
docs: LLVM version is 29b20829
The old instructions referred to 731264b0 version of LLVM. The binaries on the website provided for users were updated to 29b20829 and the install instructions were updated to reflect the preset examples. fix #462
1 parent 4e59401 commit 6c6d641

File tree

2 files changed

+181
-43
lines changed

2 files changed

+181
-43
lines changed

README.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Here are the instructions to install LLVM with the settings required by this pro
99
----
1010
git clone https://github.com/llvm/llvm-project.git
1111
cd llvm-project
12-
git checkout 731264b0c2af7aa46bd39625202a99e06cfccff9
12+
git checkout 29b20829cc6ce3e6d9c3809164994c1659e0da56
1313
cmake -S llvm -B build -D LLVM_ENABLE_PROJECTS="clang;clang-tools-extra" -D CMAKE_BUILD_TYPE=Release -D LLVM_ENABLE_RTTI=ON -D CMAKE_INSTALL_PREFIX=/path/to/llvm+clang
1414
cd build
1515
cmake --build . -j <threads> --config Release

docs/modules/ROOT/pages/install.adoc

+180-42
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
11
= Install
22

3+
[#mrdocs-binaries]
34
== Binaries
45

56
Binary packages are available from our https://github.com/cppalliance/mrdocs/releases[Release Page,window="_blank"]
67
78
== Source
89
9-
=== Cloning MrDocs
10-
1110
Clone the MrDocs repository with:
1211
1312
[source,bash]
1413
----
1514
git clone https://github.com/cppalliance/mrdocs
1615
----
1716
18-
=== Requirements
19-
20-
Create and go to the `third-party` directory, where we are going to download and install our custom dependencies:
17+
Also create and go to the `third-party` directory, where we are going to download and install our dependencies:
2118
2219
[source,bash]
2320
----
@@ -31,54 +28,168 @@ These instructions assume all dependencies are installed in the `third-party` di
3128
Fell free to install them anywhere you want and adjust the main MrDocs configuration command later.
3229
====
3330
34-
=== LLVM
35-
36-
MrDocs depends on a specific recent version of LLVM: https://github.com/llvm/llvm-project/tree/731264b0c2af7aa46bd39625202a99e06cfccff9[731264b0]
37-
38-
Because building LLVM may take many hours to complete, we provide pre-built binaries for Windows and Linux: https://mrdocs.com/llvm+clang/[LLVM Releases].
39-
You can download the binaries and uncompress them in the `./third-party/llvm+clang` directory.
31+
=== Installing LLVM
32+
33+
MrDocs uses LLVM to parse C++ code and extract documentation from it.
34+
It depends on a recent version of LLVM: https://github.com/llvm/llvm-project/tree/29b20829cc6ce3e6d9c3809164994c1659e0da56[29b20829]
35+
36+
[#llvm-binaries]
37+
**Binaries**:
38+
39+
Because building LLVM may take many hours to complete, we provide pre-built binaries for Windows and Linux:
40+
41+
|===
42+
| | https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html[CMake Preset,window=_blank] | https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html[CMake Build,window=_blank] | Debug Info | Optimized | https://learn.microsoft.com/en-us/visualstudio/ide/understanding-build-configurations?view=vs-2022[MSVC Build,window=_blank]
43+
44+
| 🪟 https://mrdox.com/llvm+clang/Windows-Release-29b20829.7z[`Windows-Release-29b20829.7z`]
45+
| 🚀 Release
46+
| 🚀 Release
47+
| ❌
48+
| ✅
49+
| 🚀 Release
50+
51+
| 🪟 https://mrdox.com/llvm+clang/Windows-Debug-29b20829.7z[`Windows-Debug-29b20829.7z`]
52+
| 🐞 Debug
53+
| 🐞 Debug
54+
| ✅
55+
| ❌
56+
| 🐞 Debug
57+
58+
| 🪟 https://mrdox.com/llvm+clang/Windows-RelWithDebInfo-29b20829.7z[`Windows-RelWithDebInfo-29b20829.7z`]
59+
| 🕵️‍♂️ RelWithDebInfo
60+
| 🕵️‍♂️ RelWithDebInfo
61+
| ✅
62+
| ✅
63+
| 🚀 Release
64+
65+
| 🪟 https://mrdox.com/llvm+clang/Windows-DebWithOpt-29b20829.7z[`Windows-DebWithOpt-29b20829.7z`]
66+
| 🔬 DebWithOpt
67+
| 🐞 Debug
68+
| ✅
69+
| ✅
70+
| 🐞 Debug
71+
72+
| 🐧 https://mrdox.com/llvm+clang/Linux-Release-29b20829.tar.xz[`Linux-Release-29b20829.tar.xz`]
73+
| 🚀 Release
74+
| 🚀 Release
75+
| ❌
76+
| ✅
77+
| N/A
78+
79+
| 🐧 https://mrdox.com/llvm+clang/Linux-Debug-29b20829.tar.xz[`Linux-Debug-29b20829.tar.xz`]
80+
| 🐞 Debug
81+
| 🐞 Debug
82+
| ✅
83+
| ❌
84+
| N/A
85+
86+
| 🐧 https://mrdox.com/llvm+clang/Linux-RelWithDebInfo-29b20829.tar.xz[`Linux-RelWithDebInfo-29b20829.tar.xz`]
87+
| 🕵️‍♂️ RelWithDebInfo
88+
| 🕵️‍♂️ RelWithDebInfo
89+
| ✅
90+
| ✅
91+
| N/A
92+
93+
| 🐧 https://mrdox.com/llvm+clang/Linux-DebWithOpt-29b20829.tar.xz[`Linux-DebWithOpt-29b20829.tar.xz`]
94+
| 🔬 DebWithOpt
95+
| 🐞 Debug
96+
| ✅
97+
| ✅
98+
| N/A
99+
|===
100+
101+
IMPORTANT: The Linux binaries are built on Ubuntu 22.04 and may not work on other distributions.
102+
103+
You can download the binaries and uncompress them in the `./third-party/llvm+clang` directory we created in the previous step.
104+
105+
LLVM binaries are provided in a number of preset configurations.
106+
Here is a brief description of each preset:
107+
108+
- `Release`: this is the preset users will typically use.
109+
It is optimized for speed and does not include debug information.
110+
- `Debug`: this is a preset developers can use.
111+
It includes debug information and no optimizations.
112+
However, using a `Debug` build of LLVM to debug MrDocs might be too slow.
113+
In this case, you can link MrDocs with `RelWithDebInfo` or `DebWithOpt`.
114+
- `RelWithDebInfo`: this is a release build with debug information.
115+
It is optimized for speed and includes debug information.
116+
However, if you are working with Windows+MSVC, this preset has a `Release` build type at the MSVC level.
117+
This means you can have conflicts with MrDocs in `Debug` mode because of LLVM setting flags such as the `_ITERATOR_DEBUG_LEVEL` and `/MDd`.
118+
In this case, you can use `DebWithOpt` instead to avoid the conflict and subsequent workarounds.
119+
- `DebWithOpt`: this is a debug build with optimizations.
120+
It includes all the default Debug flags for LLVM, it's optimized for speed, includes debug information, and causes no conflicts with MrDocs in `Debug` mode.
121+
122+
If you chose to use the provided binaries instead of building LLVM from source, you can skip to the <<duktape>> section.
123+
124+
**Download**:
40125
41126
Alternatively, if building LLVM from source, you can clone the project from the official repository:
42127
43128
[source,bash]
44129
----
45130
git clone https://github.com/llvm/llvm-project.git
46131
cd llvm-project
47-
git checkout 731264b0c2af7aa46bd39625202a99e06cfccff9
132+
git checkout 29b20829cc6ce3e6d9c3809164994c1659e0da56
133+
cd llvm
48134
----
49135
50-
Configure LLVM with the settings required by MrDocs:
136+
**Configure**:
51137
52-
Windows (from administrator `cmd.exe`, after running `vcvars64.bat`):
138+
There are two ways to configure LLVM: using <<llvm-configure-presets, CMake presets>> or using <<llvm-configure-cmd-line, CMake directly>>.
53139
54-
[source,commandline]
55-
----
56-
cmake -S llvm -B build -G "Visual Studio 17 2022" -A x64 -D LLVM_ENABLE_PROJECTS="clang;clang-tools-extra" -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
57-
----
140+
[#llvm-configure-presets]
141+
_Configure with CMake Presets_
58142

59-
Unix variants:
143+
We recommend using https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html[CMake presets,window=_blank] to build LLVM.
144+
Preset files contain a replicable set of CMake configuration values that can be used to configure a project.
145+
146+
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.
147+
Copy these files to the `llvm-project/llvm` directory and run a command such as the following to configure LLVM:
60148
61149
[source,bash]
62150
----
63-
cmake -S llvm -B build -D LLVM_ENABLE_PROJECTS="clang;clang-tools-extra" -D CMAKE_BUILD_TYPE=RelWithDebInfo -D LLVM_ENABLE_RTTI=ON -D CMAKE_INSTALL_PREFIX=../llvm+clang/RelWithDebInfo
151+
cmake -preset=relwithdebinfo-win
64152
----
65153
66-
As you can see from the step above, we configure a `RelWithDebInfo` version of LLVM for MrDocs by default.
67-
This is a release build with debug information.
68-
Other possible CMake configurations supported by LLVM are `Debug` (including debug information and no optimizations), `Release` (including optimizations and no debug information), and `MinSizeRel` (which optimizes for size).
154+
In the example above, we configure a `RelWithDebInfo` version of LLVM for MrDocs: a release build with debug information.
155+
156+
Choose one of the presets from `CMakePresets.json` or edit the variants in `CMakeUserPresets.json` to customize the configurations.
157+
The `CMakeUserPresets.json` file comes with presets for all the configurations described in the <<llvm-binaries,Binaries>> section.
69158
70159
[NOTE]
71160
====
72161
Developers might also want to build a custom `Debug` LLVM configuration including optimizations, which allows for faster execution of tests.
73-
To create such an installation, set `CMAKE_CONFIGURATION_TYPES` or `CMAKE_BUILD_TYPE` to `Debug` and manually include the optimization flags to `-D CMAKE_CXX_FLAGS="/O2 /Zi"` (MSVC) or `-D CMAKE_CXX_FLAGS="-Og -g"`.
162+
The `relwithdebinfo` and `debwithopt` presets are provided for this purpose.
163+
Or if you prefer using the command line, set `CMAKE_CONFIGURATION_TYPES` or `CMAKE_BUILD_TYPE` to `Debug` and manually include the optimization flags to `-D CMAKE_CXX_FLAGS="/O2 /Zi"` (MSVC) or `-D CMAKE_CXX_FLAGS="-Og -g"`.
74164
75165
This should give you an optimized build with all debug features and flags, such as an appropriate https://learn.microsoft.com/en-us/cpp/standard-library/iterator-debug-level[`_ITERATOR_DEBUG_LEVEL`] and the `/MDd` flag in MSVC.
76166
In other platforms, this should give you a release somewhat equivalent to `RelWithDebInfo` optimized for debugging experience. `-Og` offers a reasonable level of optimization while maintaining fast compilation and a good debugging experience.
77-
78-
This custom configuration can be installed in an alternative directory, such as `../llvm+clang/DebWithOpt`, to be used by the MrDocs `Debug` builds by developers.
79167
====
80168
81-
Then build and install it:
169+
[#llvm-configure-cmd-line]
170+
_Configure with Command Line Arguments_:
171+
172+
You can also configure LLVM directly with the settings required by MrDocs:
173+
174+
Windows (from administrator `cmd.exe`, after running `vcvars64.bat`):
175+
176+
[source,commandline]
177+
----
178+
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
179+
----
180+
181+
Unix variants:
182+
183+
[source,bash]
184+
----
185+
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
186+
----
187+
188+
Unlike the <<llvm-configure-presets,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.
189+
190+
**Build**:
191+
192+
Build and install the configured version of LLVM with:
82193

83194
[source,bash]
84195
----
@@ -87,16 +198,27 @@ cmake --build . --config RelWithDebInfo
87198
cmake --install . --prefix ../../llvm+clang/RelWithDebInfo" --config RelWithDebInfo
88199
----
89200

201+
If you prefer using the provided CMake presets, you can also use the `--preset` option for the `build` command:
202+
203+
[source,bash]
204+
----
205+
cd build
206+
cmake --build --preset=relwithdebinfo-win
207+
cmake --install MSVC/RelWithDebInfo --config RelWithDebInfo
208+
----
209+
90210
Return from `./third-party/llvm-project/build` to the parent `third-party` directory to install other dependencies:
91211

92212
[source,bash]
93213
----
94214
cd ../..
95215
----
96216

97-
==== Duktape
217+
[#duktape]
218+
=== Downloading Duktape
98219

99-
Duktape is a JavaScript engine that is used by MrDocs to parse and evaluate JavaScript code.
220+
MrDocs contains functionality to allow users to define their own templates for the documentation.
221+
Duktape is a JavaScript engine that is used by MrDocs to parse and evaluate template helpers.
100222

101223
The release files can be obtained from the Duktape repository:
102224

@@ -107,7 +229,8 @@ tar -xvf "duktape-2.7.0.tar.xz"
107229
----
108230

109231
Duktape provides no CMake integration scripts.
110-
The MrDocs configuration script needs direct access to the installed source files for Duktape so that's all you need to do.
232+
For this reason, MrDocs needs direct access to the source files for Duktape.
233+
This means that's all you need to do for `duktape`.
111234

112235
=== CMake dependencies
113236

@@ -155,7 +278,7 @@ vcpkg has two operation modes with which you can install these dependencies: <<v
155278
[#vcpkg-classic-mode]
156279
_Classic mode_:
157280

158-
In vcpkg @https://learn.microsoft.com/en-us/vcpkg/users/classic-mode[classic mode,window=blank_], vcpkg maintains a central installed tree inside the vcpkg instance built up by individual vcpkg install and vcpkg remove commands.
281+
In vcpkg https://learn.microsoft.com/en-us/vcpkg/users/classic-mode[classic mode,window=blank_], vcpkg maintains a central installed tree inside the vcpkg instance built up by individual `vcpkg install` and `vcpkg remove` commands.
159282
This central set of packages can then be shared by any number of projects.
160283
However, each instance of vcpkg (a separate git clone) will have its own set of packages installed.
161284

@@ -178,16 +301,30 @@ Unix variants:
178301
[#vcpkg-manifest-mode]
179302
_Manifest mode_:
180303

181-
In @https://learn.microsoft.com/en-us/vcpkg/users/manifests[manifest mode,windows=blank_], you declare your project's direct dependencies in a manifest file named `vcpkg.json`.
304+
In https://learn.microsoft.com/en-us/vcpkg/users/manifests[manifest mode,windows=blank_], you declare your project's direct dependencies in a manifest file named `vcpkg.json`.
182305
MrDocs includes a `vcpkg.json.example` file you can duplicate or create a symlink as `vcpkg.json` to use this mode.
183306
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.
184307

185308
In this mode, vcpkg will create separate installed trees for each project and configuration.
186-
This is the recommended vcpkg mode for most users according to the @https://learn.microsoft.com/en-us/vcpkg/users/manifests[vcpkg documentation,window=blank_].
309+
This is the recommended vcpkg mode for most users according to the https://learn.microsoft.com/en-us/vcpkg/users/manifests[vcpkg documentation,window=blank_].
187310

188311
=== MrDocs
189312

190-
Once the dependencies are available in `third-party`, you can configure MrDocs with:
313+
Return from `./third-party/vcpkg` to the parent directory of `third-party` (the one containing the `mrdocs` directory) to build and install MrDocs:
314+
315+
[source,bash]
316+
----
317+
cd ../..
318+
----
319+
320+
**Configure**:
321+
322+
You can also configure MrDocs with <<mrdocs-configure-cmd-line, command line arguments>> or <<mrdocs-configure-presets, CMake presets>>.
323+
324+
[#mrdocs-configure-cmd-line]
325+
_Configure with Command Line Arguments_:
326+
327+
With the dependencies are available in `third-party`, you can configure MrDocs with:
191328

192329
Windows:
193330

@@ -203,19 +340,20 @@ Unix variants:
203340
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"
204341
----
205342

206-
[TIP]
207-
====
343+
[#mrdocs-configure-presets]
344+
_Configure with CMake Presets_:
345+
208346
The MrDocs repository also includes a `CMakePresets.json` file that contains the parameters to configure MrDocs with CMake.
209347

210348
To specify the installation directories, you can use the `LLVM_ROOT`, `DUKTAPE_SOURCE_ROOT`, `CMAKE_TOOLCHAIN_FILE` environment variables.
211349
To specify a generator (`-G`) and platform name (`-A`), you can use the `CMAKE_GENERATOR` and `CMAKE_GENERATOR_PLATFORM` environment variables.
212350

213-
Alternatively, you can create a `CMakeUserPresets.json` file in the `mrdocs` directory with the specific values you want to override in each configuration.
214-
This is typically more convenient than using environment variables when working on an IDE.
215-
The repository includes a `CMakeUserPresets.json.example` file that can be used as a template.
216-
====
351+
You can also customize the presets by duplicating and editing the `CMakeUserPresets.json.example` file in the `mrdocs` directory.
352+
This is typically more convenient than using environment variables.
353+
354+
**Build**:
217355

218-
Then build and install it with:
356+
Then build and install MrDocs with:
219357

220358
[source,bash]
221359
----
@@ -230,7 +368,7 @@ To customize the C and C++ compilers, use the `CMAKE_C_COMPILER` and `CMAKE_CXX_
230368
[NOTE]
231369
====
232370
Developers should also enable `-D BUILD_TESTING=ON`.
233-
If any custom build of LLVM is being used (such as `DebWithOpt`), the `LLVM_ROOT` variable should be set to the installation directory of that build.
371+
If any custom build of LLVM other than `RelWithDebInfo` is being used, the `LLVM_ROOT` variable should be set to the installation directory of that build.
234372
====
235373

236374
== Package layout

0 commit comments

Comments
 (0)