83 lines
2.6 KiB
C++
83 lines
2.6 KiB
C++
#include "Common.hpp"
|
|
#include "Download.hpp"
|
|
#include "Unpack.hpp"
|
|
|
|
#include <Process/Environment.hpp>
|
|
#include <Process/Process.hpp>
|
|
|
|
#include <filesystem>
|
|
#include <print>
|
|
|
|
int main()
|
|
{
|
|
std::println("Hello World!");
|
|
|
|
Toolchain::fs::create_directories("Archives");
|
|
|
|
if (!Toolchain::fs::exists("Archives/LLVM.tar.gz") && !Toolchain::DownloadFile("Archives/LLVM.tar.gz", "https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-21.1.8.tar.gz")) {
|
|
std::println("Unlucky");
|
|
return 1;
|
|
}
|
|
|
|
Toolchain::fs::create_directories("Sources");
|
|
|
|
if (!Toolchain::fs::exists("Sources/LLVM") && !Toolchain::UnpackArchive("Archives/LLVM.tar.gz", "Sources/LLVM")) {
|
|
std::println("Unlucky");
|
|
return 1;
|
|
}
|
|
|
|
return 0;
|
|
|
|
Toolchain::fs::create_directories("Builds");
|
|
|
|
Process::Process configure(
|
|
"cmake", { "-S", "Sources/LLVM/llvm", "-B", "Builds/LLVM", "-G", "Ninja", "-DCMAKE_BUILD_TYPE=Release", "-DCMAKE_INSTALL_PREFIX=Stage0", "-DLLVM_ENABLE_PROJECTS=all", "-DLLVM_ENABLE_RUNTIMES=all" },
|
|
Process::ProcessOptions {
|
|
.StdinMode = Process::PipeMode::Null,
|
|
.StdoutMode = Process::PipeMode::Inherit,
|
|
.StderrMode = Process::PipeMode::Inherit,
|
|
.PathResolution = Process::PathMode::CurrentEnvironment,
|
|
.Environment = Process::CurrentEnvironment(),
|
|
.CloseOtherFds = true,
|
|
}
|
|
);
|
|
configure.Wait();
|
|
if (configure.ExitCode() != 0) {
|
|
std::println("Unlucky");
|
|
return 1;
|
|
}
|
|
|
|
Process::Process build (
|
|
"ninja", { "-C", "Builds/LLVM", "-j4" },
|
|
Process::ProcessOptions {
|
|
.StdinMode = Process::PipeMode::Null,
|
|
.StdoutMode = Process::PipeMode::Inherit,
|
|
.StderrMode = Process::PipeMode::Inherit,
|
|
.PathResolution = Process::PathMode::CurrentEnvironment,
|
|
.Environment = Process::CurrentEnvironment(),
|
|
.CloseOtherFds = true,
|
|
}
|
|
);
|
|
build.Wait();
|
|
if (build.ExitCode() != 0) {
|
|
std::println("Unlucky");
|
|
return 1;
|
|
}
|
|
|
|
Process::Process install (
|
|
"ninja", { "-C", "Builds/LLVM", "install" },
|
|
Process::ProcessOptions {
|
|
.StdinMode = Process::PipeMode::Null,
|
|
.StdoutMode = Process::PipeMode::Inherit,
|
|
.StderrMode = Process::PipeMode::Inherit,
|
|
.PathResolution = Process::PathMode::CurrentEnvironment,
|
|
.Environment = Process::CurrentEnvironment(),
|
|
.CloseOtherFds = true,
|
|
}
|
|
);
|
|
install.Wait();
|
|
if (install.ExitCode() != 0){
|
|
std::println("Unlucky");
|
|
return 1;
|
|
}
|
|
}
|