Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
name: Build Installer OMOD Plugin
name: Build Installer OMOD

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 OMOD Plugin
- name: Build Installer OMOD
id: build-installer-omod
uses: ModOrganizer2/build-with-mob-action@master
with:
mo2-dependencies: cmake_common uibase
mo2-dependencies: uibase
20 changes: 20 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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 changes: 0 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
# CMake 3.18 due to https://gitlab.kitware.com/cmake/cmake/-/issues/20764
cmake_minimum_required(VERSION 3.18)

if(DEFINED DEPENDENCIES_DIR)
include(${DEPENDENCIES_DIR}/modorganizer_super/cmake_common/mo2.cmake)
else()
include(${CMAKE_CURRENT_LIST_DIR}/../cmake_common/mo2.cmake)
endif()

# set globally as Nuget gets confused about ZERO_CHECK, ALL_BUILD and INSTALL otherwise
set(CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION "v4.8")

Expand Down
59 changes: 59 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"configurePresets": [
{
"errors": {
"deprecated": true
},
"hidden": true,
"name": "cmake-dev",
"warnings": {
"deprecated": true,
"dev": true
}
},
{
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"hidden": true,
"name": "vcpkg"
},
{
"binaryDir": "${sourceDir}/vsbuild",
"architecture": {
"strategy": "set",
"value": "x64"
},
"cacheVariables": {
"CMAKE_VS_NUGET_PACKAGE_RESTORE": {
"type": "BOOL",
"value": "ON"
},
"INSTALL_REQUIRES_VS_PACKAGE_RESTORE": {
"type": "BOOL",
"value": "ON"
}
},
"generator": "Visual Studio 17 2022",
"inherits": ["cmake-dev", "vcpkg"],
"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
}
12 changes: 8 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
cmake_minimum_required(VERSION 3.16)
# 3.23 for CMAKE_VS_NUGET_PACKAGE_RESTORE
cmake_minimum_required(VERSION 3.23)

find_package(mo2-cmake CONFIG REQUIRED)
find_package(mo2-uibase CONFIG REQUIRED)

# Dummy .NET library as VS_PACKAGE_REFERENCES doesn't work on C++/CLI projects yet
# Needs to be declared before cmake_common stuff is included as that polutes the environment and makes C# get compiled as C++
# This only mostly works - you need to build via Visual Studio or run `msbuild -t:restore installer_omod.sln` at least once before this will build via the command line due to https://gitlab.kitware.com/cmake/cmake/-/issues/20646
add_library(dummy_cs_project SHARED DummyCSFile.cs)
set_target_properties(dummy_cs_project PROPERTIES
LINKER_LANGUAGE CSharp
Expand All @@ -11,6 +14,7 @@ set_target_properties(dummy_cs_project PROPERTIES

add_library(installer_omod SHARED)
mo2_configure_plugin(installer_omod WARNINGS OFF CLI ON)
target_link_libraries(installer_omod PRIVATE mo2::uibase)

# I'd like to use get_target_property(source_files ${PROJECT_NAME} SOURCES) as
# globbing is naughty, but need to filter out the things that aren't relative to this directory.
Expand Down Expand Up @@ -46,7 +50,7 @@ target_compile_definitions(installer_omod PRIVATE "NOGDI")
# aren't pulled in. We do need it to build first, though.
add_dependencies(installer_omod dummy_cs_project)

mo2_install_target(installer_omod FOLDER)
mo2_install_plugin(installer_omod FOLDER)

install(
FILES
Expand All @@ -55,7 +59,7 @@ install(
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/ICSharpCode.SharpZipLib.dll"
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/System.Drawing.Common.dll"
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/RtfPipe.dll"
DESTINATION "${MO2_INSTALL_PATH}/bin/plugins/installer_omod/"
DESTINATION bin/plugins/installer_omod/
)
install(
FILES "$<TARGET_PDB_FILE_DIR:${PROJECT_NAME}>/ICSharpCode.SharpZipLib.pdb"
Expand Down
2 changes: 1 addition & 1 deletion src/DummyCSFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ static void Stub2()
Rtf.ToHtml("");
}
}
}
}
22 changes: 11 additions & 11 deletions src/OMODFrameworkWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ using namespace cli;
#include <QTemporaryDir>
#include <QProgressDialog>

#include <imodinterface.h>
#include <imodlist.h>
#include <iplugingame.h>
#include <ipluginlist.h>
#include <igamefeatures.h>
#include <log.h>
#include <utility.h>
#include <registry.h>

#include <dataarchives.h>
#include <gameplugins.h>
#include <uibase/imodinterface.h>
#include <uibase/imodlist.h>
#include <uibase/iplugingame.h>
#include <uibase/ipluginlist.h>
#include <uibase/game_features/igamefeatures.h>
#include <uibase/log.h>
#include <uibase/utility.h>
#include <uibase/registry.h>

#include <uibase/game_features/dataarchives.h>
#include <uibase/game_features/gameplugins.h>

#include "implementations/CodeProgress.h"
#include "implementations/Logger.h"
Expand Down
4 changes: 2 additions & 2 deletions src/OMODFrameworkWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <QProgressDialog>
#include <QStack>

#include <iplugininstaller.h>
#include <uibase/iplugininstaller.h>

#include "implementations/CodeProgress.h"
#include "QObject_unique_ptr.h"
Expand Down Expand Up @@ -53,7 +53,7 @@ protected slots:
void pickModNameSlot(bool& successOut, MOBase::GuessedValue<QString>& modName);
void createModSlot(MOBase::IModInterface*& modInterfaceOut, MOBase::GuessedValue<QString>& modName);
void displayReadmeSlot(const QString& modName, const QString& readme);

void showWaitDialogSlot(QString message);
void hideWaitDialogSlot();

Expand Down
2 changes: 1 addition & 1 deletion src/implementations/Logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

using namespace cli;

#include <log.h>
#include <uibase/log.h>

ref class Logger : OMODFramework::ILogger
{
Expand Down
8 changes: 4 additions & 4 deletions src/implementations/ScriptFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
#include <QMessageBox>
#include <QScreen>

#include <iplugingame.h>
#include <ipluginlist.h>
#include <log.h>
#include <uibase/iplugingame.h>
#include <uibase/ipluginlist.h>
#include <uibase/log.h>

#include "../interop/QtDotNetConverters.h"
#include "../newstuff/rtfPopup.h"
Expand All @@ -20,7 +20,7 @@
ScriptFunctionsHelper::ScriptFunctionsHelper() : mMessageBoxHelper(make_unique<MessageBoxHelper>())
{
moveToThread(QApplication::instance()->thread());

connect(this, &ScriptFunctionsHelper::DialogSelectSignal, this, &ScriptFunctionsHelper::DialogSelectSlot, Qt::BlockingQueuedConnection);
connect(this, &ScriptFunctionsHelper::InputStringSignal, this, &ScriptFunctionsHelper::InputStringSlot, Qt::BlockingQueuedConnection);
connect(this, &ScriptFunctionsHelper::DisplayImageSignal, this, &ScriptFunctionsHelper::DisplayImageSlot, Qt::BlockingQueuedConnection);
Expand Down
2 changes: 1 addition & 1 deletion src/implementations/ScriptFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using namespace cli;

#include <QWidget>

#include <imoinfo.h>
#include <uibase/imoinfo.h>

#include "../MessageBoxHelper.h"
#include "../QObject_unique_ptr.h"
Expand Down
4 changes: 2 additions & 2 deletions src/installerOmod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#include <QRegularExpression>
#include <QTemporaryFile>

#include <iplugingame.h>
#include <log.h>
#include <uibase/iplugingame.h>
#include <uibase/log.h>

#include "OMODFrameworkWrapper.h"

Expand Down
4 changes: 2 additions & 2 deletions src/installerOmod.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#include <QTemporaryFile>

#include <iplugininstallercustom.h>
#include <ipluginfilemapper.h>
#include <uibase/iplugininstallercustom.h>
#include <uibase/ipluginfilemapper.h>

#include "OMODFrameworkWrapper.h"

Expand Down
2 changes: 1 addition & 1 deletion src/newstuff/namedialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <QDialog>

#include <guessedvalue.h>
#include <uibase/guessedvalue.h>

#include "ui_namedialog.h"

Expand Down
2 changes: 1 addition & 1 deletion src/oldstuff/DialogSelect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ std::optional<QVector<int>> DialogSelect(
rightInner = new QWidget(right);
rightScrollArea->setWidget(rightInner);
rightScrollArea->setWidgetResizable(true);

rightInnerLayout = new QVBoxLayout(rightInner);
}
else
Expand Down
2 changes: 1 addition & 1 deletion src/oldstuff/folder.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
This is stuff I'm just lifting from my original attempt at an OMOD installer. It's probably terrible and I'm barely going to fix it. I expect and want other MO2 devs to rework/replace it with something better.
This is stuff I'm just lifting from my original attempt at an OMOD installer. It's probably terrible and I'm barely going to fix it. I expect and want other MO2 devs to rework/replace it with something better.
15 changes: 15 additions & 0 deletions vcpkg.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}