kicad: add sanitizeAddress & sanitizeThreads options

only kicad 5.99 or later are affected
was briefly -DKICAD_SANITIZE=ON
are mutually exclusive according to a compiler error
This commit is contained in:
Evils 2021-01-23 10:58:33 +01:00
parent e37d772beb
commit e2661b00f7
2 changed files with 16 additions and 1 deletions

View File

@ -50,12 +50,18 @@
, withNgspice
, withScripting
, debug
, sanitizeAddress
, sanitizeThreads
, withI18n
}:
assert lib.asserts.assertMsg (!(withOCE && stdenv.isAarch64)) "OCE fails a test on Aarch64";
assert lib.asserts.assertMsg (!(withOCC && withOCE))
"Only one of OCC and OCE may be enabled";
assert lib.assertMsg (!(stable && (sanitizeAddress || sanitizeThreads)))
"Only kicad-unstable(-small) supports address/thread sanitation";
assert lib.assertMsg (!(sanitizeAddress && sanitizeThreads))
"'sanitizeAddress' and 'sanitizeThreads' are mutually exclusive, use one.";
let
inherit (lib) optional optionals;
in
@ -98,6 +104,12 @@ stdenv.mkDerivation rec {
"-DCMAKE_BUILD_TYPE=Debug"
"-DKICAD_STDLIB_DEBUG=ON"
"-DKICAD_USE_VALGRIND=ON"
]
++ optionals (sanitizeAddress) [
"-DKICAD_SANITIZE_ADDRESS=ON"
]
++ optionals (sanitizeThreads) [
"-DKICAD_SANITIZE_THREADS=ON"
];
nativeBuildInputs = [

View File

@ -25,6 +25,8 @@
, withScripting ? true
, python3
, debug ? false
, sanitizeAddress ? false
, sanitizeThreads ? false
, with3d ? true
, withI18n ? true
, srcs ? { }
@ -162,7 +164,8 @@ stdenv.mkDerivation rec {
inherit kicadSrc kicadVersion;
inherit (passthru) i18n;
inherit wxGTK python wxPython;
inherit debug withI18n withOCC withOCE withNgspice withScripting;
inherit withI18n withOCC withOCE withNgspice withScripting;
inherit debug sanitizeAddress sanitizeThreads;
};
inherit pname;