aboutsummaryrefslogtreecommitdiff
path: root/build2/cc
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-03-07 09:06:37 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-03-07 09:06:37 +0200
commit1845141809aa91b03718066a6f46863885a6a887 (patch)
treea3f542ec7c1781e65aa16a9b0d5c31eae4c4d757 /build2/cc
parente0002617846755fb5f199f40a677e16d6f69e5ec (diff)
Add support for alternative build file/directory naming scheme
Now the build/*.build, buildfile, and .buildignore filesystem entries in a project can alternatively (but consistently) be called build2/*.build2, build2file, and .build2ignore. See a note at the beginning of the Project Structure section in the manual for details (motivation, restrictions, etc).
Diffstat (limited to 'build2/cc')
-rw-r--r--build2/cc/compile-rule.cxx8
-rw-r--r--build2/cc/init.cxx8
-rw-r--r--build2/cc/utility.cxx2
-rw-r--r--build2/cc/utility.hxx8
4 files changed, 18 insertions, 8 deletions
diff --git a/build2/cc/compile-rule.cxx b/build2/cc/compile-rule.cxx
index eacce7b..e0faf7f 100644
--- a/build2/cc/compile-rule.cxx
+++ b/build2/cc/compile-rule.cxx
@@ -3922,7 +3922,10 @@ 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 () / modules_sidebuild_dir /= x);
+ dir_path pd (as->out_path () /
+ as->root_extra->build_dir /
+ modules_sidebuild_dir /=
+ x);
{
const scope* ps (&scopes.find (pd));
@@ -3942,7 +3945,8 @@ namespace build2
// The project might already be created in which case we just need
// to load it.
//
- if (!is_src_root (pd))
+ optional<bool> altn (false); // Standard naming scheme.
+ if (!is_src_root (pd, altn))
{
// Copy our standard and force modules.
//
diff --git a/build2/cc/init.cxx b/build2/cc/init.cxx
index edb9961..d9c1371 100644
--- a/build2/cc/init.cxx
+++ b/build2/cc/init.cxx
@@ -27,7 +27,9 @@ namespace build2
static target_state
clean_module_sidebuilds (action, const scope& rs, const dir&)
{
- dir_path d (rs.out_path () / modules_sidebuild_dir);
+ const dir_path& out_root (rs.out_path ());
+
+ dir_path d (out_root / rs.root_extra->build_dir / modules_sidebuild_dir);
if (exists (d))
{
@@ -35,7 +37,7 @@ namespace build2
{
// Clean up cc/ if it became empty.
//
- d = rs.out_path () / module_dir;
+ d = out_root / rs.root_extra->build_dir / module_dir;
if (empty (d))
{
rmdir (d);
@@ -43,7 +45,7 @@ namespace build2
// And build/ if it also became empty (e.g., in case of a build
// with a transient configuration).
//
- d = rs.out_path () / build_dir;
+ d = out_root / rs.root_extra->build_dir;
if (empty (d))
rmdir (d);
}
diff --git a/build2/cc/utility.cxx b/build2/cc/utility.cxx
index 7e5ce53..39f5c35 100644
--- a/build2/cc/utility.cxx
+++ b/build2/cc/utility.cxx
@@ -19,7 +19,7 @@ namespace build2
{
using namespace bin;
- const dir_path module_dir (dir_path ("build") /= "cc");
+ const dir_path module_dir ("cc");
const dir_path modules_sidebuild_dir (dir_path (module_dir) /= "modules");
lorder
diff --git a/build2/cc/utility.hxx b/build2/cc/utility.hxx
index bf96949..6b629de 100644
--- a/build2/cc/utility.hxx
+++ b/build2/cc/utility.hxx
@@ -19,8 +19,12 @@ namespace build2
namespace cc
{
- extern const dir_path module_dir; // build/cc/
- extern const dir_path modules_sidebuild_dir; // build/cc/modules/
+ // To form the complete path do:
+ //
+ // root.out_path () / root.root_extra->build_dir / module_dir
+ //
+ extern const dir_path module_dir; // cc/
+ extern const dir_path modules_sidebuild_dir; // cc/modules/
// Compile output type.
//