mirror of
https://github.com/ModOrganizer2/mob.git
synced 2026-07-27 14:07:05 -07:00
renamed cmake::projects() to targets() because it could be "clean"
added --reconfigure, only used by MO for now, will refactor cleaning stuff
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
dry = false
|
||||
redownload = false
|
||||
reextract = false
|
||||
reconfigure = false
|
||||
rebuild = false
|
||||
output_log_level = 3
|
||||
file_log_level = 5
|
||||
|
||||
+15
-6
@@ -313,10 +313,16 @@ clipp::group build_command::do_group()
|
||||
(clipp::option("-e", "--reextract") >> reextract_)
|
||||
% "deletes source directories and re-extracts archives",
|
||||
|
||||
(clipp::option("-b", "--rebuild") >> rebuild_)
|
||||
% "cleans and rebuilds projects",
|
||||
(clipp::option("-c", "--reconfigure") >> reconfigure_)
|
||||
% "reconfigures the task by running cmake, configure scripts, "
|
||||
"etc.; some tasks might have to delete the whole source "
|
||||
"directory",
|
||||
|
||||
(clipp::option("-n", "--new") >> clean_)
|
||||
(clipp::option("-b", "--rebuild") >> rebuild_)
|
||||
% "cleans and rebuilds projects; some tasks might have to "
|
||||
"delete the whole source directory",
|
||||
|
||||
(clipp::option("-n", "--new") >> new_)
|
||||
% "deletes everything and starts from scratch",
|
||||
|
||||
(
|
||||
@@ -343,13 +349,16 @@ void build_command::convert_cl_to_conf()
|
||||
{
|
||||
command::convert_cl_to_conf();
|
||||
|
||||
if (redownload_ || clean_)
|
||||
if (redownload_ || new_)
|
||||
common.options.push_back("global/redownload=true");
|
||||
|
||||
if (reextract_ || clean_)
|
||||
if (reextract_ || new_)
|
||||
common.options.push_back("global/reextract=true");
|
||||
|
||||
if (rebuild_ || clean_)
|
||||
if (reconfigure_ || new_)
|
||||
common.options.push_back("global/reconfigure=true");
|
||||
|
||||
if (rebuild_ || new_)
|
||||
common.options.push_back("global/rebuild=true");
|
||||
|
||||
if (nopull_)
|
||||
|
||||
+2
-1
@@ -112,7 +112,8 @@ private:
|
||||
bool redownload_ = false;
|
||||
bool reextract_ = false;
|
||||
bool rebuild_ = false;
|
||||
bool clean_ = false;
|
||||
bool reconfigure_ = false;
|
||||
bool new_ = false;
|
||||
std::optional<bool> nopull_;
|
||||
bool keep_msbuild_ = false;
|
||||
std::optional<bool> revert_ts_;
|
||||
|
||||
@@ -54,6 +54,7 @@ public:
|
||||
static fs::path log_file() { return global_by_name("log_file"); }
|
||||
static bool redownload() { return bool_global_by_name("redownload"); }
|
||||
static bool reextract() { return bool_global_by_name("reextract"); }
|
||||
static bool reconfigure() { return bool_global_by_name("reconfigure"); }
|
||||
static bool rebuild() { return bool_global_by_name("rebuild"); }
|
||||
|
||||
static std::vector<std::string> format_options();
|
||||
|
||||
+9
-2
@@ -58,16 +58,23 @@ void boost::do_build_and_install()
|
||||
build_and_install_from_source();
|
||||
}
|
||||
|
||||
void boost::do_clean_for_rebuild()
|
||||
void boost::do_clean_for_reconfigure()
|
||||
{
|
||||
if (prebuilt())
|
||||
return;
|
||||
|
||||
op::delete_directory(cx(), source_path() / "bin.v2", op::optional);
|
||||
op::delete_file(cx(), b2_exe(), op::optional);
|
||||
}
|
||||
|
||||
void boost::do_clean_for_rebuild()
|
||||
{
|
||||
if (prebuilt())
|
||||
return;
|
||||
|
||||
op::delete_directory(cx(), root_lib_path(arch::x86), op::optional);
|
||||
op::delete_directory(cx(), root_lib_path(arch::x64), op::optional);
|
||||
op::delete_file(cx(), config_jam_file(), op::optional);
|
||||
op::delete_file(cx(), b2_exe(), op::optional);
|
||||
op::delete_file(cx(), source_path() / "project-config.jam", op::optional);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -99,7 +99,7 @@ void lz4::build_and_install_from_source()
|
||||
{
|
||||
run_tool(msbuild()
|
||||
.solution(solution_file())
|
||||
.projects({"liblz4-dll"}));
|
||||
.targets({"liblz4-dll"}));
|
||||
});
|
||||
|
||||
instrument<times::install>([&]
|
||||
|
||||
+29
-11
@@ -49,12 +49,27 @@ fs::path modorganizer::this_source_path() const
|
||||
return super_path() / name();
|
||||
}
|
||||
|
||||
fs::path modorganizer::this_solution_path() const
|
||||
{
|
||||
// run the project file instead of the .sln and giving INSTALL as a
|
||||
// target, because the target name depends on the folders in the solution
|
||||
//
|
||||
// since cmake can put INSTALL inside CMakePredefinedTarget, the target has
|
||||
// to be "CMakePredefinedTarget\\INSTALL" instead of just "INSTALL"
|
||||
//
|
||||
// because the creation of the CMakePredefinedTarget actually depends on
|
||||
// the USE_FOLDERS variable in the cmake file, just use the project
|
||||
// instead
|
||||
const auto build_path = create_cmake_tool(this_source_path()).build_path();
|
||||
return build_path / "INSTALL.vcxproj";
|
||||
}
|
||||
|
||||
fs::path modorganizer::super_path()
|
||||
{
|
||||
return paths::build() / "modorganizer_super";
|
||||
}
|
||||
|
||||
void modorganizer::do_clean_for_rebuild()
|
||||
void modorganizer::do_clean_for_reconfigure()
|
||||
{
|
||||
instrument<times::fetch>([&]
|
||||
{
|
||||
@@ -63,6 +78,18 @@ void modorganizer::do_clean_for_rebuild()
|
||||
});
|
||||
}
|
||||
|
||||
void modorganizer::do_clean_for_rebuild()
|
||||
{
|
||||
instrument<times::clean>([&]
|
||||
{
|
||||
run_tool(msbuild()
|
||||
.solution(this_solution_path())
|
||||
.config("RelWithDebInfo")
|
||||
.architecture(arch::x64)
|
||||
.targets({"Clean"}));
|
||||
});
|
||||
}
|
||||
|
||||
void modorganizer::do_fetch()
|
||||
{
|
||||
instrument<times::init_super>([&]
|
||||
@@ -127,19 +154,10 @@ void modorganizer::do_build_and_install()
|
||||
return run_tool(create_cmake_tool(this_source_path()));
|
||||
});
|
||||
|
||||
// run the project file instead of the .sln and giving INSTALL as a
|
||||
// target, because the target name depends on the folders in the solution
|
||||
//
|
||||
// since cmake can put INSTALL inside CMakePredefinedTarget, the target has
|
||||
// to be "CMakePredefinedTarget\\INSTALL" instead of just "INSTALL"
|
||||
//
|
||||
// because the creation of the CMakePredefinedTarget actually depends on
|
||||
// the USE_FOLDERS variable in the cmake file, just use the project
|
||||
// instead
|
||||
instrument<times::build>([&]
|
||||
{
|
||||
run_tool(msbuild()
|
||||
.solution(build_path / ("INSTALL.vcxproj"))
|
||||
.solution(this_solution_path())
|
||||
.config("RelWithDebInfo")
|
||||
.architecture(arch::x64));
|
||||
});
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ void ncc::do_build_and_install()
|
||||
{
|
||||
run_tool(msbuild()
|
||||
.solution(source_path() / "NexusClient.sln")
|
||||
.projects({"NexusClientCLI"})
|
||||
.targets({"NexusClientCLI"})
|
||||
.platform("Any CPU"));
|
||||
});
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@ void python::build_and_install_from_source()
|
||||
{
|
||||
run_tool(msbuild()
|
||||
.solution(solution_file())
|
||||
.projects({
|
||||
.targets({
|
||||
"python", "pythonw", "python3dll", "select", "pyexpat",
|
||||
"unicodedata", "_queue", "_bz2", "_ssl"})
|
||||
.parameters({
|
||||
|
||||
@@ -73,6 +73,17 @@ public:
|
||||
clean
|
||||
};
|
||||
|
||||
|
||||
enum class clean
|
||||
{
|
||||
nothing = 0x00,
|
||||
redownload = 0x01,
|
||||
reextract = 0x02,
|
||||
reconfigure = 0x04,
|
||||
rebuild = 0x08,
|
||||
everything = redownload+reextract+reconfigure+rebuild
|
||||
};
|
||||
|
||||
task(const task&) = delete;
|
||||
task& operator=(const task&) = delete;
|
||||
|
||||
@@ -111,6 +122,7 @@ protected:
|
||||
|
||||
virtual void do_fetch() {}
|
||||
virtual void do_build_and_install() {}
|
||||
virtual void do_clean_for_reconfigure() {}
|
||||
virtual void do_clean_for_rebuild() {}
|
||||
|
||||
template <class Tool>
|
||||
@@ -145,6 +157,9 @@ private:
|
||||
};
|
||||
|
||||
|
||||
MOB_ENUM_OPERATORS(task::clean);
|
||||
|
||||
|
||||
template <class Task>
|
||||
class basic_task : public task
|
||||
{
|
||||
|
||||
@@ -31,6 +31,7 @@ public:
|
||||
protected:
|
||||
void do_fetch() override;
|
||||
void do_build_and_install() override;
|
||||
void do_clean_for_reconfigure() override;
|
||||
void do_clean_for_rebuild() override;
|
||||
|
||||
private:
|
||||
@@ -274,6 +275,7 @@ public:
|
||||
protected:
|
||||
void do_fetch() override;
|
||||
void do_build_and_install() override;
|
||||
void do_clean_for_reconfigure() override;
|
||||
void do_clean_for_rebuild() override;
|
||||
|
||||
private:
|
||||
@@ -282,6 +284,7 @@ private:
|
||||
void initialize_super(const fs::path& super_root);
|
||||
|
||||
fs::path this_source_path() const;
|
||||
fs::path this_solution_path() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -97,12 +97,12 @@ void usvfs::build_and_install_from_source()
|
||||
|
||||
run_tool(msbuild()
|
||||
.platform("x64")
|
||||
.projects({"usvfs_proxy"})
|
||||
.targets({"usvfs_proxy"})
|
||||
.solution(source_path() / "vsbuild" / "usvfs.sln"));
|
||||
|
||||
run_tool(msbuild()
|
||||
.platform("x86")
|
||||
.projects({"usvfs_proxy"})
|
||||
.targets({"usvfs_proxy"})
|
||||
.solution(source_path() / "vsbuild" / "usvfs.sln"));
|
||||
});
|
||||
}
|
||||
|
||||
+11
-4
@@ -90,6 +90,15 @@ cmake& cmake::cmd(const std::string& s)
|
||||
return *this;
|
||||
}
|
||||
|
||||
fs::path cmake::build_path() const
|
||||
{
|
||||
if (!output_.empty())
|
||||
return output_;
|
||||
|
||||
const auto& g = get_generator(gen_);
|
||||
return root_ / (g.output_dir(arch_));
|
||||
}
|
||||
|
||||
fs::path cmake::result() const
|
||||
{
|
||||
return output_;
|
||||
@@ -100,11 +109,9 @@ void cmake::do_run()
|
||||
if (root_.empty())
|
||||
cx().bail_out(context::generic, "cmake output path is empty");
|
||||
|
||||
const fs::path output = output_.empty() ? build_path() : output_;
|
||||
const auto& g = get_generator(gen_);
|
||||
|
||||
if (output_.empty())
|
||||
output_ = root_ / (g.output_dir(arch_));
|
||||
|
||||
process_
|
||||
.stdout_encoding(encodings::utf8)
|
||||
.stderr_encoding(encodings::utf8)
|
||||
@@ -136,7 +143,7 @@ void cmake::do_run()
|
||||
process_
|
||||
.env(env::vs(arch_)
|
||||
.set("CXXFLAGS", "/wd4566"))
|
||||
.cwd(output_);
|
||||
.cwd(output);
|
||||
|
||||
execute_and_join();
|
||||
}
|
||||
|
||||
@@ -22,9 +22,9 @@ msbuild& msbuild::solution(const fs::path& sln)
|
||||
return *this;
|
||||
}
|
||||
|
||||
msbuild& msbuild::projects(const std::vector<std::string>& names)
|
||||
msbuild& msbuild::targets(const std::vector<std::string>& names)
|
||||
{
|
||||
projects_ = names;
|
||||
targets_ = names;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -122,8 +122,8 @@ void msbuild::do_run()
|
||||
.arg("-verbosity:minimal", process::log_quiet)
|
||||
.arg("-consoleLoggerParameters:ErrorsOnly", process::log_quiet);
|
||||
|
||||
if (!projects_.empty())
|
||||
process_.arg("-target:" + mob::join(projects_, ","));
|
||||
if (!targets_.empty())
|
||||
process_.arg("-target:" + mob::join(targets_, ","));
|
||||
|
||||
for (auto&& p : params_)
|
||||
process_.arg("-property:" + p);
|
||||
|
||||
+11
-2
@@ -345,6 +345,15 @@ public:
|
||||
cmake& architecture(arch a);
|
||||
cmake& cmd(const std::string& s);
|
||||
|
||||
// returns the path given in output(), if it was set
|
||||
//
|
||||
// if not, returns the build path based on the parameters (for example,
|
||||
// `vsbuild_32/` for a 32-bit arch with the VS generator
|
||||
//
|
||||
fs::path build_path() const;
|
||||
|
||||
// returns build_path(), used by task::run_tool()
|
||||
//
|
||||
fs::path result() const;
|
||||
|
||||
protected:
|
||||
@@ -422,7 +431,7 @@ public:
|
||||
static fs::path binary();
|
||||
|
||||
msbuild& solution(const fs::path& sln);
|
||||
msbuild& projects(const std::vector<std::string>& names);
|
||||
msbuild& targets(const std::vector<std::string>& names);
|
||||
msbuild& parameters(const std::vector<std::string>& params);
|
||||
msbuild& config(const std::string& s);
|
||||
msbuild& platform(const std::string& s);
|
||||
@@ -436,7 +445,7 @@ protected:
|
||||
|
||||
private:
|
||||
fs::path sln_;
|
||||
std::vector<std::string> projects_;
|
||||
std::vector<std::string> targets_;
|
||||
std::vector<std::string> params_;
|
||||
std::string config_;
|
||||
std::string platform_;
|
||||
|
||||
Reference in New Issue
Block a user