aboutsummaryrefslogtreecommitdiff
path: root/build/context
blob: 05f0094bb5af343dcbc0df21f9fcb26e4eab0cfe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// file      : build/context -*- C++ -*-
// copyright : Copyright (c) 2014-2015 Code Synthesis Tools CC
// license   : MIT; see accompanying LICENSE file

#ifndef BUILD_CONTEXT
#define BUILD_CONTEXT

#include <string>
#include <ostream>

#include <build/path>

namespace build
{
  extern path work;
  extern path home;

  extern path src_root;
  extern path out_root;

  extern path src_base;
  extern path out_base;

  // Return the src/out directory corresponding to the given out/src. The
  // passed directory should be a sub-directory of out/src_root.
  //
  path
  src_out (const path&);

  path
  out_src (const path&);

  // If possible, translate an absolute, normalized path into relative to
  // the work directory.
  //
  path
  translate (const path&);

  // In addition to calling translate() above, this function also uses
  // shorter notations such as ~/.
  //
  std::string
  diagnostic_string (const path&);

  inline std::ostream&
  operator<< (std::ostream& os, const path& p)
  {
    return os << diagnostic_string (p);
  }
}

#endif // BUILD_CONTEXT