From e888baf3ee06a649b160670ddf8420c17d4b8f69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=C3=ABl=20Capelle?= Date: Fri, 12 Jul 2024 14:58:22 +0200 Subject: [PATCH] Move to VCPKG. --- .github/workflows/build.yml | 39 +++++++++++++++++++++--- CMakeLists.txt | 6 ---- CMakePresets.json | 60 +++++++++++++++++++++++++++++++++++++ src/CMakeLists.txt | 7 +++-- src/SConscript | 15 ---------- src/installerBundle.pro | 31 ------------------- src/installerbundle.cpp | 3 +- src/installerbundle.h | 4 +-- src/installerbundle.json | 0 src/multiarchivedialog.h | 2 +- vcpkg.json | 16 ++++++++++ 11 files changed, 121 insertions(+), 62 deletions(-) create mode 100644 CMakePresets.json delete mode 100644 src/SConscript delete mode 100644 src/installerBundle.pro delete mode 100644 src/installerbundle.json create mode 100644 vcpkg.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f4b1230..cc1706f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build Installer Bundle Plugin +name: Build Installer Bundle on: push: @@ -6,11 +6,42 @@ 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 Bundle 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 Installer Bundle + shell: pwsh + run: | + cmake --preset vs2022-windows-standalone ` + "-DCMAKE_PREFIX_PATH=${env:QT_ROOT_DIR}\msvc2019_64" ` + "-DCMAKE_INSTALL_PREFIX=install" + + - name: Build Installer Bundle + run: cmake --build vsbuild --config RelWithDebInfo --target INSTALL diff --git a/CMakeLists.txt b/CMakeLists.txt index 2f947cb..6c48f9d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,10 +2,4 @@ cmake_minimum_required(VERSION 3.16) project(installer_bundle) -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 91844e6..cc70f28 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,5 +1,8 @@ -cmake_minimum_required(VERSION 3.16) + +find_package(mo2-cmake CONFIG REQUIRED) +find_package(mo2-uibase CONFIG REQUIRED) add_library(installer_bundle SHARED) mo2_configure_plugin(installer_bundle WARNINGS OFF) -mo2_install_target(installer_bundle) +target_link_libraries(installer_bundle PRIVATE mo2::uibase) +mo2_install_plugin(installer_bundle) diff --git a/src/SConscript b/src/SConscript deleted file mode 100644 index b0db551..0000000 --- a/src/SConscript +++ /dev/null @@ -1,15 +0,0 @@ -Import('qt_env') - -env = qt_env.Clone() - -env.DisableQtModules('Gui') -env.AppendUnique(CPPDEFINES = [ 'INSTALLERBUNDLE_LIBRARY' ]) - -# Sigh -env['CPPPATH'] += [ '.' ] - -lib = env.SharedLibrary('installerBundle', env.Glob('*.cpp')) -env.InstallModule(lib) - -res = env['QT_USED_MODULES'] -Return('res') diff --git a/src/installerBundle.pro b/src/installerBundle.pro deleted file mode 100644 index a5f52e6..0000000 --- a/src/installerBundle.pro +++ /dev/null @@ -1,31 +0,0 @@ -#------------------------------------------------- -# -# Project created by QtCreator 2013-01-03T13:31:41 -# -#------------------------------------------------- - -QT -= gui - -TARGET = installerBundle -TEMPLATE = lib - -CONFIG += plugins -CONFIG += dll - -CONFIG(release, debug|release) { - QMAKE_CXXFLAGS += /Zi - QMAKE_LFLAGS += /DEBUG -} - -DEFINES += INSTALLERBUNDLE_LIBRARY - -SOURCES += installerbundle.cpp - -HEADERS += installerbundle.h - - -include(../plugin_template.pri) - -OTHER_FILES += \ - installerbundle.json\ - SConscript diff --git a/src/installerbundle.cpp b/src/installerbundle.cpp index 6fe205f..65ea02f 100644 --- a/src/installerbundle.cpp +++ b/src/installerbundle.cpp @@ -18,10 +18,11 @@ along with Mod Organizer. If not, see . */ #include "installerbundle.h" -#include "iinstallationmanager.h" #include +#include + #include "multiarchivedialog.h" using namespace MOBase; diff --git a/src/installerbundle.h b/src/installerbundle.h index 885c6e9..59cc28c 100644 --- a/src/installerbundle.h +++ b/src/installerbundle.h @@ -20,7 +20,7 @@ along with Mod Organizer. If not, see . #ifndef INSTALLERBUNDLE_H #define INSTALLERBUNDLE_H -#include +#include class InstallerBundle : public MOBase::IPluginInstallerSimple { @@ -28,7 +28,7 @@ class InstallerBundle : public MOBase::IPluginInstallerSimple Q_OBJECT Q_INTERFACES(MOBase::IPlugin MOBase::IPluginInstaller MOBase::IPluginInstallerSimple) #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) - Q_PLUGIN_METADATA(IID "org.tannin.InstallerBundle" FILE "installerbundle.json") + Q_PLUGIN_METADATA(IID "org.tannin.InstallerBundle") #endif public: diff --git a/src/installerbundle.json b/src/installerbundle.json deleted file mode 100644 index e69de29..0000000 diff --git a/src/multiarchivedialog.h b/src/multiarchivedialog.h index 8995869..39949b9 100644 --- a/src/multiarchivedialog.h +++ b/src/multiarchivedialog.h @@ -24,7 +24,7 @@ along with Mod Organizer. If not, see . #include -#include "ifiletree.h" +#include namespace Ui { 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" + } + } +}