diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3185e6a..7e78949 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build Installer FOMOD C# Plugin +name: Build Installer FOMOD C# 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 FOMOD C# 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 FOMOD C# + 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 C# + run: cmake --build vsbuild --config RelWithDebInfo --target INSTALL diff --git a/CMakeLists.txt b/CMakeLists.txt index 3afad35..3170ab3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,10 +2,4 @@ cmake_minimum_required(VERSION 3.16) project(installer_fomod_csharp) -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 0577735..09b3015 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,7 +1,11 @@ cmake_minimum_required(VERSION 3.16) +find_package(mo2-cmake CONFIG REQUIRED) +find_package(mo2-uibase CONFIG REQUIRED) + add_library(installer_fomod_csharp SHARED) mo2_configure_plugin(installer_fomod_csharp WARNINGS OFF CLI ON) -mo2_install_target(installer_fomod_csharp) +target_link_libraries(installer_fomod_csharp PRIVATE mo2::uibase) +mo2_install_plugin(installer_fomod_csharp) set_target_properties(installer_fomod_csharp PROPERTIES CXX_STANDARD 20) diff --git a/src/base_script.cpp b/src/base_script.cpp index b80f9aa..5ec4e6e 100644 --- a/src/base_script.cpp +++ b/src/base_script.cpp @@ -15,39 +15,39 @@ You should have received a copy of the GNU General Public License along with Mod Organizer. If not, see . */ -// clang-format off - #include "base_script.h" #include #include -#include #include -#include -#include -#include #include -#include -#include +#include #include +#include +#include +#include +#include #include +#include -#include "imoinfo.h" -#include "iplugingame.h" -#include "ipluginlist.h" -#include "igamefeatures.h" -#include "iinstallationmanager.h" -#include "log.h" -#include "scriptextender.h" +#include +#include +#include +#include +#include +#include +#include -#include "psettings.h" -#include "installer_fomod_postdialog.h" #include "csharp_interface.h" #include "csharp_utils.h" +#include "installer_fomod_postdialog.h" +#include "psettings.h" using namespace MOBase; +// clang-format off + namespace CSharp { // Pointer to object: diff --git a/src/base_script.h b/src/base_script.h index 1d3ff5d..8f427b9 100644 --- a/src/base_script.h +++ b/src/base_script.h @@ -24,7 +24,7 @@ along with Mod Organizer. If not, see . #using #using -#include +#include /** * Note: The specification of BaseScript where taken from the Nexus-Mods installer_fomod extension diff --git a/src/csharp_interface.cpp b/src/csharp_interface.cpp index fe5ea6e..7d3c38a 100644 --- a/src/csharp_interface.cpp +++ b/src/csharp_interface.cpp @@ -1,15 +1,15 @@ -// clang-format off - #include "csharp_interface.h" #include -#include #include +#include -#include "log.h" +#include -#include "csharp_utils.h" #include "base_script.h" +#include "csharp_utils.h" + +// clang-format off #using diff --git a/src/csharp_interface.h b/src/csharp_interface.h index fa209ca..4f22c20 100644 --- a/src/csharp_interface.h +++ b/src/csharp_interface.h @@ -3,8 +3,8 @@ #include -#include "ifiletree.h" -#include "iplugininstaller.h" +#include +#include namespace CSharp { diff --git a/src/installer_fomod_csharp.cpp b/src/installer_fomod_csharp.cpp index ba461f4..02d3a3e 100644 --- a/src/installer_fomod_csharp.cpp +++ b/src/installer_fomod_csharp.cpp @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with Mod Organizer. If not, see . */ -#include "iinstallationmanager.h" +#include #include "csharp_interface.h" #include "installer_fomod_csharp.h" @@ -145,7 +145,7 @@ InstallerFomodCSharp::install(MOBase::GuessedValue& modName, QStringList paths(manager()->extractFiles(toExtract)); // If user cancelled: - if (toExtract.size() != paths.size()) { + if (toExtract.size() != static_cast(paths.size())) { return EInstallResult::RESULT_CANCELED; } diff --git a/src/installer_fomod_csharp.h b/src/installer_fomod_csharp.h index 166b966..530db37 100644 --- a/src/installer_fomod_csharp.h +++ b/src/installer_fomod_csharp.h @@ -18,7 +18,7 @@ along with Mod Organizer. If not, see . #ifndef INSTALLER_FOMOD_CSHARP_H #define INSTALLER_FOMOD_CSHARP_H -#include "iplugininstallersimple.h" +#include class InstallerFomodCSharp : public MOBase::IPluginInstallerSimple { diff --git a/src/installer_fomod_predialog.h b/src/installer_fomod_predialog.h index 4c5dbd3..5c57fdf 100644 --- a/src/installer_fomod_predialog.h +++ b/src/installer_fomod_predialog.h @@ -3,7 +3,7 @@ #include "ui_installer_fomod_csharp_predialog.h" -#include "guessedvalue.h" +#include #include diff --git a/src/xml_info_reader.h b/src/xml_info_reader.h index 0170fcf..91d6d9a 100644 --- a/src/xml_info_reader.h +++ b/src/xml_info_reader.h @@ -8,8 +8,8 @@ #include #include -#include "log.h" -#include "utility.h" +#include +#include // This is from installer_fomod, but should probably not be duplicated here. diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 0000000..486b0fd --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,15 @@ +{ + "features": { + "standalone": { + "description": "Build Standalone.", + "dependencies": ["mo2-cmake", "mo2-uibase"] + } + }, + "vcpkg-configuration": { + "default-registry": { + "kind": "git", + "repository": "https://github.com/ModOrganizer2/vcpkg-registry", + "baseline": "d194ec4e14052784518d5e9f1c5ccac16de49c2c" + } + } +}