Author SHA1 Message Date
Mikaël Capelle c9f527b1c8 Remove option to use USVFS prebuilt. 2024-06-02 16:34:25 +02:00
24 changed files with 199 additions and 605 deletions
+9 -88
View File
@@ -21,88 +21,14 @@ host =
super = cmake_common modorganizer* githubpp super = cmake_common modorganizer* githubpp
plugins = check_fnis bsapacker bsa_extractor diagnose_basic installer_* plugin_python preview_base preview_bsa tool_* game_* plugins = check_fnis bsapacker bsa_extractor diagnose_basic installer_* plugin_python preview_base preview_bsa tool_* game_*
[dependencies]
sevenz =
zlib =
gtest =
libbsarch = directxtex
libloot =
openssl =
bzip2 =
directxtex =
cmake_common =
python = openssl
lz4 =
spdlog =
boost =
boost_di =
sip = python
pyqt = sip
pybind11 =
usvfs = gtest boost
stylesheets =
licenses =
explorerpp =
cmake_common =
archive = 7z
uibase = cmake_common boost spdlog gtest
basic_games = python
bsa_extractor = uibase bsatk
bsapacker = uibase libbsarch
bsatk = boost zlib lz4
check_fnis = uibase
diagnose_basic = uibase
esptk = boost
fnistool = python
form43_checker = python
game_gamebryo = uibase zlib lz4
game_enderal = game_gamebryo
game_enderalse = game_gamebryo
game_fallout3 = game_gamebryo
game_fallout4 = game_gamebryo
game_fallout4vr = game_gamebryo
game_fallout76 = game_gamebryo
game_falloutnv = game_gamebryo
game_morrowind = game_gamebryo
game_nehrim = game_gamebryo
game_oblivion = game_gamebryo
game_skyrim = game_gamebryo
game_skyrimse = game_gamebryo
game_skyrimvr = game_gamebryo
game_starfield = game_gamebryo
game_ttw = game_gamebryo
githubpp =
helper =
installer_bain = uibase
installer_bundle = uibase
installer_fomod = uibase
installer_fomod_csharp = uibase
installer_manual = uibase
installer_omod = uibase
installer_quick = uibase
installer_wizard = python
lootcli = libloot
modorganizer = uibase githubpp bsatk esptk archive usvfs lootcli
nxmhandler = uibase
plugin_python = uibase python pybind11
preview_base = uibase
preview_bsa = uibase bsatk
preview_dds = uibase
script_extender_plugin_checker = python
tool_configurator = python
tool_inibakery = uibase
tool_inieditor = uibase
[task] [task]
enabled = true enabled = true
mo_org = ModOrganizer2 mo_org = ModOrganizer2
mo_branch = master mo_branch = master
mo_fallback = mo_fallback =
no_pull = false no_pull = false
ignore_ts = false ignore_ts = false
revert_ts = false revert_ts = false
configuration = RelWithDebInfo
git_url_prefix = https://github.com/ git_url_prefix = https://github.com/
git_shallow = true git_shallow = true
@@ -174,7 +100,6 @@ boost = 1.85.0
boost_vs = 14.3 boost_vs = 14.3
fmt = 10.2.1 fmt = 10.2.1
gtest = main gtest = main
directxtex = main
libloot = 0.22.4 libloot = 0.22.4
lz4 = v1.9.4 lz4 = v1.9.4
nmm = 0.71.2 nmm = 0.71.2
@@ -190,9 +115,10 @@ spdlog = v1.14.1
qt = 6.7.0 qt = 6.7.0
qt_vs = 2019 qt_vs = 2019
zlib = v1.3.1 zlib = v1.3.1
libbsarch = 0.0.10 libbsarch = 0.0.9
usvfs = master usvfs = master
explorerpp = 1.4.0 explorerpp = 1.4.0
ss_paper_lad_6788 = 7.2 ss_paper_lad_6788 = 7.2
ss_paper_automata_6788 = 3.2 ss_paper_automata_6788 = 3.2
ss_paper_mono_6788 = 3.2 ss_paper_mono_6788 = 3.2
@@ -203,11 +129,6 @@ ss_starfield_trosski = V1.11
ss_fallout3_trosski = v1.11 ss_fallout3_trosski = v1.11
ss_fallout4_trosski = v1.11 ss_fallout4_trosski = v1.11
[build-types]
libbsarch = release
pyqt = release
python = release
[paths] [paths]
third_party = third_party =
prefix = prefix =
+4 -5
View File
@@ -68,7 +68,7 @@ aqt install-qt --outputdir "C:\Qt" windows desktop 6.7.0 win64_msvc2019_64 -m qt
- Optional: - Optional:
- Qt Source Files - Qt Source Files
- Qt Debug Files - Qt Debug Files
### Visual Studio ### Visual Studio
- Install Visual Studio 2022 ([Installer](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community&channel=Release&version=VS2022&source=VSLandingPage&cid=2030&passive=false)) - Install Visual Studio 2022 ([Installer](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community&channel=Release&version=VS2022&source=VSLandingPage&cid=2030&passive=false))
- Desktop development with C++ - Desktop development with C++
@@ -141,10 +141,9 @@ Inside the INI file are `[sections]` and `key = value` pairs. The `[task]` secti
### `[task]` ### `[task]`
Options for individual tasks. Can be `[task_name:task]`, where `task_name` is the name of a task (see `mob list`) , `super` for all MO tasks or a glob like `installer_*`. Options for individual tasks. Can be `[task_name:task]`, where `task_name` is the name of a task (see `mob list`) , `super` for all MO tasks or a glob like `installer_*`.
| Option | Type | Description | | Option | Type | Description |
| --- | --- | --- | | --- | --- | --- |
| `enabled` | bool | Whether this task is enabled. Disabled tasks are never built. When specifying task names with `mob build task1 task2...`, all tasks except those given are turned off. | | `enabled` | bool | Whether this task is enabled. Disabled tasks are never built. When specifying task names with `mob build task1 task2...`, all tasks except those given are turned off. |
| `configuration` | enum | Which configuration to build, should be one of Debug, Release or RelWithDebInfo with RelWithDebInfo being the default.|
#### Common git options #### Common git options
Unless otherwise stated, applies to any task that is a git repo. Unless otherwise stated, applies to any task that is a git repo.
+1 -6
View File
@@ -33,17 +33,12 @@ namespace mob {
(clipp::option("--install-prefix") & clipp::value("PATH") >> prefix_) % (clipp::option("--install-prefix") & clipp::value("PATH") >> prefix_) %
"sets CMAKE_INSTALL_PREFIX [default: empty]", "sets CMAKE_INSTALL_PREFIX [default: empty]",
(clipp::option("-d", "--debug").set(debug_, true)) %
"whether to configure for debug mode [default: false]",
(clipp::value("PATH") >> path_) % "path from which to run `cmake`"); (clipp::value("PATH") >> path_) % "path from which to run `cmake`");
} }
int cmake_command::do_run() int cmake_command::do_run()
{ {
auto t = tasks::modorganizer::create_cmake_tool( auto t = tasks::modorganizer::create_cmake_tool(fs::path(utf8_to_utf16(path_)));
fs::path(utf8_to_utf16(path_)), mob::cmake::generate,
debug_ ? config::debug : config::relwithdebinfo);
t.generator(gen_); t.generator(gen_);
t.cmd(cmd_); t.cmd(cmd_);
+1 -2
View File
@@ -382,8 +382,7 @@ namespace mob {
private: private:
std::string gen_; std::string gen_;
std::string cmd_; std::string cmd_;
bool x64_ = true; bool x64_ = true;
bool debug_ = false;
std::string prefix_; std::string prefix_;
std::string path_; std::string path_;
}; };
+38 -90
View File
@@ -14,11 +14,6 @@ namespace mob::details {
using key_value_map = std::map<std::string, std::string, std::less<>>; using key_value_map = std::map<std::string, std::string, std::less<>>;
using section_map = std::map<std::string, key_value_map, std::less<>>; using section_map = std::map<std::string, key_value_map, std::less<>>;
static std::unordered_map<mob::config, std::string_view> s_configuration_values{
{mob::config::release, "Release"},
{mob::config::debug, "Debug"},
{mob::config::relwithdebinfo, "RelWithDebInfo"}};
// holds all the options not related to tasks (global, tools, paths, etc.) // holds all the options not related to tasks (global, tools, paths, etc.)
static section_map g_conf; static section_map g_conf;
@@ -32,18 +27,6 @@ namespace mob::details {
static int g_file_log_level = 5; static int g_file_log_level = 5;
static bool g_dry = false; static bool g_dry = false;
// check if the two given string are equals case-insensitive
//
bool case_insensitive_equals(std::string_view lhs, std::string_view rhs)
{
// _strcmpi does not have a n-overload, and since string_view is not
// necessarily null-terminated, _strmcpi cannot be safely used
return std::equal(std::begin(lhs), std::end(lhs), std::begin(rhs),
std::end(rhs), [](auto&& c1, auto&& c2) {
return ::tolower(c1) == ::tolower(c2);
});
}
bool bool_from_string(std::string_view s) bool bool_from_string(std::string_view s)
{ {
return (s == "true" || s == "yes" || s == "1"); return (s == "true" || s == "yes" || s == "1");
@@ -102,17 +85,6 @@ namespace mob::details {
kitor->second = value; kitor->second = value;
} }
config string_to_config(std::string_view value)
{
for (const auto& [c, v] : s_configuration_values) {
if (case_insensitive_equals(value, v)) {
return c;
}
}
gcx().bail_out(context::conf, "invalid configuration '{}'", value);
}
// sets the given option, adds it if it doesn't exist; used when setting options // sets the given option, adds it if it doesn't exist; used when setting options
// from the master ini // from the master ini
// //
@@ -212,28 +184,6 @@ namespace mob::details {
g_tasks[task_name][key] = std::move(value); g_tasks[task_name][key] = std::move(value);
} }
// read a CMake constant from the configuration
//
template <typename T>
T parse_cmake_value(std::string_view section, std::string_view key,
std::string_view value,
std::unordered_map<T, std::string_view> const& values)
{
for (const auto& [value_c, value_s] : values) {
if (case_insensitive_equals(value_s, value)) {
return value_c;
}
}
// build a string containing allowed value for logging
std::vector<std::string_view> values_s;
for (const auto& [value_c, value_s] : values) {
values_s.push_back(value_s);
}
gcx().bail_out(context::conf, "bad value '{}' for {}/{} (expected one of {})",
value, section, key, join(values_s, ", ", std::string{}));
}
} // namespace mob::details } // namespace mob::details
namespace mob { namespace mob {
@@ -694,11 +644,6 @@ namespace mob {
return {}; return {};
} }
conf_build_types conf::build_types()
{
return {};
}
conf_paths conf::path() conf_paths conf::path()
{ {
return {}; return {};
@@ -721,34 +666,6 @@ namespace mob {
return details::g_dry; return details::g_dry;
} }
// use appropriate case for the below constants since we will be using them in
// to_string, although most of cmake and msbuild is case-insensitive so it will
// not matter much in the end
static std::unordered_map<conf_cmake::constant, std::string_view> constant_values{
{conf_cmake::always, "ALWAYS"},
{conf_cmake::lazy, "LAZY"},
{conf_cmake::never, "NEVER"}};
std::string conf_cmake::to_string(constant c)
{
return std::string{constant_values.at(c)};
}
conf_cmake::conf_cmake() : conf_section("cmake") {}
conf_cmake::constant conf_cmake::install_message() const
{
return details::parse_cmake_value(
name(), "install_message", details::get_string(name(), "install_message"),
constant_values);
}
std::string conf_cmake::host() const
{
return details::get_string(name(), "host");
}
conf_task::conf_task(std::vector<std::string> names) : names_(std::move(names)) {} conf_task::conf_task(std::vector<std::string> names) : names_(std::move(names)) {}
std::string conf_task::get(std::string_view key) const std::string conf_task::get(std::string_view key) const
@@ -761,12 +678,45 @@ namespace mob {
return details::get_bool_for_task(names_, key); return details::get_bool_for_task(names_, key);
} }
mob::config conf_task::configuration() const bool conf_cmake::cmake_constant::is_equivalent(std::string_view other) const
{ {
return details::parse_cmake_value( // _strcmpi does not have a n-overload, and since string_view is not
names_[0], "configuration", // necessarily null-terminated, _strmcpi cannot be safely used
details::get_string_for_task(names_, "configuration"), return std::equal(std::begin(value_), std::end(value_), std::begin(other),
details::s_configuration_values); std::end(other), [](auto&& c1, auto&& c2) {
return ::tolower(c1) == ::tolower(c2);
});
}
conf_cmake::conf_cmake() : conf_section("cmake") {}
const conf_cmake::cmake_constant conf_cmake::ALWAYS{"always"};
const conf_cmake::cmake_constant conf_cmake::LAZY{"lazy"};
const conf_cmake::cmake_constant conf_cmake::NEVER{"never"};
conf_cmake::cmake_constant conf_cmake::install_message() const
{
return read_cmake_constant("install_message", {ALWAYS, LAZY, NEVER});
}
std::string conf_cmake::host() const
{
return details::get_string(name(), "host");
}
conf_cmake::cmake_constant
conf_cmake::read_cmake_constant(std::string_view key,
std::vector<cmake_constant> const& allowed) const
{
const auto value = details::get_string(name(), key);
for (const auto& constant : allowed) {
if (constant.is_equivalent(value)) {
return constant;
}
}
gcx().bail_out(context::conf, "bad value '{}' for {}/{} (expected one of {})",
value, name(), key, join(allowed, ", ", std::string{}));
} }
conf_tools::conf_tools() : conf_section("tools") {} conf_tools::conf_tools() : conf_section("tools") {}
@@ -775,8 +725,6 @@ namespace mob {
conf_versions::conf_versions() : conf_section("versions") {} conf_versions::conf_versions() : conf_section("versions") {}
conf_build_types::conf_build_types() : conf_section("build-types") {}
conf_prebuilt::conf_prebuilt() : conf_section("prebuilt") {} conf_prebuilt::conf_prebuilt() : conf_section("prebuilt") {}
conf_paths::conf_paths() : conf_section("paths") {} conf_paths::conf_paths() : conf_section("paths") {}
+53 -57
View File
@@ -1,7 +1,5 @@
#pragma once #pragma once
#include "../utility.h"
// these shouldn't be called directly, they're used by some of the template // these shouldn't be called directly, they're used by some of the template
// below // below
// //
@@ -11,18 +9,6 @@ namespace mob::details {
// //
std::string get_string(std::string_view section, std::string_view key); std::string get_string(std::string_view section, std::string_view key);
// convert a string to the given type
template <class T>
T string_to(std::string_view value);
config string_to_config(std::string_view value);
template <>
inline config string_to<config>(std::string_view value)
{
return string_to_config(value);
}
// calls get_string(), converts to bool // calls get_string(), converts to bool
// //
bool get_bool(std::string_view section, std::string_view key); bool get_bool(std::string_view section, std::string_view key);
@@ -62,14 +48,7 @@ namespace mob {
public: public:
DefaultType get(std::string_view key) const DefaultType get(std::string_view key) const
{ {
const auto value = details::get_string(name_, key); return details::get_string(name_, key);
if constexpr (std::is_convertible_v<std::string, DefaultType>) {
return value;
}
else {
return details::string_to<DefaultType>(value);
}
} }
// undefined // undefined
@@ -123,29 +102,6 @@ namespace mob {
bool build() const { return get<bool>("build_task"); } bool build() const { return get<bool>("build_task"); }
}; };
// options in [cmake]
//
class conf_cmake : conf_section<std::string> {
public:
enum class constant { always, lazy, never };
using enum constant;
static std::string to_string(constant m);
conf_cmake();
// specify the value for CMAKE_INSTALL_MESSAGE
//
constant install_message() const;
// specify the toolset host configuration, if any, this is equivalent
// to -T host=XXX on the command line
//
// an empty string means no host configured
//
std::string host() const;
};
// options in [task] or [task_name:task] // options in [task] or [task_name:task]
// //
class conf_task { class conf_task {
@@ -185,16 +141,64 @@ namespace mob {
return get<bool>("remote_push_default_origin"); return get<bool>("remote_push_default_origin");
} }
// specify the configuration to build
//
mob::config configuration() const;
private: private:
std::vector<std::string> names_; std::vector<std::string> names_;
bool get_bool(std::string_view name) const; bool get_bool(std::string_view name) const;
}; };
// options in [task] or [task_name:task]
//
class conf_cmake : conf_section<std::string> {
public:
class cmake_constant {
std::string value_;
// check if the given string is equivalent to this constant
//
bool is_equivalent(std::string_view other) const;
friend class conf_cmake;
public:
constexpr cmake_constant(std::string_view value) : value_{value} {}
constexpr const auto& value() const { return value_; }
constexpr operator const std::string&() const { return value(); }
friend bool operator==(cmake_constant const& lhs, cmake_constant const& rhs)
{
return lhs.is_equivalent(rhs.value());
}
friend bool operator!=(cmake_constant const& lhs, cmake_constant const& rhs)
{
return !(lhs == rhs);
}
};
static const cmake_constant ALWAYS;
static const cmake_constant LAZY;
static const cmake_constant NEVER;
public:
conf_cmake();
// specify the value for CMAKE_INSTALL_MESSAGE
//
cmake_constant install_message() const;
// specify the toolset host configuration, if any, this is equivalent
// to -T host=XXX on the command line
//
// an empty string means no host configured
//
std::string host() const;
private:
cmake_constant
read_cmake_constant(std::string_view key,
std::vector<cmake_constant> const& allowed) const;
};
// options in [tools] // options in [tools]
// //
class conf_tools : public conf_section<fs::path> { class conf_tools : public conf_section<fs::path> {
@@ -216,13 +220,6 @@ namespace mob {
conf_versions(); conf_versions();
}; };
// options in [build-types]
//
class conf_build_types : public conf_section<config> {
public:
conf_build_types();
};
// options in [prebuilt] // options in [prebuilt]
// //
class conf_prebuilt : public conf_section<std::string> { class conf_prebuilt : public conf_section<std::string> {
@@ -287,7 +284,6 @@ namespace mob {
conf_transifex transifex(); conf_transifex transifex();
conf_prebuilt prebuilt(); conf_prebuilt prebuilt();
conf_versions version(); conf_versions version();
conf_build_types build_types();
conf_paths path(); conf_paths path();
// opens the log file, creates the directory if needed // opens the log file, creates the directory if needed
+1 -2
View File
@@ -33,8 +33,7 @@ namespace mob {
.add_task<libbsarch>() .add_task<libbsarch>()
.add_task<libloot>() .add_task<libloot>()
.add_task<openssl>() .add_task<openssl>()
.add_task<bzip2>() .add_task<bzip2>();
.add_task<directxtex>();
add_task<parallel_tasks>() add_task<parallel_tasks>()
.add_task<tasks::python>() .add_task<tasks::python>()
+10 -15
View File
@@ -218,28 +218,23 @@ namespace mob::tasks {
bootstrap(); bootstrap();
} }
// we do not need all variants of all components but since people should // some libraries only need some variants, avoid building the unnecessary
// usually be using the pre-built, we can build everything without losing too // ones
// much time and it is much easier to deal when mixing
//
// note: filesystem is only required by USVFS I think, so maybe think about
// removing it if we switch to std::filesystem in USVFS
//
clipp::arg_list components{"thread", "date_time", "filesystem", "locale",
"program_options"};
// static link, static runtime, x64 // static link, static runtime, x64
do_b2(components, "static", "static", arch::x64); do_b2({"thread", "date_time", "filesystem", "locale", "program_options"},
"static", "static", arch::x64);
// static link, static/shared runtime, x86, required by usvfs 32-bit // static link, static runtime, x86, required by usvfs 32-bit
do_b2(components, "static", "static", arch::x86); do_b2({"thread", "date_time", "filesystem", "locale"}, "static", "static",
do_b2(components, "static", "shared", arch::x86); arch::x86);
// static link, shared runtime, x64 // static link, shared runtime, x64
do_b2(components, "static", "shared", arch::x64); do_b2({"thread", "date_time", "locale", "program_options"}, "static", "shared",
arch::x64);
// shared link, shared runtime, x64 // shared link, shared runtime, x64
do_b2(components, "shared", "shared", arch::x64); do_b2({"thread", "date_time", "atomic"}, "shared", "shared", arch::x64);
} }
void boost::do_b2(const std::vector<std::string>& components, void boost::do_b2(const std::vector<std::string>& components,
-80
View File
@@ -1,80 +0,0 @@
#include "pch.h"
#include "tasks.h"
namespace mob::tasks {
namespace {
msbuild create_msbuild_tool(arch a, config config,
msbuild::ops o = msbuild::build)
{
return std::move(msbuild(o).architecture(a).configuration(config).solution(
directxtex::source_path() / "DirectXTex" /
"DirectXTex_Desktop_2022.vcxproj"));
}
} // namespace
directxtex::directxtex() : basic_task("directxtex") {}
std::string directxtex::version()
{
return conf().version().get("directxtex");
}
bool directxtex::prebuilt()
{
return false;
}
fs::path directxtex::source_path()
{
return conf().path().build() / "DirectXTex";
}
void directxtex::do_clean(clean c)
{
if (is_set(c, clean::reclone)) {
git_wrap::delete_directory(cx(), source_path());
return;
}
if (is_set(c, clean::rebuild)) {
run_tool(create_msbuild_tool(arch::x64, config::release, msbuild::clean));
run_tool(create_msbuild_tool(arch::x64, config::debug, msbuild::clean));
}
}
void directxtex::do_fetch()
{
run_tool(make_git()
.url(make_git_url("microsoft", "DirectXTex"))
.branch(version())
.root(source_path()));
}
void directxtex::do_build_and_install()
{
op::create_directories(cx(), directxtex::source_path() / "Include");
op::create_directories(cx(), directxtex::source_path() / "Lib" / "Debug");
op::create_directories(cx(), directxtex::source_path() / "Lib" / "Release");
// DO NOT run these in parallel because both generate files that are shared
// between release and debug
run_tool(create_msbuild_tool(arch::x64, config::release));
run_tool(create_msbuild_tool(arch::x64, config::debug));
const auto binary_path =
source_path() / "DirectXTex" / "Bin" / "Desktop_2022" / "x64";
for (const auto& header : {"DDS.h", "DirectXTex.h", "DirectXTex.inl "}) {
op::copy_file_to_dir_if_better(cx(), source_path() / "DirectXTex" / header,
source_path() / "Include");
}
op::copy_file_to_dir_if_better(cx(), binary_path / "Debug" / "DirectXTex.lib",
source_path() / "Lib" / "Debug");
op::copy_file_to_dir_if_better(cx(), binary_path / "Release" / "DirectXTex.lib",
source_path() / "Lib" / "Release");
}
} // namespace mob::tasks
+16 -32
View File
@@ -5,24 +5,25 @@ namespace mob::tasks {
namespace { namespace {
cmake create_cmake_tool(arch a, config config, cmake::ops o = cmake::generate) cmake create_cmake_tool(arch a, cmake::ops o = cmake::generate)
{ {
const std::string build_dir = (a == arch::x64 ? "build" : "build_32");
return std::move(cmake(o) return std::move(cmake(o)
.generator(cmake::vs) .generator(cmake::vs)
.architecture(a) .architecture(a)
.arg("-Wno-deprecated") .arg("-Wno-deprecated")
.arg("-Dgtest_force_shared_crt=ON") .arg("-Dgtest_force_shared_crt=ON")
.prefix(gtest::build_path(a, config)) .prefix(gtest::source_path() / build_dir)
.root(gtest::source_path())); .root(gtest::source_path()));
} }
msbuild create_msbuild_tool(arch a, config config, msbuild create_msbuild_tool(arch a, msbuild::ops o = msbuild::build)
msbuild::ops o = msbuild::build)
{ {
const fs::path build_path = create_cmake_tool(a, config).build_path(); const fs::path build_path = create_cmake_tool(a).build_path();
return std::move(msbuild(o).architecture(a).configuration(config).solution( return std::move(
build_path / "INSTALL.vcxproj")); msbuild(o).architecture(a).solution(build_path / "INSTALL.vcxproj"));
} }
} // namespace } // namespace
@@ -44,12 +45,6 @@ namespace mob::tasks {
return conf().path().build() / "googletest"; return conf().path().build() / "googletest";
} }
fs::path gtest::build_path(arch a, config c)
{
return source_path() / "build" / (a == arch::x64 ? "x64" : "Win32") /
msbuild::configuration_name(c);
}
void gtest::do_clean(clean c) void gtest::do_clean(clean c)
{ {
if (is_set(c, clean::reclone)) { if (is_set(c, clean::reclone)) {
@@ -58,15 +53,13 @@ namespace mob::tasks {
} }
if (is_set(c, clean::reconfigure)) { if (is_set(c, clean::reconfigure)) {
run_tool(create_cmake_tool(arch::x86, config::release, cmake::clean)); run_tool(create_cmake_tool(arch::x86, cmake::clean));
run_tool(create_cmake_tool(arch::x64, config::release, cmake::clean)); run_tool(create_cmake_tool(arch::x64, cmake::clean));
} }
if (is_set(c, clean::rebuild)) { if (is_set(c, clean::rebuild)) {
run_tool(create_msbuild_tool(arch::x86, config::release, msbuild::clean)); run_tool(create_msbuild_tool(arch::x86, msbuild::clean));
run_tool(create_msbuild_tool(arch::x86, config::debug, msbuild::clean)); run_tool(create_msbuild_tool(arch::x64, msbuild::clean));
run_tool(create_msbuild_tool(arch::x64, config::release, msbuild::clean));
run_tool(create_msbuild_tool(arch::x64, config::debug, msbuild::clean));
} }
} }
@@ -80,24 +73,15 @@ namespace mob::tasks {
void gtest::do_build_and_install() void gtest::do_build_and_install()
{ {
op::create_directories(cx(), gtest::build_path(arch::x64).parent_path());
op::create_directories(cx(), gtest::build_path(arch::x86).parent_path());
parallel({{"gtest64", parallel({{"gtest64",
[&] { [&] {
run_tool(create_cmake_tool(arch::x64, config::release)); run_tool(create_cmake_tool(arch::x64));
run_tool(create_msbuild_tool(arch::x64, config::release)); run_tool(create_msbuild_tool(arch::x64));
run_tool(create_cmake_tool(arch::x64, config::debug));
run_tool(create_msbuild_tool(arch::x64, config::debug));
}}, }},
{"gtest32", [&] { {"gtest32", [&] {
run_tool(create_cmake_tool(arch::x86, config::release)); run_tool(create_cmake_tool(arch::x86));
run_tool(create_msbuild_tool(arch::x86, config::release)); run_tool(create_msbuild_tool(arch::x86));
run_tool(create_cmake_tool(arch::x86, config::debug));
run_tool(create_msbuild_tool(arch::x86, config::debug));
}}}); }}});
} }
+1 -8
View File
@@ -7,9 +7,7 @@ namespace mob::tasks {
std::string dir_name() std::string dir_name()
{ {
return "libbsarch-" + libbsarch::version() + "-" + return "libbsarch-" + libbsarch::version() + "-release-x64";
(libbsarch::build_type() == config::debug ? "debug" : "release") +
"-x64";
} }
url source_url() url source_url()
@@ -27,11 +25,6 @@ namespace mob::tasks {
return conf().version().get("libbsarch"); return conf().version().get("libbsarch");
} }
config libbsarch::build_type()
{
return conf().build_types().get("libbsarch");
}
bool libbsarch::prebuilt() bool libbsarch::prebuilt()
{ {
return false; return false;
+21 -26
View File
@@ -200,41 +200,36 @@ namespace mob::tasks {
cmake modorganizer::create_cmake_tool(cmake::ops o) cmake modorganizer::create_cmake_tool(cmake::ops o)
{ {
return create_cmake_tool(source_path(), o, task_conf().configuration()); return create_cmake_tool(source_path(), o);
} }
cmake modorganizer::create_cmake_tool(const fs::path& root, cmake::ops o, config c) cmake modorganizer::create_cmake_tool(const fs::path& root, cmake::ops o)
{ {
return std::move( return std::move(cmake(o)
cmake(o) .generator(cmake::vs)
.generator(cmake::vs) .def("CMAKE_INSTALL_PREFIX:PATH", conf().path().install())
.def("CMAKE_INSTALL_PREFIX:PATH", conf().path().install()) .def("DEPENDENCIES_DIR", conf().path().build())
.def("DEPENDENCIES_DIR", conf().path().build()) .def("BOOST_ROOT", boost::source_path())
.def("BOOST_ROOT", boost::source_path()) .def("BOOST_LIBRARYDIR", boost::lib_path(arch::x64))
.def("BOOST_LIBRARYDIR", boost::lib_path(arch::x64)) .def("SPDLOG_ROOT", spdlog::source_path())
.def("SPDLOG_ROOT", spdlog::source_path()) .def("LOOT_PATH", libloot::source_path())
.def("LOOT_PATH", libloot::source_path()) .def("LZ4_ROOT", lz4::source_path())
.def("LZ4_ROOT", lz4::source_path()) .def("QT_ROOT", qt::installation_path())
.def("QT_ROOT", qt::installation_path()) .def("ZLIB_ROOT", zlib::source_path())
.def("ZLIB_ROOT", zlib::source_path()) .def("PYTHON_ROOT", python::source_path())
.def("PYTHON_ROOT", python::source_path()) .def("SEVENZ_ROOT", sevenz::source_path())
.def("SEVENZ_ROOT", sevenz::source_path()) .def("LIBBSARCH_ROOT", libbsarch::source_path())
.def("LIBBSARCH_ROOT", libbsarch::source_path()) .def("BOOST_DI_ROOT", boost_di::source_path())
.def("BOOST_DI_ROOT", boost_di::source_path()) .def("GTEST_ROOT", gtest::source_path())
// gtest has no RelWithDebInfo, so simply use Debug/Release .def("OPENSSL_ROOT_DIR", openssl::source_path())
.def("GTEST_ROOT", .root(root));
gtest::build_path(arch::x64, c == config::debug ? config::debug
: config::release))
.def("OPENSSL_ROOT_DIR", openssl::source_path())
.def("DIRECTXTEX_ROOT", directxtex::source_path())
.root(root));
} }
msbuild modorganizer::create_msbuild_tool(msbuild::ops o) msbuild modorganizer::create_msbuild_tool(msbuild::ops o)
{ {
return std::move(msbuild(o) return std::move(msbuild(o)
.solution(project_file_path()) .solution(project_file_path())
.configuration(task_conf().configuration()) .config("RelWithDebInfo")
.architecture(arch::x64)); .architecture(arch::x64));
} }
+11 -60
View File
@@ -47,9 +47,7 @@ namespace mob::tasks {
url prebuilt_url() url prebuilt_url()
{ {
return make_prebuilt_url( return make_prebuilt_url("PyQt6_gpl-prebuilt-" + pyqt::version() + ".7z");
"PyQt6_gpl-prebuilt-" + pyqt::version() +
(pyqt::build_type() == config::debug ? "-debug" : "") + ".7z");
} }
// file created by sip-module.exe // file created by sip-module.exe
@@ -88,11 +86,6 @@ namespace mob::tasks {
return source_path() / "build"; return source_path() / "build";
} }
config pyqt::build_type()
{
return conf().build_types().get("pyqt");
}
std::string pyqt::pyqt_sip_module_name() std::string pyqt::pyqt_sip_module_name()
{ {
return "PyQt6.sip"; return "PyQt6.sip";
@@ -173,24 +166,7 @@ namespace mob::tasks {
void pyqt::build_and_install_from_source() void pyqt::build_and_install_from_source()
{ {
// use pip to install the pyqt builder // use pip to install the pyqt builder
if (python::build_type() == config::debug) { run_tool(pip(pip::install).package("PyQt-builder").version(builder_version()));
// PyQt-builder has sip as a dependency, so installing it directly will
// replace the sip we have installed manually, but the installed sip will
// not work (see comment in sip::build() for details)
//
// the workaround is to install the dependencies manually (only packaging),
// and then use a --no-dependencies install with pip
//
run_tool(pip(pip::install).package("packaging"));
run_tool(pip(pip::install)
.package("PyQt-builder")
.no_dependencies()
.version(builder_version()));
}
else {
run_tool(
pip(pip::install).package("PyQt-builder").version(builder_version()));
}
// patch for builder.py // patch for builder.py
run_tool(patcher() run_tool(patcher()
@@ -273,30 +249,9 @@ namespace mob::tasks {
cx().trace(context::bypass, "pyqt already installed"); cx().trace(context::bypass, "pyqt already installed");
} }
else { else {
if (python::build_type() == config::debug) { // run `pip install` on the generated PyQt6_sip-XX.tar.gz file
run_tool(
const auto pyqt_sip_folder = source_path() / "PyQt6_sip" / pip(pip::install).file(conf().path().cache() / sip_install_file()));
("pyqt6_sip-" + sip::version_for_pyqt());
// in debug, we need to do stuff manually because pip does not work
// as expected
run_tool(extractor()
.file(conf().path().cache() / sip_install_file())
.output(pyqt_sip_folder.parent_path()));
run_tool(mob::python()
.root(pyqt_sip_folder)
.arg("setup.py")
.arg("build")
.arg("--debug"));
run_tool(pip(pip::install).file(pyqt_sip_folder));
}
else {
// run `pip install` on the generated PyQt6_sip-XX.tar.gz file
run_tool(
pip(pip::install).file(conf().path().cache() / sip_install_file()));
}
// done, create the bypass file // done, create the bypass file
installed_bypass.create(); installed_bypass.create();
@@ -312,17 +267,13 @@ namespace mob::tasks {
// python-XX/PCBuild/amd64, those are needed by PyQt6 when building several // python-XX/PCBuild/amd64, those are needed by PyQt6 when building several
// projects // projects
const std::vector<std::string> dlls{"Qt6Core", "Qt6Xml"}; op::copy_file_to_dir_if_better(cx(), qt::bin_path() / "Qt6Core.dll",
python::build_path(),
op::unsafe); // source file is outside prefix
for (auto dll : dlls) { op::copy_file_to_dir_if_better(cx(), qt::bin_path() / "Qt6Xml.dll",
if (build_type() == config::debug) { python::build_path(),
dll += "d"; op::unsafe); // source file is outside prefix
}
dll += ".dll";
op::copy_file_to_dir_if_better(
cx(), qt::bin_path() / dll, python::build_path(),
op::unsafe); // source file is outside prefix
}
// installation of PyQt6 python files (.pyd, etc.) is done // installation of PyQt6 python files (.pyd, etc.) is done
// by the python plugin directly // by the python plugin directly
+12 -29
View File
@@ -30,9 +30,7 @@ namespace mob::tasks {
url prebuilt_url() url prebuilt_url()
{ {
return make_prebuilt_url( return make_prebuilt_url("python-prebuilt-" + version_without_v() + ".7z");
"python-prebuilt-" + version_without_v() +
(python::build_type() == config::debug ? "-debug" : "") + ".7z");
} }
fs::path solution_file() fs::path solution_file()
@@ -91,11 +89,6 @@ namespace mob::tasks {
return source_path() / "PCBuild" / "amd64"; return source_path() / "PCBuild" / "amd64";
} }
config python::build_type()
{
return conf().build_types().get("python");
}
void python::do_clean(clean c) void python::do_clean(clean c)
{ {
if (prebuilt()) { if (prebuilt()) {
@@ -197,22 +190,16 @@ namespace mob::tasks {
const auto bat = source_path() / "python.bat"; const auto bat = source_path() / "python.bat";
auto p = process()
.binary(bat)
.arg(fs::path("PC/layout"))
.arg("--source", source_path())
.arg("--build", build_path())
.arg("--temp", (build_path() / "pythoncore_temp"))
.arg("--copy", (build_path() / "pythoncore"))
.arg("--preset-embed")
.cwd(source_path());
if (build_type() == config::debug) {
p = p.arg("--debug");
}
// package libs into pythonXX.zip // package libs into pythonXX.zip
run_tool(process_runner(p)); run_tool(process_runner(process()
.binary(bat)
.arg(fs::path("PC/layout"))
.arg("--source", source_path())
.arg("--build", build_path())
.arg("--temp", (build_path() / "pythoncore_temp"))
.arg("--copy", (build_path() / "pythoncore"))
.arg("--preset-embed")
.cwd(source_path())));
} }
void python::copy_files() void python::copy_files()
@@ -223,9 +210,7 @@ namespace mob::tasks {
// pdbs // pdbs
op::copy_file_to_dir_if_better( op::copy_file_to_dir_if_better(
cx(), cx(), build_path() / ("python" + version_for_dll() + ".pdb"),
build_path() / ("python" + version_for_dll() +
(build_type() == config::debug ? "_d" : "") + ".pdb"),
conf().path().install_pdbs()); conf().path().install_pdbs());
// dlls and python libraries are installed by the python plugin // dlls and python libraries are installed by the python plugin
@@ -244,7 +229,6 @@ namespace mob::tasks {
.solution(solution_file()) .solution(solution_file())
.targets({"python", "pythonw", "python3dll", "select", "pyexpat", .targets({"python", "pythonw", "python3dll", "select", "pyexpat",
"unicodedata", "_queue", "_bz2", "_ssl", "_overlapped"}) "unicodedata", "_queue", "_bz2", "_ssl", "_overlapped"})
.configuration(build_type())
.properties( .properties(
{"bz2Dir=" + path_to_utf8(bzip2::source_path()), {"bz2Dir=" + path_to_utf8(bzip2::source_path()),
"zlibDir=" + path_to_utf8(zlib::source_path()), "zlibDir=" + path_to_utf8(zlib::source_path()),
@@ -254,8 +238,7 @@ namespace mob::tasks {
fs::path python::python_exe() fs::path python::python_exe()
{ {
return build_path() / return build_path() / "python.exe";
(build_type() == config::debug ? "python_d.exe" : "python.exe");
} }
fs::path python::include_path() fs::path python::include_path()
+1 -10
View File
@@ -140,16 +140,7 @@ namespace mob::tasks {
void sip::build() void sip::build()
{ {
if (python::build_type() == config::debug) { run_tool(pip(pip::install).file(source_path()));
// if Python is build in debug mode, fall back to old setup.py because pip
// install seems to generated broken script wrapper that point to a
// non-existing python.exe instead of python_d.exe
run_tool(pip(pip::install).package("setuptools"));
run_tool(mob::python().root(source_path()).arg("setup.py").arg("install"));
}
else {
run_tool(pip(pip::install).file(source_path()));
}
} }
void sip::convert_script_file_to_acp(const std::string& filename) void sip::convert_script_file_to_acp(const std::string& filename)
+2 -25
View File
@@ -77,20 +77,6 @@ namespace mob::tasks {
void do_fetch() override; void do_fetch() override;
}; };
class directxtex : public basic_task<directxtex> {
public:
directxtex();
static std::string version();
static bool prebuilt();
static fs::path source_path();
protected:
void do_clean(clean c) override;
void do_fetch() override;
void do_build_and_install() override;
};
class explorerpp : public basic_task<explorerpp> { class explorerpp : public basic_task<explorerpp> {
public: public:
explorerpp(); explorerpp();
@@ -111,7 +97,6 @@ namespace mob::tasks {
static std::string version(); static std::string version();
static bool prebuilt(); static bool prebuilt();
static fs::path source_path(); static fs::path source_path();
static fs::path build_path(arch = arch::x64, config = config::release);
protected: protected:
void do_clean(clean c) override; void do_clean(clean c) override;
@@ -138,7 +123,6 @@ namespace mob::tasks {
libbsarch(); libbsarch();
static std::string version(); static std::string version();
static config build_type();
static bool prebuilt(); static bool prebuilt();
static fs::path source_path(); static fs::path source_path();
@@ -213,8 +197,7 @@ namespace mob::tasks {
// projects, used internally, but also by the cmake command // projects, used internally, but also by the cmake command
// //
static cmake create_cmake_tool(const fs::path& root, static cmake create_cmake_tool(const fs::path& root,
cmake::ops o = cmake::generate, cmake::ops o = cmake::generate);
config config = config::relwithdebinfo);
// flags for some MO projects // flags for some MO projects
enum flags { enum flags {
@@ -377,7 +360,6 @@ namespace mob::tasks {
static fs::path source_path(); static fs::path source_path();
static fs::path build_path(); static fs::path build_path();
static config build_type();
// "PyQt5.sip", used both in pyqt and sip // "PyQt5.sip", used both in pyqt and sip
// //
@@ -437,10 +419,6 @@ namespace mob::tasks {
// //
static fs::path site_packages_path(); static fs::path site_packages_path();
// configuration to build
//
static config build_type();
protected: protected:
void do_clean(clean c) override; void do_clean(clean c) override;
void do_fetch() override; void do_fetch() override;
@@ -671,8 +649,7 @@ namespace mob::tasks {
void fetch_from_source(); void fetch_from_source();
void build_and_install_from_source(); void build_and_install_from_source();
msbuild create_msbuild_tool(arch, msbuild::ops = msbuild::build, msbuild create_msbuild_tool(arch a, msbuild::ops o = msbuild::build) const;
config = config::release) const;
}; };
class zlib : public basic_task<zlib> { class zlib : public basic_task<zlib> {
+3 -6
View File
@@ -42,10 +42,8 @@ namespace mob::tasks {
if (is_set(c, clean::rebuild)) { if (is_set(c, clean::rebuild)) {
// msbuild clean // msbuild clean
run_tool(create_msbuild_tool(arch::x86, msbuild::clean, run_tool(create_msbuild_tool(arch::x86, msbuild::clean));
task_conf().configuration())); run_tool(create_msbuild_tool(arch::x64, msbuild::clean));
run_tool(create_msbuild_tool(arch::x64, msbuild::clean,
task_conf().configuration()));
} }
} }
@@ -73,7 +71,7 @@ namespace mob::tasks {
run_tool(create_msbuild_tool(arch::x64)); run_tool(create_msbuild_tool(arch::x64));
} }
msbuild usvfs::create_msbuild_tool(arch a, msbuild::ops o, config c) const msbuild usvfs::create_msbuild_tool(arch a, msbuild::ops o) const
{ {
// usvfs doesn't use "Win32" for 32-bit, it uses "x86" // usvfs doesn't use "Win32" for 32-bit, it uses "x86"
// //
@@ -92,7 +90,6 @@ namespace mob::tasks {
return std::move( return std::move(
msbuild(o) msbuild(o)
.platform(plat) .platform(plat)
.configuration(c)
.targets({"usvfs_proxy"}) .targets({"usvfs_proxy"})
.solution(source_path() / "vsbuild" / "usvfs.sln") .solution(source_path() / "vsbuild" / "usvfs.sln")
.env(env::vs(a) .env(env::vs(a)
+1 -1
View File
@@ -129,7 +129,7 @@ namespace mob {
.binary(binary()) .binary(binary())
.arg("-DCMAKE_BUILD_TYPE=Release") .arg("-DCMAKE_BUILD_TYPE=Release")
.arg("-DCMAKE_INSTALL_MESSAGE=" + .arg("-DCMAKE_INSTALL_MESSAGE=" +
conf_cmake::to_string(conf().cmake().install_message())) conf().cmake().install_message().value())
.arg("--log-level=ERROR") .arg("--log-level=ERROR")
.arg("--no-warn-unused-cli"); .arg("--no-warn-unused-cli");
+2 -4
View File
@@ -14,25 +14,23 @@ namespace mob {
// type of build files generated // type of build files generated
// //
enum class generators { enum generators {
// generates build files for visual studio // generates build files for visual studio
vs = 0x01, vs = 0x01,
// generates build files for jom/nmake // generates build files for jom/nmake
jom = 0x02 jom = 0x02
}; };
using enum generators;
// what run() will do // what run() will do
// //
enum class ops { enum ops {
// generates the build files // generates the build files
generate = 1, generate = 1,
// cleans the build files so they're regenerated from scratch // cleans the build files so they're regenerated from scratch
clean clean
}; };
using enum ops;
cmake(ops o = generate); cmake(ops o = generate);
+5 -19
View File
@@ -7,8 +7,8 @@
namespace mob { namespace mob {
msbuild::msbuild(ops o) msbuild::msbuild(ops o)
: basic_process_runner("msbuild"), op_(o), config_(config::release), : basic_process_runner("msbuild"), op_(o), config_("Release"), arch_(arch::def),
arch_(arch::def), flags_(noflags) flags_(noflags)
{ {
} }
@@ -17,20 +17,6 @@ namespace mob {
return conf().tool().get("msbuild"); return conf().tool().get("msbuild");
} }
std::string msbuild::configuration_name(config c)
{
switch (c) {
case config::debug:
return "Debug";
case config::release:
return "Release";
case config::relwithdebinfo:
[[fallthrough]];
default:
return "RelWithDebInfo";
}
}
msbuild& msbuild::solution(const fs::path& sln) msbuild& msbuild::solution(const fs::path& sln)
{ {
sln_ = sln; sln_ = sln;
@@ -49,9 +35,9 @@ namespace mob {
return *this; return *this;
} }
msbuild& msbuild::configuration(config c) msbuild& msbuild::config(const std::string& s)
{ {
config_ = c; config_ = s;
return *this; return *this;
} }
@@ -165,7 +151,7 @@ namespace mob {
.arg("-property:EnforceProcessCountAcrossBuilds=true"); .arg("-property:EnforceProcessCountAcrossBuilds=true");
} }
p.arg("-property:Configuration=", configuration_name(config_), process::quote) p.arg("-property:Configuration=", config_, process::quote)
.arg("-property:PlatformToolset=" + toolset) .arg("-property:PlatformToolset=" + toolset)
.arg("-property:WindowsTargetPlatformVersion=" + vs::sdk()) .arg("-property:WindowsTargetPlatformVersion=" + vs::sdk())
.arg("-property:Platform=", platform_property(), process::quote) .arg("-property:Platform=", platform_property(), process::quote)

Some files were not shown because too many files have changed in this diff Show More