aboutsummaryrefslogtreecommitdiff
path: root/src/build_systems.cc
diff options
context:
space:
mode:
authordacctal <120422854+dacctal@users.noreply.github.com>2026-01-21 23:56:39 -0500
committerdacctal <120422854+dacctal@users.noreply.github.com>2026-01-21 23:56:39 -0500
commit8926f839720471cc86fd4f7c6371d63b8f71b91d (patch)
treec14523954085f7b6c428a488f81bfb645dcd2c83 /src/build_systems.cc
parent8fc3b1f6cd1062e15c0aed60a110fb91143cd801 (diff)
initial commit
Diffstat (limited to 'src/build_systems.cc')
-rw-r--r--src/build_systems.cc111
1 files changed, 111 insertions, 0 deletions
diff --git a/src/build_systems.cc b/src/build_systems.cc
new file mode 100644
index 0000000..2e402e7
--- /dev/null
+++ b/src/build_systems.cc
@@ -0,0 +1,111 @@
+#include <filesystem>
+
+#include "toml.hh"
+
+#include "vars.cc"
+
+void autogen_build() {
+ system("./autogen.sh");
+ system("make");
+}
+
+void autotools_build() {
+ system("./configure");
+ for (auto const& dir_entry : fs::directory_iterator(fs::current_path().string())) {
+ if (dir_entry.path().filename() == "CMakeLists.txt") {
+ fs::create_directories("build");
+ fs::current_path("build");
+ system("cmake ..");
+ }
+ }
+ for (auto const& dir_entry : fs::directory_iterator(fs::current_path().string())) {
+ if (dir_entry.path().filename() == "Makefile") {
+ system("make");
+ }
+ }
+}
+
+void bldit_build() {
+ system("./bldit");
+}
+
+void buildsh_build() {
+ system("./build.sh");
+}
+
+void compilesh_build() {
+ system("./compile.sh");
+}
+
+void cargo_build() {
+ system("cargo build --release");
+}
+
+void cmake_build() {
+ fs::create_directories("build");
+ fs::current_path("build");
+ system("cmake ..");
+ system("make");
+}
+
+void go_build() {
+ for (auto const& dir_entry : fs::directory_iterator(fs::current_path().string())) {
+ if (dir_entry.path().filename() == "main.go") {
+ system("go build main.go");
+ }
+ }
+}
+
+void gradle_build() {
+ system("gradle build");
+}
+
+void make_build() {
+ for (auto const& dir_entry : fs::directory_iterator(fs::current_path().string())) {
+ if (dir_entry.path().filename() == "autogen.sh") {
+ autogen_build();
+ return;
+ }
+ }
+ for (auto const& dir_entry : fs::directory_iterator(fs::current_path().string())) {
+ if (dir_entry.path().filename() == "configure.ac") {
+ autotools_build();
+ return;
+ }
+ }
+ system("make");
+}
+
+void meson_build() {
+ system("meson setup --wipe build");
+ system("meson compile -C build");
+}
+
+void ninja_build() {
+ system("ninja");
+}
+
+void nim_build() {
+ system("nimble build");
+}
+
+void pnpm_build() {
+ system("pnpm install");
+ system("pnpm run build");
+}
+
+void python_build() {
+ toml::parse_result pyproject_toml = toml::parse_file("pyproject.toml");
+ std::string pypkg = pyproject_toml["project"]["name"].ref<std::string>();
+ std::string commands[] = {
+ "export PIPX_BIN_DIR=" + bin,
+ "pipx install " + pypkg
+ };
+ for (int i = 0; i < sizeof(commands)/sizeof(commands[0]); i++) {
+ system(commands[i].c_str());
+ }
+}
+
+void zig_build() {
+ system("zig build");
+}