blob: 1a02be18b0200bc6bdb52467cb4678d7cf391818 (
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
53
54
55
56
57
58
|
# Introduction
Have you ever wondered, if you want to compile a C++ program, why you always
need to learn another language to make it build properly with dependency
tracking and so on.
Many good build-systems exists which all have their strengths and weeknesses
autotools, cmake, meson to name a few.
`ctor` tries to make it possible to use all the cool features of the above
in a tool only using C++ (through the compiler).
## Getting Started: 3 Simple Steps
Step 1: Create a build configuration, in C++
A really simple example ('hello_config.cc'):
```c++
#include "ctor.h"
namespace
{
BuildConfigurations helloConfigs()
{
return
{
{
.target = "hello",
.sources = {
"hello.cc",
},
.cxxflags = {
"-Wall",
"-std=c++17",
}
},
};
}
REG(helloConfigs);
}
```
Step 2: Bootstrap the system by compiling your build configuration along with
the libctor.a static library:
```sh
g++ -std=c++17 hello_config.cc -pthread libctor.a -o ctor
```
Step 3: Run ctor to build you application:
```sh
./ctor
```
Any consecutive changes to the build configuration or any of the sources will
automagically trigger a rebuild of all (and only) affected sources the next time
ctor is executed.
|