From 11dce6c2fa7dc39cd9e40c0fedda3280aa2757ad Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 30 Nov 2017 14:50:05 +0200 Subject: Implement module sidebuilds cleanup using scope operation callbacks --- build2/cc/compile.cxx | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'build2/cc/compile.cxx') diff --git a/build2/cc/compile.cxx b/build2/cc/compile.cxx index 0ab9bfc..ca07b42 100644 --- a/build2/cc/compile.cxx +++ b/build2/cc/compile.cxx @@ -3711,6 +3711,9 @@ namespace build2 // Use cc.core.vars as a proxy for {c,cxx}.config (a bit smelly). // + // This is also the module that registers the scope operation + // callback that cleans up the subproject. + // if (cast_false ((*s)["cc.core.vars.loaded"])) as = s; @@ -3723,11 +3726,7 @@ namespace build2 // So the first step is to check if the project has already been created // and/or loaded and if not, then to go ahead and do so. // - dir_path pd (as->out_path ()); - pd /= "build"; - pd /= "cc"; - pd /= "modules"; - pd /= x; + dir_path pd (as->out_path () / modules_sidebuild_dir /= x); { const scope* ps (&scopes.find (pd)); @@ -3758,18 +3757,17 @@ namespace build2 extra += string (x) + ".features.modules = true"; - dir_path ad (((dir_path ("..") /= "..") /= "..") /= ".."); - - config::create_project (pd, - ad, /* amalgamation */ - {}, /* boot_modules */ - extra, /* root_pre */ - {string (x) + '.'}, /* root_modules */ - "", /* root_post */ - false, /* config */ - false, /* buildfile */ - "the cc module", - 2); /* verbosity */ + config::create_project ( + pd, + as->out_path ().relative (pd), /* amalgamation */ + {}, /* boot_modules */ + extra, /* root_pre */ + {string (x) + '.'}, /* root_modules */ + "", /* root_post */ + false, /* config */ + false, /* buildfile */ + "the cc module", + 2); /* verbosity */ } ps = &load_project (as->rw () /* lock */, pd, pd); -- cgit v1.1