diff --git a/CMakeLists.txt b/CMakeLists.txt index e27a71b..1f0128e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,6 +67,7 @@ find_program(IWYU NAMES include-what-you-use iwyu) if(IWYU) set(IWYU_CMD ${IWYU} -Xiwyu --no_comments) set(CMAKE_C_INCLUDE_WHAT_YOU_USE ${IWYU_CMD}) + message(STATUS "IWYU found") else() message(WARNING "IWYU not found, skipping") endif() diff --git a/nix/ovni.nix b/nix/ovni.nix index fd010bb..5f024af 100644 --- a/nix/ovni.nix +++ b/nix/ovni.nix @@ -2,13 +2,12 @@ stdenv , cmake , mpi -, include-what-you-use }: stdenv.mkDerivation rec { name = "ovni"; - buildInputs = [ cmake mpi include-what-you-use ]; + buildInputs = [ cmake mpi ]; # Prevent accidental reutilization of previous builds, as we are taking the # current directory as-is diff --git a/nix/rt.nix b/nix/rt.nix index 23ce07d..86302fb 100644 --- a/nix/rt.nix +++ b/nix/rt.nix @@ -11,6 +11,20 @@ let mpi = last.impi; #mpi = last.openmpi; + include-what-you-use = let + gcc = pkgs.gcc; + targetConfig = pkgs.stdenv.targetPlatform.config; + in pkgs.wrapCCWith rec { + cc = pkgs.include-what-you-use; + extraBuildCommands = '' + echo "--gcc-toolchain=${gcc}" >> $out/nix-support/cc-cflags + echo "-B${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}" >> $out/nix-support/cc-cflags + echo "-isystem${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}/include" >> $out/nix-support/cc-cflags + wrap include-what-you-use $wrapper $ccPath/include-what-you-use + substituteInPlace "$out/bin/include-what-you-use" --replace 'dontLink=0' 'dontLink=1' + ''; + }; + ovni = last.callPackage ./ovni.nix { }; # Use a fixed version to compile Nanos6 and nOS-V, so we don't need to @@ -132,6 +146,7 @@ let }).overrideAttrs (old: { __noChroot = true; buildInputs = old.buildInputs ++ [ + last.include-what-you-use pkgs.gdb last.nosv last.nanos6