mirror of
https://github.com/ModOrganizer2/mob.git
synced 2026-07-27 14:07:05 -07:00
Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5f88eeab02 | ||
|
|
74d415f2a4 | ||
|
|
64c62ad9a8 | ||
|
|
98a71eae17 | ||
|
|
3eea9f228f | ||
|
|
facd852e3f | ||
|
|
8bf4671496 | ||
|
|
612ef324bc |
@@ -2,15 +2,20 @@ 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-2022
|
||||
runs-on: windows-2025-vs2026
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
- name: Build Mob
|
||||
shell: pwsh
|
||||
run: ./bootstrap.ps1 -Verbose
|
||||
run: |
|
||||
$env:VCPKG_ROOT = $env:VCPKG_INSTALLATION_ROOT
|
||||
./bootstrap.ps1 -Verbose
|
||||
|
||||
@@ -9,7 +9,7 @@ jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v6
|
||||
- name: Check format
|
||||
uses: ModOrganizer2/check-formatting-action@master
|
||||
with:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v5.0.0
|
||||
rev: v6.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: v19.1.5
|
||||
rev: v21.1.8
|
||||
hooks:
|
||||
- id: clang-format
|
||||
'types_or': [c++, c]
|
||||
|
||||
+6
-1
@@ -1,6 +1,11 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(mob)
|
||||
project(mob LANGUAGES CXX)
|
||||
|
||||
find_package(clipp CONFIG REQUIRED)
|
||||
find_package(nlohmann_json CONFIG REQUIRED)
|
||||
find_package(CURL REQUIRED)
|
||||
|
||||
add_subdirectory(src)
|
||||
|
||||
set_property(DIRECTORY ${PROJECT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT mob)
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"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"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
+6
-30
@@ -11,41 +11,17 @@ if (!$root) {
|
||||
$root = "."
|
||||
}
|
||||
|
||||
$output = if ($Verbose) { "Out-Default" } else { "Out-Null" }
|
||||
$logLevel = if ($Verbose) { "STATUS" } else { "ERROR" }
|
||||
|
||||
cmake -B $root/build -G "Visual Studio 17 2022" $root | & $output
|
||||
cmake --preset vs2026-windows --log-level=$logLevel
|
||||
|
||||
$installationPath = & $root\third-party\bin\vswhere.exe -products * -nologo -prerelease -latest -property installationPath
|
||||
if (! $?) {
|
||||
Write-Error "vswhere returned $LastExitCode"
|
||||
exit $LastExitCode
|
||||
if ($Verbose) {
|
||||
cmake --build --preset vs2026-windows --config $Config --verbose
|
||||
}
|
||||
|
||||
if (! $installationPath) {
|
||||
Write-Error "Empty installation path"
|
||||
exit 1
|
||||
else {
|
||||
cmake --build --preset vs2026-windows --config $Config
|
||||
}
|
||||
|
||||
$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
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
|
||||
"name": "zlib",
|
||||
"version-string": "zlib-ng overlay",
|
||||
"dependencies": [
|
||||
"zlib-ng"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
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)
|
||||
@@ -33,6 +33,7 @@ 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
|
||||
```
|
||||
@@ -51,6 +52,21 @@ 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.
|
||||
|
||||
@@ -93,15 +109,32 @@ 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
|
||||
|
||||
# close this repository
|
||||
# clone 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
|
||||
|
||||
@@ -118,7 +151,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:
|
||||
|
||||
+14
-18
@@ -1,22 +1,18 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
file(GLOB_RECURSE source_files *.cpp)
|
||||
file(GLOB_RECURSE header_files *.h)
|
||||
file(GLOB_RECURSE source_files CONFIGURE_DEPENDS "*.cpp")
|
||||
file(GLOB_RECURSE header_files CONFIGURE_DEPENDS "*.h")
|
||||
|
||||
add_executable(mob ${source_files} ${header_files})
|
||||
set_target_properties(mob PROPERTIES CXX_STANDARD 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_features(mob PRIVATE cxx_std_20)
|
||||
|
||||
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)
|
||||
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})
|
||||
|
||||
+6
-5
@@ -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"];
|
||||
const std::string url = item["repository_url"].get<std::string>();
|
||||
|
||||
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"],
|
||||
pr_info info = {repo, author, branch, item["title"].get<std::string>(),
|
||||
std::to_string(item["number"].get<int>())};
|
||||
|
||||
if (!repos.emplace(repo, info).second) {
|
||||
@@ -287,9 +287,10 @@ namespace mob {
|
||||
const auto output = dl.steal_output();
|
||||
json = nlohmann::json::parse(output);
|
||||
|
||||
const std::string repo = json["head"]["repo"]["name"];
|
||||
const std::string author = json["head"]["repo"]["user"]["login"];
|
||||
const std::string branch = json["head"]["ref"];
|
||||
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>();
|
||||
|
||||
return {repo, author, branch};
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
// global warnings
|
||||
#pragma warning(disable : 4464) // relative include path
|
||||
#pragma warning(disable : 4820) // padding added
|
||||
@@ -62,10 +64,12 @@
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
#include <Shlobj.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include <dbghelp.h>
|
||||
#include <fcntl.h>
|
||||
#include <imagehlp.h>
|
||||
#include <io.h>
|
||||
#include <shlobj.h>
|
||||
#include <shlwapi.h>
|
||||
|
||||
#include <clipp.h>
|
||||
|
||||
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user