Move to VCPKG. (#11)

This commit is contained in:
Mikaël Capelle
2025-05-29 11:03:00 +02:00
committed by GitHub
parent 4928105afc
commit 276bf9d10e
16 changed files with 161 additions and 56 deletions
+8 -4
View File
@@ -1,16 +1,20 @@
name: Build Installer FOMOD C# Plugin
name: Build Installer FOMOD C#
on:
push:
branches: master
branches: [master]
pull_request:
types: [opened, synchronize, reopened]
env:
VCPKG_BINARY_SOURCES: clear;x-azblob,${{ vars.AZ_BLOB_VCPKG_URL }},${{ secrets.AZ_BLOB_SAS }},readwrite
jobs:
build:
runs-on: windows-2022
steps:
- name: Build Installer FOMOD C# Plugin
- name: Build Installer FOMOD C#
id: build-installer-fomod-csharp
uses: ModOrganizer2/build-with-mob-action@master
with:
mo2-dependencies: cmake_common uibase
mo2-dependencies: uibase
+1 -1
View File
@@ -1 +1 @@
vsbuild
vsbuild
+20
View File
@@ -0,0 +1,20 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-merge-conflict
- id: check-case-conflict
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v19.1.5
hooks:
- id: clang-format
'types_or': [c++, c]
ci:
autofix_commit_msg: "[pre-commit.ci] Auto fixes from pre-commit.com hooks."
autofix_prs: true
autoupdate_commit_msg: "[pre-commit.ci] Pre-commit autoupdate."
autoupdate_schedule: quarterly
submodules: false
-6
View File
@@ -2,10 +2,4 @@ cmake_minimum_required(VERSION 3.16)
project(installer_fomod_csharp)
if(DEFINED DEPENDENCIES_DIR)
include(${DEPENDENCIES_DIR}/modorganizer_super/cmake_common/mo2.cmake)
else()
include(${CMAKE_CURRENT_LIST_DIR}/../cmake_common/mo2.cmake)
endif()
add_subdirectory(src)
+67
View File
@@ -0,0 +1,67 @@
{
"configurePresets": [
{
"errors": {
"deprecated": true
},
"hidden": true,
"name": "cmake-dev",
"warnings": {
"deprecated": true,
"dev": true
}
},
{
"cacheVariables": {
"VCPKG_MANIFEST_NO_DEFAULT_FEATURES": {
"type": "BOOL",
"value": "ON"
}
},
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"hidden": true,
"name": "vcpkg"
},
{
"hidden": true,
"inherits": ["vcpkg"],
"name": "vcpkg-dev"
},
{
"binaryDir": "${sourceDir}/vsbuild",
"architecture": {
"strategy": "set",
"value": "x64"
},
"cacheVariables": {
"CMAKE_CXX_FLAGS": "/EHsc /MP /W4",
"VCPKG_TARGET_TRIPLET": {
"type": "STRING",
"value": "x64-windows-static-md"
}
},
"generator": "Visual Studio 17 2022",
"inherits": ["cmake-dev", "vcpkg-dev"],
"name": "vs2022-windows",
"toolset": "v143"
},
{
"cacheVariables": {
"VCPKG_MANIFEST_FEATURES": {
"type": "STRING",
"value": "standalone"
}
},
"inherits": "vs2022-windows",
"name": "vs2022-windows-standalone"
}
],
"buildPresets": [
{
"name": "vs2022-windows",
"resolvePackageReferences": "on",
"configurePreset": "vs2022-windows"
}
],
"version": 4
}
+5 -1
View File
@@ -1,7 +1,11 @@
cmake_minimum_required(VERSION 3.16)
find_package(mo2-cmake CONFIG REQUIRED)
find_package(mo2-uibase CONFIG REQUIRED)
add_library(installer_fomod_csharp SHARED)
mo2_configure_plugin(installer_fomod_csharp WARNINGS OFF CLI ON)
mo2_install_target(installer_fomod_csharp)
target_link_libraries(installer_fomod_csharp PRIVATE mo2::uibase)
mo2_install_plugin(installer_fomod_csharp)
set_target_properties(installer_fomod_csharp PROPERTIES CXX_STANDARD 20)
+23 -21
View File
@@ -15,39 +15,39 @@ You should have received a copy of the GNU General Public License
along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
*/
// clang-format off
#include "base_script.h"
#include <filesystem>
#include <map>
#include <QMessageBox>
#include <QCheckBox>
#include <QRadioButton>
#include <QInputDialog>
#include <QSettings>
#include <QDialogButtonBox>
#include <QPushButton>
#include <QVersionNumber>
#include <QInputDialog>
#include <QLabel>
#include <QMessageBox>
#include <QPushButton>
#include <QRadioButton>
#include <QSettings>
#include <QVBoxLayout>
#include <QVersionNumber>
#include "imoinfo.h"
#include "iplugingame.h"
#include "ipluginlist.h"
#include "igamefeatures.h"
#include "iinstallationmanager.h"
#include "log.h"
#include "scriptextender.h"
#include <uibase/game_features/igamefeatures.h>
#include <uibase/game_features/scriptextender.h>
#include <uibase/iinstallationmanager.h>
#include <uibase/imoinfo.h>
#include <uibase/iplugingame.h>
#include <uibase/ipluginlist.h>
#include <uibase/log.h>
#include "psettings.h"
#include "installer_fomod_postdialog.h"
#include "csharp_interface.h"
#include "csharp_utils.h"
#include "installer_fomod_postdialog.h"
#include "psettings.h"
using namespace MOBase;
// clang-format off
namespace CSharp {
// Pointer to object:
@@ -228,8 +228,9 @@ namespace CSharp {
}, "/");
// Convert to C#:
array<String^>^ result = gcnew array<String^>(paths.size());
for (std::size_t i = 0; i < paths.size(); ++i) {
const auto size = static_cast<int>(paths.size());
array<String^>^ result = gcnew array<String^>(size);
for (int i = 0; i < size; ++i) {
result[i] = from_string(paths[i].toStdWString());
}
@@ -401,7 +402,7 @@ namespace CSharp {
}
// Otherwize: Create the entry and the temporary file:
else {
auto entry = g.DestinationTree->addFile(qPath, true);
entry = g.DestinationTree->addFile(qPath, true);
qAbsPath = g.InstallManager->createFile(entry);
if (qAbsPath.isEmpty()) {
// Remove the entry from the tree:
@@ -574,7 +575,8 @@ namespace CSharp {
}
System::Version^ BaseScriptImpl::GetModManagerVersion() {
return make_version(g_Organizer->appVersion());
const auto version = g_Organizer->version();
return gcnew System::Version(version.major(), version.minor(), version.patch());
}
System::Version^ BaseScriptImpl::GetGameVersion() {
+7 -7
View File
@@ -24,7 +24,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#using <System.Drawing.dll>
#using <System.Windows.Forms.dll>
#include <iplugininstaller.h>
#include <uibase/iplugininstaller.h>
/**
* Note: The specification of BaseScript where taken from the Nexus-Mods installer_fomod extension
@@ -306,7 +306,7 @@ namespace CSharp {
/// <param name="p_strTitle">The title of the selection form.</param>
/// <param name="p_booSelectMany">Whether more than one item can be selected.</param>
/// <returns>The indices of the selected items.</returns>
static array<int>^ ImageSelect(array<String^>^ p_strItems, array<Image^>^ p_imgPreviews, array<String^>^ p_strDescriptions, String^ p_strTitle, bool p_booSelectMany) {
static array<int>^ ImageSelect(array<String^>^ p_strItems, array<Image^>^ /* p_imgPreviews */, array<String^>^ p_strDescriptions, String^ p_strTitle, bool p_booSelectMany) {
return Select(p_strItems, gcnew array<String^>(p_strItems->Length), p_strDescriptions, p_strTitle, p_booSelectMany);
}
@@ -404,7 +404,7 @@ namespace CSharp {
/// </summary>
/// <param name="p_strPluginPath">The path to the plugin to activate or deactivate.</param>
/// <param name="p_booActivate">Whether to activate the plugin.</param>
static void SetPluginActivation(String^ p_strPluginPath, bool p_booActivate) {
static void SetPluginActivation(String^ /* p_strPluginPath */, bool /* p_booActivate */) {
// throw gcnew NotImplementedException("SetPluginActivation");
}
@@ -413,7 +413,7 @@ namespace CSharp {
/// </summary>
/// <param name="p_strPlugin">The path to the plugin file whose load order is to be set.</param>
/// <param name="p_intNewIndex">The new load order index of the plugin.</param>
static void SetPluginOrderIndex(String^ p_strPlugin, int p_intNewIndex) {
static void SetPluginOrderIndex(String^ /* p_strPlugin */, int /* p_intNewIndex */) {
// throw gcnew NotImplementedException("SetPluginOrderIndex");
}
@@ -426,7 +426,7 @@ namespace CSharp {
/// </remarks>
/// <param name="p_intPlugins">The new load order of the plugins. Each entry in this array
/// contains the current index of a plugin. This array must contain all current indices.</param>
static void SetLoadOrder(array<int>^ p_intPlugins) {
static void SetLoadOrder(array<int>^ /* p_intPlugins */) {
// throw gcnew NotImplementedException("SetLoadOrder");
}
@@ -443,7 +443,7 @@ namespace CSharp {
/// load order. Each entry in this array contains the current index of a plugin.</param>
/// <param name="p_intPosition">The position in the load order to which to move the specified
/// plugins.</param>
static void SetLoadOrder(array<int>^ p_intPlugins, int p_intPosition) {
static void SetLoadOrder(array<int>^ /* p_intPlugins */, int /* p_intPosition */) {
// throw gcnew NotImplementedException("SetLoadOrder");
}
@@ -530,7 +530,7 @@ namespace CSharp {
/// <param name="p_booSaveOld">Not used.</param>
/// <returns><c>true</c> if the value was set; <c>false</c>
/// if the user chose not to overwrite the existing value.</returns>
static bool EditFalloutINI(String^ p_strSection, String^ p_strKey, String^ p_strValue, bool p_booSaveOld) {
static bool EditFalloutINI(String^ p_strSection, String^ p_strKey, String^ p_strValue, bool /* p_booSaveOld */) {
return EditIni("Fallout.ini", p_strSection, p_strKey, p_strValue);
}
+5 -6
View File
@@ -1,15 +1,15 @@
// clang-format off
#include "csharp_interface.h"
#include <fstream>
#include <sstream>
#include <regex>
#include <sstream>
#include "log.h"
#include <uibase/log.h>
#include "csharp_utils.h"
#include "base_script.h"
#include "csharp_utils.h"
// clang-format off
#using <System.dll>
@@ -73,7 +73,6 @@ IPluginInstaller::EInstallResult executeScript(System::String^ script) {
auto result = provider->CompileAssemblyFromSource(cp, script);
int errorCount = 0;
CompilerErrorCollection^ errors = result->Errors;
for each (CompilerError ^ error in result->Errors) {
if (error->IsWarning) {
log::warn("C# [{}]: {}", error->Line, CSharp::to_string(error->ErrorText));
+2 -2
View File
@@ -3,8 +3,8 @@
#include <map>
#include "ifiletree.h"
#include "iplugininstaller.h"
#include <uibase/ifiletree.h>
#include <uibase/iplugininstaller.h>
namespace CSharp
{
+2 -2
View File
@@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License
along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
*/
#include "iinstallationmanager.h"
#include <uibase/iinstallationmanager.h>
#include "csharp_interface.h"
#include "installer_fomod_csharp.h"
@@ -145,7 +145,7 @@ InstallerFomodCSharp::install(MOBase::GuessedValue<QString>& modName,
QStringList paths(manager()->extractFiles(toExtract));
// If user cancelled:
if (toExtract.size() != paths.size()) {
if (toExtract.size() != static_cast<std::size_t>(paths.size())) {
return EInstallResult::RESULT_CANCELED;
}
+1 -1
View File
@@ -18,7 +18,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#ifndef INSTALLER_FOMOD_CSHARP_H
#define INSTALLER_FOMOD_CSHARP_H
#include "iplugininstallersimple.h"
#include <uibase/iplugininstallersimple.h>
class InstallerFomodCSharp : public MOBase::IPluginInstallerSimple
{
+2 -2
View File
@@ -112,12 +112,12 @@
<context>
<name>QObject</name>
<message>
<location filename="base_script.cpp" line="515"/>
<location filename="base_script.cpp" line="516"/>
<source>Choose any:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="base_script.cpp" line="518"/>
<location filename="base_script.cpp" line="519"/>
<source>Choose one:</source>
<translation type="unfinished"></translation>
</message>
+1 -1
View File
@@ -3,7 +3,7 @@
#include "ui_installer_fomod_csharp_predialog.h"
#include "guessedvalue.h"
#include <uibase/guessedvalue.h>
#include <QCompleter>
+2 -2
View File
@@ -8,8 +8,8 @@
#include <QTextStream>
#include <QXmlStreamReader>
#include "log.h"
#include "utility.h"
#include <uibase/log.h>
#include <uibase/utility.h>
// This is from installer_fomod, but should probably not be duplicated here.
+15
View File
@@ -0,0 +1,15 @@
{
"features": {
"standalone": {
"description": "Build Standalone.",
"dependencies": ["mo2-cmake", "mo2-uibase"]
}
},
"vcpkg-configuration": {
"default-registry": {
"kind": "git",
"repository": "https://github.com/ModOrganizer2/vcpkg-registry",
"baseline": "8beb2e0efa9c17dd6d17bb05288dd1e40727f673"
}
}
}