You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This change makes mrdocs use the system includes by default instead of
the bundled ones.
This helps mrdocs build projects which rely on differences between
standard library implementations, since now mrdocs sees the source code
closer to what the original compiler did, with only potential differences in the
compilers themselves and some minor command line manipulations remaining.
It also stops bundling the clang resource directory, relying on the one
installed with libclang. This makes it so installing both to the same
prefix be necessary, which is the same as all the other libclang based tools.
---------
Co-authored-by: Agustin Berge <[email protected]>
To customize the installation directory, use the `CMAKE_INSTALL_PREFIX` option or use the `--prefix` option for the `cmake --install .` command.
322
328
To customize the C and C++ compilers, use the `CMAKE_C_COMPILER` and `CMAKE_CXX_COMPILER` options.
323
329
330
+
[IMPORTANT]
331
+
====
332
+
The `--prefix` for MrDocs installation *must* match the installation prefix used for LLVM/Clang.
333
+
This is critical for proper runtime resolution of the Clang resource directory.
334
+
For example, if LLVM was installed to `/opt/llvm`, then install MrDocs with `cmake --install . --prefix /opt/llvm`.
335
+
====
336
+
324
337
[NOTE]
325
338
====
326
339
Developers should also enable `-D BUILD_TESTING=ON`.
@@ -337,3 +350,10 @@ The MrDocs installation directory follows the "Filesystem Hierarchy Standard" (F
337
350
* `lib`: the MrDocs library
338
351
339
352
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.
353
+
354
+
[IMPORTANT]
355
+
====
356
+
The MrDocs binary must be installed in the same installation prefix as the Clang library it was built from.
357
+
This is required because the Clang resource directory location is resolved relative to the MrDocs executable at runtime.
358
+
When installing both LLVM/Clang and MrDocs, ensure they share the same `CMAKE_INSTALL_PREFIX`.
Copy file name to clipboardExpand all lines: docs/modules/ROOT/pages/usage.adoc
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -278,7 +278,7 @@ It's also common for libraries to depend on the C++ standard library, the C stan
278
278
279
279
That means unless `-nostdinc` is defined, all systems include paths are included. This is what allows the user to also use headers like `<Windows.h>` or `<linux/version.h>` without explicitly including anything else, even though they are not part of the C standard library. This is often seen as a convenience but can lead to portability issues.
280
280
281
-
In this context, MrDocs provides the `use-system-stdlib` and `use-system-libc` options. Both are set as `false` by default, meaning MrDocs will compile the code as if the `-nostdinc++ -nostdlib++` and `-nostdinc` flags were passed to Clang. Additionally:
281
+
In this context, MrDocs provides the `use-system-stdlib` and `use-system-libc` options. Both are set as `true` by default; setting both to `false` results in MrDocs compiling the code as if the `-nostdinc++ -nostdlib++` and `-nostdinc` flags were passed to Clang. Additionally:
282
282
283
283
- When `use-system-stdlib` is `false`, MrDocs will use the bundled libc++ headers available in `<mrdocs-root>/share/mrdocs/headers/libcxx` and `<mrdocs-root>/share/mrdocs/headers/clang`. These paths can be adjusted with the `stdlib-includes` option.
284
284
- When `use-system-libc` is `false`, MrDocs will use the bundled libc stubs available in `<mrdocs-root>/share/mrdocs/headers/libc-stubs`. This path can be adjusted with the `libc-includes` option.
Copy file name to clipboardExpand all lines: docs/mrdocs.schema.json
+3-4Lines changed: 3 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -570,8 +570,7 @@
570
570
},
571
571
"stdlib-includes": {
572
572
"default": [
573
-
"<mrdocs-root>/share/mrdocs/headers/libcxx",
574
-
"<mrdocs-root>/share/mrdocs/headers/clang"
573
+
"<mrdocs-root>/share/mrdocs/headers/libcxx"
575
574
],
576
575
"description": "When `use-system-stdlib` is disabled, the C++ standard library headers are available in these paths.",
577
576
"items": {
@@ -611,7 +610,7 @@
611
610
"type": "string"
612
611
},
613
612
"use-system-libc": {
614
-
"default": false,
613
+
"default": true,
615
614
"description": "To achieve reproducible results, MrDocs bundles the LibC headers with its definitions. To use the C standard library available in the system instead, set this option to true.",
616
615
"enum": [
617
616
true,
@@ -621,7 +620,7 @@
621
620
"type": "boolean"
622
621
},
623
622
"use-system-stdlib": {
624
-
"default": false,
623
+
"default": true,
625
624
"description": "To achieve reproducible results, MrDocs bundles the LibC++ headers. To use the C++ standard library available in the system instead, set this option to true.",
0 commit comments