From 9ad5336d831fd650050784bcb553a02087289e6b Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Thu, 30 May 2024 21:22:59 +0200 Subject: [PATCH] Added documentation about clang-uml-wrapped script for Nix --- docs/common_options.md | 9 +++++++++ docs/troubleshooting.md | 6 +++--- packaging/nix/default.nix | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/docs/common_options.md b/docs/common_options.md index c8fea3ba..83abcf84 100644 --- a/docs/common_options.md +++ b/docs/common_options.md @@ -11,6 +11,7 @@ * [Use '--query-driver' command line option](#use---query-driver-command-line-option) * [Manually add and remove compile flags from the compilation database](#manually-add-and-remove-compile-flags-from-the-compilation-database) * [Using 'CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES'](#using-cmake_cxx_implicit_include_directories) + * [Nix wrapper](#nix-wrapper) @@ -224,4 +225,12 @@ Yet another option, for CMake based projects, is to use the following CMake opti set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}) ``` +### Nix wrapper +On NixOS or when using `nix`, `clang-uml` provides a wrapper script called +`clang-uml-wrapped`, which builds and exports `CPATH` and `CPLUS_INCLUDE_PATH` +environment variables before running `clang-uml`, which contain valid +system header Clang paths for the current Nix environment. +The `clang-uml-wrapped` script can be called the same way as `clang-uml` and +should resolve the system include paths without the need for any of the above +solutions. diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index 014c6c38..858b78da 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -11,8 +11,8 @@ * [Cannot generate diagrams from header-only projects](#cannot-generate-diagrams-from-header-only-projects) * [YAML anchors and aliases are not fully supported](#yaml-anchors-and-aliases-are-not-fully-supported) * [Schema validation error is thrown, but the configuration file is correct](#schema-validation-error-is-thrown-but-the-configuration-file-is-correct) -* [Class diagrams](#class-diagrams) * ["fatal error: 'stddef.h' file not found"](#fatal-error-stddefh-file-not-found) +* [Class diagrams](#class-diagrams) * [How can I generate class diagram of my entire project](#how-can-i-generate-class-diagram-of-my-entire-project) * [Cannot generate classes for 'std' namespace](#cannot-generate-classes-for-std-namespace) * [Sequence diagrams](#sequence-diagrams) @@ -224,8 +224,6 @@ schema validation, and exits if the configuration file is invalid. In case there is a bug in the schema validation, the schema validation step can be skipped by providing `--no-validate` command line option. -## Class diagrams - ### "fatal error: 'stddef.h' file not found" This error means that Clang cannot find some standard headers in include @@ -285,6 +283,8 @@ clang-uml --add-compile-flag -I/opt/my_toolchain/include \ Also see [here](./md_docs_2common__options.html#resolving-include-path-and-compiler-flags-issues). +## Class diagrams + ### How can I generate class diagram of my entire project I want to generate a diagram containing all classes and relationships in my diff --git a/packaging/nix/default.nix b/packaging/nix/default.nix index 56fa5594..f6571b2c 100644 --- a/packaging/nix/default.nix +++ b/packaging/nix/default.nix @@ -32,7 +32,7 @@ stdenv.mkDerivation { postInstall = '' export unwrapped_clang_uml="$out/bin/clang-uml" - # inject clang and unwrapp_clang_uml variables into wrapper + # inject clang and unwrap_clang_uml variables into wrapper substituteAll ${./wrapper} $out/bin/clang-uml-wrapped chmod +x $out/bin/clang-uml-wrapped