Skip to content

Commit

Permalink
Move to VCPKG.
Browse files Browse the repository at this point in the history
  • Loading branch information
Holt59 committed Aug 2, 2024
1 parent f6c7a51 commit 467a6d3
Show file tree
Hide file tree
Showing 9 changed files with 128 additions and 22 deletions.
39 changes: 35 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,47 @@
name: Build Preview Base Plugin
name: Build Preview Base

on:
push:
branches: master
pull_request:
types: [opened, synchronize, reopened]

env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"

jobs:
build:
runs-on: windows-2022
steps:
- name: Build Preview Base Plugin
uses: ModOrganizer2/build-with-mob-action@master
# https://learn.microsoft.com/en-us/vcpkg/consume/binary-caching-github-actions-cache
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
mo2-dependencies: cmake_common uibase
setup-python: false
version: 6.7.0
modules:
cache: true

- uses: actions/checkout@v4

- name: "Set environmental variables"
shell: bash
run: |
echo "VCPKG_ROOT=$VCPKG_INSTALLATION_ROOT" >> $GITHUB_ENV
- name: Configure Preview Base
shell: pwsh
run: |
cmake --preset vs2022-windows-standalone `
"-DCMAKE_PREFIX_PATH=${env:QT_ROOT_DIR}\msvc2019_64" `
"-DCMAKE_INSTALL_PREFIX=install"
- name: Build Preview Base
run: cmake --build vsbuild --config RelWithDebInfo --target INSTALL
7 changes: 1 addition & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
cmake_minimum_required(VERSION 3.16)

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

project(preview_base)

add_subdirectory(src)
60 changes: 60 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"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"
}
],
"version": 4
}
8 changes: 6 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
cmake_minimum_required(VERSION 3.16)

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

add_library(preview_base SHARED)
mo2_configure_plugin(preview_base WARNINGS OFF)
mo2_install_target(preview_base)
mo2_configure_plugin(preview_base WARNINGS 4)
target_link_libraries(preview_base PRIVATE mo2::uibase)
mo2_install_plugin(preview_base)
8 changes: 4 additions & 4 deletions src/preview_base_en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
<context>
<name>PreviewBase</name>
<message>
<location filename="previewbase.cpp" line="84"/>
<location filename="previewbase.cpp" line="86"/>
<source>Preview Base</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="previewbase.cpp" line="94"/>
<location filename="previewbase.cpp" line="96"/>
<source>Supports previewing various types of data files</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="previewbase.cpp" line="107"/>
<location filename="previewbase.cpp" line="109"/>
<source>Enable previewing of basic file types, such as images and text files.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="previewbase.cpp" line="111"/>
<location filename="previewbase.cpp" line="113"/>
<source>Specify a list of comma separated extensions (without &quot;.&quot;) that should not be previewed by this plugin.</source>
<translation type="unfinished"></translation>
</message>
Expand Down
4 changes: 3 additions & 1 deletion src/previewbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@ along with Base Preview plugin. If not, see <http://www.gnu.org/licenses/>.
*/

#include "previewbase.h"

#include <QApplication>
#include <QFileInfo>
#include <QImageReader>
#include <QLabel>
#include <QScreen>
#include <QTextEdit>
#include <QtPlugin>
#include <utility.h>

#include <uibase/utility.h>

using namespace MOBase;

Expand Down
7 changes: 3 additions & 4 deletions src/previewbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,15 @@ along with Base Preview plugin. If not, see <http://www.gnu.org/licenses/>.
#define PREVIEWBASE_H

#include <functional>
#include <ipluginpreview.h>

#include <uibase/ipluginpreview.h>

class PreviewBase : public MOBase::IPluginPreview
{

Q_OBJECT
Q_INTERFACES(MOBase::IPlugin MOBase::IPluginPreview)
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
Q_PLUGIN_METADATA(IID "org.tannin.PreviewBase" FILE "previewbase.json")
#endif
Q_PLUGIN_METADATA(IID "org.tannin.PreviewBase")

public:
PreviewBase();
Expand Down
1 change: 0 additions & 1 deletion src/previewbase.json

This file was deleted.

16 changes: 16 additions & 0 deletions vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"dependencies": ["mo2-cmake"],
"features": {
"standalone": {
"description": "Build Standalone.",
"dependencies": ["mo2-uibase"]
}
},
"vcpkg-configuration": {
"default-registry": {
"kind": "git",
"repository": "https://github.com/ModOrganizer2/vcpkg-registry",
"baseline": "d194ec4e14052784518d5e9f1c5ccac16de49c2c"
}
}
}

0 comments on commit 467a6d3

Please sign in to comment.