Author SHA1 Message Date
Mikaël Capelle d9d7c8fc41 Fix format for clang-format 17. 2024-05-26 09:55:14 +02:00
Mikaël Capelle f28c98e274 Use MO2 formatting action. 2024-05-26 09:53:47 +02:00
24 changed files with 358 additions and 619 deletions
+11 -89
View File
@@ -21,88 +21,14 @@ host =
super = cmake_common modorganizer* githubpp
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]
enabled = true
mo_org = ModOrganizer2
mo_branch = master
mo_fallback =
no_pull = false
ignore_ts = false
revert_ts = false
configuration = RelWithDebInfo
enabled = true
mo_org = ModOrganizer2
mo_branch = master
mo_fallback =
no_pull = false
ignore_ts = false
revert_ts = false
git_url_prefix = https://github.com/
git_shallow = true
@@ -163,6 +89,7 @@ lz4 = true
openssl = true
pyqt = true
python = true
usvfs = false
[versions]
vs = 17
@@ -174,7 +101,6 @@ boost = 1.85.0
boost_vs = 14.3
fmt = 10.2.1
gtest = main
directxtex = main
libloot = 0.22.4
lz4 = v1.9.4
nmm = 0.71.2
@@ -190,9 +116,10 @@ spdlog = v1.14.1
qt = 6.7.0
qt_vs = 2019
zlib = v1.3.1
libbsarch = 0.0.10
usvfs = master
libbsarch = 0.0.9
usvfs = qt6
explorerpp = 1.4.0
ss_paper_lad_6788 = 7.2
ss_paper_automata_6788 = 3.2
ss_paper_mono_6788 = 3.2
@@ -203,11 +130,6 @@ ss_starfield_trosski = V1.11
ss_fallout3_trosski = v1.11
ss_fallout4_trosski = v1.11
[build-types]
libbsarch = release
pyqt = release
python = release
[paths]
third_party =
prefix =
+6 -8
View File
@@ -52,11 +52,11 @@
#### Using aqt
- Open a terminal with administrative rights, and run
```powershell
aqt install-qt --outputdir "C:\Qt" windows desktop 6.7.0 win64_msvc2019_64 -m qtwebengine qtimageformats qtpositioning qtserialport qtwebchannel qtwebsockets
aqt install-qt --outputdir "C:\Qt" windows desktop 6.5.0 win64_msvc2019_64 -m qtwebengine qtimageformats qtpositioning qtserialport qtwebchannel qtwebsockets
```
### Qt - Manual installation
- Install Qt 6.7.0 ([Installer](https://download.qt.io/official_releases/online_installers/qt-unified-windows-x64-online.exe)) and select these components:
- Install Qt 6.5.0 ([Installer](https://download.qt.io/official_releases/online_installers/qt-unified-windows-x64-online.exe)) and select these components:
- MSVC 2019 64-bit
- Additional Libraries:
- Qt WebEngine (display nexus pages)
@@ -68,7 +68,7 @@ aqt install-qt --outputdir "C:\Qt" windows desktop 6.7.0 win64_msvc2019_64 -m qt
- Optional:
- Qt Source Files
- Qt Debug Files
### 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))
- Desktop development with C++
@@ -91,7 +91,6 @@ aqt install-qt --outputdir "C:\Qt" windows desktop 6.7.0 win64_msvc2019_64 -m qt
mkdir C:\dev
cd C:\dev
git clone https://github.com/ModOrganizer2/mob
./bootstrap.ps1
mob -d C:\dev\modorganizer build
```
- Once `mob` is finished, everything will be in `C:\dev\modorganizer`. Mod Organizer can be run from `install\bin\ModOrganizer.exe`. The Visual Studio solution for Mod Organizer itself is `build\modorganizer_super\modorganizer\vsbuild\organizer.sln`.
@@ -141,10 +140,9 @@ Inside the INI file are `[sections]` and `key = value` pairs. The `[task]` secti
### `[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_*`.
| 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. |
| `configuration` | enum | Which configuration to build, should be one of Debug, Release or RelWithDebInfo with RelWithDebInfo being the default.|
| 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. |
#### Common git options
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_) %
"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`");
}
int cmake_command::do_run()
{
auto t = tasks::modorganizer::create_cmake_tool(
fs::path(utf8_to_utf16(path_)), mob::cmake::generate,
debug_ ? config::debug : config::relwithdebinfo);
auto t = tasks::modorganizer::create_cmake_tool(fs::path(utf8_to_utf16(path_)));
t.generator(gen_);
t.cmd(cmd_);
+1 -2
View File
@@ -382,8 +382,7 @@ namespace mob {
private:
std::string gen_;
std::string cmd_;
bool x64_ = true;
bool debug_ = false;
bool x64_ = true;
std::string prefix_;
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 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.)
static section_map g_conf;
@@ -32,18 +27,6 @@ namespace mob::details {
static int g_file_log_level = 5;
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)
{
return (s == "true" || s == "yes" || s == "1");
@@ -102,17 +85,6 @@ namespace mob::details {
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
// from the master ini
//
@@ -212,28 +184,6 @@ namespace mob::details {
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 {
@@ -694,11 +644,6 @@ namespace mob {
return {};
}
conf_build_types conf::build_types()
{
return {};
}
conf_paths conf::path()
{
return {};
@@ -721,34 +666,6 @@ namespace mob {
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)) {}
std::string conf_task::get(std::string_view key) const
@@ -761,12 +678,45 @@ namespace mob {
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(
names_[0], "configuration",
details::get_string_for_task(names_, "configuration"),
details::s_configuration_values);
// _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(value_), std::end(value_), std::begin(other),
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") {}
@@ -775,8 +725,6 @@ namespace mob {
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_paths::conf_paths() : conf_section("paths") {}
+53 -57
View File
@@ -1,7 +1,5 @@
#pragma once
#include "../utility.h"
// these shouldn't be called directly, they're used by some of the template
// below
//
@@ -11,18 +9,6 @@ namespace mob::details {
//
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
//
bool get_bool(std::string_view section, std::string_view key);
@@ -62,14 +48,7 @@ namespace mob {
public:
DefaultType get(std::string_view key) const
{
const auto value = details::get_string(name_, key);
if constexpr (std::is_convertible_v<std::string, DefaultType>) {
return value;
}
else {
return details::string_to<DefaultType>(value);
}
return details::get_string(name_, key);
}
// undefined
@@ -123,29 +102,6 @@ namespace mob {
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]
//
class conf_task {
@@ -185,16 +141,64 @@ namespace mob {
return get<bool>("remote_push_default_origin");
}
// specify the configuration to build
//
mob::config configuration() const;
private:
std::vector<std::string> names_;
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]
//
class conf_tools : public conf_section<fs::path> {
@@ -216,13 +220,6 @@ namespace mob {
conf_versions();
};
// options in [build-types]
//
class conf_build_types : public conf_section<config> {
public:
conf_build_types();
};
// options in [prebuilt]
//
class conf_prebuilt : public conf_section<std::string> {
@@ -287,7 +284,6 @@ namespace mob {
conf_transifex transifex();
conf_prebuilt prebuilt();
conf_versions version();
conf_build_types build_types();
conf_paths path();
// opens the log file, creates the directory if needed
+1 -2
View File
@@ -33,8 +33,7 @@ namespace mob {
.add_task<libbsarch>()
.add_task<libloot>()
.add_task<openssl>()
.add_task<bzip2>()
.add_task<directxtex>();
.add_task<bzip2>();
add_task<parallel_tasks>()
.add_task<tasks::python>()
+10 -15
View File
@@ -218,28 +218,23 @@ namespace mob::tasks {
bootstrap();
}
// we do not need all variants of all components but since people should
// usually be using the pre-built, we can build everything without losing too
// 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"};
// some libraries only need some variants, avoid building the unnecessary
// ones
// 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
do_b2(components, "static", "static", arch::x86);
do_b2(components, "static", "shared", arch::x86);
// static link, static runtime, x86, required by usvfs 32-bit
do_b2({"thread", "date_time", "filesystem", "locale"}, "static", "static",
arch::x86);
// 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
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,
-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 {
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)
.generator(cmake::vs)
.architecture(a)
.arg("-Wno-deprecated")
.arg("-Dgtest_force_shared_crt=ON")
.prefix(gtest::build_path(a, config))
.prefix(gtest::source_path() / build_dir)
.root(gtest::source_path()));
}
msbuild create_msbuild_tool(arch a, config config,
msbuild::ops o = msbuild::build)
msbuild create_msbuild_tool(arch a, 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(
build_path / "INSTALL.vcxproj"));
return std::move(
msbuild(o).architecture(a).solution(build_path / "INSTALL.vcxproj"));
}
} // namespace
@@ -44,12 +45,6 @@ namespace mob::tasks {
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)
{
if (is_set(c, clean::reclone)) {
@@ -58,15 +53,13 @@ namespace mob::tasks {
}
if (is_set(c, clean::reconfigure)) {
run_tool(create_cmake_tool(arch::x86, config::release, cmake::clean));
run_tool(create_cmake_tool(arch::x64, config::release, cmake::clean));
run_tool(create_cmake_tool(arch::x86, cmake::clean));
run_tool(create_cmake_tool(arch::x64, cmake::clean));
}
if (is_set(c, clean::rebuild)) {
run_tool(create_msbuild_tool(arch::x86, config::release, msbuild::clean));
run_tool(create_msbuild_tool(arch::x86, config::debug, msbuild::clean));
run_tool(create_msbuild_tool(arch::x64, config::release, msbuild::clean));
run_tool(create_msbuild_tool(arch::x64, config::debug, msbuild::clean));
run_tool(create_msbuild_tool(arch::x86, msbuild::clean));
run_tool(create_msbuild_tool(arch::x64, msbuild::clean));
}
}
@@ -80,24 +73,15 @@ namespace mob::tasks {
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",
[&] {
run_tool(create_cmake_tool(arch::x64, config::release));
run_tool(create_msbuild_tool(arch::x64, config::release));
run_tool(create_cmake_tool(arch::x64, config::debug));
run_tool(create_msbuild_tool(arch::x64, config::debug));
run_tool(create_cmake_tool(arch::x64));
run_tool(create_msbuild_tool(arch::x64));
}},
{"gtest32", [&] {
run_tool(create_cmake_tool(arch::x86, config::release));
run_tool(create_msbuild_tool(arch::x86, config::release));
run_tool(create_cmake_tool(arch::x86, config::debug));
run_tool(create_msbuild_tool(arch::x86, config::debug));
run_tool(create_cmake_tool(arch::x86));
run_tool(create_msbuild_tool(arch::x86));
}}});
}
+1 -8
View File
@@ -7,9 +7,7 @@ namespace mob::tasks {
std::string dir_name()
{
return "libbsarch-" + libbsarch::version() + "-" +
(libbsarch::build_type() == config::debug ? "debug" : "release") +
"-x64";
return "libbsarch-" + libbsarch::version() + "-release-x64";
}
url source_url()
@@ -27,11 +25,6 @@ namespace mob::tasks {
return conf().version().get("libbsarch");
}
config libbsarch::build_type()
{
return conf().build_types().get("libbsarch");
}
bool libbsarch::prebuilt()
{
return false;
+21 -26
View File
@@ -200,41 +200,36 @@ namespace mob::tasks {
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(
cmake(o)
.generator(cmake::vs)
.def("CMAKE_INSTALL_PREFIX:PATH", conf().path().install())
.def("DEPENDENCIES_DIR", conf().path().build())
.def("BOOST_ROOT", boost::source_path())
.def("BOOST_LIBRARYDIR", boost::lib_path(arch::x64))
.def("SPDLOG_ROOT", spdlog::source_path())
.def("LOOT_PATH", libloot::source_path())
.def("LZ4_ROOT", lz4::source_path())
.def("QT_ROOT", qt::installation_path())
.def("ZLIB_ROOT", zlib::source_path())
.def("PYTHON_ROOT", python::source_path())
.def("SEVENZ_ROOT", sevenz::source_path())
.def("LIBBSARCH_ROOT", libbsarch::source_path())
.def("BOOST_DI_ROOT", boost_di::source_path())
// gtest has no RelWithDebInfo, so simply use Debug/Release
.def("GTEST_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));
return std::move(cmake(o)
.generator(cmake::vs)
.def("CMAKE_INSTALL_PREFIX:PATH", conf().path().install())
.def("DEPENDENCIES_DIR", conf().path().build())
.def("BOOST_ROOT", boost::source_path())
.def("BOOST_LIBRARYDIR", boost::lib_path(arch::x64))
.def("SPDLOG_ROOT", spdlog::source_path())
.def("LOOT_PATH", libloot::source_path())
.def("LZ4_ROOT", lz4::source_path())
.def("QT_ROOT", qt::installation_path())
.def("ZLIB_ROOT", zlib::source_path())
.def("PYTHON_ROOT", python::source_path())
.def("SEVENZ_ROOT", sevenz::source_path())
.def("LIBBSARCH_ROOT", libbsarch::source_path())
.def("BOOST_DI_ROOT", boost_di::source_path())
.def("GTEST_ROOT", gtest::source_path())
.def("OPENSSL_ROOT_DIR", openssl::source_path())
.root(root));
}
msbuild modorganizer::create_msbuild_tool(msbuild::ops o)
{
return std::move(msbuild(o)
.solution(project_file_path())
.configuration(task_conf().configuration())
.config("RelWithDebInfo")
.architecture(arch::x64));
}
+11 -60
View File
@@ -47,9 +47,7 @@ namespace mob::tasks {
url prebuilt_url()
{
return make_prebuilt_url(
"PyQt6_gpl-prebuilt-" + pyqt::version() +
(pyqt::build_type() == config::debug ? "-debug" : "") + ".7z");
return make_prebuilt_url("PyQt6_gpl-prebuilt-" + pyqt::version() + ".7z");
}
// file created by sip-module.exe
@@ -88,11 +86,6 @@ namespace mob::tasks {
return source_path() / "build";
}
config pyqt::build_type()
{
return conf().build_types().get("pyqt");
}
std::string pyqt::pyqt_sip_module_name()
{
return "PyQt6.sip";
@@ -173,24 +166,7 @@ namespace mob::tasks {
void pyqt::build_and_install_from_source()
{
// use pip to install the pyqt builder
if (python::build_type() == config::debug) {
// 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()));
}
run_tool(pip(pip::install).package("PyQt-builder").version(builder_version()));
// patch for builder.py
run_tool(patcher()
@@ -273,30 +249,9 @@ namespace mob::tasks {
cx().trace(context::bypass, "pyqt already installed");
}
else {
if (python::build_type() == config::debug) {
const auto pyqt_sip_folder = source_path() / "PyQt6_sip" /
("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()));
}
// 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
installed_bypass.create();
@@ -312,17 +267,13 @@ namespace mob::tasks {
// python-XX/PCBuild/amd64, those are needed by PyQt6 when building several
// 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) {
if (build_type() == config::debug) {
dll += "d";
}
dll += ".dll";
op::copy_file_to_dir_if_better(
cx(), qt::bin_path() / dll, python::build_path(),
op::unsafe); // source file is outside prefix
}
op::copy_file_to_dir_if_better(cx(), qt::bin_path() / "Qt6Xml.dll",
python::build_path(),
op::unsafe); // source file is outside prefix
// installation of PyQt6 python files (.pyd, etc.) is done
// by the python plugin directly
+12 -29
View File
@@ -30,9 +30,7 @@ namespace mob::tasks {
url prebuilt_url()
{
return make_prebuilt_url(
"python-prebuilt-" + version_without_v() +
(python::build_type() == config::debug ? "-debug" : "") + ".7z");
return make_prebuilt_url("python-prebuilt-" + version_without_v() + ".7z");
}
fs::path solution_file()
@@ -91,11 +89,6 @@ namespace mob::tasks {
return source_path() / "PCBuild" / "amd64";
}
config python::build_type()
{
return conf().build_types().get("python");
}
void python::do_clean(clean c)
{
if (prebuilt()) {
@@ -197,22 +190,16 @@ namespace mob::tasks {
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
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()
@@ -223,9 +210,7 @@ namespace mob::tasks {
// pdbs
op::copy_file_to_dir_if_better(
cx(),
build_path() / ("python" + version_for_dll() +
(build_type() == config::debug ? "_d" : "") + ".pdb"),
cx(), build_path() / ("python" + version_for_dll() + ".pdb"),
conf().path().install_pdbs());
// dlls and python libraries are installed by the python plugin
@@ -244,7 +229,6 @@ namespace mob::tasks {
.solution(solution_file())
.targets({"python", "pythonw", "python3dll", "select", "pyexpat",
"unicodedata", "_queue", "_bz2", "_ssl", "_overlapped"})
.configuration(build_type())
.properties(
{"bz2Dir=" + path_to_utf8(bzip2::source_path()),
"zlibDir=" + path_to_utf8(zlib::source_path()),
@@ -254,8 +238,7 @@ namespace mob::tasks {
fs::path python::python_exe()
{
return build_path() /
(build_type() == config::debug ? "python_d.exe" : "python.exe");
return build_path() / "python.exe";
}
fs::path python::include_path()
+1 -10
View File
@@ -140,16 +140,7 @@ namespace mob::tasks {
void sip::build()
{
if (python::build_type() == config::debug) {
// 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()));
}
run_tool(pip(pip::install).file(source_path()));
}
void sip::convert_script_file_to_acp(const std::string& filename)
+13 -25
View File
@@ -77,20 +77,6 @@ namespace mob::tasks {
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> {
public:
explorerpp();
@@ -111,7 +97,6 @@ namespace mob::tasks {
static std::string version();
static bool prebuilt();
static fs::path source_path();
static fs::path build_path(arch = arch::x64, config = config::release);
protected:
void do_clean(clean c) override;
@@ -138,7 +123,6 @@ namespace mob::tasks {
libbsarch();
static std::string version();
static config build_type();
static bool prebuilt();
static fs::path source_path();
@@ -213,8 +197,7 @@ namespace mob::tasks {
// projects, used internally, but also by the cmake command
//
static cmake create_cmake_tool(const fs::path& root,
cmake::ops o = cmake::generate,
config config = config::relwithdebinfo);
cmake::ops o = cmake::generate);
// flags for some MO projects
enum flags {
@@ -377,7 +360,6 @@ namespace mob::tasks {
static fs::path source_path();
static fs::path build_path();
static config build_type();
// "PyQt5.sip", used both in pyqt and sip
//
@@ -437,10 +419,6 @@ namespace mob::tasks {
//
static fs::path site_packages_path();
// configuration to build
//
static config build_type();
protected:
void do_clean(clean c) override;
void do_fetch() override;
@@ -668,11 +646,21 @@ namespace mob::tasks {
void do_build_and_install() override;
private:
void fetch_prebuilt();
void fetch_from_source();
void build_and_install_prebuilt();
void build_and_install_from_source();
msbuild create_msbuild_tool(arch, msbuild::ops = msbuild::build,
config = config::release) const;
void download_from_appveyor(arch a);
void copy_prebuilt(arch a);
msbuild create_msbuild_tool(arch a, msbuild::ops o = msbuild::build) const;
std::vector<std::shared_ptr<downloader>>
create_appveyor_downloaders(arch a,
downloader::ops o = downloader::download) const;
std::string prebuilt_directory_name(arch a) const;
};
class zlib : public basic_task<zlib> {
+147 -16
View File
@@ -22,7 +22,7 @@ namespace mob::tasks {
bool usvfs::prebuilt()
{
return false;
return conf().prebuilt().get<bool>("usvfs");
}
fs::path usvfs::source_path()
@@ -32,31 +32,68 @@ namespace mob::tasks {
void usvfs::do_clean(clean c)
{
// delete the whole directory
if (is_set(c, clean::reclone)) {
git_wrap::delete_directory(cx(), source_path());
if (prebuilt()) {
if (is_set(c, clean::redownload)) {
// the `downloader` class knows how to delete its own files, so
// create the same downloaders and ask them to clean
// nothing more to do
return;
const auto x86_dls =
create_appveyor_downloaders(arch::x86, downloader::clean);
const auto x64_dls =
create_appveyor_downloaders(arch::x64, downloader::clean);
for (auto dl : x86_dls)
run_tool(*dl);
for (auto dl : x64_dls)
run_tool(*dl);
}
}
else {
// delete the whole directory
if (is_set(c, clean::reclone)) {
git_wrap::delete_directory(cx(), source_path());
if (is_set(c, clean::rebuild)) {
// msbuild clean
run_tool(create_msbuild_tool(arch::x86, msbuild::clean,
task_conf().configuration()));
run_tool(create_msbuild_tool(arch::x64, msbuild::clean,
task_conf().configuration()));
// nothing more to do
return;
}
if (is_set(c, clean::rebuild)) {
// msbuild clean
run_tool(create_msbuild_tool(arch::x86, msbuild::clean));
run_tool(create_msbuild_tool(arch::x64, msbuild::clean));
}
}
}
void usvfs::do_fetch()
{
fetch_from_source();
if (prebuilt())
fetch_prebuilt();
else
fetch_from_source();
}
void usvfs::do_build_and_install()
{
build_and_install_from_source();
if (prebuilt())
build_and_install_prebuilt();
else
build_and_install_from_source();
}
void usvfs::fetch_prebuilt()
{
fetch_from_source();
download_from_appveyor(arch::x64);
download_from_appveyor(arch::x86);
}
void usvfs::build_and_install_prebuilt()
{
copy_prebuilt(arch::x86);
copy_prebuilt(arch::x64);
}
void usvfs::fetch_from_source()
@@ -73,7 +110,42 @@ namespace mob::tasks {
run_tool(create_msbuild_tool(arch::x64));
}
msbuild usvfs::create_msbuild_tool(arch a, msbuild::ops o, config c) const
void usvfs::download_from_appveyor(arch a)
{
// create all downloaders, run them in parallel
parallel_functions v;
for (auto dl : create_appveyor_downloaders(a))
v.emplace_back("usvfs", [this, dl] {
run_tool(*dl);
});
parallel(v);
}
void usvfs::copy_prebuilt(arch a)
{
const auto path = conf().path();
const auto src = path.build() / prebuilt_directory_name(a);
// dlls and exes to install/bin/
op::copy_glob_to_dir_if_better(cx(), src / "*.dll", path.install_bin(),
op::copy_files);
op::copy_glob_to_dir_if_better(cx(), src / "*.exe", path.install_bin(),
op::copy_files);
// pdbs
op::copy_glob_to_dir_if_better(cx(), src / "*.pdb", path.install_pdbs(),
op::copy_files);
// libs
op::copy_glob_to_dir_if_better(cx(), src / "*.lib", path.install_libs(),
op::copy_files);
}
msbuild usvfs::create_msbuild_tool(arch a, msbuild::ops o) const
{
// usvfs doesn't use "Win32" for 32-bit, it uses "x86"
//
@@ -92,7 +164,6 @@ namespace mob::tasks {
return std::move(
msbuild(o)
.platform(plat)
.configuration(c)
.targets({"usvfs_proxy"})
.solution(source_path() / "vsbuild" / "usvfs.sln")
.env(env::vs(a)
@@ -100,4 +171,64 @@ namespace mob::tasks {
.set("BOOST_PATH", path_to_utf8(boost::source_path()))));
}
std::vector<std::shared_ptr<downloader>>
usvfs::create_appveyor_downloaders(arch a, downloader::ops o) const
{
std::string arch_s;
switch (a) {
case arch::x86:
arch_s = "x86";
break;
case arch::x64:
arch_s = "x64";
break;
case arch::dont_care:
default:
cx().bail_out(context::generic, "bad arch");
}
// returns an appveyor downloader for the given filename that outputs into
// build/usvfs_bin[_32]/
auto make_dl = [&](std::string filename) {
const auto u = make_appveyor_artifact_url(a, "usvfs", filename);
const std::string dir = prebuilt_directory_name(a);
auto dl = std::make_shared<downloader>(o);
dl->url(u);
dl->file(conf().path().build() / dir / u.filename());
return dl;
};
std::vector<std::shared_ptr<downloader>> v;
// five downloaders for the pdbs, dlls, libs and exes
v.push_back(make_dl("lib/usvfs_" + arch_s + ".pdb"));
v.push_back(make_dl("lib/usvfs_" + arch_s + ".dll"));
v.push_back(make_dl("lib/usvfs_" + arch_s + ".lib"));
v.push_back(make_dl("bin/usvfs_proxy_" + arch_s + ".exe"));
v.push_back(make_dl("bin/usvfs_proxy_" + arch_s + ".pdb"));
return v;
}
std::string usvfs::prebuilt_directory_name(arch a) const
{
switch (a) {
case arch::x86:
return "usvfs_bin_32";
case arch::x64:
return "usvfs_bin";
case arch::dont_care:
default:
cx().bail_out(context::generic, "bad arch");
}
}
} // namespace mob::tasks
+1 -1
View File
@@ -129,7 +129,7 @@ namespace mob {
.binary(binary())
.arg("-DCMAKE_BUILD_TYPE=Release")
.arg("-DCMAKE_INSTALL_MESSAGE=" +
conf_cmake::to_string(conf().cmake().install_message()))
conf().cmake().install_message().value())
.arg("--log-level=ERROR")
.arg("--no-warn-unused-cli");
+2 -4
View File
@@ -14,25 +14,23 @@ namespace mob {
// type of build files generated
//
enum class generators {
enum generators {
// generates build files for visual studio
vs = 0x01,
// generates build files for jom/nmake
jom = 0x02
};
using enum generators;
// what run() will do
//
enum class ops {
enum ops {
// generates the build files
generate = 1,
// cleans the build files so they're regenerated from scratch
clean
};
using enum ops;
cmake(ops o = generate);
+5 -19
View File
@@ -7,8 +7,8 @@
namespace mob {
msbuild::msbuild(ops o)
: basic_process_runner("msbuild"), op_(o), config_(config::release),
arch_(arch::def), flags_(noflags)
: basic_process_runner("msbuild"), op_(o), config_("Release"), arch_(arch::def),
flags_(noflags)
{
}
@@ -17,20 +17,6 @@ namespace mob {
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)
{
sln_ = sln;
@@ -49,9 +35,9 @@ namespace mob {
return *this;
}
msbuild& msbuild::configuration(config c)
msbuild& msbuild::config(const std::string& s)
{
config_ = c;
config_ = s;
return *this;
}
@@ -165,7 +151,7 @@ namespace mob {
.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:WindowsTargetPlatformVersion=" + vs::sdk())
.arg("-property:Platform=", platform_property(), process::quote)

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