Skip to content

Commit 934de77

Browse files
authored
Move to VCPKG. (#14)
1 parent 9d59d54 commit 934de77

17 files changed

Lines changed: 137 additions & 41 deletions

.github/workflows/build.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1-
name: Build Installer OMOD Plugin
1+
name: Build Installer OMOD
22

33
on:
44
push:
5-
branches: master
5+
branches: [master]
66
pull_request:
77
types: [opened, synchronize, reopened]
88

9+
env:
10+
VCPKG_BINARY_SOURCES: clear;x-azblob,${{ vars.AZ_BLOB_VCPKG_URL }},${{ secrets.AZ_BLOB_SAS }},readwrite
11+
912
jobs:
1013
build:
1114
runs-on: windows-2022
1215
steps:
13-
- name: Build Installer OMOD Plugin
16+
- name: Build Installer OMOD
17+
id: build-installer-omod
1418
uses: ModOrganizer2/build-with-mob-action@master
1519
with:
16-
mo2-dependencies: cmake_common uibase
20+
mo2-dependencies: uibase

.pre-commit-config.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v5.0.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-merge-conflict
8+
- id: check-case-conflict
9+
# - repo: https://github.com/pre-commit/mirrors-clang-format
10+
# rev: v19.1.5
11+
# hooks:
12+
# - id: clang-format
13+
# 'types_or': [c++, c]
14+
15+
ci:
16+
autofix_commit_msg: "[pre-commit.ci] Auto fixes from pre-commit.com hooks."
17+
autofix_prs: true
18+
autoupdate_commit_msg: "[pre-commit.ci] Pre-commit autoupdate."
19+
autoupdate_schedule: quarterly
20+
submodules: false

CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
# CMake 3.18 due to https://gitlab.kitware.com/cmake/cmake/-/issues/20764
22
cmake_minimum_required(VERSION 3.18)
33

4-
if(DEFINED DEPENDENCIES_DIR)
5-
include(${DEPENDENCIES_DIR}/modorganizer_super/cmake_common/mo2.cmake)
6-
else()
7-
include(${CMAKE_CURRENT_LIST_DIR}/../cmake_common/mo2.cmake)
8-
endif()
9-
104
# set globally as Nuget gets confused about ZERO_CHECK, ALL_BUILD and INSTALL otherwise
115
set(CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION "v4.8")
126

CMakePresets.json

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"configurePresets": [
3+
{
4+
"errors": {
5+
"deprecated": true
6+
},
7+
"hidden": true,
8+
"name": "cmake-dev",
9+
"warnings": {
10+
"deprecated": true,
11+
"dev": true
12+
}
13+
},
14+
{
15+
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
16+
"hidden": true,
17+
"name": "vcpkg"
18+
},
19+
{
20+
"binaryDir": "${sourceDir}/vsbuild",
21+
"architecture": {
22+
"strategy": "set",
23+
"value": "x64"
24+
},
25+
"cacheVariables": {
26+
"CMAKE_VS_NUGET_PACKAGE_RESTORE": {
27+
"type": "BOOL",
28+
"value": "ON"
29+
},
30+
"INSTALL_REQUIRES_VS_PACKAGE_RESTORE": {
31+
"type": "BOOL",
32+
"value": "ON"
33+
}
34+
},
35+
"generator": "Visual Studio 17 2022",
36+
"inherits": ["cmake-dev", "vcpkg"],
37+
"name": "vs2022-windows",
38+
"toolset": "v143"
39+
},
40+
{
41+
"cacheVariables": {
42+
"VCPKG_MANIFEST_FEATURES": {
43+
"type": "STRING",
44+
"value": "standalone"
45+
}
46+
},
47+
"inherits": "vs2022-windows",
48+
"name": "vs2022-windows-standalone"
49+
}
50+
],
51+
"buildPresets": [
52+
{
53+
"name": "vs2022-windows",
54+
"resolvePackageReferences": "on",
55+
"configurePreset": "vs2022-windows"
56+
}
57+
],
58+
"version": 4
59+
}

src/CMakeLists.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
cmake_minimum_required(VERSION 3.16)
1+
# 3.23 for CMAKE_VS_NUGET_PACKAGE_RESTORE
2+
cmake_minimum_required(VERSION 3.23)
3+
4+
find_package(mo2-cmake CONFIG REQUIRED)
5+
find_package(mo2-uibase CONFIG REQUIRED)
26

37
# Dummy .NET library as VS_PACKAGE_REFERENCES doesn't work on C++/CLI projects yet
48
# Needs to be declared before cmake_common stuff is included as that polutes the environment and makes C# get compiled as C++
5-
# 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
69
add_library(dummy_cs_project SHARED DummyCSFile.cs)
710
set_target_properties(dummy_cs_project PROPERTIES
811
LINKER_LANGUAGE CSharp
@@ -11,6 +14,7 @@ set_target_properties(dummy_cs_project PROPERTIES
1114

1215
add_library(installer_omod SHARED)
1316
mo2_configure_plugin(installer_omod WARNINGS OFF CLI ON)
17+
target_link_libraries(installer_omod PRIVATE mo2::uibase)
1418

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

49-
mo2_install_target(installer_omod FOLDER)
53+
mo2_install_plugin(installer_omod FOLDER)
5054

5155
install(
5256
FILES
@@ -55,7 +59,7 @@ install(
5559
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/ICSharpCode.SharpZipLib.dll"
5660
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/System.Drawing.Common.dll"
5761
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/RtfPipe.dll"
58-
DESTINATION "${MO2_INSTALL_PATH}/bin/plugins/installer_omod/"
62+
DESTINATION bin/plugins/installer_omod/
5963
)
6064
install(
6165
FILES "$<TARGET_PDB_FILE_DIR:${PROJECT_NAME}>/ICSharpCode.SharpZipLib.pdb"

src/DummyCSFile.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ static void Stub2()
1313
Rtf.ToHtml("");
1414
}
1515
}
16-
}
16+
}

src/OMODFrameworkWrapper.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ using namespace cli;
1010
#include <QTemporaryDir>
1111
#include <QProgressDialog>
1212

13-
#include <imodinterface.h>
14-
#include <imodlist.h>
15-
#include <iplugingame.h>
16-
#include <ipluginlist.h>
17-
#include <igamefeatures.h>
18-
#include <log.h>
19-
#include <utility.h>
20-
#include <registry.h>
21-
22-
#include <dataarchives.h>
23-
#include <gameplugins.h>
13+
#include <uibase/imodinterface.h>
14+
#include <uibase/imodlist.h>
15+
#include <uibase/iplugingame.h>
16+
#include <uibase/ipluginlist.h>
17+
#include <uibase/game_features/igamefeatures.h>
18+
#include <uibase/log.h>
19+
#include <uibase/utility.h>
20+
#include <uibase/registry.h>
21+
22+
#include <uibase/game_features/dataarchives.h>
23+
#include <uibase/game_features/gameplugins.h>
2424

2525
#include "implementations/CodeProgress.h"
2626
#include "implementations/Logger.h"

src/OMODFrameworkWrapper.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <QProgressDialog>
55
#include <QStack>
66

7-
#include <iplugininstaller.h>
7+
#include <uibase/iplugininstaller.h>
88

99
#include "implementations/CodeProgress.h"
1010
#include "QObject_unique_ptr.h"
@@ -53,7 +53,7 @@ protected slots:
5353
void pickModNameSlot(bool& successOut, MOBase::GuessedValue<QString>& modName);
5454
void createModSlot(MOBase::IModInterface*& modInterfaceOut, MOBase::GuessedValue<QString>& modName);
5555
void displayReadmeSlot(const QString& modName, const QString& readme);
56-
56+
5757
void showWaitDialogSlot(QString message);
5858
void hideWaitDialogSlot();
5959

src/implementations/Logger.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
using namespace cli;
44

5-
#include <log.h>
5+
#include <uibase/log.h>
66

77
ref class Logger : OMODFramework::ILogger
88
{

src/implementations/ScriptFunctions.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
#include <QMessageBox>
1010
#include <QScreen>
1111

12-
#include <iplugingame.h>
13-
#include <ipluginlist.h>
14-
#include <log.h>
12+
#include <uibase/iplugingame.h>
13+
#include <uibase/ipluginlist.h>
14+
#include <uibase/log.h>
1515

1616
#include "../interop/QtDotNetConverters.h"
1717
#include "../newstuff/rtfPopup.h"
@@ -20,7 +20,7 @@
2020
ScriptFunctionsHelper::ScriptFunctionsHelper() : mMessageBoxHelper(make_unique<MessageBoxHelper>())
2121
{
2222
moveToThread(QApplication::instance()->thread());
23-
23+
2424
connect(this, &ScriptFunctionsHelper::DialogSelectSignal, this, &ScriptFunctionsHelper::DialogSelectSlot, Qt::BlockingQueuedConnection);
2525
connect(this, &ScriptFunctionsHelper::InputStringSignal, this, &ScriptFunctionsHelper::InputStringSlot, Qt::BlockingQueuedConnection);
2626
connect(this, &ScriptFunctionsHelper::DisplayImageSignal, this, &ScriptFunctionsHelper::DisplayImageSlot, Qt::BlockingQueuedConnection);

0 commit comments

Comments
 (0)