From 497eb0cd3cbe1ae94250ba126a61ac1e855cb339 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=C3=ABl=20Capelle?= Date: Fri, 12 Jul 2024 15:03:16 +0200 Subject: [PATCH] Move to VCPKG. --- .github/workflows/build.yml | 34 +++++++++++++-- CMakeLists.txt | 6 --- CMakePresets.json | 60 +++++++++++++++++++++++++++ src/CMakeLists.txt | 6 ++- src/SConscript | 28 ------------- src/fomodinstallerdialog.cpp | 29 ++++++------- src/fomodinstallerdialog.h | 12 +++--- src/fomodscreenshotdialog.cpp | 5 +-- src/installerFomod.pro | 50 ---------------------- src/installer_fomod_en.ts | 78 +++++++++++++++++------------------ src/installerfomod.cpp | 18 ++++---- src/installerfomod.h | 8 ++-- src/installerfomod.json | 1 - src/scalelabel.cpp | 1 + src/xmlreader.cpp | 3 +- vcpkg.json | 16 +++++++ 16 files changed, 189 insertions(+), 166 deletions(-) create mode 100644 CMakePresets.json delete mode 100644 src/SConscript delete mode 100644 src/installerFomod.pro delete mode 100644 src/installerfomod.json create mode 100644 vcpkg.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3088aa3..b9fcf17 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build Installer FOMOD Plugin +name: Build Installer FOMOD Library on: push: @@ -6,11 +6,37 @@ on: pull_request: types: [opened, synchronize, reopened] +env: + VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" + jobs: build: runs-on: windows-2022 steps: - - name: Build Installer FOMOD 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: Configure Installer FOMOD + shell: pwsh + run: | + cmake --preset vs2022-windows-standalone ` + "-DCMAKE_PREFIX_PATH=${env:QT_ROOT_DIR}\msvc2019_64" ` + "-DCMAKE_INSTALL_PREFIX=install" + + - name: Build Installer FOMOD + run: cmake --build vsbuild --config RelWithDebInfo --target INSTALL diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e68b55..1eeb93d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,10 +2,4 @@ cmake_minimum_required(VERSION 3.16) project(installer_fomod) -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) diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 0000000..16e1e6f --- /dev/null +++ b/CMakePresets.json @@ -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 +} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fc35d8a..75a4640 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,5 +1,9 @@ cmake_minimum_required(VERSION 3.16) +find_package(mo2-cmake CONFIG REQUIRED) +find_package(mo2-uibase CONFIG REQUIRED) + add_library(installer_fomod SHARED) mo2_configure_plugin(installer_fomod WARNINGS OFF) -mo2_install_target(installer_fomod) +target_link_libraries(installer_fomod PRIVATE mo2::uibase) +mo2_install_plugin(installer_fomod) diff --git a/src/SConscript b/src/SConscript deleted file mode 100644 index c2fa88c..0000000 --- a/src/SConscript +++ /dev/null @@ -1,28 +0,0 @@ -Import('qt_env') - -env = qt_env.Clone() - -env.Uic(env.Glob('*.ui')) - -env.AppendUnique(CPPDEFINES = [ - 'INSTALLERFOMOD_LIBRARY', - # boost uses things MS C++ is mldly unhappy about. - '_SCL_SECURE_NO_WARNINGS' -]) - -# can't use appendunique... -env['CPPPATH'] += [ '.', '../gamefeatures' ] - -env.AppendUnique(CPPPATH = [ - '${BOOSTPATH}' -]) - -env.AppendUnique(LIBS = [ - 'shell32' -]) - -lib = env.SharedLibrary('installerFomod', env.Glob('*.cpp')) -env.InstallModule(lib) - -res = env['QT_USED_MODULES'] -Return('res') diff --git a/src/fomodinstallerdialog.cpp b/src/fomodinstallerdialog.cpp index 1e685a4..b90f410 100644 --- a/src/fomodinstallerdialog.cpp +++ b/src/fomodinstallerdialog.cpp @@ -20,16 +20,10 @@ along with Mod Organizer. If not, see . #include "fomodinstallerdialog.h" #include "ui_fomodinstallerdialog.h" -#include "fomodscreenshotdialog.h" -#include "igamefeatures.h" -#include "imoinfo.h" -#include "iplugingame.h" -#include "log.h" -#include "report.h" -#include "scopeguard.h" -#include "scriptextender.h" -#include "utility.h" -#include "xmlreader.h" +#include +#include +#include +#include #include #include @@ -43,10 +37,17 @@ along with Mod Organizer. If not, see . #include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "fomodscreenshotdialog.h" +#include "xmlreader.h" using namespace MOBase; diff --git a/src/fomodinstallerdialog.h b/src/fomodinstallerdialog.h index 6d6c2d3..bd9f975 100644 --- a/src/fomodinstallerdialog.h +++ b/src/fomodinstallerdialog.h @@ -19,12 +19,6 @@ along with Mod Organizer. If not, see . #pragma once -#include "guessedvalue.h" -#include "ifiletree.h" -#include "imoinfo.h" -#include "iplugininstaller.h" -#include "ipluginlist.h" - #include #include #include @@ -34,6 +28,12 @@ along with Mod Organizer. If not, see . #include #include +#include +#include +#include +#include +#include + #include "installerfomod.h" class QAbstractButton; diff --git a/src/fomodscreenshotdialog.cpp b/src/fomodscreenshotdialog.cpp index a7d1029..568faa4 100644 --- a/src/fomodscreenshotdialog.cpp +++ b/src/fomodscreenshotdialog.cpp @@ -16,12 +16,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Mod Organizer. If not, see . */ - #include "fomodscreenshotdialog.h" #include "ui_fomodscreenshotdialog.h" -#include "scalelabel.h" - #include #include #include @@ -30,6 +27,8 @@ along with Mod Organizer. If not, see . #include #include +#include "scalelabel.h" + constexpr int kScreenshotTileWidth = 100; constexpr int kScreenshotTileHeight = 80; constexpr int kScreenshotTileSpacing = 16; diff --git a/src/installerFomod.pro b/src/installerFomod.pro deleted file mode 100644 index e143230..0000000 --- a/src/installerFomod.pro +++ /dev/null @@ -1,50 +0,0 @@ -#------------------------------------------------- -# -# Project created by QtCreator 2013-01-01T19:24:15 -# -#------------------------------------------------- - -TARGET = installerFomod -TEMPLATE = lib - -greaterThan(QT_MAJOR_VERSION, 4): QT += widgets - -CONFIG += plugins -CONFIG += dll - -CONFIG(release, debug|release) { - QMAKE_CXXFLAGS += /Zi /wd4503 - QMAKE_LFLAGS += /DEBUG -} - -DEFINES += INSTALLERFOMOD_LIBRARY - -SOURCES += installerfomod.cpp \ - fomodinstallerdialog.cpp \ - fomodscreenshotdialog.cpp \ - scalelabel.cpp \ - xmlreader.cpp - -HEADERS += installerfomod.h \ - fomodinstallerdialog.h \ - fomodscreenshotdialog.h \ - scalelabel.h \ - xmlreader.h - -FORMS += \ - fomodinstallerdialog.ui \ - fomodscreenshotdialog.ui - -RESOURCES += \ - resources.qrc - -OTHER_FILES += \ - installerfomod.json\ - SConscript\ - CMakeLists.txt - -include(../plugin_template.pri) - -INCLUDEPATH += "$${BOOSTPATH}" -INCLUDEPATH += ../gamefeatures - diff --git a/src/installer_fomod_en.ts b/src/installer_fomod_en.ts index 23b61e1..9fb5bf0 100644 --- a/src/installer_fomod_en.ts +++ b/src/installer_fomod_en.ts @@ -45,144 +45,144 @@ - - + + Next - + Cancel - + Failed to parse %1. See console for details. - + %1 missing. - + At least one condition was successful in an 'OR' clause! - + All conditions were successful in an 'AND' clause! - + No conditions were successful in an 'OR' clause! - + invalid plugin state %1 - + Missing - + Inactive - + Active - + Success: The file '%1' was marked %2. - + Missing requirement: The file '%1' should be %2, but was %3! - + Success: The required version of %1 is %2, and was detected as %3. - + Missing requirement: The required version of %1 is %2, but was detected as %3. - + Missing files or folders - + Install anyway - + The following files or folders were not found in the archive. This is likely due to an incorrect FOMOD installer. This mod may not work properly. - + Folder '%1'. - + File '%1'. - + <a href="%1">Link</a> - + unsupported order type %1 - + unsupported group type %1 - + All components in this group are required - + None - + Select one or more of these options: - + The flag '%1' matched '%2' - + The flag '%1' did not match '%2' @@ -207,32 +207,32 @@ - + Install - + This component is required - + It is recommended you enable this component - + Optional component - + This component is not usable in combination with other installed plugins - + You may be experiencing instability in combination with other installed plugins @@ -240,17 +240,17 @@ InstallerFomod - + Installer for xml based fomod archives. - + Fomod Installer - + Installation as fomod failed: %1 @@ -261,7 +261,7 @@ - + invalid problem key %1 diff --git a/src/installerfomod.cpp b/src/installerfomod.cpp index 8d50c82..51fcd06 100644 --- a/src/installerfomod.cpp +++ b/src/installerfomod.cpp @@ -1,18 +1,18 @@ #include "installerfomod.h" -#include "fomodinstallerdialog.h" -#include "imodinterface.h" -#include "imodlist.h" - -#include -#include -#include -#include - #include #include #include +#include +#include +#include +#include +#include +#include + +#include "fomodinstallerdialog.h" + using namespace MOBase; InstallerFomod::InstallerFomod() : m_MOInfo(nullptr) {} diff --git a/src/installerfomod.h b/src/installerfomod.h index 303c269..1ba8ed8 100644 --- a/src/installerfomod.h +++ b/src/installerfomod.h @@ -1,9 +1,9 @@ #ifndef INSTALLERFOMOD_H #define INSTALLERFOMOD_H -#include -#include -#include +#include +#include +#include class InstallerFomod : public MOBase::IPluginInstallerSimple, public MOBase::IPluginDiagnose @@ -13,7 +13,7 @@ class InstallerFomod : public MOBase::IPluginInstallerSimple, Q_INTERFACES(MOBase::IPlugin MOBase::IPluginInstaller MOBase::IPluginInstallerSimple MOBase::IPluginDiagnose) #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) - Q_PLUGIN_METADATA(IID "org.tannin.InstallerFomod" FILE "installerfomod.json") + Q_PLUGIN_METADATA(IID "org.tannin.InstallerFomod") #endif public: diff --git a/src/installerfomod.json b/src/installerfomod.json deleted file mode 100644 index 69a88e3..0000000 --- a/src/installerfomod.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/src/scalelabel.cpp b/src/scalelabel.cpp index ec9c745..e654bf5 100644 --- a/src/scalelabel.cpp +++ b/src/scalelabel.cpp @@ -1,4 +1,5 @@ #include "scalelabel.h" + #include static bool isResourceMovie(const QString& path) diff --git a/src/xmlreader.cpp b/src/xmlreader.cpp index 038b545..cd0b8ab 100644 --- a/src/xmlreader.cpp +++ b/src/xmlreader.cpp @@ -1,8 +1,9 @@ #include "xmlreader.h" -#include "utility.h" #include +#include + using MOBase::Exception; bool XmlReader::getNextElement(QString const& start) diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 0000000..c88f540 --- /dev/null +++ b/vcpkg.json @@ -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" + } + } +}