Skip to content

Commit 4deb451

Browse files
authored
Merge pull request #12 from ModOrganizer2/dev/vcpkg
1 parent f6c7a51 commit 4deb451

10 files changed

Lines changed: 136 additions & 23 deletions

File tree

.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 Preview Base Plugin
1+
name: Build Preview Base
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 Preview Base Plugin
16+
- name: Build Preview Base
17+
id: build-preview-base
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: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
cmake_minimum_required(VERSION 3.16)
22

3-
if(DEFINED DEPENDENCIES_DIR)
4-
include(${DEPENDENCIES_DIR}/modorganizer_super/cmake_common/mo2.cmake)
5-
else()
6-
include(${CMAKE_CURRENT_LIST_DIR}/../cmake_common/mo2.cmake)
7-
endif()
8-
93
project(preview_base)
4+
105
add_subdirectory(src)

CMakePresets.json

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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+
"cacheVariables": {
16+
"VCPKG_MANIFEST_NO_DEFAULT_FEATURES": {
17+
"type": "BOOL",
18+
"value": "ON"
19+
}
20+
},
21+
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
22+
"hidden": true,
23+
"name": "vcpkg"
24+
},
25+
{
26+
"hidden": true,
27+
"inherits": ["vcpkg"],
28+
"name": "vcpkg-dev"
29+
},
30+
{
31+
"binaryDir": "${sourceDir}/vsbuild",
32+
"architecture": {
33+
"strategy": "set",
34+
"value": "x64"
35+
},
36+
"cacheVariables": {
37+
"CMAKE_CXX_FLAGS": "/EHsc /MP /W4",
38+
"VCPKG_TARGET_TRIPLET": {
39+
"type": "STRING",
40+
"value": "x64-windows-static-md"
41+
}
42+
},
43+
"generator": "Visual Studio 17 2022",
44+
"inherits": ["cmake-dev", "vcpkg-dev"],
45+
"name": "vs2022-windows",
46+
"toolset": "v143"
47+
},
48+
{
49+
"cacheVariables": {
50+
"VCPKG_MANIFEST_FEATURES": {
51+
"type": "STRING",
52+
"value": "standalone"
53+
}
54+
},
55+
"inherits": "vs2022-windows",
56+
"name": "vs2022-windows-standalone"
57+
}
58+
],
59+
"buildPresets": [
60+
{
61+
"name": "vs2022-windows",
62+
"resolvePackageReferences": "on",
63+
"configurePreset": "vs2022-windows"
64+
}
65+
],
66+
"version": 4
67+
}

src/CMakeLists.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
cmake_minimum_required(VERSION 3.16)
22

3-
add_library(preview_base SHARED)
4-
mo2_configure_plugin(preview_base WARNINGS OFF)
5-
mo2_install_target(preview_base)
3+
find_package(mo2-cmake CONFIG REQUIRED)
4+
find_package(mo2-uibase CONFIG REQUIRED)
5+
6+
add_library(preview_base SHARED previewbase.cpp previewbase.h)
7+
mo2_configure_plugin(preview_base NO_SOURCES WARNINGS 4)
8+
target_link_libraries(preview_base PRIVATE mo2::uibase)
9+
mo2_install_plugin(preview_base)

src/preview_base_en.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@
44
<context>
55
<name>PreviewBase</name>
66
<message>
7-
<location filename="previewbase.cpp" line="84"/>
7+
<location filename="previewbase.cpp" line="86"/>
88
<source>Preview Base</source>
99
<translation type="unfinished"></translation>
1010
</message>
1111
<message>
12-
<location filename="previewbase.cpp" line="94"/>
12+
<location filename="previewbase.cpp" line="96"/>
1313
<source>Supports previewing various types of data files</source>
1414
<translation type="unfinished"></translation>
1515
</message>
1616
<message>
17-
<location filename="previewbase.cpp" line="107"/>
17+
<location filename="previewbase.cpp" line="109"/>
1818
<source>Enable previewing of basic file types, such as images and text files.</source>
1919
<translation type="unfinished"></translation>
2020
</message>
2121
<message>
22-
<location filename="previewbase.cpp" line="111"/>
22+
<location filename="previewbase.cpp" line="113"/>
2323
<source>Specify a list of comma separated extensions (without &quot;.&quot;) that should not be previewed by this plugin.</source>
2424
<translation type="unfinished"></translation>
2525
</message>

src/previewbase.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,16 @@ along with Base Preview plugin. If not, see <http://www.gnu.org/licenses/>.
1818
*/
1919

2020
#include "previewbase.h"
21+
2122
#include <QApplication>
2223
#include <QFileInfo>
2324
#include <QImageReader>
2425
#include <QLabel>
2526
#include <QScreen>
2627
#include <QTextEdit>
2728
#include <QtPlugin>
28-
#include <utility.h>
29+
30+
#include <uibase/utility.h>
2931

3032
using namespace MOBase;
3133

src/previewbase.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,15 @@ along with Base Preview plugin. If not, see <http://www.gnu.org/licenses/>.
2121
#define PREVIEWBASE_H
2222

2323
#include <functional>
24-
#include <ipluginpreview.h>
24+
25+
#include <uibase/ipluginpreview.h>
2526

2627
class PreviewBase : public MOBase::IPluginPreview
2728
{
2829

2930
Q_OBJECT
3031
Q_INTERFACES(MOBase::IPlugin MOBase::IPluginPreview)
31-
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
32-
Q_PLUGIN_METADATA(IID "org.tannin.PreviewBase" FILE "previewbase.json")
33-
#endif
32+
Q_PLUGIN_METADATA(IID "org.tannin.PreviewBase")
3433

3534
public:
3635
PreviewBase();

src/previewbase.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

vcpkg.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"features": {
3+
"standalone": {
4+
"description": "Build Standalone.",
5+
"dependencies": ["mo2-cmake", "mo2-uibase"]
6+
}
7+
},
8+
"vcpkg-configuration": {
9+
"default-registry": {
10+
"kind": "git",
11+
"repository": "https://github.com/Microsoft/vcpkg",
12+
"baseline": "294f76666c3000630d828703e675814c05a4fd43"
13+
},
14+
"registries": [
15+
{
16+
"kind": "git",
17+
"repository": "https://github.com/ModOrganizer2/vcpkg-registry",
18+
"baseline": "8beb2e0efa9c17dd6d17bb05288dd1e40727f673",
19+
"packages": ["mo2-*"]
20+
}
21+
]
22+
}
23+
}

0 commit comments

Comments
 (0)