-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompiler.cpp
More file actions
29 lines (22 loc) · 1008 Bytes
/
compiler.cpp
File metadata and controls
29 lines (22 loc) · 1008 Bytes
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
#include "compiler.h"
#include <format.h>
#include <filesystem>
int compile(std::string const& compiler, std::filesystem::path const& linker_search_path, std::filesystem::path const& project_path) {
if(compiler == "gcc") {
auto build_api_include_path = linker_search_path.parent_path() / "api";
auto builder_path = project_path / "builder.cpp";
auto project_path_arg = project_path.string();
auto build_api_include_path_arg = build_api_include_path.string();
auto builder_path_arg = builder_path.string();
auto linker_search_path_arg = linker_search_path.string();
auto command = formatv(
"g++ -std=c++2a -shared -I\"%\" -I\"%\" \"%\" -o build_temp.dll -L\"%\" -llibbuild.cpp",
build_api_include_path_arg,
project_path_arg,
builder_path_arg,
linker_search_path_arg);
printv("> %", command);
return std::system(command.c_str());
}
return 0;
}