Author SHA1 Message Date
Mikaël Capelle 9f97e0f1c7 Merge remote-tracking branch 'origin/master' into dev/extensions 2025-05-29 17:51:43 +02:00
Mikaël Capelle b6d75fd1a3 Add plugin_python to base translations. 2024-08-10 10:57:01 +02:00
Mikaël Capelle c9882c7d99 Add uibase to the base translations. 2024-08-09 20:53:44 +02:00
Mikaël Capelle 41bb2a3032 Fix issues with translations. 2024-08-09 17:44:38 +02:00
Mikaël Capelle 0d6a130ef8 Move to VCPKG.
* Use CMake with presets to generate USVFS solution.
* Use preset when building super repository.
* Allow overriding VCPKG_ROOT with [paths] entry.
* Remove gamebryo and nuget specific stuff.
* Remove cmake command. Add done log.
* Use VCPKG from VS if no VCPKG_ROOT or path setting.
2024-08-09 17:12:46 +02:00
47 changed files with 37709 additions and 194 deletions
+4 -9
View File
@@ -2,20 +2,15 @@ name: Build Mob
on:
push:
branches: [master]
branches: master
pull_request:
types: [opened, synchronize, reopened]
env:
VCPKG_BINARY_SOURCES: ${{ vars.AZ_BLOB_VCPKG_URL != '' && format('clear;x-azblob,{0},{1},readwrite', vars.AZ_BLOB_VCPKG_URL, secrets.AZ_BLOB_SAS) || '' }}
jobs:
build:
runs-on: windows-2025-vs2026
runs-on: windows-2022
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v4
- name: Build Mob
shell: pwsh
run: |
$env:VCPKG_ROOT = $env:VCPKG_INSTALLATION_ROOT
./bootstrap.ps1 -Verbose
run: ./bootstrap.ps1 -Verbose
+1 -1
View File
@@ -9,7 +9,7 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v3
- name: Check format
uses: ModOrganizer2/check-formatting-action@master
with:
+2 -2
View File
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
exclude: '^(third-party|licenses)/.*$'
@@ -11,7 +11,7 @@ repos:
- id: check-case-conflict
exclude: '^(third-party|licenses)/.*$'
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v21.1.8
rev: v19.1.5
hooks:
- id: clang-format
'types_or': [c++, c]
+1 -6
View File
@@ -1,11 +1,6 @@
cmake_minimum_required(VERSION 3.16)
project(mob LANGUAGES CXX)
find_package(clipp CONFIG REQUIRED)
find_package(nlohmann_json CONFIG REQUIRED)
find_package(CURL REQUIRED)
project(mob)
add_subdirectory(src)
set_property(DIRECTORY ${PROJECT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT mob)
-28
View File
@@ -1,28 +0,0 @@
{
"version": 6,
"configurePresets": [
{
"name": "vs2026-windows",
"generator": "Visual Studio 18 2026",
"architecture": "x64",
"binaryDir": "${sourceDir}/build/",
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": "x64-windows-static-md",
"CMAKE_CONFIGURATION_TYPES": "Debug;Release;RelWithDebInfo"
}
}
],
"buildPresets": [
{
"name": "vs2026-windows",
"configurePreset": "vs2026-windows",
"nativeToolOptions": [
"-m",
"-noLogo",
"-p:UseMultiToolTask=true",
"-p:EnforceProcessCountAcrossBuilds=true"
]
}
]
}
+30 -6
View File
@@ -11,17 +11,41 @@ if (!$root) {
$root = "."
}
$logLevel = if ($Verbose) { "STATUS" } else { "ERROR" }
$output = if ($Verbose) { "Out-Default" } else { "Out-Null" }
cmake --preset vs2026-windows --log-level=$logLevel
cmake -B $root/build -G "Visual Studio 17 2022" $root | & $output
if ($Verbose) {
cmake --build --preset vs2026-windows --config $Config --verbose
$installationPath = & $root\third-party\bin\vswhere.exe -products * -nologo -prerelease -latest -property installationPath
if (! $?) {
Write-Error "vswhere returned $LastExitCode"
exit $LastExitCode
}
else {
cmake --build --preset vs2026-windows --config $Config
if (! $installationPath) {
Write-Error "Empty installation path"
exit 1
}
$opts = ""
$opts += " $root\build\mob.sln"
$opts += " -m"
$opts += " -p:Configuration=${Config}"
$opts += " -noLogo"
$opts += " -p:UseMultiToolTask=true"
$opts += " -p:EnforceProcessCountAcrossBuilds=true"
if (!$Verbose) {
$opts += " -clp:ErrorsOnly;Verbosity=minimal"
}
$vsDevCmd = "$installationPath\Common7\Tools\VsDevCmd.bat"
if (!(Test-Path "$vsDevCmd")) {
Write-Error "VdDevCmd.bat not found at $vsDevCmd"
exit 1
}
& "${env:COMSPEC}" /c "`"$vsDevCmd`" -no_logo -arch=amd64 -host_arch=amd64 && msbuild $opts"
if (! $?) {
Write-Error "Build failed"
exit $LastExitCode
-1
View File
@@ -1 +0,0 @@
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
-8
View File
@@ -1,8 +0,0 @@
{
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
"name": "zlib",
"version-string": "zlib-ng overlay",
"dependencies": [
"zlib-ng"
]
}
@@ -1,6 +0,0 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
set(ZLIB_COMPAT ON)
set(nlohmann-json_IMPLICIT_CONVERSIONS OFF)
Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

+7 -1
View File
@@ -18,9 +18,13 @@ install_message = never
host =
[aliases]
super = cmake_common modorganizer* githubpp
super = cmake_common modorganizer*
plugins = check_fnis bsapacker bsa_extractor diagnose_basic installer_* plugin_python preview_base preview_bsa tool_* game_*
[translations]
mo2-translations = organizer uibase plugin_python
mo2-game-bethesda = game_creation game_enderal game_enderalse game_fallout3 game_fallout4 game_fallout4vr game_falloutNV game_gamebryo game_morrowind game_nehrim game_oblivion game_skyrim game_skyrimse game_skyrimvr game_ttw
[task]
enabled = true
mo_org = ModOrganizer2
@@ -109,6 +113,7 @@ ss_fallout4_trosski = v1.11
third_party =
prefix =
cache =
icons =
licenses =
build =
install =
@@ -118,6 +123,7 @@ install_libs =
install_pdbs =
install_dlls =
install_plugins =
install_extensions =
install_stylesheets =
install_licenses =
install_translations =
+2 -35
View File
@@ -33,7 +33,6 @@ check the [ModOrganizer2 Wiki](https://github.com/ModOrganizer2/modorganizer/wik
```powershell
git clone https://github.com/ModOrganizer2/mob
cd mob
$env:VCPKG_ROOT = "C:\path\to\vcpkg"
./bootstrap
mob -d c:\somewhere build
```
@@ -52,21 +51,6 @@ installing Qt extremely quick and painless, and doesn't require a login.
Check the [documentation](https://aqtinstall.readthedocs.io/en/latest/installation.html)
to install **aqt** itself.
> [!IMPORTANT]
> As of version 3.3.0, **aqt** is unable to install Qt version 6.7.3 on the
> `win64_msvc2022_64` target architecture due to a non-standard download URL (see:
> miurahr/aqtinstall#919). The [Holt59/aqtinstall fork](https://github.com/Holt59/aqtinstall)
> provides a workaround for this issue and can be installed using the following command
> (requires Python 3.9 or above):
> ```powershell
> pip install git+https://github.com/Holt59/aqtinstall.git#egg=aqtinstall
> ```
> If you already installed **aqt** before, you first need to uninstall it before
> installing the fork:
> ```powershell
> pip uninstall aqtinstall
> ```
When using **aqt**, you can choose which modules to install but we recommend installing
all of them in case of changes.
@@ -109,32 +93,15 @@ aqt install-qt --outputdir "C:\Qt" windows desktop ${QT_VERSION} win64_msvc2022_
- Git for Windows (Skip if you have this already installed outside of the VS installer)
- CMake tools for Windows (Skip if you have this already installed outside of the VS installer)
### vcpkg
`mob` now uses **vcpkg** to manage its third-party dependencies (like libcurl).
1. **Install vcpkg**: If you don't have it, follow the [official instructions](https://learn.microsoft.com/en-us/vcpkg/get_started/get-started).
2. **Set Environment Variable**: `mob` requires the `VCPKG_ROOT` environment variable to locate the toolchain.
```powershell
$env:VCPKG_ROOT = "C:\path\to\vcpkg"
$env:PATH = "$env:VCPKG_ROOT;$env:PATH"
```
3. **Static Triplet**: `mob` builds with the `x64-windows-static-md` triplet by default to ensure a standalone executable. The `bootstrap.ps1` script handles this automatically if `VCPKG_ROOT` is set.
## Setting up MOB
```powershell
mkdir C:\dev
cd C:\dev
# clone this repository
# close this repository
git clone https://github.com/ModOrganizer2/mob
# set vcpkg path, or use `vcpkg integrate install` instead
$env:VCPKG_ROOT = "C:\path\to\your\vcpkg"
# build mob itself - this will create mob.exe in the current directory
./bootstrap.ps1
@@ -151,7 +118,7 @@ The Visual Studio solution for Mod Organizer itself is `build\modorganizer_super
`mob` has two ways of setting options: from INI files, the `MOBINI` environment
variable, or from the command line.
### Override options using INI files
### OVerride options using INI files
`mob` builds a list of available INI files in order of priority. Higher numbers
override lower numbers:
+18 -14
View File
@@ -1,18 +1,22 @@
file(GLOB_RECURSE source_files CONFIGURE_DEPENDS "*.cpp")
file(GLOB_RECURSE header_files CONFIGURE_DEPENDS "*.h")
cmake_minimum_required(VERSION 3.16)
file(GLOB_RECURSE source_files *.cpp)
file(GLOB_RECURSE header_files *.h)
add_executable(mob ${source_files} ${header_files})
set_target_properties(mob PROPERTIES CXX_STANDARD 23)
target_compile_features(mob PRIVATE cxx_std_20)
target_compile_definitions(mob PUBLIC NOMINMAX)
target_compile_options(mob PUBLIC "/MT")
target_include_directories(mob PUBLIC ${CMAKE_SOURCE_DIR}/third-party/include)
target_link_libraries(mob PUBLIC
wsock32 ws2_32 crypt32 wldap32 dbghelp shlwapi version
optimized ${CMAKE_SOURCE_DIR}/third-party/lib/libcurl.lib
debug ${CMAKE_SOURCE_DIR}/third-party/lib/libcurl-d.lib
optimized ${CMAKE_SOURCE_DIR}/third-party/lib/zlib.lib
debug ${CMAKE_SOURCE_DIR}/third-party/lib/zlibd.lib)
target_compile_definitions(
mob PRIVATE _WIN32_WINNT=0x0A00 NTDDI_VERSION=0x0A000007 WIN32_LEAN_AND_MEAN
NOMINMAX NOCOMM)
target_link_libraries(mob PRIVATE clipp::clipp nlohmann_json::nlohmann_json
CURL::libcurl dbghelp shlwapi version)
source_group(
TREE ${CMAKE_CURRENT_SOURCE_DIR}
PREFIX src
FILES ${source_files} ${header_files})
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}
PREFIX src
FILES ${source_files} ${header_files})
set_property(DIRECTORY ${PROJECT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT mob)
+5 -6
View File
@@ -236,7 +236,7 @@ namespace mob {
for (auto&& item : json["items"]) {
// ex: https://api.github.com/repos/ModOrganizer2/modorganizer-Installer
const std::string url = item["repository_url"].get<std::string>();
const std::string url = item["repository_url"];
const auto last_slash = url.find_last_of("/");
if (last_slash == std::string::npos) {
@@ -246,7 +246,7 @@ namespace mob {
const auto repo = url.substr(last_slash + 1);
pr_info info = {repo, author, branch, item["title"].get<std::string>(),
pr_info info = {repo, author, branch, item["title"],
std::to_string(item["number"].get<int>())};
if (!repos.emplace(repo, info).second) {
@@ -287,10 +287,9 @@ namespace mob {
const auto output = dl.steal_output();
json = nlohmann::json::parse(output);
const std::string repo = json["head"]["repo"]["name"].get<std::string>();
const std::string author =
json["head"]["repo"]["user"]["login"].get<std::string>();
const std::string branch = json["head"]["ref"].get<std::string>();
const std::string repo = json["head"]["repo"]["name"];
const std::string author = json["head"]["repo"]["user"]["login"];
const std::string branch = json["head"]["ref"];
return {repo, author, branch};
}
+28 -13
View File
@@ -51,24 +51,32 @@ namespace mob::details {
// returns a string from conf, bails out if it doesn't exist
//
std::string get_string(std::string_view section, std::string_view key)
std::string get_string(std::string_view section, std::string_view key,
std::optional<std::string> default_)
{
auto sitor = g_conf.find(section);
if (sitor == g_conf.end())
gcx().bail_out(context::conf, "[{}] doesn't exist", section);
auto kitor = sitor->second.find(key);
if (kitor == sitor->second.end())
gcx().bail_out(context::conf, "no key '{}' in [{}]", key, section);
if (kitor == sitor->second.end()) {
if (!default_.has_value()) {
gcx().bail_out(context::conf, "no key '{}' in [{}]", key, section);
}
return *default_;
}
return kitor->second;
}
// calls get_string(), converts to int
//
int get_int(std::string_view section, std::string_view key)
int get_int(std::string_view section, std::string_view key,
std::optional<int> default_)
{
const auto s = get_string(section, key);
const auto s = get_string(section, key, default_.transform([](auto v) {
return std::to_string(v);
}));
try {
return std::stoi(s);
@@ -80,9 +88,12 @@ namespace mob::details {
// 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,
std::optional<bool> default_)
{
const auto s = get_string(section, key);
const auto s = get_string(section, key, default_.transform([](auto v) {
return v ? "true" : "false";
}));
return bool_from_string(s);
}
@@ -428,13 +439,8 @@ namespace mob {
MOB_ASSERT(!tasks.empty());
for (auto& t : tasks) {
if (t->name() != task &&
details::find_string_for_task(t->name(), key)) {
continue;
}
for (auto& t : tasks)
details::set_string_for_task(t->name(), key, value);
}
}
else {
// global task option
@@ -512,6 +518,7 @@ namespace mob {
set_path_if_empty("vcpkg", find_vcpkg); // set after vs as it will use the VS
set_path_if_empty("qt_install", find_qt);
set_path_if_empty("temp_dir", find_temp_dir);
set_path_if_empty("icons", find_in_root("icons"));
set_path_if_empty("licenses", find_in_root("licenses"));
set_path_if_empty("qt_bin", qt::installation_path() / "bin");
set_path_if_empty("qt_translations", qt::installation_path() / "translations");
@@ -537,6 +544,7 @@ namespace mob {
resolve_path("install_licenses", p.install_bin(), "licenses");
resolve_path("install_stylesheets", p.install_bin(), "stylesheets");
resolve_path("install_translations", p.install_bin(), "translations");
resolve_path("install_extensions", p.install_bin(), "extensions");
// finally, resolve the tools that are unlikely to be in PATH; all the
// other tools (7z, jom, patch, etc.) are assumed to be in PATH (which
@@ -682,6 +690,11 @@ namespace mob {
return {};
}
conf_translations conf::translation()
{
return {};
}
conf_versions conf::version()
{
return {};
@@ -770,6 +783,8 @@ namespace mob {
conf_build_types::conf_build_types() : conf_section("build-types") {}
conf_translations::conf_translations() : conf_section("translations") {}
conf_prebuilt::conf_prebuilt() : conf_section("prebuilt") {}
conf_paths::conf_paths() : conf_section("paths") {}
+31 -11
View File
@@ -9,7 +9,8 @@ namespace mob::details {
// returns an option named `key` from the given `section`
//
std::string get_string(std::string_view section, std::string_view key);
std::string get_string(std::string_view section, std::string_view key,
std::optional<std::string> default_ = {});
// convert a string to the given type
template <class T>
@@ -25,11 +26,13 @@ namespace mob::details {
// 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,
std::optional<bool> default_ = {});
// calls get_string(), converts to in
//
int get_int(std::string_view section, std::string_view key);
int get_int(std::string_view section, std::string_view key,
std::optional<int> default_ = {});
// sets the given option, bails out if the option doesn't exist
//
@@ -60,9 +63,17 @@ namespace mob {
template <class DefaultType>
class conf_section {
public:
DefaultType get(std::string_view key) const
DefaultType get(std::string_view key,
std::optional<DefaultType> default_ = {}) const
{
const auto value = details::get_string(name_, key);
const auto value = [=] {
if constexpr (std::is_same_v<DefaultType, std::string>) {
return details::get_string(name_, key, default_);
}
else {
return details::get_string(name_, key);
}
}();
if constexpr (std::is_convertible_v<std::string, DefaultType>) {
return value;
@@ -74,18 +85,18 @@ namespace mob {
// undefined
template <class T>
T get(std::string_view key) const;
T get(std::string_view key, std::optional<T> default_ = {}) const;
template <>
bool get<bool>(std::string_view key) const
bool get<bool>(std::string_view key, std::optional<bool> default_) const
{
return details::get_bool(name_, key);
return details::get_bool(name_, key, default_);
}
template <>
int get<int>(std::string_view key) const
int get<int>(std::string_view key, std::optional<int> default_) const
{
return details::get_int(name_, key);
return details::get_int(name_, key, default_);
}
void set(std::string_view key, std::string_view value)
@@ -223,6 +234,13 @@ namespace mob {
conf_build_types();
};
// options in [translations]
//
class conf_translations : public conf_section<std::string> {
public:
conf_translations();
};
// options in [prebuilt]
//
class conf_prebuilt : public conf_section<std::string> {
@@ -245,6 +263,7 @@ namespace mob {
VALUE(third_party);
VALUE(prefix);
VALUE(cache);
VALUE(icons);
VALUE(licenses);
VALUE(build);
@@ -255,7 +274,7 @@ namespace mob {
VALUE(install_pdbs);
VALUE(install_dlls);
VALUE(install_plugins);
VALUE(install_extensions);
VALUE(install_stylesheets);
VALUE(install_licenses);
VALUE(install_translations);
@@ -283,6 +302,7 @@ namespace mob {
conf_cmake cmake();
conf_tools tool();
conf_transifex transifex();
conf_translations translation();
conf_prebuilt prebuilt();
conf_versions version();
conf_build_types build_types();
+24
View File
@@ -116,6 +116,30 @@ namespace mob::op {
}
}
void delete_file_glob_recurse(const context& cx, const fs::path& directory,
const fs::path& glob, flags f)
{
cx.trace(context::fs, "deleting glob {}", glob);
const auto native = glob.native();
if (!fs::exists(directory))
return;
for (auto&& e : fs::recursive_directory_iterator(directory)) {
const auto p = e.path();
const auto name = p.filename().native();
if (!PathMatchSpecW(name.c_str(), native.c_str())) {
cx.trace(context::fs, "{} did not match {}; skipping", name, glob);
continue;
}
delete_file(cx, p, f);
}
}
void remove_readonly(const context& cx, const fs::path& dir, flags f)
{
cx.trace(context::fs, "removing read-only from {}", dir);
+5
View File
@@ -65,6 +65,11 @@ namespace mob::op {
//
void delete_file_glob(const context& cx, const fs::path& glob, flags f = noflags);
// deletes all files matching the glob in the given directory and its subdirectories
//
void delete_file_glob_recurse(const context& cx, const fs::path& directory,
const fs::path& glob, flags f = noflags);
// removes the readonly flag for all files in `dir`, recursive
//
void remove_readonly(const context& cx, const fs::path& dir, flags f = noflags);
+2 -4
View File
@@ -23,7 +23,6 @@ namespace mob {
//
// mob doesn't have a concept of task dependencies, just task ordering, so
// if a task depends on another, it has to be earlier in the order
// super tasks
using mo = modorganizer;
@@ -42,13 +41,12 @@ namespace mob {
.add_task<mo>("modorganizer-bsatk")
.add_task<mo>("modorganizer-nxmhandler")
.add_task<mo>("modorganizer-helper")
.add_task<mo>({"modorganizer-bsapacker", "bsa_packer"})
.add_task<mo>("modorganizer-preview_bsa")
.add_task<mo>("modorganizer-game_bethesda");
add_task<parallel_tasks>()
.add_task<mo>({"modorganizer-bsapacker", "bsa_packer"})
.add_task<mo>({"modorganizer-tool_inieditor", "inieditor"})
.add_task<mo>({"modorganizer-tool_inibakery", "inibakery"})
.add_task<mo>("modorganizer-preview_bsa")
.add_task<mo>("modorganizer-preview_base")
.add_task<mo>("modorganizer-diagnose_basic")
.add_task<mo>("modorganizer-check_fnis")
+2 -6
View File
@@ -1,5 +1,3 @@
#pragma once
// global warnings
#pragma warning(disable : 4464) // relative include path
#pragma warning(disable : 4820) // padding added
@@ -64,12 +62,10 @@
#include <thread>
#include <vector>
#include <windows.h>
#include <dbghelp.h>
#include <Shlobj.h>
#include <fcntl.h>
#include <imagehlp.h>
#include <io.h>
#include <shlobj.h>
#include <shlwapi.h>
#include <clipp.h>

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