add old build script
This commit is contained in:
77
random/build_sytem/build.cpp
Normal file
77
random/build_sytem/build.cpp
Normal file
@@ -0,0 +1,77 @@
|
||||
|
||||
#define EXT_LINK
|
||||
#define EXT_INC
|
||||
#include "build.hpp"
|
||||
#include <unordered_set>
|
||||
|
||||
std::vector<std::string> LINK = {"raylib/lib/libraylib.a"};
|
||||
|
||||
std::vector<std::string> RAYINCLUDE = {"-Iraylib/include"};
|
||||
std::filesystem::path RAYLIB_DIR = "raylib";
|
||||
|
||||
bool build = false;
|
||||
bool clear = false;
|
||||
bool run = false;
|
||||
|
||||
int main(int argc, char const *argv[])
|
||||
{
|
||||
if (rebuild_my_self(__FILE__, argc, argv))
|
||||
return 0;
|
||||
|
||||
for (int i = 1; i < argc; ++i)
|
||||
{
|
||||
if (!std::strcmp(argv[i], "opt"))
|
||||
opt_flags = "-O3";
|
||||
|
||||
if (!std::strcmp(argv[i], "build"))
|
||||
build = true;
|
||||
|
||||
if (!std::strcmp(argv[i], "run"))
|
||||
run = true;
|
||||
|
||||
if (!std::strcmp(argv[i], "clear"))
|
||||
{
|
||||
clear_all_build();
|
||||
clear = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (clear && !build)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!std::filesystem::is_directory(RAYLIB_DIR))
|
||||
{
|
||||
command = {"wget", "https://github.com/raysan5/raylib/releases/download/5.5/raylib-5.5_linux_amd64.tar.gz"};
|
||||
run_command(command);
|
||||
command = {"tar", "-xzvf", "raylib-5.5_linux_amd64.tar.gz"};
|
||||
run_command(command);
|
||||
std::filesystem::rename("raylib-5.5_linux_amd64", "raylib");
|
||||
std::filesystem::remove_all("raylib-5.5_linux_amd64.tar.gz");
|
||||
}
|
||||
|
||||
if (!std::filesystem::is_directory(RAYLIB_DIR))
|
||||
return 0;
|
||||
|
||||
std::filesystem::create_directory(OBJ_DIR);
|
||||
|
||||
int res = compile_src_dir(RAYINCLUDE);
|
||||
switch (res)
|
||||
{
|
||||
case 1:
|
||||
compile_obj_dir(LINK);
|
||||
break;
|
||||
case -1:
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!std::filesystem::exists(BUILD_FILE))
|
||||
compile_obj_dir(LINK);
|
||||
|
||||
if (run)
|
||||
{
|
||||
run_main();
|
||||
}
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user