mirror of
https://github.com/ModOrganizer2/mob.git
synced 2026-07-27 14:07:05 -07:00
lz4 prebuilt
This commit is contained in:
@@ -17,6 +17,7 @@ vcvars =
|
||||
|
||||
[prebuilt]
|
||||
boost = true
|
||||
lz4 = true
|
||||
|
||||
[versions]
|
||||
vs = 16
|
||||
|
||||
+3
-2
@@ -44,7 +44,8 @@ static path_map g_tools =
|
||||
|
||||
static bool_map g_prebuilt =
|
||||
{
|
||||
{"boost", false}
|
||||
{"boost", false},
|
||||
{"lz4", false}
|
||||
};
|
||||
|
||||
static string_map g_versions =
|
||||
@@ -188,7 +189,7 @@ namespace tools
|
||||
|
||||
fs::path vs::installation_path() { return paths::by_name("vs"); }
|
||||
fs::path vs::vswhere() { return tool_by_name("vswhere"); }
|
||||
fs::path vs::vcvars() { return tool_by_name("vsvars"); }
|
||||
fs::path vs::vcvars() { return tool_by_name("vcvars"); }
|
||||
std::string vs::version() { return versions::by_name("vs"); }
|
||||
std::string vs::year() { return versions::by_name("vs_year"); }
|
||||
std::string vs::toolset() { return versions::by_name("vs_toolset"); }
|
||||
|
||||
+1
-4
@@ -211,10 +211,7 @@ fs::path boost::config_jam_file()
|
||||
url boost::prebuilt_url()
|
||||
{
|
||||
const auto underscores = replace_all(version(), ".", "_");
|
||||
|
||||
return
|
||||
"https://github.com/ModOrganizer2/modorganizer-umbrella/"
|
||||
"releases/download/1.1/boost_prebuilt_" + underscores + ".7z";
|
||||
return make_prebuilt_url("boost_prebuilt_" + underscores + ".7z");
|
||||
}
|
||||
|
||||
url boost::source_url()
|
||||
|
||||
+45
-2
@@ -16,7 +16,7 @@ const std::string& lz4::version()
|
||||
|
||||
bool lz4::prebuilt()
|
||||
{
|
||||
return false;
|
||||
return prebuilt::by_name("lz4");
|
||||
}
|
||||
|
||||
fs::path lz4::source_path()
|
||||
@@ -30,6 +30,44 @@ void lz4::do_clean_for_rebuild()
|
||||
}
|
||||
|
||||
void lz4::do_fetch()
|
||||
{
|
||||
if (prebuilt())
|
||||
fetch_prebuilt();
|
||||
else
|
||||
fetch_from_source();
|
||||
}
|
||||
|
||||
void lz4::do_build_and_install()
|
||||
{
|
||||
if (prebuilt())
|
||||
build_and_install_prebuilt();
|
||||
else
|
||||
build_and_install_from_source();
|
||||
}
|
||||
|
||||
void lz4::fetch_prebuilt()
|
||||
{
|
||||
cx().trace(context::generic, "using prebuilt lz4");
|
||||
|
||||
const auto file = run_tool(downloader(prebuilt_url()));
|
||||
|
||||
run_tool(extractor()
|
||||
.file(file)
|
||||
.output(source_path()));
|
||||
}
|
||||
|
||||
void lz4::build_and_install_prebuilt()
|
||||
{
|
||||
op::copy_file_to_dir_if_better(cx(),
|
||||
source_path() / "bin" / "liblz4.pdb",
|
||||
paths::install_pdbs());
|
||||
|
||||
op::copy_file_to_dir_if_better(cx(),
|
||||
source_path() / "bin" / "liblz4.dll",
|
||||
paths::install_dlls());
|
||||
}
|
||||
|
||||
void lz4::fetch_from_source()
|
||||
{
|
||||
run_tool(git_clone()
|
||||
.url(make_github_url("lz4","lz4"))
|
||||
@@ -39,7 +77,7 @@ void lz4::do_fetch()
|
||||
run_tool(devenv_upgrade(solution_file()));
|
||||
}
|
||||
|
||||
void lz4::do_build_and_install()
|
||||
void lz4::build_and_install_from_source()
|
||||
{
|
||||
run_tool(msbuild()
|
||||
.solution(solution_file())
|
||||
@@ -74,4 +112,9 @@ fs::path lz4::out_dir()
|
||||
return solution_dir() / "bin" / "x64_Release";
|
||||
}
|
||||
|
||||
url lz4::prebuilt_url()
|
||||
{
|
||||
return make_prebuilt_url("lz4_prebuilt_" + version() + ".7z");
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -241,6 +241,14 @@ private:
|
||||
static fs::path solution_dir();
|
||||
static fs::path solution_file();
|
||||
static fs::path out_dir();
|
||||
|
||||
void fetch_prebuilt();
|
||||
void build_and_install_prebuilt();
|
||||
|
||||
void fetch_from_source();
|
||||
void build_and_install_from_source();
|
||||
|
||||
static url prebuilt_url();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -5,11 +5,6 @@
|
||||
namespace mob
|
||||
{
|
||||
|
||||
url make_github_url(const std::string& org, const std::string& repo)
|
||||
{
|
||||
return "https://github.com/" + org + "/" + repo + ".git";
|
||||
}
|
||||
|
||||
|
||||
git_clone::git_clone()
|
||||
: basic_process_runner("git")
|
||||
|
||||
@@ -111,9 +111,6 @@ private:
|
||||
};
|
||||
|
||||
|
||||
url make_github_url(const std::string& org, const std::string& repo);
|
||||
|
||||
|
||||
class git_clone : public basic_process_runner
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -9,6 +9,19 @@
|
||||
namespace mob
|
||||
{
|
||||
|
||||
url make_github_url(const std::string& org, const std::string& repo)
|
||||
{
|
||||
return "https://github.com/" + org + "/" + repo + ".git";
|
||||
}
|
||||
|
||||
url make_prebuilt_url(const std::string& filename)
|
||||
{
|
||||
return
|
||||
"https://github.com/ModOrganizer2/modorganizer-umbrella/"
|
||||
"releases/download/1.1/" + filename;
|
||||
}
|
||||
|
||||
|
||||
std::string replace_all(
|
||||
std::string s, const std::string& from, const std::string& to)
|
||||
{
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace mob
|
||||
|
||||
|
||||
class context;
|
||||
class url;
|
||||
|
||||
class bailed
|
||||
{
|
||||
@@ -162,6 +163,9 @@ private:
|
||||
};
|
||||
|
||||
|
||||
url make_github_url(const std::string& org, const std::string& repo);
|
||||
url make_prebuilt_url(const std::string& filename);
|
||||
|
||||
std::string replace_all(
|
||||
std::string s, const std::string& from, const std::string& to);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user