-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.cpp
37 lines (32 loc) · 1.01 KB
/
build.cpp
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
import std;
import makeDotCpp;
import makeDotCpp.project;
import makeDotCpp.project.api;
import makeDotCpp.compiler.Clang;
import makeDotCpp.fileProvider.Glob;
import makeDotCpp.builder;
using namespace makeDotCpp;
using namespace api;
extern "C" int build(const ProjectContext &ctx) {
auto compiler = std::make_shared<Clang>();
compiler->addOption("-std=c++20 -O3 -Wall")
.addLinkOption("-lclang-cpp")
.addLinkOption("-lLLVM-18")
.addLinkOption("-Wl,--stack=4194304");
ExeBuilder builder("cmg");
builder.addSrc(Glob("src/**/*.cppm")).addSrc("src/main.cpp");
for (auto &package : ctx.packageExports | std::views::values) {
builder.dependOn(package);
}
Project()
.setName("cxx-module-generator")
.setCompiler(compiler)
.setBuild([&](const Context &ctx) {
auto future = builder.build(ctx);
future.get();
std::cout << "\033[0;32mDone\033[0m" << std::endl;
})
.setInstall([](const Context &) {})
.run(ctx.argc, ctx.argv);
return 0;
}